Lunatic t.: don't error on changing stat/sect of sprite not in the game world.

git-svn-id: https://svn.eduke32.com/eduke32@3598 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-03-24 18:53:48 +00:00
parent efbc4cec90
commit c5e76e73f3
3 changed files with 8 additions and 8 deletions

View file

@ -454,8 +454,8 @@ for member, code in pairs(ActorLabels) do
end
-- Sprites set stat- and sectnum via sprite.change{stat,sect} functions.
ActorLabels.sectnum[2] = "sprite.changesect(%s,%%s)"
ActorLabels.statnum[2] = "sprite.changestat(%s,%%s)"
ActorLabels.sectnum[2] = "sprite.changesect(%s,%%s,true)"
ActorLabels.statnum[2] = "sprite.changestat(%s,%%s,true)"
local PL = function(memb) return "player[%s]"..memb end
-- Access to DukePlayer_t's bool members: they must be read as numbers.

View file

@ -651,20 +651,20 @@ sms._nextspritestat = creategtab(ffiC.nextspritestat, ffiC.MAXSPRITES, 'nextspri
sms._prevspritesect = creategtab(ffiC.prevspritesect, ffiC.MAXSPRITES, 'prevspritesect[]')
sms._prevspritestat = creategtab(ffiC.prevspritestat, ffiC.MAXSPRITES, 'prevspritestat[]')
function static_members.sprite.changesect(spritenum, sectnum)
function static_members.sprite.changesect(spritenum, sectnum, noerr)
check_sprite_idx(spritenum)
check_sector_idx(sectnum)
if (ffiC.changespritesect(spritenum, sectnum)==-1) then
if (ffiC.changespritesect(spritenum, sectnum)==-1 and not noerr) then
error("cannot change sector number of sprite not in the game world", 2)
end
end
function static_members.sprite.changestat(spritenum, statnum)
function static_members.sprite.changestat(spritenum, statnum, noerr)
check_sprite_idx(spritenum)
if (statnum >= ffiC.MAXSTATUS+0ULL) then
error("invalid status number "..statnum, 2)
end
if (ffiC.changespritestat(spritenum, statnum)==-1) then
if (ffiC.changespritestat(spritenum, statnum)==-1 and not noerr) then
error("cannot change status number of sprite not in the game world", 2)
end
end

View file

@ -2165,9 +2165,9 @@ local Cinner = {
canseespr = cmd(R,R,W)
/ "%3=_con._canseespr(%1,%2)",
changespritesect = cmd(R,R)
/ "sprite.changesect(%1,%2)",
/ "sprite.changesect(%1,%2,true)",
changespritestat = cmd(R,R)
/ "sprite.changestat(%1,%2)",
/ "sprite.changestat(%1,%2,true)",
displayrand = cmd(W)
/ "%1=_con._displayrand(32767)",
displayrandvar = cmd(W,D)