diff --git a/code/game/g_active.c b/code/game/g_active.c index e6ff5eb..85afa13 100644 --- a/code/game/g_active.c +++ b/code/game/g_active.c @@ -8,6 +8,7 @@ #include "g_items.h" #include "g_combat.h" #include "g_lua.h" +#include "g_mover.h" extern void ammo_station_finish_spawning ( gentity_t *self ); diff --git a/code/game/g_arenas.c b/code/game/g_arenas.c index 09ca1f7..7c39098 100644 --- a/code/game/g_arenas.c +++ b/code/game/g_arenas.c @@ -6,6 +6,7 @@ #include "g_local.h" #include "g_client.h" +#include "g_utils.h" #ifndef min #define min(a, b) (a) < (b) ? a : b @@ -17,17 +18,16 @@ gentity_t* podium2; gentity_t* podium3; void UpdateTournamentInfo(void) { + char msg[AWARDS_MSG_LENGTH]; + char msg2[AWARDS_MSG_LENGTH]; + char* mvpName = ""; int32_t i = 0; int32_t j = 0; int32_t k = 0; - gentity_t* player = NULL; - int32_t playerClientNum = 0; int32_t n = 0; - char msg[AWARDS_MSG_LENGTH]; - char msg2[AWARDS_MSG_LENGTH]; + int32_t playerClientNum = 0; int32_t playerRank = level.numNonSpectatorClients - 1; int32_t highestTiedRank = 0; - gentity_t* MVP = NULL; int32_t mvpNum = -1; int32_t mvpPoints = 0; int32_t winningCaptures = 0; @@ -35,10 +35,11 @@ void UpdateTournamentInfo(void) { int32_t winningTeam=0; int32_t loseCaptures = 0; int32_t losePoints = 0; - char* mvpName = ""; + int32_t secondPlaceTied=0; + gentity_t* MVP = NULL; + gentity_t* player = NULL; gclient_t* cl = NULL; gclient_t* cl2= NULL; - int32_t secondPlaceTied=0; memset(msg, 0, AWARDS_MSG_LENGTH); memset(msg2, 0, AWARDS_MSG_LENGTH); diff --git a/code/game/g_breakable.c b/code/game/g_breakable.c index 3367d95..f2cbedf 100644 --- a/code/game/g_breakable.c +++ b/code/game/g_breakable.c @@ -3,6 +3,7 @@ #include "g_spawn.h" #include "g_items.h" #include "g_combat.h" +#include "g_utils.h" /** * \brief A func_breakables health has sunk to or under zero diff --git a/code/game/g_local.h b/code/game/g_local.h index 43c720b..b0ba8f0 100644 --- a/code/game/g_local.h +++ b/code/game/g_local.h @@ -865,17 +865,6 @@ typedef struct { // // g_utils.c // -/** - * \brief Get the model index for a model. - * - * Get the model index for a model. - * - * \param name the model name - * - * \return the models index - */ -int G_ModelIndex( char* name ); - /** * \brief Get the sound index for a sound. * @@ -1242,34 +1231,6 @@ int G_GetEntityByBmodel(char* bmodel,list_p entities); */ void AddRemap(const char* oldShader, const char* newShader, float timeOffset); -// -// g_mover.c -// -/** - * Run a mover. - * - * \param ent Mover to run. - */ -void G_Mover_Run( gentity_t* ent ); - -/** - * Touch function for doors. - * - * \param ent The mover. - * \param other The touching entity. - * \param trace A trace. - */ -void G_Mover_TouchDoorTrigger( gentity_t* ent, gentity_t* other, trace_t* trace ); - -/** - * Use function for binary movers. - * - * \param ent The mover. - * \param other Other entity. - * \param activator Activator. - */ -void G_Mover_UseBinaryMover( gentity_t* ent, gentity_t* other, gentity_t* activator ); - // // g_misc.c // diff --git a/code/game/g_main.c b/code/game/g_main.c index 64a0e5c..f0f62f0 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -14,6 +14,8 @@ #include "g_usable.h" #include "g_lua.h" #include "g_missile.h" +#include "g_utils.h" +#include "g_mover.h" extern void BG_LoadItemNames(void); extern qboolean BG_ParseRankNames(char* fileName, rankNames_t rankNames[], size_t size); diff --git a/code/game/g_mover.c b/code/game/g_mover.c index 393c120..8717486 100644 --- a/code/game/g_mover.c +++ b/code/game/g_mover.c @@ -1,11 +1,12 @@ // Copyright (C) 1999-2000 Id Software, Inc. // -#include "g_local.h" +#include "g_mover.h" #include "g_client.h" #include "g_spawn.h" #include "g_combat.h" #include "g_lua.h" +#include "g_utils.h" extern qboolean G_CallSpawn(gentity_t *ent); diff --git a/code/game/g_mover.h b/code/game/g_mover.h new file mode 100644 index 0000000..a1f2665 --- /dev/null +++ b/code/game/g_mover.h @@ -0,0 +1,31 @@ +#ifndef G_MOVER_H_ +#define G_MOVER_H_ + +#include "g_local.h" + +/** + * \brief Run a mover. + * + * \param ent Mover to run. + */ +void G_Mover_Run(gentity_t* ent); + +/** + * \brief Touch function for doors. + * + * \param ent The mover. + * \param other The touching entity. + * \param trace A trace. + */ +void G_Mover_TouchDoorTrigger(gentity_t* ent, gentity_t* other, trace_t* trace); + +/** + * \brief Use function for binary movers. + * + * \param ent The mover. + * \param other Other entity. + * \param activator Activator. + */ +void G_Mover_UseBinaryMover(gentity_t* ent, gentity_t* other, gentity_t* activator); + +#endif /* G_MOVER_H_ */ diff --git a/code/game/g_spawn.c b/code/game/g_spawn.c index 6aa62e8..f621f2d 100644 --- a/code/game/g_spawn.c +++ b/code/game/g_spawn.c @@ -7,78 +7,78 @@ #include "g_lua.h" field_t fields[] = { - {"classname", FOFS(classname), F_LSTRING}, - {"origin", FOFS(s.origin), F_VECTOR}, - {"model", FOFS(model), F_LSTRING}, - {"model2", FOFS(model2), F_LSTRING}, - {"spawnflags", FOFS(spawnflags), F_INT}, - {"speed", FOFS(speed), F_FLOAT}, - {"target", FOFS(target), F_LSTRING}, - {"paintarget", FOFS(paintarget), F_LSTRING}, - {"targetname", FOFS(targetname), F_LSTRING}, - {"message", FOFS(message), F_LSTRING}, - {"team", FOFS(team), F_LSTRING}, - {"splashDamage", FOFS(splashDamage), F_INT}, - {"splashRadius", FOFS(splashRadius), F_INT}, - {"wait", FOFS(wait), F_FLOAT}, - {"random", FOFS(random), F_FLOAT}, - {"count", FOFS(count), F_INT}, - {"material", FOFS(s.powerups), F_INT}, - {"health", FOFS(health), F_INT}, - {"light", 0, F_IGNORE}, - {"dmg", FOFS(damage), F_INT}, - {"angles", FOFS(s.angles), F_VECTOR}, - {"angle", FOFS(s.angles), F_ANGLEHACK}, - {"pos2", FOFS(pos2), F_VECTOR}, - {"apos1", FOFS(apos1), F_VECTOR}, - {"apos2", FOFS(apos2), F_VECTOR}, - {"swapname", FOFS(swapname), F_LSTRING}, //RPG-X Modification | Phenix | 13/06/2004 - {"truename", FOFS(truename), F_LSTRING}, - {"falsename", FOFS(falsename), F_LSTRING}, - {"truetarget", FOFS(truetarget), F_LSTRING}, - {"falsetarget", FOFS(falsetarget), F_LSTRING}, - {"booleanstate", FOFS(booleanstate), F_INT}, - {"distance", FOFS(distance), F_FLOAT}, // VALKYRIE: for rotating doors - {"targetname2", FOFS(targetname2), F_LSTRING }, - {"bluename", FOFS(bluename), F_LSTRING}, - {"greensnd", FOFS(greensound), F_LSTRING}, - {"yellowsnd", FOFS(yellowsound), F_LSTRING}, - {"redsnd", FOFS(redsound), F_LSTRING}, - {"bluesnd", FOFS(bluesound), F_LSTRING}, - {"targetShaderName", FOFS(targetShaderName), F_LSTRING}, - {"targetShaderNewName", FOFS(targetShaderNewName), F_LSTRING}, - #ifdef G_LUA - {"luaThink", FOFS(luaThink), F_LSTRING}, - {"luaTouch", FOFS(luaTouch), F_LSTRING}, - {"luaUse", FOFS(luaUse), F_LSTRING}, - {"luaHurt", FOFS(luaHurt), F_LSTRING}, - {"luaDie", FOFS(luaDie), F_LSTRING}, - {"luaFree", FOFS(luaFree), F_LSTRING}, - {"luaTrigger", FOFS(luaTrigger), F_LSTRING}, - {"luaReached", FOFS(luaReached), F_LSTRING}, - {"luaReachedAngular", FOFS(luaReachedAngular), F_LSTRING}, - {"luaSpawn", FOFS(luaSpawn), F_LSTRING}, + { "classname", FOFS(classname), F_LSTRING }, + { "origin", FOFS(s.origin), F_VECTOR }, + { "model", FOFS(model), F_LSTRING }, + { "model2", FOFS(model2), F_LSTRING }, + { "spawnflags", FOFS(spawnflags), F_INT }, + { "speed", FOFS(speed), F_FLOAT }, + { "target", FOFS(target), F_LSTRING }, + { "paintarget", FOFS(paintarget), F_LSTRING }, + { "targetname", FOFS(targetname), F_LSTRING }, + { "message", FOFS(message), F_LSTRING }, + { "team", FOFS(team), F_LSTRING }, + { "splashDamage", FOFS(splashDamage), F_INT }, + { "splashRadius", FOFS(splashRadius), F_INT }, + { "wait", FOFS(wait), F_FLOAT }, + { "random", FOFS(random), F_FLOAT }, + { "count", FOFS(count), F_INT }, + { "material", FOFS(s.powerups), F_INT }, + { "health", FOFS(health), F_INT }, + { "light", 0, F_IGNORE }, + { "dmg", FOFS(damage), F_INT }, + { "angles", FOFS(s.angles), F_VECTOR }, + { "angle", FOFS(s.angles), F_ANGLEHACK }, + { "pos2", FOFS(pos2), F_VECTOR }, + { "apos1", FOFS(apos1), F_VECTOR }, + { "apos2", FOFS(apos2), F_VECTOR }, + { "swapname", FOFS(swapname), F_LSTRING }, //RPG-X Modification | Phenix | 13/06/2004 + { "truename", FOFS(truename), F_LSTRING }, + { "falsename", FOFS(falsename), F_LSTRING }, + { "truetarget", FOFS(truetarget), F_LSTRING }, + { "falsetarget", FOFS(falsetarget), F_LSTRING }, + { "booleanstate", FOFS(booleanstate), F_INT }, + { "distance", FOFS(distance), F_FLOAT }, // VALKYRIE: for rotating doors + { "targetname2", FOFS(targetname2), F_LSTRING }, + { "bluename", FOFS(bluename), F_LSTRING }, + { "greensnd", FOFS(greensound), F_LSTRING }, + { "yellowsnd", FOFS(yellowsound), F_LSTRING }, + { "redsnd", FOFS(redsound), F_LSTRING }, + { "bluesnd", FOFS(bluesound), F_LSTRING }, + { "targetShaderName", FOFS(targetShaderName), F_LSTRING }, + { "targetShaderNewName", FOFS(targetShaderNewName), F_LSTRING }, +#ifdef G_LUA + { "luaThink", FOFS(luaThink), F_LSTRING }, + { "luaTouch", FOFS(luaTouch), F_LSTRING }, + { "luaUse", FOFS(luaUse), F_LSTRING }, + { "luaHurt", FOFS(luaHurt), F_LSTRING }, + { "luaDie", FOFS(luaDie), F_LSTRING }, + { "luaFree", FOFS(luaFree), F_LSTRING }, + { "luaTrigger", FOFS(luaTrigger), F_LSTRING }, + { "luaReached", FOFS(luaReached), F_LSTRING }, + { "luaReachedAngular", FOFS(luaReachedAngular), F_LSTRING }, + { "luaSpawn", FOFS(luaSpawn), F_LSTRING }, - {"luaParm1", FOFS(luaParm1), F_LSTRING}, - {"luaParm2", FOFS(luaParm2), F_LSTRING}, - {"luaParm3", FOFS(luaParm3), F_LSTRING}, - {"luaParm4", FOFS(luaParm4), F_LSTRING}, - {"luaEntity", FOFS(luaEntity), F_INT}, - #endif - {"startRGBA", FOFS(startRGBA), F_VECTOR4}, - {"finalRGBA", FOFS(finalRGBA), F_VECTOR4}, - {NULL} + { "luaParm1", FOFS(luaParm1), F_LSTRING }, + { "luaParm2", FOFS(luaParm2), F_LSTRING }, + { "luaParm3", FOFS(luaParm3), F_LSTRING }, + { "luaParm4", FOFS(luaParm4), F_LSTRING }, + { "luaEntity", FOFS(luaEntity), F_INT }, +#endif + { "startRGBA", FOFS(startRGBA), F_VECTOR4 }, + { "finalRGBA", FOFS(finalRGBA), F_VECTOR4 }, + { NULL } }; -qboolean G_SpawnString( const char *key, const char *defaultString, char **out ) { +qboolean G_SpawnString(const char *key, const char *defaultString, char **out) { int i; - if ( !level.spawning ) { + if (!level.spawning) { *out = (char *)defaultString; } - for ( i = 0 ; i < level.numSpawnVars ; i++ ) { - if ( !strcmp( key, level.spawnVars[i][0] ) ) { + for (i = 0; i < level.numSpawnVars; i++) { + if (!strcmp(key, level.spawnVars[i][0])) { *out = level.spawnVars[i][1]; return qtrue; } @@ -88,236 +88,236 @@ qboolean G_SpawnString( const char *key, const char *defaultString, char **out ) return qfalse; } -qboolean G_SpawnFloat( const char *key, const char *defaultString, float *out ) { +qboolean G_SpawnFloat(const char *key, const char *defaultString, float *out) { char *s; qboolean present; - present = G_SpawnString( key, defaultString, &s ); - *out = atof( s ); + present = G_SpawnString(key, defaultString, &s); + *out = atof(s); return present; } -qboolean G_SpawnInt( const char *key, const char *defaultString, int *out ) { +qboolean G_SpawnInt(const char *key, const char *defaultString, int *out) { char *s; qboolean present; - present = G_SpawnString( key, defaultString, &s ); - *out = atoi( s ); + present = G_SpawnString(key, defaultString, &s); + *out = atoi(s); return present; } -qboolean G_SpawnVector( const char *key, const char *defaultString, float *out ) { +qboolean G_SpawnVector(const char *key, const char *defaultString, float *out) { char *s; qboolean present; - present = G_SpawnString( key, defaultString, &s ); - sscanf( s, "%f %f %f", &out[0], &out[1], &out[2] ); + present = G_SpawnString(key, defaultString, &s); + sscanf(s, "%f %f %f", &out[0], &out[1], &out[2]); return present; } -qboolean G_SpawnVector4( const char *key, const char *defaultString, float *out ) { +qboolean G_SpawnVector4(const char *key, const char *defaultString, float *out) { char *s; qboolean present; - present = G_SpawnString( key, defaultString, &s ); - sscanf( s, "%f %f %f %f", &out[0], &out[1], &out[2], &out[3] ); + present = G_SpawnString(key, defaultString, &s); + sscanf(s, "%f %f %f %f", &out[0], &out[1], &out[2], &out[3]); return present; } typedef struct { char *name; - void (*spawn)(gentity_t *ent); + void(*spawn)(gentity_t *ent); } spawn_t; 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_deathmatch}, + { "info_player_start", SP_info_player_deathmatch }, - {"NPC_BioHulk", SP_info_player_deathmatch}, - {"NPC_starfleet", SP_info_player_deathmatch}, - {"NPC_starfleet_random", SP_info_player_deathmatch}, - {"NPC_Tuvok", SP_info_player_deathmatch}, - {"NPC_Kim", SP_info_player_deathmatch}, - {"NPC_Doctor", SP_info_player_deathmatch}, - {"NPC_Paris", SP_info_player_deathmatch}, - {"NPC_Torres", SP_info_player_deathmatch}, - {"NPC_Janeway", SP_info_player_deathmatch}, - {"NPC_Seven", SP_info_player_deathmatch}, - {"NPC_Chakotay", SP_info_player_deathmatch}, - {"NPC_Neelix", SP_info_player_deathmatch}, - {"NPC_Vorik", SP_info_player_deathmatch}, - {"NPC_Foster", SP_info_player_deathmatch}, - {"NPC_Munro", SP_info_player_deathmatch}, - {"NPC_MunroScav", SP_info_player_deathmatch}, - {"NPC_Telsia", SP_info_player_deathmatch}, - {"NPC_Biessman", SP_info_player_deathmatch}, - {"NPC_Chang", SP_info_player_deathmatch}, - {"NPC_Chell", SP_info_player_deathmatch}, - {"NPC_Jurot", SP_info_player_deathmatch}, - {"NPC_borg", SP_info_player_deathmatch}, - {"NPC_klingon", SP_info_player_deathmatch}, - {"NPC_Malon", SP_info_player_deathmatch}, - {"NPC_Hirogen", SP_info_player_deathmatch}, - {"NPC_Hirogen_Alpha", SP_info_player_deathmatch}, - {"NPC_Imperial", SP_info_player_deathmatch}, - {"NPC_Imperial_Blue", SP_info_player_deathmatch}, - {"NPC_Imperial_Gold", SP_info_player_deathmatch}, - {"NPC_Imperial_Raider", SP_info_player_deathmatch}, - {"NPC_Stasis", SP_info_player_deathmatch}, - {"NPC_Species8472", SP_info_player_deathmatch}, - {"NPC_Reaver", SP_info_player_deathmatch}, - {"NPC_ReaverGuard", SP_info_player_deathmatch}, - {"NPC_Avatar", SP_info_player_deathmatch}, - {"NPC_Vohrsoth", SP_info_player_deathmatch}, - {"NPC_Desperado", SP_info_player_deathmatch}, - {"NPC_Paladin", SP_info_player_deathmatch}, - {"NPC_ChaoticaGuard", SP_info_player_deathmatch}, - {"NPC_Chaotica", SP_info_player_deathmatch}, - {"NPC_CaptainProton", SP_info_player_deathmatch}, - {"NPC_SatansRobot", SP_info_player_deathmatch}, - {"NPC_Buster", SP_info_player_deathmatch}, - {"NPC_Goodheart", SP_info_player_deathmatch}, + { "NPC_BioHulk", SP_info_player_deathmatch }, + { "NPC_starfleet", SP_info_player_deathmatch }, + { "NPC_starfleet_random", SP_info_player_deathmatch }, + { "NPC_Tuvok", SP_info_player_deathmatch }, + { "NPC_Kim", SP_info_player_deathmatch }, + { "NPC_Doctor", SP_info_player_deathmatch }, + { "NPC_Paris", SP_info_player_deathmatch }, + { "NPC_Torres", SP_info_player_deathmatch }, + { "NPC_Janeway", SP_info_player_deathmatch }, + { "NPC_Seven", SP_info_player_deathmatch }, + { "NPC_Chakotay", SP_info_player_deathmatch }, + { "NPC_Neelix", SP_info_player_deathmatch }, + { "NPC_Vorik", SP_info_player_deathmatch }, + { "NPC_Foster", SP_info_player_deathmatch }, + { "NPC_Munro", SP_info_player_deathmatch }, + { "NPC_MunroScav", SP_info_player_deathmatch }, + { "NPC_Telsia", SP_info_player_deathmatch }, + { "NPC_Biessman", SP_info_player_deathmatch }, + { "NPC_Chang", SP_info_player_deathmatch }, + { "NPC_Chell", SP_info_player_deathmatch }, + { "NPC_Jurot", SP_info_player_deathmatch }, + { "NPC_borg", SP_info_player_deathmatch }, + { "NPC_klingon", SP_info_player_deathmatch }, + { "NPC_Malon", SP_info_player_deathmatch }, + { "NPC_Hirogen", SP_info_player_deathmatch }, + { "NPC_Hirogen_Alpha", SP_info_player_deathmatch }, + { "NPC_Imperial", SP_info_player_deathmatch }, + { "NPC_Imperial_Blue", SP_info_player_deathmatch }, + { "NPC_Imperial_Gold", SP_info_player_deathmatch }, + { "NPC_Imperial_Raider", SP_info_player_deathmatch }, + { "NPC_Stasis", SP_info_player_deathmatch }, + { "NPC_Species8472", SP_info_player_deathmatch }, + { "NPC_Reaver", SP_info_player_deathmatch }, + { "NPC_ReaverGuard", SP_info_player_deathmatch }, + { "NPC_Avatar", SP_info_player_deathmatch }, + { "NPC_Vohrsoth", SP_info_player_deathmatch }, + { "NPC_Desperado", SP_info_player_deathmatch }, + { "NPC_Paladin", SP_info_player_deathmatch }, + { "NPC_ChaoticaGuard", SP_info_player_deathmatch }, + { "NPC_Chaotica", SP_info_player_deathmatch }, + { "NPC_CaptainProton", SP_info_player_deathmatch }, + { "NPC_SatansRobot", SP_info_player_deathmatch }, + { "NPC_Buster", SP_info_player_deathmatch }, + { "NPC_Goodheart", SP_info_player_deathmatch }, - {"info_player_deathmatch", SP_info_player_deathmatch}, - {"info_player_intermission", SP_info_player_intermission}, - {"info_null", SP_info_null}, - {"info_notnull", SP_info_notnull}, - {"info_camp", SP_info_camp}, + { "info_player_deathmatch", SP_info_player_deathmatch }, + { "info_player_intermission", SP_info_player_intermission }, + { "info_null", SP_info_null }, + { "info_notnull", SP_info_notnull }, + { "info_camp", SP_info_camp }, - {"func_plat", SP_func_plat}, - {"func_button", SP_func_button}, - {"func_door", SP_func_door}, - {"func_forcefield", SP_func_forcefield}, - {"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? - {"func_usable", SP_func_usable}, - {"func_breakable", SP_func_breakable}, - {"func_door_rotating", SP_func_door_rotating}, - {"func_brushmodel", SP_func_brushmodel}, // Hijack me haha - {"func_lightchange", SP_func_lightchange}, - {"func_targetmover", SP_func_targetmover}, - {"func_stasis_door", SP_func_stasis_door}, + { "func_plat", SP_func_plat }, + { "func_button", SP_func_button }, + { "func_door", SP_func_door }, + { "func_forcefield", SP_func_forcefield }, + { "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? + { "func_usable", SP_func_usable }, + { "func_breakable", SP_func_breakable }, + { "func_door_rotating", SP_func_door_rotating }, + { "func_brushmodel", SP_func_brushmodel }, // Hijack me haha + { "func_lightchange", SP_func_lightchange }, + { "func_targetmover", SP_func_targetmover }, + { "func_stasis_door", SP_func_stasis_door }, // 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_transporter", SP_trigger_transporter}, - {"trigger_radiation", SP_trigger_radiation}, + { "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_transporter", SP_trigger_transporter }, + { "trigger_radiation", SP_trigger_radiation }, // targets perform no action by themselves, but must be triggered // by another entity - {"target_give", SP_target_give}, - {"target_remove_powerups", SP_target_remove_powerups}, - {"target_delay", SP_target_delay}, - {"target_speaker", SP_target_speaker}, - {"target_print", SP_target_print}, - {"target_laser", SP_target_laser}, - {"target_teleporter", SP_target_teleporter}, - {"target_relay", SP_target_relay}, - {"target_kill", SP_target_kill}, - {"target_position", SP_info_notnull}, - {"target_location", SP_target_location}, - {"target_push", SP_target_push}, - {"target_counter", SP_target_counter}, - {"target_objective", SP_target_objective}, - {"target_boolean", SP_target_boolean}, // RPG-X | Phenix | 13/06/2004 - {"target_gravity", SP_target_gravity}, //RPG-X Phenix/J2J 03/08/04 - {"target_shake", SP_target_shake}, //RPG-X Phenix/J2J 16/11/04 - {"target_evosuit", SP_target_evosuit}, //RPG-X Phenix/J2J 16/11/04 - RedTechie: Fixed a typo you have evo suit pointing to shake function - {"target_turbolift", SP_target_turbolift}, - {"target_doorlock", SP_target_doorLock}, //RPG-X | GSIO01 | 08/05/2009 - {"target_repair", SP_target_repair}, //RPG-X | GSIO01 | 09/05/2009 - {"target_alert", SP_target_alert}, //RPG-X | GSIO01 - {"target_warp", SP_target_warp}, //RPG-X | GSIO01 | 19/05/2009 - {"target_deactivate", SP_target_deactivate}, - {"target_serverchange", SP_target_serverchange}, - {"target_levelchange", SP_target_levelchange}, - {"target_shaderremap", SP_target_shaderremap}, - {"target_selfdestruct", SP_target_selfdestruct}, - {"target_safezone", SP_target_zone}, - {"target_zone", SP_target_zone}, - {"target_shiphealth", SP_target_shiphealth}, - {"target_sequence", SP_target_sequence}, + { "target_give", SP_target_give }, + { "target_remove_powerups", SP_target_remove_powerups }, + { "target_delay", SP_target_delay }, + { "target_speaker", SP_target_speaker }, + { "target_print", SP_target_print }, + { "target_laser", SP_target_laser }, + { "target_teleporter", SP_target_teleporter }, + { "target_relay", SP_target_relay }, + { "target_kill", SP_target_kill }, + { "target_position", SP_info_notnull }, + { "target_location", SP_target_location }, + { "target_push", SP_target_push }, + { "target_counter", SP_target_counter }, + { "target_objective", SP_target_objective }, + { "target_boolean", SP_target_boolean }, // RPG-X | Phenix | 13/06/2004 + { "target_gravity", SP_target_gravity }, //RPG-X Phenix/J2J 03/08/04 + { "target_shake", SP_target_shake }, //RPG-X Phenix/J2J 16/11/04 + { "target_evosuit", SP_target_evosuit }, //RPG-X Phenix/J2J 16/11/04 - RedTechie: Fixed a typo you have evo suit pointing to shake function + { "target_turbolift", SP_target_turbolift }, + { "target_doorlock", SP_target_doorLock }, //RPG-X | GSIO01 | 08/05/2009 + { "target_repair", SP_target_repair }, //RPG-X | GSIO01 | 09/05/2009 + { "target_alert", SP_target_alert }, //RPG-X | GSIO01 + { "target_warp", SP_target_warp }, //RPG-X | GSIO01 | 19/05/2009 + { "target_deactivate", SP_target_deactivate }, + { "target_serverchange", SP_target_serverchange }, + { "target_levelchange", SP_target_levelchange }, + { "target_shaderremap", SP_target_shaderremap }, + { "target_selfdestruct", SP_target_selfdestruct }, + { "target_safezone", SP_target_zone }, + { "target_zone", SP_target_zone }, + { "target_shiphealth", SP_target_shiphealth }, + { "target_sequence", SP_target_sequence }, - {"light", SP_light}, - {"path_corner", SP_path_corner}, + { "light", SP_light }, + { "path_corner", SP_path_corner }, - {"misc_teleporter_dest", SP_info_notnull}, - {"misc_model", SP_misc_model}, - {"misc_model_breakable", SP_misc_model_breakable}, - {"misc_portal_surface", SP_misc_portal_surface}, - {"misc_portal_camera", SP_misc_portal_camera}, - {"misc_turret", SP_misc_turret}, - {"misc_laser", SP_laser_arm}, - {"misc_ammo_station", SP_misc_ammo_station}, + { "misc_teleporter_dest", SP_info_notnull }, + { "misc_model", SP_misc_model }, + { "misc_model_breakable", SP_misc_model_breakable }, + { "misc_portal_surface", SP_misc_portal_surface }, + { "misc_portal_camera", SP_misc_portal_camera }, + { "misc_turret", SP_misc_turret }, + { "misc_laser", SP_laser_arm }, + { "misc_ammo_station", SP_misc_ammo_station }, - {"shooter_rocket", SP_shooter_rocket}, - {"shooter_grenade", SP_shooter_grenade}, - {"shooter_plasma", SP_shooter_plasma}, - {"shooter_torpedo", SP_shooter_torpedo}, + { "shooter_rocket", SP_shooter_rocket }, + { "shooter_grenade", SP_shooter_grenade }, + { "shooter_plasma", SP_shooter_plasma }, + { "shooter_torpedo", SP_shooter_torpedo }, - {"team_CTF_redplayer", SP_info_player_deathmatch}, - {"team_CTF_blueplayer", SP_info_player_deathmatch}, + { "team_CTF_redplayer", SP_info_player_deathmatch }, + { "team_CTF_blueplayer", SP_info_player_deathmatch }, - {"team_CTF_redspawn", SP_info_player_deathmatch}, - {"team_CTF_bluespawn", SP_info_player_deathmatch}, + { "team_CTF_redspawn", SP_info_player_deathmatch }, + { "team_CTF_bluespawn", SP_info_player_deathmatch }, // extra Trek stuff - {"fx_spark", SP_fx_spark}, - {"fx_steam", SP_fx_steam}, - {"fx_bolt", SP_fx_bolt}, - {"fx_transporter", SP_fx_transporter}, - {"fx_drip", SP_fx_drip}, - {"fx_fountain", SP_fx_fountain}, - {"fx_surface_explosion", SP_fx_surface_explosion }, - {"fx_blow_chunks", SP_fx_blow_chunks }, - {"fx_smoke", SP_fx_smoke }, - {"fx_electrical_explosion", SP_fx_electrical_explosion }, - {"fx_phaser", SP_fx_phaser}, - {"fx_torpedo", SP_fx_torpedo}, - {"fx_particle_fire", SP_fx_particleFire}, - {"fx_fire", SP_fx_fire}, + { "fx_spark", SP_fx_spark }, + { "fx_steam", SP_fx_steam }, + { "fx_bolt", SP_fx_bolt }, + { "fx_transporter", SP_fx_transporter }, + { "fx_drip", SP_fx_drip }, + { "fx_fountain", SP_fx_fountain }, + { "fx_surface_explosion", SP_fx_surface_explosion }, + { "fx_blow_chunks", SP_fx_blow_chunks }, + { "fx_smoke", SP_fx_smoke }, + { "fx_electrical_explosion", SP_fx_electrical_explosion }, + { "fx_phaser", SP_fx_phaser }, + { "fx_torpedo", SP_fx_torpedo }, + { "fx_particle_fire", SP_fx_particleFire }, + { "fx_fire", SP_fx_fire }, -// Additional ports from SP by Harry Young - {"fx_cooking_steam", SP_fx_cooking_steam}, - {"fx_elecfire", SP_fx_electricfire}, + // Additional ports from SP by Harry Young + { "fx_cooking_steam", SP_fx_cooking_steam }, + { "fx_elecfire", SP_fx_electricfire }, //{"fx_forge_bolt", SP_fx_forge_bolt}, //{"fx_plasma", SP_fx_plasma}, //{"fx_energy_stream", SP_fx_stream}, //{"fx_transporter_stream", SP_fx_transporter_stream}, //{"fx_explosion_trail", SP_fx_explosion_trail}, //{"fx_borg_energy_beam", SP_fx_borg_energy_beam}, - {"fx_shimmery_thing", SP_fx_shimmery_thing}, - {"fx_borg_bolt", SP_fx_borg_bolt}, + { "fx_shimmery_thing", SP_fx_shimmery_thing }, + { "fx_borg_bolt", SP_fx_borg_bolt }, - {"func_mover", SP_func_mover}, - {"path_point", SP_path_point}, + { "func_mover", SP_func_mover }, + { "path_point", SP_path_point }, // ui entities - {"ui_transporter", SP_ui_transporter}, - {"ui_msd", SP_ui_msd}, - {"ui_holodeck", SP_ui_holodeck}, - - {"ref_tag", SP_info_notnull}, + { "ui_transporter", SP_ui_transporter }, + { "ui_msd", SP_ui_msd }, + { "ui_holodeck", SP_ui_holodeck }, + + { "ref_tag", SP_info_notnull }, // cinematic entities - {"cinematic_camera", SP_cinematic_camera}, + { "cinematic_camera", SP_cinematic_camera }, - {0, 0} + { 0, 0 } }; /* @@ -328,43 +328,36 @@ Finds the spawn function for the entity and calls it, returning qfalse if not found =============== */ -qboolean G_CallSpawn( gentity_t *ent ) { +qboolean G_CallSpawn(gentity_t *ent) { spawn_t *s; gitem_t *item; - if ( ent->classname == NULL ) - { - G_Printf ("G_CallSpawn: NULL classname\n"); + if (ent->classname == NULL) { + G_Printf("G_CallSpawn: NULL classname\n"); return qfalse; } // check item spawn functions - for ( item=bg_itemlist+1 ; item->classname ; item++ ) - { - if ( !strcmp(item->classname, ent->classname) ) - { // found it - if( item->giType == IT_TEAM && g_gametype.integer != GT_CTF ) - { + for (item = bg_itemlist + 1; item->classname; item++) { + if (!strcmp(item->classname, ent->classname)) { // found it + if (item->giType == IT_TEAM && g_gametype.integer != GT_CTF) { return qfalse; } - G_SpawnItem( ent, item ); + G_SpawnItem(ent, item); - #ifdef G_LUA - if(ent->luaSpawn) - { +#ifdef G_LUA + if (ent->luaSpawn) { LuaHook_G_EntitySpawn(ent->luaSpawn, ent->s.number); } - #endif +#endif return qtrue; } } // check normal spawn functions - for ( s=spawns ; s->name ; s++ ) - { - if ( !strcmp(s->name, ent->classname) ) - { + for (s = spawns; s->name; s++) { + if (!strcmp(s->name, ent->classname)) { // found it s->spawn(ent); @@ -372,17 +365,15 @@ qboolean G_CallSpawn( gentity_t *ent ) { } } - if ( Q_stricmp( "item_botroam", ent->classname ) != 0 ) - {//suppress error message about botroams as those are actually valid - DEVELOPER(G_Printf (S_COLOR_RED "%s doesn't have a spawn function\n", ent->classname);); + if (Q_stricmp("item_botroam", ent->classname) != 0) {//suppress error message about botroams as those are actually valid + DEVELOPER(G_Printf(S_COLOR_RED "%s doesn't have a spawn function\n", ent->classname);); } - #ifdef G_LUA - if(ent->luaSpawn) - { +#ifdef G_LUA + if (ent->luaSpawn) { LuaHook_G_EntitySpawn(ent->luaSpawn, ent->s.number); } - #endif +#endif return qfalse; } @@ -395,27 +386,27 @@ Builds a copy of the string, translating \n to real linefeeds so message texts can be multi-line ============= */ -char *G_NewString( const char *string ) { +char *G_NewString(const char *string) { char *newb, *new_p; - int i,l; + int i, l; - if(string == NULL) { + if (string == NULL) { return NULL; } l = strlen(string) + 1; - newb = (char *)G_Alloc( l ); + newb = (char *)G_Alloc(l); - if(newb == NULL) { + if (newb == NULL) { return NULL; } new_p = newb; // turn \n into a real linefeed - for ( i=0 ; i< l ; i++ ) { - if (string[i] == '\\' && i < l-1) { + for (i = 0; i < l; i++) { + if (string[i] == '\\' && i < l - 1) { i++; if (string[i] == 'n') { *new_p++ = '\n'; @@ -426,7 +417,7 @@ char *G_NewString( const char *string ) { *new_p++ = string[i]; } } - + return newb; } @@ -441,51 +432,51 @@ Takes a key/value pair and sets the binary values in a gentity =============== */ -qboolean G_ParseField( const char *key, const char *value, gentity_t *ent ) { +qboolean G_ParseField(const char *key, const char *value, gentity_t *ent) { field_t *f; byte *b; float v; vec3_t vec; vec4_t vec4; - for ( f=fields ; f->name ; f++ ) { - if ( !Q_stricmp(f->name, key) ) { + for (f = fields; f->name; f++) { + if (!Q_stricmp(f->name, key)) { // found it b = (byte *)ent; - switch( f->type ) { - case F_LSTRING: - *(char **)(b+f->ofs) = G_NewString (value); - break; - case F_VECTOR: - sscanf (value, "%f %f %f", &vec[0], &vec[1], &vec[2]); - ((float *)(b+f->ofs))[0] = vec[0]; - ((float *)(b+f->ofs))[1] = vec[1]; - ((float *)(b+f->ofs))[2] = vec[2]; - break; - case F_VECTOR4: - sscanf (value, "%f %f %f %f", &vec4[0], &vec[1], &vec[2], &vec[3]); - ((float *)(b+f->ofs))[0] = vec4[0]; - ((float *)(b+f->ofs))[0] = vec4[1]; - ((float *)(b+f->ofs))[0] = vec4[2]; - ((float *)(b+f->ofs))[0] = vec4[3]; - break; - case F_INT: - *(int *)(b+f->ofs) = atoi(value); - break; - case F_FLOAT: - *(float *)(b+f->ofs) = atof(value); - break; - case F_ANGLEHACK: - v = atof(value); - ((float *)(b+f->ofs))[0] = 0; - ((float *)(b+f->ofs))[1] = v; - ((float *)(b+f->ofs))[2] = 0; - break; - default: - case F_IGNORE: - return qfalse; - break; + switch (f->type) { + case F_LSTRING: + *(char **)(b + f->ofs) = G_NewString(value); + break; + case F_VECTOR: + sscanf(value, "%f %f %f", &vec[0], &vec[1], &vec[2]); + ((float *)(b + f->ofs))[0] = vec[0]; + ((float *)(b + f->ofs))[1] = vec[1]; + ((float *)(b + f->ofs))[2] = vec[2]; + break; + case F_VECTOR4: + sscanf(value, "%f %f %f %f", &vec4[0], &vec[1], &vec[2], &vec[3]); + ((float *)(b + f->ofs))[0] = vec4[0]; + ((float *)(b + f->ofs))[0] = vec4[1]; + ((float *)(b + f->ofs))[0] = vec4[2]; + ((float *)(b + f->ofs))[0] = vec4[3]; + break; + case F_INT: + *(int *)(b + f->ofs) = atoi(value); + break; + case F_FLOAT: + *(float *)(b + f->ofs) = atof(value); + break; + case F_ANGLEHACK: + v = atof(value); + ((float *)(b + f->ofs))[0] = 0; + ((float *)(b + f->ofs))[1] = v; + ((float *)(b + f->ofs))[2] = 0; + break; + default: + case F_IGNORE: + return qfalse; + break; } return qtrue; } @@ -504,69 +495,59 @@ Spawn an entity and fill in all of the level fields from level.spawnVars[], then call the class specfic spawn function =================== */ -void G_SpawnGEntityFromSpawnVars( void ) -{ +void G_SpawnGEntityFromSpawnVars(void) { int i; gentity_t *ent; char *s, *value, *gametypeName; - static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf"}; + static char *gametypeNames[] = { "ffa", "tournament", "single", "team", "ctf" }; // get the next free entity ent = G_Spawn(); - for ( i = 0 ; i < level.numSpawnVars ; i++ ) { - G_ParseField( level.spawnVars[i][0], level.spawnVars[i][1], ent ); + for (i = 0; i < level.numSpawnVars; i++) { + G_ParseField(level.spawnVars[i][0], level.spawnVars[i][1], ent); } // check for "notteam" / "notfree" flags - if ( g_gametype.integer == GT_SINGLE_PLAYER ) { - G_SpawnInt( "notsingle", "0", &i ); - if ( i ) { - G_FreeEntity( ent ); + if (g_gametype.integer == GT_SINGLE_PLAYER) { + G_SpawnInt("notsingle", "0", &i); + if (i) { + G_FreeEntity(ent); return; } } - if ( g_gametype.integer >= GT_TEAM ) - { - G_SpawnInt( "notteam", "0", &i ); - if ( i ) - { - G_FreeEntity( ent ); + if (g_gametype.integer >= GT_TEAM) { + G_SpawnInt("notteam", "0", &i); + if (i) { + G_FreeEntity(ent); return; } - } - else - { - G_SpawnInt( "notfree", "0", &i ); - if ( i ) - { - G_FreeEntity( ent ); + } else { + G_SpawnInt("notfree", "0", &i); + if (i) { + G_FreeEntity(ent); return; } } - if ( G_SpawnString( "gametype", "", &value ) ) - { - if ( g_gametype.integer >= GT_FFA && g_gametype.integer < GT_MAX_GAME_TYPE ) - { + if (G_SpawnString("gametype", "", &value)) { + if (g_gametype.integer >= GT_FFA && g_gametype.integer < GT_MAX_GAME_TYPE) { gametypeName = gametypeNames[g_gametype.integer]; - s = strstr( value, gametypeName ); - if ( !s ) - { - G_FreeEntity( ent ); + s = strstr(value, gametypeName); + if (!s) { + G_FreeEntity(ent); return; } } } // move editor origin to pos - VectorCopy( ent->s.origin, ent->s.pos.trBase ); - VectorCopy( ent->s.origin, ent->r.currentOrigin ); + VectorCopy(ent->s.origin, ent->s.pos.trBase); + VectorCopy(ent->s.origin, ent->r.currentOrigin); // if we didn't get a classname, don't bother spawning anything - if ( !G_CallSpawn( ent ) ) - { - G_FreeEntity( ent ); + if (!G_CallSpawn(ent)) { + G_FreeEntity(ent); } } @@ -577,17 +558,17 @@ void G_SpawnGEntityFromSpawnVars( void ) G_AddSpawnVarToken ==================== */ -char *G_AddSpawnVarToken( const char *string ) { +char *G_AddSpawnVarToken(const char *string) { int l; char *dest; - l = strlen( string ); - if ( level.numSpawnVarChars + l + 1 > MAX_SPAWN_VARS_CHARS ) { - G_Error( "G_AddSpawnVarToken: MAX_SPAWN_VARS" ); + l = strlen(string); + if (level.numSpawnVarChars + l + 1 > MAX_SPAWN_VARS_CHARS) { + G_Error("G_AddSpawnVarToken: MAX_SPAWN_VARS"); } dest = level.spawnVarChars + level.numSpawnVarChars; - memcpy( dest, string, l+1 ); + memcpy(dest, string, l + 1); level.numSpawnVarChars += l + 1; @@ -604,7 +585,7 @@ level's entity strings into level.spawnVars[] This does not actually spawn an entity. ==================== */ -qboolean G_ParseSpawnVars( void ) { +qboolean G_ParseSpawnVars(void) { char keyname[MAX_TOKEN_CHARS]; char com_token[MAX_TOKEN_CHARS]; @@ -612,40 +593,40 @@ qboolean G_ParseSpawnVars( void ) { level.numSpawnVarChars = 0; // parse the opening brace - if ( !trap_GetEntityToken( com_token, sizeof( com_token ) ) ) { + if (!trap_GetEntityToken(com_token, sizeof(com_token))) { // end of spawn string return qfalse; } - if ( com_token[0] != '{' ) { - G_Error( "G_ParseSpawnVars: found %s when expecting {",com_token ); + if (com_token[0] != '{') { + G_Error("G_ParseSpawnVars: found %s when expecting {", com_token); } // go through all the key / value pairs - while ( 1 ) { + while (1) { // parse key - if ( !trap_GetEntityToken( keyname, sizeof( keyname ) ) ) { - Com_Printf( S_COLOR_RED "G_ParseSpawnVars: Keyname - %s\n", keyname ); - G_Error( "G_ParseSpawnVars: EOF without closing brace" ); + if (!trap_GetEntityToken(keyname, sizeof(keyname))) { + Com_Printf(S_COLOR_RED "G_ParseSpawnVars: Keyname - %s\n", keyname); + G_Error("G_ParseSpawnVars: EOF without closing brace"); } - if ( keyname[0] == '}' ) { + if (keyname[0] == '}') { break; } - + // parse value - if ( !trap_GetEntityToken( com_token, sizeof( com_token ) ) ) { - Com_Printf( S_COLOR_RED "G_ParseSpawnVars: Token - %s\n", com_token ); - G_Error( "G_ParseSpawnVars: EOF without closing brace" ); + if (!trap_GetEntityToken(com_token, sizeof(com_token))) { + Com_Printf(S_COLOR_RED "G_ParseSpawnVars: Token - %s\n", com_token); + G_Error("G_ParseSpawnVars: EOF without closing brace"); } - if ( com_token[0] == '}' ) { - G_Error( "G_ParseSpawnVars: closing brace without data" ); + if (com_token[0] == '}') { + G_Error("G_ParseSpawnVars: closing brace without data"); } - if ( level.numSpawnVars == MAX_SPAWN_VARS ) { - G_Error( "G_ParseSpawnVars: MAX_SPAWN_VARS" ); + if (level.numSpawnVars == MAX_SPAWN_VARS) { + G_Error("G_ParseSpawnVars: MAX_SPAWN_VARS"); } - level.spawnVars[ level.numSpawnVars ][0] = G_AddSpawnVarToken( keyname ); - level.spawnVars[ level.numSpawnVars ][1] = G_AddSpawnVarToken( com_token ); + level.spawnVars[level.numSpawnVars][0] = G_AddSpawnVarToken(keyname); + level.spawnVars[level.numSpawnVars][1] = G_AddSpawnVarToken(com_token); level.numSpawnVars++; } @@ -689,59 +670,55 @@ q3map2: "_style42rgbgen" |rgbGen|-like shader definition string for light style 42 (works the same way for all style numbers) "_style42alphagen" |alphaGen|-like shader definition string for light style 42 (works the same way for all style numbers) */ -void SP_worldspawn( void ) { +void SP_worldspawn(void) { char *s; - G_SpawnString( "classname", "", &s ); - if ( Q_stricmp( s, "worldspawn" ) ) { - G_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" ); + G_SpawnString("classname", "", &s); + if (Q_stricmp(s, "worldspawn")) { + G_Error("SP_worldspawn: The first entity isn't 'worldspawn'"); } // make some data visible to connecting client - trap_SetConfigstring( CS_GAME_VERSION, GAME_VERSION ); + trap_SetConfigstring(CS_GAME_VERSION, GAME_VERSION); - trap_SetConfigstring( CS_LEVEL_START_TIME, va("%i", level.startTime ) ); + trap_SetConfigstring(CS_LEVEL_START_TIME, va("%i", level.startTime)); - G_SpawnString( "music", "", &s ); - trap_SetConfigstring( CS_MUSIC, s ); + G_SpawnString("music", "", &s); + trap_SetConfigstring(CS_MUSIC, s); - G_SpawnString( "message", "", &s ); - trap_SetConfigstring( CS_MESSAGE, s ); // map specific message + G_SpawnString("message", "", &s); + trap_SetConfigstring(CS_MESSAGE, s); // map specific message - trap_SetConfigstring( CS_MOTD, g_motd.string ); // message of the day - trap_SetConfigstring( CS_CON_FAIL, rpg_passMessage.string ); + trap_SetConfigstring(CS_MOTD, g_motd.string); // message of the day + trap_SetConfigstring(CS_CON_FAIL, rpg_passMessage.string); - G_SpawnString( "gravity", "800", &s ); - trap_Cvar_Set( "g_gravity", s ); + G_SpawnString("gravity", "800", &s); + trap_Cvar_Set("g_gravity", s); //FIXME: in some cases, want to carry over from previous running of this map - G_SpawnString( "fraglimit", "0", &s ); - if ( s && atoi(s) != 0 ) - { - trap_Cvar_Set( "fraglimit", s ); + G_SpawnString("fraglimit", "0", &s); + if (s && atoi(s) != 0) { + trap_Cvar_Set("fraglimit", s); } - G_SpawnString( "capturelimit", "0", &s ); - if ( s && atoi(s) != 0 ) - { - trap_Cvar_Set( "capturelimit", s ); + G_SpawnString("capturelimit", "0", &s); + if (s && atoi(s) != 0) { + trap_Cvar_Set("capturelimit", s); } - G_SpawnString( "timelimit", "0", &s ); - if ( s && atoi(s) != 0 ) - { - trap_Cvar_Set( "timelimit", s ); + G_SpawnString("timelimit", "0", &s); + if (s && atoi(s) != 0) { + trap_Cvar_Set("timelimit", s); } - G_SpawnString( "timelimitWinningTeam", "", &s ); - if ( s ) - { - trap_Cvar_Set( "timelimitWinningTeam", s ); + G_SpawnString("timelimitWinningTeam", "", &s); + if (s) { + trap_Cvar_Set("timelimitWinningTeam", s); } g_entities[ENTITYNUM_WORLD].s.number = ENTITYNUM_WORLD; g_entities[ENTITYNUM_WORLD].classname = "worldspawn"; // see if we want a warmup time - trap_SetConfigstring( CS_WARMUP, "" ); - if ( g_restarted.integer ) { + trap_SetConfigstring(CS_WARMUP, ""); + if (g_restarted.integer) { level.warmupTime = 0; } } @@ -754,7 +731,7 @@ G_SpawnEntitiesFromString Parses textual entity definitions out of an entstring and spawns gentities. ============== */ -void G_SpawnEntitiesFromString( void ) { +void G_SpawnEntitiesFromString(void) { // allow calls to G_Spawn*() level.spawning = qtrue; level.numSpawnVars = 0; @@ -762,15 +739,15 @@ void G_SpawnEntitiesFromString( void ) { // the worldspawn is not an actual entity, but it still // has a "spawn" function to perform any global setup // needed by a level (setting configstrings or cvars, etc) - if ( !G_ParseSpawnVars() ) { - G_Error( "SpawnEntities: no entities" ); + if (!G_ParseSpawnVars()) { + G_Error("SpawnEntities: no entities"); } SP_worldspawn(); // parse ents - while( G_ParseSpawnVars() ) { + while (G_ParseSpawnVars()) { G_SpawnGEntityFromSpawnVars(); - } + } level.spawning = qfalse; // any future calls to G_Spawn*() will be errors } diff --git a/code/game/g_turrets.c b/code/game/g_turrets.c index 5a082c5..e02dd54 100644 --- a/code/game/g_turrets.c +++ b/code/game/g_turrets.c @@ -3,6 +3,7 @@ #include "g_items.h" #include "g_logger.h" #include "g_combat.h" +#include "g_utils.h" #define ARM_ANGLE_RANGE 60 #define HEAD_ANGLE_RANGE 90 diff --git a/code/game/g_utils.h b/code/game/g_utils.h index d0acc43..5c6d989 100644 --- a/code/game/g_utils.h +++ b/code/game/g_utils.h @@ -3,6 +3,13 @@ #include "g_local.h" -qboolean G_Utils_LineOfSight( gentity_t* ent1, gentity_t* ent2 ); //Phenix +/** + * \brief Get the model index for a model. + * Get the model index for a model. + * + * \param name the model name + * \return the models index + */ +int32_t G_ModelIndex(char* name); #endif /* G_UTILS_H_ */ diff --git a/code/game/game.vcxproj b/code/game/game.vcxproj index c8c340b..9af76e0 100644 --- a/code/game/game.vcxproj +++ b/code/game/game.vcxproj @@ -516,6 +516,7 @@ + diff --git a/code/game/game.vcxproj.filters b/code/game/game.vcxproj.filters index bfb7c7e..267e1de 100644 --- a/code/game/game.vcxproj.filters +++ b/code/game/game.vcxproj.filters @@ -530,6 +530,9 @@ Header Files + + Header Files +