forked from JACoders/OpenJK
/
bg_public.h
1974 lines (1636 loc) · 59.9 KB
/
bg_public.h
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
// bg_public.h
/*
===========================================================================
Copyright (C) 1999 - 2005, Id Software, Inc.
Copyright (C) 2000 - 2013, Raven Software, Inc.
Copyright (C) 2001 - 2013, Activision, Inc.
Copyright (C) 2013 - 2015, OpenJK contributors
This file is part of the OpenJK source code.
OpenJK is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
===========================================================================
*/
// bg_public.h -- definitions shared by both the server game and client game modules
// because games can change separately from the main system version, we need a
// second version that must match between game and cgame
// Copyright (C) 1999-2000 Id Software, Inc. (c) 2013 Jedi Knight Galaxies
#ifndef BG_PUBLIC_H
#define BG_PUBLIC_H
#include "bg_ammo.h"
#include "bg_weapons.h"
#include "anims.h"
#include "qcommon/game_version.h"
//these two defs are shared now because we do clientside ent parsing
#define MAX_SPAWN_VARS 64
#define MAX_SPAWN_VARS_CHARS 4096
#define GAME_VERSION "Jedi Knight Galaxies " JKG_VERSION
#define DEFAULT_SABER "Kyle"
#define DEFAULT_SABER_STAFF "dual_1"
#define DEFAULT_SABER_MODEL "models/weapons2/saber/saber_w.glm"
#define DEFAULT_MODEL "kyle"
#define DEFAULT_MODEL_FEMALE "jan"
#define DEFAULT_REDTEAM_NAME "Empire"
#define DEFAULT_BLUETEAM_NAME "Rebellion"
#define STEPSIZE 18
#define DEFAULT_FORCEPOWERS "0-1-000000000000000000"
#define DEFAULT_FORCEPOWERS_LEN (22) // numPowers + rank + side + separators
//"rank-side-heal.lev.speed.push.pull.tele.grip.lightning.rage.protect.absorb.teamheal.teamforce.drain.see"
#define DEFAULT_GRAVITY 800
#define GIB_HEALTH -40
#define ARMOR_PROTECTION 0.50 // Shields only stop 50% of armor-piercing dmg
#define ARMOR_REDUCTION_FACTOR 0.50 // Certain damage doesn't take off armor as efficiently
#define JUMP_VELOCITY 225//270
#define MAX_ITEMS 256
#define RANK_TIED_FLAG 0x4000
#define ITEM_RADIUS 15 // item sizes are needed for client side pickup detection
#define SCORE_NOT_PRESENT -9999 // for the CS_SCORES[12] when only one player is present
#define VOTE_TIME 30000 // 30 seconds before vote times out
#define DEFAULT_MINS_2 -24
#define DEFAULT_MAXS_2 40
#define CROUCH_MAXS_2 16
#define STANDARD_VIEWHEIGHT_OFFSET -4
#define MINS_Z -24
#define DEFAULT_VIEWHEIGHT (DEFAULT_MAXS_2+STANDARD_VIEWHEIGHT_OFFSET)//26
#define CROUCH_VIEWHEIGHT (CROUCH_MAXS_2+STANDARD_VIEWHEIGHT_OFFSET)//12
#define DEAD_VIEWHEIGHT -16
#define MAX_CLIENT_SCORE_SEND 20
// Xy: time to bring ironsights up
#define IRONSIGHTS_TIME (200)
// Sprint animation time --eez
#define SPRINT_TIME (300)
// damage flags
#define DAMAGE_NORMAL 0x00000000 // No flags set.
#define DAMAGE_RADIUS 0x00000001 // damage was indirect
#define DAMAGE_NO_SHIELD 0x00000002 // shield does not protect from this damage
#define DAMAGE_NO_KNOCKBACK 0x00000004 // do not affect velocity, just view angles
#define DAMAGE_NO_PROTECTION 0x00000008 // armor, shields, invulnerability, and godmode have no effect. Self-inflicted damage is also not reduced.
#define DAMAGE_NO_HIT_LOC 0x00000010 // No hit location
#define DAMAGE_NO_DISMEMBER 0x00000020 // Dont do dismemberment
//
// config strings are a general means of communicating variable length strings
// from the server to all connected clients.
//
// CS_SERVERINFO and CS_SYSTEMINFO are defined in q_shared.h
#define CS_MUSIC 2
#define CS_MESSAGE 3 // from the map worldspawn's message field
#define CS_MOTD 4 // g_motd string for server message of the day
#define CS_WARMUP 5 // server time when the match will be restarted
#define CS_SCORES1 6
#define CS_SCORES2 7
#define CS_VOTE_TIME 8
#define CS_VOTE_STRING 9
#define CS_VOTE_YES 10
#define CS_VOTE_NO 11
#define CS_TEAMVOTE_TIME 12
#define CS_TEAMVOTE_STRING 14
#define CS_TEAMVOTE_YES 16
#define CS_TEAMVOTE_NO 18
#define CS_GAME_VERSION 20
#define CS_LEVEL_START_TIME 21 // so the timer only shows the current level
#define CS_INTERMISSION 22 // when 1, fraglimit/timelimit has been hit and intermission will start in a second or two
#define CS_FLAGSTATUS 23 // string indicating flag status in CTF
#define CS_SHADERSTATE 24
#define CS_BOTINFO 25
#define CS_ITEMS 27 // string of 0's and 1's that tell which items are present
#define CS_CLIENT_DUELWINNER 28 // current duel round winner - needed for printing at top of scoreboard
#define CS_CLIENT_DUELISTS 29 // client numbers for both current duelists. Needed for a number of client-side things.
#define CS_CLIENT_DUELHEALTHS 30 // nmckenzie: DUEL_HEALTH. Hopefully adding this cs is safe and good?
#define CS_GLOBAL_AMBIENT_SET 31
#define CS_AMBIENT_SET 36
#define CS_MODELS (CS_AMBIENT_SET+MAX_AMBIENT_SETS)
#define CS_SKYBOXORG (CS_MODELS+MAX_MODELS) //rww - skybox info
#define CS_SOUNDS (CS_SKYBOXORG+1)
#define CS_ICONS (CS_SOUNDS+MAX_SOUNDS)
#define CS_PLAYERS (CS_ICONS+MAX_ICONS)
/*
Ghoul2 Insert Start
*/
#define CS_G2BONES (CS_PLAYERS+MAX_CLIENTS)
//rww - used to be CS_CHARSKINS, but I have eliminated the need for that.
/*
Ghoul2 Insert End
*/
#define CS_LOCATIONS (CS_G2BONES+MAX_G2BONES)
#define CS_PARTICLES (CS_LOCATIONS+MAX_LOCATIONS)
#define CS_EFFECTS (CS_PARTICLES+MAX_LOCATIONS)
#define CS_LIGHT_STYLES (CS_EFFECTS + MAX_FX)
//rwwRMG - added:
#define CS_TERRAINS (CS_LIGHT_STYLES + (MAX_LIGHT_STYLES*3))
#define CS_BSP_MODELS (CS_TERRAINS + MAX_TERRAINS)
// Jedi Knight Galaxies - Gang Wars
#define CS_TEAMS (CS_BSP_MODELS + MAX_SUB_BSP)
#define CS_MAX (CS_TEAMS + 1)
#if (CS_MAX) > MAX_CONFIGSTRINGS
#error overflow: (CS_MAX) > MAX_CONFIGSTRINGS
#endif
typedef enum {
G2_MODELPART_HEAD = 10,
G2_MODELPART_WAIST,
G2_MODELPART_LARM,
G2_MODELPART_RARM,
G2_MODELPART_RHAND,
G2_MODELPART_LLEG,
G2_MODELPART_RLEG
} g2ModelParts_t;
#define G2_MODEL_PART 50
#define BG_NUM_TOGGLEABLE_SURFACES 31
#define MAX_CUSTOM_SIEGE_SOUNDS 30
extern const char *bg_customSiegeSoundNames[MAX_CUSTOM_SIEGE_SOUNDS];
extern const char *bgToggleableSurfaces[BG_NUM_TOGGLEABLE_SURFACES];
extern const int bgToggleableSurfaceDebris[BG_NUM_TOGGLEABLE_SURFACES];
typedef enum {
HANDEXTEND_NONE = 0,
HANDEXTEND_FORCEPUSH,
HANDEXTEND_FORCEPULL,
HANDEXTEND_FORCE_HOLD,
HANDEXTEND_SABERPULL,
HANDEXTEND_CHOKE, //use handextend priorities to choke someone being gripped
HANDEXTEND_WEAPONREADY,
HANDEXTEND_DODGE,
HANDEXTEND_KNOCKDOWN,
HANDEXTEND_DUELCHALLENGE,
HANDEXTEND_TAUNT,
HANDEXTEND_PRETHROW,
HANDEXTEND_POSTTHROW,
HANDEXTEND_PRETHROWN,
HANDEXTEND_POSTTHROWN,
HANDEXTEND_DRAGGING,
HANDEXTEND_JEDITAUNT,
} forceHandAnims_t;
typedef enum
{
BROKENLIMB_NONE = 0,
BROKENLIMB_LARM,
BROKENLIMB_RARM,
NUM_BROKENLIMBS
} brokenLimb_t;
//for supplier class items
#define TOSS_DEBOUNCE_TIME 5000
typedef enum {
GT_FFA, // free for all
GT_DUEL, // one on one tournament
GT_POWERDUEL, // one on two tournament
GT_SINGLE_PLAYER, // single player ffa
//-- team games go after this --
GT_TEAM, // team deathmatch
GT_CTF, // capture the flag
GT_WARZONE,
#ifdef __JKG_NINELIVES__
GT_LMS_NINELIVES, // replace Holocron/Singleplayer?
#endif
#ifdef __JKG_TICKETING__
GT_LMS_TICKETED,
#endif
#ifdef __JKG_ROUNDBASED__
GT_LMS_ROUNDS,
#endif
GT_MAX_GAME_TYPE
} gametype_t;
// gametype bits
#define GTB_NONE 0x000 // invalid
#define GTB_FFA 0x001 // free for all
#define GTB_HOLOCRON 0x002 // holocron ffa
#define GTB_JEDIMASTER 0x004 // jedi master
#define GTB_DUEL 0x008 // one on one tournament
#define GTB_POWERDUEL 0x010 // two on one tournament
#define GTB_SINGLE_PLAYER 0x020 // single player ffa
#define GTB_NOTTEAM 0x03F // **SPECIAL: All of the above gametypes, i.e. not team-based
#define GTB_TEAM 0x040 // team deathmatch
#define GTB_SIEGE 0x080 // siege
#define GTB_CTF 0x100 // capture the flag
#define GTB_CTY 0x200 // capture the ysalimiri
#define GTB_ALL 0x1FF // all
typedef enum _flag_status {
FLAG_ATBASE = 0,
FLAG_TAKEN, // CTF
FLAG_TAKEN_RED, // One Flag CTF
FLAG_TAKEN_BLUE, // One Flag CTF
FLAG_DROPPED
} flagStatus_t;
typedef enum { GENDER_MALE, GENDER_FEMALE, GENDER_NEUTER } gender_t;
extern int forcePowerSorted[NUM_FORCE_POWERS];
typedef enum saberLockType_e
{
SABERLOCK_TOP,
SABERLOCK_SIDE,
SABERLOCK_LOCK,
SABERLOCK_BREAK,
SABERLOCK_SUPERBREAK,
SABERLOCK_WIN,
SABERLOCK_LOSE
} saberLockType_t;
typedef enum direction_e
{
DIR_RIGHT,
DIR_LEFT,
DIR_FRONT,
DIR_BACK
} direction_t;
/*
===================================================================================
PMOVE MODULE
The pmove code takes a playerState_t and a usercmd_t and generates a new playerState_t
and some other output data. Used for local prediction on the client game and true
movement on the server game.
===================================================================================
*/
#pragma pack(push, 1)
typedef struct animation_s {
unsigned short firstFrame;
unsigned short numFrames;
short frameLerp; // msec between frames
//initialLerp is abs(frameLerp)
signed char loopFrames; // 0 to numFrames
} animation_t;
#pragma pack(pop)
extern qboolean BGPAFtextLoaded;
extern animation_t bgHumanoidAnimations[MAX_TOTALANIMATIONS];
#define NUM_RESERVED_ANIMSETS (3)
#define MAX_ANIM_FILES 16
#define MAX_ANIM_EVENTS 300
typedef enum
{
FOOTSTEP_R,
FOOTSTEP_L,
FOOTSTEP_HEAVY_R,
FOOTSTEP_HEAVY_L,
NUM_FOOTSTEP_TYPES
} footstepType_t;
extern stringID_table_t animEventTypeTable[MAX_ANIM_EVENTS+1];
extern stringID_table_t footstepTypeTable[NUM_FOOTSTEP_TYPES+1];
//size of Anim eventData array...
#define MAX_RANDOM_ANIM_SOUNDS 4
#define AED_ARRAY_SIZE (MAX_RANDOM_ANIM_SOUNDS+3)
//indices for AEV_SOUND data
#define AED_SOUNDINDEX_START 0
#define AED_SOUNDINDEX_END (MAX_RANDOM_ANIM_SOUNDS-1)
#define AED_SOUND_NUMRANDOMSNDS (MAX_RANDOM_ANIM_SOUNDS)
#define AED_SOUND_PROBABILITY (MAX_RANDOM_ANIM_SOUNDS+1)
//indices for AEV_SOUNDCHAN data
#define AED_SOUNDCHANNEL (MAX_RANDOM_ANIM_SOUNDS+2)
//indices for AEV_FOOTSTEP data
#define AED_FOOTSTEP_TYPE 0
#define AED_FOOTSTEP_PROBABILITY 1
//indices for AEV_EFFECT data
#define AED_EFFECTINDEX 0
#define AED_BOLTINDEX 1
#define AED_EFFECT_PROBABILITY 2
#define AED_MODELINDEX 3
//indices for AEV_FIRE data
#define AED_FIRE_ALT 0
#define AED_FIRE_PROBABILITY 1
//indices for AEV_MOVE data
#define AED_MOVE_FWD 0
#define AED_MOVE_RT 1
#define AED_MOVE_UP 2
//indices for AEV_SABER_SWING data
#define AED_SABER_SWING_SABERNUM 0
#define AED_SABER_SWING_TYPE 1
#define AED_SABER_SWING_PROBABILITY 2
//indices for AEV_SABER_SPIN data
#define AED_SABER_SPIN_SABERNUM 0
#define AED_SABER_SPIN_TYPE 1 //0 = saberspinoff, 1 = saberspin, 2-4 = saberspin1-saberspin3
#define AED_SABER_SPIN_PROBABILITY 2
typedef enum
{//NOTENOTE: Be sure to update animEventTypeTable and ParseAnimationEvtBlock(...) if you change this enum list!
AEV_NONE,
AEV_SOUND, //# animID AEV_SOUND framenum soundpath randomlow randomhi chancetoplay
AEV_FOOTSTEP, //# animID AEV_FOOTSTEP framenum footstepType chancetoplay
AEV_EFFECT, //# animID AEV_EFFECT framenum effectpath boltName chancetoplay
AEV_FIRE, //# animID AEV_FIRE framenum altfire chancetofire
AEV_MOVE, //# animID AEV_MOVE framenum forwardpush rightpush uppush
AEV_SOUNDCHAN, //# animID AEV_SOUNDCHAN framenum CHANNEL soundpath randomlow randomhi chancetoplay
AEV_SABER_SWING, //# animID AEV_SABER_SWING framenum CHANNEL randomlow randomhi chancetoplay
AEV_SABER_SPIN, //# animID AEV_SABER_SPIN framenum CHANNEL chancetoplay
AEV_NUM_AEV
} animEventType_t;
typedef struct animevent_s
{
animEventType_t eventType;
unsigned short keyFrame; //Frame to play event on
signed short eventData[AED_ARRAY_SIZE]; //Unique IDs, can be soundIndex of sound file to play OR effect index or footstep type, etc.
char stringData[2048]; //we allow storage of one string, temporarily (in case we have to look up an index later, then make sure to set stringData to NULL so we only do the look-up once)
} animevent_t;
typedef struct bgLoadedAnim_s {
char filename[MAX_QPATH];
animation_t *anims;
// animsounds_t torsoAnimSnds[MAX_ANIM_SOUNDS];
// animsounds_t legsAnimSnds[MAX_ANIM_SOUNDS];
// qboolean soundsCached;
} bgLoadedAnim_t;
typedef struct bgLoadedEvents_s {
char filename[MAX_QPATH];
animevent_t torsoAnimEvents[MAX_ANIM_EVENTS];
animevent_t legsAnimEvents[MAX_ANIM_EVENTS];
qboolean eventsParsed;
} bgLoadedEvents_t;
extern bgLoadedAnim_t bgAllAnims[MAX_ANIM_FILES];
//In SP this is shared in with the anim stuff, and humanoid anim sets can be loaded
//multiple times just for the sake of sounds being different. We probably wouldn't
//care normally but since we're working in VMs we have to do everything possible to
//cut memory cost.
//On the bright side this also means we're cutting a rather large size out of
//required game-side memory.
#ifndef _GAME
extern bgLoadedEvents_t bgAllEvents[MAX_ANIM_FILES];
extern int bgNumAnimEvents;
#endif
typedef enum {
PM_NORMAL, // can accelerate and turn
PM_JETPACK, // special jetpack movement
PM_FLOAT, // float with no gravity in general direction of velocity (intended for gripping)
PM_NOCLIP, // noclip movement
PM_SPECTATOR, // still run into walls
PM_DEAD, // no acceleration or turning, but free falling
PM_FREEZE, // stuck in place with no control
PM_INTERMISSION, // no movement or status bar
PM_SPINTERMISSION, // no movement or status bar
// Jedi Knight Galaxies
PM_LOCK, // Fully stop all motion whatsoever, including turning
PM_NOMOVE, // Stop movement keys, but keep pmove itself intact
} pmtype_t;
typedef enum {
WEAPON_READY,
WEAPON_RAISING,
WEAPON_DROPPING,
WEAPON_FIRING,
WEAPON_CHARGING,
WEAPON_IDLE, //lowered // NOTENOTE Added with saber
WEAPON_RELOADING, // added for reloading weapon
WEAPON_ROLLFIRING, //when firing weapon midroll
} weaponstate_t;
typedef enum forceMasteries_e {
FORCE_MASTERY_UNINITIATED,
FORCE_MASTERY_INITIATE,
FORCE_MASTERY_PADAWAN,
FORCE_MASTERY_JEDI,
FORCE_MASTERY_JEDI_GUARDIAN,
FORCE_MASTERY_JEDI_ADEPT,
FORCE_MASTERY_JEDI_KNIGHT,
FORCE_MASTERY_JEDI_MASTER,
NUM_FORCE_MASTERY_LEVELS
} forceMasteries_t;
extern char *forceMasteryLevels[NUM_FORCE_MASTERY_LEVELS];
extern int forceMasteryPoints[NUM_FORCE_MASTERY_LEVELS];
extern int bgForcePowerCost[NUM_FORCE_POWERS][NUM_FORCE_POWER_LEVELS];
// pmove->pm_flags
#define PMF_DUCKED 1
#define PMF_JUMP_HELD 2
#define PMF_ROLLING 4
#define PMF_BACKWARDS_JUMP 8 // go into backwards land
#define PMF_BACKWARDS_RUN 16 // coast down to backwards run
#define PMF_TIME_LAND 32 // pm_time is time before rejump
#define PMF_TIME_KNOCKBACK 64 // pm_time is an air-accelerate only time
#define PMF_FIX_MINS 128 // mins have been brought up, keep tracing down to fix them
#define PMF_TIME_WATERJUMP 256 // pm_time is waterjump
#define PMF_RESPAWNED 512 // clear after attack and jump buttons come up
#define PMF_UNUSED 1024
#define PMF_UPDATE_ANIM 2048 // The server updated the animation, the pmove should set the ghoul2 anim to match.
#define PMF_FOLLOW 4096 // spectate following another player
#define PMF_SCOREBOARD 8192 // spectate as a scoreboard
#define PMF_STUCK_TO_WALL 16384 // grabbing a wall
#define PMF_ALL_TIMES (PMF_TIME_WATERJUMP|PMF_TIME_LAND|PMF_TIME_KNOCKBACK)
#define MAXTOUCH 32
typedef struct bgEntity_s
{
entityState_t s;
playerState_t *playerState;
void *ghoul2; //g2 instance
int localAnimIndex; //index locally (game/cgame) to anim data for this skel
vec3_t modelScale; //needed for g2 collision
//Data type(s) must directly correspond to the head of the gentity and centity structures
//#if defined(__GNUC__) || defined(__GCC__) || defined(MINGW32) || defined(MACOS_X)
// } _bgEntity_t;
//#else
} bgEntity_t;
//#endif
typedef struct pmove_s {
// state (in / out)
playerState_t *ps;
//rww - shared ghoul2 stuff (not actually the same data, but hey)
void *ghoul2;
int g2Bolts_LFoot;
int g2Bolts_RFoot;
vec3_t modelScale;
//hacky bool so we know if we're dealing with a nonhumanoid (which is probably a rockettrooper)
qboolean nonHumanoid;
// command (in)
usercmd_t cmd;
int tracemask; // collide against these types of surfaces
int debugLevel; // if set, diagnostic output will be printed
qboolean noFootsteps; // if the game is setup for no footsteps by the server
int framecount;
int gender;
// results (out)
int numtouch;
int touchents[MAXTOUCH];
vec3_t mins, maxs; // bounding box size
int watertype;
int waterlevel;
int gametype;
int debugMelee;
int stepSlideFix;
int noSpecMove;
animation_t *animations;
float xyspeed;
// for fixed msec Pmove
int pmove_fixed;
int pmove_float;
int pmove_msec;
// callbacks to test the world
// these will be different functions during game and cgame
//void (*g2trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask );
void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask );
int (*pointcontents)( const vec3_t point, int passEntityNum );
int checkDuelLoss;
//rww - bg entitystate access method
bgEntity_t *baseEnt; //base address of the entity array (g_entities or cg_entities)
int entSize; //size of the struct (gentity_t or centity_t) so things can be dynamic
} pmove_t;
// Jedi Knight Galaxies
typedef struct {
playerState_t *ps;
void *ghoul2;
vec3_t modelScale;
usercmd_t cmd;
int tracemask; // collide against these types of surfaces
animation_t *animations;
qboolean isRider; // always false if we're using the vehicle in question
//rww - bg entitystate access method
bgEntity_t *baseEnt; //base address of the entity array (g_entities or cg_entities)
int entSize; //size of the struct (gentity_t or centity_t) so things can be dynamic
void (*trace)( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask );
int (*pointcontents)( const vec3_t point, int passEntityNum );
} vmove_t;
extern pmove_t *pm;
#define SETANIM_TORSO 1
#define SETANIM_LEGS 2
#define SETANIM_BOTH SETANIM_TORSO|SETANIM_LEGS//3
#define SETANIM_FLAG_NORMAL 0//Only set if timer is 0
#define SETANIM_FLAG_OVERRIDE 1//Override previous
#define SETANIM_FLAG_HOLD 2//Set the new timer
#define SETANIM_FLAG_RESTART 4//Allow restarting the anim if playing the same one (weapon fires)
#define SETANIM_FLAG_HOLDLESS 8//Set the new timer
// if a full pmove isn't done on the client, you can just update the angles
void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd );
void Pmove (pmove_t *pmove);
// vehicle pmove
void Vmove( vmove_t *vmove );
//===================================================================================
// playerState_t->stats[] indexes
// NOTE: may not have more than 16
typedef enum {
STAT_HEALTH,
STAT_PERSISTANT_POWERUP,
//MAKE SURE STAT_WEAPONS REMAINS 4!!!!
//There is a hardcoded reference in msg.cpp to send it in 32 bits -rww
STAT_WEAPONS = 4, // 16 bit fields
STAT_SHIELD,
STAT_DEAD_YAW, // look this direction when dead (FIXME: get rid of?)
STAT_CLIENTS_READY, // bit mask of clients wishing to exit the intermission (FIXME: configstring?)
STAT_MAX_HEALTH, // Maximum health
// Jedi Knight Galaxies
STAT_MAX_STAMINA,
STAT_MAX_SHIELD, // Maximum shield
STAT_AMMO, // Ammo in current weapon
STAT_TOTALAMMO, // Total ammo
STAT_ACCURACY, // Extra accuracy rating from weapon
STAT_CAPTURE_ENTITYNUM // Warzone Flag Capture Entity...
} statIndex_t;
// playerState_t->persistant[] indexes
// these fields are the only part of playerState_t that isn't
// cleared on respawn
// NOTE: may not have more than 16
typedef enum {
PERS_SCORE, // !!! MUST NOT CHANGE, SERVER AND GAME BOTH REFERENCE !!!
PERS_HITS, // total points damage inflicted so damage beeps can sound on change
PERS_RANK, // player rank or team rank
PERS_TEAM, // player team
PERS_SPAWN_COUNT, // incremented every respawn
PERS_PLAYEREVENTS, // 16 bits that can be flipped for events
PERS_ATTACKER, // clientnum of last damage inflicter
PERS_ATTACKEE_ARMOR, // health/armor of last person we attacked
PERS_KILLED, // count of the number of times you died
} persEnum_t;
// entityState_t->eFlags
#define EF_G2ANIMATING (1<<0) //perform g2 bone anims based on torsoAnim and legsAnim, works for ET_GENERAL -rww
#define EF_DEAD (1<<1) // don't draw a foe marker over players with EF_DEAD
//#define EF_BOUNCE_SHRAPNEL (1<<2) // special shrapnel flag
//do not use eflags for server-only things, it wastes bandwidth -rww
#define EF_RADAROBJECT (1<<2) // display on team radar
#define EF_TELEPORT_BIT (1<<3) // toggled every time the origin abruptly changes
#define EF_SHADER_ANIM (1<<4) // Animating shader (by s.frame)
#define EF_PLAYER_EVENT (1<<5)
//#define EF_BOUNCE (1<<5) // for missiles
//#define EF_BOUNCE_HALF (1<<6) // for missiles
//these aren't even referenced in bg or client code and do not need to be eFlags, so I
//am using these flags for rag stuff -rww
#define EF_RAG (1<<6) //ragdoll him even if he's alive
#define EF_PERMANENT (1<<7) // rww - I am claiming this. (for permanent entities)
#define EF_NODRAW (1<<8) // may have an event, but no model (unspawned items)
#define EF_FIRING (1<<9) // for lightning gun
#define EF_ALT_FIRING (1<<10) // for alt-fires, mostly for lightning guns though
#define EF_JETPACK_ACTIVE (1<<11) //jetpack is activated
#define EF_ONFIRE (1<<12) // JKG: Damage types - on fire
#define EF_TALK (1<<13) // draw a talk balloon
//#define EF_CONNECTION (1<<14) // draw a connection trouble sprite
#define EF_ELECTROCUTED (1 << 14) // JKG: Damage types - electrocuted
#define EF_SPRINTING (1<<15) // JKG: sprinting
#define EF_FROZEN (1<<16) // JKG: Damage types - frozen
#define EF_CUSTOMBB (1<<17) // Ent uses custom bounding box
#define EF_STUNNED (1<<18) // JKG: Damage types - stunned
#define EF_BODYPUSH (1<<19) //rww - claiming this for fullbody push effect
#define EF_DOUBLE_AMMO (1<<20) // Hacky way to get around ammo max
#define EF_SEEKERDRONE (1<<21) // show seeker drone floating around head
#define EF_MISSILE_STICK (1<<22) // missiles that stick to the wall.
#define EF_ITEMPLACEHOLDER (1<<23) // item effect
#define EF_SOUNDTRACKER (1<<24) // sound position needs to be updated in relation to another entity
#define EF_DROPPEDWEAPON (1<<25) // it's a dropped weapon
#define EF_DISINTEGRATION (1<<26) // being disintegrated by the disruptor
#define EF_INVULNERABLE (1<<27) // just spawned in or whatever, so is protected
#define EF_CLIENTSMOOTH (1<<28) // standard lerporigin smooth override on client
#define EF_JETPACK (1<<29) //rww - wearing a jetpack
#define EF_JETPACK_FLAMING (1<<30) //rww - jetpack fire effect
#define EF_CONNECTION (1<<31) // we have a bad connection
//These new EF2_??? flags were added for NPCs, they really should not be used often.
//NOTE: we only allow 10 of these!
#define EF2_HELD_BY_MONSTER (1<<0) // Being held by something, like a Rancor or a Wampa
#define EF2_USE_ALT_ANIM (1<<1) // For certain special runs/stands for creatures like the Rancor and Wampa whose runs/stands are conditional
#define EF2_ALERTED (1<<2) // For certain special anims, for Rancor: means you've had an enemy, so use the more alert stand
#define EF2_GENERIC_NPC_FLAG (1<<3) // So far, used for Rancor...
#define EF2_FLYING (1<<4) // Flying FIXME: only used on NPCs doesn't *really* have to be passed over, does it?
#define EF2_NOT_USED_1 (1<<8) // not used
typedef enum {
EFFECT_NONE = 0,
EFFECT_SMOKE,
EFFECT_EXPLOSION,
EFFECT_EXPLOSION_PAS,
EFFECT_SPARK_EXPLOSION,
EFFECT_EXPLOSION_DETPACK,
EFFECT_STUNHIT,
EFFECT_EXPLOSION_TURRET,
EFFECT_SPARKS,
EFFECT_WATER_SPLASH,
EFFECT_ACID_SPLASH,
EFFECT_LAVA_SPLASH,
EFFECT_LANDING_MUD,
EFFECT_LANDING_SAND,
EFFECT_LANDING_DIRT,
EFFECT_LANDING_SNOW,
EFFECT_LANDING_GRAVEL,
EFFECT_MAX
} effectTypes_t;
// NOTE: may not have more than 16
typedef enum {
PW_NONE,
PW_PULL,
PW_REDFLAG,
PW_BLUEFLAG,
PW_SHIELDHIT,
PW_SPEEDBURST,
PW_DISINT_4,
PW_SPEED,
PW_CLOAKED,
PW_NUM_POWERUPS
} powerup_t;
typedef enum {
CTFMESSAGE_FRAGGED_FLAG_CARRIER,
CTFMESSAGE_FLAG_RETURNED,
CTFMESSAGE_PLAYER_RETURNED_FLAG,
CTFMESSAGE_PLAYER_CAPTURED_FLAG,
CTFMESSAGE_PLAYER_GOT_FLAG
} ctfMsg_t;
// reward sounds (stored in ps->persistant[PERS_PLAYEREVENTS])
#define PLAYEREVENT_DENIEDREWARD 0x0001
#define PLAYEREVENT_GAUNTLETREWARD 0x0002
//OJKFIXME: add holy shit :D
#define PLAYEREVENT_HOLYSHIT 0x0004
// entityState_t->event values
// entity events are for effects that take place reletive
// to an existing entities origin. Very network efficient.
// two bits at the top of the entityState->event field
// will be incremented with each change in the event so
// that an identical event started twice in a row can
// be distinguished. And off the value with ~EV_EVENT_BITS
// to retrieve the actual event number
#define EV_EVENT_BIT1 0x00000100
#define EV_EVENT_BIT2 0x00000200
#define EV_EVENT_BITS (EV_EVENT_BIT1|EV_EVENT_BIT2)
#define EVENT_VALID_MSEC 300
typedef enum
{
PDSOUND_NONE,
PDSOUND_PROTECTHIT,
PDSOUND_PROTECT,
PDSOUND_ABSORBHIT,
PDSOUND_ABSORB,
PDSOUND_FORCEJUMP,
PDSOUND_FORCEGRIP,
PDSOUND_VENDORPURCHASE,
PDSOUND_TRADE,
PDSOUND_PAY
} pdSounds_t;
typedef enum {
EV_NONE,
EV_CLIENTJOIN,
EV_FOOTSTEP,
EV_FOOTSTEP_METAL,
EV_FOOTSPLASH,
EV_FOOTWADE,
EV_SWIM,
EV_STEP_4,
EV_STEP_8,
EV_STEP_12,
EV_STEP_16,
EV_FALL,
EV_JUMP_PAD, // boing sound at origin, jump sound on player
EV_GHOUL2_MARK, //create a projectile impact mark on something with a client-side g2 instance.
EV_GLOBAL_DUEL,
EV_PRIVATE_DUEL,
EV_JUMP,
EV_ROLL,
EV_WATER_TOUCH, // foot touches
EV_WATER_LEAVE, // foot leaves
EV_WATER_UNDER, // head touches
EV_WATER_CLEAR, // head leaves
EV_ITEM_PICKUP, // normal item pickups are predictable
EV_GLOBAL_ITEM_PICKUP, // powerup / team sounds are broadcast to everyone
EV_NOAMMO,
EV_CHANGE_WEAPON,
EV_FIRE_WEAPON,
EV_ALT_FIRE,
EV_HEATCRIT,
EV_OVERHEATED,
EV_HEATCOOLED,
EV_SABER_ATTACK,
EV_SABER_HIT,
EV_SABER_BLOCK,
EV_SABER_CLASHFLARE,
EV_SABER_UNHOLSTER,
EV_SABER_HOLSTER,
EV_WEAPON_TRACELINE,
EV_ZOOM,
EV_PREDEFSOUND,
EV_TEAM_POWER,
EV_SCREENSHAKE,
EV_LOCALTIMER,
EV_USE, // +Use key
EV_ITEM_RESPAWN,
EV_ITEM_POP,
EV_PLAYER_TELEPORT_IN,
EV_PLAYER_TELEPORT_OUT,
EV_GRENADE_BOUNCE, // eventParm will be the soundindex
EV_MISSILE_STICK, // eventParm will be the soundindex
EV_PLAY_EFFECT,
EV_PLAY_EFFECT_ID,
EV_PLAY_PORTAL_EFFECT_ID,
EV_PLAYDOORSOUND,
EV_PLAYDOORLOOPSOUND,
EV_BMODEL_SOUND,
EV_MUTE_SOUND,
EV_VOICECMD_SOUND,
EV_GENERAL_SOUND,
EV_GLOBAL_SOUND, // no attenuation
EV_ENTITY_SOUND,
EV_PLAY_ROFF,
EV_GLASS_SHATTER,
EV_DEBRIS,
EV_MISC_MODEL_EXP,
EV_EXPLOSIVE_BLOW,
EV_MISSILE_HIT,
EV_MISSILE_MISS,
EV_MISSILE_MISS_METAL,
EV_PAIN,
EV_DEATH1,
EV_DEATH2,
EV_DEATH3,
EV_OBITUARY,
EV_FORCE_DRAINED,
EV_SCOREPLUM, // score plum
EV_CTFMESSAGE,
EV_BODYFADE,
EV_DESTROY_GHOUL2_INSTANCE,
EV_DESTROY_WEAPON_MODEL,
EV_GIVE_NEW_RANK,
EV_SET_FREE_SABER,
EV_SET_FORCE_DISABLE,
EV_WEAPON_CHARGE,
EV_WEAPON_CHARGE_ALT,
EV_SHIELD_HIT,
EV_SHIELD_BROKEN,
EV_SHIELD_RECHARGE,
EV_DEBUG_LINE,
EV_TESTLINE,
EV_STOPLOOPINGSOUND,
EV_STARTLOOPINGSOUND,
EV_TAUNT,
//rww - Begin NPC sound events
EV_ANGER1, //Say when acquire an enemy when didn't have one before
EV_ANGER2,
EV_ANGER3,
EV_VICTORY1, //Say when killed an enemy
EV_VICTORY2,
EV_VICTORY3,
EV_CONFUSE1, //Say when confused
EV_CONFUSE2,
EV_CONFUSE3,
EV_PUSHED1, //Say when pushed
EV_PUSHED2,
EV_PUSHED3,
EV_CHOKE1, //Say when choking
EV_CHOKE2,
EV_CHOKE3,
EV_FFWARN, //ffire founds
EV_FFTURN,
//extra sounds for ST
EV_CHASE1,
EV_CHASE2,
EV_CHASE3,
EV_COVER1,
EV_COVER2,
EV_COVER3,
EV_COVER4,
EV_COVER5,
EV_DETECTED1,
EV_DETECTED2,
EV_DETECTED3,
EV_DETECTED4,
EV_DETECTED5,
EV_LOST1,
EV_OUTFLANK1,
EV_OUTFLANK2,
EV_ESCAPING1,
EV_ESCAPING2,
EV_ESCAPING3,
EV_GIVEUP1,
EV_GIVEUP2,
EV_GIVEUP3,
EV_GIVEUP4,
EV_LOOK1,
EV_LOOK2,
EV_SIGHT1,
EV_SIGHT2,
EV_SIGHT3,
EV_SOUND1,
EV_SOUND2,
EV_SOUND3,
EV_SUSPICIOUS1,
EV_SUSPICIOUS2,
EV_SUSPICIOUS3,
EV_SUSPICIOUS4,
EV_SUSPICIOUS5,
//extra sounds for Jedi
EV_COMBAT1,
EV_COMBAT2,
EV_COMBAT3,
EV_JDETECTED1,
EV_JDETECTED2,
EV_JDETECTED3,
EV_TAUNT1,
EV_TAUNT2,
EV_TAUNT3,
EV_JCHASE1,
EV_JCHASE2,
EV_JCHASE3,
EV_JLOST1,
EV_JLOST2,
EV_JLOST3,