diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 9eb58c655..6fb29af54 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -3393,14 +3393,12 @@ nullquote: continue; case CON_SAVEMAPSTATE: - if (MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate == NULL) - 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); + G_SaveMapState(); insptr++; continue; case CON_LOADMAPSTATE: - G_RestoreMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate); + G_RestoreMapState(); insptr++; continue; @@ -5352,8 +5350,15 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist) 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) { int32_t i; @@ -5444,10 +5449,10 @@ void G_SaveMapState(mapstate_t *save) } } -extern void Gv_RefreshPointers(void); - -void G_RestoreMapState(mapstate_t *save) +void G_RestoreMapState(void) { + mapstate_t *save = MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate; + if (save != NULL) { int32_t i, x; diff --git a/polymer/eduke32/source/gameexec.h b/polymer/eduke32/source/gameexec.h index 4155201b7..6e1f48c6e 100644 --- a/polymer/eduke32/source/gameexec.h +++ b/polymer/eduke32/source/gameexec.h @@ -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); void A_GetZLimits(int32_t iActor); int32_t G_GetAngleDelta(int32_t a,int32_t na); -void G_RestoreMapState(mapstate_t *save); -void G_SaveMapState(mapstate_t *save); +void G_RestoreMapState(); +void G_SaveMapState(); int32_t VM_OnEvent(int32_t iEventID,int32_t iActor,int32_t iPlayer,int32_t lDist, int32_t iReturn); void VM_ScriptInfo(void); diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index 1120b26c3..9cf8d467c 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -1140,16 +1140,14 @@ static int32_t osdcmd_screenshot(const osdfuncparm_t *parm) static int32_t osdcmd_savestate(const osdfuncparm_t *parm) { UNREFERENCED_PARAMETER(parm); - if (MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate == NULL) - 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); + G_SaveMapState(); return OSDCMD_OK; } static int32_t osdcmd_restorestate(const osdfuncparm_t *parm) { UNREFERENCED_PARAMETER(parm); - G_RestoreMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate); + G_RestoreMapState(); return OSDCMD_OK; } #endif diff --git a/polymer/eduke32/source/sector.h b/polymer/eduke32/source/sector.h index baa716749..5c9573e1d 100644 --- a/polymer/eduke32/source/sector.h +++ b/polymer/eduke32/source/sector.h @@ -88,8 +88,8 @@ typedef struct { #endif } mapstate_t; -extern void G_SaveMapState(mapstate_t *save); -extern void G_RestoreMapState(mapstate_t *save); +extern void G_SaveMapState(); +extern void G_RestoreMapState(); typedef struct { int32_t partime, designertime;