1505 lines
41 KiB
C
1505 lines
41 KiB
C
// g_local.h -- local definitions for game module
|
|
|
|
|
|
// define GAME_INCLUDE so that game.h does not define the
|
|
// short, server-visible gclient_t and edict_t structures,
|
|
// because we define the full size ones in this file
|
|
#define GAME_INCLUDE
|
|
#include <assert.h>
|
|
#include <math.h>
|
|
#include <stdio.h>
|
|
#include <stdarg.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <direct.h>
|
|
#include <time.h>
|
|
#include <io.h>
|
|
|
|
#include "basetypes.h"
|
|
#include "basemath.h"
|
|
#include "qfiles.h"
|
|
#include "const.h"
|
|
#include "ref_system.h"
|
|
#include "ref_server.h"
|
|
#include "p_menu.h"
|
|
|
|
// the "gameversion" client command will print this plus compile date
|
|
#define GAMEVERSION "xash"
|
|
|
|
extern byte *zone_level;
|
|
extern byte *zone_game;
|
|
|
|
#define FreeTag(data) gi.Mem.Free(data)
|
|
|
|
//malloc-free
|
|
#define Mem_Alloc(pool,size) gi.Mem.Alloc(pool, size, __FILE__, __LINE__)
|
|
#define Mem_Free(mem) gi.Mem.Free(mem, __FILE__, __LINE__)
|
|
|
|
//Hunk_AllocName
|
|
#define Mem_AllocPool(name) gi.Mem.AllocPool(name, __FILE__, __LINE__)
|
|
#define Mem_FreePool(pool) gi.Mem.FreePool(pool, __FILE__, __LINE__)
|
|
#define Mem_EmptyPool(pool) gi.Mem.EmptyPool(pool, __FILE__, __LINE__)
|
|
|
|
#define COM_Parse(data) gi.Script.ParseToken(data)
|
|
|
|
#define GameTitle gi.GameInfo().title
|
|
|
|
/*
|
|
===========================================
|
|
infostring manager
|
|
===========================================
|
|
*/
|
|
#define Info_Print(x) gi.Info.Print
|
|
#define Info_Validate(x) gi.Info.Validate(x)
|
|
#define Info_RemoveKey(x, y) gi.Info.RemoveKey(x,y)
|
|
#define Info_ValueForKey(x,y) gi.Info.ValueForKey(x,y)
|
|
#define Info_SetValueForKey(x,y,z) gi.Info.SetValueForKey(x,y,z)
|
|
|
|
void *TagMalloc (int size, int tag);
|
|
void FreeTags (int tag);
|
|
|
|
// protocol bytes that can be directly added to messages
|
|
#define svc_muzzleflash 1
|
|
#define svc_muzzleflash2 2
|
|
#define svc_temp_entity 3
|
|
#define svc_layout 4
|
|
#define svc_inventory 5
|
|
#define svc_stufftext 11
|
|
|
|
/*
|
|
===========================================
|
|
network messaging manager
|
|
===========================================
|
|
*/
|
|
|
|
#define MESSAGE_BEGIN(x) gi.Msg.Begin(x)
|
|
#define WRITE_CHAR(x) gi.Msg.WriteChar(x)
|
|
#define WRITE_BYTE(x) gi.Msg.WriteByte(x)
|
|
#define WRITE_WORD(x) gi.Msg.WriteWord(x)
|
|
#define WRITE_SHORT(x) gi.Msg.WriteShort(x)
|
|
#define WRITE_LONG(x) gi.Msg.WriteLong(x)
|
|
#define WRITE_FLOAT(x) gi.Msg.WriteFloat(x)
|
|
#define WRITE_STRING(x) gi.Msg.WriteString(x)
|
|
#define WRITE_COORD(x) gi.Msg.WriteCoord(x)
|
|
#define WRITE_DIR(x) gi.Msg.WriteDir(x)
|
|
#define WRITE_ANGLE(x) gi.Msg.WriteAngler(x)
|
|
#define MESSAGE_SEND(x,y,z) gi.Msg.Send(x,y,z)
|
|
|
|
//==================================================================
|
|
|
|
// view pitching times
|
|
#define DAMAGE_TIME 0.5
|
|
#define FALL_TIME 0.3
|
|
|
|
|
|
// edict->spawnflags
|
|
// these are set with checkboxes on each entity in the map editor
|
|
#define SPAWNFLAG_NOT_EASY 0x00000100
|
|
#define SPAWNFLAG_NOT_MEDIUM 0x00000200
|
|
#define SPAWNFLAG_NOT_HARD 0x00000400
|
|
#define SPAWNFLAG_NOT_DEATHMATCH 0x00000800
|
|
|
|
// edict->flags
|
|
#define FL_FLY 0x00000001
|
|
#define FL_SWIM 0x00000002 // implied immunity to drowining
|
|
#define FL_IMMUNE_LASER 0x00000004
|
|
#define FL_INWATER 0x00000008
|
|
#define FL_GODMODE 0x00000010
|
|
#define FL_NOTARGET 0x00000020
|
|
#define FL_IMMUNE_SLIME 0x00000040
|
|
#define FL_IMMUNE_LAVA 0x00000080
|
|
#define FL_PARTIALGROUND 0x00000100 // not all corners are valid
|
|
#define FL_WATERJUMP 0x00000200 // player jumping out of water
|
|
#define FL_TEAMSLAVE 0x00000400 // not the first on the team
|
|
#define FL_NO_KNOCKBACK 0x00000800
|
|
#define FL_POWER_ARMOR 0x00001000 // power armor (if any) is active
|
|
#define FL_BOB 0x00002000 // Lazarus: Used for bobbing water
|
|
|
|
#define FL_TRACKTRAIN 0x00008000
|
|
#define FL_DISGUISED 0x00020000 // entity is in disguise, monsters will not recognize.
|
|
#define FL_NOGIB 0x00040000 // player has been vaporized by a nuke, drop no gibs
|
|
|
|
#define FL_REVERSIBLE 0x00080000 // Lazarus: used for reversible func_door_rotating
|
|
#define FL_REVOLVING 0x00100000 // Lazarus revolving door
|
|
#define FL_ROBOT 0x00200000 // Player-controlled robot or monster. Relax yaw constraints
|
|
|
|
#define FL_RESPAWN 0x80000000 // used for item respawning
|
|
|
|
|
|
#define FRAMETIME 0.1
|
|
|
|
// memory tags to allow dynamic memory to be cleaned up
|
|
#define TAG_GAME 765 // clear when unloading the dll
|
|
#define TAG_LEVEL 766 // clear when loading a new level
|
|
|
|
|
|
#define MELEE_DISTANCE 80
|
|
|
|
#define BODY_QUEUE_SIZE 8
|
|
|
|
typedef enum
|
|
{
|
|
AMMO_BULLETS,
|
|
AMMO_SHELLS,
|
|
AMMO_ROCKETS,
|
|
AMMO_GRENADES,
|
|
AMMO_CELLS,
|
|
AMMO_SLUGS,
|
|
AMMO_FUEL,
|
|
AMMO_HOMING_MISSILES
|
|
} ammo_t;
|
|
|
|
|
|
//deadflag
|
|
#define DEAD_NO 0
|
|
#define DEAD_DYING 1
|
|
#define DEAD_DEAD 2
|
|
#define DEAD_RESPAWNABLE 3
|
|
#define DEAD_FROZEN 4 // Lazarus: Don't shift angles, just freeze him
|
|
|
|
//range
|
|
#define RANGE_MELEE 0
|
|
#define RANGE_NEAR 1
|
|
#define RANGE_MID 2
|
|
#define RANGE_FAR 3
|
|
|
|
//gib types
|
|
#define GIB_ORGANIC 0
|
|
#define GIB_METALLIC 1
|
|
|
|
//monster ai flags
|
|
#define AI_STAND_GROUND 0x00000001
|
|
#define AI_TEMP_STAND_GROUND 0x00000002
|
|
#define AI_SOUND_TARGET 0x00000004
|
|
#define AI_LOST_SIGHT 0x00000008
|
|
#define AI_PURSUIT_LAST_SEEN 0x00000010
|
|
#define AI_PURSUE_NEXT 0x00000020
|
|
#define AI_PURSUE_TEMP 0x00000040
|
|
#define AI_HOLD_FRAME 0x00000080
|
|
#define AI_GOOD_GUY 0x00000100
|
|
#define AI_BRUTAL 0x00000200
|
|
#define AI_NOSTEP 0x00000400
|
|
#define AI_DUCKED 0x00000800
|
|
#define AI_COMBAT_POINT 0x00001000
|
|
#define AI_MEDIC 0x00002000
|
|
#define AI_RESURRECTING 0x00004000
|
|
#define AI_ACTOR 0x00040000 // Is this a misc_actor?
|
|
#define AI_FOLLOW_LEADER 0x00080000 // misc_actor only
|
|
#define AI_TWO_GUNS 0x00100000 // misc_actor only - nothing to do with AI really,
|
|
// but we're out of spawnflags
|
|
#define AI_RESPAWN_FINDPLAYER 0x00200000 // used for monsters that change maps with
|
|
// a trigger_transition... tells 'em to find SP
|
|
// player right away
|
|
#define AI_FREEFORALL 0x00400000 // Set by target_monsterbattle, lets dmgteam monsters
|
|
// attack monsters on opposion dmgteam
|
|
#define AI_RANGE_PAUSE 0x00800000
|
|
#define AI_SEEK_COVER 0x02000000
|
|
#define AI_CHICKEN 0x04000000
|
|
#define AI_MEDIC_PATROL 0x08000000
|
|
#define AI_HINT_TEST 0x10000000
|
|
#define AI_CROUCH 0x20000000
|
|
#define AI_EVADE_GRENADE 0x40000000
|
|
#define AI_SEEK_ENEMY 0x80000000
|
|
|
|
//monster attack state
|
|
#define AS_STRAIGHT 1
|
|
#define AS_SLIDING 2
|
|
#define AS_MELEE 3
|
|
#define AS_MISSILE 4
|
|
#define AS_BLIND 5 // PMM - used by boss code to do nasty things even if it can't see you
|
|
|
|
// armor types
|
|
#define ARMOR_NONE 0
|
|
#define ARMOR_JACKET 1
|
|
#define ARMOR_COMBAT 2
|
|
#define ARMOR_BODY 3
|
|
#define ARMOR_SHARD 4
|
|
|
|
// power armor types
|
|
#define POWER_ARMOR_NONE 0
|
|
#define POWER_ARMOR_SCREEN 1
|
|
#define POWER_ARMOR_SHIELD 2
|
|
|
|
// handedness values
|
|
#define RIGHT_HANDED 0
|
|
#define LEFT_HANDED 1
|
|
#define CENTER_HANDED 2
|
|
|
|
|
|
// game.serverflags values
|
|
#define SFL_CROSS_TRIGGER_1 0x00000001
|
|
#define SFL_CROSS_TRIGGER_2 0x00000002
|
|
#define SFL_CROSS_TRIGGER_3 0x00000004
|
|
#define SFL_CROSS_TRIGGER_4 0x00000008
|
|
#define SFL_CROSS_TRIGGER_5 0x00000010
|
|
#define SFL_CROSS_TRIGGER_6 0x00000020
|
|
#define SFL_CROSS_TRIGGER_7 0x00000040
|
|
#define SFL_CROSS_TRIGGER_8 0x00000080
|
|
#define SFL_CROSS_TRIGGER_MASK 0x000000ff
|
|
|
|
|
|
// noise types for PlayerNoise
|
|
#define PNOISE_SELF 0
|
|
#define PNOISE_WEAPON 1
|
|
#define PNOISE_IMPACT 2
|
|
|
|
// actor follow parms
|
|
#define ACTOR_FOLLOW_RUN_RANGE 256 // AI_FOLLOW_LEADER actors run if farther away than this
|
|
#define ACTOR_FOLLOW_STAND_RANGE 128 // .. .. stand if closer than this
|
|
|
|
typedef struct
|
|
{
|
|
int base_count;
|
|
int max_count;
|
|
float normal_protection;
|
|
float energy_protection;
|
|
int armor;
|
|
} gitem_armor_t;
|
|
|
|
|
|
// gitem_t->flags
|
|
#define IT_WEAPON 1 // use makes active weapon
|
|
#define IT_AMMO 2
|
|
#define IT_ARMOR 4
|
|
#define IT_STAY_COOP 8
|
|
#define IT_KEY 16
|
|
#define IT_POWERUP 32
|
|
|
|
// gitem_t->weapmodel for weapons indicates model index
|
|
#define WEAP_BLASTER 1
|
|
#define WEAP_SHOTGUN 2
|
|
#define WEAP_SUPERSHOTGUN 3
|
|
#define WEAP_MACHINEGUN 4
|
|
#define WEAP_CHAINGUN 5
|
|
#define WEAP_GRENADES 6
|
|
#define WEAP_GRENADELAUNCHER 7
|
|
#define WEAP_ROCKETLAUNCHER 8
|
|
#define WEAP_HYPERBLASTER 9
|
|
#define WEAP_RAILGUN 10
|
|
#define WEAP_BFG 11
|
|
#define WEAP_NONE 12
|
|
|
|
typedef struct gitem_s
|
|
{
|
|
char *classname; // spawning name
|
|
bool (*pickup)(struct edict_s *ent, struct edict_s *other);
|
|
void (*use)(struct edict_s *ent, struct gitem_s *item);
|
|
void (*drop)(struct edict_s *ent, struct gitem_s *item);
|
|
void (*weaponthink)(struct edict_s *ent);
|
|
char *pickup_sound;
|
|
char *world_model;
|
|
int world_model_flags;
|
|
char *view_model;
|
|
|
|
// client side info
|
|
char *icon;
|
|
char *pickup_name; // for printing on pickup
|
|
int count_width; // number of digits to display by icon
|
|
|
|
int quantity; // for ammo how much, for weapons how much is used per shot
|
|
char *ammo; // for weapons
|
|
int flags; // IT_* flags
|
|
|
|
int weapmodel; // weapon model index (for weapons)
|
|
|
|
void *info;
|
|
int tag;
|
|
|
|
char *precaches; // string of all models, sounds, and images this item will use
|
|
} gitem_t;
|
|
|
|
|
|
|
|
//
|
|
// this structure is left intact through an entire game
|
|
// it should be initialized at dll load time, and read/written to
|
|
// the server.ssv file for savegames
|
|
//
|
|
typedef struct
|
|
{
|
|
char helpmessage1[512];
|
|
char helpmessage2[512];
|
|
int helpchanged; // flash F1 icon if non 0, play sound
|
|
// and increment only if 1, 2, or 3
|
|
|
|
gclient_t *clients; // [maxclients]
|
|
|
|
// can't store spawnpoint in level, because
|
|
// it would get overwritten by the savegame restore
|
|
char spawnpoint[512]; // needed for coop respawns
|
|
|
|
// store latched cvars here that we want to get at often
|
|
int maxclients;
|
|
int maxentities;
|
|
|
|
// cross level triggers
|
|
int serverflags;
|
|
|
|
// Lazarus: target_lock combination
|
|
char lock_code[9];
|
|
int lock_revealed;
|
|
bool lock_hud;
|
|
// Lazarus: number of entities moved between maps (not counting players)
|
|
int transition_ents;
|
|
|
|
// items
|
|
int num_items;
|
|
|
|
bool autosaved;
|
|
} game_locals_t;
|
|
|
|
//
|
|
// this structure is cleared as each map is entered
|
|
// it is read/written to the level.sav file for savegames
|
|
//
|
|
typedef struct
|
|
{
|
|
int framenum;
|
|
float time;
|
|
|
|
char level_name[MAX_QPATH]; // the descriptive name (Outer Base, etc)
|
|
char mapname[MAX_QPATH]; // the server name (base1, etc)
|
|
char nextmap[MAX_QPATH]; // go here when fraglimit is hit
|
|
|
|
// intermission state
|
|
float intermissiontime; // time the intermission was started
|
|
char *changemap;
|
|
int exitintermission;
|
|
vec3_t intermission_origin;
|
|
vec3_t intermission_angle;
|
|
|
|
edict_t *sight_client; // changed once each frame for coop games
|
|
|
|
edict_t *sight_entity;
|
|
int sight_entity_framenum;
|
|
edict_t *sound_entity;
|
|
int sound_entity_framenum;
|
|
edict_t *sound2_entity;
|
|
int sound2_entity_framenum;
|
|
|
|
int pic_health;
|
|
|
|
int total_secrets;
|
|
int found_secrets;
|
|
|
|
int total_goals;
|
|
int found_goals;
|
|
|
|
int total_monsters;
|
|
int killed_monsters;
|
|
|
|
edict_t *current_entity; // entity running from G_RunFrame
|
|
int body_que; // dead bodies
|
|
|
|
int power_cubes; // ugly necessity for coop
|
|
|
|
int flashlight_cost; // cost/10 seconds for flashlight
|
|
int mud_puddles;
|
|
int num_3D_sounds;
|
|
bool restart_for_actor_models;
|
|
bool freeze;
|
|
int freezeframes;
|
|
int next_skill;
|
|
|
|
} level_locals_t;
|
|
|
|
|
|
// spawn_temp_t is only used to hold entity field values that
|
|
// can be set from the editor, but aren't actualy present
|
|
// in edict_t during gameplay
|
|
typedef struct
|
|
{
|
|
// world vars
|
|
char *sky;
|
|
float skyrotate;
|
|
vec3_t skyaxis;
|
|
char *nextmap;
|
|
|
|
int lip;
|
|
int distance;
|
|
int height;
|
|
char *noise;
|
|
float pausetime;
|
|
char *item;
|
|
char *gravity;
|
|
|
|
float minyaw;
|
|
float maxyaw;
|
|
float minpitch;
|
|
float maxpitch;
|
|
float phase;
|
|
|
|
float shift;
|
|
} spawn_temp_t;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
// fixed data
|
|
vec3_t start_origin;
|
|
vec3_t start_angles;
|
|
vec3_t end_origin;
|
|
vec3_t end_angles;
|
|
|
|
int sound_start;
|
|
int sound_middle;
|
|
int sound_end;
|
|
|
|
float accel;
|
|
float speed;
|
|
float decel;
|
|
float distance;
|
|
|
|
float wait;
|
|
|
|
// state data
|
|
int state;
|
|
int prevstate;
|
|
vec3_t dir;
|
|
float current_speed;
|
|
float move_speed;
|
|
float next_speed;
|
|
float remaining_distance;
|
|
float decel_distance;
|
|
float ratio;
|
|
void (*endfunc)(edict_t *);
|
|
bool is_blocked;
|
|
} moveinfo_t;
|
|
|
|
|
|
typedef struct
|
|
{
|
|
void (*aifunc)(edict_t *self, float dist);
|
|
float dist;
|
|
void (*thinkfunc)(edict_t *self);
|
|
} mframe_t;
|
|
|
|
typedef struct
|
|
{
|
|
int firstframe;
|
|
int lastframe;
|
|
mframe_t *frame;
|
|
void (*endfunc)(edict_t *self);
|
|
} mmove_t;
|
|
|
|
typedef struct
|
|
{
|
|
mmove_t *currentmove;
|
|
mmove_t *savemove;
|
|
int aiflags;
|
|
int nextframe;
|
|
float scale;
|
|
|
|
void (*stand)(edict_t *self);
|
|
void (*idle)(edict_t *self);
|
|
void (*search)(edict_t *self);
|
|
void (*walk)(edict_t *self);
|
|
void (*run)(edict_t *self);
|
|
void (*dodge)(edict_t *self, edict_t *other, float eta);
|
|
void (*attack)(edict_t *self);
|
|
void (*melee)(edict_t *self);
|
|
void (*sight)(edict_t *self, edict_t *other);
|
|
bool (*checkattack)(edict_t *self);
|
|
void (*jump)(edict_t *self);
|
|
|
|
float pausetime;
|
|
float attack_finished;
|
|
|
|
vec3_t saved_goal;
|
|
float search_time;
|
|
float trail_time;
|
|
vec3_t last_sighting;
|
|
int attack_state;
|
|
int lefty;
|
|
float idle_time;
|
|
int linkcount;
|
|
|
|
int power_armor_type;
|
|
int power_armor_power;
|
|
|
|
float min_range; // Monsters stop chasing enemy at this distance
|
|
float max_range; // Monsters won't notice or attack targets farther than this
|
|
float ideal_range[2]; // Ideal low and high range from target, weapon-specific
|
|
float flies; // Probability of dead monster generating flies
|
|
float jumpup;
|
|
float jumpdn;
|
|
float rangetime;
|
|
int chicken_framenum;
|
|
int pathdir; // Up/down a hint_path chain flag for medic
|
|
float visibility; // Ratio of visibility
|
|
|
|
} monsterinfo_t;
|
|
|
|
extern game_locals_t game;
|
|
extern level_locals_t level;
|
|
extern game_import_t gi;
|
|
extern game_export_t globals;
|
|
extern spawn_temp_t st;
|
|
|
|
extern int sm_meat_index;
|
|
extern int snd_fry;
|
|
|
|
extern int noweapon_index;
|
|
extern int jacket_armor_index;
|
|
extern int combat_armor_index;
|
|
extern int body_armor_index;
|
|
extern int shells_index;
|
|
extern int bullets_index;
|
|
extern int grenades_index;
|
|
extern int rockets_index;
|
|
extern int cells_index;
|
|
extern int slugs_index;
|
|
extern int fuel_index;
|
|
extern int homing_index;
|
|
extern int rl_index;
|
|
extern int hml_index;
|
|
|
|
// means of death
|
|
#define MOD_UNKNOWN 0
|
|
#define MOD_BLASTER 1
|
|
#define MOD_SHOTGUN 2
|
|
#define MOD_SSHOTGUN 3
|
|
#define MOD_MACHINEGUN 4
|
|
#define MOD_CHAINGUN 5
|
|
#define MOD_GRENADE 6
|
|
#define MOD_G_SPLASH 7
|
|
#define MOD_ROCKET 8
|
|
#define MOD_R_SPLASH 9
|
|
#define MOD_HYPERBLASTER 10
|
|
#define MOD_RAILGUN 11
|
|
#define MOD_BFG_LASER 12
|
|
#define MOD_BFG_BLAST 13
|
|
#define MOD_BFG_EFFECT 14
|
|
#define MOD_HANDGRENADE 15
|
|
#define MOD_HG_SPLASH 16
|
|
#define MOD_WATER 17
|
|
#define MOD_SLIME 18
|
|
#define MOD_LAVA 19
|
|
#define MOD_CRUSH 20
|
|
#define MOD_TELEFRAG 21
|
|
#define MOD_FALLING 22
|
|
#define MOD_SUICIDE 23
|
|
#define MOD_HELD_GRENADE 24
|
|
#define MOD_EXPLOSIVE 25
|
|
#define MOD_BARREL 26
|
|
#define MOD_BOMB 27
|
|
#define MOD_EXIT 28
|
|
#define MOD_SPLASH 29
|
|
#define MOD_TARGET_LASER 30
|
|
#define MOD_TRIGGER_HURT 31
|
|
#define MOD_HIT 32
|
|
#define MOD_TARGET_BLASTER 33
|
|
#define MOD_VEHICLE 34
|
|
#define MOD_KICK 35
|
|
#define MOD_FRIENDLY_FIRE 0x8000000
|
|
|
|
extern int meansOfDeath;
|
|
|
|
extern edict_t *g_edicts;
|
|
|
|
#define FOFS(x) (int)&(((edict_t *)0)->x)
|
|
#define STOFS(x) (int)&(((spawn_temp_t *)0)->x)
|
|
#define LLOFS(x) (int)&(((level_locals_t *)0)->x)
|
|
#define CLOFS(x) (int)&(((gclient_t *)0)->x)
|
|
|
|
#define random() ((rand () & 0x7fff) / ((float)0x7fff))
|
|
#define crandom() (2.0 * (random() - 0.5))
|
|
|
|
extern cvar_t *maxentities;
|
|
extern cvar_t *deathmatch;
|
|
extern cvar_t *coop;
|
|
extern cvar_t *dmflags;
|
|
extern cvar_t *skill;
|
|
extern cvar_t *fraglimit;
|
|
extern cvar_t *timelimit;
|
|
extern cvar_t *password;
|
|
extern cvar_t *spectator_password;
|
|
extern cvar_t *needpass;
|
|
extern cvar_t *g_select_empty;
|
|
extern cvar_t *dedicated;
|
|
|
|
extern cvar_t *filterban;
|
|
|
|
extern cvar_t *sv_gravity;
|
|
extern cvar_t *sv_maxvelocity;
|
|
|
|
extern cvar_t *gun_x, *gun_y, *gun_z;
|
|
extern cvar_t *sv_rollspeed;
|
|
extern cvar_t *sv_rollangle;
|
|
|
|
extern cvar_t *run_pitch;
|
|
extern cvar_t *run_roll;
|
|
extern cvar_t *bob_up;
|
|
extern cvar_t *bob_pitch;
|
|
extern cvar_t *bob_roll;
|
|
|
|
extern cvar_t *sv_cheats;
|
|
extern cvar_t *maxclients;
|
|
extern cvar_t *maxspectators;
|
|
|
|
extern cvar_t *flood_msgs;
|
|
extern cvar_t *flood_persecond;
|
|
extern cvar_t *flood_waitdelay;
|
|
|
|
extern cvar_t *sv_maplist;
|
|
extern cvar_t *r_motionblur;
|
|
|
|
extern cvar_t *actorchicken;
|
|
extern cvar_t *actorjump;
|
|
extern cvar_t *actorscram;
|
|
extern cvar_t *alert_sounds;
|
|
extern cvar_t *allow_download;
|
|
extern cvar_t *bounce_bounce;
|
|
extern cvar_t *bounce_minv;
|
|
extern cvar_t *cd_loopcount;
|
|
extern cvar_t *cl_gun;
|
|
extern cvar_t *corpse_fade;
|
|
extern cvar_t *corpse_fadetime;
|
|
extern cvar_t *crosshair;
|
|
extern cvar_t *developer;
|
|
extern cvar_t *fov;
|
|
extern cvar_t *gl_clear;
|
|
extern cvar_t *gl_driver;
|
|
extern cvar_t *hand;
|
|
extern cvar_t *jetpack_weenie;
|
|
extern cvar_t *joy_pitchsensitivity;
|
|
extern cvar_t *joy_yawsensitivity;
|
|
extern cvar_t *jump_kick;
|
|
extern cvar_t *lazarus_cd_loop;
|
|
extern cvar_t *lazarus_cl_gun;
|
|
extern cvar_t *lazarus_crosshair;
|
|
extern cvar_t *lazarus_gl_clear;
|
|
extern cvar_t *lazarus_joyp;
|
|
extern cvar_t *lazarus_joyy;
|
|
extern cvar_t *lazarus_pitch;
|
|
extern cvar_t *lazarus_yaw;
|
|
extern cvar_t *m_pitch;
|
|
extern cvar_t *m_yaw;
|
|
extern cvar_t *monsterjump;
|
|
extern cvar_t *player_vampire;
|
|
extern cvar_t *readout;
|
|
extern cvar_t *rocket_strafe;
|
|
extern cvar_t *rotate_distance;
|
|
extern cvar_t *s_primary;
|
|
extern cvar_t *shift_distance;
|
|
extern cvar_t *sv_maxgibs;
|
|
extern cvar_t *turn_rider;
|
|
extern cvar_t *zoomrate;
|
|
extern cvar_t *zoomsnap;
|
|
|
|
extern int max_modelindex;
|
|
extern int max_soundindex;
|
|
|
|
|
|
#define world (&g_edicts[0])
|
|
|
|
// item spawnflags
|
|
#define ITEM_TRIGGER_SPAWN 0x00000001
|
|
#define ITEM_NO_TOUCH 0x00000002
|
|
// 6 bits reserved for editor flags
|
|
// 8 bits used as power cube id bits for coop games
|
|
#define DROPPED_ITEM 0x00010000
|
|
#define DROPPED_PLAYER_ITEM 0x00020000
|
|
#define ITEM_TARGETS_USED 0x00040000
|
|
|
|
//
|
|
// fields are needed for spawning from the entity string
|
|
// and saving / loading games
|
|
//
|
|
#define FFL_SPAWNTEMP 1
|
|
#define FFL_NOSPAWN 2
|
|
|
|
typedef enum {
|
|
F_INT,
|
|
F_FLOAT,
|
|
F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL
|
|
F_GSTRING, // string on disk, pointer in memory, TAG_GAME
|
|
F_VECTOR,
|
|
F_ANGLEHACK,
|
|
F_EDICT, // index on disk, pointer in memory
|
|
F_ITEM, // index on disk, pointer in memory
|
|
F_CLIENT, // index on disk, pointer in memory
|
|
F_FUNCTION,
|
|
F_MMOVE,
|
|
F_IGNORE
|
|
} fieldtype_t;
|
|
|
|
typedef struct
|
|
{
|
|
char *name;
|
|
int ofs;
|
|
fieldtype_t type;
|
|
int flags;
|
|
} field_t;
|
|
|
|
typedef struct
|
|
{
|
|
char *name;
|
|
void (*spawn)(edict_t *ent);
|
|
} spawn_t;
|
|
|
|
// Lazarus: worldspawn effects
|
|
#define FX_WORLDSPAWN_NOHELP 1
|
|
#define FX_WORLDSPAWN_STEPSOUNDS 2
|
|
#define FX_WORLDSPAWN_WHATSIT 4
|
|
#define FX_WORLDSPAWN_ALERTSOUNDS 8
|
|
#define FX_WORLDSPAWN_CORPSEFADE 16
|
|
#define FX_WORLDSPAWN_JUMPKICK 32
|
|
|
|
|
|
extern field_t fields[];
|
|
extern gitem_t itemlist[];
|
|
extern spawn_t spawns[];
|
|
|
|
//
|
|
// g_ai.c
|
|
//
|
|
void AI_SetSightClient (void);
|
|
void ai_stand (edict_t *self, float dist);
|
|
void ai_move (edict_t *self, float dist);
|
|
void ai_walk (edict_t *self, float dist);
|
|
void ai_turn (edict_t *self, float dist);
|
|
void ai_run (edict_t *self, float dist);
|
|
void ai_charge (edict_t *self, float dist);
|
|
bool canReach (edict_t *ent, edict_t *other);
|
|
bool FacingIdeal(edict_t *self);
|
|
bool FindTarget (edict_t *self);
|
|
void FoundTarget (edict_t *self);
|
|
void HuntTarget (edict_t *self);
|
|
bool infront (edict_t *self, edict_t *other);
|
|
int range (edict_t *self, edict_t *other);
|
|
bool visible (edict_t *self, edict_t *other);
|
|
bool ai_chicken (edict_t *ent, edict_t *badguy);
|
|
//
|
|
// g_combat.c
|
|
//
|
|
bool OnSameTeam (edict_t *ent1, edict_t *ent2);
|
|
bool CanDamage (edict_t *targ, edict_t *inflictor);
|
|
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);
|
|
void T_RadiusDamage (edict_t *inflictor, edict_t *attacker, float damage, edict_t *ignore, float radius, int mod, double dmg_slope);
|
|
void Killed (edict_t *targ, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
|
|
|
|
// damage flags
|
|
#define DAMAGE_RADIUS 0x00000001 // damage was indirect
|
|
#define DAMAGE_NO_ARMOR 0x00000002 // armour does not protect from this damage
|
|
#define DAMAGE_ENERGY 0x00000004 // damage is from an energy based weapon
|
|
#define DAMAGE_NO_KNOCKBACK 0x00000008 // do not affect velocity, just view angles
|
|
#define DAMAGE_BULLET 0x00000010 // damage is from a bullet (used for ricochets)
|
|
#define DAMAGE_NO_PROTECTION 0x00000020 // armor, shields, invulnerability, and godmode have no effect
|
|
|
|
#define DEFAULT_BULLET_HSPREAD 300
|
|
#define DEFAULT_BULLET_VSPREAD 500
|
|
#define DEFAULT_SHOTGUN_HSPREAD 1000
|
|
#define DEFAULT_SHOTGUN_VSPREAD 500
|
|
#define DEFAULT_DEATHMATCH_SHOTGUN_COUNT 12
|
|
#define DEFAULT_SHOTGUN_COUNT 12
|
|
#define DEFAULT_SSHOTGUN_COUNT 20
|
|
//
|
|
// g_cmds.c
|
|
//
|
|
void Cmd_Help_f (edict_t *ent);
|
|
void Cmd_Score_f (edict_t *ent);
|
|
void Use_Flashlight(edict_t *ent,gitem_t *item);
|
|
void ClientCommand (edict_t *ent);
|
|
//
|
|
// g_items.c
|
|
//
|
|
void PrecacheItem (gitem_t *it);
|
|
void InitItems (void);
|
|
void SetItemNames (void);
|
|
gitem_t *FindItem (char *pickup_name);
|
|
gitem_t *FindItemByClassname (char *classname);
|
|
#define ITEM_INDEX(x) ((x)-itemlist)
|
|
edict_t *Drop_Item (edict_t *ent, gitem_t *item);
|
|
void SetRespawn (edict_t *ent, float delay);
|
|
void ChangeWeapon (edict_t *ent);
|
|
void SpawnItem (edict_t *ent, gitem_t *item);
|
|
void Think_Weapon (edict_t *ent);
|
|
int ArmorIndex (edict_t *ent);
|
|
int PowerArmorType (edict_t *ent);
|
|
gitem_t *GetItemByIndex (int index);
|
|
bool Add_Ammo (edict_t *ent, gitem_t *item, int count);
|
|
void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf);
|
|
//
|
|
// g_main.c
|
|
//
|
|
void SaveClientData (void);
|
|
void FetchClientEntData (edict_t *ent);
|
|
//
|
|
// g_misc.c
|
|
//
|
|
void ThrowHead (edict_t *self, char *gibname, int damage, int type);
|
|
void ThrowClientHead (edict_t *self, int damage);
|
|
void ThrowGib (edict_t *self, char *gibname, int damage, int type);
|
|
void BecomeExplosion1(edict_t *self);
|
|
void barrel_delay (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
|
|
void barrel_explode (edict_t *self);
|
|
void func_explosive_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
|
|
void PrecacheDebris (int style);
|
|
//
|
|
// g_monster.c
|
|
//
|
|
#define SF_MONSTER_AMBUSH 1
|
|
#define SF_MONSTER_TRIGGER_SPAWN 2
|
|
#define SF_MONSTER_SIGHT 4
|
|
#define SF_MONSTER_GOODGUY 8
|
|
#define SF_MONSTER_NOGIB 16
|
|
#define SF_MONSTER_SPECIAL 32
|
|
#define SF_ACTOR_BAD_GUY 64
|
|
#define SF_MONSTER_FLIES 128 // only used for monster_commander_body
|
|
#define SF_MONSTER_IGNORESHOTS 128
|
|
#define SF_MONSTER_KNOWS_MIRRORS 0x00010000
|
|
|
|
void FadeSink (edict_t *ent);
|
|
void FadeDieSink (edict_t *ent);
|
|
void monster_fire_bullet (edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype);
|
|
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);
|
|
void monster_fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect);
|
|
void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype);
|
|
void monster_fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, edict_t *homing_target);
|
|
void monster_fire_railgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int flashtype);
|
|
void monster_fire_bfg (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int kick, float damage_radius, int flashtype);
|
|
void HintTestNext (edict_t *self, edict_t *hint);
|
|
int HintTestStart (edict_t *self);
|
|
void M_droptofloor (edict_t *ent);
|
|
void monster_think (edict_t *self);
|
|
void walkmonster_start (edict_t *self);
|
|
void swimmonster_start (edict_t *self);
|
|
void flymonster_start (edict_t *self);
|
|
void AttackFinished (edict_t *self, float time);
|
|
void monster_death_use (edict_t *self);
|
|
void M_CatagorizePosition (edict_t *ent);
|
|
bool M_CheckAttack (edict_t *self);
|
|
void M_FlyCheck (edict_t *self);
|
|
void M_FliesOff (edict_t *self);
|
|
void M_FliesOn (edict_t *self);
|
|
void M_CheckGround (edict_t *ent);
|
|
bool M_walkmove (edict_t *ent, float yaw, float dist);
|
|
bool M_SetDeath (edict_t *ent,mmove_t **moves);
|
|
int PatchMonsterModel (char *model);
|
|
//
|
|
// g_patchplayermodels.c
|
|
//
|
|
int PatchPlayerModels (char *modelname);
|
|
//
|
|
// g_phys.c
|
|
//
|
|
void SV_AddGravity (edict_t *ent);
|
|
void G_RunEntity (edict_t *ent);
|
|
//
|
|
// g_spawn.c
|
|
//
|
|
void ED_CallSpawn (edict_t *ent);
|
|
void G_FindTeams();
|
|
void Cmd_ToggleHud ();
|
|
void Hud_On();
|
|
void Hud_Off();
|
|
//
|
|
// g_svcmds.c
|
|
//
|
|
void ServerCommand (void);
|
|
bool SV_FilterPacket (char *from);
|
|
//
|
|
// g_thing.c
|
|
//
|
|
edict_t *SpawnThing();
|
|
//
|
|
// g_trigger.c
|
|
//
|
|
typedef struct
|
|
{
|
|
char *name;
|
|
} entlist_t;
|
|
bool HasSpawnFunction(edict_t *ent);
|
|
int trigger_transition_ents (edict_t *changelevel, edict_t *self);
|
|
//
|
|
// g_utils.c
|
|
//
|
|
bool KillBox (edict_t *ent);
|
|
void G_ProjectSource (vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result);
|
|
edict_t *G_Find (edict_t *from, int fieldofs, char *match);
|
|
edict_t *findradius (edict_t *from, vec3_t org, float rad);
|
|
edict_t *G_PickTarget (char *targetname);
|
|
void G_UseTargets (edict_t *ent, edict_t *activator);
|
|
void G_SetMovedir (vec3_t angles, vec3_t movedir);
|
|
void G_InitEdict (edict_t *e);
|
|
edict_t *G_Spawn (void);
|
|
void G_FreeEdict (edict_t *e);
|
|
void G_TouchTriggers (edict_t *ent);
|
|
void G_TouchSolids (edict_t *ent);
|
|
char *G_CopyString (char *in);
|
|
void stuffcmd(edict_t *ent,char *command);
|
|
float *tv (float x, float y, float z);
|
|
char *vtos (vec3_t v);
|
|
float vectoyaw (vec3_t vec);
|
|
void vectoangles (vec3_t vec, vec3_t angles);
|
|
bool point_infront (edict_t *self, vec3_t point);
|
|
void AnglesNormalize(vec3_t vec);
|
|
float SnapToEights(float x);
|
|
// Lazarus
|
|
float AtLeast(float x, float dx);
|
|
edict_t *LookingAt(edict_t *ent, int filter, vec3_t endpos, float *range);
|
|
void GameDirRelativePath(char *filename, char *output);
|
|
void G_UseTarget (edict_t *ent, edict_t *activator, edict_t *target);
|
|
//
|
|
// p_client.c
|
|
//
|
|
void player_pain (edict_t *self, edict_t *other, float kick, int damage);
|
|
void player_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
|
|
void respawn (edict_t *ent);
|
|
void BeginIntermission (edict_t *targ);
|
|
void PutClientInServer (edict_t *ent);
|
|
void InitClientPersistant (gclient_t *client,int style);
|
|
void InitClientResp (gclient_t *client);
|
|
void InitBodyQue (void);
|
|
void ClientBeginServerFrame (edict_t *ent);
|
|
//
|
|
// p_hud.c
|
|
//
|
|
void MoveClientToIntermission (edict_t *client);
|
|
void G_SetStats (edict_t *ent);
|
|
void G_SetSpectatorStats (edict_t *ent);
|
|
void ValidateSelectedItem (edict_t *ent);
|
|
void DeathmatchScoreboardMessage (edict_t *client, edict_t *killer);
|
|
//
|
|
// p_view.c
|
|
//
|
|
void ClientEndServerFrame (edict_t *ent);
|
|
//
|
|
// p_weapon.c
|
|
//
|
|
void PlayerNoise(edict_t *who, vec3_t where, int type);
|
|
void P_ProjectSource (gclient_t *client, vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result);
|
|
void kick_attack (edict_t *ent);
|
|
|
|
//============================================================================
|
|
|
|
// client_t->anim_priority
|
|
#define ANIM_BASIC 0 // stand / run
|
|
#define ANIM_WAVE 1
|
|
#define ANIM_JUMP 2
|
|
#define ANIM_PAIN 3
|
|
#define ANIM_ATTACK 4
|
|
#define ANIM_DEATH 5
|
|
#define ANIM_REVERSE 6
|
|
|
|
|
|
// client data that stays across multiple level loads
|
|
typedef struct
|
|
{
|
|
char userinfo[MAX_INFO_STRING];
|
|
char netname[16];
|
|
int hand;
|
|
|
|
bool connected; // a loadgame will leave valid entities that
|
|
// just don't have a connection yet
|
|
|
|
// values saved and restored from edicts when changing levels
|
|
int health;
|
|
int max_health;
|
|
int savedFlags;
|
|
|
|
int selected_item;
|
|
int inventory[MAX_ITEMS];
|
|
|
|
// ammo capacities
|
|
int max_bullets;
|
|
int max_shells;
|
|
int max_rockets;
|
|
int max_grenades;
|
|
int max_cells;
|
|
int max_slugs;
|
|
int max_fuel;
|
|
int max_homing_missiles;
|
|
|
|
gitem_t *weapon;
|
|
gitem_t *lastweapon;
|
|
|
|
bool fire_mode; // Lazarus - alternate firing mode
|
|
|
|
int power_cubes; // used for tracking the cubes in coop games
|
|
int score; // for calculating total unit score in coop games
|
|
|
|
int game_helpchanged;
|
|
int helpchanged;
|
|
|
|
bool spectator; // client is a spectator
|
|
bool spawn_landmark;
|
|
bool spawn_levelchange;
|
|
vec3_t spawn_offset;
|
|
vec3_t spawn_velocity;
|
|
vec3_t spawn_angles;
|
|
vec3_t spawn_viewangles;
|
|
int spawn_pm_flags;
|
|
int spawn_gunframe;
|
|
int spawn_modelframe;
|
|
int spawn_anim_end;
|
|
gitem_t *newweapon;
|
|
} client_persistant_t;
|
|
|
|
// client data that stays across deathmatch respawns
|
|
typedef struct
|
|
{
|
|
client_persistant_t coop_respawn; // what to set client->pers to on a respawn
|
|
int enterframe; // level.framenum the client entered the game
|
|
int score; // frags, etc
|
|
vec3_t cmd_angles; // angles sent over in the last command
|
|
|
|
bool spectator; // client is a spectator
|
|
} client_respawn_t;
|
|
|
|
// this structure is cleared on each PutClientInServer(),
|
|
// except for 'client->pers'
|
|
struct gclient_s
|
|
{
|
|
// known to server
|
|
player_state_t ps; // communicated by server to clients
|
|
int ping;
|
|
|
|
// private to game
|
|
client_persistant_t pers;
|
|
client_respawn_t resp;
|
|
pmove_state_t old_pmove; // for detecting out-of-pmove changes
|
|
|
|
bool showscores; // set layout stat
|
|
bool showinventory; // set layout stat
|
|
bool showhelp;
|
|
bool showhelpicon;
|
|
|
|
int ammo_index;
|
|
|
|
int buttons;
|
|
int oldbuttons;
|
|
int latched_buttons;
|
|
|
|
int nNewLatch;
|
|
|
|
bool weapon_thunk;
|
|
|
|
gitem_t *newweapon;
|
|
|
|
// sum up damage over an entire frame, so
|
|
// shotgun blasts give a single big kick
|
|
int damage_armor; // damage absorbed by armor
|
|
int damage_parmor; // damage absorbed by power armor
|
|
int damage_blood; // damage taken out of health
|
|
int damage_knockback; // impact damage
|
|
vec3_t damage_from; // origin for vector calculation
|
|
|
|
float killer_yaw; // when dead, look at killer
|
|
|
|
weaponstate_t weaponstate;
|
|
vec3_t kick_angles; // weapon kicks
|
|
vec3_t kick_origin;
|
|
float v_dmg_roll, v_dmg_pitch, v_dmg_time; // damage kicks
|
|
float fall_time, fall_value; // for view drop on fall
|
|
float damage_alpha;
|
|
float bonus_alpha;
|
|
vec3_t damage_blend;
|
|
vec3_t v_angle; // aiming direction
|
|
float bobtime; // so off-ground doesn't change it
|
|
vec3_t oldviewangles;
|
|
vec3_t oldvelocity;
|
|
|
|
float next_drown_time;
|
|
int old_waterlevel;
|
|
int breather_sound;
|
|
|
|
int machinegun_shots; // for weapon raising
|
|
|
|
// animation vars
|
|
int anim_end;
|
|
int anim_priority;
|
|
bool anim_duck;
|
|
bool anim_run;
|
|
|
|
// powerup timers
|
|
float quad_framenum;
|
|
float invincible_framenum;
|
|
float breather_framenum;
|
|
float enviro_framenum;
|
|
|
|
bool grenade_blew_up;
|
|
float grenade_time;
|
|
int silencer_shots;
|
|
int weapon_sound;
|
|
|
|
float pickup_msg_time;
|
|
|
|
float flood_locktill; // locked from talking
|
|
float flood_when[10]; // when messages were said
|
|
int flood_whenhead; // head pointer for when said
|
|
|
|
float respawn_time; // can respawn when time > this
|
|
|
|
usercmd_t ucmd; // Lazarus: Copied for convenience in ClientThink
|
|
|
|
// TREMOR func_pushable stuff
|
|
float maxvelocity; // Used when pushing func_pushable
|
|
edict_t *push;
|
|
|
|
// flashlight
|
|
bool flashlight;
|
|
float flashlight_time;
|
|
|
|
// menu stuff ala CTF
|
|
bool inmenu; // in menu
|
|
int menutimer;
|
|
pmenuhnd_t *menu; // current menu
|
|
char *whatsit;
|
|
|
|
// security camera
|
|
edict_t *spycam;
|
|
edict_t *monitor;
|
|
edict_t *camplayer;
|
|
vec3_t org_viewangles;
|
|
short old_owner_angles[2];
|
|
|
|
// laser sight
|
|
edict_t *laser_sight;
|
|
|
|
int vehicle_framenum; // last time player engaged or disengaged vehicle
|
|
int zooming;
|
|
float joy_pitchsensitivity;
|
|
float joy_yawsensitivity;
|
|
float m_pitch;
|
|
float m_yaw;
|
|
bool sensitivities_init;
|
|
bool zoomed;
|
|
float original_fov;
|
|
float fps_time_start;
|
|
int fps_frames;
|
|
float secs_per_frame;
|
|
float frame_zoomrate;
|
|
|
|
int shift_dir; // direction code for debugging/moving an item
|
|
int startframe; // time at which ClientBegin is called
|
|
|
|
float fadestart;
|
|
float fadein; // for fading screen to black at mission failure
|
|
float fadehold;
|
|
float fadeout;
|
|
vec3_t fadecolor;
|
|
float fadealpha;
|
|
|
|
int leftfoot; // 0 or 1, used for footstep sounds
|
|
int jumping; // 0 or 1, used for jumpkick
|
|
|
|
edict_t *homing_rocket; // used to limit firing frequency
|
|
};
|
|
|
|
#define NUM_ACTOR_SOUNDS 13
|
|
|
|
struct edict_s
|
|
{
|
|
entity_state_t s;
|
|
struct gclient_s *client; // NULL if not a player
|
|
// the server expects the first part
|
|
// of gclient_s to be a player_state_t
|
|
// but the rest of it is opaque
|
|
|
|
bool inuse;
|
|
int linkcount;
|
|
|
|
// FIXME: move these fields to a server private sv_entity_t
|
|
link_t area; // linked to a division node or leaf
|
|
|
|
int num_clusters; // if -1, use headnode instead
|
|
int clusternums[MAX_ENT_CLUSTERS];
|
|
int headnode; // unused if num_clusters != -1
|
|
int areanum, areanum2;
|
|
|
|
//================================
|
|
|
|
int svflags;
|
|
vec3_t mins, maxs;
|
|
vec3_t absmin, absmax, size;
|
|
solid_t solid;
|
|
int clipmask;
|
|
edict_t *owner;
|
|
|
|
|
|
// DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER
|
|
// EXPECTS THE FIELDS IN THAT ORDER!
|
|
|
|
//================================
|
|
entity_id class_id; // Lazarus: Added in lieu of doing string comparisons
|
|
// on classnames.
|
|
|
|
int movetype;
|
|
int flags;
|
|
|
|
char *model;
|
|
float freetime; // sv.time when the object was freed
|
|
|
|
//
|
|
// only used locally in game, not by server
|
|
//
|
|
char *message;
|
|
char *key_message; // Lazarus: used from tremor_trigger_key
|
|
char *classname;
|
|
int spawnflags;
|
|
|
|
float timestamp;
|
|
|
|
float angle; // set in qe3, -1 = up, -2 = down
|
|
char *target;
|
|
char *targetname;
|
|
char *killtarget;
|
|
char *team;
|
|
char *pathtarget;
|
|
char *deathtarget;
|
|
char *combattarget;
|
|
edict_t *target_ent;
|
|
|
|
float speed, accel, decel;
|
|
vec3_t movedir;
|
|
vec3_t pos1, pos2;
|
|
|
|
vec3_t velocity;
|
|
vec3_t avelocity;
|
|
int mass;
|
|
float air_finished;
|
|
float gravity; // per entity gravity multiplier (1.0 is normal)
|
|
// use for lowgrav artifact, flares
|
|
|
|
edict_t *goalentity;
|
|
edict_t *movetarget;
|
|
float yaw_speed;
|
|
float ideal_yaw;
|
|
|
|
char *common_name;
|
|
|
|
// Lazarus: for rotating brush models:
|
|
float pitch_speed;
|
|
float roll_speed;
|
|
float ideal_pitch;
|
|
float ideal_roll;
|
|
float roll;
|
|
|
|
float nextthink;
|
|
void (*prethink) (edict_t *ent);
|
|
void (*think)(edict_t *self);
|
|
void (*blocked)(edict_t *self, edict_t *other); //move to moveinfo?
|
|
void (*touch)(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf);
|
|
void (*use)(edict_t *self, edict_t *other, edict_t *activator);
|
|
void (*pain)(edict_t *self, edict_t *other, float kick, int damage);
|
|
void (*die)(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
|
|
|
|
void (*play)(edict_t *self, edict_t *activator);
|
|
|
|
float touch_debounce_time; // are all these legit? do we need more/less of them?
|
|
float pain_debounce_time;
|
|
float damage_debounce_time;
|
|
float gravity_debounce_time; // used by item_ movement commands to prevent
|
|
// monsters from dropping to floor
|
|
float fly_sound_debounce_time; //move to clientinfo
|
|
float last_move_time;
|
|
|
|
int health;
|
|
int max_health;
|
|
int gib_health;
|
|
int deadflag;
|
|
bool show_hostile;
|
|
|
|
// Lazarus: health2 and mass2 are passed from jorg to makron health and mass
|
|
int health2;
|
|
int mass2;
|
|
|
|
float powerarmor_time;
|
|
|
|
char *map; // target_changelevel
|
|
|
|
int viewheight; // height above origin where eyesight is determined
|
|
int takedamage;
|
|
int dmg;
|
|
int radius_dmg;
|
|
float dmg_radius;
|
|
int sounds; //make this a spawntemp var?
|
|
int count;
|
|
|
|
edict_t *chain;
|
|
edict_t *enemy;
|
|
edict_t *oldenemy;
|
|
edict_t *activator;
|
|
edict_t *groundentity;
|
|
int groundentity_linkcount;
|
|
edict_t *teamchain;
|
|
edict_t *teammaster;
|
|
|
|
edict_t *mynoise; // can go in client only
|
|
edict_t *mynoise2;
|
|
|
|
int noise_index;
|
|
int noise_index2;
|
|
float volume;
|
|
float attenuation;
|
|
|
|
// timing variables
|
|
float wait;
|
|
float delay; // before firing targets
|
|
float random;
|
|
// Lazarus: laser timing
|
|
float starttime;
|
|
float endtime;
|
|
|
|
float teleport_time;
|
|
|
|
int watertype;
|
|
int waterlevel;
|
|
int old_watertype;
|
|
|
|
vec3_t move_origin;
|
|
vec3_t move_angles;
|
|
|
|
// move this to clientinfo?
|
|
int light_level;
|
|
|
|
int style; // also used as areaportal number
|
|
|
|
gitem_t *item; // for bonus items
|
|
|
|
// common data blocks
|
|
moveinfo_t moveinfo;
|
|
monsterinfo_t monsterinfo;
|
|
|
|
float goal_frame;
|
|
|
|
// various Lazarus additions follow:
|
|
|
|
//ed - for the sprite/model spawner
|
|
char *usermodel;
|
|
int startframe;
|
|
int framenumbers;
|
|
int solidstate;
|
|
// Lazarus: changed from rendereffect to renderfx and effects, and now uses
|
|
// real constants which can be combined.
|
|
// int rendereffect;
|
|
int renderfx;
|
|
int effects;
|
|
vec3_t bleft;
|
|
vec3_t tright;
|
|
|
|
// item identification
|
|
char *datafile;
|
|
|
|
// func_pushable
|
|
vec3_t oldvelocity; // Added for TREMOR to figure falling damage
|
|
vec3_t offset; // Added for TREMOR - offset from func_pushable to pusher
|
|
float density;
|
|
float bob; // bobbing in water amplitude
|
|
float duration;
|
|
int bobframe;
|
|
int bounce_me; // 0 for no bounce, 1 to bounce, 2 if velocity should not be clipped
|
|
// this is solely used by func_pushable for now
|
|
vec3_t origin_offset; // used to help locate brush models w/o origin brush
|
|
vec3_t org_mins,org_maxs;
|
|
vec3_t org_angles;
|
|
int org_movetype;
|
|
int axis;
|
|
|
|
// crane
|
|
bool busy;
|
|
bool attracted;
|
|
int crane_increment;
|
|
int crane_dir;
|
|
edict_t *crane_control;
|
|
edict_t *crane_onboard_control;
|
|
edict_t *crane_beam;
|
|
edict_t *crane_hoist;
|
|
edict_t *crane_hook;
|
|
edict_t *crane_cargo;
|
|
edict_t *crane_cable;
|
|
edict_t *crane_light;
|
|
vec_t crane_bonk;
|
|
|
|
edict_t *speaker; // moving speaker that eliminates the need
|
|
// for origin brushes with brush models
|
|
edict_t *vehicle; // generic drivable vehicle
|
|
char *idle_noise;
|
|
float radius;
|
|
vec3_t org_size; // Initial size of the vehicle bounding box,
|
|
|
|
// monster AI
|
|
char *dmgteam;
|
|
|
|
// spycam
|
|
edict_t *viewer;
|
|
|
|
// monster power armor
|
|
int powerarmor;
|
|
|
|
// MOVETYPE_PUSH rider angles
|
|
int turn_rider;
|
|
|
|
// selected brush models will move their origin to
|
|
// the origin of this entity:
|
|
char *move_to;
|
|
|
|
// newtargetname used ONLY by target_change and target_bmodel_spawner.
|
|
char *newtargetname;
|
|
|
|
// source of target_clone's model
|
|
char *source;
|
|
|
|
// if true, brush models will move directly to Move_Done
|
|
// at Move_Final rather than slowing down.
|
|
bool smooth_movement;
|
|
|
|
int in_mud;
|
|
|
|
int actor_sound_index[NUM_ACTOR_SOUNDS];
|
|
int actor_gunframe;
|
|
int actor_current_weapon; // Index into weapon[]
|
|
int actor_weapon[2];
|
|
int actor_model_index[2];
|
|
float actor_crouch_time;
|
|
bool actor_id_model;
|
|
vec3_t muzzle; // Offset from origin to gun muzzle
|
|
vec3_t muzzle2; // Offset to left weapon (must have SF | 128)
|
|
|
|
vec3_t color; // target_fade
|
|
float alpha;
|
|
float fadein;
|
|
float holdtime;
|
|
float fadeout;
|
|
|
|
int owner_id; // These are used ONLY for ents that
|
|
int id; // change maps via trigger_transition
|
|
int last_attacked_framenum; // Used to turn off chicken mode
|
|
|
|
// tracktrain
|
|
char *target2;
|
|
edict_t *prevpath;
|
|
|
|
// spline train
|
|
edict_t *from;
|
|
edict_t *to;
|
|
|
|
edict_t *next_grenade; // Used to build a list of active grenades
|
|
edict_t *prev_grenade;
|
|
|
|
// gib type - specifies folder where gib models are found.
|
|
int gib_type;
|
|
int blood_type;
|
|
|
|
int moreflags;
|
|
|
|
// actor muzzle flash
|
|
edict_t *flash;
|
|
};
|
|
|
|
#define LOOKAT_NOBRUSHMODELS 1
|
|
#define LOOKAT_NOWORLD 2
|
|
#define LOOKAT_MD2 (LOOKAT_NOBRUSHMODELS | LOOKAT_NOWORLD)
|
|
|
|
#define BeepBeep(ent) (gi.sound (ent, CHAN_AUTO, gi.soundindex ("misc/talk1.wav"), 1, ATTN_NORM, 0))
|
|
|
|
#define POWERUP_REPLACE_ENT 0
|
|
#define POWERUP_NEW_ENT 1
|
|
#define POWERUP_USE_ITEM 2
|
|
|
|
#define FLASHLIGHT_MOD
|
|
#define FLASHLIGHT_USE POWERUP_NEW_ENT
|
|
#define FLASHLIGHT_DRAIN 60
|
|
#define FLASHLIGHT_ITEM "Cells" |