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",
palette = PL".palette",
palette = { PL".palette" },
-- NOTE the special case:
pals = PL"._pals[%s]",

View file

@ -314,7 +314,7 @@ __attribute__((packed)) struct {
const<W-> int8_t wantweaponfire;
const<W> int8_t curr_weapon;
uint8_t palette;
const uint8_t palette;
palette_t _pals;
int8_t _palsfadespeed, _palsfadenext, _palsfadeprio, _padding2;
@ -1542,11 +1542,11 @@ end
-- TODO: make return 1-based index?
function gv_access.currentEpisode()
return ffiC.ud.volume_number
return ffiC.ud.volume_number + 1
end
function gv_access.currentLevel()
return ffiC.ud.level_number
return ffiC.ud.level_number + 1
end
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.
// TODO: Play sound how? ("globalsound")
//////////
`gv.currentEpisode()`::
TODO
Returns the one-based number of the episode currently being played.
`gv.currentLevel()`::
TODO
//////////
Returns the one-based number of the level currently being played.
[[Lunatic_structures]]
Lunatic structures

View file

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

View file

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