mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-21 19:21:44 +00:00
LunaCON: accept empty square brackets for {g,s}etuserdef optional index part.
git-svn-id: https://svn.eduke32.com/eduke32@4287 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
842cce37b7
commit
7c26c180cd
2 changed files with 20 additions and 7 deletions
|
@ -1852,6 +1852,8 @@ end
|
||||||
-- is kinda breaking the classic "no array nesting" rules
|
-- is kinda breaking the classic "no array nesting" rules
|
||||||
-- (if there ever were any) but making our life harder else.
|
-- (if there ever were any) but making our life harder else.
|
||||||
local arraypat = sp0 * "[" * sp0 * tok.rvar * sp0 * "]"
|
local arraypat = sp0 * "[" * sp0 * tok.rvar * sp0 * "]"
|
||||||
|
-- For {get,set}userdef:
|
||||||
|
local arraypat_maybe_empty = sp0 * "[" * sp0 * (tok.rvar * sp0)^-1 * "]"
|
||||||
|
|
||||||
-- Table of various patterns that are (parts of) more complex inner commands.
|
-- Table of various patterns that are (parts of) more complex inner commands.
|
||||||
local patt = {}
|
local patt = {}
|
||||||
|
@ -2263,7 +2265,8 @@ local handle =
|
||||||
soundonce = "_con._soundonce(_aci,%1)",
|
soundonce = "_con._soundonce(_aci,%1)",
|
||||||
}
|
}
|
||||||
|
|
||||||
local userdef_common_pat = (arraypat + sp1)/{} * lpeg.Cc(0) * lpeg.Ct(patt.singlemember) * sp1
|
local userdef_common_pat = (arraypat_maybe_empty + sp1)/{}
|
||||||
|
* lpeg.Cc(0) * lpeg.Ct(patt.singlemember) * sp1
|
||||||
|
|
||||||
-- NOTE about prefixes: most is handled by all_alt_pattern(), however commands
|
-- NOTE about prefixes: most is handled by all_alt_pattern(), however commands
|
||||||
-- that have no arguments and that are prefixes of other commands MUST be
|
-- that have no arguments and that are prefixes of other commands MUST be
|
||||||
|
|
|
@ -1,16 +1,26 @@
|
||||||
// XXX: should be allowed to override existing modes? (Probably yes.)
|
definegametype 0 46051 Cooperative, not Dukematch
|
||||||
// XXX: but currently, this ensues badness? (g_numGametypes becomes inconsistent?)
|
|
||||||
definegametype 0 46051 Cooperative
|
// NOTE: we need to define the rest anew too (or at least #4), because
|
||||||
|
// 'definegametype' does "g_numGametypes = idx+1", as opposed to
|
||||||
|
// "g_numGametypes = max(g_numGametypes, idx+1)".
|
||||||
|
definegametype 1 46051 Cooperative
|
||||||
|
definegametype 2 16410 Dukematch (no spawn)
|
||||||
|
definegametype 3 216088 Team Dukematch
|
||||||
|
definegametype 4 213018 Team Dukematch (no spawn)
|
||||||
|
|
||||||
gamevar temp 0 0
|
gamevar temp 0 0
|
||||||
|
|
||||||
// Original version by Fox, from
|
// Original version by Fox, from
|
||||||
// http://forums.duke4.net/topic/775-eduke32-20-and-polymer/page__view__findpost__p__183890
|
// http://forums.duke4.net/topic/775-eduke32-20-and-polymer/page__view__findpost__p__183890
|
||||||
onevent EVENT_DISPLAYREST
|
onevent EVENT_DISPLAYREST
|
||||||
// getuserdef[THISACTOR].statusbarscale temp
|
// Notes:
|
||||||
// NOTE: index (THISACTOR) is never used.
|
// - index (THISACTOR) is never used.
|
||||||
// NOTE: incorrect if screenpeek != myconnectindex, e.g. by pressing [K]:
|
// - incorrect if screenpeek != myconnectindex, e.g. by pressing [K]:
|
||||||
|
// - all three are equivalent:
|
||||||
|
getuserdef[THISACTOR].statusbarscale temp
|
||||||
getuserdef .statusbarscale temp
|
getuserdef .statusbarscale temp
|
||||||
|
getuserdef[].statusbarscale temp
|
||||||
|
|
||||||
redefinequote 0 %ld
|
redefinequote 0 %ld
|
||||||
qsprintf 0 0 temp
|
qsprintf 0 0 temp
|
||||||
gametext STARTALPHANUM 10 10 0 0 0 0 0 0 xdim ydim
|
gametext STARTALPHANUM 10 10 0 0 0 0 0 0 xdim ydim
|
||||||
|
|
Loading…
Reference in a new issue