mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-22 11:31:11 +00:00
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:
parent
5868097deb
commit
76299ca635
5 changed files with 52 additions and 3 deletions
|
@ -1646,6 +1646,16 @@ function _setgamepalette(pli, basepal)
|
||||||
ffiC.P_SetGamePalette(player[pli], basepal, 2+16)
|
ffiC.P_SetGamePalette(player[pli], basepal, 2+16)
|
||||||
end
|
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
|
-- Gamevar persistence in the configuration file
|
||||||
|
|
||||||
function _savegamevar(name, val)
|
function _savegamevar(name, val)
|
||||||
|
|
|
@ -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 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 s, int32_t p, int32_t o,
|
||||||
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z);
|
int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t z);
|
||||||
|
|
||||||
|
void G_SaveMapState(void);
|
||||||
|
void G_RestoreMapState(void);
|
||||||
]]
|
]]
|
||||||
|
|
||||||
decl[[
|
decl[[
|
||||||
|
|
|
@ -195,4 +195,7 @@ S_ChangeSoundPitch;
|
||||||
minitext_;
|
minitext_;
|
||||||
G_DrawTXDigiNumZ;
|
G_DrawTXDigiNumZ;
|
||||||
G_PrintGameText;
|
G_PrintGameText;
|
||||||
|
|
||||||
|
G_SaveMapState;
|
||||||
|
G_RestoreMapState;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2165,11 +2165,11 @@ local Cinner = {
|
||||||
|
|
||||||
-- Persistence
|
-- Persistence
|
||||||
clearmapstate = cmd(R)
|
clearmapstate = cmd(R)
|
||||||
/ handle.dynNYI,
|
/ handle.NYI,
|
||||||
loadmapstate = cmd()
|
loadmapstate = cmd()
|
||||||
/ handle.dynNYI,
|
/ "_con._loadmapstate()",
|
||||||
savemapstate = cmd()
|
savemapstate = cmd()
|
||||||
/ handle.dynNYI,
|
/ "_con._savemapstate()",
|
||||||
savegamevar = cmd(I)
|
savegamevar = cmd(I)
|
||||||
/ function(id) return handle.RSgamevar(id, true) end,
|
/ function(id) return handle.RSgamevar(id, true) end,
|
||||||
readgamevar = cmd(I)
|
readgamevar = cmd(I)
|
||||||
|
|
33
polymer/eduke32/source/lunatic/test/mapstate.con
Normal file
33
polymer/eduke32/source/lunatic/test/mapstate.con
Normal 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
|
Loading…
Reference in a new issue