LunaCON: partially implement {save,load}mapstate CON commands.

What is missing is saving and restoring per-player and per-actor gamevars.
Also add a test CON mutator 'mapstate.con'.

git-svn-id: https://svn.eduke32.com/eduke32@3794 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-05-20 19:31:34 +00:00
parent 5868097deb
commit 76299ca635
5 changed files with 52 additions and 3 deletions

View file

@ -1646,6 +1646,16 @@ function _setgamepalette(pli, basepal)
ffiC.P_SetGamePalette(player[pli], basepal, 2+16)
end
-- Map state persistence.
-- TODO: saving/restoration of per-player or per-actor gamevars.
function _savemapstate()
ffiC.G_SaveMapState()
end
function _loadmapstate()
ffiC.G_RestoreMapState()
end
-- Gamevar persistence in the configuration file
function _savegamevar(name, val)

View file

@ -641,6 +641,9 @@ void G_DrawTXDigiNumZ(int32_t starttile, int32_t x,int32_t y,int32_t n,int32_t s
int32_t G_PrintGameText(int32_t f, int32_t tile, int32_t x, int32_t y, const char *t,
int32_t s, int32_t p, int32_t o,
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z);
void G_SaveMapState(void);
void G_RestoreMapState(void);
]]
decl[[

View file

@ -195,4 +195,7 @@ S_ChangeSoundPitch;
minitext_;
G_DrawTXDigiNumZ;
G_PrintGameText;
G_SaveMapState;
G_RestoreMapState;
};

View file

@ -2165,11 +2165,11 @@ local Cinner = {
-- Persistence
clearmapstate = cmd(R)
/ handle.dynNYI,
/ handle.NYI,
loadmapstate = cmd()
/ handle.dynNYI,
/ "_con._loadmapstate()",
savemapstate = cmd()
/ handle.dynNYI,
/ "_con._savemapstate()",
savegamevar = cmd(I)
/ function(id) return handle.RSgamevar(id, true) end,
readgamevar = cmd(I)

View file

@ -0,0 +1,33 @@
// Map state test.
// To warp to a particular map, press the steroids key.
// Volume: player angle / 512, displayed on screen.
// Level: current weapon.
define Q 400
definequote Q ====== TEMP =======
definequote 401 VOLUME %d
state calcvolume
getplayer[THISACTOR].ang gs
andvar gs 2047
divvar gs 512
ends
onevent EVENT_DISPLAYREST
state calcvolume
qsprintf Q /*<-*/ 401 /**/ gs
gametext STARTALPHANUM 20 20 Q 0 0 0 0 0 xdim ydim
endevent
onevent EVENT_USESTEROIDS
savemapstate
state calcvolume
startlevel gs currentweapon
endevent
onevent EVENT_ENTERLEVEL
loadmapstate
endevent