Refactoring patch by DevHC
This commit is contained in:
parent
86d96f12b9
commit
a9696d3558
7 changed files with 19 additions and 36 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue