mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-14 08:30:58 +00:00
LunaCON: warn if a 'spriteflags' is issued after its actor definition...
... or another 'spriteflags' or 'sprite*' directive. git-svn-id: https://svn.eduke32.com/eduke32@4373 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6908ce6be7
commit
c3ff173553
2 changed files with 22 additions and 7 deletions
|
@ -4570,7 +4570,6 @@ static int32_t C_ParseCommand(int32_t loop)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: may remove bits set in A_InitEnemyFlags!
|
|
||||||
g_tile[j].flags = *g_scriptPtr;
|
g_tile[j].flags = *g_scriptPtr;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -481,8 +481,11 @@ function reset.codegen()
|
||||||
|
|
||||||
g_have_file = {}
|
g_have_file = {}
|
||||||
g_curcode = new_initial_codetab()
|
g_curcode = new_initial_codetab()
|
||||||
-- [{actor, event, actor}num]=gencode_table
|
-- actor, event, loadactor: [{actor, event, actor}num] = gencode_table
|
||||||
g_code = { actor={}, event={}, loadactor={} }
|
--
|
||||||
|
-- aflagsloc[actornum]: location of '(user)actor' token, 'spriteflags' or
|
||||||
|
-- 'sprite*' command; result of getLocation(<kind>, <pos>)
|
||||||
|
g_code = { actor={}, event={}, loadactor={}, aflagsloc={} }
|
||||||
|
|
||||||
g_recurslevel = -1
|
g_recurslevel = -1
|
||||||
g_numerrors = 0
|
g_numerrors = 0
|
||||||
|
@ -518,6 +521,7 @@ end
|
||||||
|
|
||||||
-- fwd-decls
|
-- fwd-decls
|
||||||
local warnprintf, errprintf, pwarnprintf, perrprintf, contprintf
|
local warnprintf, errprintf, pwarnprintf, perrprintf, contprintf
|
||||||
|
local getLocation
|
||||||
|
|
||||||
local on = {}
|
local on = {}
|
||||||
|
|
||||||
|
@ -565,6 +569,7 @@ function on.actor_end(pos, usertype, tsamm, codetab)
|
||||||
pwarnprintf(pos, "redefined actor %d", tilenum)
|
pwarnprintf(pos, "redefined actor %d", tilenum)
|
||||||
end
|
end
|
||||||
g_code.actor[tilenum] = codetab
|
g_code.actor[tilenum] = codetab
|
||||||
|
g_code.aflagsloc[tilenum] = getLocation("definition of actor", pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- NOTE: in C-CON, the slash and backslash can also be part of an identifier,
|
-- NOTE: in C-CON, the slash and backslash can also be part of an identifier,
|
||||||
|
@ -748,8 +753,11 @@ local g_labelspecial = {} -- [<label>] = true
|
||||||
local g_labelloc = {} -- [<label>] = { filename, linenum, colnum }
|
local g_labelloc = {} -- [<label>] = { filename, linenum, colnum }
|
||||||
|
|
||||||
-- Get location table for use in continued warning/error reporting.
|
-- Get location table for use in continued warning/error reporting.
|
||||||
local function getLocation()
|
--[[ local --]]
|
||||||
return { g_filename, getlinecol(g_lastkwpos) }
|
function getLocation(kind, pos)
|
||||||
|
local loc = { g_filename, getlinecol(pos or g_lastkwpos) }
|
||||||
|
loc[4] = kind
|
||||||
|
return loc
|
||||||
end
|
end
|
||||||
|
|
||||||
function reset.labels()
|
function reset.labels()
|
||||||
|
@ -864,8 +872,7 @@ local inform = {}
|
||||||
|
|
||||||
function inform.common(loc, iserr)
|
function inform.common(loc, iserr)
|
||||||
if (loc) then
|
if (loc) then
|
||||||
contprintf(iserr, "Old definition is at %s %d:%d",
|
contprintf(iserr, "Old definition is at %s %d:%d", loc[1], loc[2], loc[3])
|
||||||
loc[1], loc[2], loc[3])
|
|
||||||
else
|
else
|
||||||
contprintf(iserr, "Old definition is built-in")
|
contprintf(iserr, "Old definition is built-in")
|
||||||
end
|
end
|
||||||
|
@ -1291,6 +1298,15 @@ function Cmd.xspriteflags(tilenum, flags, override)
|
||||||
local ok = check.tile_idx(tilenum)
|
local ok = check.tile_idx(tilenum)
|
||||||
check.reserved_bits(flags, conl.user_sflags, "for sprite flags")
|
check.reserved_bits(flags, conl.user_sflags, "for sprite flags")
|
||||||
|
|
||||||
|
local loc = g_code.aflagsloc[tilenum]
|
||||||
|
|
||||||
|
if (override and loc ~= nil) then
|
||||||
|
warnprintf("'spriteflags' after %s %d", loc[4], tilenum)
|
||||||
|
contprintf(false, "at %s %d:%d", loc[1], loc[2], loc[3])
|
||||||
|
end
|
||||||
|
|
||||||
|
g_code.aflagsloc[tilenum] = getLocation(format("'%s' for actor", g_lastkw), pos)
|
||||||
|
|
||||||
if (ffi and ok) then
|
if (ffi and ok) then
|
||||||
local tile = ffiC.g_tile[tilenum]
|
local tile = ffiC.g_tile[tilenum]
|
||||||
tile._flags = bit.bor(override and 0 or tile._flags, flags)
|
tile._flags = bit.bor(override and 0 or tile._flags, flags)
|
||||||
|
|
Loading…
Reference in a new issue