This repository was archived by the owner on Jan 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathg_local.h
2461 lines (2102 loc) · 69.5 KB
/
g_local.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
// g_local.h -- local definitions for game module
#include "../qcommon/shared/q_shared.h"
#include "laz_misc.h"
// define GAME_INCLUDE so that game.h does not define the
// short, server-visible gclient_t and edict_t structures,
// because we define the full size ones in this file
#define GAME_INCLUDE
#include "../qcommon/shared/game.h"
#include "player/p_menu.h"
#include "player/p_text.h"
#include "km_cvar.h"
#define JETPACK_MOD
// the "gameversion" client command will print this plus compile date
#define GAMEVERSION "Q2MP4"
// protocol bytes that can be directly added to messages
#define svc_muzzleflash 1
#define svc_muzzleflash2 2
#define svc_temp_entity 3
#define svc_layout 4
#define svc_inventory 5
#define svc_stufftext 11
#define svc_fog 21
#ifndef _MAX_PATH
#define _MAX_PATH 2048
#endif
//==================================================================
#ifndef _WIN32
#include <math.h>
//#define min(a,b) ((a) < (b) ? (a) : (b))
//#define max(a,b) ((a) > (b) ? (a) : (b))
#ifdef __sun__
#define _isnan(a) (NaN((a)))
#else
#define _isnan(a) (isnan(a))
#endif
#endif
//==================================================================
// Lazarus: When visibility is reduced below this level, aiming accuracy suffers:
#define FOG_CANSEEGOOD 0.12
// view pitching times
#define DAMAGE_TIME 0.5
#define FALL_TIME 0.3
// ROGUE- id killed this weapon
//Knightmare brought it back
//#define KILL_DISRUPTOR 1
// rogue
// edict->spawnflags
// these are set with checkboxes on each entity in the map editor
#define SPAWNFLAG_NOT_EASY 0x00000100 // 256
#define SPAWNFLAG_NOT_MEDIUM 0x00000200 // 512
#define SPAWNFLAG_NOT_HARD 0x00000400 // 1024
#define SPAWNFLAG_NOT_DEATHMATCH 0x00000800 // 2048
#define SPAWNFLAG_NOT_COOP 0x00001000 // 4192
// edict->flags
#define FL_FLY 0x00000001
#define FL_SWIM 0x00000002 // implied immunity to drowining
#define FL_IMMUNE_LASER 0x00000004
#define FL_INWATER 0x00000008
#define FL_GODMODE 0x00000010
#define FL_NOTARGET 0x00000020
#define FL_IMMUNE_SLIME 0x00000040
#define FL_IMMUNE_LAVA 0x00000080
#define FL_PARTIALGROUND 0x00000100 // not all corners are valid
#define FL_WATERJUMP 0x00000200 // player jumping out of water
#define FL_TEAMSLAVE 0x00000400 // not the first on the team
#define FL_NO_KNOCKBACK 0x00000800
#define FL_POWER_SHIELD 0x00001000 // power armor (if any) is active
#define FL_POWER_SCREEN 0x00002000
//ROGUE
#define FL_MECHANICAL 0x00004000 // entity is mechanical, use sparks not blood
#define FL_SAM_RAIMI 0x00008000 // entity is in sam raimi cam mode
#define FL_DISGUISED 0x00010000 // entity is in disguise, monsters will not recognize.
#define FL_NUKED 0x00020000 // player has been vaporized by a nuke, drop no gibs
//ROGUE
//Mappack - this flag says the player is in a turret and controlling it
#define FL_TURRET_OWNER 0x00040000
//Knightmare- this says that an entity is set to move with another
#define FL_MOVESLAVE 0x00080000
//Knightmare- flags for trains
#define FL_TRACKTRAIN 0x00100000
#define FL_ROTTRAIN 0x00200000
#define FL_REVERSIBLE 0x00400000
#define FL_REVOLVING 0x00800000
#define FL_BOB 0x01000000
#define FL_ROBOT 0x02000000 // Player-controlled robot or monster. Relax yaw constraints
#define FL_REFLECT 0x04000000 // Reflection entity
#define FL_RESPAWN 0x80000000 // used for item respawning
#define FRAMETIME 0.1
// memory tags to allow dynamic memory to be cleaned up
#define TAG_GAME 0x7FFD // clear when unloading the dll
#define TAG_LEVEL 0x7FFE // clear when loading a new level
#define MELEE_DISTANCE 80
#define BODY_QUEUE_SIZE 8
typedef enum
{
DAMAGE_NO,
DAMAGE_YES, // will take damage if hit
DAMAGE_AIM // auto targeting recognizes this
} damage_t;
typedef enum
{
WEAPON_READY,
WEAPON_ACTIVATING,
WEAPON_DROPPING,
WEAPON_FIRING
} weaponstate_t;
typedef enum
{
AMMO_BULLETS,
AMMO_SHELLS,
AMMO_ROCKETS,
AMMO_GRENADES,
AMMO_CELLS,
AMMO_SLUGS,
// RAFAEL
AMMO_MAGSLUG,
AMMO_TRAP,
// ROGUE
AMMO_FLECHETTES,
AMMO_TESLA,
AMMO_PROX,
AMMO_DISRUPTOR,
// Knightmare
AMMO_SHOCKSPHERE,
AMMO_FUEL,
AMMO_HOMING_ROCKETS
} ammo_t;
//deadflag
#define DEAD_NO 0
#define DEAD_DYING 1
#define DEAD_DEAD 2
#define DEAD_RESPAWNABLE 3
#define DEAD_FROZEN 4 // Lazarus: Don't shift angles, just freeze him
//range
#define RANGE_MELEE 0
#define RANGE_NEAR 1
#define RANGE_MID 2
#define RANGE_FAR 3
//gib types
#define GIB_ORGANIC 0
#define GIB_METALLIC 1
//monster ai flags
#define AI_STAND_GROUND 0x00000001
#define AI_TEMP_STAND_GROUND 0x00000002
#define AI_SOUND_TARGET 0x00000004
#define AI_LOST_SIGHT 0x00000008
#define AI_PURSUIT_LAST_SEEN 0x00000010
#define AI_PURSUE_NEXT 0x00000020
#define AI_PURSUE_TEMP 0x00000040
#define AI_HOLD_FRAME 0x00000080
#define AI_GOOD_GUY 0x00000100
#define AI_BRUTAL 0x00000200
#define AI_NOSTEP 0x00000400
#define AI_DUCKED 0x00000800
#define AI_COMBAT_POINT 0x00001000
#define AI_MEDIC 0x00002000
#define AI_RESURRECTING 0x00004000
#define AI_MANUAL_STEERING 0x00008000
#define AI_TARGET_ANGER 0x00010000 //Lazarus keep
#define AI_DODGING 0x00020000
#define AI_CHARGING 0x00040000
#define AI_HINT_PATH 0x00080000 //Lazarus keep
#define AI_IGNORE_SHOTS 0x00100000
#define AI_BLOCKED 0x00200000 // used by blocked_checkattack: set to say I'm attacking while blocked
// (prevents run-attacks)
// Lazarus:
#define AI_ACTOR 0x00400000 // Is this a misc_actor?
#define AI_FOLLOW_LEADER 0x00800000 // misc_actor only
#define AI_TWO_GUNS 0x01000000 // misc_actor only - nothing to do with AI really,
// but we're out of spawnflags
#define AI_RESPAWN_FINDPLAYER 0x02000000 // used for monsters that change maps with
// a trigger_transition... tells 'em to find SP
// player right away
#define AI_CHASE_THING 0x04000000
#define AI_SEEK_COVER 0x08000000
#define AI_CHICKEN 0x10000000
#define AI_MEDIC_PATROL 0x20000000
#define AI_CROUCH 0x40000000
#define AI_EVADE_GRENADE 0x80000000
//Knightmare- thes are for moreaiflags
#define AI_FREEFORALL 0x00000001 // Set by target_monsterbattle, lets dmgteam monsters
// attack monsters on opposion dmgteam
#define AI_RANGE_PAUSE 0x00000002
#define AI_HINT_TEST 0x00000004
//Knightmare- monster flags
#define MFL_WALK_WALLS 1
#define MFL_DO_NOT_COUNT 2 // set for healed monsters
#define MFL_SPAWNED_CARRIER 4 // both do_not_count and spawned are set for spawned monsters
#define MFL_SPAWNED_MEDIC_C 8 // both do_not_count and spawned are set for spawned monsters
#define MFL_SPAWNED_WIDOW 16 // both do_not_count and spawned are set for spawned monsters
#define MFL_SPAWNED_MASK 32 // mask to catch all three flavors of spawned
//monster attack state
#define AS_STRAIGHT 1
#define AS_SLIDING 2
#define AS_MELEE 3
#define AS_MISSILE 4
#define AS_BLIND 5 // PMM - used by boss code to do nasty things even if it can't see you
// armor types
#define ARMOR_NONE 0
#define ARMOR_JACKET 1
#define ARMOR_COMBAT 2
#define ARMOR_BODY 3
#define ARMOR_SHARD 4
// power armor types
#define POWER_ARMOR_NONE 0
#define POWER_ARMOR_SCREEN 1
#define POWER_ARMOR_SHIELD 2
// handedness values
#define RIGHT_HANDED 0
#define LEFT_HANDED 1
#define CENTER_HANDED 2
// game.serverflags values
#define SFL_CROSS_TRIGGER_1 0x00000001
#define SFL_CROSS_TRIGGER_2 0x00000002
#define SFL_CROSS_TRIGGER_3 0x00000004
#define SFL_CROSS_TRIGGER_4 0x00000008
#define SFL_CROSS_TRIGGER_5 0x00000010
#define SFL_CROSS_TRIGGER_6 0x00000020
#define SFL_CROSS_TRIGGER_7 0x00000040
#define SFL_CROSS_TRIGGER_8 0x00000080
#define SFL_CROSS_TRIGGER_MASK 0x000000ff
// noise types for PlayerNoise
#define PNOISE_SELF 0
#define PNOISE_WEAPON 1
#define PNOISE_IMPACT 2
// actor follow parms
#define ACTOR_FOLLOW_RUN_RANGE 256 // AI_FOLLOW_LEADER actors run if farther away than this
#define ACTOR_FOLLOW_STAND_RANGE 128 // .. .. stand if closer than this
// edict->movetype values
typedef enum
{
MOVETYPE_NONE, // never moves
MOVETYPE_NOCLIP, // origin and angles change with no interaction
MOVETYPE_PUSH, // no clip to world, push on box contact
MOVETYPE_STOP, // no clip to world, stops on box contact
MOVETYPE_WALK, // gravity
MOVETYPE_STEP, // gravity, special edge handling
MOVETYPE_FLY,
MOVETYPE_TOSS, // gravity
MOVETYPE_FLYMISSILE, // extra size to monsters
MOVETYPE_BOUNCE,
MOVETYPE_NEWTOSS, // PGM - for deathball
// RAFAEL
MOVETYPE_WALLBOUNCE,
MOVETYPE_VEHICLE,
MOVETYPE_PUSHABLE, // Pushable object
MOVETYPE_DEBRIS, // falling rocks
MOVETYPE_RAIN, // identical to MOVETYPE_FLYMISSILE, but doesn't cause splash noises
// when touching water.
MOVETYPE_PENDULUM, // same as MOVETYPE_PUSH, but used only for pendulums to grab special-case
MOVETYPE_CONVEYOR // conveyor
} movetype_t;
typedef struct
{
int base_count;
int max_count;
float normal_protection;
float energy_protection;
int armor;
} gitem_armor_t;
// gitem_t->flags
#define IT_WEAPON 0x00000001 // use makes active weapon
#define IT_AMMO 0x00000002
#define IT_ARMOR 0x00000004
#define IT_STAY_COOP 0x00000008
#define IT_KEY 0x00000010
#define IT_POWERUP 0x00000020
// ROGUE
#define IT_MELEE 0x00000040
#define IT_NOT_GIVEABLE 0x00000080 // item can not be given
// ROGUE
#define IT_XATRIX 0x00000100
#define IT_ROGUE 0x00000200
#define IT_DEVELOPER 0x00000400
// gitem_t->weapmodel for weapons indicates model index
#define WEAP_BLASTER 1
#define WEAP_SHOTGUN 2
#define WEAP_SUPERSHOTGUN 3
#define WEAP_MACHINEGUN 4
#define WEAP_CHAINGUN 5
#define WEAP_GRENADES 6
#define WEAP_GRENADELAUNCHER 7
#define WEAP_ROCKETLAUNCHER 8
#define WEAP_HYPERBLASTER 9
#define WEAP_RAILGUN 10
#define WEAP_BFG 11
#define WEAP_DISRUPTOR 12 // PGM
#define WEAP_ETFRIFLE 13 // PGM
#define WEAP_PLASMA 14 // PGM
#define WEAP_PROXLAUNCH 15 // PGM
#define WEAP_CHAINFIST 16 // PGM
#define WEAP_PHALANX 17
#define WEAP_BOOMER 18
#define WEAP_SHOCKWAVE 19
#define WEAP_TRAP 20
#define WEAP_TESLA 21
#define WEAP_GRAPPLE 22
#define WEAP_NONE 23
typedef struct gitem_s
{
char *classname; // spawning name
qboolean (*pickup)(struct edict_s *ent, struct edict_s *other);
void (*use)(struct edict_s *ent, struct gitem_s *item);
void (*drop)(struct edict_s *ent, struct gitem_s *item);
void (*weaponthink)(struct edict_s *ent);
char *pickup_sound;
char *world_model;
int world_model_skinnum; //Knightmare- added skinnum here since some items share models
int world_model_flags;
char *view_model;
// client side info
char *icon;
char *pickup_name; // for printing on pickup
int count_width; // number of digits to display by icon
int quantity; // for ammo how much, for weapons how much is used per shot
char *ammo; // for weapons
int flags; // IT_* flags
int weapmodel; // weapon model index (for weapons)
void *info;
int tag;
char *precaches; // string of all models, sounds, and images this item will use
hash32_t classHash;
hash32_t pickupHash;
} gitem_t;
//
// this structure is left intact through an entire game
// it should be initialized at dll load time, and read/written to
// the server.ssv file for savegames
//
typedef struct
{
char helpmessage1[512];
char helpmessage2[512];
int helpchanged; // flash F1 icon if non 0, play sound
// and increment only if 1, 2, or 3
gclient_t *clients; // [maxclients]
// can't store spawnpoint in level, because
// it would get overwritten by the savegame restore
char spawnpoint[512]; // needed for coop respawns
// store latched cvars here that we want to get at often
int maxclients;
int maxentities;
// cross level triggers
int serverflags;
// Lazarus: target_lock combination
char lock_code[9];
int lock_revealed;
qboolean lock_hud;
// Lazarus: number of entities moved between maps (not counting players)
int transition_ents;
// items
int num_items;
qboolean autosaved;
} game_locals_t;
struct fog_s
{
qboolean Trigger;
int Model;
float Near;
float Far;
float Density;
float Density1;
float Density2;
vec3_t Dir;
int model;
vec3_t Color;
edict_t *ent;
};
typedef struct fog_s fog_t;
//
// this structure is cleared as each map is entered
// it is read/written to the level.sav file for savegames
//
typedef struct
{
int framenum;
float time;
char level_name[MAX_QPATH]; // the descriptive name (Outer Base, etc)
char mapname[MAX_QPATH]; // the server name (base1, etc)
char nextmap[MAX_QPATH]; // go here when fraglimit is hit
// intermission state
float intermissiontime; // time the intermission was started
char *changemap;
int exitintermission;
vec3_t intermission_origin;
vec3_t intermission_angle;
edict_t *sight_client; // changed once each frame for coop games
edict_t *sight_entity;
int sight_entity_framenum;
edict_t *sound_entity;
int sound_entity_framenum;
edict_t *sound2_entity;
int sound2_entity_framenum;
int pic_health;
int total_secrets;
int found_secrets;
int total_goals;
int found_goals;
int total_monsters;
int killed_monsters;
edict_t *current_entity; // entity running from G_RunFrame
int body_que; // dead bodies
int power_cubes; // ugly necessity for coop
// ROGUE
edict_t *disguise_violator;
int disguise_violation_framenum;
// ROGUE
// Lazarus
int fogs;
int trigger_fogs;
int active_target_fog;
int active_fog;
int last_active_fog;
fog_t fog;
int flashlight_cost; // cost/10 seconds for flashlight
int mud_puddles;
int num_3D_sounds;
qboolean restart_for_actor_models;
qboolean freeze;
int freezeframes;
int next_skill;
int num_reflectors;
qboolean intermission_letterbox; // Knightmare- letterboxing
} level_locals_t;
// spawn_temp_t is only used to hold entity field values that
// can be set from the editor, but aren't actualy present
// in edict_t during gameplay
typedef struct
{
// world vars
char *sky;
float skyrotate;
vec3_t skyaxis;
char *nextmap;
int lip;
int distance;
int height;
char *noise;
float pausetime;
char *item;
char *gravity;
float minyaw;
float maxyaw;
float minpitch;
float maxpitch;
float phase;
float shift;
} spawn_temp_t;
typedef struct
{
// fixed data
vec3_t start_origin;
vec3_t start_angles;
vec3_t end_origin;
vec3_t end_angles;
//Knightmare- these are for the bezier curves
// vec3_t last_pathpoint_origin;
// vec3_t last_pathpoint_angles;
// vec3_t bezier_begin_point;
/// vec3_t bezier_start_origin;
// vec3_t bezier_end_origin;
// vec3_t bezier_start_angles;
// vec3_t bezier_end_angles;
// float bezier_speed;
// float bezier_distance;
float bezier_ratio; //Decimal position in beizier curve
int sound_start;
int sound_middle;
int sound_end;
int is_blocked;
float accel;
float speed;
float decel;
float distance;
float wait;
// state data
int state;
int prevstate;
vec3_t dir;
float current_speed;
float move_speed;
float next_speed;
float remaining_distance;
float decel_distance;
void (*endfunc)(edict_t *);
} moveinfo_t;
typedef struct
{
void (*aifunc)(edict_t *self, float dist);
float dist;
void (*thinkfunc)(edict_t *self);
} mframe_t;
typedef struct
{
int firstframe;
int lastframe;
mframe_t *frame;
void (*endfunc)(edict_t *self);
} mmove_t;
typedef struct
{
mmove_t *currentmove;
mmove_t *savemove;
unsigned int aiflags; // PGM - unsigned, since we're close to the max
unsigned int moreaiflags; //Knightmare- more AI flags, needed for Lazarus stuff
unsigned int monsterflags; //Knightmare- moved some of the Rogue AI flags here
int nextframe;
float scale;
void (*stand)(edict_t *self);
void (*idle)(edict_t *self);
void (*search)(edict_t *self);
void (*walk)(edict_t *self);
void (*run)(edict_t *self);
void (*dodge)(edict_t *self, edict_t *other, float eta, trace_t *tr);
void (*attack)(edict_t *self);
void (*melee)(edict_t *self);
void (*sight)(edict_t *self, edict_t *other);
qboolean (*checkattack)(edict_t *self);
void (*jump)(edict_t *self);
float pausetime;
float attack_finished;
vec3_t saved_goal;
float search_time;
float trail_time;
vec3_t last_sighting;
int attack_state;
int lefty;
float idle_time;
int linkcount;
int power_armor_type;
int power_armor_power;
//Mappack - array for ai.
//vec3_t radial_chk[8];
//Mappack - for the pathing rountine
qboolean following_nodes;
edict_t *target_node;
//Mappack - for buoy system
edict_t *buoy;
//Mappack - damit I need one
vec3_t tempvec;
//ROGUE
qboolean (*blocked)(edict_t *self, float dist);
// edict_t *last_hint; // last hint_path the monster touched
float last_hint_time; // last time the monster checked for hintpaths.
edict_t *goal_hint; // which hint_path we're trying to get to
int medicTries;
edict_t *badMedic1, *badMedic2; // these medics have declared this monster "unhealable"
edict_t *healer; // this is who is healing this monster
void (*duck)(edict_t *self, float eta);
void (*unduck)(edict_t *self);
void (*sidestep)(edict_t *self);
// while abort_duck would be nice, only monsters which duck but don't sidestep would use it .. only the brain
// not really worth it. sidestep is an implied abort_duck
// void (*abort_duck)(edict_t *self);
float base_height;
float next_duck_time;
float duck_wait_time;
edict_t *last_player_enemy;
// blindfire stuff .. the boolean says whether the monster will do it, and blind_fire_time is the timing
// (set in the monster) of the next shot
qboolean blindfire; // will the monster blindfire?
float blind_fire_delay;
vec3_t blind_fire_target;
// used by the spawners to not spawn too much and keep track of #s of monsters spawned
int monster_slots;
int monster_used;
edict_t *commander;
// powerup timers, used by widow, our friend
float quad_framenum;
float double_framenum;
float invincible_framenum;
//ROGUE
edict_t *leader;
edict_t *old_leader;
//ROGUE
//Lazarus
float min_range; // Monsters stop chasing enemy at this distance
float max_range; // Monsters won't notice or attack targets farther than this
float ideal_range[2]; // Ideal low and high range from target, weapon-specific
float flies; // Probability of dead monster generating flies
float jumpup;
float jumpdn;
float rangetime;
int chicken_framenum;
int pathdir; // Up/down a hint_path chain flag for medic
float visibility; // Ratio of visibility (it's a fog thang)
//end Lazarus
} monsterinfo_t;
// ROGUE
// this determines how long to wait after a duck to duck again. this needs to be longer than
// the time after the monster_duck_up in all of the animation sequences
#define DUCK_INTERVAL 0.5
// ROGUE
extern game_locals_t game;
extern level_locals_t level;
extern game_import_t gi;
extern game_export_t globals;
extern spawn_temp_t st;
extern int sm_meat_index;
extern int snd_fry;
extern int jacket_armor_index;
extern int combat_armor_index;
extern int body_armor_index;
extern int noweapon_index;
extern int jacket_armor_index;
extern int combat_armor_index;
extern int body_armor_index;
extern int shells_index;
extern int bullets_index;
extern int grenades_index;
extern int rockets_index;
extern int cells_index;
extern int slugs_index;
extern int fuel_index;
extern int homing_index;
extern int rl_index;
extern int hml_index;
extern int pl_index;
extern int magslug_index;
extern int flechettes_index;
extern int prox_index;
extern int disruptors_index;
extern int tesla_index;
extern int trap_index;
extern int shocksphere_index;
// means of death
#define MOD_UNKNOWN 0
#define MOD_BLASTER 1
#define MOD_SHOTGUN 2
#define MOD_SSHOTGUN 3
#define MOD_MACHINEGUN 4
#define MOD_CHAINGUN 5
#define MOD_GRENADE 6
#define MOD_G_SPLASH 7
#define MOD_ROCKET 8
#define MOD_R_SPLASH 9
#define MOD_HYPERBLASTER 10
#define MOD_RAILGUN 11
#define MOD_BFG_LASER 12
#define MOD_BFG_BLAST 13
#define MOD_BFG_EFFECT 14
#define MOD_HANDGRENADE 15
#define MOD_HG_SPLASH 16
#define MOD_WATER 17
#define MOD_SLIME 18
#define MOD_LAVA 19
#define MOD_CRUSH 20
#define MOD_TELEFRAG 21
#define MOD_FALLING 22
#define MOD_SUICIDE 23
#define MOD_HELD_GRENADE 24
#define MOD_EXPLOSIVE 25
#define MOD_BARREL 26
#define MOD_BOMB 27
#define MOD_EXIT 28
#define MOD_SPLASH 29
#define MOD_TARGET_LASER 30
#define MOD_TRIGGER_HURT 31
#define MOD_HIT 32
#define MOD_TARGET_BLASTER 33
//Xatrix
#define MOD_RIPPER 34
#define MOD_PHALANX 35
#define MOD_BRAINTENTACLE 36
#define MOD_BLASTOFF 37
#define MOD_GEKK 38
#define MOD_TRAP 39
//Xatrix
#define MOD_FRIENDLY_FIRE 0x8000000
//========
//ROGUE
#define MOD_CHAINFIST 40
#define MOD_DISINTEGRATOR 41
#define MOD_ETF_RIFLE 42
#define MOD_BLASTER2 43
#define MOD_HEATBEAM 44
#define MOD_TESLA 45
#define MOD_PROX 46
#define MOD_NUKE 47
#define MOD_NBOMB 48
#define MOD_VENGEANCE_SPHERE 49
#define MOD_HUNTER_SPHERE 50
#define MOD_DEFENDER_SPHERE 51
#define MOD_TRACKER 52
#define MOD_DBALL_CRUSH 54
#define MOD_DOPPLE_EXPLODE 55
#define MOD_DOPPLE_VENGEANCE 56
#define MOD_DOPPLE_HUNTER 57
//ROGUE
//========
//Knightmare
#define MOD_SHOCK_SPHERE 58
#define MOD_SHOCK_SPLASH 59
#define MOD_PROX_SPLASH 60
#define MOD_PHALANX_SPLASH 61
#define MOD_ETF_SPLASH 62
#define MOD_FALLING_ROCKS 63
#define MOD_VEHICLE 65
#define MOD_KICK 66
#define MOD_MISSILE 67
#define MOD_MISSILE_SPLASH 68
extern int meansOfDeath;
extern edict_t *g_edicts;
extern gclient_t *g_clients;
#ifdef __GNUC__
#include <stddef.h>
#define FOFS(x) offsetof(edict_t, x)
#define STOFS(x) offsetof(spawn_temp_t, x)
#define LLOFS(x) offsetof(level_locals_t, x)
#define CLOFS(x) offsetof(gclient_t, x)
#else
#define FOFS(x) (size_t)&(((edict_t *)0)->x)
#define STOFS(x) (size_t)&(((spawn_temp_t *)0)->x)
#define LLOFS(x) (size_t)&(((level_locals_t *)0)->x)
#define CLOFS(x) (size_t)&(((gclient_t *)0)->x)
#endif
#define random() ((rand () & 0x7fff) / ((float)0x7fff))
#define crandom() (2.0 * (random() - 0.5))
extern cvar_t *maxentities;
extern cvar_t *deathmatch;
extern cvar_t *coop;
extern cvar_t *dmflags;
extern cvar_t *skill;
extern cvar_t *fraglimit;
extern cvar_t *timelimit;
extern cvar_t *password;
extern cvar_t *spectator_password;
extern cvar_t *g_select_empty;
extern cvar_t *dedicated;
extern cvar_t *gamedir;
extern cvar_t *filterban;
extern cvar_t *sv_gravity;
extern cvar_t *sv_maxvelocity;
extern cvar_t *gun_x, *gun_y, *gun_z;
extern cvar_t *sv_rollspeed;
extern cvar_t *sv_rollangle;
extern cvar_t *run_pitch;
extern cvar_t *run_roll;
extern cvar_t *bob_up;
extern cvar_t *bob_pitch;
extern cvar_t *bob_roll;
extern cvar_t *sv_cheats;
extern cvar_t *maxclients;
extern cvar_t *maxspectators;
extern cvar_t *flood_msgs;
extern cvar_t *flood_persecond;
extern cvar_t *flood_waitdelay;
extern cvar_t *sv_maplist;
extern cvar_t *sv_stopspeed; // PGM - this was a define in g_phys.c
//ROGUE
extern cvar_t *g_showlogic;
extern cvar_t *gamerules;
extern cvar_t *huntercam;
extern cvar_t *strong_mines;
extern cvar_t *randomrespawn;
extern cvar_t *actorchicken;
extern cvar_t *actorjump;
extern cvar_t *actorscram;
extern cvar_t *alert_sounds;
extern cvar_t *allow_download;
extern cvar_t *allow_fog; // Set to 0 for no fog
// set to 0 to bypass target_changelevel clear inventory flag
// because some user maps have this erroneously set
extern cvar_t *allow_clear_inventory;
extern cvar_t *bounce_bounce;
extern cvar_t *bounce_minv;
extern cvar_t *cd_loopcount;
extern cvar_t *cl_gun;
extern cvar_t *cl_thirdperson; // Knightmare added
extern cvar_t *corpse_fade;
extern cvar_t *corpse_fadetime;
extern cvar_t *crosshair;
extern cvar_t *crossh;
extern cvar_t *developer;
extern cvar_t *footstep_sounds;
extern cvar_t *fov;
extern cvar_t *gl_clear;
extern cvar_t *gl_driver;
extern cvar_t *hand;
extern cvar_t *jetpack_weenie;
extern cvar_t *joy_pitchsensitivity;
extern cvar_t *joy_yawsensitivity;
extern cvar_t *jump_kick;
extern cvar_t *lazarus_cd_loop;
extern cvar_t *lazarus_cl_gun;
extern cvar_t *lazarus_crosshair;
extern cvar_t *lazarus_gl_clear;
extern cvar_t *lazarus_joyp;
extern cvar_t *lazarus_joyy;
extern cvar_t *lazarus_pitch;
extern cvar_t *lazarus_yaw;
extern cvar_t *lights;
extern cvar_t *lightsmin;
extern cvar_t *m_pitch;
extern cvar_t *m_yaw;
extern cvar_t *monsterjump;
extern cvar_t *readout;
extern cvar_t *rocket_strafe;
extern cvar_t *rotate_distance;
extern cvar_t *shift_distance;
extern cvar_t *sv_maxgibs;
extern cvar_t *tpp; // third person perspective
extern cvar_t *tpp_auto;
extern cvar_t *turn_rider;
extern cvar_t *vid_ref;
extern cvar_t *zoomrate;
extern cvar_t *zoomsnap;
extern int max_modelindex;
extern int max_soundindex;
// this is for the count of monsters
#define ENT_SLOTS_LEFT (ent->monsterinfo.monster_slots - ent->monsterinfo.monster_used)
#define SELF_SLOTS_LEFT (self->monsterinfo.monster_slots - self->monsterinfo.monster_used)
//ROGUE
#define world (&g_edicts[0])
// item spawnflags
#define ITEM_TRIGGER_SPAWN 0x00000001
#define ITEM_NO_TOUCH 0x00000002
#define ITEM_NO_ROTATE 0x00000004
#define ITEM_NO_DROPTOFLOOR 0x00000008
#define ITEM_SHOOTABLE 0x00000010
// 6 bits reserved for editor flags
// 8 bits used as power cube id bits for coop games
#define DROPPED_ITEM 0x00010000
#define DROPPED_PLAYER_ITEM 0x00020000
#define ITEM_TARGETS_USED 0x00040000
//
// fields are needed for spawning from the entity string
// and saving / loading games
//
#define FFL_SPAWNTEMP 1
#define FFL_NOSPAWN 2
typedef enum {
F_INT,
F_FLOAT,
F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL
F_GSTRING, // string on disk, pointer in memory, TAG_GAME
F_VECTOR,
F_ANGLEHACK,
F_EDICT, // index on disk, pointer in memory
F_ITEM, // index on disk, pointer in memory
F_CLIENT, // index on disk, pointer in memory
F_FUNCTION,
F_MMOVE,
F_IGNORE
} fieldtype_t;
typedef struct
{
char *name;
int ofs;
fieldtype_t type;
int flags;
} field_t;
typedef struct
{
char *name;
void (*spawn)(edict_t *ent);
} spawn_t;
// Lazarus: worldspawn effects