mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Re-add P_ThingOnSpecial3DFloor for Lua backwards compatibility
This commit is contained in:
parent
060b79452a
commit
e472c551e1
3 changed files with 37 additions and 0 deletions
|
@ -2335,6 +2335,18 @@ static int lib_pMobjTouchingSectorSpecial(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pThingOnSpecial3DFloor(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
NOHUD
|
||||
INLEVEL
|
||||
if (!mo)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
LUA_Deprecated(L, "P_ThingOnSpecial3DFloor", "P_MobjTouchingSectorSpecial\" or \"P_MobjTouchingSectorSpecialFlag");
|
||||
LUA_PushUserdata(L, P_ThingOnSpecial3DFloor(mo), META_SECTOR);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pMobjTouchingSectorSpecialFlag(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = *((mobj_t**)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
@ -4213,6 +4225,7 @@ static luaL_Reg lib[] = {
|
|||
{"P_DoSuperTransformation",lib_pDoSuperTransformation},
|
||||
{"P_ExplodeMissile",lib_pExplodeMissile},
|
||||
{"P_MobjTouchingSectorSpecial",lib_pMobjTouchingSectorSpecial},
|
||||
{"P_ThingOnSpecial3DFloor",lib_pThingOnSpecial3DFloor},
|
||||
{"P_MobjTouchingSectorSpecialFlag",lib_pMobjTouchingSectorSpecialFlag},
|
||||
{"P_PlayerTouchingSectorSpecial",lib_pPlayerTouchingSectorSpecial},
|
||||
{"P_PlayerTouchingSectorSpecialFlag",lib_pPlayerTouchingSectorSpecialFlag},
|
||||
|
|
23
src/p_spec.c
23
src/p_spec.c
|
@ -4180,6 +4180,29 @@ sector_t *P_MobjTouchingSectorSpecial(mobj_t *mo, INT32 section, INT32 number)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// Deprecated in favor of P_MobjTouchingSectorSpecial
|
||||
// Kept for Lua backwards compatibility only
|
||||
sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
|
||||
for (rover = mo->subsector->sector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!rover->master->frontsector->special)
|
||||
continue;
|
||||
|
||||
if (!(rover->fofflags & FOF_EXISTS))
|
||||
continue;
|
||||
|
||||
if (!P_IsMobjTouching3DFloor(mo, rover, mo->subsector->sector))
|
||||
continue;
|
||||
|
||||
return rover->master->frontsector;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sector_t *P_MobjTouchingSectorSpecialFlag(mobj_t *mo, sectorspecialflags_t flag)
|
||||
{
|
||||
msecnode_t *node;
|
||||
|
|
|
@ -496,6 +496,7 @@ void P_SpawnSpecials(boolean fromnetsave);
|
|||
// every tic
|
||||
void P_UpdateSpecials(void);
|
||||
sector_t *P_MobjTouchingSectorSpecial(mobj_t *mo, INT32 section, INT32 number);
|
||||
sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo);
|
||||
sector_t *P_MobjTouchingSectorSpecialFlag(mobj_t *mo, sectorspecialflags_t flag);
|
||||
sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 number);
|
||||
sector_t *P_PlayerTouchingSectorSpecialFlag(player_t *player, sectorspecialflags_t flag);
|
||||
|
|
Loading…
Reference in a new issue