Lunatic: make gv.current{Level,Episode} one-based and document them.

Also, in LunaCON, make player .palette member read-only. BUILD_LUNATIC.

git-svn-id: https://svn.eduke32.com/eduke32@4260 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-01-15 20:29:10 +00:00
parent b79ee42553
commit 14db86ebb5
5 changed files with 10 additions and 11 deletions

View file

@ -649,7 +649,7 @@ local PlayerLabels = {
curr_weapon = PL".curr_weapon", curr_weapon = PL".curr_weapon",
palette = PL".palette", palette = { PL".palette" },
-- NOTE the special case: -- NOTE the special case:
pals = PL"._pals[%s]", pals = PL"._pals[%s]",

View file

@ -314,7 +314,7 @@ __attribute__((packed)) struct {
const<W-> int8_t wantweaponfire; const<W-> int8_t wantweaponfire;
const<W> int8_t curr_weapon; const<W> int8_t curr_weapon;
uint8_t palette; const uint8_t palette;
palette_t _pals; palette_t _pals;
int8_t _palsfadespeed, _palsfadenext, _palsfadeprio, _padding2; int8_t _palsfadespeed, _palsfadenext, _palsfadeprio, _padding2;
@ -1542,11 +1542,11 @@ end
-- TODO: make return 1-based index? -- TODO: make return 1-based index?
function gv_access.currentEpisode() function gv_access.currentEpisode()
return ffiC.ud.volume_number return ffiC.ud.volume_number + 1
end end
function gv_access.currentLevel() function gv_access.currentLevel()
return ffiC.ud.level_number return ffiC.ud.level_number + 1
end end
function gv_access.doQuake(gametics, snd) function gv_access.doQuake(gametics, snd)

View file

@ -419,12 +419,11 @@ etc. for the next `gametics` game tics. If a sound index `snd` is passed, also
start playing that sound. start playing that sound.
// TODO: Play sound how? ("globalsound") // TODO: Play sound how? ("globalsound")
//////////
`gv.currentEpisode()`:: `gv.currentEpisode()`::
TODO Returns the one-based number of the episode currently being played.
`gv.currentLevel()`:: `gv.currentLevel()`::
TODO Returns the one-based number of the level currently being played.
//////////
[[Lunatic_structures]] [[Lunatic_structures]]
Lunatic structures Lunatic structures

View file

@ -427,8 +427,8 @@ local function new_initial_gvartab()
WEAPON = PRO(PLSX".curr_weapon"), WEAPON = PRO(PLSX".curr_weapon"),
WORKSLIKE = PRO(format(PLSX".weapon[%s].workslike", PLSX".curr_weapon")), WORKSLIKE = PRO(format(PLSX".weapon[%s].workslike", PLSX".curr_weapon")),
VOLUME = RO "_gv.currentEpisode()", VOLUME = RO "_gv._ud.volume_number",
LEVEL = RO "_gv.currentLevel()", LEVEL = RO "_gv._ud.level_number",
} }
-- Reserved bits -- Reserved bits

View file

@ -50,7 +50,7 @@ gameevent
"ENTERLEVEL", "ENTERLEVEL",
function() function()
local vol, lev = gv.currentEpisode()+1, gv.currentLevel()+1 local vol, lev = gv.currentEpisode(), gv.currentLevel()
printf('volume=%d, level=%d', vol, lev) printf('volume=%d, level=%d', vol, lev)
if (vol ~= 4) then if (vol ~= 4) then