mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-23 03:12:38 +00:00
Fix some theoretical crashes when using the P_*XYMovement, P_*ZMovement, and P_RailThinker functions.
This commit is contained in:
parent
a9a0137d22
commit
2ae5c02050
1 changed files with 12 additions and 0 deletions
|
@ -910,44 +910,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;
|
||||
}
|
||||
|
||||
|
@ -959,6 +967,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;
|
||||
}
|
||||
|
||||
|
@ -970,6 +979,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;
|
||||
}
|
||||
|
||||
|
@ -981,6 +991,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;
|
||||
}
|
||||
|
||||
|
@ -992,6 +1003,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