forked from ShakaUVM/CustomTF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCLIENT.QC
3887 lines (3281 loc) · 92.2 KB
/
CLIENT.QC
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
/*======================================================
CLIENT.QC Custom TeamFortress v3.2
(c) TeamFortress Software Pty Ltd 29/2/97
(c) William Kerney 16/9/00
(c) Craig Hauser 19/3/00
========================================================
Handles obituaries, what happens when a client dies, respawns,
connects & disconnects, and when a map changes levels
======================================================*/
// prototypes
void () W_WeaponFrame;
void() W_SetCurrentAmmo;
void() player_pain;
void() player_stand1;
void (vector org) spawn_tfog;
void (vector org, entity death_owner) spawn_tdeath;
float modelindex_eyes, modelindex_player, modelindex_null;
float(float v) anglemod;
//void () SetUpChrisRound;//-
void () PrematchBegin;
void () TeamAllPlayers;
//void (float winner) RoundStop;//-
//void () UpdateScores;
//void () roundtimer_think;//-
//void () EndRound;//-
// TeamFortress prototypes
void() TeamFortress_MOTD;
void() TeamFortress_CheckTeamCheats;
//float(float tno) TeamFortress_TeamGetColor; //- OfN - not used here
void(entity Viewer, float pc, float rpc) TeamFortress_PrintClassName;
void(entity Viewer, float pc) TeamFortress_PrintJobName;
void() TeamFortress_RemoveTimers;
void(float Suicided) TeamFortress_SetupRespawn;
void() TeamFortress_ShowTF;
float(float pc) IsLegalClass;
void() SetupTeamEqualiser;
#ifdef QUAKE_WORLD
void(entity p) SetTeamName;
#endif
void (float number) decrement_team_ammoboxes;
void() TeamFortress_DetonatePipebombs;
void(float f) decrement_team_pipebombs;
void () PlayerObserverMode;
// Hook prototypes
void () Service_Grapple;
// TeamFortressMap prototypes
void(entity AD) ParseTFDetect;
entity(float ino) Finditem;
void(entity Item, entity AP, entity Goal) tfgoalitem_GiveToPlayer;
void(entity Goal, entity AP, entity ActivatingGoal) AttemptToActivate;
void() CTF_FlagCheck;
//WK
void() DropToCustomClassGen;
void(entity p) TeamFortress_SetSpeed;
void () kill_my_demons;
void () DetonateAllGuns; // SB
void () Boot_Flamer_stream_touch;
void (entity foo,float bar) makeImmune;
// SB Extern
void (entity targ) GetRank;
//void() SwitchFromCamera;
//==============// ofn
void(entity mine_owner) DetonateMines;
void(entity player) RemoveHolo;
string(entity thebuilding) GetBuildingName;
string(entity themonster) GetMonsterName;
void(entity attacker) MonsterKill;
void() DetonateAllGunsForced;
float() ValidVoteEnt;
void() ResetVoteEnt;
void(string thesound) BroadcastSound;
void (entity attacker) WarlockKnifeKill;
void(entity player, float usage) SetMeatUsage;
void(entity player, float usage) SetHeadsUsage;
void() PlayerJoined;
void() PlayerQuit;
string(entity client) GetClientDescription;
string(entity client) GetBracedClDesc;
float() ServerUpdating;
void(float broadcastmsg) PrintGameSettings;
void(entity player) PlayerDropRunes;
void() FinalizedPerformAction;
entity() GetSleepVote;
void() VoteToSleep;
void(entity sleepent, entity targetclient) SleepVoteResume;
void(string nfmap) LaunchMap;
/*
=============================================================================
LEVEL CHANGING / INTERMISSION
=============================================================================
*/
string nextmap;
//float intermission_running; // OfN - Moved to defs.qc for use on environ.qc
float intermission_exittime;
/*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
This is the camera point for the intermission.
Use mangle instead of angle, so you can set pitch or roll as well as yaw. 'pitch roll yaw'
*/
void() info_intermission =
{
if (CheckExistence() == #FALSE)
{
dremove(self);
return;
}
};
void() SetChangeParms =
{
if (self.health <= 0)
{
SetNewParms ();
return;
}
// remove items
self.items = self.items - (self.items & (#IT_KEY1 | #IT_KEY2 | #IT_INVISIBILITY | #IT_INVULNERABILITY | #IT_SUIT | #IT_QUAD) );
// cap super health
if (self.health > 100)
self.health = 100;
if (self.health < 50)
self.health = 50;
parm1 = self.items;
parm2 = self.health;
parm3 = self.armorvalue;
if (self.ammo_shells < 25)
parm4 = 25;
else
parm4 = self.ammo_shells;
parm5 = self.ammo_nails;
parm6 = self.ammo_rockets;
parm7 = self.ammo_cells;
parm8 = self.current_weapon;
parm9 = self.armortype * 100;
// TeamFortress Parameters
parm10 = toggleflags; // Store the global ToggleFlag settings
parm11 = 0; // Random Playerclass
parm12 = 0;
#ifdef COOP_MODE
if (toggleflags & #TFLAG_CLASS_PERSIST)
{
if (self.tfstate & #TFSTATE_RANDOMPC)
{
parm11 = (parm11 | #TFSTATE_RANDOMPC);
self.playerclass = 1 + floor(random() * (#PC_RANDOM - 1));
while(!IsLegalClass(self.playerclass))
self.playerclass = 1 + floor(random() * (#PC_RANDOM - 1));
}
parm12 = self.playerclass; // save the playerclass between levels in parm12
} // if the toggleflag CLASS_PERSIST is set
#endif
#ifdef STATUSBAR
parm13 = self.StatusBarRes;
parm14 = self.StatusBarSize;
#endif
#ifdef QUAKE_WORLD
parm15 = self.admin_flag; //CH Pass along admin status :)
#endif
};
void() SetNewParms =
{
parm1 = 0;
parm2 = 100;
parm3 = 0;
parm4 = 25;
parm5 = 0;
parm6 = 0;
parm6 = 0;
parm8 = 1;
parm9 = 0;
// TeamFortress Parameters
parm10 = 0;
parm11 = 0;
parm12 = 0;
parm13 = 0;
parm14 = 0;
parm15 = 0;
};
// This think kicks in 30 seconds into the map to
// turn autoteam on.
void() autoteam_think =
{
//local float loopc;
//? local entity other;//,oself;
// if (chris)
// SetUpChrisRound();
// if (!chris)
PrematchBegin();
toggleflags = toggleflags | #TFLAG_AUTOTEAM;
dremove(self);
};
void () PrematchBegin =
{
if (prematch)
{
bprint(#PRINT_HIGH,"œ The game has now started! œ\n");
other = find(world, classname, "player");
while (other != world)
{
other.is_abouttodie = #TRUE;
other.items = other.items - (other.items & #IT_INVULNERABILITY);
other.invincible_time = 0;
other.invincible_finished = 0;
other.effects = other.effects - (other.effects & #EF_DIMLIGHT);
TF_T_Damage(other, world, world, other.health + 20, #TF_TD_IGNOREARMOUR, #TF_TD_OTHER);
other = find(other, classname, "player");
}
// - OfN - wtf
/*other = find(world, classname, "grunty");
while (other != world)
{
other.is_abouttodie = #TRUE;
other.items = other.items - (other.items & #IT_INVULNERABILITY);
other.invincible_time = 0;
other.invincible_finished = 0;
other.effects = other.effects - (other.effects & #EF_DIMLIGHT);
TF_T_Damage(other, world, world, other.health + 20, #TF_TD_IGNOREARMOUR, #TF_TD_OTHER);
other = find(other, classname, "grunty");
}*/
}
/* if (chris)
{
if (self.classname == "prematch_timer")
dremove(self);
else
SetUpChrisRound();
}*/
};
/*void () SetUpChrisRound =
{
local entity other, oself;
// Make sure everyone is on a team
TeamAllPlayers();
// Clean up team player counts
team1total = 0;
team2total = 0;
team3total = 0;
team4total = 0;
oself = self;
other = find(world, classname, "player");
while (other != world)
{
if (livesperguy > 0)
{
if (other.team_no == 1) team1total = team1total + livesperguy;
if (other.team_no == 2) team2total = team2total + livesperguy;
if (other.team_no == 3) team3total = team3total + livesperguy;
if (other.team_no == 4) team4total = team4total + livesperguy;
other.lives = livesperguy;
}
self = other;
kill_my_demons();
DetonateAllGuns();
TF_T_Damage(other, world, world, other.health + 20, #TF_TD_IGNOREARMOUR, #TF_TD_OTHER);
other = find(other, classname, "player");
}
newmis = spawn();
newmis.classname = "chris_round_timer";
newmis.nextthink = time + roundtime;
newmis.think = roundtimer_think;
};*/
/*void() roundtimer_think =
{
RoundStop(0);
dremove(self);
};*/
void () TeamAllPlayers =
{
local entity other, oself;
other = find(world, classname, "player");
while (other != world)
{
if (other.team_no <= 0 && other.is_connected)
{
oself = self;
self = other;
Menu_Team_Input(5);
self = oself;
}
other = find(other, classname, "player");
}
};
/*void (float winner) RoundStop =
{
if (winner == 0)
bprint(#PRINT_MEDIUM, "The round has ended due to time.\n");
else
{
if (winner == 1)
{
team1rounds = team1rounds + 1;
bprint(#PRINT_MEDIUM, "The blue team wins the round.\n");
}
if (winner == 2)
{
team2rounds = team2rounds + 1;
bprint(#PRINT_MEDIUM, "This round goes to the red team.\n");
}
if (winner == 3)
{
team3rounds = team3rounds + 1;
bprint(#PRINT_MEDIUM, "The yellow team are sponsored by SB-1 Tech and have won this round.\n");
}
if (winner == 4)
{
team4rounds = team4rounds + 1;
bprint(#PRINT_MEDIUM, "The green team are the winners of this round.\n");
}
}
UpdateScores();
newmis = spawn();
newmis.nextthink = time + 1;
newmis.think = EndRound;
};*/
/*void() UpdateScores =
{
local entity guy;
guy = find(other, classname, "player");
while (guy != world)
{
if (guy.team_no == 1)
{
guy.frags = team1rounds * 10;
guy.real_frags = team1rounds * 10;
}
else if (guy.team_no == 2)
{
guy.frags = team2rounds * 10;
guy.real_frags = team2rounds * 10;
}
else if (guy.team_no == 3)
{
guy.frags = team3rounds * 10;
guy.real_frags = team3rounds * 10;
}
else if (guy.team_no == 4)
{
guy.frags = team4rounds * 10;
guy.real_frags = team4rounds * 10;
}
guy = find(guy, classname, "other");
}
};*/ /////////////??/////////////7
/*void() EndRound =
{
local entity roundtimer, prematchtimer;
local float winner, prematchtime;
local string st;
// Kill the round timer
other = find(world, classname, "chris_round_timer");
// I deliberately don't do a contingency check here - if it screws up I wanna know about it
dremove(other);
st = infokey(world, "pm");
if (st == string_null) // if 'pm' isn't set, try 'prematch'
st = infokey(world, "prematch");
if (st == "on") // if it reads 'on', do a 30 second prematch
prematchtime = time + 30;
else // if it doesn't read 'on'...
prematchtime = stof(st); // turn the string into a float
if (prematchtime) // if we have prematch
{
prematch = time + prematchtime; // set it
}
else
prematch = #FALSE; // otherwise, no prematch
// Kill everyone
/* other = find(world, classname, "player");
while (other != world)
{
TF_T_Damage(other, world, world, other.health + 20, #TF_TD_IGNOREARMOUR, #TF_TD_OTHER);
other = find(other, classname, "player");
} Don't kill everyone here or it drops the flag
*/
// Set up the timer
/*- if (team1rounds < roundstowin && team2rounds < roundstowin && team3rounds < roundstowin && team4rounds < roundstowin)
{
roundtimer = spawn();
roundtimer.think = SetUpChrisRound;
roundtimer.nextthink = time + 5;
prematchtimer = spawn();
prematchtimer.classname == "prematch_timer";
prematchtimer.nextthink = time + prematch;
prematchtimer.think = PrematchBegin;
}
else
{
newmis = spawn();
newmis.nextthink = time + 5;
newmis.think = execute_changelevel;
}
};*/
void() DecodeLevelParms =
{
local string st;
local entity ent;
local float prematchtime;
if (serverflags)
{
if (world.model == "maps/start.bsp")
SetNewParms (); // take away all stuff on starting new episode
}
self.items = parm1;
self.health = parm2;
self.armorvalue = parm3;
self.ammo_shells = parm4;
self.ammo_nails = parm5;
self.ammo_rockets = parm6;
self.ammo_cells = parm7;
self.current_weapon = parm8;
self.armortype = parm9 * 0.01;
// TeamFortress Parameters
// Detect whether this is the first entrance into a map
if (toggleflags == 0)
{
toggleflags = parm10;
allow_hook = 0;
invis_only = #SPY_INVIS_ONLY;
if (coop || !deathmatch)
toggleflags = toggleflags | #TFLAG_CLASS_PERSIST;
nextmap = mapname;
#ifdef GRAPPLING_HOOK
allow_hook = #TRUE;
#endif
// Is this a FortressMap?
ent = find(world, classname, "info_tfdetect");
if (ent != world)
{
// Turn on Teamplay
if (teamplay == 0)
cvar_set("teamplay","21?TeamFortress");
// Parse the rest of the Detection details
ParseTFDetect(ent);
// If the number_of_teams wasn't set, then there's not TF
// spawnpoints on this lvl... so guess at 4 teams.
if (number_of_teams <= 0 || number_of_teams >= 5)
number_of_teams = 4;
}
else
{
// Is this a CTF map?
ent = find(world, classname, "info_player_team1");
if ((ent != world) || (CTF_Map == #TRUE))
{
// Turn on CTF MAP
CTF_Map = #TRUE;
// Turn on Teamplay
if (teamplay == 0)
cvar_set("teamplay","21?TeamFortress");
// Setup the CTF FlagCheck Timer
ent = spawn();
ent.nextthink = time + 30;
ent.think = CTF_FlagCheck;
number_of_teams = 2;
}
else // Normal map
{
number_of_teams = 4;
}
// Set speed limits
#ifndef QUAKE_WORLD
cvar_set("sv_maxspeed", "1000");
#endif
// set aiming level
#ifndef NET_SERVER
cvar_set("sv_aim", "1");
#endif
// Set life limits
team1lives = -1;
team2lives = -1;
team3lives = -1;
team4lives = -1;
// WK Clear our nextspam counters
team1nextspam = -1;
team2nextspam = -1;
team3nextspam = -1;
team4nextspam = -1;
// Set illegal playerclasses
illegalclasses1 = 0;
illegalclasses2 = 0;
illegalclasses3 = 0;
illegalclasses4 = 0;
// Set Team Limits
team1maxplayers = 100;
team2maxplayers = 100;
team3maxplayers = 100;
team4maxplayers = 100;
civilianteams = 0;
}
// Ofn
PrintGameSettings(#TRUE);
SetupTeamEqualiser();
if (#CHECK_SPEEDS)
{
toggleflags = toggleflags | #TFLAG_CHEATCHECK;
}
#ifdef QUAKE_WORLD
st = infokey(world, "temp1");
toggleflags = (toggleflags | #TFLAG_FIRSTENTRY | stof(st));
#else
toggleflags = (toggleflags | #TFLAG_FIRSTENTRY | cvar("temp1"));
#endif
local float autoteam_time;
autoteam_time = 30;
#ifdef QUAKE_WORLD
// check all serverinfo settings, to set the appropriate toggleflags
//local string st;
// AUTOTEAM
st = infokey(world, "a");
if (st == string_null)
st = infokey(world, "autoteam");
if (st == "on")
toggleflags = toggleflags | #TFLAG_AUTOTEAM;
else if (st == "off")
toggleflags = toggleflags - (toggleflags & #TFLAG_AUTOTEAM);
else if (stof(st) != 0)
{
toggleflags = toggleflags | #TFLAG_AUTOTEAM;
autoteam_time = stof(st);
}
// TEAMFRAGS
st = infokey(world, "t");
if (st == string_null)
st = infokey(world, "teamfrags");
if (st == "on")
toggleflags = toggleflags | #TFLAG_TEAMFRAGS;
else if (st == "off")
toggleflags = toggleflags - (toggleflags & #TFLAG_TEAMFRAGS);
// PZ - for AGR mode
if (agr)
{
if (agr_teamfrags)
toggleflags = toggleflags | #TFLAG_TEAMFRAGS;
else
toggleflags = toggleflags - (toggleflags & #TFLAG_TEAMFRAGS);
}
// end AGR mod
//WK JELLO WATER
st = infokey(world, "j");
if (st == string_null)
st = infokey(world, "jello");
if (st == "on")
jello = #TRUE;
else {
local float numba;
numba = stof(st);
if (numba)
jello = numba;
else
jello = #FALSE;
}
//WK JELLO WATER
light_damage = #FALSE;
st = infokey(world, "ld");
if (st == string_null)
st = infokey(world, "lightdamage");
if (st == "on")
light_damage = #TRUE;
// SB New, improved TF 2.9 fake prematch mode!
// We can make a class, come in, run around, play tag the flag, but can't do anything
// useful until the prematch is over!
st = infokey(world, "pm");
if (st == string_null) // if 'pm' isn't set, try 'prematch'
st = infokey(world, "prematch");
if (st == "on") // if it reads 'on', do a 30 second prematch
prematchtime = time + 30;
else // if it doesn't read 'on'...
prematchtime = stof(st); // turn the string into a float
if (prematchtime) // if we have prematch
{
prematch = time + prematchtime; // set it
autoteam_time = prematchtime;
toggleflags = toggleflags | #TFLAG_AUTOTEAM;
}
else
prematch = #FALSE; // otherwise, no prematch
//WK Bounty System
st = infokey(world, "bounty");
if (st == string_null)
st = infokey(world, "moola");
if (st == "on")
bounty = #TRUE;
else
bounty = #FALSE;
//CH Sets the starting amount of money :)
/*st = infokey(world, "m");
if (st == string_null)
st = infokey(world, "money");
local float numba;
numba = stof(st);
if (numba)
custom_money = numba;
else
custom_money = #SPENDING_LIMIT; // --> DEFAULT_MONEY
MOVED TO UDPATEINFOS()*/
// GRAPPLING HOOK
st = infokey(world, "g");
if (st == string_null)
st = infokey(world, "grapple");
if (st == "off")
allow_hook = #FALSE;
if (!(toggleflags & #TFLAG_GRAPPLE) && st != "on")
allow_hook = #FALSE;
// SPY OFF
st = infokey(world, "spy");
if (st == "off")
spy_off = #TRUE;
// SPY INVIS ONLY
st = infokey(world, "s");
if (st == string_null)
st = infokey(world, "spyinvis");
if (st == "on" || toggleflags & #TFLAG_SPYINVIS)
invis_only = #TRUE;
else if (st == "off")
invis_only = #FALSE;
// RespawnDelay
st = infokey(world, "rd");
if (st == string_null)
st = infokey(world, "respawn_delay");
respawn_delay_time = stof(st);
if (respawn_delay_time)
toggleflags = toggleflags | #TFLAG_RESPAWNDELAY;
#else
// GRAPPLING HOOK
if (!(toggleflags & #TFLAG_GRAPPLE) && (CTF_Map == #FALSE))
allow_hook = #FALSE;
#endif
// If no Respawndelay has been specified, set the default
if (toggleflags & #TFLAG_RESPAWNDELAY && respawn_delay_time == 0)
respawn_delay_time = #RESPAWN_DELAY_TIME;
// Prevent autoteam from kicking in for 30 seconds.
// Allows restructuring of the teams from the last map nicely.
if (toggleflags & #TFLAG_AUTOTEAM)
{
toggleflags = toggleflags - (toggleflags & #TFLAG_AUTOTEAM);
ent = spawn();
ent.nextthink = time + autoteam_time;
ent.think = autoteam_think;
}
}
if (parm11)
self.tfstate = parm11;
if (self.playerclass == 0)
self.playerclass = parm12;
#ifdef STATUSBAR
if (parm13)
self.StatusBarRes = parm13;
if (parm14)
self.StatusBarSize = parm14;
#endif
#ifdef QUAKE_WORLD
if (parm15)
self.admin_flag = parm15; //CH Admin status :)
#endif
};
/*
============
FindIntermission
Returns the entity to view from
============
*/
entity() FindIntermission =
{
local entity spot;
local float cyc;
// look for info_intermission first
spot = find (world, classname, "info_intermission");
if (spot)
{ // pick a random one
cyc = random() * 1;
// Following removed for the observer code
/*while (cyc > 1)
{
spot = find (spot, classname, "info_intermission");
if (!spot)
spot = find (spot, classname, "info_intermission");
cyc = cyc - 1;
}*/
return spot;
}
// then look for the start position
spot = find (world, classname, "info_player_start");
if (spot)
return spot;
// then look through the deathmatch starts
spot = find (world, classname, "info_player_deathmatch");
if (spot)
{
// pick a random one
cyc = random() * 6;
while (cyc > 1)
{
spot = find (spot, classname, "info_player_deathmatch");
if (!spot)
spot = find (spot, classname, "info_player_deathmatch");
cyc = cyc - 1;
}
return spot;
}
objerror ("FindIntermission: no spot");
};
/*===========================
FindNextIntermission
returns the next intermission point
===========================*/
entity (entity start_point) FindNextIntermission =
{
local entity spot;
//local float cyc;
if (deathmatch)
{
// look through info_intermission first
if (start_point.classname == "info_intermission" || start_point == world)
{
spot = find (start_point, classname, "info_intermission");
if (spot)
return spot;
else
start_point = world;
}
// then look through the deathmatch starts
if (start_point.classname == "info_player_deathmatch" || start_point == world)
{
spot = find (start_point, classname, "info_player_deathmatch");
if (spot)
return spot;
}
// at the end of the list
spot = find (world, classname, "info_intermission");
if (spot)
return spot;
spot = find (world, classname, "info_player_deathmatch");
if (spot)
return spot;
}
else // do not cycle though in co-op or single
{
spot = find (world, classname, "info_player_start");
if (spot)
return spot;
}
// it should never reach this point
return FindIntermission();
};
/*==================================================
TF_MovePlayer
Moves the player to another intermission viewpoint
====================================================*/
void() TF_MovePlayer =
{
local entity place;
place = FindNextIntermission(self.observer_list);
self.observer_list = place;
setorigin(self, place.origin + '0 0 1');
self.angles = place.angles;
self.fixangle = #TRUE; // turn this way immediately
};
//- OfN - Map cycling code modified to match TF2.8 standard
float(float checkIP, float noIdlers) GetNoPlayers;
void() SetCycleTimeoutTimer;
void() SetCycleErrorCheck;
void() SetCycleTimer;
//- OfN - super new map cycling code :)
float() DoExtraCycle =
{
local string nfmap, temp;
nfmap = infokey(world, "nmap");
if (nfmap != string_null)
{
local float minplayers, maxplayers, itsok, currentpl;
if (infokey(world,"minp")!="")
minplayers = stof(infokey(world,"minp"));
else
minplayers = 0;
if (infokey(world,"maxp")!="")
maxplayers = stof(infokey(world,"maxp"));
else
maxplayers = 32;
itsok = #TRUE;
currentpl = GetNoPlayers(#FALSE, #FALSE);
//check conditions
if (minplayers > currentpl)
{
bprint(#PRINT_HIGH,"Map ");
nfmap = infokey(world, "nmap");
bprint(#PRINT_HIGH, nfmap);
bprint(#PRINT_HIGH," skipped minimum players ");
temp = ftos(minplayers);
bprint(#PRINT_HIGH, temp);
bprint(#PRINT_HIGH," ¨currently ");
temp = ftos(currentpl);
bprint(#PRINT_HIGH, temp);
bprint(#PRINT_HIGH,"©\n");
itsok = #FALSE;
}
else
{
if (maxplayers < currentpl)
{
bprint(#PRINT_HIGH,"Map ");
nfmap = infokey(world, "nmap");
bprint(#PRINT_HIGH, nfmap);
bprint(#PRINT_HIGH," skipped maximum players ");
temp = ftos(maxplayers);
bprint(#PRINT_HIGH,temp);
bprint(#PRINT_HIGH," ¨currently ");
temp = ftos(currentpl);
bprint(#PRINT_HIGH,temp);
bprint(#PRINT_HIGH,"©\n");
itsok = #FALSE;
}
}
//cleanup..
localcmd("localinfo minp \"\"\n");
localcmd("localinfo maxp \"\"\n");
//locals clean
//execute map conditions ok
if (itsok)
{
nfmap = infokey(world, "nmap");
LaunchMap(nfmap);
return #TRUE;
}
else //conditions not passed...
{
localcmd("localinfo nmap \"\"\n");
return #FALSE;
}
}
return #FALSE;
};
void() GotoNextMap;
void() cycle_timer_think =
{
GotoNextMap();
dremove(self);
};
void() cycle_timeout_think =
{
// Silently report to server console and remote debugger
//RPrint("Warning: Error executing map cfg file, it doesn't exist or it doesn't make an explicit map change\n\n Attempting direct map launch...\n\n");
// Direct map launch
local string tmap;
tmap = infokey(world,"tmap");
localcmd("map ");
localcmd(tmap);
localcmd("\n");
// If map is really launched the following timer never runs
SetCycleErrorCheck();
dremove(self);
};
void() cycle_error_think =
{
// Get name of problematic map
local string tmap;
tmap = infokey(world,"tmap");
// And display it to every1 on server