mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 15:21:44 +00:00
game: cleanup savegame exports
This commit is contained in:
parent
863dc290a8
commit
d88732f8da
3 changed files with 28 additions and 40 deletions
|
@ -388,7 +388,7 @@ FindMmoveByName(char *name)
|
|||
* data generated by the functions
|
||||
* below this block into files.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
WriteField1(FILE *f, field_t *field, byte *base)
|
||||
{
|
||||
void *p;
|
||||
|
@ -478,7 +478,8 @@ WriteField1(FILE *f, field_t *field, byte *base)
|
|||
|
||||
if (!func)
|
||||
{
|
||||
gi.error ("WriteField1: function not in list, can't save game");
|
||||
gi.error("%s: function not in list, can't save game",
|
||||
__func__);
|
||||
}
|
||||
|
||||
len = strlen(func->funcStr)+1;
|
||||
|
@ -498,7 +499,8 @@ WriteField1(FILE *f, field_t *field, byte *base)
|
|||
|
||||
if (!mmove)
|
||||
{
|
||||
gi.error ("WriteField1: mmove not in list, can't save game");
|
||||
gi.error("%s: mmove not in list, can't save game",
|
||||
__func__);
|
||||
}
|
||||
|
||||
len = strlen(mmove->mmoveStr)+1;
|
||||
|
@ -507,7 +509,7 @@ WriteField1(FILE *f, field_t *field, byte *base)
|
|||
*(int *)p = len;
|
||||
break;
|
||||
default:
|
||||
gi.error("WriteEdict: unknown field type");
|
||||
gi.error("%s: unknown field type", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -545,7 +547,8 @@ WriteField2(FILE *f, field_t *field, byte *base)
|
|||
|
||||
if (!func)
|
||||
{
|
||||
gi.error ("WriteField2: function not in list, can't save game");
|
||||
gi.error("%s: function not in list, can't save game",
|
||||
__func__);
|
||||
}
|
||||
|
||||
len = strlen(func->funcStr)+1;
|
||||
|
@ -560,7 +563,8 @@ WriteField2(FILE *f, field_t *field, byte *base)
|
|||
mmove = GetMmoveByAddress (*(mmove_t **)p);
|
||||
if (!mmove)
|
||||
{
|
||||
gi.error ("WriteField2: mmove not in list, can't save game");
|
||||
gi.error("%s: mmove not in list, can't save game",
|
||||
__func__);
|
||||
}
|
||||
|
||||
len = strlen(mmove->mmoveStr)+1;
|
||||
|
@ -670,15 +674,16 @@ ReadField(FILE *f, field_t *field, byte *base)
|
|||
{
|
||||
if (len > sizeof(funcStr))
|
||||
{
|
||||
gi.error ("ReadField: function name is longer than buffer (%i chars)",
|
||||
(int)sizeof(funcStr));
|
||||
gi.error("%s: function name is longer than buffer (%i chars)",
|
||||
__func__, (int)sizeof(funcStr));
|
||||
}
|
||||
|
||||
fread (funcStr, len, 1, f);
|
||||
|
||||
if ( !(*(byte **)p = FindFunctionByName (funcStr)) )
|
||||
{
|
||||
gi.error ("ReadField: function %s not found in table, can't load game", funcStr);
|
||||
gi.error("%s: function %s not found in table, can't load game",
|
||||
__func__, funcStr);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -694,21 +699,22 @@ ReadField(FILE *f, field_t *field, byte *base)
|
|||
{
|
||||
if (len > sizeof(funcStr))
|
||||
{
|
||||
gi.error ("ReadField: mmove name is longer than buffer (%i chars)",
|
||||
(int)sizeof(funcStr));
|
||||
gi.error("%s: mmove name is longer than buffer (%i chars)",
|
||||
__func__, (int)sizeof(funcStr));
|
||||
}
|
||||
|
||||
fread (funcStr, len, 1, f);
|
||||
|
||||
if ( !(*(mmove_t **)p = FindMmoveByName (funcStr)) )
|
||||
{
|
||||
gi.error ("ReadField: mmove %s not found in table, can't load game", funcStr);
|
||||
gi.error("%s: mmove %s not found in table, can't load game",
|
||||
__func__, funcStr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
gi.error("ReadEdict: unknown field type");
|
||||
gi.error("%s: unknown field type", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -717,7 +723,7 @@ ReadField(FILE *f, field_t *field, byte *base)
|
|||
/*
|
||||
* Write the client struct into a file.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
WriteClient(FILE *f, gclient_t *client)
|
||||
{
|
||||
field_t *field;
|
||||
|
@ -794,7 +800,7 @@ WriteGame(const char *filename, qboolean autosave)
|
|||
|
||||
if (!f)
|
||||
{
|
||||
gi.error("Couldn't open %s", filename);
|
||||
gi.error("%s: Couldn't open %s", __func__, filename);
|
||||
}
|
||||
|
||||
/* Savegame identification */
|
||||
|
@ -839,7 +845,7 @@ ReadGame(const char *filename)
|
|||
|
||||
if (!f)
|
||||
{
|
||||
gi.error("Couldn't open %s", filename);
|
||||
gi.error("%s: Couldn't open %s", __func__, filename);
|
||||
}
|
||||
|
||||
/* Sanity checks */
|
||||
|
@ -949,7 +955,7 @@ ReadGame(const char *filename)
|
|||
* edict into a file. Called by
|
||||
* WriteLevel.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
WriteEdict(FILE *f, edict_t *ent)
|
||||
{
|
||||
field_t *field;
|
||||
|
@ -979,7 +985,7 @@ WriteEdict(FILE *f, edict_t *ent)
|
|||
* level local data into a file.
|
||||
* Called by WriteLevel.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
WriteLevelLocals(FILE *f)
|
||||
{
|
||||
field_t *field;
|
||||
|
@ -1019,7 +1025,7 @@ WriteLevel(const char *filename)
|
|||
|
||||
if (!f)
|
||||
{
|
||||
gi.error("Couldn't open %s", filename);
|
||||
gi.error("%s: Couldn't open %s", __func__, filename);
|
||||
}
|
||||
|
||||
/* write out edict size for checking */
|
||||
|
@ -1110,7 +1116,7 @@ ReadLevel(const char *filename)
|
|||
|
||||
if (!f)
|
||||
{
|
||||
gi.error("Couldn't open %s", filename);
|
||||
gi.error("%s: Couldn't open %s", __func__, filename);
|
||||
}
|
||||
|
||||
/* free any dynamic memory allocated by
|
||||
|
@ -1127,7 +1133,7 @@ ReadLevel(const char *filename)
|
|||
if (i != sizeof(edict_t))
|
||||
{
|
||||
fclose(f);
|
||||
gi.error("ReadLevel: mismatched edict size");
|
||||
gi.error("%s: mismatched edict size", __func__);
|
||||
}
|
||||
|
||||
/* load the level locals */
|
||||
|
@ -1139,7 +1145,7 @@ ReadLevel(const char *filename)
|
|||
if (fread(&entnum, sizeof(entnum), 1, f) != 1)
|
||||
{
|
||||
fclose(f);
|
||||
gi.error("ReadLevel: failed to read entnum");
|
||||
gi.error("%s: failed to read entnum", __func__);
|
||||
}
|
||||
|
||||
if (entnum == -1)
|
||||
|
|
|
@ -255,8 +255,6 @@ extern void Hunter_Launch ( edict_t * self ) ;
|
|||
extern void InfantryMachineGun ( edict_t * self ) ;
|
||||
extern void InitClientPersistant ( gclient_t * client ) ;
|
||||
extern void InitClientResp ( gclient_t * client ) ;
|
||||
extern void InitGame ( void ) ;
|
||||
extern void InitGameRules ( void ) ;
|
||||
extern void InitHintPaths ( void ) ;
|
||||
extern void InitItems ( void ) ;
|
||||
extern void InitTrigger ( edict_t * self ) ;
|
||||
|
@ -662,13 +660,6 @@ extern void WidowSaveLoc ( edict_t * self ) ;
|
|||
extern void WidowSpawn ( edict_t * self ) ;
|
||||
extern void WidowVelocityForDamage ( int damage , vec3_t v ) ;
|
||||
extern void Widowlegs_Spawn ( vec3_t startpos , vec3_t angles ) ;
|
||||
extern void WriteClient ( FILE * f , gclient_t * client ) ;
|
||||
extern void WriteEdict ( FILE * f , edict_t * ent ) ;
|
||||
extern void WriteField1 ( FILE * f , field_t * field , byte * base ) ;
|
||||
extern void WriteField2 ( FILE * f , field_t * field , byte * base ) ;
|
||||
extern void WriteGame ( const char * filename , qboolean autosave ) ;
|
||||
extern void WriteLevel ( const char * filename ) ;
|
||||
extern void WriteLevelLocals ( FILE * f ) ;
|
||||
extern void abortHeal ( edict_t *self, qboolean change_frame, qboolean gib, qboolean mark ) ;
|
||||
extern void actorMachineGun ( edict_t * self ) ;
|
||||
extern void actor_attack ( edict_t * self ) ;
|
||||
|
|
|
@ -150,8 +150,6 @@
|
|||
{"InitBodyQue", (byte *)InitBodyQue},
|
||||
{"InitClientPersistant", (byte *)InitClientPersistant},
|
||||
{"InitClientResp", (byte *)InitClientResp},
|
||||
{"InitGame", (byte *)InitGame},
|
||||
{"InitGameRules", (byte *)InitGameRules},
|
||||
{"InitHintPaths", (byte *)InitHintPaths},
|
||||
{"InitItems", (byte *)InitItems},
|
||||
{"InitTrigger", (byte *)InitTrigger},
|
||||
|
@ -607,13 +605,6 @@
|
|||
{"WidowVelocityForDamage", (byte *)WidowVelocityForDamage},
|
||||
{"Widow_CheckAttack", (byte *)Widow_CheckAttack},
|
||||
{"Widowlegs_Spawn", (byte *)Widowlegs_Spawn},
|
||||
{"WriteClient", (byte *)WriteClient},
|
||||
{"WriteEdict", (byte *)WriteEdict},
|
||||
{"WriteField1", (byte *)WriteField1},
|
||||
{"WriteField2", (byte *)WriteField2},
|
||||
{"WriteGame", (byte *)WriteGame},
|
||||
{"WriteLevel", (byte *)WriteLevel},
|
||||
{"WriteLevelLocals", (byte *)WriteLevelLocals},
|
||||
{"abortHeal", (byte *)abortHeal},
|
||||
{"actorMachineGun", (byte *)actorMachineGun},
|
||||
{"actor_attack", (byte *)actor_attack},
|
||||
|
|
Loading…
Reference in a new issue