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
|
@ -913,44 +913,52 @@ static int lib_pMaceRotate(lua_State *L)
|
||||||
static int lib_pRailThinker(lua_State *L)
|
static int lib_pRailThinker(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
mobj_t *ptmthing = tmthing;
|
||||||
NOHUD
|
NOHUD
|
||||||
INLEVEL
|
INLEVEL
|
||||||
if (!mobj)
|
if (!mobj)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
lua_pushboolean(L, P_RailThinker(mobj));
|
lua_pushboolean(L, P_RailThinker(mobj));
|
||||||
|
P_SetTarget(&tmthing, ptmthing);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_pXYMovement(lua_State *L)
|
static int lib_pXYMovement(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
mobj_t *ptmthing = tmthing;
|
||||||
NOHUD
|
NOHUD
|
||||||
INLEVEL
|
INLEVEL
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
P_XYMovement(actor);
|
P_XYMovement(actor);
|
||||||
|
P_SetTarget(&tmthing, ptmthing);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_pRingXYMovement(lua_State *L)
|
static int lib_pRingXYMovement(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
mobj_t *ptmthing = tmthing;
|
||||||
NOHUD
|
NOHUD
|
||||||
INLEVEL
|
INLEVEL
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
P_RingXYMovement(actor);
|
P_RingXYMovement(actor);
|
||||||
|
P_SetTarget(&tmthing, ptmthing);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lib_pSceneryXYMovement(lua_State *L)
|
static int lib_pSceneryXYMovement(lua_State *L)
|
||||||
{
|
{
|
||||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
mobj_t *ptmthing = tmthing;
|
||||||
NOHUD
|
NOHUD
|
||||||
INLEVEL
|
INLEVEL
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
P_SceneryXYMovement(actor);
|
P_SceneryXYMovement(actor);
|
||||||
|
P_SetTarget(&tmthing, ptmthing);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -962,6 +970,7 @@ static int lib_pZMovement(lua_State *L)
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
lua_pushboolean(L, P_ZMovement(actor));
|
lua_pushboolean(L, P_ZMovement(actor));
|
||||||
|
P_CheckPosition(actor, actor->x, actor->y);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,6 +982,7 @@ static int lib_pRingZMovement(lua_State *L)
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
P_RingZMovement(actor);
|
P_RingZMovement(actor);
|
||||||
|
P_CheckPosition(actor, actor->x, actor->y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -984,6 +994,7 @@ static int lib_pSceneryZMovement(lua_State *L)
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
lua_pushboolean(L, P_SceneryZMovement(actor));
|
lua_pushboolean(L, P_SceneryZMovement(actor));
|
||||||
|
P_CheckPosition(actor, actor->x, actor->y);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -995,6 +1006,7 @@ static int lib_pPlayerZMovement(lua_State *L)
|
||||||
if (!actor)
|
if (!actor)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
P_PlayerZMovement(actor);
|
P_PlayerZMovement(actor);
|
||||||
|
P_CheckPosition(actor, actor->x, actor->y);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue