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