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