-
Notifications
You must be signed in to change notification settings - Fork 148
/
Q3_Interface.cpp
11286 lines (9713 loc) · 252 KB
/
Q3_Interface.cpp
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
// ICARUS Engine Interface File
//
// This file is the only section of the ICARUS systems that
// is not directly portable from engine to engine.
//
// -- jweier
// leave this line at the top for PCH reasons...
#include "g_headers.h"
#include "g_local.h"
#include "g_functions.h"
#include "Q3_Interface.h"
#include "anims.h"
#include "b_local.h"
#include "events.h"
#include "g_nav.h"
#include "..\cgame\cg_camera.h"
#include "..\game\objectives.h"
#include "g_roff.h"
#include "..\cgame\cg_local.h"
#include "wp_saber.h"
#include "g_vehicles.h"
extern cvar_t *com_buildScript;
extern void InitMover( gentity_t *ent );
extern void MatchTeam( gentity_t *teamLeader, int moverState, int time );
//extern void SetMoverState( gentity_t *ent, moverState_t moverState, int time );
extern void ChangeWeapon( gentity_t *ent, int newWeapon );
extern char *G_GetLocationForEnt( gentity_t *ent );
extern void NPC_BSSearchStart( int homeWp, bState_t bState );
extern void InitMoverTrData( gentity_t *ent );
extern qboolean SpotWouldTelefrag2( gentity_t *mover, vec3_t dest );
extern cvar_t *g_sex;
extern cvar_t *g_timescale;
extern void G_SetEnemy( gentity_t *self, gentity_t *enemy );
//extern void FX_BorgTeleport( vec3_t org );
static void Q3_SetWeapon (int entID, const char *wp_name);
static void Q3_SetItem (int entID, const char *item_name);
extern void CG_ChangeWeapon( int num );
extern int TAG_GetOrigin2( const char *owner, const char *name, vec3_t origin );
extern void G_TeamRetaliation ( gentity_t *targ, gentity_t *attacker, qboolean stopIcarus );
extern void G_PlayDoorLoopSound( gentity_t *ent );
extern void G_PlayDoorSound( gentity_t *ent, int type );
extern void NPC_SetLookTarget( gentity_t *self, int entNum, int clearTime );
extern void NPC_ClearLookTarget( gentity_t *self );
extern void WP_SaberSetColor( gentity_t *ent, int saberNum, int bladeNum, char *colorName );
extern void WP_SetSaber( gentity_t *ent, int saberNum, char *saberName );
extern qboolean PM_HasAnimation( gentity_t *ent, int animation );
extern void G_ChangePlayerModel( gentity_t *ent, const char *newModel );
extern vehicleType_t TranslateVehicleName( char *name );
extern void WP_SetSaberOrigin( gentity_t *self, vec3_t newOrg );
extern void JET_FlyStart( gentity_t *self );
extern void JET_FlyStop( gentity_t *self );
extern void Rail_LockCenterOfTrack(const char* trackName);
extern void Rail_UnLockCenterOfTrack(const char* trackName);
extern void G_GetBoltPosition( gentity_t *self, int boltIndex, vec3_t pos, int modelIndex = 0 );
extern qboolean G_DoDismemberment( gentity_t *self, vec3_t point, int mod, int damage, int hitLoc, qboolean force = qfalse );
extern int BMS_START;
extern int BMS_MID;
extern int BMS_END;
extern cvar_t *g_skippingcin;
extern qboolean stop_icarus;
static void PrisonerObjCheck(const char *name,const char *data);
#define stringIDExpand(str, strEnum) str, strEnum, ENUM2STRING(strEnum)
//#define stringIDExpand(str, strEnum) str,strEnum
/*
stringID_table_t tagsTable [] =
{
}
*/
stringID_table_t BSTable[] =
{
ENUM2STRING(BS_DEFAULT),//# default behavior for that NPC
ENUM2STRING(BS_ADVANCE_FIGHT),//# Advance to captureGoal and shoot enemies if you can
ENUM2STRING(BS_SLEEP),//# Play awake script when startled by sound
ENUM2STRING(BS_FOLLOW_LEADER),//# Follow your leader and shoot any enemies you come across
ENUM2STRING(BS_JUMP),//# Face navgoal and jump to it.
ENUM2STRING(BS_SEARCH),//# Using current waypoint as a base), search the immediate branches of waypoints for enemies
ENUM2STRING(BS_WANDER),//# Wander down random waypoint paths
ENUM2STRING(BS_NOCLIP),//# Moves through walls), etc.
ENUM2STRING(BS_REMOVE),//# Waits for player to leave PVS then removes itself
ENUM2STRING(BS_CINEMATIC),//# Does nothing but face it's angles and move to a goal if it has one
ENUM2STRING(BS_FLEE),//# Run toward the nav goal, avoiding danger
//the rest are internal only
"", -1,
};
stringID_table_t BSETTable[] =
{
ENUM2STRING(BSET_SPAWN),//# script to use when first spawned
ENUM2STRING(BSET_USE),//# script to use when used
ENUM2STRING(BSET_AWAKE),//# script to use when awoken/startled
ENUM2STRING(BSET_ANGER),//# script to use when aquire an enemy
ENUM2STRING(BSET_ATTACK),//# script to run when you attack
ENUM2STRING(BSET_VICTORY),//# script to run when you kill someone
ENUM2STRING(BSET_LOSTENEMY),//# script to run when you can't find your enemy
ENUM2STRING(BSET_PAIN),//# script to use when take pain
ENUM2STRING(BSET_FLEE),//# script to use when take pain below 50% of health
ENUM2STRING(BSET_DEATH),//# script to use when killed
ENUM2STRING(BSET_DELAYED),//# script to run when self->delayScriptTime is reached
ENUM2STRING(BSET_BLOCKED),//# script to run when blocked by a friendly NPC or player
ENUM2STRING(BSET_BUMPED),//# script to run when bumped into a friendly NPC or player (can set bumpRadius)
ENUM2STRING(BSET_STUCK),//# script to run when blocked by a wall
ENUM2STRING(BSET_FFIRE),//# script to run when player shoots their own teammates
ENUM2STRING(BSET_FFDEATH),//# script to run when player kills a teammate
stringIDExpand("", BSET_INVALID),
"", -1,
};
stringID_table_t WPTable[] =
{
"NULL",WP_NONE,
ENUM2STRING(WP_NONE),
// Player weapons
ENUM2STRING(WP_SABER), // NOTE: lots of code assumes this is the first weapon (... which is crap) so be careful -Ste.
ENUM2STRING(WP_BLASTER_PISTOL), // apparently some enemy only version of the blaster
ENUM2STRING(WP_BLASTER),
ENUM2STRING(WP_DISRUPTOR),
ENUM2STRING(WP_BOWCASTER),
ENUM2STRING(WP_REPEATER),
ENUM2STRING(WP_DEMP2),
ENUM2STRING(WP_FLECHETTE),
ENUM2STRING(WP_ROCKET_LAUNCHER),
ENUM2STRING(WP_THERMAL),
ENUM2STRING(WP_TRIP_MINE),
ENUM2STRING(WP_DET_PACK),
ENUM2STRING(WP_CONCUSSION),
ENUM2STRING(WP_MELEE), // Any ol' melee attack
//NOTE: player can only have up to 16 weapons), anything after that is enemy only
ENUM2STRING(WP_STUN_BATON),
// NPC enemy weapons
ENUM2STRING(WP_BRYAR_PISTOL),
ENUM2STRING(WP_EMPLACED_GUN),
ENUM2STRING(WP_BOT_LASER), // Probe droid - Laser blast
ENUM2STRING(WP_TURRET), // turret guns
ENUM2STRING(WP_ATST_MAIN),
ENUM2STRING(WP_ATST_SIDE),
ENUM2STRING(WP_TIE_FIGHTER),
ENUM2STRING(WP_RAPID_FIRE_CONC),
ENUM2STRING(WP_JAWA),
ENUM2STRING(WP_TUSKEN_RIFLE),
ENUM2STRING(WP_TUSKEN_STAFF),
ENUM2STRING(WP_SCEPTER),
ENUM2STRING(WP_NOGHRI_STICK),
"", NULL
};
stringID_table_t INVTable[] =
{
ENUM2STRING(INV_ELECTROBINOCULARS),
ENUM2STRING(INV_BACTA_CANISTER),
ENUM2STRING(INV_SEEKER),
ENUM2STRING(INV_LIGHTAMP_GOGGLES),
ENUM2STRING(INV_SENTRY),
"", NULL
};
stringID_table_t eventTable[] =
{
//BOTH_h
//END
"", EV_BAD,
};
stringID_table_t DMSTable[] =
{
"NULL",-1,
ENUM2STRING(DM_AUTO), //# let the game determine the dynamic music as normal
ENUM2STRING(DM_SILENCE), //# stop the music
ENUM2STRING(DM_EXPLORE), //# force the exploration music to play
ENUM2STRING(DM_ACTION), //# force the action music to play
ENUM2STRING(DM_BOSS), //# force the boss battle music to play (if there is any)
ENUM2STRING(DM_DEATH), //# force the "player dead" music to play
"", -1
};
stringID_table_t HLTable[] =
{
"NULL",-1,
ENUM2STRING(HL_FOOT_RT),
ENUM2STRING(HL_FOOT_LT),
ENUM2STRING(HL_LEG_RT),
ENUM2STRING(HL_LEG_LT),
ENUM2STRING(HL_WAIST),
ENUM2STRING(HL_BACK_RT),
ENUM2STRING(HL_BACK_LT),
ENUM2STRING(HL_BACK),
ENUM2STRING(HL_CHEST_RT),
ENUM2STRING(HL_CHEST_LT),
ENUM2STRING(HL_CHEST),
ENUM2STRING(HL_ARM_RT),
ENUM2STRING(HL_ARM_LT),
ENUM2STRING(HL_HAND_RT),
ENUM2STRING(HL_HAND_LT),
ENUM2STRING(HL_HEAD),
ENUM2STRING(HL_GENERIC1),
ENUM2STRING(HL_GENERIC2),
ENUM2STRING(HL_GENERIC3),
ENUM2STRING(HL_GENERIC4),
ENUM2STRING(HL_GENERIC5),
ENUM2STRING(HL_GENERIC6),
"", -1
};
stringID_table_t setTable[] =
{
ENUM2STRING(SET_SPAWNSCRIPT),//0
ENUM2STRING(SET_USESCRIPT),
ENUM2STRING(SET_AWAKESCRIPT),
ENUM2STRING(SET_ANGERSCRIPT),
ENUM2STRING(SET_ATTACKSCRIPT),
ENUM2STRING(SET_VICTORYSCRIPT),
ENUM2STRING(SET_PAINSCRIPT),
ENUM2STRING(SET_FLEESCRIPT),
ENUM2STRING(SET_DEATHSCRIPT),
ENUM2STRING(SET_DELAYEDSCRIPT),
ENUM2STRING(SET_BLOCKEDSCRIPT),
ENUM2STRING(SET_FFIRESCRIPT),
ENUM2STRING(SET_FFDEATHSCRIPT),
ENUM2STRING(SET_MINDTRICKSCRIPT),
ENUM2STRING(SET_NO_MINDTRICK),
ENUM2STRING(SET_ORIGIN),
ENUM2STRING(SET_TELEPORT_DEST),
ENUM2STRING(SET_ANGLES),
ENUM2STRING(SET_XVELOCITY),
ENUM2STRING(SET_YVELOCITY),
ENUM2STRING(SET_ZVELOCITY),
ENUM2STRING(SET_Z_OFFSET),
ENUM2STRING(SET_ENEMY),
ENUM2STRING(SET_LEADER),
ENUM2STRING(SET_NAVGOAL),
ENUM2STRING(SET_ANIM_UPPER),
ENUM2STRING(SET_ANIM_LOWER),
ENUM2STRING(SET_ANIM_BOTH),
ENUM2STRING(SET_ANIM_HOLDTIME_LOWER),
ENUM2STRING(SET_ANIM_HOLDTIME_UPPER),
ENUM2STRING(SET_ANIM_HOLDTIME_BOTH),
ENUM2STRING(SET_PLAYER_TEAM),
ENUM2STRING(SET_ENEMY_TEAM),
ENUM2STRING(SET_BEHAVIOR_STATE),
ENUM2STRING(SET_BEHAVIOR_STATE),
ENUM2STRING(SET_HEALTH),
ENUM2STRING(SET_ARMOR),
ENUM2STRING(SET_DEFAULT_BSTATE),
ENUM2STRING(SET_CAPTURE),
ENUM2STRING(SET_DPITCH),
ENUM2STRING(SET_DYAW),
ENUM2STRING(SET_EVENT),
ENUM2STRING(SET_TEMP_BSTATE),
ENUM2STRING(SET_COPY_ORIGIN),
ENUM2STRING(SET_VIEWTARGET),
ENUM2STRING(SET_WEAPON),
ENUM2STRING(SET_ITEM),
ENUM2STRING(SET_WALKSPEED),
ENUM2STRING(SET_RUNSPEED),
ENUM2STRING(SET_YAWSPEED),
ENUM2STRING(SET_AGGRESSION),
ENUM2STRING(SET_AIM),
ENUM2STRING(SET_FRICTION),
ENUM2STRING(SET_GRAVITY),
ENUM2STRING(SET_IGNOREPAIN),
ENUM2STRING(SET_IGNOREENEMIES),
ENUM2STRING(SET_IGNOREALERTS),
ENUM2STRING(SET_DONTSHOOT),
ENUM2STRING(SET_DONTFIRE),
ENUM2STRING(SET_LOCKED_ENEMY),
ENUM2STRING(SET_NOTARGET),
ENUM2STRING(SET_LEAN),
ENUM2STRING(SET_CROUCHED),
ENUM2STRING(SET_WALKING),
ENUM2STRING(SET_RUNNING),
ENUM2STRING(SET_CHASE_ENEMIES),
ENUM2STRING(SET_LOOK_FOR_ENEMIES),
ENUM2STRING(SET_FACE_MOVE_DIR),
ENUM2STRING(SET_ALT_FIRE),
ENUM2STRING(SET_DONT_FLEE),
ENUM2STRING(SET_FORCED_MARCH),
ENUM2STRING(SET_NO_RESPONSE),
ENUM2STRING(SET_NO_COMBAT_TALK),
ENUM2STRING(SET_NO_ALERT_TALK),
ENUM2STRING(SET_UNDYING),
ENUM2STRING(SET_TREASONED),
ENUM2STRING(SET_DISABLE_SHADER_ANIM),
ENUM2STRING(SET_SHADER_ANIM),
ENUM2STRING(SET_INVINCIBLE),
ENUM2STRING(SET_NOAVOID),
ENUM2STRING(SET_SHOOTDIST),
ENUM2STRING(SET_TARGETNAME),
ENUM2STRING(SET_TARGET),
ENUM2STRING(SET_TARGET2),
ENUM2STRING(SET_LOCATION),
ENUM2STRING(SET_PAINTARGET),
ENUM2STRING(SET_TIMESCALE),
ENUM2STRING(SET_VISRANGE),
ENUM2STRING(SET_EARSHOT),
ENUM2STRING(SET_VIGILANCE),
ENUM2STRING(SET_HFOV),
ENUM2STRING(SET_VFOV),
ENUM2STRING(SET_DELAYSCRIPTTIME),
ENUM2STRING(SET_FORWARDMOVE),
ENUM2STRING(SET_RIGHTMOVE),
ENUM2STRING(SET_LOCKYAW),
ENUM2STRING(SET_SOLID),
ENUM2STRING(SET_CAMERA_GROUP),
ENUM2STRING(SET_CAMERA_GROUP_Z_OFS),
ENUM2STRING(SET_CAMERA_GROUP_TAG),
ENUM2STRING(SET_LOOK_TARGET),
ENUM2STRING(SET_ADDRHANDBOLT_MODEL),
ENUM2STRING(SET_REMOVERHANDBOLT_MODEL),
ENUM2STRING(SET_ADDLHANDBOLT_MODEL),
ENUM2STRING(SET_REMOVELHANDBOLT_MODEL),
ENUM2STRING(SET_FACEAUX),
ENUM2STRING(SET_FACEBLINK),
ENUM2STRING(SET_FACEBLINKFROWN),
ENUM2STRING(SET_FACEFROWN),
ENUM2STRING(SET_FACENORMAL),
ENUM2STRING(SET_FACEEYESCLOSED),
ENUM2STRING(SET_FACEEYESOPENED),
ENUM2STRING(SET_SCROLLTEXT),
ENUM2STRING(SET_LCARSTEXT),
ENUM2STRING(SET_CENTERTEXT),
ENUM2STRING(SET_SCROLLTEXTCOLOR),
ENUM2STRING(SET_CAPTIONTEXTCOLOR),
ENUM2STRING(SET_CENTERTEXTCOLOR),
ENUM2STRING(SET_PLAYER_USABLE),
ENUM2STRING(SET_STARTFRAME),
ENUM2STRING(SET_ENDFRAME),
ENUM2STRING(SET_ANIMFRAME),
ENUM2STRING(SET_LOOP_ANIM),
ENUM2STRING(SET_INTERFACE),
ENUM2STRING(SET_SHIELDS),
ENUM2STRING(SET_NO_KNOCKBACK),
ENUM2STRING(SET_INVISIBLE),
ENUM2STRING(SET_VAMPIRE),
ENUM2STRING(SET_FORCE_INVINCIBLE),
ENUM2STRING(SET_GREET_ALLIES),
ENUM2STRING(SET_PLAYER_LOCKED),
ENUM2STRING(SET_LOCK_PLAYER_WEAPONS),
ENUM2STRING(SET_NO_IMPACT_DAMAGE),
ENUM2STRING(SET_PARM1),
ENUM2STRING(SET_PARM2),
ENUM2STRING(SET_PARM3),
ENUM2STRING(SET_PARM4),
ENUM2STRING(SET_PARM5),
ENUM2STRING(SET_PARM6),
ENUM2STRING(SET_PARM7),
ENUM2STRING(SET_PARM8),
ENUM2STRING(SET_PARM9),
ENUM2STRING(SET_PARM10),
ENUM2STRING(SET_PARM11),
ENUM2STRING(SET_PARM12),
ENUM2STRING(SET_PARM13),
ENUM2STRING(SET_PARM14),
ENUM2STRING(SET_PARM15),
ENUM2STRING(SET_PARM16),
ENUM2STRING(SET_DEFEND_TARGET),
ENUM2STRING(SET_WAIT),
ENUM2STRING(SET_COUNT),
ENUM2STRING(SET_SHOT_SPACING),
ENUM2STRING(SET_VIDEO_PLAY),
ENUM2STRING(SET_VIDEO_FADE_IN),
ENUM2STRING(SET_VIDEO_FADE_OUT),
ENUM2STRING(SET_REMOVE_TARGET),
ENUM2STRING(SET_LOADGAME),
ENUM2STRING(SET_MENU_SCREEN),
ENUM2STRING(SET_OBJECTIVE_SHOW),
ENUM2STRING(SET_OBJECTIVE_HIDE),
ENUM2STRING(SET_OBJECTIVE_SUCCEEDED),
ENUM2STRING(SET_OBJECTIVE_SUCCEEDED_NO_UPDATE),
ENUM2STRING(SET_OBJECTIVE_FAILED),
ENUM2STRING(SET_MISSIONFAILED),
ENUM2STRING(SET_TACTICAL_SHOW),
ENUM2STRING(SET_TACTICAL_HIDE),
ENUM2STRING(SET_FOLLOWDIST),
ENUM2STRING(SET_SCALE),
ENUM2STRING(SET_OBJECTIVE_CLEARALL),
ENUM2STRING(SET_OBJECTIVE_LIGHTSIDE),
ENUM2STRING(SET_MISSIONSTATUSTEXT),
ENUM2STRING(SET_WIDTH),
ENUM2STRING(SET_CLOSINGCREDITS),
ENUM2STRING(SET_SKILL),
ENUM2STRING(SET_MISSIONSTATUSTIME),
ENUM2STRING(SET_FORCE_HEAL_LEVEL),
ENUM2STRING(SET_FORCE_JUMP_LEVEL),
ENUM2STRING(SET_FORCE_SPEED_LEVEL),
ENUM2STRING(SET_FORCE_PUSH_LEVEL),
ENUM2STRING(SET_FORCE_PULL_LEVEL),
ENUM2STRING(SET_FORCE_MINDTRICK_LEVEL),
ENUM2STRING(SET_FORCE_GRIP_LEVEL),
ENUM2STRING(SET_FORCE_LIGHTNING_LEVEL),
ENUM2STRING(SET_SABER_THROW),
ENUM2STRING(SET_SABER_DEFENSE),
ENUM2STRING(SET_SABER_OFFENSE),
ENUM2STRING(SET_FORCE_RAGE_LEVEL),
ENUM2STRING(SET_FORCE_PROTECT_LEVEL),
ENUM2STRING(SET_FORCE_ABSORB_LEVEL),
ENUM2STRING(SET_FORCE_DRAIN_LEVEL),
ENUM2STRING(SET_FORCE_SIGHT_LEVEL),
ENUM2STRING(SET_SABER1_COLOR1),
ENUM2STRING(SET_SABER1_COLOR2),
ENUM2STRING(SET_SABER2_COLOR1),
ENUM2STRING(SET_SABER2_COLOR2),
ENUM2STRING(SET_DISMEMBER_LIMB),
ENUM2STRING(SET_VIEWENTITY),
ENUM2STRING(SET_WATCHTARGET),
ENUM2STRING(SET_SABERACTIVE),
ENUM2STRING(SET_SABER1BLADEON),
ENUM2STRING(SET_SABER1BLADEOFF),
ENUM2STRING(SET_SABER2BLADEON),
ENUM2STRING(SET_SABER2BLADEOFF),
ENUM2STRING(SET_ADJUST_AREA_PORTALS),
ENUM2STRING(SET_DMG_BY_HEAVY_WEAP_ONLY),
ENUM2STRING(SET_SHIELDED),
ENUM2STRING(SET_NO_GROUPS),
ENUM2STRING(SET_FIRE_WEAPON),
ENUM2STRING(SET_FIRE_WEAPON_NO_ANIM),
ENUM2STRING(SET_SAFE_REMOVE),
ENUM2STRING(SET_BOBA_JET_PACK),
ENUM2STRING(SET_INACTIVE),
ENUM2STRING(SET_FUNC_USABLE_VISIBLE),
ENUM2STRING(SET_END_SCREENDISSOLVE),
ENUM2STRING(SET_LOOPSOUND),
ENUM2STRING(SET_ICARUS_FREEZE),
ENUM2STRING(SET_ICARUS_UNFREEZE),
ENUM2STRING(SET_SABER1),
ENUM2STRING(SET_SABER2),
ENUM2STRING(SET_PLAYERMODEL),
ENUM2STRING(SET_VEHICLE),
ENUM2STRING(SET_SECURITY_KEY),
ENUM2STRING(SET_DAMAGEENTITY),
ENUM2STRING(SET_USE_CP_NEAREST),
ENUM2STRING(SET_MORELIGHT),
ENUM2STRING(SET_CINEMATIC_SKIPSCRIPT),
ENUM2STRING(SET_RAILCENTERTRACKLOCKED),
ENUM2STRING(SET_RAILCENTERTRACKUNLOCKED),
ENUM2STRING(SET_NO_FORCE),
ENUM2STRING(SET_NO_FALLTODEATH),
ENUM2STRING(SET_DISMEMBERABLE),
ENUM2STRING(SET_NO_ACROBATICS),
ENUM2STRING(SET_MUSIC_STATE),
ENUM2STRING(SET_USE_SUBTITLES),
ENUM2STRING(SET_CLEAN_DAMAGING_ENTS),
ENUM2STRING(SET_HUD),
//JKA
ENUM2STRING(SET_NO_PVS_CULL),
ENUM2STRING(SET_CLOAK),
ENUM2STRING(SET_RENDER_CULL_RADIUS),
ENUM2STRING(SET_DISTSQRD_TO_PLAYER),
ENUM2STRING(SET_FORCE_HEAL),
ENUM2STRING(SET_FORCE_SPEED),
ENUM2STRING(SET_FORCE_PUSH),
ENUM2STRING(SET_FORCE_PUSH_FAKE),
ENUM2STRING(SET_FORCE_PULL),
ENUM2STRING(SET_FORCE_MIND_TRICK),
ENUM2STRING(SET_FORCE_GRIP),
ENUM2STRING(SET_FORCE_LIGHTNING),
ENUM2STRING(SET_FORCE_SABERTHROW),
ENUM2STRING(SET_FORCE_RAGE),
ENUM2STRING(SET_FORCE_PROTECT),
ENUM2STRING(SET_FORCE_ABSORB),
ENUM2STRING(SET_FORCE_DRAIN),
ENUM2STRING(SET_WINTER_GEAR),
ENUM2STRING(SET_NO_ANGLES),
ENUM2STRING(SET_SABER_ORIGIN),
ENUM2STRING(SET_SKIN),
"", SET_,
};
qboolean COM_ParseString( char **data, char **s );
//=======================================================================
vec4_t textcolor_caption;
vec4_t textcolor_center;
vec4_t textcolor_scroll;
/*
-------------------------
void Q3_SetTaskID( gentity_t *ent, taskID_t taskType, int taskID )
-------------------------
*/
static void Q3_TaskIDSet( gentity_t *ent, taskID_t taskType, int taskID )
{
if ( taskType < TID_CHAN_VOICE || taskType >= NUM_TIDS )
{
return;
}
//Might be stomping an old task, so complete and clear previous task if there was one
Q3_TaskIDComplete( ent, taskType );
ent->taskID[taskType] = taskID;
}
/*
-------------------------
SetTextColor
-------------------------
*/
static void SetTextColor ( vec4_t textcolor,const char *color)
{
if (Q_stricmp(color,"BLACK") == 0)
{
Vector4Copy( colorTable[CT_BLACK], textcolor );
}
else if (Q_stricmp(color,"RED") == 0)
{
Vector4Copy( colorTable[CT_RED], textcolor );
}
else if (Q_stricmp(color,"GREEN") == 0)
{
Vector4Copy( colorTable[CT_GREEN], textcolor );
}
else if (Q_stricmp(color,"YELLOW") == 0)
{
Vector4Copy( colorTable[CT_YELLOW], textcolor );
}
else if (Q_stricmp(color,"BLUE") == 0)
{
Vector4Copy( colorTable[CT_BLUE], textcolor );
}
else if (Q_stricmp(color,"CYAN") == 0)
{
Vector4Copy( colorTable[CT_CYAN], textcolor );
}
else if (Q_stricmp(color,"MAGENTA") == 0)
{
Vector4Copy( colorTable[CT_MAGENTA], textcolor );
}
else if (Q_stricmp(color,"WHITE") == 0)
{
Vector4Copy( colorTable[CT_WHITE], textcolor );
}
else
{
Vector4Copy( colorTable[CT_WHITE], textcolor );
}
return;
}
/*
-------------------------
void Q3_ClearTaskID( int *taskID )
WARNING: Clearing a taskID will make that task never finish unless you intend to
return the same taskID from somewhere else.
-------------------------
*/
void Q3_TaskIDClear( int *taskID )
{
*taskID = -1;
}
/*
-------------------------
qboolean Q3_TaskIDPending( gentity_t *ent, taskID_t taskType )
-------------------------
*/
qboolean Q3_TaskIDPending( gentity_t *ent, taskID_t taskType )
{
if ( ent->m_iIcarusID == IIcarusInterface::ICARUS_INVALID /*!ent->sequencer || !ent->taskManager*/ )
{
return qfalse;
}
if ( taskType < TID_CHAN_VOICE || taskType >= NUM_TIDS )
{
return qfalse;
}
if ( ent->taskID[taskType] >= 0 )//-1 is none
{
return qtrue;
}
return qfalse;
}
/*
-------------------------
void Q3_TaskIDComplete( gentity_t *ent, taskID_t taskType )
-------------------------
*/
void Q3_TaskIDComplete( gentity_t *ent, taskID_t taskType )
{
if ( taskType < TID_CHAN_VOICE || taskType >= NUM_TIDS )
{
return;
}
if ( ent->m_iIcarusID != IIcarusInterface::ICARUS_INVALID /*ent->taskManager*/ && Q3_TaskIDPending( ent, taskType ) )
{//Complete it
IIcarusInterface::GetIcarus()->Completed( ent->m_iIcarusID, ent->taskID[taskType] );
//See if any other tasks have the name number and clear them so we don't complete more than once
int clearTask = ent->taskID[taskType];
for ( int tid = 0; tid < NUM_TIDS; tid++ )
{
if ( ent->taskID[tid] == clearTask )
{
Q3_TaskIDClear( &ent->taskID[tid] );
}
}
//clear it - should be cleared in for loop above
//Q3_TaskIDClear( &ent->taskID[taskType] );
}
//otherwise, wasn't waiting for a task to complete anyway
}
/*
============
Q3_CheckStringCounterIncrement
Description :
Return type : static float
Argument : const char *string
============
*/
static float Q3_CheckStringCounterIncrement( const char *string )
{
char *numString;
float val = 0.0f;
if ( string[0] == '+' )
{//We want to increment whatever the value is by whatever follows the +
if ( string[1] )
{
numString = (char *)&string[1];
val = atof( numString );
}
}
else if ( string[0] == '-' )
{//we want to decrement
if ( string[1] )
{
numString = (char *)&string[1];
val = atof( numString ) * -1;
}
}
return val;
}
/*
-------------------------
Q3_GetAnimLower
-------------------------
*/
static char *Q3_GetAnimLower( gentity_t *ent )
{
if ( ent->client == NULL )
{
Quake3Game()->DebugPrint( IGameInterface::WL_WARNING, "Q3_GetAnimLower: attempted to read animation state off non-client!\n" );
return NULL;
}
int anim = ent->client->ps.legsAnim;
return (char *) GetStringForID( animTable, anim );
}
/*
-------------------------
Q3_GetAnimUpper
-------------------------
*/
static char *Q3_GetAnimUpper( gentity_t *ent )
{
if ( ent->client == NULL )
{
Quake3Game()->DebugPrint( IGameInterface::WL_WARNING, "Q3_GetAnimUpper: attempted to read animation state off non-client!\n" );
return NULL;
}
int anim = ent->client->ps.torsoAnim;
return (char *) GetStringForID( animTable, anim );
}
/*
-------------------------
Q3_GetAnimBoth
-------------------------
*/
static char *Q3_GetAnimBoth( gentity_t *ent )
{
char *lowerName, *upperName;
lowerName = Q3_GetAnimLower( ent );
upperName = Q3_GetAnimUpper( ent );
if ( VALIDSTRING( lowerName ) == false )
{
Quake3Game()->DebugPrint( IGameInterface::WL_WARNING, "Q3_GetAnimBoth: NULL legs animation string found!\n" );
return NULL;
}
if ( VALIDSTRING( upperName ) == false )
{
Quake3Game()->DebugPrint( IGameInterface::WL_WARNING, "Q3_GetAnimBoth: NULL torso animation string found!\n" );
return NULL;
}
if ( stricmp( lowerName, upperName ) )
{
#ifdef _DEBUG // sigh, cut down on tester reports that aren't important
Quake3Game()->DebugPrint( IGameInterface::WL_WARNING, "Q3_GetAnimBoth: legs and torso animations did not match : returning legs\n" );
#endif
}
return lowerName;
}
/*
-------------------------
Q3_SetObjective
-------------------------
*/
extern qboolean G_CheckPlayerDarkSide( void );
static void Q3_SetObjective(const char *ObjEnum, int status)
{
int objectiveID;
gclient_t *client;
objectives_t *objective;
int *objectivesShown;
client = &level.clients[0];
objectiveID = GetIDForString( objectiveTable, ObjEnum );
objective = &client->sess.mission_objectives[objectiveID];
objectivesShown = &client->sess.missionObjectivesShown;
switch (status)
{
case SET_OBJ_HIDE :
objective->display = OBJECTIVE_HIDE;
break;
case SET_OBJ_SHOW :
objective->display = OBJECTIVE_SHOW;
objectivesShown++;
missionInfo_Updated = qtrue; // Activate flashing text
break;
case SET_OBJ_PENDING :
objective->status = OBJECTIVE_STAT_PENDING;
if (objective->display != OBJECTIVE_HIDE)
{
objectivesShown++;
missionInfo_Updated = qtrue; // Activate flashing text
}
break;
case SET_OBJ_SUCCEEDED :
objective->status = OBJECTIVE_STAT_SUCCEEDED;
if (objective->display != OBJECTIVE_HIDE)
{
objectivesShown++;
missionInfo_Updated = qtrue; // Activate flashing text
}
break;
case SET_OBJ_FAILED :
objective->status = OBJECTIVE_STAT_FAILED;
if (objective->display != OBJECTIVE_HIDE)
{
objectivesShown++;
missionInfo_Updated = qtrue; // Activate flashing text
}
break;
}
if ( objectiveID == LIGHTSIDE_OBJ
&& status == SET_OBJ_FAILED )
{//don't do this unless we just set that specific objective (just turned to the dark side) with this SET_OBJECTIVE command
G_CheckPlayerDarkSide();
}
}
/*
-------------------------
Q3_SetMissionFailed
-------------------------
*/
extern void G_PlayerGuiltDeath( void );
static void Q3_SetMissionFailed(const char *TextEnum)
{
gentity_t *ent = &g_entities[0];
if ( ent->health >= 0 )
{
G_PlayerGuiltDeath();
}
ent->health = 0;
//FIXME: what about other NPCs? Scripts?
// statusTextIndex is looked at on the client side.
statusTextIndex = GetIDForString( missionFailedTable, TextEnum );
cg.missionStatusShow = qtrue;
if ( ent->client )
{//hold this screen up for at least 2 seconds
ent->client->respawnTime = level.time + 2000;
}
}
/*
-------------------------
Q3_SetStatusText
-------------------------
*/
static void Q3_SetStatusText(const char *StatusTextEnum)
{
int statusTextID;
statusTextID = GetIDForString( statusTextTable, StatusTextEnum );
switch (statusTextID)
{
case STAT_INSUBORDINATION:
case STAT_YOUCAUSEDDEATHOFTEAMMATE:
case STAT_DIDNTPROTECTTECH:
case STAT_DIDNTPROTECT7OF9:
case STAT_NOTSTEALTHYENOUGH:
case STAT_STEALTHTACTICSNECESSARY:
case STAT_WATCHYOURSTEP:
case STAT_JUDGEMENTMUCHDESIRED:
statusTextIndex = statusTextID;
break;
default:
assert(0);
break;
}
}
/*
-------------------------
Q3_ObjectiveClearAll
-------------------------
*/
static void Q3_ObjectiveClearAll(void)
{
client = &level.clients[0];
memset(client->sess.mission_objectives,0,sizeof(client->sess.mission_objectives));
}
/*
=============
Q3_SetCaptionTextColor
Change color text prints in
=============
*/
static void Q3_SetCaptionTextColor ( const char *color)
{
SetTextColor(textcolor_caption,color);
}
/*
=============
Q3_SetCenterTextColor
Change color text prints in
=============
*/
static void Q3_SetCenterTextColor ( const char *color)
{
SetTextColor(textcolor_center,color);
}
/*
=============
Q3_SetScrollTextColor
Change color text prints in
=============
*/
static void Q3_SetScrollTextColor ( const char *color)
{
SetTextColor(textcolor_scroll,color);
}
/*
=============
Q3_ScrollText
Prints a message in the center of the screen
=============
*/
static void Q3_ScrollText ( const char *id)
{
gi.SendServerCommand( NULL, "st \"%s\"", id);
return;
}
/*
=============
Q3_LCARSText
Prints a message in the center of the screen giving it an LCARS frame around it
=============
*/
static void Q3_LCARSText ( const char *id)
{
gi.SendServerCommand( NULL, "lt \"%s\"", id);
return;
}
/*
=============
`
Returns the sequencer of the entity by the given name
=============
*/
/*static gentity_t *Q3_GetEntityByName( const char *name )
{
gentity_t *ent;
entitylist_t::iterator ei;
char temp[1024];
if ( name == NULL || name[0] == NULL )
return NULL;
strncpy( (char *) temp, name, sizeof(temp) );
temp[sizeof(temp)-1] = 0;
ei = ICARUS_EntList.find( strupr( (char *) temp ) );
if ( ei == ICARUS_EntList.end() )
return NULL;
ent = &g_entities[(*ei).second];
return ent;
// this now returns the ent instead of the sequencer -- dmv 06/27/01
// if (ent == NULL)
// return NULL;
// return ent->sequencer;
}*/
/*
=============
Q3_GetTime
Get the current game time
=============
*/
/*static DWORD Q3_GetTime( void )
{
return level.time;
}*/
/*
=============
G_AddSexToPlayerString
Take any string, look for "jaden_male/" replace with "jaden_fmle/" based on "sex"
And: Take any string, look for "/mr_" replace with "/ms_" based on "sex"
returns qtrue if changed to ms
=============
*/
static qboolean G_AddSexToPlayerString ( char *string, qboolean qDoBoth )
{
char *start;
if VALIDSTRING( string ) {
if ( g_sex->string[0] == 'f' ) {
start = strstr( string, "jaden_male/" );
if ( start != NULL ) {
strncpy( start, "jaden_fmle", 10 );
return qtrue;
} else {
start = strrchr( string, '/' ); //get the last slash before the wav
if (start != NULL) {
if (!strncmp( start, "/mr_", 4) ) {
if (qDoBoth) { //we want to change mr to ms
start[2] = 's'; //change mr to ms
return qtrue;
} else { //IF qDoBoth
return qfalse; //don't want this one
}