-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinc__r2gamecycle.pas
1440 lines (1178 loc) · 80.3 KB
/
inc__r2gamecycle.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{*******************************************************************************
NFK [R2]
Gaimcycle Library
Info:
This is main cycle.
Contains:
procedure Tmainform.DXTimerTimer(Sender: TObject);
*******************************************************************************}
procedure Tmainform.DXTimerTimer(Sender: TObject);
var
i,a,obj : integer;
Msg: TMP_PlayerPosUpdate;
Msg2: TMP_HAUpdate;
Msg3: TMP_TimeUpdate;
Msg4: TMP_Ping;
Msg5: TMP_DropPlayer;
Msg6: TMP_SoundStatData;
MsgSize: word;
f : TMonosprite;
nott : boolean;
rct : trect;
str: string;
stx,sty : word;
stp,sti,z : byte;
tmp : byte;
c : word;
gxx,gyy : Smallint;
res,res2 : integer;
alpha,ccl : cardinal;
cccl : byte;
wdh: word; // conn: for messagemode
my: byte; // conn: to keem my players[index]
begin
//if SYS_CPUHACK
sleep(1); // conn: cpu hack
STIME := gettickcount;
if not OPT_PSYHODELIA then PowerGraph.Clear($FF000000+OPT_FILL_RGB);
PowerGraph.BeginScene();
PowerGraph.Antialias := true;
//PowerGraph.Antialias := false;
// ccl := gametic mod 2;
// ccl := gametic mod 3;
// powergraph.PutPixel ();
if font_alpha_dir = 1 then begin
if font_alpha <$FF then inc(font_alpha,5) else font_alpha_dir := 0;
end else
if font_alpha_dir = 0 then begin
if font_alpha >150 then dec(font_alpha,5) else font_alpha_dir := 1; end;
font_invalpha := 255 - font_alpha + 150;
if font_alpha_dir_s = 1 then begin
if font_alpha_s <$FD then inc(font_alpha_s,2) else font_alpha_dir_s := 0;
end else
if font_alpha_dir_s = 0 then begin
if font_alpha_s >200 then dec(font_alpha_s,2) else font_alpha_dir_s := 1; end;
font_invalpha_s := 255 - font_alpha_s + 200;
if SYS_DXINPUT then dxinput.Update;
if planet_frametime > 0 then dec(planet_frametime) else begin
planet_frametime := 2;
inc(planet_frame);
if planet_frame >= 25 then planet_frame := 0;
end;
// NFKAMP MP3 PLAYER
if (OPT_SOUND = true) and (SYS_NFKAMPSTATE = 1) then
with SND do begin
if (SYS_NFKAMPREFRESH = 50) then begin
IF (FSOUND_Stream_GetTime(Stream) = 0) or (FSOUND_Stream_GetLengthMs(Stream)=FSOUND_Stream_GetTime(Stream)) then begin
if SYS_NFKAMP_PLAYINGCOMMENT then musicStop else musicPlay();
end;
SYS_NFKAMPREFRESH := 0;
end else inc(SYS_NFKAMPREFRESH);
end;
// DXDraw.Surface.Fill(Conv24to16(RGB(OPT_BG_R, OPT_BG_G, OPT_BG_B)));
// Menu Draw.
if inmenu then begin
DRAWMENU;
Network_SendAllQueue();
exit;
end;
my := me;
// Anim Flag;
if SYS_FLAGFRAMERATE < 2 then inc(SYS_FLAGFRAMERATE) else begin
if SYS_FLAGFRAME < 13 then inc(SYS_FLAGFRAME) else SYS_FLAGFRAME := 0;
SYS_FLAGFRAMERATE := 0;
end;
// Anim DomFlag;
if SYS_DOMFRAMERATE < 2 then inc(SYS_DOMFRAMERATE) else begin
SYS_DOMFRAMERATE := 0;
end;
if mapcansel > 0 then dec(mapcansel);
if not inconsole then
if application.Active then
setcursorpos(320, 240);
for i := SYS_MAXPLAYERS-1 downto 0 do if players[i] <> nil then begin
playermove(i);
BD_FixAngle(i);
end;
// CAMERA
if OPT_CAMERATYPE = 1 then
if players[OPT_1BARTRAX] <> nil then begin
if (players[OPT_1BARTRAX].netobject=false) then begin
GX := -trunc(players[OPT_1BARTRAX].x)+mainform.powergraph.width div 2;
GY := -trunc(players[OPT_1BARTRAX].Y)+mainform.powergraph.height div 2;
end else begin
GX := -trunc(players[OPT_1BARTRAX].TESTPREDICT_X)+mainform.powergraph.width div 2;
GY := -trunc(players[OPT_1BARTRAX].TESTPREDICT_Y)+mainform.powergraph.height div 2;
end;
end;
obj := 0;
rct := rect(0,0,mainform.powergraph.width,mainform.powergraph.height);
if OPT_BGMOTION then begin
gxx := trunc(gx / 1.512);
gyy := trunc(gy / 1.512);
end else begin
gxx := gx;
gyy := gy;
end;
while (gxx < 0) do gxx := gxx + 256;
while (gyy < 0) do gyy := gyy + 256;
if not OPT_PSYHODELIA then begin
if OPT_BGMADNESS>0 then begin
//PowerGraph.antialias := true;
if SYS_BGANGLE < 255 then inc(SYS_BGANGLE) else SYS_BGANGLE := 0;
PowerGraph.RotateEffect(Images[10+OPT_BG], 320, 240, SYS_BGANGLE*OPT_BGMADNESS,768,0, effectNone);
//PowerGraph.antialias := false;
end else
{ if DRAW_BACKGROUND then BEGIN
if OPT_CAMERATYPE = 0 then begin
for i := 0 to 2 do for a := 0 to 1 do PowerGraph.
TextureMapRect(Images[10+OPT_BG], 256*i, 256*a,256,256 , 0, effectNone);
end else
for i := 0 to 3 do for a := 0 to 2 do PowerGraph.TextureMapRect
(Images[10+OPT_BG], 256*i+GXX-288,256*a+GYY-256, 256,256 , 0, effectNone);
end;
}
if DRAW_BACKGROUND then for i := 0 to (mainform.powergraph.width + 256) div 256 do for a := 0 to (mainform.powergraph.height + 256) div 256 do PowerGraph.TextureMapRect
(Images[10+OPT_BG], 256*i+GXX-288,256*a+GYY-256, 256, 256 , 0, effectNone);
end;
// if DRAW_BACKGROUND then for i := 0 to 2 do for a := 0 to 1 do PowerGraph.RenderEffect(Images[10+OPT_BG], 256*i, 256*a , 0, effectNone);
// DRAW background OBJECTs
//
for i := 0 to 1000 do if GameObjects[i] <> nil then begin // conn: many players fix? not working
if GameObjects[i].dead < 2 then
if GameObjects[i].topdraw = 0 then
if GameObjects[i].dead < 2 then begin
GameObjects[i].DoMove(100);
if GameObjects[i].objname = 'corpse' then CorpsePhysic(i); // many players error
if GameObjects[i].objname = 'shaft2' then if GameObjects[i].dead = 2 then addmessage('^3 OBJCYCLE DEAD!');
inc(obj);
end;
end;
// Draw Bricks
//
for i := 0 to BRICK_X-1 do // brickz
for a := 0 to BRICK_Y-1 do begin
if (AllBricks[i,a].image > 0) and (AllBricks[i,a].image< 54) then begin
// mark empty death
if (match_gametype<>GAMETYPE_TRIXARENA) or (match_startsin>0) then
if OPT_CONTENTEMPTYDEATHHIGHLIGHT then begin
if (AllBricks[i,a].image=CONTENT_EMPTY) then PowerGraph.FillRect(i*32+GX,a*16+GY,32,16,$33FFFF00,effectSrcAlpha or effectDiffuseAlpha);
if (AllBricks[i,a].image=CONTENT_DEATH) then PowerGraph.FillRect(i*32+GX,a*16+GY,32,16,$330000FF,effectSrcAlpha or effectDiffuseAlpha);
end;
// FLAG.
if isVisible(i,a,my) then
if MATCH_GAMETYPE = GAMETYPE_CTF then
if AllBricks[i,a].dir = 0 then
if inscreen(i*32,a*16,32) then
if (AllBricks[i,a].image = 40) or (AllBricks[i,a].image = 41) then begin
if (AllBricks[i,a].image = 40) then PowerGraph.RenderEffect(Images[47], i*32+GX+2, a*16-25+GY, SYS_FLAGFRAME, effectSrcAlpha);
if (AllBricks[i,a].image = 41) then PowerGraph.RenderEffect(Images[47], i*32+GX-6, a*16-25+GY, 14+SYS_FLAGFRAME, effectSrcAlpha or effectMirror);
end;
// DOM FLAG.
if MATCH_GAMETYPE = GAMETYPE_DOMINATION then
if (AllBricks[i,a].image = 42) then begin
if SYS_DOMFRAMERATE=0 then
if AllBricks[i,a].scale < 46 then inc(AllBricks[i,a].scale) else AllBricks[i,a].scale := 0;
if AllBricks[i,a].oy > 0 then AllBricks[i,a].oy := AllBricks[i,a].oy - 1 else AllBricks[i,a].oy := 0;
if isVisible(i,a,my) then
if inscreen(i*32,a*16,32) then begin
if MATCH_STARTSIN>0 then
case AllBricks[i,a].y of
0 : Font2s.textout('alpha',GX + Trunc(i*32) + 16 - Font2s.TextWidth('alpha') div 2,GY+a*16-40,clWhite);
1 : Font2s.textout('beta',GX + Trunc(i*32) + 16 - Font2s.TextWidth('beta') div 2,GY+a*16-40 ,clWhite);
2 : Font2s.textout('gamma',GX + Trunc(i*32) + 16 - Font2s.TextWidth('gamma') div 2,GY+a*16-40,clWhite);
end;
if AllBricks[i,a].dir <> C_TEAMNON then begin
PowerGraph.TextureMap(Images[52+AllBricks[i,a].dir],i*32+GX+4, a*16-25+GY, i*32+GX+28, a*16-25+GY,i*32+GX+28, a*16+16+GY, i*32+GX+4, a*16+16+GY,47, effectSrcAlpha);
PowerGraph.RenderEffect(Images[52+AllBricks[i,a].dir], i*32+GX+2, a*16-23+GY, AllBricks[i,a].scale, effectSrcAlpha);
end else begin
PowerGraph.TextureCol(Images[52],i*32+GX+4, a*16-25+GY, i*32+GX+28, a*16-25+GY,i*32+GX+28, a*16+16+GY, i*32+GX+4, a*16+16+GY, $66FFFFFF ,47, effectSrcAlpha or EffectDiffuseAlpha);
PowerGraph.RenderEffectCol (Images[52], i*32+GX+2, a*16-23+GY, $66000000,AllBricks[i,a].scale, effectSrcAlpha or EffectDiffuseAlpha);
end;
end;
end;
if ((AllBricks[i,a].image= 38) or (AllBricks[i,a].image=39)) and (inscreen(i*32,a*16,32)) then begin // jumppad
inc(AllBricks[i,a].dir);
if AllBricks[i,a].dir = 78 then AllBricks[i,a].dir := 0;
if AllBricks[i,a].dir >= 32 then
PowerGraph.RenderEffect(Images[24], i*32+GX, a*16+12+GY, 0, effectSrcAlpha) else
PowerGraph.RenderEffect(Images[24], i*32+GX, a*16+12+GY, AllBricks[i,a].dir div 2, effectSrcAlpha);
end else
if isVisible(i,a,my) then
if AllBricks[i,a].respawnable = true then begin
if AllBricks[i,a].scale < $FF then inc(AllBricks[i,a].scale,15);
if OPT_R_ALPHAITEMSRESPAWN then
alpha := AllBricks[i,a].scale else alpha := $FF;
// itemz
if IsItemRespawned(i,a) then begin
if inscreen(i*32,a*16,32) then begin
if (OPT_WEAPONFLOAT) and ((AllBricks[i,a].image = 17) OR (AllBricks[i,a].image = 18)) then begin// floating armors
//ARMORS. ANIMATED.
if (AllBricks[i,a].image = 17) then
PowerGraph.RenderEffectCol(Images[62], i*32+GX, a*16+GY + floatItem(5) , (alpha shl 24)+$FFFFFF, (STIME div 96) mod 20, effectSrcAlpha or $100) else
PowerGraph.RenderEffectCol(Images[62], i*32+GX, a*16+GY + floatItem(5) , (alpha shl 24)+$FFFFFF, (STIME div 96) mod 20+20, effectSrcAlpha or $100);
// conn: animated powerups, somewere here
{ hint:
Images[65].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_regen', Format2); // conn: animated powerups, regen
Images[66].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_quad', Format2); // quad
Images[67].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_mega', Format2); // ...
Images[68].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_invis', Format2); //
Images[69].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_haste', Format2); //
Images[70].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_fly', Format2); //
Images[71].LoadFromVTDb(VTDb,PowerGraph.D3DDevice8, 'fine_battle', Format2); //
[TODO] Optimize it!
}
end else if (AllBricks[i,a].image = 22) then begin // conn: animated powerups, mega
PowerGraph.RenderEffectCol(Images[67], i*32+GX+7, a*16+GY + floatItem(8) , 128,(alpha shl 24)+$FFFFFF, (STIME div 96) mod 12, effectSrcAlpha or $100);
end else if (AllBricks[i,a].image = 23) then begin // conn: animated powerups, regen
PowerGraph.RenderEffectCol(Images[65], i*32+GX, a*16+GY -10, (alpha shl 24)+$FFFFFF, (STIME div 96) mod 20, effectSrcAlpha or $100);
end else if (AllBricks[i,a].image = 24) then begin // conn: animated powerups, battlesuit
PowerGraph.RenderEffectCol(Images[71], i*32+GX, a*16+GY -10 , (alpha shl 24)+$FFFFFF, (STIME div 96) mod 20, effectSrcAlpha or $100);
end else if (AllBricks[i,a].image = 25) then begin // conn: animated powerups, haste
PowerGraph.RenderEffectCol(Images[69], i*32+GX, a*16+GY -10, (alpha shl 24)+$FFFFFF, (STIME div 96) mod 20, effectSrcAlpha or $100);
end else if (AllBricks[i,a].image = 26) then begin // conn: animated powerups, Quad
PowerGraph.RenderEffectCol(Images[66], i*32+GX, a*16+GY -10, (alpha shl 24)+$FFFFFF, (STIME div 96) mod 20, effectSrcAlpha or $100);
end else if (AllBricks[i,a].image = 27) then begin // conn: animated powerups, fly
PowerGraph.RenderEffectCol(Images[70], i*32+GX, a*16+GY -10, (alpha shl 24)+$FFFFFF, (STIME div 96) mod 20, effectSrcAlpha or $100);
end else if (AllBricks[i,a].image = 28) then begin // conn: animated powerups, invis
PowerGraph.RenderEffectCol(Images[68], i*32+GX, a*16+GY -10, (alpha shl 24)+$FFFFFF, (STIME div 96) mod 20, effectSrcAlpha or $100);
end else if (AllBricks[i,a].image>=18) and (AllBricks[i,a].image<=28) then begin // medikitz
if (AllBricks[i,a].y > 62) then AllBricks[i,a].y := 62;
if (AllBricks[i,a].y < 0) then AllBricks[i,a].y := 2;
if AllBricks[i,a].dir = 1 then begin
AllBricks[i,a].y := AllBricks[i,a].y + 1;
if AllBricks[i,a].y >= 30 then AllBricks[i,a].dir := 0;
end else
if AllBricks[i,a].dir = 0 then begin
AllBricks[i,a].y := AllBricks[i,a].y - 1;
if AllBricks[i,a].y <= 1 then AllBricks[i,a].dir := 1;
end;
if OPT_R_FLASHINGITEMS then
ccl := rgb($fE-AllBricks[i,a].y,$fE-AllBricks[i,a].y,$fE-AllBricks[i,a].y) else ccl:=$DDDDDD;
if (AllBricks[i,a].image=19) then begin // health +5
//PowerGraph.Antialias := true;
PowerGraph.RenderEffectCol(Images[37], trunc(i*32+GX)+4, trunc(a*16+GY)+4 + floatItem(8), 200,(alpha shl 24)+ccl, 0, effectSrcAlpha or effectDiffuseAlpha);
//PowerGraph.Antialias := False;
end else if (AllBricks[i,a].image>=20) and (AllBricks[i,a].image<=22) then
PowerGraph.RenderEffectCol(Images[37], trunc(i*32+GX), trunc(a*16+GY) + floatItem(8), (alpha shl 24)+ccl, AllBricks[i,a].image-19, effectSrcAlpha or effectDiffuseAlpha) else
PowerGraph.RenderEffectCol(Images[IMAGE_ITEM], trunc(i*32+GX), trunc(a*16+GY)+ floatItem(8), (alpha shl 24)+ccl, AllBricks[i,a].image, effectSrcAlpha or effectDiffuseAlpha);
end else
// other items
PowerGraph.RenderEffectCol(Images[IMAGE_ITEM], i*32+GX, a*16+GY + floatItem(8), (alpha shl 24)+$FFFFFF,AllBricks[i,a].image, effectSrcAlpha or effectDiffuseAlpha);//
end;//#inscreen(i*32,a*16,32)
end;//#IsItemRespawned(i,a)
end;
end else
//if isVisible(i,a,my) then
if (inscreen(i*32,a*16,32)) then begin
z := AllBricks[i,a].image;
if (G_BRICKREPLACE>0) and (z>=54) then z:= G_BRICKREPLACE;
if (z >= 54) and (z< 182) then begin
if (SYS_USECUSTOMPALETTE) and (G_BRICKREPLACE=0) then begin
if SYS_USECUSTOMPALETTE_TRANSPARENT then
PowerGraph.RenderEffect(Images[48], i*32+GX, a*16+GY, z-54, effectSrcAlpha)
else
PowerGraph.RenderEffect(Images[48], i*32+GX, a*16+GY, z-54, effectNone);
end else
PowerGraph.RenderEffect(Images[IMAGE_BR1], i*32+GX, a*16+GY, z-54, effectNone)
end
else if (z >= 181) then PowerGraph.RenderEffect(Images[IMAGE_BR2], i*32+GX, a*16+GY, z-182, effectNone);
end;
end;
// portals, doors, buttonz, etz.
if NUM_OBJECTS_0 = false then for z := 0 to NUM_OBJECTS do if MapObjects[z].active = true then
MAPOBJ_think(z);
//DRAW background OBJECTs
{ conn: moved behind the bricks
for i := 0 to 1000 do if GameObjects[i].dead < 2 then begin
if GameObjects[i].topdraw = 0 then
if GameObjects[i].dead < 2 then begin
GameObjects[i].DoMove(100);
if GameObjects[i].objname = 'corpse' then CorpsePhysic(i);
if GameObjects[i].objname = 'shaft2' then if GameObjects[i].dead = 2 then addmessage('^3 OBJCYCLE DEAD!');
inc(obj);
end;
end;
}
// DRAW PLAYERS
//
if draworder = 0 then begin
for i := SYS_MAXPLAYERS-1 downto 0 do if players[i] <> nil then
if (i = my) or (isVisible(players[i].x/32,players[i].y/16,my)) then begin
setcrosshairpos(players[i], players[i].x,players[i].y, players[i].clippixel,true);
PlayerAnim(i);
end
end
else for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then
if (i = my) or (isVisible(players[i].x/32,players[i].y/16,my)) then begin
setcrosshairpos(players[i], players[i].x,players[i].y, players[i].clippixel,true);
PlayerAnim(i);
end;
if random(2) = 0 then begin for i := SYS_MAXPLAYERS-1 downto 0 do if players[i] <> nil then ClipItems(players[i]); end
else begin for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then ClipItems(players[i]); end;
// secret code.
if SYS_BLOODRAIN then for i:= 0 to SYS_MAXPLAYERS-1 do
ParticleEngine.AddParticle(random(640),0,1-random(2),2+random(6),true);
ParticleEngine.Process();
// render bloooooooooooooooooood.
ParticleEngine.Render();
// a := ParticleEngine.Count;
// mainform.font1.textout(inttostr(players[0].clippixel ),0,0,clred);
// DRAW background OBJECTs
// conn: [?] LAYER1
for i := 0 to 1000 do if GameObjects[i].dead < 2 then begin
if GameObjects[i].topdraw = 1 then
if GameObjects[i].dead < 2 then begin
GameObjects[i].DoMove(100);
inc(obj);
end;
end;
// if this section is under commens, then REMOVE THIS SECTION
// if NUM_OBJECTS_0 = false then for z := 0 to NUM_OBJECTS do if MapObjects[z].active = true then
// MAPOBJ_think(z,true);
// Rewards\weapon anim
//
if draworder = 1 then begin for i := SYS_MAXPLAYERS-1 downto 0 do if players[i] <> nil then begin
if players[i].balloon then PowerGraph.RenderEffectCol(Images[34], trunc(players[i].TESTPREDICT_X-12)+GX, trunc(players[i].TESTPREDICT_Y-50)+GY,$DDFFFFFF, 4, effectSrcAlpha or effectDiffuseAlpha);
if isVisible(players[i].x/32,players[i].y/15,my) then if (players[i].item_invis=0) or ((players[i].netobject=false) and (players[i].idd <> 2 )) or (MATCH_DDEMOPLAY=true) then begin
// conn: shownames 2
if OPT_SHOWNAMES > 0 then
if players[i].health > GIB_DEATH then
if ((OPT_SHOWNAMES = 2) and (i<>me)) or (OPT_SHOWNAMES = 1) then
ParseColorText(players[i].netname,GX+trunc(players[i].TESTPREDICT_X)-GetColorTextWidth(players[i].netname,2) div 2,GY+trunc(players[i].TESTPREDICT_Y-40),2);
if (players[i].netobject=false) then begin
if ((INCONSOLE) or (MESSAGEMODE > 0)) and (players[i].idd<>2) then players[i].balloon := true else if (players[i].idd<>2)then players[i].balloon := false;
end;
if players[i].rewardtime > 0 then PowerGraph.RenderEffectCol(Images[34], trunc(players[i].TESTPREDICT_X-12)+GX, trunc(players[i].TESTPREDICT_Y-50)+GY,$DDFFFFFF, players[i].rewardtype -1, effectSrcAlpha or effectDiffuseAlpha);
end;
PlayerWeaponAnim(i);
end; end
else begin for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then begin
if players[i].balloon then PowerGraph.RenderEffectCol(Images[34], trunc(players[i].TESTPREDICT_X-12)+GX, trunc(players[i].TESTPREDICT_Y-50)+GY,$DDFFFFFF, 4, effectSrcAlpha or effectDiffuseAlpha);
if isVisible(players[i].x/32,players[i].y/16,my) then if (players[i].item_invis=0) or ((players[i].netobject=false) and (players[i].idd <> 2 )) or (MATCH_DDEMOPLAY=true) then begin
// conn: shownames 2
if OPT_SHOWNAMES > 0 then
if players[i].health > GIB_DEATH then
if ((OPT_SHOWNAMES = 2) and (i<>me)) or (OPT_SHOWNAMES = 1) then
ParseColorText(players[i].netname,GX+trunc(players[i].TESTPREDICT_X)-GetColorTextWidth(players[i].netname,2) div 2,GY+trunc(players[i].TESTPREDICT_Y-40),2);
// cool: PQRMod's teamhealth.
if (Not MATCH_DDEMOPLAY and OPT_TEAMHEALTH) then
if TeamGame then
if (players[i].team = MyTeamIS) and (i <> me) then
if players[i].health > 0 then begin
if players[i].health >= 100 then
ParseColorText('^7'+IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),
GX+trunc(players[i].TESTPREDICT_X)-GetColorTextWidth(IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),2) div 2,
GY+trunc(players[i].TESTPREDICT_Y-40)+68,2) else
if players[i].health >= 30 then
ParseColorText('^3'+IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),
GX+trunc(players[i].TESTPREDICT_X)-GetColorTextWidth(IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),2) div 2,
GY+trunc(players[i].TESTPREDICT_Y-40)+68,2) else
ParseColorText('^1'+IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),
GX+trunc(players[i].TESTPREDICT_X)-GetColorTextWidth(IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),2) div 2,
GY+trunc(players[i].TESTPREDICT_Y-40)+68,2);
end else
ParseColorText('^00/0',
GX+trunc(players[i].TESTPREDICT_X)-GetColorTextWidth('0/0',2) div 2,
GY+trunc(players[i].TESTPREDICT_Y-40)+68,2);
// Teamhealth end
// Demohealth ...
if (MATCH_DDEMOPLAY and OPT_DEMOHEALTH) then begin
if players[i].health > 0 then begin
if players[i].health >= 100 then
ParseColorText('^7'+IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),
GX+trunc(players[i].TESTPREDICT_X)-GetColorTextWidth(IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),2) div 2,
GY+trunc(players[i].TESTPREDICT_Y-40)+68,2) else
if players[i].health >= 30 then
ParseColorText('^3'+IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),
GX+trunc(players[i].TESTPREDICT_X)-GetColorTextWidth(IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),2) div 2,
GY+trunc(players[i].TESTPREDICT_Y-40)+68,2) else
ParseColorText('^1'+IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),
GX+trunc(players[i].TESTPREDICT_X)-GetColorTextWidth(IntToStr(players[i].health)+'/'+IntToStr(players[i].armor),2) div 2,
GY+trunc(players[i].TESTPREDICT_Y-40)+68,2);
end else
ParseColorText('^00/0',
GX+trunc(players[i].TESTPREDICT_X)-GetColorTextWidth('0/0',2) div 2,
GY+trunc(players[i].TESTPREDICT_Y-40)+68,2);
end;
// ... Demohealth
if (players[i].netobject=false) then begin
if ((INCONSOLE) or (MESSAGEMODE > 0)) and (players[i].idd<>2) then players[i].balloon := true else if(players[i].idd<>2)then players[i].balloon := false;
end;
if players[i].rewardtime > 0 then PowerGraph.RenderEffectCol(Images[34], trunc(players[i].TESTPREDICT_X-12)+GX, trunc(players[i].TESTPREDICT_Y-50)+GY,$DDFFFFFF, players[i].rewardtype -1, effectSrcAlpha or effectDiffuseAlpha);
end;
if isVisible(players[i].x/32,players[i].y/16,my) then
PlayerWeaponAnim(i);
end;
end;
// quad...
for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then if players[i].dead = 0 then begin
if OPT_FXQUAD then
if isVisible(players[i].x/32,players[i].y/16,my) then
if players[i].item_quad > 0 then begin
if (TeamGame) and (
(
(players[i].team = C_TEAMBLU) and (CG_SWAPSKINS)
) or (
(players[i].team = C_TEAMRED) and (CG_SWAPSKINS = false)
)
) and (OPT_FXQUAD) then
alpha := $880000FF else // red
alpha := $55FFFF00; // blue
//mainform.powergraph.Antialias := true;
mainform.powergraph.RotateEffect(mainform.images[54],round(players[i].TESTPREDICT_X)+gx,round(players[i].TESTPREDICT_Y)+gy,0,1024 - random(150),alpha,0,effectsrcalphaadd or effectdiffusealpha);
//mainform.powergraph.Antialias := false;
end;
if SYS_IAMMOON then begin
//mainform.powergraph.Antialias := true;
mainform.powergraph.RotateEffect(mainform.images[54],round(players[i].TESTPREDICT_X)+gx,round(players[i].TESTPREDICT_Y)+gy,0,2048 - random(300),$aaFFFFFF,0,effectsrcalphaadd or effectdiffusealpha);
//mainform.powergraph.Antialias := false;
end;
end;
// DRAW TOP OBJECTs
// LAYER2
for i := 0 to 1000 do if GameObjects[i].dead < 2 then begin
if GameObjects[i].topdraw = 2 then
if GameObjects[i].dead < 2 then begin
GameObjects[i].DoMove(100);
inc(obj);
end;
end;
stx := 0;
//trunc(cos(STIME/1300)*160), {trunc(sin(STIME/2000)*100)}0
// Draw Lava Anim
for i := 0 to BRICK_X-1 do
for a := 0 to BRICK_Y-1 do begin
if AllBricks[i,a].image=31 then
PowerGraph.RenderEffectCol2(Images[19], trunc(i*32+GX), trunc(a*16+GY), (OPT_R_WATERALPHA shl 24) +$FFFFFF , trunc(cos(STIME/1300)*160), {trunc(sin(STIME/2000)*100)}0, 32, 16, 0, effectSrcAlpha or effectDiffuseAlpha) else
if AllBricks[i,a].image=32 then
PowerGraph.RenderEffectCol2(Images[58], trunc(i*32+GX), trunc(a*16+GY), (OPT_R_WATERALPHA shl 24) +$FFFFFF , trunc(cos(STIME/1300)*160), {trunc(sin(STIME/2000)*100)}0, 32, 16, 0, effectSrcAlpha or effectDiffuseAlpha);
{
if AllBricks[i,a].image= 31 then begin
if AllBricks[i,a].respawntime > 0 then dec(AllBricks[i,a].respawntime);
if inscreen(i*32,a*16,32) then
PowerGraph.RenderEffectCol(Images[19], trunc(i*32+GX), trunc(a*16+GY), (OPT_R_WATERALPHA shl 24) +$FFFFFF , AllBricks[i,a].respawntime, effectSrcAlpha or effectDiffuseAlpha);
if AllBricks[i,a].respawntime = 0 then AllBricks[i,a].respawntime := 16;
end;
if AllBricks[i,a].image= 32 then begin
if AllBricks[i,a].respawntime > 0 then dec(AllBricks[i,a].respawntime);
if inscreen(i*32,a*16,32) then
PowerGraph.RenderEffectCol(Images[19], trunc(i*32+GX), trunc(a*16+GY), (OPT_R_WATERALPHA shl 24) +$FFFFFF , 16+AllBricks[i,a].respawntime, effectSrcAlpha or effectDiffuseAlpha);
if AllBricks[i,a].respawntime = 0 then AllBricks[i,a].respawntime := 16;
stx := AllBricks[i,a].respawntime;
end;
}
end;
// render area_waterillusion.
if NUM_OBJECTS_0 = false then for z := 0 to NUM_OBJECTS do if (MapObjects[z].active = true) and (MapObjects[z].objtype = 10) then begin
for res := 1 to MapObjects[z].special do for res2 := 1 to MapObjects[z].orient do
if AllBricks[MapObjects[z].x+res-1,MapObjects[z].y+res2-1].image <> 32 then
if inscreen(MapObjects[z].x*32+res*32-32,MapObjects[z].y*16+res2*16-16,32) then
PowerGraph.RenderEffectCol2(Images[58], trunc(MapObjects[z].x*32+res*32+GX-32), trunc(MapObjects[z].y*16+res2*16+GY-16), (OPT_R_WATERALPHA shl 24) +$FFFFFF , trunc(cos(STIME/1300)*160), 0, 32, 16, 0, effectSrcAlpha or effectDiffuseAlpha);
// PowerGraph.RenderEffectCol(Images[19], trunc(MapObjects[z].x*32+res*32+GX-32), trunc(MapObjects[z].y*16+res2*16+GY-16), (OPT_R_WATERALPHA shl 24) +$FFFFFF , 16+stx, effectSrcAlpha or effectDiffuseAlpha);
end;
// crosshairs
if not MATCH_DDEMOPLAY then
for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then begin
if players[i].idd = 0 then if players[i].dead =0 then if OPT_P1CROSH > 0 then if OPT_P1CROSHT>0 then
PowerGraph.RenderEffectCol(Images[27], trunc(players[i].cx-3+GX), trunc(players[i].cy-3+GY),$FF000000+ACOLOR[OPT_P1CROSH],OPT_P1CROSHT-1, effectSrcAlpha);
if players[i].idd = 1 then if players[i].dead =0 then if OPT_P2CROSH > 0 then if OPT_P2CROSHT>0 then
PowerGraph.RenderEffectCol(Images[27], trunc(players[i].cx-3+GX), trunc(players[i].cy-3+GY),$FF000000+ACOLOR[OPT_P2CROSH],OPT_P2CROSHT-1, effectSrcAlpha);
// if players[i].idd = 2 then if players[i].dead =0 then if OPT_P2CROSH > 0 then if OPT_P2CROSHT>0 then
// PowerGraph.RenderEffectCol(Images[27], trunc(players[i].cx-3+GX), trunc(players[i].cy-3+GY),$FF000000+ACOLOR[OPT_P2CROSH],OPT_P2CROSHT-1, effectSrcAlpha);
end;
if SYS_BLOODMONITOR then begin
//mainform.PowerGraph.Antialias := true;
mainform.PowerGraph.RenderEffect(mainform.Images[3], 0, -100,5200, 2, effectMUl);
mainform.PowerGraph.RenderEffect(mainform.Images[3], 0, -100,5200, 2, effectSrcAlphaAdd);
//mainform.PowerGraph.Antialias := false;
end;
// Draw Fog
//
z := me;
for i := 0 to (BRICK_X-1) do
for a := 0 to BRICK_Y-1 do begin
if not isVisible(i,a,z) then
PowerGraph.RenderEffectCol(Images[84],i*32+GX,a*16+GY,clSilver,0,effectMul);
end;
// At my birthday
if OPT_BIRTHDAY then begin
AddFireWorks(random(640), random(480));
PowerGraph.RenderEffect(Images[4], 114, round(cos(STIME/300)*50) + 120,0, effectSrcAlpha);
PowerGraph.RenderEffect(Images[4], 370, round(cos(STIME/300)*50) + 120, 1, effectSrcAlpha);
//PowerGraph.Antialias := true;
Font3.Scale := 448;
Font3.AlignedOut ('TODAY IS NEED FOR KILL',0,230+round(sin(STIME/400)*20),tacenter,tanone,$00FF00);
Font3.AlignedOut ('AUTHOR''s BIRTHDAY!!',0,280+round(sin(STIME/400)*20),tacenter,tanone,$00FF00);
Font3.AlignedOut ('HAPPY BIRTHDAY TO 3d[Power]',0,330+round(sin(STIME/400)*20),tacenter,tanone,$00FFFF);
Font3.Scale := 256;
Font3.AlignedOut ('Dont forget to leave your congratulation',0,380+round(sin(STIME/400)*20),tacenter,tanone,$FFFFFF);
Font3.AlignedOut ('messages at www.3dpower.org',0,400+round(sin(STIME/400)*20),tacenter,tanone,$FFFFFF);
//PowerGraph.Antialias := false;
end;
// HUD
if (players[OPT_1BARTRAX] <> nil) then begin
if p1weapbar > 0 then dec(p1weapbar);
if p1flashbar > 0 then flashstatusbar(1);
if not HUD_BigHudAvail then
PowerGraph.RenderEffectCol(Images[38],PowerGraph.Width-37,P1BARORIENT-1,(OPT_R_STATUSBARALPHA shl 24)+ $FFFFFF,p1flashbar div 3,EffectSrcAlpha or EffectDiffuseAlpha);
end;
if SYS_BAR2AVAILABLE then
if (players[OPT_2BARTRAX] <> nil) then begin
if p2weapbar > 0 then dec(p2weapbar);
if p2flashbar > 0 then flashstatusbar(2);
PowerGraph.RenderEffectCol(Images[38],0,P1BARORIENT-1,(OPT_R_STATUSBARALPHA shl 24)+ $FFFFFF,p2flashbar div 3,EffectSrcAlpha or EffectDiffuseAlpha);
end;
// PowerGraph.RenderEffectCol(Images[50],32*6+4,32*6,$DDFF7777,SYS_FLAGFRAME,EffectSrcAlphaAdd or effectDiffuseAlpha);
// player.air calculate.
if not MATCH_DDEMOPLAY then for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then if players[i].dead = 0 then begin
if players[i].crouch = false then begin
if IsWaterContentHEAD(players[i]) then begin
if players[i].air > 0 then dec(players[i].air);
end else players[i].air := SYS_MAXAIR; // ...GET AIR...
end;
if players[i].crouch = true then begin
if IsWaterContentCrouchHEAD(players[i]) then begin
if players[i].air > 0 then dec(players[i].air);
end else players[i].air := SYS_MAXAIR; // ...GET AIR...
end;
end;
// water HUD
if not MATCH_DDEMOPLAY then
if players[OPT_1BARTRAX]<>NIL then
if players[OPT_1BARTRAX].dead = 0 then
if players[OPT_1BARTRAX].air > 0 then begin
if players[OPT_1BARTRAX].crouch = false then
if IsWaterContentHEAD(players[OPT_1BARTRAX]) then
PowerGraph.FillRect(603-players[OPT_1BARTRAX].air div 10,P1BARORIENT+33,players[OPT_1BARTRAX].air div 10,5,clBlue,effectAdd);
if players[OPT_1BARTRAX].crouch = true then
if IsWaterContentCrouchHEAD(players[OPT_1BARTRAX]) then
PowerGraph.FillRect(603-players[OPT_1BARTRAX].air div 10,P1BARORIENT+33,players[OPT_1BARTRAX].air div 10,5,clBlue,effectAdd);
end;
if SYS_BAR2AVAILABLE then
if not MATCH_DDEMOPLAY then
if players[OPT_2BARTRAX]<>NIL then
if players[OPT_2BARTRAX].dead = 0 then
if players[OPT_2BARTRAX].air > 0 then begin
if players[OPT_2BARTRAX].crouch = false then
if IsWaterContentHEAD(players[OPT_2BARTRAX]) then
PowerGraph.FillRect(37,P1BARORIENT+33,players[OPT_2BARTRAX].air div 10,5,clBlue,effectAdd);
if players[OPT_2BARTRAX].crouch = true then
if IsWaterContentCrouchHEAD(players[OPT_2BARTRAX]) then
PowerGraph.FillRect(37,P1BARORIENT+33,players[OPT_2BARTRAX].air div 10,5,clBlue,effectAdd);
end;
// STATS image
if OPT_SHOWSTATS then begin
//powergraph.antialias := true;
SYS_P1STATSX := LinearInterpolation(SYS_P1STATSX,400,3);
SYS_P2STATSX := LinearInterpolation(SYS_P2STATSX,240,3);
if (players[OPT_1BARTRAX] <> nil) then
if not OPT_TRANSPASTATS then
PowerGraph.TextureMap(Images[41],SYS_P1STATSX,106,640,106,640,427,SYS_P1STATSX,427,0,effectNone);
if SYS_BAR2AVAILABLE then if (players[OPT_2BARTRAX] <> nil) then
if not OPT_TRANSPASTATS then
PowerGraph.TextureMap(Images[41],0,106,SYS_P2STATSX,106,SYS_P2STATSX,427,0,427,0,effectNone);
//powergraph.antialias := false;
end;
// powergraph.RenderEffect(images[54],100,100,512, 0,effectsrcalphaadd or effectdiffusealpha);
// powerup icons, shownickatsb
HUD_PowerIcons();
{ Font4.TextOut('BytesRecv:'+Inttostr(BNET1.BytesReceived),4,100,clLime);
Font4.TextOut('BytesSend:'+Inttostr(BNET1.BytesSent),4,120,clLime);
if BNET1.GuaranteedPacketsEnabled then
Font4.TextOut('PacketVerify: 1',4,140,clLime) else
Font4.TextOut('PacketVerify: 0',4,140,clLime);
}
// Demo Engine proce$$.
DEMOPLAREC();
// BOT
if BD_Avail then begin
BD_UpdatePlayers();
DLL_MainLoop();
end;
// mouse button POV CHANGE.
if CanSpectate then begin
mapcansel := 15;
applyHcommand('nextplayer');
end;
if players[OPT_1BARTRAX]<>nil then
if (players[OPT_1BARTRAX].netobject = false) and (players[OPT_1BARTRAX].ping >= 500) and (ismultip=2) then begin
Font3.AlignedOut (' Connection Interrupted',0,0,tacenter,tacenter,clwhite);
MainForm.PowerGraph.RenderEffectCol(MainForm.images[34],200,228,$FFFFFFFF,5,effectSRCALPHA or effectDiffuseAlpha);
MainForm.PowerGraph.RenderEffectCol(MainForm.images[34],200,228,((font_alpha div 2-75) shl 24)+ $FFFFFF,5,effectSRCALPHAADD or effectDiffuseAlpha);
end;
// cheat.
if SYS_MAGICLEVEL then begin
i := random(BRICK_X-1);
c := random(BRICK_Y-1);
if (AllBricks[i,c].image < 254) and (AllBricks[i,c].image > 53) then inc(AllBricks[i,c].image) else if AllBricks[i,c].image = 254 then AllBricks[i,c].image := 54;
end;
// server lava & wrong place check.
if ismultip=1 then for i := 0 to SYS_MAXPLAYERS-1 do if (players[i] <> nil) then if (players[i].netobject = true) then ClipTriggers(players[i]);
if (ismultip=1) and (OPT_SV_DEDICATED) and (MATCH_gameend) then
if STIME - dedicated_gameend_time > 15000 then begin
ApplyHCommand('restart');
dedicated_gameend_time := STIME;
end;
// second (sec) event.
// vote test
if ismultip=1 then if SVVOTE.voteActive then
if votetesttime < STIME then begin
VOTE_TestVote;
votetesttime := STIME+1000;
end;
if MATCH_gameend = false then begin
// voting
if ismultip=2 then begin
// we are in lag!
if pingrecv_tick < pingsend_tick then
if pingsend_tick - pingrecv_tick > 1500 then
for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then if players[i].netobject = false then players[i].ping := 999;
end;
if gametic < 50 then inc(gametic) else begin
// #second prosla
// shownames
if OPT_AUTOSHOWNAMESTIME = 1 then if OPT_AUTOSHOWNAMES then OPT_SHOWNAMES := 0;
if OPT_AUTOSHOWNAMESTIME > 0 then DEC(OPT_AUTOSHOWNAMESTIME);
if OPT_DRAWFRAGBAR then CalculateFragBar;
if MATCH_DDEMOPLAY then // demo powerups
for i := 0 to SYS_MAXPLAYERS-1 do
if players[i] <> nil then
if players[i].dead = 0 then begin
if players[i].item_regen > 0 then
if players[i].health < 200 then begin
SND.play(SND_regen,players[i].x,players[i].y);
players[i].item_regen_time := 15;
end;
if players[i].item_quad > 0 then dec(players[i].item_quad);
if players[i].item_regen > 0 then dec(players[i].item_regen);
if players[i].item_flight > 0 then dec(players[i].item_flight);
if players[i].item_invis > 0 then dec(players[i].item_invis);
if players[i].item_battle > 0 then dec(players[i].item_battle);
if players[i].item_haste > 0 then dec(players[i].item_haste);
end;
// ==================================================
if isMultiP=2 then begin // hels\armor. hud
starttime := STIME;
// network client powerups
for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then if players[i].dead = 0 then begin
if players[i].item_regen > 0 then
if players[i].health < 200 then begin
SND.play(SND_regen,players[i].x,players[i].y);
players[i].item_regen_time := 15;
end;
if players[i].item_quad > 0 then dec(players[i].item_quad);
if players[i].item_quad = 3 then SND.play(SND_damage2,players[i].x,players[i].y);
if (players[i].item_flight <= 4) and (players[i].item_flight > 1) then SND.play(SND_wearoff,players[i].x,players[i].y);
if (players[i].item_battle <= 4) and (players[i].item_battle > 1) then SND.play(SND_wearoff,players[i].x,players[i].y);
if (players[i].item_haste <= 4) and (players[i].item_haste > 1) then SND.play(SND_wearoff,players[i].x,players[i].y);
if players[i].item_regen > 0 then dec(players[i].item_regen);
if players[i].item_flight > 0 then dec(players[i].item_flight);
if players[i].item_invis > 0 then dec(players[i].item_invis);
if players[i].item_battle > 0 then dec(players[i].item_battle);
if players[i].item_haste > 0 then dec(players[i].item_haste);
if IsWaterContentHEAD(players[i]) then
if players[i].paintime = 0 then SpawnBubble(players[i]);
end;
for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then if players[i].netobject = false then begin
MsgSize := SizeOf(TMP_Ping);
Msg4.Data := MMP_PING;
Msg4.DXID := players[i].dxid;
Msg4.PING := players[i].ping;
pingsend_tick := STIME;
mainform.BNETSendData2HOST (Msg4, MsgSize, 0);
break;
end;
end else
// ==================================================
if isMultiP=1 then begin // send hels\armor data to client.
if MATCH_GAMETYPE = GAMETYPE_DOMINATION then DOM_Think();
// server drop timedout players.
for i := 0 to SYS_MAXPLAYERS-1 do if (players[i] <> nil) then if (players[i].netobject = true) and (players[i]. NETNoSignal > 999) then begin
// RETURNFLAG!
if (MATCH_GAMETYPE = GAMETYPE_CTF) and (players[i].flagcarrier = true) and (players[i].dead = 0) then begin
CTF_DropFlag(players[i]);
players[i].team := 2;
end;
MsgSize := SizeOf(TMP_DropPlayer);
Msg5.Data := MMP_DROPPLAYER;
Msg5.DXID := players[i].dxid;
RespawnFlash(players[i].x-16, players[i].y);
mainform.BNETSendData2All (Msg5, MsgSize, 1);
addmessage(players[i].netname+ ' ^7^ndropped by timeout.');
if MATCH_DRECORD then begin
DData.type0 := DDEMO_DROPPLAYER;
DData.gametic := gametic;
DData.gametime := gametime;
DemoStream.Write( DData, Sizeof(DData));
DNETKickDropPlayer.DXID := players[i].DXID;
DemoStream.Write( DNETKickDropPlayer, Sizeof(DNETKickDropPlayer));
end;
SV_Remember_Score_Add(players[i].netname, players[i].nfkmodel,players[i].frags);
if SYS_BOT then DLL_SYSTEM_RemovePlayer(players[i].DXID);
players[i] := nil;
//NFKPLANET_UpdateCurrentUsers (GetNumberOfPlayers);
nfkLive.UpdateCurrentUsers(GetNumberOfPlayers);
if GetNumberOfPlayers < BOT_MINPLAYERS then
ApplyHCommand('addbot');
break;
end;
// server players frags update.
for i := 0 to SYS_MAXPLAYERS-1 do if (players[i] <> nil) and (players[i].netobject = false) then
if (players[i].NETAmmo <> players[i].NETLastammo) or (players[i].frags <> players[i].NETFrags) or (players[i].health <> players[i].NEThealth) then begin
MsgSize := SizeOf(TMP_HAUpdate);
if players[i].weapon = 0 then MSG2.ammo := 0;
if players[i].weapon = 1 then MSG2.ammo := players[i].ammo_mg;
if players[i].weapon = 2 then MSG2.ammo := players[i].ammo_sg;
if players[i].weapon = 3 then MSG2.ammo := players[i].ammo_gl;
if players[i].weapon = 4 then MSG2.ammo := players[i].ammo_rl;
if players[i].weapon = 5 then MSG2.ammo := players[i].ammo_sh;
if players[i].weapon = 6 then MSG2.ammo := players[i].ammo_rg;
if players[i].weapon = 7 then MSG2.ammo := players[i].ammo_pl;
if players[i].weapon = 8 then MSG2.ammo := players[i].ammo_bfg;
Msg2.Data := MMP_HAUPDATE;
Msg2.DXID := players[i].dxid;
Msg2.health := players[i].health;
Msg2.armor := players[i].armor;
Msg2.frags := players[i].frags;
mainform.BNETSendData2All (Msg2, MsgSize, 0);
players[i].NETAmmo := not players[i].NETLastammo;
players[i].NETArmor := players[i].armor;
players[i].NEThealth := players[i].health;
players[i].NETfrags := players[i].frags;
end;
//****************
for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then if players[i].dead = 0 then begin
if players[i].health > 100 then if players[i].item_regen = 0 then dec(players[i].health);
if players[i].armor >100 then dec(players[i].armor);
// network server powerups
if players[i].item_regen > 0 then begin
if players[i].health < 200 then begin
players[i].health := players[i].health + 5;
SND.play(SND_regen,players[i].x,players[i].y);
players[i].item_regen_time := 15;
end;
if players[i].health > 200 then
players[i].health := 200;
end;
if players[i].item_quad > 0 then dec(players[i].item_quad);
if players[i].item_quad = 3 then SND.play(SND_damage2,players[i].x,players[i].y);
if (players[i].item_flight <= 4) and (players[i].item_flight > 1) then SND.play(SND_wearoff,players[i].x,players[i].y);
if (players[i].item_battle <= 4) and (players[i].item_battle > 1) then SND.play(SND_wearoff,players[i].x,players[i].y);
if (players[i].item_haste <= 4) and (players[i].item_haste > 1) then SND.play(SND_wearoff,players[i].x,players[i].y);
if players[i].item_regen > 0 then dec(players[i].item_regen);
if players[i].item_flight > 0 then dec(players[i].item_flight);
if players[i].item_invis > 0 then dec(players[i].item_invis);
if players[i].item_battle > 0 then dec(players[i].item_battle);
if players[i].item_haste > 0 then dec(players[i].item_haste);
// water check. here.
if players[i].crouch=false then
if IsWaterContentHEAD(players[i]) then begin
if players[i].air=0 then ApplyDamage(players[i],DMG_WATER+random(4),GameObjects[0],DIE_WATER)
else SpawnBubble(players[i]);
end;
if players[i].crouch=true then
if IsWaterContentCrouchHEAD(players[i]) then begin
if players[i].air=0 then ApplyDamage(players[i],DMG_WATER+random(4),GameObjects[0],DIE_WATER)
else SpawnBubble(players[i]);
end;
end;
// health\armor\frags update to clients.
for i := 0 to SYS_MAXPLAYERS-1 do if (players[i] <> nil) and (players[i].netobject = true) then
if (players[i].health <> players[i].NETHealth) or
(players[i].armor <> players[i].NETArmor) or
(players[i].frags <> players[i].NETFrags) then begin
MsgSize := SizeOf(TMP_HAUpdate);
Msg2.Data := MMP_HAUPDATE;
Msg2.DXID := players[i].dxid;
Msg2.health := players[i].health;
Msg2.armor := players[i].armor;
Msg2.frags := players[i].frags;
mainform.BNETSendData2All (Msg2, MsgSize, 0);
players[i].NETArmor := players[i].armor;
players[i].NEThealth := players[i].health;
players[i].NETfrags := players[i].frags;
end;
// TIME UPDATE;
MsgSize := SizeOf(TMP_TimeUpdate);
Msg3.Data := MMP_TIMEUPDATE;
iF MATCH_STARTSIN > 1 then begin
Msg3.WARMUP := TRUE;
Msg3.Min := (MATCH_STARTSIN+50) div 50;
end else begin
Msg3.Min := GAMETIME;
Msg3.WARMUP := false;
end;
mainform.BNETSendData2All (Msg3, MsgSize, 1);
end else
// ==================================================
if not MATCH_DDEMOPLAY then // not in demo!
for i := 0 to SYS_MAXPLAYERS-1 do
if players[i] <> nil then
if players[i].dead = 0 then begin
if players[i].item_regen > 0 then begin
if players[i].health < 200 then begin
players[i].health := players[i].health + 5;
SND.play(SND_regen,players[i].x,players[i].y);
players[i].item_regen_time := 15;
end;
if players[i].health > 200 then players[i].health := 200;
end;
if players[i].health > 100 then if players[i].item_regen = 0 then dec(players[i].health);
if players[i].armor >100 then dec(players[i].armor);
if players[i].item_quad > 0 then dec(players[i].item_quad);
if players[i].item_quad = 3 then SND.play(SND_damage2,players[i].x,players[i].y);
if (players[i].item_flight <= 4) and (players[i].item_flight > 1) then SND.play(SND_wearoff,players[i].x,players[i].y);
if (players[i].item_battle <= 4) and (players[i].item_battle > 1) then SND.play(SND_wearoff,players[i].x,players[i].y);
if (players[i].item_haste <= 4) and (players[i].item_haste > 1) then SND.play(SND_wearoff,players[i].x,players[i].y);
if players[i].item_regen > 0 then dec(players[i].item_regen);
if players[i].item_flight > 0 then dec(players[i].item_flight);
if players[i].item_invis > 0 then dec(players[i].item_invis);
if players[i].item_battle > 0 then dec(players[i].item_battle);
if players[i].item_haste > 0 then dec(players[i].item_haste);
// initial water damage.