mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Lunatic: fix stuff after last commits; translator: clean up -f parsing code.
Also, implement 'cmenu' in LunaCON, make 'definequote' also allowed as inner command. git-svn-id: https://svn.eduke32.com/eduke32@3656 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6c7e835fb0
commit
d1280de362
5 changed files with 56 additions and 35 deletions
|
@ -24,7 +24,8 @@ MAXSOUNDS = 4096
|
||||||
-- For Lunatic, MAXQUOTES is OBITQUOTEINDEX because starting from that index
|
-- For Lunatic, MAXQUOTES is OBITQUOTEINDEX because starting from that index
|
||||||
-- are obituary and suicide quotes which are passed as *format strings* to
|
-- are obituary and suicide quotes which are passed as *format strings* to
|
||||||
-- sprintf() in C.
|
-- sprintf() in C.
|
||||||
MAXQUOTES = 16384-128
|
REALMAXQUOTES = 16384
|
||||||
|
MAXQUOTES = REALMAXQUOTES-128
|
||||||
MAXQUOTELEN = 128
|
MAXQUOTELEN = 128
|
||||||
|
|
||||||
local STR = {
|
local STR = {
|
||||||
|
@ -606,7 +607,7 @@ local PlayerLabels = {
|
||||||
|
|
||||||
tipincs = PL".tipincs",
|
tipincs = PL".tipincs",
|
||||||
hbomb_hold_delay = PL".hbomb_hold_delay",
|
hbomb_hold_delay = PL".hbomb_hold_delay",
|
||||||
frag_ps = { PL".frag_ps" },
|
frag_ps = PL".frag_ps",
|
||||||
kickback_pic = PL".kickback_pic",
|
kickback_pic = PL".kickback_pic",
|
||||||
|
|
||||||
gm = PL".gm",
|
gm = PL".gm",
|
||||||
|
|
|
@ -467,7 +467,7 @@ end
|
||||||
--- the C functions.)
|
--- the C functions.)
|
||||||
|
|
||||||
-- quotes
|
-- quotes
|
||||||
local MAXQUOTES = con_lang.MAXQUOTES
|
local REALMAXQUOTES = con_lang.REALMAXQUOTES
|
||||||
local MAXQUOTELEN = con_lang.MAXQUOTELEN
|
local MAXQUOTELEN = con_lang.MAXQUOTELEN
|
||||||
|
|
||||||
-- CON redefinequote command
|
-- CON redefinequote command
|
||||||
|
@ -483,7 +483,7 @@ end
|
||||||
function _quote(pli, qnum)
|
function _quote(pli, qnum)
|
||||||
bcheck.quote_idx(qnum)
|
bcheck.quote_idx(qnum)
|
||||||
check_player_idx(pli)
|
check_player_idx(pli)
|
||||||
ffiC.P_DoQuote(qnum+MAXQUOTES, ffiC.g_player[pli].ps)
|
ffiC.P_DoQuote(qnum+REALMAXQUOTES, ffiC.g_player[pli].ps)
|
||||||
end
|
end
|
||||||
|
|
||||||
function _echo(qnum)
|
function _echo(qnum)
|
||||||
|
@ -938,7 +938,7 @@ function _addinventory(ps, inv, amount, i)
|
||||||
end
|
end
|
||||||
-- NOTE: this is more permissive than CON, e.g. allows
|
-- NOTE: this is more permissive than CON, e.g. allows
|
||||||
-- GET_DUMMY1 too.
|
-- GET_DUMMY1 too.
|
||||||
ps:set_inv_amount(inv, amount)
|
ps.inv_amount[inv] = amount
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -620,6 +620,7 @@ void G_GetTimeDate(int32_t *vals);
|
||||||
int32_t G_ToggleWallInterpolation(int32_t w, int32_t doset);
|
int32_t G_ToggleWallInterpolation(int32_t w, int32_t doset);
|
||||||
int32_t G_StartTrack(int32_t level);
|
int32_t G_StartTrack(int32_t level);
|
||||||
int32_t VM_CheckSquished2(int32_t i, int32_t snum);
|
int32_t VM_CheckSquished2(int32_t i, int32_t snum);
|
||||||
|
void M_ChangeMenu(int32_t cm);
|
||||||
|
|
||||||
const char *KB_ScanCodeToString(uint8_t scancode);
|
const char *KB_ScanCodeToString(uint8_t scancode);
|
||||||
|
|
||||||
|
@ -1182,6 +1183,10 @@ function gv_access._currentMenu()
|
||||||
return ffiC.g_currentMenu
|
return ffiC.g_currentMenu
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function gv_access._changeMenu(cm)
|
||||||
|
ffiC.M_ChangeMenu(cm)
|
||||||
|
end
|
||||||
|
|
||||||
function gv_access._set_guniqhudid(id)
|
function gv_access._set_guniqhudid(id)
|
||||||
local MAXUNIQHUDID = 256 -- KEEPINSYNC build.h
|
local MAXUNIQHUDID = 256 -- KEEPINSYNC build.h
|
||||||
if (id >= MAXUNIQHUDID+0ULL) then
|
if (id >= MAXUNIQHUDID+0ULL) then
|
||||||
|
|
|
@ -172,6 +172,7 @@ G_GetTimeDate;
|
||||||
G_ToggleWallInterpolation;
|
G_ToggleWallInterpolation;
|
||||||
G_StartTrack;
|
G_StartTrack;
|
||||||
VM_CheckSquished2;
|
VM_CheckSquished2;
|
||||||
|
M_ChangeMenu;
|
||||||
|
|
||||||
KB_ScanCodeToString;
|
KB_ScanCodeToString;
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ local g_warn = { ["not-redefined"]=true, ["bad-identifier"]=false,
|
||||||
|
|
||||||
-- Code generation and output options.
|
-- Code generation and output options.
|
||||||
local g_cgopt = { ["no"]=false, ["debug-lineinfo"]=false, ["gendir"]=nil,
|
local g_cgopt = { ["no"]=false, ["debug-lineinfo"]=false, ["gendir"]=nil,
|
||||||
["cache-sap"]=false, ["no-error-nostate"]=false, }
|
["cache-sap"]=false, ["error-nostate"]=true, }
|
||||||
local function csapp() return g_cgopt["cache-sap"] end
|
local function csapp() return g_cgopt["cache-sap"] end
|
||||||
|
|
||||||
-- How many 'if' statements are following immediately each other,
|
-- How many 'if' statements are following immediately each other,
|
||||||
|
@ -929,7 +929,7 @@ function Cmd.definegamefuncname(idx, name)
|
||||||
|
|
||||||
assert(type(name)=="string")
|
assert(type(name)=="string")
|
||||||
-- XXX: in place of C-CON's "invalid character in function name" report:
|
-- XXX: in place of C-CON's "invalid character in function name" report:
|
||||||
name:gsub("[^A-Za-z0-9]", "_")
|
name = name:gsub("[^A-Za-z0-9]", "_")
|
||||||
|
|
||||||
if (ffi) then
|
if (ffi) then
|
||||||
ffiC.C_DefineGameFuncName(idx, name)
|
ffiC.C_DefineGameFuncName(idx, name)
|
||||||
|
@ -944,7 +944,7 @@ end
|
||||||
function Cmd.definequote(qnum, quotestr)
|
function Cmd.definequote(qnum, quotestr)
|
||||||
if (not (qnum >= 0 and qnum < conl.MAXQUOTES)) then
|
if (not (qnum >= 0 and qnum < conl.MAXQUOTES)) then
|
||||||
errprintf("quote number is negative or exceeds limit of %d.", conl.MAXQUOTES-1)
|
errprintf("quote number is negative or exceeds limit of %d.", conl.MAXQUOTES-1)
|
||||||
return
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
quotestr = stripws(quotestr)
|
quotestr = stripws(quotestr)
|
||||||
|
@ -960,6 +960,7 @@ function Cmd.definequote(qnum, quotestr)
|
||||||
end
|
end
|
||||||
|
|
||||||
g_data.quote[qnum] = quotestr
|
g_data.quote[qnum] = quotestr
|
||||||
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
function Cmd.defineprojectile(tilenum, what, val)
|
function Cmd.defineprojectile(tilenum, what, val)
|
||||||
|
@ -1784,7 +1785,7 @@ local handle =
|
||||||
|
|
||||||
state = function(statename)
|
state = function(statename)
|
||||||
if (g_funcname[statename]==nil) then
|
if (g_funcname[statename]==nil) then
|
||||||
local warn = g_cgopt["no-error-nostate"]
|
local warn = not g_cgopt["error-nostate"]
|
||||||
local xprintf = warn and warnprintf or errprintf
|
local xprintf = warn and warnprintf or errprintf
|
||||||
|
|
||||||
xprintf("state `%s' not found.", statename)
|
xprintf("state `%s' not found.", statename)
|
||||||
|
@ -1952,7 +1953,7 @@ local Cinner = {
|
||||||
jump = cmd(R)
|
jump = cmd(R)
|
||||||
/ handle.NYI, -- will never be
|
/ handle.NYI, -- will never be
|
||||||
cmenu = cmd(R)
|
cmenu = cmd(R)
|
||||||
/ handle.NYI,
|
/ "_gv._changeMenu(%1)",
|
||||||
checkavailweapon = cmd(R) -- THISACTOR
|
checkavailweapon = cmd(R) -- THISACTOR
|
||||||
/ function(pli)
|
/ function(pli)
|
||||||
return format("_con._checkavailweapon(%s)", thisactor_to_pli(pli))
|
return format("_con._checkavailweapon(%s)", thisactor_to_pli(pli))
|
||||||
|
@ -2284,6 +2285,11 @@ local Cinner = {
|
||||||
prevspritestat = cmd(W,R)
|
prevspritestat = cmd(W,R)
|
||||||
/ "%1=sprite._prevspritestat[%2]",
|
/ "%1=sprite._prevspritestat[%2]",
|
||||||
|
|
||||||
|
-- NOTE: Yup, it's also an inner command. Do this one concession to
|
||||||
|
-- cleanness for backward compatibility (e.g. Sonic3D v0.3).
|
||||||
|
definequote = sp1 * tok.define * newline_term_string
|
||||||
|
/ Cmd.definequote,
|
||||||
|
|
||||||
redefinequote = sp1 * tok.define * newline_term_string
|
redefinequote = sp1 * tok.define * newline_term_string
|
||||||
/ function(qnum, qstr) return format("_con._definequote(%d,%q)", qnum, stripws(qstr)) end,
|
/ function(qnum, qstr) return format("_con._definequote(%d,%q)", qnum, stripws(qstr)) end,
|
||||||
rotatesprite = cmd(R,R,R,R,R,R,R,R,R,R,R,R) -- 12R
|
rotatesprite = cmd(R,R,R,R,R,R,R,R,R,R,R,R) -- 12R
|
||||||
|
@ -2461,7 +2467,7 @@ local Cif = {
|
||||||
ifnotmoving = cmd()
|
ifnotmoving = cmd()
|
||||||
/ "_band(actor[_aci]._movflag,49152)>16384",
|
/ "_band(actor[_aci]._movflag,49152)>16384",
|
||||||
ifnosounds = cmd()
|
ifnosounds = cmd()
|
||||||
/ "not _con._ianysound()",
|
/ "not _con._ianysound(_aci)",
|
||||||
ifmultiplayer = cmd()
|
ifmultiplayer = cmd()
|
||||||
/ "false", -- TODO_MP
|
/ "false", -- TODO_MP
|
||||||
ifinwater = cmd()
|
ifinwater = cmd()
|
||||||
|
@ -3193,12 +3199,12 @@ local function handle_cmdline_arg(str)
|
||||||
local ok = false
|
local ok = false
|
||||||
local kind = str:sub(2,2)
|
local kind = str:sub(2,2)
|
||||||
|
|
||||||
|
-- -W(no-)*: warnings
|
||||||
if (kind=="W" and #str >= 3) then
|
if (kind=="W" and #str >= 3) then
|
||||||
-- warnings
|
|
||||||
local val = true
|
local val = true
|
||||||
local warnstr = str:sub(3)
|
local warnstr = str:sub(3)
|
||||||
|
|
||||||
if (#warnstr >= 4 and warnstr:sub(1,3)=="no-") then
|
if (warnstr:sub(1,3)=="no-") then
|
||||||
val = false
|
val = false
|
||||||
warnstr = warnstr:sub(4)
|
warnstr = warnstr:sub(4)
|
||||||
end
|
end
|
||||||
|
@ -3207,31 +3213,39 @@ local function handle_cmdline_arg(str)
|
||||||
g_warn[warnstr] = val
|
g_warn[warnstr] = val
|
||||||
ok = true
|
ok = true
|
||||||
end
|
end
|
||||||
elseif (str:sub(2,4)=="fno") then -- NOTE: not ":sub(2)"
|
|
||||||
-- Disable printing code.
|
-- -fno* special handling
|
||||||
if (#str >= 5 and str:sub(5)=="=onlycheck") then
|
elseif (str:sub(2)=="fno") then
|
||||||
g_cgopt["no"] = "onlycheck"
|
-- Disable printing code entirely.
|
||||||
ok = true
|
|
||||||
else
|
|
||||||
g_cgopt["no"] = true
|
g_cgopt["no"] = true
|
||||||
ok = true
|
ok = true
|
||||||
end
|
elseif (str:sub(2)=="fno=onlycheck") then
|
||||||
elseif (str:sub(2,8)=="fgendir") then
|
-- Disable printing code, only do syntax check of gen'd code.
|
||||||
if (#str >= 10 and str:sub(9,9)=="=") then
|
g_cgopt["no"] = "onlycheck"
|
||||||
|
ok = true
|
||||||
|
|
||||||
|
-- -fgendir=<directory>: specify directory for generated code
|
||||||
|
elseif (str:sub(2,9)=="fgendir=" and #str >= 10) then
|
||||||
g_cgopt["gendir"] = str:sub(10)
|
g_cgopt["gendir"] = str:sub(10)
|
||||||
ok = true
|
ok = true
|
||||||
|
|
||||||
|
-- -f(no-)*: code generation options
|
||||||
|
elseif (kind=="f" and #str >= 3) then
|
||||||
|
local val = true
|
||||||
|
local cgstr = str:sub(3)
|
||||||
|
|
||||||
|
if (cgstr:sub(1,3)=="no-") then
|
||||||
|
val = false
|
||||||
|
cgstr = cgstr:sub(4)
|
||||||
end
|
end
|
||||||
elseif (str:sub(2)=="fcache-sap") then
|
|
||||||
g_cgopt["cache-sap"] = true
|
if (type(g_cgopt[cgstr])=="boolean") then
|
||||||
ok = true
|
g_cgopt[cgstr] = val
|
||||||
elseif (str:sub(2)=="fno-error-nostate") then
|
|
||||||
g_cgopt["no-error-nostate"] = true
|
|
||||||
ok = true
|
|
||||||
elseif (str:sub(2)=="fdebug-lineinfo") then
|
|
||||||
g_cgopt["debug-lineinfo"] = true
|
|
||||||
ok = true
|
ok = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- -I<directory>: default search directory (only ONCE, not search path)
|
||||||
elseif (kind=="I" and #str >= 3) then
|
elseif (kind=="I" and #str >= 3) then
|
||||||
-- default directory (only ONCE, not search path)
|
|
||||||
g_defaultDir = str:sub(3)
|
g_defaultDir = str:sub(3)
|
||||||
ok = true
|
ok = true
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue