Make G_{Save,Restore}MapState() take no input arguments.

Instead, MapInfo[ud.volume_number*MAXLEVELS+ud.level_number] is accessed
inside these functions.

git-svn-id: https://svn.eduke32.com/eduke32@3792 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-05-19 19:29:26 +00:00
parent 4a6fc2b94f
commit d1b1fe52d8
4 changed files with 19 additions and 16 deletions

View file

@ -3393,14 +3393,12 @@ nullquote:
continue; continue;
case CON_SAVEMAPSTATE: case CON_SAVEMAPSTATE:
if (MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate == NULL) G_SaveMapState();
MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate = (mapstate_t *)Bcalloc(1,sizeof(mapstate_t));
G_SaveMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate);
insptr++; insptr++;
continue; continue;
case CON_LOADMAPSTATE: case CON_LOADMAPSTATE:
G_RestoreMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate); G_RestoreMapState();
insptr++; insptr++;
continue; continue;
@ -5352,8 +5350,15 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
changespritestat(vm.g_i, STAT_ZOMBIEACTOR); changespritestat(vm.g_i, STAT_ZOMBIEACTOR);
} }
void G_SaveMapState(mapstate_t *save) void G_SaveMapState(void)
{ {
map_t *mapinfo = &MapInfo[ud.volume_number*MAXLEVELS+ud.level_number];
mapstate_t *save;
if (mapinfo->savedstate == NULL)
mapinfo->savedstate = Bcalloc(1,sizeof(mapstate_t));
save = mapinfo->savedstate;
if (save != NULL) if (save != NULL)
{ {
int32_t i; int32_t i;
@ -5444,10 +5449,10 @@ void G_SaveMapState(mapstate_t *save)
} }
} }
extern void Gv_RefreshPointers(void); void G_RestoreMapState(void)
void G_RestoreMapState(mapstate_t *save)
{ {
mapstate_t *save = MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate;
if (save != NULL) if (save != NULL)
{ {
int32_t i, x; int32_t i, x;

View file

@ -145,8 +145,8 @@ int32_t A_FurthestVisiblePoint(int32_t iActor,spritetype *ts,int32_t *dax,int32_
int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs); int32_t A_GetFurthestAngle(int32_t iActor,int32_t angs);
void A_GetZLimits(int32_t iActor); void A_GetZLimits(int32_t iActor);
int32_t G_GetAngleDelta(int32_t a,int32_t na); int32_t G_GetAngleDelta(int32_t a,int32_t na);
void G_RestoreMapState(mapstate_t *save); void G_RestoreMapState();
void G_SaveMapState(mapstate_t *save); void G_SaveMapState();
int32_t VM_OnEvent(int32_t iEventID,int32_t iActor,int32_t iPlayer,int32_t lDist, int32_t iReturn); int32_t VM_OnEvent(int32_t iEventID,int32_t iActor,int32_t iPlayer,int32_t lDist, int32_t iReturn);
void VM_ScriptInfo(void); void VM_ScriptInfo(void);

View file

@ -1140,16 +1140,14 @@ static int32_t osdcmd_screenshot(const osdfuncparm_t *parm)
static int32_t osdcmd_savestate(const osdfuncparm_t *parm) static int32_t osdcmd_savestate(const osdfuncparm_t *parm)
{ {
UNREFERENCED_PARAMETER(parm); UNREFERENCED_PARAMETER(parm);
if (MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate == NULL) G_SaveMapState();
MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate = Bcalloc(1,sizeof(mapstate_t));
G_SaveMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate);
return OSDCMD_OK; return OSDCMD_OK;
} }
static int32_t osdcmd_restorestate(const osdfuncparm_t *parm) static int32_t osdcmd_restorestate(const osdfuncparm_t *parm)
{ {
UNREFERENCED_PARAMETER(parm); UNREFERENCED_PARAMETER(parm);
G_RestoreMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate); G_RestoreMapState();
return OSDCMD_OK; return OSDCMD_OK;
} }
#endif #endif

View file

@ -88,8 +88,8 @@ typedef struct {
#endif #endif
} mapstate_t; } mapstate_t;
extern void G_SaveMapState(mapstate_t *save); extern void G_SaveMapState();
extern void G_RestoreMapState(mapstate_t *save); extern void G_RestoreMapState();
typedef struct { typedef struct {
int32_t partime, designertime; int32_t partime, designertime;