|
|
1.1 root 1: // g_local.h -- local definitions for game module
2:
3: #include "q_shared.h"
4:
5: // define GAME_INCLUDE so that game.h does not define the
6: // short, server-visible gclient_t and edict_t structures,
7: // because we define the full size ones in this file
8: #define GAME_INCLUDE
9: #include "game.h"
10:
11: //ZOID
12: #include "p_menu.h"
13: //ZOID
14:
15: // the "gameversion" client command will print this plus compile date
16: #define GAMEVERSION "baseq2"
17:
18: // protocol bytes that can be directly added to messages
19: #define svc_muzzleflash 1
20: #define svc_muzzleflash2 2
21: #define svc_temp_entity 3
22: #define svc_layout 4
23: #define svc_inventory 5
24:
25: //==================================================================
26:
27: // view pitching times
28: #define DAMAGE_TIME 0.5
29: #define FALL_TIME 0.3
30:
31:
32: // edict->spawnflags
33: // these are set with checkboxes on each entity in the map editor
34: #define SPAWNFLAG_NOT_EASY 0x00000100
35: #define SPAWNFLAG_NOT_MEDIUM 0x00000200
36: #define SPAWNFLAG_NOT_HARD 0x00000400
37: #define SPAWNFLAG_NOT_DEATHMATCH 0x00000800
38: #define SPAWNFLAG_NOT_COOP 0x00001000
39:
40: // edict->flags
41: #define FL_FLY 0x00000001
42: #define FL_SWIM 0x00000002 // implied immunity to drowining
43: #define FL_IMMUNE_LASER 0x00000004
44: #define FL_INWATER 0x00000008
45: #define FL_GODMODE 0x00000010
46: #define FL_NOTARGET 0x00000020
47: #define FL_IMMUNE_SLIME 0x00000040
48: #define FL_IMMUNE_LAVA 0x00000080
49: #define FL_PARTIALGROUND 0x00000100 // not all corners are valid
50: #define FL_WATERJUMP 0x00000200 // player jumping out of water
51: #define FL_TEAMSLAVE 0x00000400 // not the first on the team
52: #define FL_NO_KNOCKBACK 0x00000800
53: #define FL_POWER_ARMOR 0x00001000 // power armor (if any) is active
54: #define FL_RESPAWN 0x80000000 // used for item respawning
55:
56:
57: #define FRAMETIME 0.1
58:
59: // memory tags to allow dynamic memory to be cleaned up
60: #define TAG_GAME 765 // clear when unloading the dll
61: #define TAG_LEVEL 766 // clear when loading a new level
62:
63:
64: #define MELEE_DISTANCE 80
65:
66: #define BODY_QUEUE_SIZE 8
67:
68: typedef enum
69: {
70: DAMAGE_NO,
71: DAMAGE_YES, // will take damage if hit
72: DAMAGE_AIM // auto targeting recognizes this
73: } damage_t;
74:
75: typedef enum
76: {
77: WEAPON_READY,
78: WEAPON_ACTIVATING,
79: WEAPON_DROPPING,
80: WEAPON_FIRING
81: } weaponstate_t;
82:
83: typedef enum
84: {
85: AMMO_BULLETS,
86: AMMO_SHELLS,
87: AMMO_ROCKETS,
88: AMMO_GRENADES,
89: AMMO_CELLS,
90: AMMO_SLUGS
91: } ammo_t;
92:
93:
94: //deadflag
95: #define DEAD_NO 0
96: #define DEAD_DYING 1
97: #define DEAD_DEAD 2
98: #define DEAD_RESPAWNABLE 3
99:
100: //range
101: #define RANGE_MELEE 0
102: #define RANGE_NEAR 1
103: #define RANGE_MID 2
104: #define RANGE_FAR 3
105:
106: //gib types
107: #define GIB_ORGANIC 0
108: #define GIB_METALLIC 1
109:
110: //monster ai flags
111: #define AI_STAND_GROUND 0x00000001
112: #define AI_TEMP_STAND_GROUND 0x00000002
113: #define AI_SOUND_TARGET 0x00000004
114: #define AI_LOST_SIGHT 0x00000008
115: #define AI_PURSUIT_LAST_SEEN 0x00000010
116: #define AI_PURSUE_NEXT 0x00000020
117: #define AI_PURSUE_TEMP 0x00000040
118: #define AI_HOLD_FRAME 0x00000080
119: #define AI_GOOD_GUY 0x00000100
120: #define AI_BRUTAL 0x00000200
121: #define AI_NOSTEP 0x00000400
122: #define AI_DUCKED 0x00000800
123: #define AI_COMBAT_POINT 0x00001000
124: #define AI_MEDIC 0x00002000
125: #define AI_RESURRECTING 0x00004000
126:
127: //monster attack state
128: #define AS_STRAIGHT 1
129: #define AS_SLIDING 2
130: #define AS_MELEE 3
131: #define AS_MISSILE 4
132:
133: // armor types
134: #define ARMOR_NONE 0
135: #define ARMOR_JACKET 1
136: #define ARMOR_COMBAT 2
137: #define ARMOR_BODY 3
138: #define ARMOR_SHARD 4
139:
140: // power armor types
141: #define POWER_ARMOR_NONE 0
142: #define POWER_ARMOR_SCREEN 1
143: #define POWER_ARMOR_SHIELD 2
144:
145: // handedness values
146: #define RIGHT_HANDED 0
147: #define LEFT_HANDED 1
148: #define CENTER_HANDED 2
149:
150:
151: // game.serverflags values
152: #define SFL_CROSS_TRIGGER_1 0x00000001
153: #define SFL_CROSS_TRIGGER_2 0x00000002
154: #define SFL_CROSS_TRIGGER_3 0x00000004
155: #define SFL_CROSS_TRIGGER_4 0x00000008
156: #define SFL_CROSS_TRIGGER_5 0x00000010
157: #define SFL_CROSS_TRIGGER_6 0x00000020
158: #define SFL_CROSS_TRIGGER_7 0x00000040
159: #define SFL_CROSS_TRIGGER_8 0x00000080
160: #define SFL_CROSS_TRIGGER_MASK 0x000000ff
161:
162:
163: // noise types for PlayerNoise
164: #define PNOISE_SELF 0
165: #define PNOISE_WEAPON 1
166: #define PNOISE_IMPACT 2
167:
168:
169: // edict->movetype values
170: typedef enum
171: {
172: MOVETYPE_NONE, // never moves
173: MOVETYPE_NOCLIP, // origin and angles change with no interaction
174: MOVETYPE_PUSH, // no clip to world, push on box contact
175: MOVETYPE_STOP, // no clip to world, stops on box contact
176:
177: MOVETYPE_WALK, // gravity
178: MOVETYPE_STEP, // gravity, special edge handling
179: MOVETYPE_FLY,
180: MOVETYPE_TOSS, // gravity
181: MOVETYPE_FLYMISSILE, // extra size to monsters
182: MOVETYPE_BOUNCE
183: } movetype_t;
184:
185:
186:
187: typedef struct
188: {
189: int base_count;
190: int max_count;
191: float normal_protection;
192: float energy_protection;
193: int armor;
194: } gitem_armor_t;
195:
196:
197: // gitem_t->flags
198: #define IT_WEAPON 1 // use makes active weapon
199: #define IT_AMMO 2
200: #define IT_ARMOR 4
201: #define IT_STAY_COOP 8
202: #define IT_KEY 16
203: #define IT_POWERUP 32
204: //ZOID
205: #define IT_TECH 64
206: //ZOID
207:
208: // gitem_t->weapmodel for weapons indicates model index
209: #define WEAP_BLASTER 1
210: #define WEAP_SHOTGUN 2
211: #define WEAP_SUPERSHOTGUN 3
212: #define WEAP_MACHINEGUN 4
213: #define WEAP_CHAINGUN 5
214: #define WEAP_GRENADES 6
215: #define WEAP_GRENADELAUNCHER 7
216: #define WEAP_ROCKETLAUNCHER 8
217: #define WEAP_HYPERBLASTER 9
218: #define WEAP_RAILGUN 10
219: #define WEAP_BFG 11
220: #define WEAP_GRAPPLE 12
221:
222: typedef struct gitem_s
223: {
224: char *classname; // spawning name
225: qboolean (*pickup)(struct edict_s *ent, struct edict_s *other);
226: void (*use)(struct edict_s *ent, struct gitem_s *item);
227: void (*drop)(struct edict_s *ent, struct gitem_s *item);
228: void (*weaponthink)(struct edict_s *ent);
229: char *pickup_sound;
230: char *world_model;
231: int world_model_flags;
232: char *view_model;
233:
234: // client side info
235: char *icon;
236: char *pickup_name; // for printing on pickup
237: int count_width; // number of digits to display by icon
238:
239: int quantity; // for ammo how much, for weapons how much is used per shot
240: char *ammo; // for weapons
241: int flags; // IT_* flags
242:
243: int weapmodel; // weapon model index (for weapons)
244:
245: void *info;
246: int tag;
247:
248: char *precaches; // string of all models, sounds, and images this item will use
249: } gitem_t;
250:
251:
252:
253: //
254: // this structure is left intact through an entire game
255: // it should be initialized at dll load time, and read/written to
256: // the server.ssv file for savegames
257: //
258: typedef struct
259: {
260: char helpmessage1[512];
261: char helpmessage2[512];
262: int helpchanged; // flash F1 icon if non 0, play sound
263: // and increment only if 1, 2, or 3
264:
265: gclient_t *clients; // [maxclients]
266:
267: // can't store spawnpoint in level, because
268: // it would get overwritten by the savegame restore
269: char spawnpoint[512]; // needed for coop respawns
270:
271: // store latched cvars here that we want to get at often
272: int maxclients;
273: int maxentities;
274:
275: // cross level triggers
276: int serverflags;
277:
278: // items
279: int num_items;
280:
281: qboolean autosaved;
282: } game_locals_t;
283:
284:
285: //
286: // this structure is cleared as each map is entered
287: // it is read/written to the level.sav file for savegames
288: //
289: typedef struct
290: {
291: int framenum;
292: float time;
293:
294: char level_name[MAX_QPATH]; // the descriptive name (Outer Base, etc)
295: char mapname[MAX_QPATH]; // the server name (base1, etc)
296: char nextmap[MAX_QPATH]; // go here when fraglimit is hit
297: char forcemap[MAX_QPATH]; // go here
298:
299: // intermission state
300: float intermissiontime; // time the intermission was started
301: char *changemap;
302: int exitintermission;
303: vec3_t intermission_origin;
304: vec3_t intermission_angle;
305:
306: edict_t *sight_client; // changed once each frame for coop games
307:
308: edict_t *sight_entity;
309: int sight_entity_framenum;
310: edict_t *sound_entity;
311: int sound_entity_framenum;
312: edict_t *sound2_entity;
313: int sound2_entity_framenum;
314:
315: int pic_health;
316:
317: int total_secrets;
318: int found_secrets;
319:
320: int total_goals;
321: int found_goals;
322:
323: int total_monsters;
324: int killed_monsters;
325:
326: edict_t *current_entity; // entity running from G_RunFrame
327: int body_que; // dead bodies
328:
329: int power_cubes; // ugly necessity for coop
330: } level_locals_t;
331:
332:
333: // spawn_temp_t is only used to hold entity field values that
334: // can be set from the editor, but aren't actualy present
335: // in edict_t during gameplay
336: typedef struct
337: {
338: // world vars
339: char *sky;
340: float skyrotate;
341: vec3_t skyaxis;
342: char *nextmap;
343:
344: int lip;
345: int distance;
346: int height;
347: char *noise;
348: float pausetime;
349: char *item;
350: char *gravity;
351:
352: float minyaw;
353: float maxyaw;
354: float minpitch;
355: float maxpitch;
356: } spawn_temp_t;
357:
358:
359: typedef struct
360: {
361: // fixed data
362: vec3_t start_origin;
363: vec3_t start_angles;
364: vec3_t end_origin;
365: vec3_t end_angles;
366:
367: int sound_start;
368: int sound_middle;
369: int sound_end;
370:
371: float accel;
372: float speed;
373: float decel;
374: float distance;
375:
376: float wait;
377:
378: // state data
379: int state;
380: vec3_t dir;
381: float current_speed;
382: float move_speed;
383: float next_speed;
384: float remaining_distance;
385: float decel_distance;
386: void (*endfunc)(edict_t *);
387: } moveinfo_t;
388:
389:
390: typedef struct
391: {
392: void (*aifunc)(edict_t *self, float dist);
393: float dist;
394: void (*thinkfunc)(edict_t *self);
395: } mframe_t;
396:
397: typedef struct
398: {
399: int firstframe;
400: int lastframe;
401: mframe_t *frame;
402: void (*endfunc)(edict_t *self);
403: } mmove_t;
404:
405: typedef struct
406: {
407: mmove_t *currentmove;
408: int aiflags;
409: int nextframe;
410: float scale;
411:
412: void (*stand)(edict_t *self);
413: void (*idle)(edict_t *self);
414: void (*search)(edict_t *self);
415: void (*walk)(edict_t *self);
416: void (*run)(edict_t *self);
417: void (*dodge)(edict_t *self, edict_t *other, float eta);
418: void (*attack)(edict_t *self);
419: void (*melee)(edict_t *self);
420: void (*sight)(edict_t *self, edict_t *other);
421: qboolean (*checkattack)(edict_t *self);
422:
423: float pausetime;
424: float attack_finished;
425:
426: vec3_t saved_goal;
427: float search_time;
428: float trail_time;
429: vec3_t last_sighting;
430: int attack_state;
431: int lefty;
432: float idle_time;
433: int linkcount;
434:
435: int power_armor_type;
436: int power_armor_power;
437: } monsterinfo_t;
438:
439:
440:
441: extern game_locals_t game;
442: extern level_locals_t level;
443: extern game_import_t gi;
444: extern game_export_t globals;
445: extern spawn_temp_t st;
446:
447: extern int sm_meat_index;
448: extern int snd_fry;
449:
450: extern int jacket_armor_index;
451: extern int combat_armor_index;
452: extern int body_armor_index;
453:
454:
455: // means of death
456: #define MOD_UNKNOWN 0
457: #define MOD_BLASTER 1
458: #define MOD_SHOTGUN 2
459: #define MOD_SSHOTGUN 3
460: #define MOD_MACHINEGUN 4
461: #define MOD_CHAINGUN 5
462: #define MOD_GRENADE 6
463: #define MOD_G_SPLASH 7
464: #define MOD_ROCKET 8
465: #define MOD_R_SPLASH 9
466: #define MOD_HYPERBLASTER 10
467: #define MOD_RAILGUN 11
468: #define MOD_BFG_LASER 12
469: #define MOD_BFG_BLAST 13
470: #define MOD_BFG_EFFECT 14
471: #define MOD_HANDGRENADE 15
472: #define MOD_HG_SPLASH 16
473: #define MOD_WATER 17
474: #define MOD_SLIME 18
475: #define MOD_LAVA 19
476: #define MOD_CRUSH 20
477: #define MOD_TELEFRAG 21
478: #define MOD_FALLING 22
479: #define MOD_SUICIDE 23
480: #define MOD_HELD_GRENADE 24
481: #define MOD_EXPLOSIVE 25
482: #define MOD_BARREL 26
483: #define MOD_BOMB 27
484: #define MOD_EXIT 28
485: #define MOD_SPLASH 29
486: #define MOD_TARGET_LASER 30
487: #define MOD_TRIGGER_HURT 31
488: #define MOD_HIT 32
489: #define MOD_TARGET_BLASTER 33
490: #define MOD_GRAPPLE 34
491: #define MOD_FRIENDLY_FIRE 0x8000000
492:
493: extern int meansOfDeath;
494:
495:
496: extern edict_t *g_edicts;
497:
498: #define FOFS(x) (int)&(((edict_t *)0)->x)
499: #define STOFS(x) (int)&(((spawn_temp_t *)0)->x)
500: #define LLOFS(x) (int)&(((level_locals_t *)0)->x)
501: #define CLOFS(x) (int)&(((gclient_t *)0)->x)
502:
503: #define random() ((rand () & 0x7fff) / ((float)0x7fff))
504: #define crandom() (2.0 * (random() - 0.5))
505:
506: extern cvar_t *maxentities;
507: extern cvar_t *deathmatch;
508: extern cvar_t *coop;
509: extern cvar_t *dmflags;
510: extern cvar_t *skill;
511: extern cvar_t *fraglimit;
512: extern cvar_t *timelimit;
513: //ZOID
514: extern cvar_t *capturelimit;
515: extern cvar_t *instantweap;
516: //ZOID
517: extern cvar_t *password;
518: extern cvar_t *g_select_empty;
519: extern cvar_t *dedicated;
520:
521: extern cvar_t *sv_gravity;
522: extern cvar_t *sv_maxvelocity;
523:
524: extern cvar_t *gun_x, *gun_y, *gun_z;
525: extern cvar_t *sv_rollspeed;
526: extern cvar_t *sv_rollangle;
527:
528: extern cvar_t *run_pitch;
529: extern cvar_t *run_roll;
530: extern cvar_t *bob_up;
531: extern cvar_t *bob_pitch;
532: extern cvar_t *bob_roll;
533:
534: extern cvar_t *sv_cheats;
535: extern cvar_t *maxclients;
536:
537: extern cvar_t *flood_msgs;
538: extern cvar_t *flood_persecond;
539: extern cvar_t *flood_waitdelay;
540:
541: extern cvar_t *sv_maplist;
542:
543: //ZOID
544: extern qboolean is_quad;
545: //ZOID
546:
547: #define world (&g_edicts[0])
548:
549: // item spawnflags
550: #define ITEM_TRIGGER_SPAWN 0x00000001
551: #define ITEM_NO_TOUCH 0x00000002
552: // 6 bits reserved for editor flags
553: // 8 bits used as power cube id bits for coop games
554: #define DROPPED_ITEM 0x00010000
555: #define DROPPED_PLAYER_ITEM 0x00020000
556: #define ITEM_TARGETS_USED 0x00040000
557:
558: //
559: // fields are needed for spawning from the entity string
560: // and saving / loading games
561: //
562: #define FFL_SPAWNTEMP 1
563:
564: typedef enum {
565: F_INT,
566: F_FLOAT,
567: F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL
568: F_GSTRING, // string on disk, pointer in memory, TAG_GAME
569: F_VECTOR,
570: F_ANGLEHACK,
571: F_EDICT, // index on disk, pointer in memory
572: F_ITEM, // index on disk, pointer in memory
573: F_CLIENT, // index on disk, pointer in memory
574: F_IGNORE
575: } fieldtype_t;
576:
577: typedef struct
578: {
579: char *name;
580: int ofs;
581: fieldtype_t type;
582: int flags;
583: } field_t;
584:
585:
586: extern field_t fields[];
587: extern gitem_t itemlist[];
588:
589:
590: //
591: // g_cmds.c
592: //
593: qboolean CheckFlood(edict_t *ent);
594: void Cmd_Help_f (edict_t *ent);
595: void Cmd_Score_f (edict_t *ent);
596:
597: //
598: // g_items.c
599: //
600: void PrecacheItem (gitem_t *it);
601: void InitItems (void);
602: void SetItemNames (void);
603: gitem_t *FindItem (char *pickup_name);
604: gitem_t *FindItemByClassname (char *classname);
605: #define ITEM_INDEX(x) ((x)-itemlist)
606: edict_t *Drop_Item (edict_t *ent, gitem_t *item);
607: void SetRespawn (edict_t *ent, float delay);
608: void ChangeWeapon (edict_t *ent);
609: void SpawnItem (edict_t *ent, gitem_t *item);
610: void Think_Weapon (edict_t *ent);
611: int ArmorIndex (edict_t *ent);
612: int PowerArmorType (edict_t *ent);
613: gitem_t *GetItemByIndex (int index);
614: qboolean Add_Ammo (edict_t *ent, gitem_t *item, int count);
615: void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf);
616:
617: //
618: // g_utils.c
619: //
620: qboolean KillBox (edict_t *ent);
621: void G_ProjectSource (vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result);
622: edict_t *G_Find (edict_t *from, int fieldofs, char *match);
623: edict_t *findradius (edict_t *from, vec3_t org, float rad);
624: edict_t *G_PickTarget (char *targetname);
625: void G_UseTargets (edict_t *ent, edict_t *activator);
626: void G_SetMovedir (vec3_t angles, vec3_t movedir);
627:
628: void G_InitEdict (edict_t *e);
629: edict_t *G_Spawn (void);
630: void G_FreeEdict (edict_t *e);
631:
632: void G_TouchTriggers (edict_t *ent);
633: void G_TouchSolids (edict_t *ent);
634:
635: char *G_CopyString (char *in);
636:
637: float *tv (float x, float y, float z);
638: char *vtos (vec3_t v);
639:
640: float vectoyaw (vec3_t vec);
641: void vectoangles (vec3_t vec, vec3_t angles);
642:
643: //
644: // g_combat.c
645: //
646: qboolean OnSameTeam (edict_t *ent1, edict_t *ent2);
647: qboolean CanDamage (edict_t *targ, edict_t *inflictor);
648: qboolean CheckTeamDamage (edict_t *targ, edict_t *attacker);
649: void T_Damage (edict_t *targ, edict_t *inflictor, edict_t *attacker, vec3_t dir, vec3_t point, vec3_t normal, int damage, int knockback, int dflags, int mod);
650: void T_RadiusDamage (edict_t *inflictor, edict_t *attacker, float damage, edict_t *ignore, float radius, int mod);
651:
652: // damage flags
653: #define DAMAGE_RADIUS 0x00000001 // damage was indirect
654: #define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage
655: #define DAMAGE_ENERGY 0x00000004 // damage is from an energy based weapon
656: #define DAMAGE_NO_KNOCKBACK 0x00000008 // do not affect velocity, just view angles
657: #define DAMAGE_BULLET 0x00000010 // damage is from a bullet (used for ricochets)
658: #define DAMAGE_NO_PROTECTION 0x00000020 // armor, shields, invulnerability, and godmode have no effect
659:
660: #define DEFAULT_BULLET_HSPREAD 300
661: #define DEFAULT_BULLET_VSPREAD 500
662: #define DEFAULT_SHOTGUN_HSPREAD 1000
663: #define DEFAULT_SHOTGUN_VSPREAD 500
664: #define DEFAULT_DEATHMATCH_SHOTGUN_COUNT 12
665: #define DEFAULT_SHOTGUN_COUNT 12
666: #define DEFAULT_SSHOTGUN_COUNT 20
667:
668: //
669: // g_monster.c
670: //
671: void monster_fire_bullet (edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype);
672: void monster_fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int flashtype);
673: void monster_fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect);
674: void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype);
675: void monster_fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype);
676: void monster_fire_railgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int flashtype);
677: void monster_fire_bfg (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int kick, float damage_radius, int flashtype);
678: void M_droptofloor (edict_t *ent);
679: void monster_think (edict_t *self);
680: void walkmonster_start (edict_t *self);
681: void swimmonster_start (edict_t *self);
682: void flymonster_start (edict_t *self);
683: void AttackFinished (edict_t *self, float time);
684: void monster_death_use (edict_t *self);
685: void M_CatagorizePosition (edict_t *ent);
686: qboolean M_CheckAttack (edict_t *self);
687: void M_FlyCheck (edict_t *self);
688: void M_CheckGround (edict_t *ent);
689:
690: //
691: // g_misc.c
692: //
693: void ThrowHead (edict_t *self, char *gibname, int damage, int type);
694: void ThrowClientHead (edict_t *self, int damage);
695: void ThrowGib (edict_t *self, char *gibname, int damage, int type);
696: void BecomeExplosion1(edict_t *self);
697:
698: //
699: // g_ai.c
700: //
701: void AI_SetSightClient (void);
702:
703: void ai_stand (edict_t *self, float dist);
704: void ai_move (edict_t *self, float dist);
705: void ai_walk (edict_t *self, float dist);
706: void ai_turn (edict_t *self, float dist);
707: void ai_run (edict_t *self, float dist);
708: void ai_charge (edict_t *self, float dist);
709: int range (edict_t *self, edict_t *other);
710:
711: void FoundTarget (edict_t *self);
712: qboolean infront (edict_t *self, edict_t *other);
713: qboolean visible (edict_t *self, edict_t *other);
714: qboolean FacingIdeal(edict_t *self);
715:
716: //
717: // g_weapon.c
718: //
719: void ThrowDebris (edict_t *self, char *modelname, float speed, vec3_t origin);
720: qboolean fire_hit (edict_t *self, vec3_t aim, int damage, int kick);
721: void fire_bullet (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int mod);
722: void fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int mod);
723: void fire_blaster (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int effect, qboolean hyper);
724: void fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius);
725: void fire_grenade2 (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, float timer, float damage_radius, qboolean held);
726: void fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage);
727: void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick);
728: void fire_bfg (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius);
729:
730: //
731: // g_ptrail.c
732: //
733: void PlayerTrail_Init (void);
734: void PlayerTrail_Add (vec3_t spot);
735: void PlayerTrail_New (vec3_t spot);
736: edict_t *PlayerTrail_PickFirst (edict_t *self);
737: edict_t *PlayerTrail_PickNext (edict_t *self);
738: edict_t *PlayerTrail_LastSpot (void);
739:
740:
741: //
742: // g_client.c
743: //
744: void respawn (edict_t *ent);
745: void BeginIntermission (edict_t *targ);
746: void PutClientInServer (edict_t *ent);
747: void InitClientPersistant (gclient_t *client);
748: void InitClientResp (gclient_t *client);
749: void InitBodyQue (void);
750: void ClientBeginServerFrame (edict_t *ent);
751:
752: //
753: // g_player.c
754: //
755: void player_pain (edict_t *self, edict_t *other, float kick, int damage);
756: void player_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
757:
758: //
759: // g_svcmds.c
760: //
761: void ServerCommand (void);
762:
763: //
764: // p_view.c
765: //
766: void ClientEndServerFrame (edict_t *ent);
767:
768: //
769: // p_hud.c
770: //
771: void MoveClientToIntermission (edict_t *client);
772: void G_SetStats (edict_t *ent);
773: void ValidateSelectedItem (edict_t *ent);
774: void DeathmatchScoreboardMessage (edict_t *client, edict_t *killer);
775:
776: //
777: // g_pweapon.c
778: //
779: void PlayerNoise(edict_t *who, vec3_t where, int type);
780: void P_ProjectSource (gclient_t *client, vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result);
781: void Weapon_Generic (edict_t *ent, int FRAME_ACTIVATE_LAST, int FRAME_FIRE_LAST, int FRAME_IDLE_LAST, int FRAME_DEACTIVATE_LAST, int *pause_frames, int *fire_frames, void (*fire)(edict_t *ent));
782:
783: //
784: // m_move.c
785: //
786: qboolean M_CheckBottom (edict_t *ent);
787: qboolean M_walkmove (edict_t *ent, float yaw, float dist);
788: void M_MoveToGoal (edict_t *ent, float dist);
789: void M_ChangeYaw (edict_t *ent);
790:
791: //
792: // g_phys.c
793: //
794: void G_RunEntity (edict_t *ent);
795:
796: //
797: // g_main.c
798: //
799: void SaveClientData (void);
800: void FetchClientEntData (edict_t *ent);
801: void EndDMLevel (void);
802:
803:
804: //============================================================================
805:
806: // client_t->anim_priority
807: #define ANIM_BASIC 0 // stand / run
808: #define ANIM_WAVE 1
809: #define ANIM_JUMP 2
810: #define ANIM_PAIN 3
811: #define ANIM_ATTACK 4
812: #define ANIM_DEATH 5
813: #define ANIM_REVERSE 6
814:
815:
816: // client data that stays across multiple level loads
817: typedef struct
818: {
819: char userinfo[MAX_INFO_STRING];
820: char netname[16];
821: int hand;
822:
823: qboolean connected; // a loadgame will leave valid entities that
824: // just don't have a connection yet
825:
826: // values saved and restored from edicts when changing levels
827: int health;
828: int max_health;
829: qboolean powerArmorActive;
830:
831: int selected_item;
832: int inventory[MAX_ITEMS];
833:
834: // ammo capacities
835: int max_bullets;
836: int max_shells;
837: int max_rockets;
838: int max_grenades;
839: int max_cells;
840: int max_slugs;
841:
842: gitem_t *weapon;
843: gitem_t *lastweapon;
844:
845: int power_cubes; // used for tracking the cubes in coop games
846: int score; // for calculating total unit score in coop games
847: } client_persistant_t;
848:
849: // client data that stays across deathmatch respawns
850: typedef struct
851: {
852: client_persistant_t coop_respawn; // what to set client->pers to on a respawn
853: int enterframe; // level.framenum the client entered the game
854: int score; // frags, etc
855: //ZOID
856: int ctf_team; // CTF team
857: int ctf_state;
858: float ctf_lasthurtcarrier;
859: float ctf_lastreturnedflag;
860: float ctf_flagsince;
861: float ctf_lastfraggedcarrier;
862: qboolean id_state;
863: qboolean voted; // for elections
864: qboolean ready;
865: qboolean admin;
866: struct ghost_s *ghost; // for ghost codes
867: //ZOID
868: vec3_t cmd_angles; // angles sent over in the last command
869: int game_helpchanged;
870: int helpchanged;
871: } client_respawn_t;
872:
873: // this structure is cleared on each PutClientInServer(),
874: // except for 'client->pers'
875: struct gclient_s
876: {
877: // known to server
878: player_state_t ps; // communicated by server to clients
879: int ping;
880:
881: // private to game
882: client_persistant_t pers;
883: client_respawn_t resp;
884: pmove_state_t old_pmove; // for detecting out-of-pmove changes
885:
886: qboolean showscores; // set layout stat
887: //ZOID
888: qboolean inmenu; // in menu
889: pmenuhnd_t *menu; // current menu
890: //ZOID
891: qboolean showinventory; // set layout stat
892: qboolean showhelp;
893: qboolean showhelpicon;
894:
895: int ammo_index;
896:
897: int buttons;
898: int oldbuttons;
899: int latched_buttons;
900:
901: qboolean weapon_thunk;
902:
903: gitem_t *newweapon;
904:
905: // sum up damage over an entire frame, so
906: // shotgun blasts give a single big kick
907: int damage_armor; // damage absorbed by armor
908: int damage_parmor; // damage absorbed by power armor
909: int damage_blood; // damage taken out of health
910: int damage_knockback; // impact damage
911: vec3_t damage_from; // origin for vector calculation
912:
913: float killer_yaw; // when dead, look at killer
914:
915: weaponstate_t weaponstate;
916: vec3_t kick_angles; // weapon kicks
917: vec3_t kick_origin;
918: float v_dmg_roll, v_dmg_pitch, v_dmg_time; // damage kicks
919: float fall_time, fall_value; // for view drop on fall
920: float damage_alpha;
921: float bonus_alpha;
922: vec3_t damage_blend;
923: vec3_t v_angle; // aiming direction
924: float bobtime; // so off-ground doesn't change it
925: vec3_t oldviewangles;
926: vec3_t oldvelocity;
927:
928: float next_drown_time;
929: int old_waterlevel;
930: int breather_sound;
931:
932: int machinegun_shots; // for weapon raising
933:
934: // animation vars
935: int anim_end;
936: int anim_priority;
937: qboolean anim_duck;
938: qboolean anim_run;
939:
940: // powerup timers
941: float quad_framenum;
942: float invincible_framenum;
943: float breather_framenum;
944: float enviro_framenum;
945:
946: qboolean grenade_blew_up;
947: float grenade_time;
948: int silencer_shots;
949: int weapon_sound;
950:
951: float pickup_msg_time;
952:
953: float flood_locktill; // locked from talking
954: float flood_when[10]; // when messages were said
955: int flood_whenhead; // head pointer for when said
956:
957: float respawn_time; // can respawn when time > this
958:
959: //ZOID
960: void *ctf_grapple; // entity of grapple
961: int ctf_grapplestate; // true if pulling
962: float ctf_grapplereleasetime; // time of grapple release
963: float ctf_regentime; // regen tech
964: float ctf_techsndtime;
965: float ctf_lasttechmsg;
966: edict_t *chase_target;
967: qboolean update_chase;
968: float menutime; // time to update menu
969: qboolean menudirty;
970: //ZOID
971: };
972:
973:
974: struct edict_s
975: {
976: entity_state_t s;
977: struct gclient_s *client; // NULL if not a player
978: // the server expects the first part
979: // of gclient_s to be a player_state_t
980: // but the rest of it is opaque
981:
982: qboolean inuse;
983: int linkcount;
984:
985: // FIXME: move these fields to a server private sv_entity_t
986: link_t area; // linked to a division node or leaf
987:
988: int num_clusters; // if -1, use headnode instead
989: int clusternums[MAX_ENT_CLUSTERS];
990: int headnode; // unused if num_clusters != -1
991: int areanum, areanum2;
992:
993: //================================
994:
995: int svflags;
996: vec3_t mins, maxs;
997: vec3_t absmin, absmax, size;
998: solid_t solid;
999: int clipmask;
1000: edict_t *owner;
1001:
1002:
1003: // DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER
1004: // EXPECTS THE FIELDS IN THAT ORDER!
1005:
1006: //================================
1007: int movetype;
1008: int flags;
1009:
1010: char *model;
1011: float freetime; // sv.time when the object was freed
1012:
1013: //
1014: // only used locally in game, not by server
1015: //
1016: char *message;
1017: char *classname;
1018: int spawnflags;
1019:
1020: float timestamp;
1021:
1022: float angle; // set in qe3, -1 = up, -2 = down
1023: char *target;
1024: char *targetname;
1025: char *killtarget;
1026: char *team;
1027: char *pathtarget;
1028: char *deathtarget;
1029: char *combattarget;
1030: edict_t *target_ent;
1031:
1032: float speed, accel, decel;
1033: vec3_t movedir;
1034: vec3_t pos1, pos2;
1035:
1036: vec3_t velocity;
1037: vec3_t avelocity;
1038: int mass;
1039: float air_finished;
1040: float gravity; // per entity gravity multiplier (1.0 is normal)
1041: // use for lowgrav artifact, flares
1042:
1043: edict_t *goalentity;
1044: edict_t *movetarget;
1045: float yaw_speed;
1046: float ideal_yaw;
1047:
1048: float nextthink;
1049: void (*prethink) (edict_t *ent);
1050: void (*think)(edict_t *self);
1051: void (*blocked)(edict_t *self, edict_t *other); //move to moveinfo?
1052: void (*touch)(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf);
1053: void (*use)(edict_t *self, edict_t *other, edict_t *activator);
1054: void (*pain)(edict_t *self, edict_t *other, float kick, int damage);
1055: void (*die)(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
1056:
1057: float touch_debounce_time; // are all these legit? do we need more/less of them?
1058: float pain_debounce_time;
1059: float damage_debounce_time;
1060: float fly_sound_debounce_time; //move to clientinfo
1061: float last_move_time;
1062:
1063: int health;
1064: int max_health;
1065: int gib_health;
1066: int deadflag;
1067: qboolean show_hostile;
1068:
1069: float powerarmor_time;
1070:
1071: char *map; // target_changelevel
1072:
1073: int viewheight; // height above origin where eyesight is determined
1074: int takedamage;
1075: int dmg;
1076: int radius_dmg;
1077: float dmg_radius;
1078: int sounds; //make this a spawntemp var?
1079: int count;
1080:
1081: edict_t *chain;
1082: edict_t *enemy;
1083: edict_t *oldenemy;
1084: edict_t *activator;
1085: edict_t *groundentity;
1086: int groundentity_linkcount;
1087: edict_t *teamchain;
1088: edict_t *teammaster;
1089:
1090: edict_t *mynoise; // can go in client only
1091: edict_t *mynoise2;
1092:
1093: int noise_index;
1094: int noise_index2;
1095: float volume;
1096: float attenuation;
1097:
1098: // timing variables
1099: float wait;
1100: float delay; // before firing targets
1101: float random;
1102:
1103: float teleport_time;
1104:
1105: int watertype;
1106: int waterlevel;
1107:
1108: vec3_t move_origin;
1109: vec3_t move_angles;
1110:
1111: // move this to clientinfo?
1112: int light_level;
1113:
1114: int style; // also used as areaportal number
1115:
1116: gitem_t *item; // for bonus items
1117:
1118: // common data blocks
1119: moveinfo_t moveinfo;
1120: monsterinfo_t monsterinfo;
1121: };
1122:
1123: //ZOID
1124: #include "g_ctf.h"
1125: //ZOID
1126:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.