mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 20:50:58 +00:00
Merge branch 'fix-theoretical-lua-exposure-crashes' into 'next'
Fix some theoretical crashes when using the P_*XYMovement, P_*ZMovement, and P_RailThinker functions in Lua. See merge request STJr/SRB2!1173
This commit is contained in:
commit
ddb6823fe5
1 changed files with 12 additions and 0 deletions
|
@ -913,44 +913,52 @@ static int lib_pMaceRotate(lua_State *L)
|
|||
static int lib_pRailThinker(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *ptmthing = tmthing;
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mobj)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
lua_pushboolean(L, P_RailThinker(mobj));
|
||||
P_SetTarget(&tmthing, ptmthing);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pXYMovement(lua_State *L)
|
||||
{
|
||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *ptmthing = tmthing;
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_XYMovement(actor);
|
||||
P_SetTarget(&tmthing, ptmthing);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pRingXYMovement(lua_State *L)
|
||||
{
|
||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *ptmthing = tmthing;
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_RingXYMovement(actor);
|
||||
P_SetTarget(&tmthing, ptmthing);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lib_pSceneryXYMovement(lua_State *L)
|
||||
{
|
||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *ptmthing = tmthing;
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_SceneryXYMovement(actor);
|
||||
P_SetTarget(&tmthing, ptmthing);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -962,6 +970,7 @@ static int lib_pZMovement(lua_State *L)
|
|||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
lua_pushboolean(L, P_ZMovement(actor));
|
||||
P_CheckPosition(actor, actor->x, actor->y);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -973,6 +982,7 @@ static int lib_pRingZMovement(lua_State *L)
|
|||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_RingZMovement(actor);
|
||||
P_CheckPosition(actor, actor->x, actor->y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -984,6 +994,7 @@ static int lib_pSceneryZMovement(lua_State *L)
|
|||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
lua_pushboolean(L, P_SceneryZMovement(actor));
|
||||
P_CheckPosition(actor, actor->x, actor->y);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -995,6 +1006,7 @@ static int lib_pPlayerZMovement(lua_State *L)
|
|||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_PlayerZMovement(actor);
|
||||
P_CheckPosition(actor, actor->x, actor->y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue