-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinc__r2demos.pas
1535 lines (1397 loc) · 103 KB
/
inc__r2demos.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]
Demo Library
Info:
...
Contains:
procedure DEMO_AutoBarTrax;
procedure DEMOPLAREC;
procedure DEMOPLAREC;
*******************************************************************************}
procedure DEMO_AutoBarTrax;
begin
if OPT_1BARTRAX=0 then OPT_2BARTRAX := 1;
if OPT_1BARTRAX=1 then OPT_2BARTRAX := 0;
IF GetNumberOfPlayers>=3 then begin
SYS_BAR2AVAILABLE := false;
exit;
end;
IF GetNumberOfPlayers=1 then begin
SYS_BAR2AVAILABLE := false;
if players[OPT_1BARTRAX]=nil then OPT_1BARTRAX:=1;
exit;
end;
IF GetNumberOfPlayers=2 then
if ISHotSeatMap then begin
SYS_BAR2AVAILABLE := TRUE;
OPT_2BARTRAX := 1;
if OPT_1BARTRAX = OPT_2BARTRAX then begin
OPT_1BARTRAX := 0;
OPT_2BARTRAX := 1;
end;
// if players[OPT_1BARTRAX]=nil then inc(OPT_2BARTRAX);
// if players[OPT_2BARTRAX]=nil then if OPT_1BARTRAX <> 0 then OPT_2BARTRAX:=0 else OPT_1BARTRAX := 1;
exit;
end else SYS_BAR2AVAILABLE := false;
end;
//------------------------------------------------------------------------------
procedure WPN_DEMO_DropWeapon();
var z:byte;
i:word;
begin
// addmessage('PROC: ^3CTF_DEMO_DropFlag');
if not MATCH_DDEMOPLAY then exit;
if DData.type0 = DDEMO_WPN_EVENT_WEAPONDROP then
for z := 0 to SYS_MAXPLAYERS-1 do if players[z] <> nil then
if (players[z].dxid = DWPN_DropWeapon.DropperDXID) then
break;
for i := 0 to 1000 do
if GameObjects[i].dead = 2 then begin
GameObjects[i].objname := 'weapon';
GameObjects[i].x := DWPN_DropWeapon.X;
GameObjects[i].y := DWPN_DropWeapon.Y;
GameObjects[i].DXID := DWPN_DropWeapon.DXID;
GameObjects[i].dead := 0;
GameObjects[i].dude := true;
GameObjects[i].topdraw := 1;
GameObjects[i].frame := 0;
GameObjects[i].mass := 5;
GameObjects[i].weapon := 0;
GameObjects[i].health := 50*60 + 50*10; // one minute. + 10 sec.. (cuz networked removal).
if (DData.type0 = DDEMO_WPN_EVENT_WEAPONDROP) then begin
if (players[z].dir=0) or (players[z].dir=2) then
GameObjects[i].dir := 0 else GameObjects[i].dir := 1;
end else
GameObjects[i].dir := random(2);
GameObjects[i].imageindex := DWPN_DropWeapon.WeaponID;
GameObjects[i].inertiax := DWPN_DropWeapon.Inertiax;
GameObjects[i].inertiay := DWPN_DropWeapon.Inertiay;
GameObjects[i].clippixel := 4;
exit;
end;
end;
//------------------------------------------------------------------------------
procedure CTF_DEMO_DropFlag();
var z:byte;
i:word;
begin
// addmessage('PROC: ^3CTF_DEMO_DropFlag');
if not MATCH_DDEMOPLAY then exit;
if DData.type0 = DDEMO_CTF_EVENT_FLAGDROP then begin
CTF_Event_Message(DCTF_DropFlag.DropperDXID, 'lost');
for z := 0 to SYS_MAXPLAYERS-1 do if players[z] <> nil then
if (players[z].dxid = DCTF_DropFlag.DropperDXID) then begin
players[z].flagcarrier := false;
break;
end;
end;
for i := 0 to 1000 do
if GameObjects[i].dead = 2 then begin
GameObjects[i].objname := 'flag';
GameObjects[i].x := DCTF_DropFlag.X;
GameObjects[i].y := DCTF_DropFlag.Y;
GameObjects[i].DXID := DCTF_DropFlag.DXID;
GameObjects[i].dead := 0;
GameObjects[i].dude := true;
GameObjects[i].topdraw := 0;
GameObjects[i].frame := 0;
GameObjects[i].mass := 5;
GameObjects[i].weapon := 0;
GameObjects[i].health := 50*60 + 50*10; // one minute. + 10 sec.. (cuz networked removal).
if (DData.type0 = DDEMO_CTF_EVENT_FLAGDROP) then begin
if (players[z].dir=0) or (players[z].dir=2) then GameObjects[i].dir := 0 else GameObjects[i].dir := 1;
if players[z].team=0 then GameObjects[i].imageindex := 1 else GameObjects[i].imageindex := 0;
end else begin
GameObjects[i].dir := random(2);
GameObjects[i].imageindex := DCTF_DropFlag.DropperDXID;
end;
GameObjects[i].inertiax := DCTF_DropFlag.Inertiax;
GameObjects[i].inertiay := DCTF_DropFlag.Inertiay;
GameObjects[i].clippixel := 4;
exit;
end;
end;
//------------------------------------------------------------------------------
procedure CTF_SAVEDEMO_FlagDropGameState(sender : TMonoSprite);
begin
if not MATCH_DRECORD then exit;
DData.type0 := DDEMO_CTF_EVENT_FLAGDROPGAMESTATE;
DData.gametic := gametic;
DData.gametime := gametime;
DemoStream.Write( DData, Sizeof(DData));
with sender as TMonoSprite do begin
DCTF_DropFlag.DXID := sender.DXID;
DCTF_DropFlag.DropperDXID := sender.imageindex;
DCTF_DropFlag.X := sender.x;
DCTF_DropFlag.Y := sender.y;
DCTF_DropFlag.Inertiax := sender.InertiaX;
DCTF_DropFlag.Inertiay := sender.InertiaY;
end;
DemoStream.Write( DCTF_DropFlag, Sizeof(DCTF_DropFlag));
end;
procedure POWERUP_SAVEDEMO_PowerupDropGameState(sender : TMonoSprite);
begin
if not MATCH_DRECORD then exit;
DData.type0 := DDEMO_POWERUP_EVENT_POWERUPDROPGAMESTATE;
DData.gametic := gametic;
DData.gametime := gametime;
DemoStream.Write( DData, Sizeof(DData));
with sender as TMonoSprite do begin
DPOWERUP_DropPowerup.DXID := sender.DXID;
DPOWERUP_DropPowerup.DropperDXID := 0;
DPOWERUP_DropPowerup.imageindex := sender.imageindex;
DPOWERUP_DropPowerup.dir := sender.dir;
DPOWERUP_DropPowerup.X := sender.x;
DPOWERUP_DropPowerup.Y := sender.y;
DPOWERUP_DropPowerup.Inertiax := sender.InertiaX;
DPOWERUP_DropPowerup.Inertiay := sender.InertiaY;
end;
DemoStream.Write(DPOWERUP_DropPowerup, Sizeof(DPOWERUP_DropPowerup));
end;
//------------------------------------------------------------------------------
procedure POWERUP_DEMO_DropPowerup();
var z:byte;
i:word;
begin
if not MATCH_DDEMOPLAY then exit;
for i := 0 to 1000 do
if GameObjects[i].dead = 2 then begin
GameObjects[i].objname := 'powerup';
GameObjects[i].x := DPOWERUP_DropPowerup.X;
GameObjects[i].y := DPOWERUP_DropPowerup.Y;
GameObjects[i].DXID := DPOWERUP_DropPowerup.DXID;
GameObjects[i].dead := 0;
GameObjects[i].dude := true;
GameObjects[i].topdraw := 1;
GameObjects[i].frame := 0;
GameObjects[i].mass := 5;
GameObjects[i].weapon := 0;
GameObjects[i].health := 50*60 + 50*10; // one minute. + 10 sec.. (cuz networked removal).
GameObjects[i].dir := DPOWERUP_DropPowerup.dir;
GameObjects[i].imageindex := DPOWERUP_DropPowerup.imageindex;
GameObjects[i].inertiax := DPOWERUP_DropPowerup.Inertiax;
GameObjects[i].inertiay := DPOWERUP_DropPowerup.Inertiay;
GameObjects[i].clippixel := 4;
exit;
end;
end;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
procedure DEMOPLAREC;
var a : TPlayer;
stp : word;
d : byte;
i,b : word;
str : string[10];
str2 : string[30];
UPDATESPEED : shortint;
rzlt : boolean;
chatstr : string;
buf: array[0..$FF] of char;
begin
UPDATESPEED := 3; // der
// =================================================== \\
// Playing demo
// =================================================== \\
if MATCH_DDEMOPLAY then
if DemoStream.Position < demostream.Size then
while (gametime >= ddata.gametime) and ((gametic >= DData.gametic) or (gametime > DData.gametime)) do begin
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_PLAYERPOSV3 then // VERSION3: player position
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DPlayerUpdateV3.DXID then begin
players[d].x := DPlayerUpdateV3.x;
players[d].y := DPlayerUpdateV3.y;
if (DPlayerUpdateV3.PUV3 and PUV3_DIR0)=PUV3_DIR0 then players[d].dir := 0;
if (DPlayerUpdateV3.PUV3 and PUV3_DIR1)=PUV3_DIR1 then players[d].dir := 1;
if (DPlayerUpdateV3.PUV3 and PUV3_DIR2)=PUV3_DIR2 then players[d].dir := 2;
if (DPlayerUpdateV3.PUV3 and PUV3_DIR3)=PUV3_DIR3 then players[d].dir := 3;
if (DPlayerUpdateV3.PUV3 and PUV3_DEAD0)=PUV3_DEAD0 then players[d].dead := 0;
if (DPlayerUpdateV3.PUV3 and PUV3_DEAD1)=PUV3_DEAD1 then players[d].dead := 1;
if (DPlayerUpdateV3.PUV3 and PUV3_DEAD2)=PUV3_DEAD2 then players[d].dead := 2;
if (DPlayerUpdateV3.PUV3 and PUV3_WPN0)=PUV3_WPN0 then players[d].weapon := 0;
if (DPlayerUpdateV3.PUV3 and PUV3_WPN1)=PUV3_WPN1 then players[d].weapon := 1;
if (DPlayerUpdateV3.PUV3 and PUV3_WPN2)=PUV3_WPN2 then players[d].weapon := 2;
if (DPlayerUpdateV3.PUV3 and PUV3_WPN3)=PUV3_WPN3 then players[d].weapon := 3;
if (DPlayerUpdateV3.PUV3 and PUV3_WPN4)=PUV3_WPN4 then players[d].weapon := 4;
if (DPlayerUpdateV3.PUV3 and PUV3_WPN5)=PUV3_WPN5 then players[d].weapon := 5;
if (DPlayerUpdateV3.PUV3 and PUV3_WPN6)=PUV3_WPN6 then players[d].weapon := 6;
if (DPlayerUpdateV3.PUV3 and PUV3_WPN7)=PUV3_WPN7 then players[d].weapon := 7;
if (DPlayerUpdateV3.PUV3B and PUV3B_WPN8)=PUV3B_WPN8 then players[d].weapon := 8;
if (DPlayerUpdateV3.PUV3B and PUV3B_CROUCH)=PUV3B_CROUCH then players[d].crouch := true else players[d].crouch := false;
if (DPlayerUpdateV3.PUV3B and PUV3B_BALLOON)=PUV3B_BALLOON then players[d].BALLOON := true else players[d].BALLOON := false;
if (players[d].dead = 0) and ((DPlayerUpdateV3.PUV3 and PUV3_DEAD1)=PUV3_DEAD1) then players[d].frame := 0;
players[d].InertiaX := DPlayerUpdateV3.InertiaX;
players[d].InertiaY := DPlayerUpdateV3.Inertiay;
if (players[d].dead > 0) and ((DPlayerUpdateV3.PUV3 and PUV3_DEAD0)=PUV3_DEAD0) and (players[d].rewardtime>0) then players[d].rewardtime := 0;
players[d].fangle := DPlayerUpdateV3.wpnang;
// fixangle
if (players[d].dir=1) or (players[d].dir=3) then begin
if (players[d].fangle > $7F) then players[d].fangle:= $FF - players[d].fangle;
end else
if (players[d].fangle <= $7F) then players[d].fangle:= $FF - players[d].fangle;
players[d].ammo_mg := DPlayerUpdateV3.currammo;
players[d].ammo_sg := DPlayerUpdateV3.currammo;
players[d].ammo_gl := DPlayerUpdateV3.currammo;
players[d].ammo_rl := DPlayerUpdateV3.currammo;
players[d].ammo_sh := DPlayerUpdateV3.currammo;
players[d].ammo_rg := DPlayerUpdateV3.currammo;
players[d].ammo_pl := DPlayerUpdateV3.currammo;
players[d].ammo_bfg := DPlayerUpdateV3.currammo;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if Ddata.type0 = DDEMO_TIMESET then begin // set new gametic, gametime
gametic := DImmediateTimeSet.newgametic ;
gametime := DImmediateTimeSet.newgametime;
MATCH_STARTSIN := DImmediateTimeSet.warmup;
if (DImmediateTimeSet.warmup = 0) and (gametime=0) and (gametic=0) then begin // map_restart
resetmap;
for i := 0 to SYS_MAXPLAYERS-1 do if players[i] <> nil then begin
resetplayerstats(players[i]);
players[i].item_quad := 0;
players[i].item_regen := 0;
players[i].item_haste := 0;
players[i].item_battle := 0;
players[i].item_flight := 0;
players[i].item_invis := 0;
end;
//SND.play('fight.wav',320);
for i := 0 to 1000 do if GameObjects[i].objname <> 'flash' then GameObjects[i].dead := 2; // clear objects
// items
// for i := 0 to BRICK_X-1 do for b := 0 to BRICK_Y-1 do
// if AllBricks[i,b].image > 0 then if AllBricks[i,b].respawntime > 0 then AllBricks[i,b].respawntime := 0;
// reset special objects
for i := 0 to NUM_OBJECTS do if MapObjects[i].active = true then begin
if MapObjects[i].objtype = 2 then begin
MapObjects[i].targetname := 0;
MapObjects[i].lenght := 0;
end;
if MapObjects[i].objtype = 3 then begin
if (MapObjects[i].orient = 1) or (MapObjects[i].orient = 0) then MapObjects[i].target := 1 else MapObjects[i].target := 0;
MapObjects[i].nowanim := 0;
MapObjects[i].dir := 0;
end;
if MapObjects[i].objtype = 4 then MapObjects[i].targetname := 0;
end;
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_CREATEPLAYER then begin // create new player
a := TPlayer.Create;
with a do begin
x := DSpawnPlayer.x;
y := DSpawnPlayer.y;
objname := 'player';
idd := 0;
control := 0; //no control
health := 125;
armor := 0;
netname := DSpawnPlayer.netname;
nfkmodel := DSpawnPlayer.modelname;
netobject := TRUE; // not local player
soundmodel := OPT_SOUNDMODEL1;
frame := DSpawnPlayer.frame;
dead := DSpawnPlayer.dead;
weapon := 1;
netupdated := true;
flagcarrier := false;
TESTPREDICT_X := x;
TESTPREDICT_Y := y;
DXID := DSpawnPlayer.dxid;
assignmodel(a);
dir := DSpawnPlayer.dir;
addplayer(a);
resetplayer(a);
resetplayerstats(a);
//SND.play(SND_respawn,x,y);
if MATCH_DDEMOMPPLAY>0 then
addmessage(a.netname+' ^7^njoin the game');
end;
// automatic bar2assign
DEMO_AutoBarTrax;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_CREATEPLAYERV2 then begin // create new playerV2
a := TPlayer.Create;
with a do begin
x := DSpawnPlayerV2.x;
y := DSpawnPlayerV2.y;
objname := 'player';
idd := 0;
control := 0; //no control
health := 125;
armor := 0;
netname := DSpawnPlayerV2.netname;
nfkmodel := DSpawnPlayerV2.modelname;
netobject := TRUE; // not local player
soundmodel := OPT_SOUNDMODEL1;
frame := 0;
dead := DSpawnPlayerV2.dead;
weapon := 1;
netupdated := true;
TESTPREDICT_X := x;
TESTPREDICT_Y := y;
DXID := DSpawnPlayerV2.dxid;
assignmodel(a);
dir := DSpawnPlayerV2.dir;
team := DSpawnPlayerV2.team;
flagcarrier := false;
// addmessage('spawned with team: '+inttostr(team));
addplayer(a);
resetplayer(a);
resetplayerstats(a);
//SND.play(SND_respawn,x,y);
if MATCH_DDEMOMPPLAY>0 then
addmessage(a.netname+' ^7^njoin the game');
assignmodel(a);
end;
// automatic bar2assign
DEMO_AutoBarTrax;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_KILLOBJECT then begin // kill object with defined dxid.
for stp := 0 to 1000 do
if GameObjects[stp].dead < 2 then
if GameObjects[stp].DXID = DDXIDKill.DXID then begin
// addmessage('KILLING DXID#'+inttostr(demodata.dxid)+' '+GameObjects[stp].objname);
GameObjects[stp].dead := 1;
GameObjects[stp].weapon := 0;
GameObjects[stp].frame := 0;
GameObjects[stp].x := DDXIDKill.x;
GameObjects[stp].y := DDXIDKill.y;
if GameObjects[stp].objname = 'rocket' then begin
PopupGIBZ(GameObjects[stp],60,100);
GameObjects[stp].fangle := random(256);
end;
if (GameObjects[stp].objname = 'grenade') then begin
PopupGIBZ(GameObjects[stp],60,100);
GameObjects[stp].weapon := 1;
GameObjects[stp].fangle := random(256);
GameObjects[stp].speed := random(8);
GameObjects[stp].objname := 'rocket';
GameObjects[stp].topdraw := 2; // explosion to the top animaton
// addmessage('killin #'+inttostr(GameObjects[stp].DXID));
end;
// conn: new plasma
if GameObjects[stp].objname = 'plasma' then begin
PopupGIBZ(GameObjects[stp],60,100);
GameObjects[stp].weapon := 3;
GameObjects[stp].fangle := random(256);
GameObjects[stp].speed := random(8);
GameObjects[stp].objname := 'rocket';
GameObjects[stp].topdraw := 2; // explosion to the top animaton
end;
// conn: old plasma --> //if (GameObjects[stp].objname = 'plasma') then GameObjects[stp].dead := 2; // plazma-just remove
break;
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_FIREROCKET then begin // fire rocket
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DMissileV2.spawnerDxid then begin FireRocket(players[d],0,0,0); break; end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_FIREBFG then begin // fire BFG
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DMissileV2.spawnerDxid then begin FireBFG(players[d],0,0,0); break; end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_FIREPLASMA then begin // fire PLAZMA
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DMissile.spawnerDxid then begin FirePlasma(players[d],0,0,0); break; end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_FIREPLASMAV2 then begin // fire PLAZMA
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DMissileV2.spawnerDxid then begin FirePlasma(players[d],0,0,0); break; end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = 8 then begin // fire old GREN
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DVectorMissile.spawnerDxid then begin FireGren(players[d],0,0,0); break; end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_FIREGRENV2 then begin // fire GREN
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DGrenadeFireV2.spawnerDxid then begin FireGren(players[d],0,0,0); break; end; end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = 9 then begin // fire RAIL
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DVectorMissile.spawnerDxid then begin FireRail(players[d],0,0,0,0); break; end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = 10 then begin // fire SHAFT
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DVectorMissile.spawnerDxid then begin FireShaft(players[d],0,0,0); break; end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = 11 then begin // fire ShotGN
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DVectorMissile.spawnerDxid then begin FireShotGun(players[d],0,0,0); break; end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = 12 then begin // fire Mach
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DVectorMissile.spawnerDxid then begin FireMachine(players[d],0,0,0); break; end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_ITEMDISSAPEAR then begin // DDEMO_ITEMDISSAPEAR
Item_Dissapear(DItemDissapear.x,DItemDissapear.y,DItemDissapear.i,players[0]);
AllBricks[DItemDissapear.x,DItemDissapear.y].respawntime := 2; // remove item;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_ITEMAPEAR then begin // DDEMO_ITEMDISSAPEAR
AllBricks[DItemDissapear.x,DItemDissapear.y].respawntime := 0; // add item;
if OPT_R_ALPHAITEMSRESPAWN then
AllBricks[DItemDissapear.x,DItemDissapear.y].scale := 0
else AllBricks[DItemDissapear.x,DItemDissapear.y].scale := $FF;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DDAta.type0 = DDEMO_DAMAGEPLAYER then begin
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DDamagePlayer.DXID then begin
if players[d].item_battle > 0 then
if players[d].item_battle_time = 0 then begin
SND.play(SND_protect3,players[d].x,players[d].y);
players[d].item_battle_time := 50;
end;
players[d].health := DDamagePlayer.health;
players[d].armor := DDamagePlayer.armor;
if players[d].health <= GIB_DEATH then begin
players[d].rewardtime := 0;
if OPT_MEATLEVEL > 0 then begin
if random(2) = 0 then
SND.play(SND_gib1,players[d].x,players[d].y) else
SND.play(SND_gib2,players[d].x,players[d].y);
if OPT_MEATLEVEL >= 2 then begin // WOW. YOURE WIN A BONUS MEAT!
ThrowGib(Players[d],1);
ThrowGib(Players[d],1);
ThrowGib(Players[d],0);
end;
if OPT_MEATLEVEL = 3 then begin
ThrowGib(Players[d],1);
ThrowGib(Players[d],1);
ThrowGib(Players[d],0);
end;
ThrowGib(Players[d],1);
ThrowGib(Players[d],1);
ThrowGib(Players[d],1);
ThrowGib(Players[d],0);
end;
end;
if players[d].health <= 0 then begin
players[d].gantl_state := 0;
players[d].gantl_s := 0;
// conn: animated machinegun
players[d].machinegun_state := 0;
players[d].machinegun_speed := 0;
inc(players[d].stats.stat_deaths);
if DDamagePlayer.ext > 0 then
inc(players[d].stats.stat_suicide);
players[d].item_quad := 0;
players[d].item_regen := 0;
players[d].item_haste := 0;
players[d].item_battle := 0;
players[d].item_flight := 0;
players[d].item_invis := 0;
players[d].flagcarrier := false; // no flag anyway
if DDamagePlayer.ext > 0 then // suicide :}
SimpleDeathMessage(players[d],'',0,DDamagePlayer.ext) else
for stp := 0 to SYS_MAXPLAYERS-1 do if players[stp] <> nil then if players[stp].dxid = DDamagePlayer.ATTDXID then begin
SimpleDeathMessage(players[d],players[stp].netname,DDamagePlayer.attwpn,0);
break;
end;
end;
// player hit player. bloodspawn.
if (DDamagePlayer.ext = 0) then begin
if DDamagePlayer.attwpn = 1 then SpawnBlood(players[d]) else
if (DDamagePlayer.attwpn = 2) then begin // shotgun
SpawnBlood(players[d]);
SpawnBlood(players[d]);
SpawnBlood(players[d]);
SpawnBlood(players[d]);
if CG_MARKS then SpawnBulletMark( players[d].x, players[d].y); // conn: bullet mark on wall
end else
if (DDamagePlayer.attwpn = 5) then begin // shaft
SpawnBlood(players[d]);
end else
if (DDamagePlayer.attwpn = 6) then begin // rail
SpawnBlood(players[d]);
SpawnBlood(players[d]);
SpawnBlood(players[d]);
SpawnBlood(players[d]);
end else
if (DDamagePlayer.attwpn = 0) then SND.play(SND_gauntl_a,players[d].x,players[d].y);
if (DDamagePlayer.attwpn = 7) then begin
SpawnBlood(players[d]);
SpawnBlood(players[d]);
end;
if (DDamagePlayer.attwpn = 3) or (DDamagePlayer.attwpn = 4) or (DDamagePlayer.attwpn = 8) or (DDamagePlayer.attwpn = 0) then begin
SpawnBlood(players[d]);
SpawnBlood(players[d]);
SpawnBlood(players[d]);
SpawnBlood(players[d]);
end;
end;
// hitsound
if (DDamagePlayer.ext = 0) then // fire $t@Tzzz
for stp:=0 to SYS_MAXPLAYERS-1 do if players[stp] <> nil then if
players[stp].dxid = DDamagePlayer.ATTDXID then begin
case DDamagePlayer.attwpn of
1 : inc(players[stp].stats.mach_hits);
2 : inc(players[stp].stats.shot_hits);
3 : inc(players[stp].stats.gren_hits);
4 : inc(players[stp].stats.rocket_hits);
5 : inc(players[stp].stats.shaft_hits);
6 : inc(players[stp].stats.rail_hits);
7 : inc(players[stp].stats.plasma_hits);
8 : inc(players[stp].stats.bfg_hits);
end;
end;
// FIXME: in demo, blood sometimes spawns in strange places.
if DDamagePlayer.ext = DIE_INPAIN then SpawnBlood(players[d]);
if (OPT_HITSND = true) and (DDamagePlayer.ext = 0) then begin
if players[OPT_1BARTRAX]=nil then OPT_1BARTRAX := 0;
// hitsound
for stp:=0 to SYS_MAXPLAYERS-1 do if players[stp] <> nil then
if players[stp].dxid = DDamagePlayer.ATTDXID then begin
rzlt := false;
if OPT_1BARTRAX = stp then
if players[OPT_1BARTRAX] <> nil then
if (players[stp].DXID = players[OPT_1BARTRAX].DXID) then
rzlt := true;
if SYS_BAR2AVAILABLE then
if OPT_2BARTRAX = stp then
if players[OPT_2BARTRAX] <> nil then
if (players[stp].DXID = players[OPT_2BARTRAX].DXID) then
rzlt := true;
if rzlt = true then
if players[stp].hitsnd = 0 then begin
SND.play(SND_hit,players[stp].x,players[stp].y);
players[stp].hitsnd := 5;
break;
end;
end;
end;
if ((Players[d].health > GIB_DEATH) or (OPT_MEATLEVEL = 0)) and (Players[d].health <= 0) then begin
stp := random(3);
if stp = 0 then SND.play(Players[d].SND_death1,Players[d].x,Players[d].y);
if stp = 1 then SND.play(Players[d].SND_death2,Players[d].x,Players[d].y);
if stp = 2 then SND.play(Players[d].SND_death3,Players[d].x,Players[d].y);
end else
if Players[d].paintime = 0 then begin
if Players[d].health >= 76 then SND.play(Players[d].SND_Pain100,Players[d].x,Players[d].y) else
if Players[d].health >= 51 then SND.play(Players[d].SND_Pain75,Players[d].x,Players[d].y) else
if Players[d].health >= 26 then SND.play(Players[d].SND_Pain50,Players[d].x,Players[d].y) else
if Players[d].health >= 1 then SND.play(Players[d].SND_Pain25,Players[d].x,Players[d].y);
Players[d].paintime := 25;
end;
break;
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_JUMPSOUND then begin // fire Mach
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DPlayerJump.Dxid then begin SND.play(players[d].SND_Jump,players[d].x,players[d].y); break; end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_HAUPDATE then begin
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DPlayerHAUpdate.DXID then begin
players[d].health := DPlayerHAUpdate.health;
players[d].armor := DPlayerHAUpdate.armor;
players[d].frags := DPlayerHAUpdate.frags;
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_FLASH then begin // spawn Respawn Flash
RespawnFlash(DRespawnFlash.x,DRespawnFlash.y);
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_GAMEEND then begin
try
GameEnd(DGameEnd.EndType);
except addmessage('Error DDEMO_GAMEEND'); end;
case DGameEnd.EndType of
END_SUDDEN : addmessage('^3Sudden death hit.');
END_TIMELIMIT : addmessage('^3Timelimit hit.');
END_FRAGLIMIT : addmessage('^3Fraglimit hit.');
END_CAPTURELIMIT : addmessage('^3Capturelimit hit.');
END_DOMLIMIT : addmessage('^3Domlimit hit.');
end;
for i := 0 to 1000 do if (GameObjects[i].objname <> 'flash')
and (GameObjects[i].objname <> 'gib')
and (GameObjects[i].objname <> 'blood')
and (GameObjects[i].objname <> 'shots')
and (GameObjects[i].objname <> 'shots2')
and (GameObjects[i].objname <> 'smoke')
and (GameObjects[i].objname <> 'machine')
and (GameObjects[i].objname <> 'rail')
then GameObjects[i].dead := 2; // clear objects
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].gantl_state > 0 then
players[d].gantl_state := 0;
// conn: animated machinegun
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].machinegun_speed > 0 then
players[d].machinegun_speed := 0;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_NOAMMOSOUND then SND.play(SND_Noammo, DNoAmmoSound.x,DNoAmmoSound.y);
if DData.type0 = DDEMO_JUMPPADSOUND then SND.play(SND_jumppad,DJumppadSound.x,DJumppadSound.y);
if DData.type0 = DDEMO_RESPAWNSOUND then SND.play(SND_respawn,DRespawnSound.x,DRespawnSound.y);
if DData.type0 = DDEMO_LAVASOUND then SND.play(SND_lava,DLavaSound.x,DLavaSound.y);
if DData.type0 = DDEMO_POWERUPSOUND then SND.play(SND_poweruprespawn,DPowerUpSound.x,DPowerUpSound.y);
if DData.type0 = DDEMO_FLIGHTSOUND then SND.play(SND_flight,DFlightSound.x,DFlightSound.y);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_EARNPOWERUP then
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DEarnPowerup.DXID then begin
case DEarnPowerup.type1 of
1 : players[d].item_regen := DEarnPowerup.time;
2 : players[d].item_flight := DEarnPowerup.time;
3 : players[d].item_battle := DEarnPowerup.time;
4 : players[d].item_haste := DEarnPowerup.time;
5 : players[d].item_quad := DEarnPowerup.time;
6 : players[d].item_invis := DEarnPowerup.time;
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_EARNREWARD then
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DEarnReward.DXID then begin
players[d].rewardtype := DEarnReward.type1;
if players[d].rewardtime <= 170 then case DEarnReward.type1 of
1 : SND.play(SND_impressive,players[d].x,players[d].y); // no double sound.
2 : SND.play(SND_excellent,players[d].x,players[d].y);
3 : SND.play(SND_humiliation,players[d].x,players[d].y);
end;
players[d].rewardtime := 200;
break;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_READYPRESS then MATCH_STARTSIN := DReadyPress.newmatch_statsin;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_BUBBLE then
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DBubble.DXID then begin
SpawnBubble(players[d]);
break;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
{ if DData.type0 = DDEMO_STATS then // oldversion. not used anymore...
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DStats.DXID then begin
players[d].stats.stat_kills := DStats.stat_kills;
players[d].stats.stat_dmggiven := DStats.stat_dmggiven;
players[d].stats.stat_dmgrecvd := DStats.stat_dmgrecvd;
players[d].stats.mach_hits := DStats.mach_hits;
players[d].stats.shot_hits := DStats.shot_hits;
players[d].stats.gren_hits := DStats.gren_hits ;
players[d].stats.rocket_hits := DStats.rocket_hits ;
players[d].stats.shaft_hits := DStats.shaft_hits ;
players[d].stats.plasma_hits := DStats.plasma_hits ;
players[d].stats.rail_hits := DStats.rail_hits ;
players[d].stats.bfg_hits := DStats.bfg_hits;
break;
end;
if DData.type0 = DDEMO_STATS2 then // oldversion. not used anymore...
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DStats2.DXID then begin
players[d].stats.stat_kills := DStats2.stat_kills;
players[d].stats.stat_suicide := DStats2.stat_suicide;
players[d].stats.stat_deaths := DStats2.stat_deaths;
players[d].frags := DStats2.frags;
players[d].stats.stat_dmggiven := DStats2.stat_dmggiven;
players[d].stats.stat_dmgrecvd := DStats2.stat_dmgrecvd;
players[d].stats.mach_hits := DStats2.mach_hits;
players[d].stats.shot_hits := DStats2.shot_hits;
players[d].stats.gren_hits := DStats2.gren_hits ;
players[d].stats.rocket_hits := DStats2.rocket_hits ;
players[d].stats.shaft_hits := DStats2.shaft_hits ;
players[d].stats.plasma_hits := DStats2.plasma_hits ;
players[d].stats.rail_hits := DStats2.rail_hits ;
players[d].stats.bfg_hits := DStats2.bfg_hits;
players[d].stats.mach_fire := DStats2.mach_fire;
players[d].stats.shot_fire := DStats2.shot_fire;
players[d].stats.gren_fire := DStats2.gren_fire;
players[d].stats.rocket_fire := DStats2.rocket_fire;
players[d].stats.shaft_fire := DStats2.shaft_fire;
players[d].stats.plasma_fire := DStats2.plasma_fire;
players[d].stats.rail_fire := DStats2.rail_fire;
players[d].stats.bfg_fire := DStats2.bfg_fire;
break;
end; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_STATS3 then
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DStats3.DXID then begin
players[d].stats.stat_kills := DStats3.stat_kills;
players[d].stats.stat_suicide := DStats3.stat_suicide;
players[d].stats.stat_deaths := DStats3.stat_deaths;
players[d].frags := DStats3.frags;
players[d].stats.stat_dmggiven := DStats3.stat_dmggiven;
players[d].stats.stat_dmgrecvd := DStats3.stat_dmgrecvd;
players[d].stats.gaun_hits := DStats3.gaun_hits;
players[d].stats.mach_hits := DStats3.mach_hits;
players[d].stats.shot_hits := DStats3.shot_hits;
players[d].stats.gren_hits := DStats3.gren_hits ;
players[d].stats.rocket_hits := DStats3.rocket_hits ;
players[d].stats.shaft_hits := DStats3.shaft_hits ;
players[d].stats.plasma_hits := DStats3.plasma_hits ;
players[d].stats.rail_hits := DStats3.rail_hits ;
players[d].stats.bfg_hits := DStats3.bfg_hits;
players[d].stats.mach_fire := DStats3.mach_fire;
players[d].stats.shot_fire := DStats3.shot_fire;
players[d].stats.gren_fire := DStats3.gren_fire;
players[d].stats.rocket_fire := DStats3.rocket_fire;
players[d].stats.shaft_fire := DStats3.shaft_fire;
players[d].stats.plasma_fire := DStats3.plasma_fire;
players[d].stats.rail_fire := DStats3.rail_fire;
players[d].stats.bfg_fire := DStats3.bfg_fire;
players[d].stats.stat_impressives := DStats3.bonus_impressive;
players[d].stats.stat_excellents := DStats3.bonus_excellent;
players[d].stats.stat_humiliations := DStats3.bonus_humiliation;
break;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_GAMESTATE then begin
if DGameState.type1 = 1 then SND.play(SND_5_min,0,0);
if DGameState.type1 = 2 then SND.play(SND_1_min,0,0);
if DGameState.type1 = 3 then begin
SND.play(SND_sudden_death,0,0);
gamesudden := 200;
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_TRIXARENAEND then
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DTrixArenaEnd.DXID then begin
str := '';
if trunc(gametime / 60) < 10 then str := '0';
str := str + inttostr(trunc(gametime/60))+':';
if gametime - trunc(gametime / 60)*60 < 10 then str := str + '0';
str := str + inttostr(gametime - trunc(gametime / 60)*60);
addmessage(players[d].netname + ' ^7^nfinished the level. Time: '+str+'.'+inttostr(gametic));
break;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_OBJCHANGESTATE then begin
if MapObjects[DObjChangeState.objindex].active =false then begin addmessage('error: DDEMO_OBJCHANGESTATE for null object'); end;
if MapObjects[DObjChangeState.objindex].objtype = 2 then // btn
if MapObjects[DObjChangeState.objindex].targetname <> DObjChangeState.state then begin
MapObjects[DObjChangeState.objindex].targetname := DObjChangeState.state;
if DObjChangeState.state = 1 then SND.play(SND_button,MapObjects[DObjChangeState.objindex].x*32,MapObjects[DObjChangeState.objindex].y*16);
end;
if MapObjects[DObjChangeState.objindex].objtype = 3 then // dooR
if MapObjects[DObjChangeState.objindex].target <> DObjChangeState.state then begin
MapObjects[DObjChangeState.objindex].nowanim := 6;
MapObjects[DObjChangeState.objindex].target := DObjChangeState.state;
if DObjChangeState.state = 1 then begin
for i := 0 to 1000 do if GameObjects[i].dead = 0 then begin
rzlt := false;
if GameObjects[i].dead < 2 then begin
if MapObjects[DObjChangeState.objindex].orient = 0 then rzlt := object_region_touch(MapObjects[DObjChangeState.objindex].x,MapObjects[DObjChangeState.objindex].y-1,MapObjects[DObjChangeState.objindex].x+MapObjects[DObjChangeState.objindex].lenght+1,MapObjects[DObjChangeState.objindex].y, GameObjects[i]);
if MapObjects[DObjChangeState.objindex].orient = 1 then rzlt := object_region_touch(MapObjects[DObjChangeState.objindex].x,MapObjects[DObjChangeState.objindex].y,MapObjects[DObjChangeState.objindex].x, MapObjects[DObjChangeState.objindex].y+MapObjects[DObjChangeState.objindex].lenght+1, GameObjects[i]);
if rzlt = true then if GameObjects[i].objname = 'corpse' then begin
GameObjects[i].dead := 2;
end;
end;
end;
end;
if DObjChangeState.state = 1 then SND.play(SND_dr1_end,MapObjects[DObjChangeState.objindex].x*32,MapObjects[DObjChangeState.objindex].y*16);
if DObjChangeState.state = 0 then SND.play(SND_dr1_strt,MapObjects[DObjChangeState.objindex].x*32,MapObjects[DObjChangeState.objindex].y*16);
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_CORPSESPAWN then
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DCorpseSpawn.DXID then begin
SpawnCorpse(players[d]);
break;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// outdated
if DData.type0 = DDEMO_GRENADESYNC then begin // sync grenade with defined dxid.
for stp := 0 to 1000 do
if GameObjects[stp].dead < 2 then
if GameObjects[stp].objname = 'grenade' then
if GameObjects[stp].DXID = DGrenadeSync.DXID then begin
// addmessage('syncing #'+inttostr(DGrenadeSync.DXID));
GameObjects[stp].x := DGrenadeSync.x;
GameObjects[stp].y := DGrenadeSync.y;
GameObjects[stp].InertiaX := DGrenadeSync.InertiaX;
GameObjects[stp].InertiaY := DGrenadeSync.InertiaY;
break;
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_GAUNTLETSTATE then begin
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then if players[d].dxid = DGauntletState.DXID then begin
players[d].gantl_state := DGauntletState.State;
end;
end;
// conn: animated machinegun, do we need this packet?
//--------------------------------------------
// MP.
if DData.type0 = DDEMO_MPSTATE then begin
MATCH_DDEMOMPPLAY := DMultiplayer.y;
OPT_1BARTRAX := DMultiplayer.pov;
if players[OPT_1BARTRAX] = nil then
for d := 0 to SYS_MAXPLAYERS-1 do if (players[d] <> nil) then begin
OPT_1BARTRAX := d;
break;
end;
// SYS_BAR2AVAILABLE := false;
// client demos bugfix
if (ISHotSeatMap) and (GetNumberOfPlayers = 2) then
if OPT_1BARTRAX = OPT_2BARTRAX then begin
OPT_1BARTRAX := 0;
OPT_2BARTRAX := 1;
end;
end;
//--------------------------------------------
if DData.type0 = DDEMO_NETRAIL then begin
SND.play(SND_rail,DNetRail.x1,DNetRail.y1);
for i := 0 to 1000 do if GameObjects[i].dead = 2 then begin
GameObjects[i].objname := 'rail';
GameObjects[i].dude := false;
GameObjects[i].dead := 1;
GameObjects[i].topdraw := 1;
GameObjects[i].frame := 0;
GameObjects[i].DXID := 0;
GameObjects[i].x := DNetRail.x;
GameObjects[i].y := DNetRail.y;
GameObjects[i].cx := DNetRail.endx;
GameObjects[i].cy := DNetRail.endy;
GameObjects[i].fallt := DNetRail.color;
break;
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_NETPARTICLE then begin
if DNetShotParticle.index = 1 then begin
SpawnNetShots1(trunc(DNetShotParticle.x), trunc(DNetShotParticle.y));
SND.play(SND_machine,trunc(DNetShotParticle.x1),trunc(DNetShotParticle.y1));
end;
if DNetShotParticle.index = 2 then begin
SpawnNetShots(trunc(DNetShotParticle.x), trunc(DNetShotParticle.y));
SND.play(SND_shotgun,trunc(DNetShotParticle.x1),trunc(DNetShotParticle.y1));
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// client side recorded demoz...
if DData.type0 = DDEMO_NETTIMEUPDATE then begin
if DNETTimeUpdate.WARMUP = true then begin
if DNETTimeUpdate.Min < 1 then MATCH_FAKESTARTSIN:=1 else
MATCH_FAKESTARTSIN := DNETTimeUpdate.Min;
case MATCH_FAKESTARTSIN of
1 : SND.play(SND_one,0,0);
2 : SND.play(SND_two,0,0);
3 : SND.play(SND_three,0,0);
end;
end else begin
MATCH_FAKESTARTSIN := 0;
MATCH_FAKEMIN := DNETTimeUpdate.Min;
end;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_NETSVMATCHSTART then begin
SND.play(SND_fight,0,0);
MATCH_STARTSIN:=0; // GAME!
MATCH_FAKESTARTSIN:=0;
for d := 0 to SYS_MAXPLAYERS-1 do if players[d] <> nil then begin
resetplayer(players[d]);
resetplayerstats(players[d]);
end;
resetmap;
end;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if DData.type0 = DDEMO_DROPPLAYER then begin