#ifndef _Q3DEFS_H_ #define _Q3DEFS_H_ void Q3_SetKeyCatcher(int newcatcher); int Q3_GetKeyCatcher(void); int StringKey( const char *string, int length ); typedef struct { qboolean allsolid; // if true, plane is not valid qboolean startsolid; // if true, the initial point was in a solid area float fraction; // time completed, 1.0 = didn't hit anything vec3_t endpos; // final position cplane_t plane; // surface normal at impact, transformed to world space int surfaceFlags; // surface hit int contents; // contents on other side of surface hit int entityNum; // entity the contacted surface is a part of } q3trace_t; #define MAX_Q3_STATS 16 #define MAX_Q3_PERSISTANT 16 #define MAX_Q3_POWERUPS 16 #define MAX_Q3_WEAPONS 16 #define MAX_PS_EVENTS 2 typedef struct q3playerState_s { int commandTime; // cmd->serverTime of last executed command int pm_type; int bobCycle; // for view bobbing and footstep generation int pm_flags; // ducked, jump_held, etc int pm_time; vec3_t origin; vec3_t velocity; int weaponTime; int gravity; int speed; int delta_angles[3]; // add to command angles to get view direction // changed by spawns, rotating objects, and teleporters int groundEntityNum;// ENTITYNUM_NONE = in air int legsTimer; // don't change low priority animations until this runs out int legsAnim; // mask off ANIM_TOGGLEBIT int torsoTimer; // don't change low priority animations until this runs out int torsoAnim; // mask off ANIM_TOGGLEBIT int movementDir; // a number 0 to 7 that represents the reletive angle // of movement to the view angle (axial and diagonals) // when at rest, the value will remain unchanged // used to twist the legs during strafing vec3_t grapplePoint; // location of grapple to pull towards if PMF_GRAPPLE_PULL int eFlags; // copied to entityState_t->eFlags int eventSequence; // pmove generated events int events[MAX_PS_EVENTS]; int eventParms[MAX_PS_EVENTS]; int externalEvent; // events set on player from another source int externalEventParm; int externalEventTime; int clientNum; // ranges from 0 to MAX_CLIENTS-1 int weapon; // copied to entityState_t->weapon int weaponstate; vec3_t viewangles; // for fixed views int viewheight; // damage feedback int damageEvent; // when it changes, latch the other parms int damageYaw; int damagePitch; int damageCount; int stats[MAX_Q3_STATS]; int persistant[MAX_Q3_PERSISTANT]; // stats that aren't cleared on death int powerups[MAX_Q3_POWERUPS]; // level.time that the powerup runs out int ammo[MAX_Q3_WEAPONS]; int generic1; int loopSound; int jumppad_ent; // jumppad entity hit this frame // not communicated over the net at all int ping; // server to game info for scoreboard int pmove_framecount; // FIXME: don't transmit over the network int jumppad_frame; int entityEventSequence; } q3playerState_t; typedef enum { TR_STATIONARY, TR_INTERPOLATE, // non-parametric, but interpolate between snapshots TR_LINEAR, TR_LINEAR_STOP, TR_SINE, // value = base + sin( time / duration ) * delta TR_GRAVITY } trType_t; typedef struct { trType_t trType; int trTime; int trDuration; // if non 0, trTime + trDuration = stop time vec3_t trBase; vec3_t trDelta; // velocity, etc } trajectory_t; typedef struct q3entityState_s { int number; // entity index int eType; // entityType_t int eFlags; trajectory_t pos; // for calculating position trajectory_t apos; // for calculating angles int time; int time2; vec3_t origin; vec3_t origin2; vec3_t angles; vec3_t angles2; int otherEntityNum; // shotgun sources, etc int otherEntityNum2; int groundEntityNum; // -1 = in air int constantLight; // r + (g<<8) + (b<<16) + (intensity<<24) int loopSound; // constantly loop this sound int modelindex; int modelindex2; int clientNum; // 0 to (MAX_CLIENTS - 1), for players and corpses int frame; int solid; // for client side prediction, trap_linkentity sets this properly int event; // impulse events -- muzzle flashes, footsteps, etc int eventParm; // for players int powerups; // bit flags int weapon; // determines weapon and flash model, etc int legsAnim; // mask off ANIM_TOGGLEBIT int torsoAnim; // mask off ANIM_TOGGLEBIT int generic1; } q3entityState_t; #define MAX_MAP_AREA_BYTES 32 #define MAX_ENTITIES_IN_SNAPSHOT 256 //This struct is exposed to the cgame typedef struct snapshot_s { int snapFlags; // SNAPFLAG_RATE_DELAYED, etc int ping; int serverTime; // server time the message is valid for (in msec) qbyte areamask[MAX_MAP_AREA_BYTES]; // portalarea visibility bits q3playerState_t ps; // complete information about the current player at this time int numEntities; // all of the entities that need to be presented q3entityState_t entities[MAX_ENTITIES_IN_SNAPSHOT]; // at the time of this snapshot int numServerCommands; // text based server commands to execute when this int serverCommandSequence; // snapshot becomes current } snapshot_t; #define SNAPFLAG_NOT_ACTIVE 2 //this struct is used internally, using a ringbuffer for entities instead of worst-case memory usage. typedef struct clientSnap_s { qboolean valid; // cleared if delta parsing was invalid int snapFlags; int serverMessageNum; int serverCommandNum; int serverTime; // server time the message is valid for (in msec) int deltaFrame; qbyte areabits[MAX_MAP_AREA_BYTES]; // portalarea visibility bits q3playerState_t playerstate; int numEntities; int firstEntity; // non-masked index into cl.parseEntities[] array int ping; } clientSnap_t; // for ping calculation, rate estimation, usercmd delta'ing typedef struct frame_s { int userCmdNumber; int serverMessageNum; int clientTime; int serverTime; } q3frame_t; typedef struct { int serverTime; int angles[3]; int buttons; qbyte weapon; // weapon signed char forwardmove, rightmove, upmove; } q3usercmd_t; #define Q3CMD_BACKUP 64 //number of q3usercmd_ts that the client can queue before acks #define Q3CMD_MASK (Q3CMD_BACKUP-1) #define Q3MAX_PARSE_ENTITIES 2048 #define Q3PARSE_ENTITIES_MASK (Q3MAX_PARSE_ENTITIES-1) #define MAX_Q3_GAMESTATE_CHARS 16000 #define MAX_STRING_CHARS 1024 #define MAX_Q3_CONFIGSTRINGS 1024 #define Q3TEXTCMD_BACKUP 64 //number of reliable text commands that can be queued, must be power of two #define Q3TEXTCMD_MASK (Q3TEXTCMD_BACKUP-1) #define CFGSTR_SYSINFO 1 #define MODELINDEX_BITS 8 #define GENTITYNUM_BITS 10 #define MAX_GENTITIES (1<