mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 20:11:12 +00:00
Merge branch 'expos-sky' into 'next'
Expose P_CheckSkyHit to Lua See merge request STJr/SRB2!2000
This commit is contained in:
commit
5ac297475c
3 changed files with 27 additions and 10 deletions
|
@ -1031,6 +1031,20 @@ static int lib_pRailThinker(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pCheckSkyHit(lua_State *L)
|
||||
{
|
||||
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
line_t *line = *((line_t **)luaL_checkudata(L, 2, META_LINE));
|
||||
//HUDSAFE
|
||||
INLEVEL
|
||||
if (!mobj)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
if (!line)
|
||||
return LUA_ErrInvalid(L, "line_t");
|
||||
lua_pushboolean(L, P_CheckSkyHit(mobj, line));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pXYMovement(lua_State *L)
|
||||
{
|
||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
|
@ -4206,6 +4220,7 @@ static luaL_Reg lib[] = {
|
|||
{"P_CreateFloorSpriteSlope",lib_pCreateFloorSpriteSlope},
|
||||
{"P_RemoveFloorSpriteSlope",lib_pRemoveFloorSpriteSlope},
|
||||
{"P_RailThinker",lib_pRailThinker},
|
||||
{"P_CheckSkyHit",lib_pCheckSkyHit},
|
||||
{"P_XYMovement",lib_pXYMovement},
|
||||
{"P_RingXYMovement",lib_pRingXYMovement},
|
||||
{"P_SceneryXYMovement",lib_pSceneryXYMovement},
|
||||
|
|
|
@ -303,6 +303,7 @@ void P_RunOverlays(void);
|
|||
void P_HandleMinecartSegments(mobj_t *mobj);
|
||||
void P_MobjThinker(mobj_t *mobj);
|
||||
boolean P_RailThinker(mobj_t *mobj);
|
||||
boolean P_CheckSkyHit(mobj_t *mo, line_t *line);
|
||||
void P_PushableThinker(mobj_t *mobj);
|
||||
void P_SceneryThinker(mobj_t *mobj);
|
||||
|
||||
|
|
21
src/p_mobj.c
21
src/p_mobj.c
|
@ -1779,14 +1779,15 @@ bustupdone:
|
|||
//
|
||||
// P_CheckSkyHit
|
||||
//
|
||||
static boolean P_CheckSkyHit(mobj_t *mo)
|
||||
boolean P_CheckSkyHit(mobj_t *mo, line_t *line)
|
||||
{
|
||||
if (ceilingline && ceilingline->backsector
|
||||
&& ceilingline->backsector->ceilingpic == skyflatnum
|
||||
&& ceilingline->frontsector
|
||||
&& ceilingline->frontsector->ceilingpic == skyflatnum
|
||||
&& (mo->z >= ceilingline->frontsector->ceilingheight
|
||||
|| mo->z >= ceilingline->backsector->ceilingheight))
|
||||
if (line && (line->special == 41 ||
|
||||
(line->backsector
|
||||
&& line->backsector->ceilingpic == skyflatnum
|
||||
&& line->frontsector
|
||||
&& line->frontsector->ceilingpic == skyflatnum
|
||||
&& (mo->z >= line->frontsector->ceilingheight
|
||||
|| mo->z >= line->backsector->ceilingheight))))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -1893,7 +1894,7 @@ void P_XYMovement(mobj_t *mo)
|
|||
mo->fuse += ((5 - mo->threshold) * TICRATE);
|
||||
|
||||
// Check for hit against sky here
|
||||
if (P_CheckSkyHit(mo))
|
||||
if (P_CheckSkyHit(mo, ceilingline))
|
||||
{
|
||||
// Hack to prevent missiles exploding
|
||||
// against the sky.
|
||||
|
@ -1913,7 +1914,7 @@ void P_XYMovement(mobj_t *mo)
|
|||
mo->flags &= ~MF_STICKY; //Don't check again!
|
||||
|
||||
// Check for hit against sky here
|
||||
if (P_CheckSkyHit(mo))
|
||||
if (P_CheckSkyHit(mo, ceilingline))
|
||||
{
|
||||
// Hack to prevent missiles exploding
|
||||
// against the sky.
|
||||
|
@ -1972,7 +1973,7 @@ void P_XYMovement(mobj_t *mo)
|
|||
else if (mo->flags & MF_MISSILE)
|
||||
{
|
||||
// explode a missile
|
||||
if (P_CheckSkyHit(mo))
|
||||
if (P_CheckSkyHit(mo, ceilingline))
|
||||
{
|
||||
// Hack to prevent missiles exploding
|
||||
// against the sky.
|
||||
|
|
Loading…
Reference in a new issue