diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_public.h | 4 | ||||
-rw-r--r-- | src/game/g_local.h | 2 | ||||
-rw-r--r-- | src/game/g_misc.c | 101 | ||||
-rw-r--r-- | src/game/g_spawn.c | 98 | ||||
-rw-r--r-- | src/game/g_utils.c | 6 | ||||
-rw-r--r-- | src/game/q_shared.h | 1135 |
6 files changed, 719 insertions, 627 deletions
diff --git a/src/game/bg_public.h b/src/game/bg_public.h index c76132de..2027a339 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -73,7 +73,8 @@ #define CS_MODELS 33 #define CS_SOUNDS (CS_MODELS+MAX_MODELS) #define CS_SHADERS (CS_SOUNDS+MAX_SOUNDS) -#define CS_PLAYERS (CS_SHADERS+MAX_SHADERS) +#define CS_PARTICLE_SYSTEMS (CS_SHADERS+MAX_SHADERS) +#define CS_PLAYERS (CS_PARTICLE_SYSTEMS+MAX_GAME_PARTICLE_SYSTEMS) #define CS_PRECACHES (CS_PLAYERS+MAX_CLIENTS) #define CS_LOCATIONS (CS_PRECACHES+MAX_CLIENTS) #define CS_PARTICLE_FILES (CS_LOCATIONS+MAX_LOCATIONS) @@ -1166,6 +1167,7 @@ typedef enum ET_CORPSE, ET_SPRITER, + ET_PARTICLE_SYSTEM, ET_ANIMMAPOBJ, ET_MODELDOOR, ET_LIGHTFLARE, diff --git a/src/game/g_local.h b/src/game/g_local.h index 9d78b932..dde380f5 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -585,6 +585,8 @@ void FinishSpawningBuildable( gentity_t *ent ); // // g_utils.c // +int G_ParticleSystemIndex( char *name ); +int G_ShaderIndex( char *name ); int G_ModelIndex( char *name ); int G_SoundIndex( char *name ); void G_TeamCommand( pTeam_t team, char *cmd ); diff --git a/src/game/g_misc.c b/src/game/g_misc.c index fa7d660f..3249fd0c 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -242,17 +242,26 @@ void SP_misc_portal_camera( gentity_t *ent ) ====================================================================== */ -//TA: use function for spriter +/* +=============== +SP_use_spriter + +Use function for spriter +=============== +*/ void SP_use_spriter( gentity_t *self, gentity_t *other, gentity_t *activator ) { //toggle EF_NODRAW - if( self->s.eFlags & EF_NODRAW ) - self->s.eFlags &= ~EF_NODRAW; - else - self->s.eFlags |= EF_NODRAW; + self->s.eFlags ^= EF_NODRAW; } -//TA: spawn function for spriter +/* +=============== +SP_spawn_spriter + +Spawn function for spriter +=============== +*/ void SP_misc_spriter( gentity_t *self ) { vec3_t accel; @@ -295,7 +304,53 @@ void SP_misc_spriter( gentity_t *self ) trap_LinkEntity( self ); } -//TA: use function for anim model +/* +=============== +SP_use_particle_system + +Use function for particle_system +=============== +*/ +void SP_use_particle_system( gentity_t *self, gentity_t *other, gentity_t *activator ) +{ + //toggle EF_NODRAW + self->s.eFlags ^= EF_NODRAW; +} + +/* +=============== +SP_spawn_particle_system + +Spawn function for particle system +=============== +*/ +void SP_misc_particle_system( gentity_t *self ) +{ + char *s; + + G_SetOrigin( self, self->s.origin ); + + G_SpawnString( "psName", "", &s ); + + G_Printf( S_COLOR_GREEN "psName: %s\n", s ); + //add the particle system to the client precache list + self->s.modelindex = G_ParticleSystemIndex( s ); + + if( self->spawnflags & 1 ) + self->s.eFlags |= EF_NODRAW; + + self->use = SP_use_particle_system; + self->s.eType = ET_PARTICLE_SYSTEM; + trap_LinkEntity( self ); +} + +/* +=============== +SP_use_anim_model + +Use function for anim model +=============== +*/ void SP_use_anim_model( gentity_t *self, gentity_t *other, gentity_t *activator ) { if( self->spawnflags & 1 ) @@ -318,7 +373,13 @@ void SP_use_anim_model( gentity_t *self, gentity_t *other, gentity_t *activator } } -//TA: spawn function for anim model +/* +=============== +SP_misc_anim_model + +Spawn function for anim model +=============== +*/ void SP_misc_anim_model( gentity_t *self ) { self->s.powerups = (int)self->animation[ 0 ]; @@ -338,13 +399,25 @@ void SP_misc_anim_model( gentity_t *self ) trap_LinkEntity( self ); } -//TA: use function for light flares +/* +=============== +SP_use_light_flare + +Use function for light flare +=============== +*/ void SP_use_light_flare( gentity_t *self, gentity_t *other, gentity_t *activator ) { self->s.eFlags ^= EF_NODRAW; } -//TA: finds an empty spot radius units from origin +/* +=============== +findEmptySpot + +Finds an empty spot radius units from origin +============== +*/ static void findEmptySpot( vec3_t origin, float radius, vec3_t spot ) { int i, j, k; @@ -383,7 +456,13 @@ static void findEmptySpot( vec3_t origin, float radius, vec3_t spot ) VectorAdd( origin, total, spot ); } -//TA: spawn function for light flares +/* +=============== +SP_misc_light_flare + +Spawn function for light flare +=============== +*/ void SP_misc_light_flare( gentity_t *self ) { self->s.eType = ET_LIGHTFLARE; diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index f5790024..00d618c3 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -208,6 +208,7 @@ void SP_shooter_grenade( gentity_t *ent ); //TA: void SP_misc_spriter( gentity_t *ent ); +void SP_misc_particle_system( gentity_t *ent ); void SP_misc_anim_model( gentity_t *ent ); void SP_misc_light_flare( gentity_t *ent ); @@ -215,67 +216,68 @@ spawn_t spawns[ ] = { // info entities don't do anything at all, but provide positional // information for things controlled by other processes - {"info_player_start", SP_info_player_start}, - {"info_player_deathmatch", SP_info_player_deathmatch}, - {"info_player_intermission", SP_info_player_intermission}, + { "info_player_start", SP_info_player_start }, + { "info_player_deathmatch", SP_info_player_deathmatch }, + { "info_player_intermission", SP_info_player_intermission }, //TA: extra bits - {"info_alien_intermission", SP_info_alien_intermission}, - {"info_human_intermission", SP_info_human_intermission}, + { "info_alien_intermission", SP_info_alien_intermission }, + { "info_human_intermission", SP_info_human_intermission }, - {"info_null", SP_info_null}, - {"info_notnull", SP_info_notnull}, // use target_position instead - - {"func_plat", SP_func_plat}, - {"func_button", SP_func_button}, - {"func_door", SP_func_door}, - {"func_door_rotating", SP_func_door_rotating}, //TA - {"func_door_model", SP_func_door_model}, //TA - {"func_static", SP_func_static}, - {"func_rotating", SP_func_rotating}, - {"func_bobbing", SP_func_bobbing}, - {"func_pendulum", SP_func_pendulum}, - {"func_train", SP_func_train}, - {"func_group", SP_info_null}, - {"func_timer", SP_func_timer}, // rename trigger_timer? + { "info_null", SP_info_null }, + { "info_notnull", SP_info_notnull }, // use target_position instead + + { "func_plat", SP_func_plat }, + { "func_button", SP_func_button }, + { "func_door", SP_func_door }, + { "func_door_rotating", SP_func_door_rotating }, //TA + { "func_door_model", SP_func_door_model }, //TA + { "func_static", SP_func_static }, + { "func_rotating", SP_func_rotating }, + { "func_bobbing", SP_func_bobbing }, + { "func_pendulum", SP_func_pendulum }, + { "func_train", SP_func_train }, + { "func_group", SP_info_null }, + { "func_timer", SP_func_timer }, // rename trigger_timer? // Triggers are brush objects that cause an effect when contacted // by a living player, usually involving firing targets. // While almost everything could be done with // a single trigger class and different targets, triggered effects // could not be client side predicted (push and teleport). - {"trigger_always", SP_trigger_always}, - {"trigger_multiple", SP_trigger_multiple}, - {"trigger_push", SP_trigger_push}, - {"trigger_teleport", SP_trigger_teleport}, - {"trigger_hurt", SP_trigger_hurt}, + { "trigger_always", SP_trigger_always }, + { "trigger_multiple", SP_trigger_multiple }, + { "trigger_push", SP_trigger_push }, + { "trigger_teleport", SP_trigger_teleport }, + { "trigger_hurt", SP_trigger_hurt }, // targets perform no action by themselves, but must be triggered // by another entity - {"target_delay", SP_target_delay}, - {"target_speaker", SP_target_speaker}, - {"target_print", SP_target_print}, - {"target_score", SP_target_score}, - {"target_teleporter", SP_target_teleporter}, - {"target_relay", SP_target_relay}, - {"target_kill", SP_target_kill}, - {"target_position", SP_target_position}, - {"target_location", SP_target_location}, - {"target_push", SP_target_push}, - - {"light", SP_light}, - {"path_corner", SP_path_corner}, - - {"misc_teleporter_dest", SP_misc_teleporter_dest}, - {"misc_model", SP_misc_model}, - {"misc_portal_surface", SP_misc_portal_surface}, - {"misc_portal_camera", SP_misc_portal_camera}, - - {"misc_spriter", SP_misc_spriter}, - {"misc_anim_model", SP_misc_anim_model}, - {"misc_light_flare", SP_misc_light_flare}, + { "target_delay", SP_target_delay }, + { "target_speaker", SP_target_speaker }, + { "target_print", SP_target_print }, + { "target_score", SP_target_score }, + { "target_teleporter", SP_target_teleporter }, + { "target_relay", SP_target_relay }, + { "target_kill", SP_target_kill }, + { "target_position", SP_target_position }, + { "target_location", SP_target_location }, + { "target_push", SP_target_push }, + + { "light", SP_light }, + { "path_corner", SP_path_corner }, + + { "misc_teleporter_dest", SP_misc_teleporter_dest }, + { "misc_model", SP_misc_model }, + { "misc_portal_surface", SP_misc_portal_surface }, + { "misc_portal_camera", SP_misc_portal_camera }, + + { "misc_spriter", SP_misc_spriter }, + { "misc_particle_system", SP_misc_particle_system }, + { "misc_anim_model", SP_misc_anim_model }, + { "misc_light_flare", SP_misc_light_flare }, - {0, 0} + { 0, 0 } }; /* diff --git a/src/game/g_utils.c b/src/game/g_utils.c index 50812aac..e38fb01a 100644 --- a/src/game/g_utils.c +++ b/src/game/g_utils.c @@ -114,6 +114,12 @@ int G_FindConfigstringIndex( char *name, int start, int max, qboolean create ) return i; } +//TA: added ParticleSystemIndex +int G_ParticleSystemIndex( char *name ) +{ + return G_FindConfigstringIndex( name, CS_PARTICLE_SYSTEMS, MAX_GAME_PARTICLE_SYSTEMS, qtrue ); +} + //TA: added ShaderIndex int G_ShaderIndex( char *name ) { diff --git a/src/game/q_shared.h b/src/game/q_shared.h index 34d2ffb7..64ef9f30 100644 --- a/src/game/q_shared.h +++ b/src/game/q_shared.h @@ -20,7 +20,7 @@ // q_shared.h -- included first by ALL program modules. // A user mod should never modify this file -#define Q3_VERSION "Q3 1.32" +#define Q3_VERSION "Q3 1.32" #define MAX_TEAMNAME 32 @@ -30,24 +30,24 @@ #pragma warning(disable : 4018) // signed/unsigned mismatch #pragma warning(disable : 4032) #pragma warning(disable : 4051) -#pragma warning(disable : 4057) // slightly different base types -#pragma warning(disable : 4100) // unreferenced formal parameter +#pragma warning(disable : 4057) // slightly different base types +#pragma warning(disable : 4100) // unreferenced formal parameter #pragma warning(disable : 4115) -#pragma warning(disable : 4125) // decimal digit terminates octal escape sequence -#pragma warning(disable : 4127) // conditional expression is constant +#pragma warning(disable : 4125) // decimal digit terminates octal escape sequence +#pragma warning(disable : 4127) // conditional expression is constant #pragma warning(disable : 4136) -#pragma warning(disable : 4152) // nonstandard extension, function/data pointer conversion in expression +#pragma warning(disable : 4152) // nonstandard extension, function/data pointer conversion in expression //#pragma warning(disable : 4201) //#pragma warning(disable : 4214) #pragma warning(disable : 4244) -#pragma warning(disable : 4142) // benign redefinition -//#pragma warning(disable : 4305) // truncation from const double to float -//#pragma warning(disable : 4310) // cast truncates constant value -//#pragma warning(disable: 4505) // unreferenced local function has been removed +#pragma warning(disable : 4142) // benign redefinition +//#pragma warning(disable : 4305) // truncation from const double to float +//#pragma warning(disable : 4310) // cast truncates constant value +//#pragma warning(disable: 4505) // unreferenced local function has been removed #pragma warning(disable : 4514) -#pragma warning(disable : 4702) // unreachable code -#pragma warning(disable : 4711) // selected for automatic inline expansion -#pragma warning(disable : 4220) // varargs matches remaining parameters +#pragma warning(disable : 4702) // unreachable code +#pragma warning(disable : 4711) // selected for automatic inline expansion +#pragma warning(disable : 4220) // varargs matches remaining parameters #endif /********************************************************************** @@ -93,46 +93,46 @@ // this is the define for determining if we have an asm version of a C function #if (defined _M_IX86 || defined __i386__) && !defined __sun__ && !defined __LCC__ -#define id386 1 +#define id386 1 #else -#define id386 0 +#define id386 0 #endif #if (defined(powerc) || defined(powerpc) || defined(ppc) || defined(__ppc) || defined(__ppc__)) && !defined(C_ONLY) -#define idppc 1 +#define idppc 1 #else -#define idppc 0 +#define idppc 0 #endif // for windows fastcall option -#define QDECL +#define QDECL short ShortSwap (short l); -int LongSwap (int l); -float FloatSwap (const float *f); +int LongSwap (int l); +float FloatSwap (const float *f); //======================= WIN32 DEFINES ================================= #ifdef WIN32 -#define MAC_STATIC +#define MAC_STATIC #undef QDECL -#define QDECL __cdecl +#define QDECL __cdecl // buildstring will be incorporated into the version string #ifdef NDEBUG #ifdef _M_IX86 -#define CPUSTRING "win-x86" +#define CPUSTRING "win-x86" #elif defined _M_ALPHA -#define CPUSTRING "win-AXP" +#define CPUSTRING "win-AXP" #endif #else #ifdef _M_IX86 -#define CPUSTRING "win-x86-debug" +#define CPUSTRING "win-x86-debug" #elif defined _M_ALPHA -#define CPUSTRING "win-AXP-debug" +#define CPUSTRING "win-AXP-debug" #endif #endif @@ -145,7 +145,7 @@ static ID_INLINE int BigLong(int l) { LongSwap(l); } static ID_INLINE float BigFloat(const float *l) { FloatSwap(l); } #define LittleFloat -#define PATH_SEP '\\' +#define PATH_SEP '\\' #endif @@ -160,14 +160,14 @@ static ID_INLINE float BigFloat(const float *l) { FloatSwap(l); } #define ID_INLINE inline #ifdef __ppc__ -#define CPUSTRING "MacOSX-ppc" +#define CPUSTRING "MacOSX-ppc" #elif defined __i386__ -#define CPUSTRING "MacOSX-i386" +#define CPUSTRING "MacOSX-i386" #else -#define CPUSTRING "MacOSX-other" +#define CPUSTRING "MacOSX-other" #endif -#define PATH_SEP '/' +#define PATH_SEP '/' #define __rlwimi(out, in, shift, maskBegin, maskEnd) asm("rlwimi %0,%1,%2,%3,%4" : "=r" (out) : "r" (in), "i" (shift), "i" (maskBegin), "i" (maskEnd)) #define __dcbt(addr, offset) asm("dcbt %0,%1" : : "b" (addr), "r" (offset)) @@ -208,12 +208,12 @@ static inline float LittleFloat (const float l) { return FloatSwap(&l); } #ifdef __MACOS__ #include <MacTypes.h> -#define MAC_STATIC +#define MAC_STATIC #define ID_INLINE inline -#define CPUSTRING "MacOS-PPC" +#define CPUSTRING "MacOS-PPC" -#define PATH_SEP ':' +#define PATH_SEP ':' void Sys_PumpEvents( void ); @@ -235,25 +235,25 @@ static inline float LittleFloat (const float l) { return FloatSwap(&l); } // bk001205 - from Makefile #define stricmp strcasecmp -#define MAC_STATIC // bk: FIXME +#define MAC_STATIC // bk: FIXME #define ID_INLINE inline #ifdef __i386__ -#define CPUSTRING "linux-i386" +#define CPUSTRING "linux-i386" #elif defined __axp__ -#define CPUSTRING "linux-alpha" +#define CPUSTRING "linux-alpha" #else -#define CPUSTRING "linux-other" +#define CPUSTRING "linux-other" #endif -#define PATH_SEP '/' +#define PATH_SEP '/' // bk001205 - try #ifdef Q3_STATIC -#define GAME_HARD_LINKED -#define CGAME_HARD_LINKED -#define UI_HARD_LINKED -#define BOTLIB_HARD_LINKED +#define GAME_HARD_LINKED +#define CGAME_HARD_LINKED +#define UI_HARD_LINKED +#define BOTLIB_HARD_LINKED #endif #if !idppc @@ -290,7 +290,7 @@ inline static float LittleFloat (const float *l) { return FloatSwap(l); } #define CPUSTRING "freebsd-other" #endif -#define PATH_SEP '/' +#define PATH_SEP '/' // bk010116 - omitted Q3STATIC (see Linux above), broken target @@ -314,127 +314,127 @@ static float LittleFloat (const float *l) { return FloatSwap(l); } //============================================================= -typedef unsigned char byte; +typedef unsigned char byte; -typedef enum {qfalse, qtrue} qboolean; +typedef enum {qfalse, qtrue} qboolean; -typedef int qhandle_t; -typedef int sfxHandle_t; -typedef int fileHandle_t; -typedef int clipHandle_t; +typedef int qhandle_t; +typedef int sfxHandle_t; +typedef int fileHandle_t; +typedef int clipHandle_t; #ifndef NULL #define NULL ((void *)0) #endif -#define MAX_QINT 0x7fffffff -#define MIN_QINT (-MAX_QINT-1) +#define MAX_QINT 0x7fffffff +#define MIN_QINT (-MAX_QINT-1) // angle indexes -#define PITCH 0 // up / down -#define YAW 1 // left / right -#define ROLL 2 // fall over +#define PITCH 0 // up / down +#define YAW 1 // left / right +#define ROLL 2 // fall over // the game guarantees that no string from the network will ever // exceed MAX_STRING_CHARS -#define MAX_STRING_CHARS 1024 // max length of a string passed to Cmd_TokenizeString -#define MAX_STRING_TOKENS 1024 // max tokens resulting from Cmd_TokenizeString -#define MAX_TOKEN_CHARS 1024 // max length of an individual token +#define MAX_STRING_CHARS 1024 // max length of a string passed to Cmd_TokenizeString +#define MAX_STRING_TOKENS 1024 // max tokens resulting from Cmd_TokenizeString +#define MAX_TOKEN_CHARS 1024 // max length of an individual token -#define MAX_INFO_STRING 1024 -#define MAX_INFO_KEY 1024 -#define MAX_INFO_VALUE 1024 +#define MAX_INFO_STRING 1024 +#define MAX_INFO_KEY 1024 +#define MAX_INFO_VALUE 1024 -#define BIG_INFO_STRING 8192 // used for system info key only -#define BIG_INFO_KEY 8192 -#define BIG_INFO_VALUE 8192 +#define BIG_INFO_STRING 8192 // used for system info key only +#define BIG_INFO_KEY 8192 +#define BIG_INFO_VALUE 8192 -#define MAX_QPATH 64 // max length of a quake game pathname +#define MAX_QPATH 64 // max length of a quake game pathname #ifdef PATH_MAX -#define MAX_OSPATH PATH_MAX +#define MAX_OSPATH PATH_MAX #else -#define MAX_OSPATH 256 // max length of a filesystem pathname +#define MAX_OSPATH 256 // max length of a filesystem pathname #endif -#define MAX_NAME_LENGTH 32 // max length of a client name +#define MAX_NAME_LENGTH 32 // max length of a client name -#define MAX_SAY_TEXT 150 +#define MAX_SAY_TEXT 150 // paramters for command buffer stuffing typedef enum { - EXEC_NOW, // don't return until completed, a VM should NEVER use this, - // because some commands might cause the VM to be unloaded... - EXEC_INSERT, // insert at current position, but don't run yet - EXEC_APPEND // add to end of the command buffer (normal case) + EXEC_NOW, // don't return until completed, a VM should NEVER use this, + // because some commands might cause the VM to be unloaded... + EXEC_INSERT, // insert at current position, but don't run yet + EXEC_APPEND // add to end of the command buffer (normal case) } cbufExec_t; // // these aren't needed by any of the VMs. put in another header? // -#define MAX_MAP_AREA_BYTES 32 // bit vector of area visibility +#define MAX_MAP_AREA_BYTES 32 // bit vector of area visibility // print levels from renderer (FIXME: set up for game / cgame?) typedef enum { - PRINT_ALL, - PRINT_DEVELOPER, // only print when "developer 1" - PRINT_WARNING, - PRINT_ERROR + PRINT_ALL, + PRINT_DEVELOPER, // only print when "developer 1" + PRINT_WARNING, + PRINT_ERROR } printParm_t; #ifdef ERR_FATAL -#undef ERR_FATAL // this is be defined in malloc.h +#undef ERR_FATAL // this is be defined in malloc.h #endif // parameters to the main Error routine typedef enum { - ERR_FATAL, // exit the entire game with a popup window - ERR_DROP, // print to console and disconnect from game - ERR_SERVERDISCONNECT, // don't kill server - ERR_DISCONNECT, // client disconnected from the server - ERR_NEED_CD // pop up the need-cd dialog + ERR_FATAL, // exit the entire game with a popup window + ERR_DROP, // print to console and disconnect from game + ERR_SERVERDISCONNECT, // don't kill server + ERR_DISCONNECT, // client disconnected from the server + ERR_NEED_CD // pop up the need-cd dialog } errorParm_t; // font rendering values used by ui and cgame -#define PROP_GAP_WIDTH 3 -#define PROP_SPACE_WIDTH 8 -#define PROP_HEIGHT 27 -#define PROP_SMALL_SIZE_SCALE 0.75 - -#define BLINK_DIVISOR 200 -#define PULSE_DIVISOR 75 - -#define UI_LEFT 0x00000000 // default -#define UI_CENTER 0x00000001 -#define UI_RIGHT 0x00000002 -#define UI_FORMATMASK 0x00000007 -#define UI_SMALLFONT 0x00000010 -#define UI_BIGFONT 0x00000020 // default -#define UI_GIANTFONT 0x00000040 -#define UI_DROPSHADOW 0x00000800 -#define UI_BLINK 0x00001000 -#define UI_INVERSE 0x00002000 -#define UI_PULSE 0x00004000 +#define PROP_GAP_WIDTH 3 +#define PROP_SPACE_WIDTH 8 +#define PROP_HEIGHT 27 +#define PROP_SMALL_SIZE_SCALE 0.75 + +#define BLINK_DIVISOR 200 +#define PULSE_DIVISOR 75 + +#define UI_LEFT 0x00000000 // default +#define UI_CENTER 0x00000001 +#define UI_RIGHT 0x00000002 +#define UI_FORMATMASK 0x00000007 +#define UI_SMALLFONT 0x00000010 +#define UI_BIGFONT 0x00000020 // default +#define UI_GIANTFONT 0x00000040 +#define UI_DROPSHADOW 0x00000800 +#define UI_BLINK 0x00001000 +#define UI_INVERSE 0x00002000 +#define UI_PULSE 0x00004000 #if defined(_DEBUG) && !defined(BSPC) - #define HUNK_DEBUG + #define HUNK_DEBUG #endif typedef enum { - h_high, - h_low, - h_dontcare + h_high, + h_low, + h_dontcare } ha_pref; #ifdef HUNK_DEBUG -#define Hunk_Alloc( size, preference ) Hunk_AllocDebug(size, preference, #size, __FILE__, __LINE__) +#define Hunk_Alloc( size, preference ) Hunk_AllocDebug(size, preference, #size, __FILE__, __LINE__) void *Hunk_AllocDebug( int size, ha_pref preference, char *label, char *file, int line ); #else void *Hunk_Alloc( int size, ha_pref preference ); @@ -456,11 +456,11 @@ void Com_Memcpy (void* dest, const void* src, const size_t count); #define Com_Memcpy memcpy #endif -#define CIN_system 1 -#define CIN_loop 2 -#define CIN_hold 4 -#define CIN_silent 8 -#define CIN_shader 16 +#define CIN_system 1 +#define CIN_loop 2 +#define CIN_hold 4 +#define CIN_silent 8 +#define CIN_shader 16 /* ============================================================== @@ -477,101 +477,101 @@ typedef vec_t vec3_t[3]; typedef vec_t vec4_t[4]; typedef vec_t vec5_t[5]; -typedef int fixed4_t; -typedef int fixed8_t; -typedef int fixed16_t; +typedef int fixed4_t; +typedef int fixed8_t; +typedef int fixed16_t; #ifndef M_PI -#define M_PI 3.14159265358979323846f // matches value in gcc v2 math.h +#define M_PI 3.14159265358979323846f // matches value in gcc v2 math.h #endif #ifndef M_SQRT2 #define M_SQRT2 1.414213562f #endif -#define NUMVERTEXNORMALS 162 -extern vec3_t bytedirs[NUMVERTEXNORMALS]; +#define NUMVERTEXNORMALS 162 +extern vec3_t bytedirs[NUMVERTEXNORMALS]; // all drawing is done to a 640*480 virtual screen size // and will be automatically scaled to the real resolution -#define SCREEN_WIDTH 640 -#define SCREEN_HEIGHT 480 - -#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH) -#define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2) - -#define SMALLCHAR_WIDTH 8 -#define SMALLCHAR_HEIGHT 16 - -#define BIGCHAR_WIDTH 16 -#define BIGCHAR_HEIGHT 16 - -#define GIANTCHAR_WIDTH 32 -#define GIANTCHAR_HEIGHT 48 - -extern vec4_t colorBlack; -extern vec4_t colorRed; -extern vec4_t colorGreen; -extern vec4_t colorBlue; -extern vec4_t colorYellow; -extern vec4_t colorMagenta; -extern vec4_t colorCyan; -extern vec4_t colorWhite; -extern vec4_t colorLtGrey; -extern vec4_t colorMdGrey; -extern vec4_t colorDkGrey; - -#define Q_COLOR_ESCAPE '^' -#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) != Q_COLOR_ESCAPE ) - -#define COLOR_BLACK '0' -#define COLOR_RED '1' -#define COLOR_GREEN '2' -#define COLOR_YELLOW '3' -#define COLOR_BLUE '4' -#define COLOR_CYAN '5' -#define COLOR_MAGENTA '6' -#define COLOR_WHITE '7' -#define ColorIndex(c) ( ( (c) - '0' ) & 7 ) - -#define S_COLOR_BLACK "^0" -#define S_COLOR_RED "^1" -#define S_COLOR_GREEN "^2" -#define S_COLOR_YELLOW "^3" -#define S_COLOR_BLUE "^4" -#define S_COLOR_CYAN "^5" -#define S_COLOR_MAGENTA "^6" -#define S_COLOR_WHITE "^7" - -extern vec4_t g_color_table[8]; - -#define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b -#define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a +#define SCREEN_WIDTH 640 +#define SCREEN_HEIGHT 480 + +#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH) +#define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2) + +#define SMALLCHAR_WIDTH 8 +#define SMALLCHAR_HEIGHT 16 + +#define BIGCHAR_WIDTH 16 +#define BIGCHAR_HEIGHT 16 + +#define GIANTCHAR_WIDTH 32 +#define GIANTCHAR_HEIGHT 48 + +extern vec4_t colorBlack; +extern vec4_t colorRed; +extern vec4_t colorGreen; +extern vec4_t colorBlue; +extern vec4_t colorYellow; +extern vec4_t colorMagenta; +extern vec4_t colorCyan; +extern vec4_t colorWhite; +extern vec4_t colorLtGrey; +extern vec4_t colorMdGrey; +extern vec4_t colorDkGrey; + +#define Q_COLOR_ESCAPE '^' +#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) != Q_COLOR_ESCAPE ) + +#define COLOR_BLACK '0' +#define COLOR_RED '1' +#define COLOR_GREEN '2' +#define COLOR_YELLOW '3' +#define COLOR_BLUE '4' +#define COLOR_CYAN '5' +#define COLOR_MAGENTA '6' +#define COLOR_WHITE '7' +#define ColorIndex(c) ( ( (c) - '0' ) & 7 ) + +#define S_COLOR_BLACK "^0" +#define S_COLOR_RED "^1" +#define S_COLOR_GREEN "^2" +#define S_COLOR_YELLOW "^3" +#define S_COLOR_BLUE "^4" +#define S_COLOR_CYAN "^5" +#define S_COLOR_MAGENTA "^6" +#define S_COLOR_WHITE "^7" + +extern vec4_t g_color_table[8]; + +#define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b +#define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a #define DEG2RAD( a ) ( ( (a) * M_PI ) / 180.0F ) #define RAD2DEG( a ) ( ( (a) * 180.0f ) / M_PI ) struct cplane_s; -extern vec3_t vec3_origin; -extern vec3_t axisDefault[3]; +extern vec3_t vec3_origin; +extern vec3_t axisDefault[3]; -#define nanmask (255<<23) +#define nanmask (255<<23) -#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) +#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) #if idppc static inline float Q_rsqrt( float number ) { - float x = 0.5f * number; + float x = 0.5f * number; float y; #ifdef __GNUC__ asm("frsqrte %0,%1" : "=f" (y) : "f" (number)); #else - y = __frsqrte( number ); + y = __frsqrte( number ); #endif - return y * (1.5f - (x * y * y)); - } + return y * (1.5f - (x * y * y)); + } #ifdef __GNUC__ static inline float Q_fabs(float x) { @@ -586,7 +586,7 @@ static inline float Q_fabs(float x) { #else float Q_fabs( float f ); -float Q_rsqrt( float f ); // reciprocal square root +float Q_rsqrt( float f ); // reciprocal square root #endif #define SQRTFAST( x ) ( (x) * Q_rsqrt( x ) ) @@ -598,23 +598,23 @@ signed short ClampShort( int i ); int DirToByte( vec3_t dir ); void ByteToDir( int b, vec3_t dir ); -#if 1 +#if 1 -#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) -#define VectorSubtract(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2]) -#define VectorAdd(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2]) -#define VectorCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2]) -#define VectorScale(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s)) -#define VectorMA(v, s, b, o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s),(o)[2]=(v)[2]+(b)[2]*(s)) +#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) +#define VectorSubtract(a,b,c) ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2]) +#define VectorAdd(a,b,c) ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2]) +#define VectorCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2]) +#define VectorScale(v, s, o) ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s)) +#define VectorMA(v, s, b, o) ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s),(o)[2]=(v)[2]+(b)[2]*(s)) #else -#define DotProduct(x,y) _DotProduct(x,y) -#define VectorSubtract(a,b,c) _VectorSubtract(a,b,c) -#define VectorAdd(a,b,c) _VectorAdd(a,b,c) -#define VectorCopy(a,b) _VectorCopy(a,b) -#define VectorScale(v, s, o) _VectorScale(v,s,o) -#define VectorMA(v, s, b, o) _VectorMA(v,s,b,o) +#define DotProduct(x,y) _DotProduct(x,y) +#define VectorSubtract(a,b,c) _VectorSubtract(a,b,c) +#define VectorAdd(a,b,c) _VectorAdd(a,b,c) +#define VectorCopy(a,b) _VectorCopy(a,b) +#define VectorScale(v, s, o) _VectorScale(v,s,o) +#define VectorMA(v, s, b, o) _VectorMA(v,s,b,o) #endif @@ -623,19 +623,19 @@ void ByteToDir( int b, vec3_t dir ); #undef VectorCopy // this is a little hack to get more efficient copies in our interpreter typedef struct { - float v[3]; + float v[3]; } vec3struct_t; -#define VectorCopy(a,b) *(vec3struct_t *)b=*(vec3struct_t *)a +#define VectorCopy(a,b) *(vec3struct_t *)b=*(vec3struct_t *)a #define ID_INLINE static #endif #endif -#define VectorClear(a) ((a)[0]=(a)[1]=(a)[2]=0) -#define VectorNegate(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2]) -#define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z)) -#define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3]) +#define VectorClear(a) ((a)[0]=(a)[1]=(a)[2]=0) +#define VectorNegate(a,b) ((b)[0]=-(a)[0],(b)[1]=-(a)[1],(b)[2]=-(a)[2]) +#define VectorSet(v, x, y, z) ((v)[0]=(x), (v)[1]=(y), (v)[2]=(z)) +#define Vector4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3]) -#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));} +#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));} // just in case you do't want to use the macros vec_t _DotProduct( const vec3_t v1, const vec3_t v2 ); void _VectorSubtract( const vec3_t veca, const vec3_t vecb, vec3_t out ); @@ -655,57 +655,57 @@ void AddPointToBounds( const vec3_t v, vec3_t mins, vec3_t maxs ); #ifndef __LCC__ static ID_INLINE int VectorCompare( const vec3_t v1, const vec3_t v2 ) { - if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) { - return 0; - } - return 1; + if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) { + return 0; + } + return 1; } static ID_INLINE vec_t VectorLength( const vec3_t v ) { - return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); + return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); } static ID_INLINE vec_t VectorLengthSquared( const vec3_t v ) { - return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); + return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); } static ID_INLINE vec_t Distance( const vec3_t p1, const vec3_t p2 ) { - vec3_t v; + vec3_t v; - VectorSubtract (p2, p1, v); - return VectorLength( v ); + VectorSubtract (p2, p1, v); + return VectorLength( v ); } static ID_INLINE vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) { - vec3_t v; + vec3_t v; - VectorSubtract (p2, p1, v); - return v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; + VectorSubtract (p2, p1, v); + return v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; } // fast vector normalize routine that does not check to make sure // that length != 0, nor does it return length, uses rsqrt approximation static ID_INLINE void VectorNormalizeFast( vec3_t v ) { - float ilength; + float ilength; - ilength = Q_rsqrt( DotProduct( v, v ) ); + ilength = Q_rsqrt( DotProduct( v, v ) ); - v[0] *= ilength; - v[1] *= ilength; - v[2] *= ilength; + v[0] *= ilength; + v[1] *= ilength; + v[2] *= ilength; } static ID_INLINE void VectorInverse( vec3_t v ){ - v[0] = -v[0]; - v[1] = -v[1]; - v[2] = -v[2]; + v[0] = -v[0]; + v[1] = -v[1]; + v[2] = -v[2]; } static ID_INLINE void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ) { - cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; - cross[1] = v1[2]*v2[0] - v1[0]*v2[2]; - cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; + cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; + cross[1] = v1[2]*v2[0] - v1[0]*v2[2]; + cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; } #else @@ -727,7 +727,7 @@ void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ); #endif -vec_t VectorNormalize (vec3_t v); // returns vector length +vec_t VectorNormalize (vec3_t v); // returns vector length vec_t VectorNormalize2( const vec3_t v, vec3_t out ); void Vector4Scale( const vec4_t in, vec_t scale, vec4_t out ); void VectorRotate( vec3_t in, vec3_t matrix[3], vec3_t out ); @@ -735,12 +735,12 @@ int Q_log2(int val); float Q_acos(float c); -int Q_rand( int *seed ); -float Q_random( int *seed ); -float Q_crandom( int *seed ); +int Q_rand( int *seed ); +float Q_random( int *seed ); +float Q_crandom( int *seed ); -#define random() ((rand () & 0x7fff) / ((float)0x7fff)) -#define crandom() (2.0 * (random() - 0.5)) +#define random() ((rand () & 0x7fff) / ((float)0x7fff)) +#define crandom() (2.0 * (random() - 0.5)) void vectoangles( const vec3_t value1, vec3_t angles); void AnglesToAxis( const vec3_t angles, vec3_t axis[3] ); @@ -751,10 +751,10 @@ void AxisCopy( vec3_t in[3], vec3_t out[3] ); void SetPlaneSignbits( struct cplane_s *out ); int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *plane); -float AngleMod(float a); -float LerpAngle (float from, float to, float frac); -float AngleSubtract( float a1, float a2 ); -void AnglesSubtract( vec3_t v1, vec3_t v2, vec3_t v3 ); +float AngleMod(float a); +float LerpAngle (float from, float to, float frac); +float AngleSubtract( float a1, float a2 ); +void AnglesSubtract( vec3_t v1, vec3_t v2, vec3_t v3 ); float AngleNormalize360 ( float angle ); float AngleNormalize180 ( float angle ); @@ -767,7 +767,7 @@ void RotateAroundDirection( vec3_t axis[3], float yaw ); void MakeNormalVectors( const vec3_t forward, vec3_t right, vec3_t up ); // perpendicular vector could be replaced by this -//int PlaneTypeForNormal (vec3_t normal); +//int PlaneTypeForNormal (vec3_t normal); void MatrixMultiply(float in1[3][3], float in2[3][3], float out[3][3]); void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); @@ -778,42 +778,42 @@ void PerpendicularVector( vec3_t dst, const vec3_t src ); float Com_Clamp( float min, float max, float value ); -char *COM_SkipPath( char *pathname ); -void COM_StripExtension( const char *in, char *out ); -void COM_DefaultExtension( char *path, int maxSize, const char *extension ); +char *COM_SkipPath( char *pathname ); +void COM_StripExtension( const char *in, char *out ); +void COM_DefaultExtension( char *path, int maxSize, const char *extension ); -void COM_BeginParseSession( const char *name ); -int COM_GetCurrentParseLine( void ); -char *COM_Parse( char **data_p ); -char *COM_ParseExt( char **data_p, qboolean allowLineBreak ); -int COM_Compress( char *data_p ); -void COM_ParseError( char *format, ... ); -void COM_ParseWarning( char *format, ... ); -//int COM_ParseInfos( char *buf, int max, char infos[][MAX_INFO_STRING] ); +void COM_BeginParseSession( const char *name ); +int COM_GetCurrentParseLine( void ); +char *COM_Parse( char **data_p ); +char *COM_ParseExt( char **data_p, qboolean allowLineBreak ); +int COM_Compress( char *data_p ); +void COM_ParseError( char *format, ... ); +void COM_ParseWarning( char *format, ... ); +//int COM_ParseInfos( char *buf, int max, char infos[][MAX_INFO_STRING] ); -#define MAX_TOKENLENGTH 1024 +#define MAX_TOKENLENGTH 1024 #ifndef TT_STRING //token types -#define TT_STRING 1 // string -#define TT_LITERAL 2 // literal -#define TT_NUMBER 3 // number -#define TT_NAME 4 // name -#define TT_PUNCTUATION 5 // punctuation +#define TT_STRING 1 // string +#define TT_LITERAL 2 // literal +#define TT_NUMBER 3 // number +#define TT_NAME 4 // name +#define TT_PUNCTUATION 5 // punctuation #endif typedef struct pc_token_s { - int type; - int subtype; - int intvalue; - float floatvalue; - char string[MAX_TOKENLENGTH]; + int type; + int subtype; + int intvalue; + float floatvalue; + char string[MAX_TOKENLENGTH]; } pc_token_t; // data is an in/out parm, returns a parsed out token -void COM_MatchToken( char**buf_p, char *match ); +void COM_MatchToken( char**buf_p, char *match ); void SkipBracedSection (char **program); void SkipRestOfLine ( char **data ); @@ -822,21 +822,21 @@ void Parse1DMatrix (char **buf_p, int x, float *m); void Parse2DMatrix (char **buf_p, int y, int x, float *m); void Parse3DMatrix (char **buf_p, int z, int y, int x, float *m); -void QDECL Com_sprintf (char *dest, int size, const char *fmt, ...); +void QDECL Com_sprintf (char *dest, int size, const char *fmt, ...); // mode parm for FS_FOpenFile typedef enum { - FS_READ, - FS_WRITE, - FS_APPEND, - FS_APPEND_SYNC + FS_READ, + FS_WRITE, + FS_APPEND, + FS_APPEND_SYNC } fsMode_t; typedef enum { - FS_SEEK_CUR, - FS_SEEK_END, - FS_SEEK_SET + FS_SEEK_CUR, + FS_SEEK_END, + FS_SEEK_SET } fsOrigin_t; //============================================= @@ -847,16 +847,16 @@ int Q_isupper( int c ); int Q_isalpha( int c ); // portable case insensitive compare -int Q_stricmp (const char *s1, const char *s2); -int Q_strncmp (const char *s1, const char *s2, int n); -int Q_stricmpn (const char *s1, const char *s2, int n); -char *Q_strlwr( char *s1 ); -char *Q_strupr( char *s1 ); -char *Q_strrchr( const char* string, int c ); +int Q_stricmp (const char *s1, const char *s2); +int Q_strncmp (const char *s1, const char *s2, int n); +int Q_stricmpn (const char *s1, const char *s2, int n); +char *Q_strlwr( char *s1 ); +char *Q_strupr( char *s1 ); +char *Q_strrchr( const char* string, int c ); // buffer size safe library replacements -void Q_strncpyz( char *dest, const char *src, int destsize ); -void Q_strcat( char *dest, int size, const char *src ); +void Q_strncpyz( char *dest, const char *src, int destsize ); +void Q_strcat( char *dest, int size, const char *src ); // strlen that discounts Quake color sequences int Q_PrintStrlen( const char *string ); @@ -869,30 +869,30 @@ char *Q_CleanStr( char *string ); // implemented as a struct for qvm compatibility typedef struct { - byte b0; - byte b1; - byte b2; - byte b3; - byte b4; - byte b5; - byte b6; - byte b7; + byte b0; + byte b1; + byte b2; + byte b3; + byte b4; + byte b5; + byte b6; + byte b7; } qint64; //============================================= /* -short BigShort(short l); -short LittleShort(short l); -int BigLong (int l); -int LittleLong (int l); +short BigShort(short l); +short LittleShort(short l); +int BigLong (int l); +int LittleLong (int l); qint64 BigLong64 (qint64 l); qint64 LittleLong64 (qint64 l); -float BigFloat (const float *l); -float LittleFloat (const float *l); +float BigFloat (const float *l); +float LittleFloat (const float *l); -void Swap_Init (void); +void Swap_Init (void); */ -char * QDECL va(char *format, ...); +char * QDECL va(char *format, ...); //============================================= @@ -908,8 +908,8 @@ qboolean Info_Validate( const char *s ); void Info_NextPair( const char **s, char *key, char *value ); // this is only here so the functions in q_shared.c and bg_*.c can link -void QDECL Com_Error( int level, const char *error, ... ); -void QDECL Com_Printf( const char *msg, ... ); +void QDECL Com_Error( int level, const char *error, ... ); +void QDECL Com_Printf( const char *msg, ... ); /* @@ -923,52 +923,52 @@ default values. ========================================================== */ -#define CVAR_ARCHIVE 1 // set to cause it to be saved to vars.rc - // used for system variables, not for player - // specific configurations -#define CVAR_USERINFO 2 // sent to server on connect or change -#define CVAR_SERVERINFO 4 // sent in response to front end requests -#define CVAR_SYSTEMINFO 8 // these cvars will be duplicated on all clients -#define CVAR_INIT 16 // don't allow change from console at all, - // but can be set from the command line -#define CVAR_LATCH 32 // will only change when C code next does - // a Cvar_Get(), so it can't be changed - // without proper initialization. modified - // will be set, even though the value hasn't - // changed yet -#define CVAR_ROM 64 // display only, cannot be set by user at all -#define CVAR_USER_CREATED 128 // created by a set command -#define CVAR_TEMP 256 // can be set even when cheats are disabled, but is not archived -#define CVAR_CHEAT 512 // can not be changed if cheats are disabled -#define CVAR_NORESTART 1024 // do not clear when a cvar_restart is issued +#define CVAR_ARCHIVE 1 // set to cause it to be saved to vars.rc + // used for system variables, not for player + // specific configurations +#define CVAR_USERINFO 2 // sent to server on connect or change +#define CVAR_SERVERINFO 4 // sent in response to front end requests +#define CVAR_SYSTEMINFO 8 // these cvars will be duplicated on all clients +#define CVAR_INIT 16 // don't allow change from console at all, + // but can be set from the command line +#define CVAR_LATCH 32 // will only change when C code next does + // a Cvar_Get(), so it can't be changed + // without proper initialization. modified + // will be set, even though the value hasn't + // changed yet +#define CVAR_ROM 64 // display only, cannot be set by user at all +#define CVAR_USER_CREATED 128 // created by a set command +#define CVAR_TEMP 256 // can be set even when cheats are disabled, but is not archived +#define CVAR_CHEAT 512 // can not be changed if cheats are disabled +#define CVAR_NORESTART 1024 // do not clear when a cvar_restart is issued // nothing outside the Cvar_*() functions should modify these fields! typedef struct cvar_s { - char *name; - char *string; - char *resetString; // cvar_restart will reset to this value - char *latchedString; // for CVAR_LATCH vars - int flags; - qboolean modified; // set each time the cvar is changed - int modificationCount; // incremented each time the cvar is changed - float value; // atof( string ) - int integer; // atoi( string ) - struct cvar_s *next; - struct cvar_s *hashNext; + char *name; + char *string; + char *resetString; // cvar_restart will reset to this value + char *latchedString; // for CVAR_LATCH vars + int flags; + qboolean modified; // set each time the cvar is changed + int modificationCount; // incremented each time the cvar is changed + float value; // atof( string ) + int integer; // atoi( string ) + struct cvar_s *next; + struct cvar_s *hashNext; } cvar_t; -#define MAX_CVAR_VALUE_STRING 256 +#define MAX_CVAR_VALUE_STRING 256 -typedef int cvarHandle_t; +typedef int cvarHandle_t; // the modules that run in the virtual machine can't access the cvar_t directly, // so they must ask for structured updates typedef struct { - cvarHandle_t handle; - int modificationCount; - float value; - int integer; - char string[MAX_CVAR_VALUE_STRING]; + cvarHandle_t handle; + int modificationCount; + float value; + int integer; + char string[MAX_CVAR_VALUE_STRING]; } vmCvar_t; /* @@ -979,14 +979,14 @@ COLLISION DETECTION ============================================================== */ -#include "surfaceflags.h" // shared with the q3map utility +#include "surfaceflags.h" // shared with the q3map utility // plane types are used to speed some tests // 0-2 are axial planes -#define PLANE_X 0 -#define PLANE_Y 1 -#define PLANE_Z 2 -#define PLANE_NON_AXIAL 3 +#define PLANE_X 0 +#define PLANE_Y 1 +#define PLANE_Z 2 +#define PLANE_NON_AXIAL 3 /* @@ -1000,24 +1000,24 @@ PlaneTypeForNormal // plane_t structure // !!! if this is changed, it must be changed in asm code too !!! typedef struct cplane_s { - vec3_t normal; - float dist; - byte type; // for fast side tests: 0,1,2 = axial, 3 = nonaxial - byte signbits; // signx + (signy<<1) + (signz<<2), used as lookup during collision - byte pad[2]; + vec3_t normal; + float dist; + byte type; // for fast side tests: 0,1,2 = axial, 3 = nonaxial + byte signbits; // signx + (signy<<1) + (signz<<2), used as lookup during collision + byte pad[2]; } cplane_t; // a trace is returned when a box is swept through the world 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 sirface is a part of + 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 sirface is a part of } trace_t; // trace->entityNum can also be 0 to (MAX_GENTITIES-1) @@ -1026,15 +1026,15 @@ typedef struct { // markfragments are returned by CM_MarkFragments() typedef struct { - int firstPoint; - int numPoints; + int firstPoint; + int numPoints; } markFragment_t; typedef struct { - vec3_t origin; - vec3_t axis[3]; + vec3_t origin; + vec3_t axis[3]; } orientation_t; //===================================================================== @@ -1042,24 +1042,24 @@ typedef struct { // in order from highest priority to lowest // if none of the catchers are active, bound key strings will be executed -#define KEYCATCH_CONSOLE 0x0001 -#define KEYCATCH_UI 0x0002 -#define KEYCATCH_MESSAGE 0x0004 -#define KEYCATCH_CGAME 0x0008 +#define KEYCATCH_CONSOLE 0x0001 +#define KEYCATCH_UI 0x0002 +#define KEYCATCH_MESSAGE 0x0004 +#define KEYCATCH_CGAME 0x0008 // sound channels // channel 0 never willingly overrides // other channels will allways override a playing sound on that channel typedef enum { - CHAN_AUTO, - CHAN_LOCAL, // menu sounds, etc - CHAN_WEAPON, - CHAN_VOICE, - CHAN_ITEM, - CHAN_BODY, - CHAN_LOCAL_SOUND, // chat messages, etc - CHAN_ANNOUNCER // announcer voices, etc + CHAN_AUTO, + CHAN_LOCAL, // menu sounds, etc + CHAN_WEAPON, + CHAN_VOICE, + CHAN_ITEM, + CHAN_BODY, + CHAN_LOCAL_SOUND, // chat messages, etc + CHAN_ANNOUNCER // announcer voices, etc } soundChannel_t; @@ -1071,63 +1071,64 @@ typedef enum { ======================================================================== */ -#define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535) -#define SHORT2ANGLE(x) ((x)*(360.0/65536)) +#define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535) +#define SHORT2ANGLE(x) ((x)*(360.0/65536)) -#define SNAPFLAG_RATE_DELAYED 1 -#define SNAPFLAG_NOT_ACTIVE 2 // snapshot used during connection and for zombies -#define SNAPFLAG_SERVERCOUNT 4 // toggled every map_restart so transitions can be detected +#define SNAPFLAG_RATE_DELAYED 1 +#define SNAPFLAG_NOT_ACTIVE 2 // snapshot used during connection and for zombies +#define SNAPFLAG_SERVERCOUNT 4 // toggled every map_restart so transitions can be detected // // per-level limits // -#define MAX_CLIENTS 64 // absolute limit -#define MAX_LOCATIONS 64 +#define MAX_CLIENTS 64 // absolute limit +#define MAX_LOCATIONS 64 -#define GENTITYNUM_BITS 10 // don't need to send any more -#define MAX_GENTITIES (1<<GENTITYNUM_BITS) +#define GENTITYNUM_BITS 10 // don't need to send any more +#define MAX_GENTITIES (1<<GENTITYNUM_BITS) // entitynums are communicated with GENTITY_BITS, so any reserved // values thatare going to be communcated over the net need to // also be in this range -#define ENTITYNUM_NONE (MAX_GENTITIES-1) -#define ENTITYNUM_WORLD (MAX_GENTITIES-2) -#define ENTITYNUM_MAX_NORMAL (MAX_GENTITIES-2) +#define ENTITYNUM_NONE (MAX_GENTITIES-1) +#define ENTITYNUM_WORLD (MAX_GENTITIES-2) +#define ENTITYNUM_MAX_NORMAL (MAX_GENTITIES-2) -#define MAX_MODELS 256 // these are sent over the net as 8 bits -#define MAX_SOUNDS 256 // so they cannot be blindly increased -#define MAX_SHADERS 128 //TA: should be in bg_public.h -#define MAX_PARTICLE_FILES 128 +#define MAX_MODELS 256 // these are sent over the net as 8 bits +#define MAX_SOUNDS 256 // so they cannot be blindly increased +#define MAX_SHADERS 64 //TA: should be in bg_public.h +#define MAX_GAME_PARTICLE_SYSTEMS 64 //TA: should be in bg_public.h +#define MAX_PARTICLE_FILES 128 -#define MAX_CONFIGSTRINGS 1024 +#define MAX_CONFIGSTRINGS 1024 // these are the only configstrings that the system reserves, all the // other ones are strictly for servergame to clientgame communication -#define CS_SERVERINFO 0 // an info string with all the serverinfo cvars -#define CS_SYSTEMINFO 1 // an info string for server system to client system configuration (timescale, etc) +#define CS_SERVERINFO 0 // an info string with all the serverinfo cvars +#define CS_SYSTEMINFO 1 // an info string for server system to client system configuration (timescale, etc) -#define RESERVED_CONFIGSTRINGS 2 // game can't modify below this, only the system can +#define RESERVED_CONFIGSTRINGS 2 // game can't modify below this, only the system can -#define MAX_GAMESTATE_CHARS 16000 +#define MAX_GAMESTATE_CHARS 16000 typedef struct { - int stringOffsets[MAX_CONFIGSTRINGS]; - char stringData[MAX_GAMESTATE_CHARS]; - int dataCount; + int stringOffsets[MAX_CONFIGSTRINGS]; + char stringData[MAX_GAMESTATE_CHARS]; + int dataCount; } gameState_t; //========================================================= // bit field limits -#define MAX_STATS 16 -#define MAX_PERSISTANT 16 -#define MAX_POWERUPS 16 -#define MAX_WEAPONS 16 +#define MAX_STATS 16 +#define MAX_PERSISTANT 16 +#define MAX_POWERUPS 16 +#define MAX_WEAPONS 16 -#define MAX_PS_EVENTS 2 +#define MAX_PS_EVENTS 2 -#define PS_PMOVEFRAMECOUNTBITS 6 +#define PS_PMOVEFRAMECOUNTBITS 6 // playerState_t is the information needed by both the client and server // to predict player motion and actions @@ -1140,72 +1141,72 @@ typedef struct { // so if a playerState_t is transmitted, the entityState_t can be fully derived // from it. typedef struct playerState_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_STATS]; - int persistant[MAX_PERSISTANT]; // stats that aren't cleared on death - int powerups[MAX_POWERUPS]; // level.time that the powerup runs out - int ammo[MAX_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; + 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_STATS]; + int persistant[MAX_PERSISTANT]; // stats that aren't cleared on death + int powerups[MAX_POWERUPS]; // level.time that the powerup runs out + int ammo[MAX_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; } playerState_t; @@ -1216,58 +1217,58 @@ typedef struct playerState_s { // usercmd_t->button bits, many of which are generated by the client system, // so they aren't game/cgame only definitions // -#define BUTTON_ATTACK 1 -#define BUTTON_TALK 2 // displays talk balloon and disables actions -#define BUTTON_USE_HOLDABLE 4 -#define BUTTON_GESTURE 8 -#define BUTTON_WALKING 16 // walking can't just be infered from MOVE_RUN - // because a key pressed late in the frame will - // only generate a small move value for that frame - // walking will use different animations and - // won't generate footsteps +#define BUTTON_ATTACK 1 +#define BUTTON_TALK 2 // displays talk balloon and disables actions +#define BUTTON_USE_HOLDABLE 4 +#define BUTTON_GESTURE 8 +#define BUTTON_WALKING 16 // walking can't just be infered from MOVE_RUN + // because a key pressed late in the frame will + // only generate a small move value for that frame + // walking will use different animations and + // won't generate footsteps #define BUTTON_ATTACK2 32 //TA: should be safe to change from BUTTON_AFFIRMATIVE -#define BUTTON_NEGATIVE 64 +#define BUTTON_NEGATIVE 64 -#define BUTTON_GETFLAG 128 -#define BUTTON_GUARDBASE 256 -#define BUTTON_PATROL 512 -#define BUTTON_FOLLOWME 1024 +#define BUTTON_GETFLAG 128 +#define BUTTON_GUARDBASE 256 +#define BUTTON_PATROL 512 +#define BUTTON_FOLLOWME 1024 -#define BUTTON_ANY 2048 // any key whatsoever +#define BUTTON_ANY 2048 // any key whatsoever -#define MOVE_RUN 120 // if forwardmove or rightmove are >= MOVE_RUN, - // then BUTTON_WALKING should be set +#define MOVE_RUN 120 // if forwardmove or rightmove are >= MOVE_RUN, + // then BUTTON_WALKING should be set // usercmd_t is sent to the server each client frame typedef struct usercmd_s { - int serverTime; - int angles[3]; - int buttons; - byte weapon; // weapon - signed char forwardmove, rightmove, upmove; + int serverTime; + int angles[3]; + int buttons; + byte weapon; // weapon + signed char forwardmove, rightmove, upmove; } usercmd_t; //=================================================================== // if entityState->solid == SOLID_BMODEL, modelindex is an inline model number -#define SOLID_BMODEL 0xffffff +#define SOLID_BMODEL 0xffffff 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, - TR_BUOYANCY //TA: what the hell is this doing in here anyway? + 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, + TR_BUOYANCY //TA: what the hell is this doing in here anyway? } 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 + trType_t trType; + int trTime; + int trDuration; // if non 0, trTime + trDuration = stop time + vec3_t trBase; + vec3_t trDelta; // velocity, etc } trajectory_t; // entityState_t is the information conveyed from the server @@ -1278,60 +1279,60 @@ typedef struct { // the structure size is fairly large typedef struct entityState_s { - int number; // entity index - int eType; // entityType_t - int eFlags; + int number; // entity index + int eType; // entityType_t + int eFlags; - trajectory_t pos; // for calculating position - trajectory_t apos; // for calculating angles + trajectory_t pos; // for calculating position + trajectory_t apos; // for calculating angles - int time; - int time2; + int time; + int time2; - vec3_t origin; - vec3_t origin2; + vec3_t origin; + vec3_t origin2; - vec3_t angles; - vec3_t angles2; + vec3_t angles; + vec3_t angles2; - int otherEntityNum; // shotgun sources, etc - int otherEntityNum2; + int otherEntityNum; // shotgun sources, etc + int otherEntityNum2; - int groundEntityNum; // -1 = in air + int groundEntityNum; // -1 = in air - int constantLight; // r + (g<<8) + (b<<16) + (intensity<<24) - int loopSound; // constantly loop this sound + 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 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 solid; // for client side prediction, trap_linkentity sets this properly - int event; // impulse events -- muzzle flashes, footsteps, etc - int eventParm; + 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 + // 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; + int generic1; } entityState_t; typedef enum { - CA_UNINITIALIZED, - CA_DISCONNECTED, // not talking to a server - CA_AUTHORIZING, // not used any more, was checking cd key - CA_CONNECTING, // sending request packets to the server - CA_CHALLENGING, // sending challenge packets to the server - CA_CONNECTED, // netchan_t established, getting gamestate - CA_LOADING, // only during cgame initialization, never during main loop - CA_PRIMED, // got gamestate, waiting for first frame - CA_ACTIVE, // game views should be displayed - CA_CINEMATIC // playing a cinematic or a static pic, not connected to a server + CA_UNINITIALIZED, + CA_DISCONNECTED, // not talking to a server + CA_AUTHORIZING, // not used any more, was checking cd key + CA_CONNECTING, // sending request packets to the server + CA_CHALLENGING, // sending challenge packets to the server + CA_CONNECTED, // netchan_t established, getting gamestate + CA_LOADING, // only during cgame initialization, never during main loop + CA_PRIMED, // got gamestate, waiting for first frame + CA_ACTIVE, // game views should be displayed + CA_CINEMATIC // playing a cinematic or a static pic, not connected to a server } connstate_t; // font support @@ -1354,13 +1355,13 @@ typedef struct { float s2; float t2; qhandle_t glyph; // handle to the shader with the glyph - char shaderName[32]; + char shaderName[32]; } glyphInfo_t; typedef struct { glyphInfo_t glyphs [GLYPHS_PER_FONT]; float glyphScale; - char name[MAX_QPATH]; + char name[MAX_QPATH]; } fontInfo_t; #define Square(x) ((x)*(x)) @@ -1370,58 +1371,58 @@ typedef struct { typedef struct qtime_s { - int tm_sec; /* seconds after the minute - [0,59] */ - int tm_min; /* minutes after the hour - [0,59] */ - int tm_hour; /* hours since midnight - [0,23] */ - int tm_mday; /* day of the month - [1,31] */ - int tm_mon; /* months since January - [0,11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday - [0,6] */ - int tm_yday; /* days since January 1 - [0,365] */ - int tm_isdst; /* daylight savings time flag */ + int tm_sec; /* seconds after the minute - [0,59] */ + int tm_min; /* minutes after the hour - [0,59] */ + int tm_hour; /* hours since midnight - [0,23] */ + int tm_mday; /* day of the month - [1,31] */ + int tm_mon; /* months since January - [0,11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday - [0,6] */ + int tm_yday; /* days since January 1 - [0,365] */ + int tm_isdst; /* daylight savings time flag */ } qtime_t; // server browser sources // TTimo: AS_MPLAYER is no longer used -#define AS_LOCAL 0 -#define AS_MPLAYER 1 -#define AS_GLOBAL 2 -#define AS_FAVORITES 3 +#define AS_LOCAL 0 +#define AS_MPLAYER 1 +#define AS_GLOBAL 2 +#define AS_FAVORITES 3 // cinematic states typedef enum { - FMV_IDLE, - FMV_PLAY, // play - FMV_EOF, // all other conditions, i.e. stop/EOF/abort - FMV_ID_BLT, - FMV_ID_IDLE, - FMV_LOOPED, - FMV_ID_WAIT + FMV_IDLE, + FMV_PLAY, // play + FMV_EOF, // all other conditions, i.e. stop/EOF/abort + FMV_ID_BLT, + FMV_ID_IDLE, + FMV_LOOPED, + FMV_ID_WAIT } e_status; typedef enum _flag_status { - FLAG_ATBASE = 0, - FLAG_TAKEN, // CTF - FLAG_TAKEN_RED, // One Flag CTF - FLAG_TAKEN_BLUE, // One Flag CTF - FLAG_DROPPED + FLAG_ATBASE = 0, + FLAG_TAKEN, // CTF + FLAG_TAKEN_RED, // One Flag CTF + FLAG_TAKEN_BLUE, // One Flag CTF + FLAG_DROPPED } flagStatus_t; -#define MAX_GLOBAL_SERVERS 4096 -#define MAX_OTHER_SERVERS 128 -#define MAX_PINGREQUESTS 32 -#define MAX_SERVERSTATUSREQUESTS 16 +#define MAX_GLOBAL_SERVERS 4096 +#define MAX_OTHER_SERVERS 128 +#define MAX_PINGREQUESTS 32 +#define MAX_SERVERSTATUSREQUESTS 16 -#define SAY_ALL 0 -#define SAY_TEAM 1 -#define SAY_TELL 2 +#define SAY_ALL 0 +#define SAY_TEAM 1 +#define SAY_TELL 2 #define CDKEY_LEN 16 #define CDCHKSUM_LEN 2 -#endif // __Q_SHARED_H +#endif // __Q_SHARED_H |