From a9696d3558ae7b9667039754ee181fa8ec469642 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Wed, 11 May 2011 14:21:27 +0000 Subject: [PATCH] Refactoring patch by DevHC --- code/client/snd_main.c | 2 +- code/game/g_local.h | 2 +- code/game/g_public.h | 2 +- code/game/g_spawn.c | 42 ++++++++++++----------------------- code/qcommon/vm_powerpc_asm.c | 3 --- code/server/sv_client.c | 2 +- code/server/sv_snapshot.c | 2 +- 7 files changed, 19 insertions(+), 36 deletions(-) diff --git a/code/client/snd_main.c b/code/client/snd_main.c index 90c6b14f..0901d455 100644 --- a/code/client/snd_main.c +++ b/code/client/snd_main.c @@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Foobar; if not, write to the Free Software +along with Quake III Arena source code; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ diff --git a/code/game/g_local.h b/code/game/g_local.h index 89dbafce..3dc10560 100644 --- a/code/game/g_local.h +++ b/code/game/g_local.h @@ -337,7 +337,7 @@ typedef struct { struct gentity_s *gentities; int gentitySize; - int num_entities; // current number, <= MAX_GENTITIES + int num_entities; // MAX_CLIENTS <= num_entities <= ENTITYNUM_MAX_NORMAL int warmupTime; // restart match at this time diff --git a/code/game/g_public.h b/code/game/g_public.h index 57d137ad..f56a9e1c 100644 --- a/code/game/g_public.h +++ b/code/game/g_public.h @@ -83,7 +83,7 @@ typedef struct { // when a trace call is made and passEntityNum != ENTITYNUM_NONE, // an ent will be excluded from testing if: - // ent->r.number == passEntityNum (don't interact with self) + // ent->s.number == passEntityNum (don't interact with self) // ent->r.ownerNum == passEntityNum (don't interact with your own missiles) // entity[ent->r.ownerNum].r.ownerNum == passEntityNum (don't interact with other missiles from owner) int ownerNum; diff --git a/code/game/g_spawn.c b/code/game/g_spawn.c index 77db42d1..2a363983 100644 --- a/code/game/g_spawn.c +++ b/code/game/g_spawn.c @@ -75,46 +75,40 @@ qboolean G_SpawnVector( const char *key, const char *defaultString, float *out ) // fields are needed for spawning from the entity string // typedef enum { - F_INT, + F_INT, F_FLOAT, - F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL - F_GSTRING, // string on disk, pointer in memory, TAG_GAME + F_STRING, F_VECTOR, - F_ANGLEHACK, - F_ENTITY, // index on disk, pointer in memory - F_ITEM, // index on disk, pointer in memory - F_CLIENT, // index on disk, pointer in memory - F_IGNORE + F_ANGLEHACK } fieldtype_t; typedef struct { char *name; - int ofs; + size_t ofs; fieldtype_t type; } field_t; field_t fields[] = { - {"classname", FOFS(classname), F_LSTRING}, + {"classname", FOFS(classname), F_STRING}, {"origin", FOFS(s.origin), F_VECTOR}, - {"model", FOFS(model), F_LSTRING}, - {"model2", FOFS(model2), F_LSTRING}, + {"model", FOFS(model), F_STRING}, + {"model2", FOFS(model2), F_STRING}, {"spawnflags", FOFS(spawnflags), F_INT}, {"speed", FOFS(speed), F_FLOAT}, - {"target", FOFS(target), F_LSTRING}, - {"targetname", FOFS(targetname), F_LSTRING}, - {"message", FOFS(message), F_LSTRING}, - {"team", FOFS(team), F_LSTRING}, + {"target", FOFS(target), F_STRING}, + {"targetname", FOFS(targetname), F_STRING}, + {"message", FOFS(message), F_STRING}, + {"team", FOFS(team), F_STRING}, {"wait", FOFS(wait), F_FLOAT}, {"random", FOFS(random), F_FLOAT}, {"count", FOFS(count), 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}, - {"targetShaderName", FOFS(targetShaderName), F_LSTRING}, - {"targetShaderNewName", FOFS(targetShaderNewName), F_LSTRING}, + {"targetShaderName", FOFS(targetShaderName), F_STRING}, + {"targetShaderNewName", FOFS(targetShaderNewName), F_STRING}, {NULL} }; @@ -128,10 +122,6 @@ typedef struct { void SP_info_player_start (gentity_t *ent); void SP_info_player_deathmatch (gentity_t *ent); void SP_info_player_intermission (gentity_t *ent); -void SP_info_firstplace(gentity_t *ent); -void SP_info_secondplace(gentity_t *ent); -void SP_info_thirdplace(gentity_t *ent); -void SP_info_podium(gentity_t *ent); void SP_func_plat (gentity_t *ent); void SP_func_static (gentity_t *ent); @@ -155,7 +145,6 @@ void SP_target_delay (gentity_t *ent); void SP_target_speaker (gentity_t *ent); void SP_target_print (gentity_t *ent); void SP_target_laser (gentity_t *self); -void SP_target_character (gentity_t *ent); void SP_target_score( gentity_t *ent ); void SP_target_teleporter( gentity_t *ent ); void SP_target_relay (gentity_t *ent); @@ -363,7 +352,7 @@ void G_ParseField( const char *key, const char *value, gentity_t *ent ) { b = (byte *)ent; switch( f->type ) { - case F_LSTRING: + case F_STRING: *(char **)(b+f->ofs) = G_NewString (value); break; case F_VECTOR: @@ -384,9 +373,6 @@ void G_ParseField( const char *key, const char *value, gentity_t *ent ) { ((float *)(b+f->ofs))[1] = v; ((float *)(b+f->ofs))[2] = 0; break; - default: - case F_IGNORE: - break; } return; } diff --git a/code/qcommon/vm_powerpc_asm.c b/code/qcommon/vm_powerpc_asm.c index 340da178..70159259 100644 --- a/code/qcommon/vm_powerpc_asm.c +++ b/code/qcommon/vm_powerpc_asm.c @@ -65,7 +65,6 @@ struct powerpc_opcode }; static const struct powerpc_opcode powerpc_opcodes[]; -static const int powerpc_num_opcodes; #define PPC_OPCODE_PPC 1 #define PPC_OPCODE_POWER 2 @@ -112,7 +111,6 @@ struct powerpc_operand }; static const struct powerpc_operand powerpc_operands[]; -static const unsigned int num_powerpc_operands; #define PPC_OPERAND_SIGNED (0x1) #define PPC_OPERAND_SIGNOPT (0x2) @@ -390,7 +388,6 @@ static const struct powerpc_operand powerpc_operands[] = }; -static const unsigned int num_powerpc_operands = ARRAY_LEN (powerpc_operands); /* The functions used to insert and extract complicated operands. */ diff --git a/code/server/sv_client.c b/code/server/sv_client.c index f4ebe60f..89f53b33 100644 --- a/code/server/sv_client.c +++ b/code/server/sv_client.c @@ -1537,7 +1537,7 @@ static qboolean SV_ClientCommand( client_t *cl, msg_t *msg ) { // the command, we will stop processing the rest of the packet, // including the usercmd. This causes flooders to lag themselves // but not other people - // We don't do this when the client hasn't been active yet since its + // We don't do this when the client hasn't been active yet since it's // normal to spam a lot of commands when downloading if ( !com_cl_running->integer && cl->state >= CS_ACTIVE && diff --git a/code/server/sv_snapshot.c b/code/server/sv_snapshot.c index 33c61bcd..e96a4dc8 100644 --- a/code/server/sv_snapshot.c +++ b/code/server/sv_snapshot.c @@ -412,7 +412,7 @@ static void SV_AddEntitiesVisibleFromPoint( vec3_t origin, clientSnapshot_t *fra // add it SV_AddEntToSnapshot( svEnt, ent, eNums ); - // if its a portal entity, add everything visible from its camera position + // if it's a portal entity, add everything visible from its camera position if ( ent->r.svFlags & SVF_PORTAL ) { if ( ent->s.generic1 ) { vec3_t dir;