Lunatic: on the Lua side, rename gv.g_RETURN to the prettier gv.RETURN.

On the C side, keep the name g_RETURN. I'm still superstitious about
dropping the "g_".

git-svn-id: https://svn.eduke32.com/eduke32@4031 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-08-23 17:01:10 +00:00
parent 55a3cda9e1
commit 15bcfe3f34
3 changed files with 18 additions and 14 deletions

View file

@ -581,7 +581,6 @@ ffi.cdef[[
const int32_t screenpeek; const int32_t screenpeek;
hudweapon_t hudweap; hudweapon_t hudweap;
int32_t g_logoFlags; int32_t g_logoFlags;
int32_t g_RETURN;
]] ]]
-- INTERNAL VARIABLES/FUNCTIONS -- INTERNAL VARIABLES/FUNCTIONS
@ -589,6 +588,7 @@ decl("map_t MapInfo[$*$];", con_lang.MAXVOLUMES+1, con_lang.MAXLEVELS)
decl("char EpisodeNames[$][33];", con_lang.MAXVOLUMES) decl("char EpisodeNames[$][33];", con_lang.MAXVOLUMES)
decl[[ decl[[
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);
@ -2342,9 +2342,11 @@ end
-- Map of 'gv' variable names to C ones. -- Map of 'gv' variable names to C ones.
local varnameMap = { local varnameMap = {
gametic = "g_moveThingsCount", gametic = "g_moveThingsCount",
RETURN = "g_RETURN",
} }
gv_access.gametic = true gv_access.gametic = true
gv_access.RETURN = true
local tmpmt = { local tmpmt = {
__index = function(_, key) __index = function(_, key)
@ -2365,6 +2367,8 @@ local tmpmt = {
if (gv_access[key] == nil) then if (gv_access[key] == nil) then
-- Variables declared 'const' are handled by LuaJIT. -- Variables declared 'const' are handled by LuaJIT.
ffiC[key] = val ffiC[key] = val
elseif (varnameMap[key]) then
ffiC[varnameMap[key]] = val
else else
error("write access forbidden", 2) error("write access forbidden", 2)
end end

View file

@ -347,7 +347,7 @@ local function new_initial_gvartab()
-- NOTE: THISACTOR can mean different things in some contexts. -- NOTE: THISACTOR can mean different things in some contexts.
THISACTOR = RO "_aci", THISACTOR = RO "_aci",
RETURN = RW "_gv.g_RETURN", RETURN = RW "_gv.RETURN",
HITAG = RW(CSV".HITAG"), HITAG = RW(CSV".HITAG"),
LOTAG = RW(CSV".LOTAG"), LOTAG = RW(CSV".LOTAG"),
TEXTURE = RW(CSV".TEXTURE"), TEXTURE = RW(CSV".TEXTURE"),
@ -2277,7 +2277,7 @@ local Cinner = {
operatemasterswitches = cmd(R) operatemasterswitches = cmd(R)
/ "_con._G_OperateMasterSwitches(%1)", / "_con._G_OperateMasterSwitches(%1)",
checkactivatormotion = cmd(R) checkactivatormotion = cmd(R)
/ "_gv.g_RETURN=_con._checkactivatormotion(%1)", / "_gv.RETURN=_con._checkactivatormotion(%1)",
time = cmd(R) -- no-op time = cmd(R) -- no-op
/ "", / "",
inittimer = cmd(R) inittimer = cmd(R)
@ -2350,17 +2350,17 @@ local Cinner = {
spawn = cmd(D) spawn = cmd(D)
/ "_con.spawn(%1,_aci)", / "_con.spawn(%1,_aci)",
espawn = cmd(D) espawn = cmd(D)
/ "_gv.g_RETURN=_con.spawn(%1,_aci)", / "_gv.RETURN=_con.spawn(%1,_aci)",
espawnvar = cmd(R) espawnvar = cmd(R)
/ "_gv.g_RETURN=_con.spawn(%1,_aci)", / "_gv.RETURN=_con.spawn(%1,_aci)",
qspawn = cmd(D) qspawn = cmd(D)
/ "_con.spawn(%1,_aci,true)", / "_con.spawn(%1,_aci,true)",
qspawnvar = cmd(R) qspawnvar = cmd(R)
/ "_con.spawn(%1,_aci,true)", / "_con.spawn(%1,_aci,true)",
eqspawn = cmd(D) eqspawn = cmd(D)
/ "_gv.g_RETURN=_con.spawn(%1,_aci,true)", / "_gv.RETURN=_con.spawn(%1,_aci,true)",
eqspawnvar = cmd(R) eqspawnvar = cmd(R)
/ "_gv.g_RETURN=_con.spawn(%1,_aci,true)", / "_gv.RETURN=_con.spawn(%1,_aci,true)",
angoff = cmd(D) angoff = cmd(D)
/ "spriteext[_aci].angoff=%1", / "spriteext[_aci].angoff=%1",
@ -2390,13 +2390,13 @@ local Cinner = {
/ ACS".timetosleep=%1", / ACS".timetosleep=%1",
eshoot = cmd(D) eshoot = cmd(D)
/ "_gv.g_RETURN=_con._shoot(_aci,%1)", / "_gv.RETURN=_con._shoot(_aci,%1)",
eshootvar = cmd(R) eshootvar = cmd(R)
/ "_gv.g_RETURN=_con._shoot(_aci,%1)", / "_gv.RETURN=_con._shoot(_aci,%1)",
ezshoot = cmd(R,D) ezshoot = cmd(R,D)
/ "_gv.g_RETURN=_con._shoot(_aci,%2,%1)", / "_gv.RETURN=_con._shoot(_aci,%2,%1)",
ezshootvar = cmd(R,R) ezshootvar = cmd(R,R)
/ "_gv.g_RETURN=_con._shoot(_aci,%2,%1)", / "_gv.RETURN=_con._shoot(_aci,%2,%1)",
shoot = cmd(D) shoot = cmd(D)
/ "_con._shoot(_aci,%1)", / "_con._shoot(_aci,%1)",
shootvar = cmd(R) shootvar = cmd(R)
@ -2439,9 +2439,9 @@ local Cinner = {
-- player/sprite searching -- player/sprite searching
findplayer = cmd(W) findplayer = cmd(W)
/ "_gv.g_RETURN,%1=_con._findplayer(_pli,_aci)", -- player index, distance / "_gv.RETURN,%1=_con._findplayer(_pli,_aci)", -- player index, distance
findotherplayer = cmd(W) findotherplayer = cmd(W)
/ "_gv.g_RETURN,%1=0,0x7fffffff", -- TODO_MP / "_gv.RETURN,%1=0,0x7fffffff", -- TODO_MP
findnearspritezvar = cmd(D,R,R,W) findnearspritezvar = cmd(D,R,R,W)
/ "%4=_con._findnear(_aci,true,'z',%1,%2,%3)", / "%4=_con._findnear(_aci,true,'z',%1,%2,%3)",
findnearspritez = cmd(D,D,D,W) findnearspritez = cmd(D,D,D,W)

View file

@ -628,7 +628,7 @@ gameevent
function (aci, pli) function (aci, pli)
local ps = player[pli] local ps = player[pli]
local neww, curw = gv.g_RETURN, ps.curr_weapon local neww, curw = gv.RETURN, ps.curr_weapon
local r, g, b = testbit(neww, 1), testbit(neww, 2), testbit(neww, 4) local r, g, b = testbit(neww, 1), testbit(neww, 2), testbit(neww, 4)
local speed = FADE_SPEED[neww] or 1 local speed = FADE_SPEED[neww] or 1