Instead of checking whether mobj->spawnpoint->extrainfo is in the correct range every tic, have a lua error for trying to set it outside (since there'll no doubt be other consequences to being outside the range too)

This commit is contained in:
toaster 2019-08-01 18:12:12 +01:00
parent f0fd9f7656
commit 8fa0641e99
2 changed files with 7 additions and 2 deletions

View File

@ -804,7 +804,12 @@ static int mapthing_set(lua_State *L)
else if(fastcmp(field,"z"))
mt->z = (INT16)luaL_checkinteger(L, 3);
else if(fastcmp(field,"extrainfo"))
mt->extrainfo = (UINT8)luaL_checkinteger(L, 3);
{
INT32 extrainfo = luaL_checkinteger(L, 3);
if (extrainfo & ~15)
return luaL_error(L, "mapthing_t extrainfo set %d out of range (%d - %d)", extrainfo, 0, 15);
mt->extrainfo = (UINT8)extrainfo;
}
else if(fastcmp(field,"mobj"))
mt->mobj = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
else

View File

@ -7011,7 +7011,7 @@ void P_MobjThinker(mobj_t *mobj)
if (mobj->flags & MF_NOTHINK)
return;
if ((mobj->flags & MF_BOSS) && mobj->spawnpoint && !(mobj->spawnpoint->extrainfo & ~15) && (bossdisabled & (1<<mobj->spawnpoint->extrainfo)))
if ((mobj->flags & MF_BOSS) && mobj->spawnpoint && (bossdisabled & (1<<mobj->spawnpoint->extrainfo)))
return;
// Remove dead target/tracer.