LunaCON: in {save,load}mapstate, warn that saving/restoring gamevars is NYI.

git-svn-id: https://svn.eduke32.com/eduke32@4118 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-10-27 21:12:20 +00:00
parent 65cdf97bfa
commit 6c88824792
8 changed files with 24 additions and 4 deletions

View file

@ -59,7 +59,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// increase by 3, because atomic GRP adds 1, and Shareware adds 2 // increase by 3, because atomic GRP adds 1, and Shareware adds 2
#ifdef LUNATIC #ifdef LUNATIC
// Lunatic // Lunatic
# define BYTEVERSION_JF 285 # define BYTEVERSION_JF 288
#else #else
// Non-Lua build // Non-Lua build
# define BYTEVERSION_JF 285 # define BYTEVERSION_JF 285

View file

@ -5557,6 +5557,8 @@ void G_SaveMapState(void)
} }
else save->vars[i] = (intptr_t *)aGameVars[i].val.lValue; else save->vars[i] = (intptr_t *)aGameVars[i].val.lValue;
} }
#else
// TODO! (Not easy.)
#endif #endif
ototalclock = totalclock; ototalclock = totalclock;
} }
@ -5661,6 +5663,8 @@ void G_RestoreMapState(void)
} }
Gv_RefreshPointers(); Gv_RefreshPointers();
#else
// TODO! (Not easy.)
#endif #endif
// Update g_player[].ps->i (sprite indices of players) to be consistent // Update g_player[].ps->i (sprite indices of players) to be consistent
// with just loaded sprites. // with just loaded sprites.

View file

@ -9,6 +9,7 @@ local jit = require("jit")
local CF = CF local CF = CF
local bit = require("bit") local bit = require("bit")
local debug = require("debug")
local io = require("io") local io = require("io")
local math = require("math") local math = require("math")
local table = require("table") local table = require("table")
@ -1832,10 +1833,18 @@ end
-- TODO: saving/restoration of per-player or per-actor gamevars. -- TODO: saving/restoration of per-player or per-actor gamevars.
function _savemapstate() function _savemapstate()
ffiC.G_SaveMapState() ffiC.G_SaveMapState()
local errmsg = debug.traceback(
"warning: savemapstate: gamevar saving not yet implemented", 2)
ffiC.El_OnError(errmsg)
print(errmsg)
end end
function _loadmapstate() function _loadmapstate()
ffiC.G_RestoreMapState() ffiC.G_RestoreMapState()
local errmsg = debug.traceback(
"warning: loadmapstate: gamevar saving not yet implemented", 2)
ffiC.El_OnError(errmsg)
print(errmsg)
end end
-- Gamevar persistence in the configuration file -- Gamevar persistence in the configuration file

View file

@ -593,6 +593,7 @@ int32_t g_RETURN;
int32_t g_elCONSize; int32_t g_elCONSize;
char *g_elCON; char *g_elCON;
void El_SetCON(const char *conluacode); void El_SetCON(const char *conluacode);
void El_OnError(const char *str);
char *g_elSavecode; char *g_elSavecode;
void El_FreeSaveCode(void); void El_FreeSaveCode(void);
@ -2286,7 +2287,7 @@ do
return "local "..modname.."."..lname return "local "..modname.."."..lname
end end
-- Call restore_local. -- Emit code to call restore_local.
sb:addrawf("F(%d,L)", li) sb:addrawf("F(%d,L)", li)
end end
end end

View file

@ -94,6 +94,7 @@ g_argv;
g_elCONSize; g_elCONSize;
g_elCON; g_elCON;
El_SetCON; El_SetCON;
El_OnError;
g_elSavecode; g_elSavecode;
El_FreeSaveCode; El_FreeSaveCode;

View file

@ -207,7 +207,7 @@ static int32_t cmp_against_others(const char *str, int32_t slen)
return 0; return 0;
} }
static void El_OnError(const char *str) LUNATIC_EXTERN void El_OnError(const char *str)
{ {
if (!el_tooMuchErrors) if (!el_tooMuchErrors)
{ {

View file

@ -2035,6 +2035,8 @@ void G_FreeMapState(int32_t mapnum)
Bfree(mapinfo->savedstate->vars[j]); Bfree(mapinfo->savedstate->vars[j]);
} }
} }
#else
Bfree(mapinfo->savedstate->savecode);
#endif #endif
Bfree(mapinfo->savedstate); Bfree(mapinfo->savedstate);
mapinfo->savedstate = NULL; mapinfo->savedstate = NULL;

View file

@ -77,8 +77,11 @@ typedef struct {
spriteext_t spriteext[MAXSPRITES]; spriteext_t spriteext[MAXSPRITES];
spritetype sprite[MAXSPRITES]; spritetype sprite[MAXSPRITES];
walltype wall[MAXWALLS]; walltype wall[MAXWALLS];
#if !defined LUNATIC
intptr_t *vars[MAXGAMEVARS]; intptr_t *vars[MAXGAMEVARS];
#else
char *savecode;
#endif
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
int32_t numyaxbunches; int32_t numyaxbunches;
# if !defined NEW_MAP_FORMAT # if !defined NEW_MAP_FORMAT