Refactoring patch by DevHC

This commit is contained in:
Thilo Schulz 2011-05-11 14:21:27 +00:00
parent 86d96f12b9
commit a9696d3558
7 changed files with 19 additions and 36 deletions

View file

@ -16,7 +16,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License 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 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=========================================================================== ===========================================================================
*/ */

View file

@ -337,7 +337,7 @@ typedef struct {
struct gentity_s *gentities; struct gentity_s *gentities;
int gentitySize; 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 int warmupTime; // restart match at this time

View file

@ -83,7 +83,7 @@ typedef struct {
// when a trace call is made and passEntityNum != ENTITYNUM_NONE, // when a trace call is made and passEntityNum != ENTITYNUM_NONE,
// an ent will be excluded from testing if: // 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) // 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) // entity[ent->r.ownerNum].r.ownerNum == passEntityNum (don't interact with other missiles from owner)
int ownerNum; int ownerNum;

View file

@ -75,46 +75,40 @@ qboolean G_SpawnVector( const char *key, const char *defaultString, float *out )
// fields are needed for spawning from the entity string // fields are needed for spawning from the entity string
// //
typedef enum { typedef enum {
F_INT, F_INT,
F_FLOAT, F_FLOAT,
F_LSTRING, // string on disk, pointer in memory, TAG_LEVEL F_STRING,
F_GSTRING, // string on disk, pointer in memory, TAG_GAME
F_VECTOR, F_VECTOR,
F_ANGLEHACK, 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
} fieldtype_t; } fieldtype_t;
typedef struct typedef struct
{ {
char *name; char *name;
int ofs; size_t ofs;
fieldtype_t type; fieldtype_t type;
} field_t; } field_t;
field_t fields[] = { field_t fields[] = {
{"classname", FOFS(classname), F_LSTRING}, {"classname", FOFS(classname), F_STRING},
{"origin", FOFS(s.origin), F_VECTOR}, {"origin", FOFS(s.origin), F_VECTOR},
{"model", FOFS(model), F_LSTRING}, {"model", FOFS(model), F_STRING},
{"model2", FOFS(model2), F_LSTRING}, {"model2", FOFS(model2), F_STRING},
{"spawnflags", FOFS(spawnflags), F_INT}, {"spawnflags", FOFS(spawnflags), F_INT},
{"speed", FOFS(speed), F_FLOAT}, {"speed", FOFS(speed), F_FLOAT},
{"target", FOFS(target), F_LSTRING}, {"target", FOFS(target), F_STRING},
{"targetname", FOFS(targetname), F_LSTRING}, {"targetname", FOFS(targetname), F_STRING},
{"message", FOFS(message), F_LSTRING}, {"message", FOFS(message), F_STRING},
{"team", FOFS(team), F_LSTRING}, {"team", FOFS(team), F_STRING},
{"wait", FOFS(wait), F_FLOAT}, {"wait", FOFS(wait), F_FLOAT},
{"random", FOFS(random), F_FLOAT}, {"random", FOFS(random), F_FLOAT},
{"count", FOFS(count), F_INT}, {"count", FOFS(count), F_INT},
{"health", FOFS(health), F_INT}, {"health", FOFS(health), F_INT},
{"light", 0, F_IGNORE},
{"dmg", FOFS(damage), F_INT}, {"dmg", FOFS(damage), F_INT},
{"angles", FOFS(s.angles), F_VECTOR}, {"angles", FOFS(s.angles), F_VECTOR},
{"angle", FOFS(s.angles), F_ANGLEHACK}, {"angle", FOFS(s.angles), F_ANGLEHACK},
{"targetShaderName", FOFS(targetShaderName), F_LSTRING}, {"targetShaderName", FOFS(targetShaderName), F_STRING},
{"targetShaderNewName", FOFS(targetShaderNewName), F_LSTRING}, {"targetShaderNewName", FOFS(targetShaderNewName), F_STRING},
{NULL} {NULL}
}; };
@ -128,10 +122,6 @@ typedef struct {
void SP_info_player_start (gentity_t *ent); void SP_info_player_start (gentity_t *ent);
void SP_info_player_deathmatch (gentity_t *ent); void SP_info_player_deathmatch (gentity_t *ent);
void SP_info_player_intermission (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_plat (gentity_t *ent);
void SP_func_static (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_speaker (gentity_t *ent);
void SP_target_print (gentity_t *ent); void SP_target_print (gentity_t *ent);
void SP_target_laser (gentity_t *self); void SP_target_laser (gentity_t *self);
void SP_target_character (gentity_t *ent);
void SP_target_score( gentity_t *ent ); void SP_target_score( gentity_t *ent );
void SP_target_teleporter( gentity_t *ent ); void SP_target_teleporter( gentity_t *ent );
void SP_target_relay (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; b = (byte *)ent;
switch( f->type ) { switch( f->type ) {
case F_LSTRING: case F_STRING:
*(char **)(b+f->ofs) = G_NewString (value); *(char **)(b+f->ofs) = G_NewString (value);
break; break;
case F_VECTOR: 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))[1] = v;
((float *)(b+f->ofs))[2] = 0; ((float *)(b+f->ofs))[2] = 0;
break; break;
default:
case F_IGNORE:
break;
} }
return; return;
} }

View file

@ -65,7 +65,6 @@ struct powerpc_opcode
}; };
static const struct powerpc_opcode powerpc_opcodes[]; static const struct powerpc_opcode powerpc_opcodes[];
static const int powerpc_num_opcodes;
#define PPC_OPCODE_PPC 1 #define PPC_OPCODE_PPC 1
#define PPC_OPCODE_POWER 2 #define PPC_OPCODE_POWER 2
@ -112,7 +111,6 @@ struct powerpc_operand
}; };
static const struct powerpc_operand powerpc_operands[]; static const struct powerpc_operand powerpc_operands[];
static const unsigned int num_powerpc_operands;
#define PPC_OPERAND_SIGNED (0x1) #define PPC_OPERAND_SIGNED (0x1)
#define PPC_OPERAND_SIGNOPT (0x2) #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. */ /* The functions used to insert and extract complicated operands. */

View file

@ -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, // the command, we will stop processing the rest of the packet,
// including the usercmd. This causes flooders to lag themselves // including the usercmd. This causes flooders to lag themselves
// but not other people // 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 // normal to spam a lot of commands when downloading
if ( !com_cl_running->integer && if ( !com_cl_running->integer &&
cl->state >= CS_ACTIVE && cl->state >= CS_ACTIVE &&

View file

@ -412,7 +412,7 @@ static void SV_AddEntitiesVisibleFromPoint( vec3_t origin, clientSnapshot_t *fra
// add it // add it
SV_AddEntToSnapshot( svEnt, ent, eNums ); 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->r.svFlags & SVF_PORTAL ) {
if ( ent->s.generic1 ) { if ( ent->s.generic1 ) {
vec3_t dir; vec3_t dir;