mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-17 17:41:57 +00:00
Merge branch 'p-xymovement-lua-exposure' into 'next'
Expose several movement-related functions to Lua. See merge request STJr/SRB2!884
This commit is contained in:
commit
42b0ab1851
5 changed files with 110 additions and 7 deletions
|
@ -913,6 +913,83 @@ static int lib_pRailThinker(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pXYMovement(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!actor)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
P_XYMovement(actor);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pRingXYMovement(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!actor)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
P_RingXYMovement(actor);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pSceneryXYMovement(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!actor)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
P_SceneryXYMovement(actor);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pZMovement(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!actor)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
lua_pushboolean(L, P_ZMovement(actor));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pRingZMovement(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!actor)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
P_RingZMovement(actor);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pSceneryZMovement(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!actor)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
lua_pushboolean(L, P_SceneryZMovement(actor));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pPlayerZMovement(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!actor)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
P_PlayerZMovement(actor);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// P_USER
|
// P_USER
|
||||||
////////////
|
////////////
|
||||||
|
|
||||||
|
@ -1283,6 +1360,17 @@ static int lib_pSpawnSkidDust(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pMovePlayer(lua_State *L)
|
||||||
|
{
|
||||||
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!player)
|
||||||
|
return LUA_ErrInvalid(L, "player_t");
|
||||||
|
P_MovePlayer(player);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_pDoPlayerFinish(lua_State *L)
|
static int lib_pDoPlayerFinish(lua_State *L)
|
||||||
{
|
{
|
||||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
|
||||||
|
@ -3271,6 +3359,13 @@ static luaL_Reg lib[] = {
|
||||||
{"P_CanRunOnWater",lib_pCanRunOnWater},
|
{"P_CanRunOnWater",lib_pCanRunOnWater},
|
||||||
{"P_MaceRotate",lib_pMaceRotate},
|
{"P_MaceRotate",lib_pMaceRotate},
|
||||||
{"P_RailThinker",lib_pRailThinker},
|
{"P_RailThinker",lib_pRailThinker},
|
||||||
|
{"P_XYMovement",lib_pXYMovement},
|
||||||
|
{"P_RingXYMovement",lib_pRingXYMovement},
|
||||||
|
{"P_SceneryXYMovement",lib_pSceneryXYMovement},
|
||||||
|
{"P_ZMovement",lib_pZMovement},
|
||||||
|
{"P_RingZMovement",lib_pRingZMovement},
|
||||||
|
{"P_SceneryZMovement",lib_pSceneryZMovement},
|
||||||
|
{"P_PlayerZMovement",lib_pPlayerZMovement},
|
||||||
|
|
||||||
// p_user
|
// p_user
|
||||||
{"P_GetPlayerHeight",lib_pGetPlayerHeight},
|
{"P_GetPlayerHeight",lib_pGetPlayerHeight},
|
||||||
|
@ -3302,6 +3397,7 @@ static luaL_Reg lib[] = {
|
||||||
{"P_BlackOw",lib_pBlackOw},
|
{"P_BlackOw",lib_pBlackOw},
|
||||||
{"P_ElementalFire",lib_pElementalFire},
|
{"P_ElementalFire",lib_pElementalFire},
|
||||||
{"P_SpawnSkidDust", lib_pSpawnSkidDust},
|
{"P_SpawnSkidDust", lib_pSpawnSkidDust},
|
||||||
|
{"P_MovePlayer",lib_pMovePlayer},
|
||||||
{"P_DoPlayerFinish",lib_pDoPlayerFinish},
|
{"P_DoPlayerFinish",lib_pDoPlayerFinish},
|
||||||
{"P_DoPlayerExit",lib_pDoPlayerExit},
|
{"P_DoPlayerExit",lib_pDoPlayerExit},
|
||||||
{"P_InstaThrust",lib_pInstaThrust},
|
{"P_InstaThrust",lib_pInstaThrust},
|
||||||
|
|
|
@ -177,6 +177,7 @@ void P_BlackOw(player_t *player);
|
||||||
void P_ElementalFire(player_t *player, boolean cropcircle);
|
void P_ElementalFire(player_t *player, boolean cropcircle);
|
||||||
void P_SpawnSkidDust(player_t *player, fixed_t radius, boolean sound);
|
void P_SpawnSkidDust(player_t *player, fixed_t radius, boolean sound);
|
||||||
|
|
||||||
|
void P_MovePlayer(player_t *player);
|
||||||
void P_DoPityCheck(player_t *player);
|
void P_DoPityCheck(player_t *player);
|
||||||
void P_PlayerThink(player_t *player);
|
void P_PlayerThink(player_t *player);
|
||||||
void P_PlayerAfterThink(player_t *player);
|
void P_PlayerAfterThink(player_t *player);
|
||||||
|
|
12
src/p_mobj.c
12
src/p_mobj.c
|
@ -2102,7 +2102,7 @@ void P_XYMovement(mobj_t *mo)
|
||||||
P_XYFriction(mo, oldx, oldy);
|
P_XYFriction(mo, oldx, oldy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_RingXYMovement(mobj_t *mo)
|
void P_RingXYMovement(mobj_t *mo)
|
||||||
{
|
{
|
||||||
I_Assert(mo != NULL);
|
I_Assert(mo != NULL);
|
||||||
I_Assert(!P_MobjWasRemoved(mo));
|
I_Assert(!P_MobjWasRemoved(mo));
|
||||||
|
@ -2111,7 +2111,7 @@ static void P_RingXYMovement(mobj_t *mo)
|
||||||
P_SlideMove(mo);
|
P_SlideMove(mo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_SceneryXYMovement(mobj_t *mo)
|
void P_SceneryXYMovement(mobj_t *mo)
|
||||||
{
|
{
|
||||||
fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls
|
fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls
|
||||||
|
|
||||||
|
@ -2270,7 +2270,7 @@ static void P_AdjustMobjFloorZ_PolyObjs(mobj_t *mo, subsector_t *subsec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_RingZMovement(mobj_t *mo)
|
void P_RingZMovement(mobj_t *mo)
|
||||||
{
|
{
|
||||||
I_Assert(mo != NULL);
|
I_Assert(mo != NULL);
|
||||||
I_Assert(!P_MobjWasRemoved(mo));
|
I_Assert(!P_MobjWasRemoved(mo));
|
||||||
|
@ -2337,7 +2337,7 @@ boolean P_CheckSolidLava(ffloor_t *rover)
|
||||||
// P_ZMovement
|
// P_ZMovement
|
||||||
// Returns false if the mobj was killed/exploded/removed, true otherwise.
|
// Returns false if the mobj was killed/exploded/removed, true otherwise.
|
||||||
//
|
//
|
||||||
static boolean P_ZMovement(mobj_t *mo)
|
boolean P_ZMovement(mobj_t *mo)
|
||||||
{
|
{
|
||||||
fixed_t dist, delta;
|
fixed_t dist, delta;
|
||||||
boolean onground;
|
boolean onground;
|
||||||
|
@ -2891,7 +2891,7 @@ static boolean P_PlayerPolyObjectZMovement(mobj_t *mo)
|
||||||
return stopmovecut;
|
return stopmovecut;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void P_PlayerZMovement(mobj_t *mo)
|
void P_PlayerZMovement(mobj_t *mo)
|
||||||
{
|
{
|
||||||
boolean onground;
|
boolean onground;
|
||||||
|
|
||||||
|
@ -3069,7 +3069,7 @@ nightsdone:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean P_SceneryZMovement(mobj_t *mo)
|
boolean P_SceneryZMovement(mobj_t *mo)
|
||||||
{
|
{
|
||||||
// Intercept the stupid 'fall through 3dfloors' bug
|
// Intercept the stupid 'fall through 3dfloors' bug
|
||||||
if (mo->subsector->sector->ffloors)
|
if (mo->subsector->sector->ffloors)
|
||||||
|
|
|
@ -471,6 +471,12 @@ void P_NullPrecipThinker(precipmobj_t *mobj);
|
||||||
void P_RemovePrecipMobj(precipmobj_t *mobj);
|
void P_RemovePrecipMobj(precipmobj_t *mobj);
|
||||||
void P_SetScale(mobj_t *mobj, fixed_t newscale);
|
void P_SetScale(mobj_t *mobj, fixed_t newscale);
|
||||||
void P_XYMovement(mobj_t *mo);
|
void P_XYMovement(mobj_t *mo);
|
||||||
|
void P_RingXYMovement(mobj_t *mo);
|
||||||
|
void P_SceneryXYMovement(mobj_t *mo);
|
||||||
|
boolean P_ZMovement(mobj_t *mo);
|
||||||
|
void P_RingZMovement(mobj_t *mo);
|
||||||
|
boolean P_SceneryZMovement(mobj_t *mo);
|
||||||
|
void P_PlayerZMovement(mobj_t *mo);
|
||||||
void P_EmeraldManager(void);
|
void P_EmeraldManager(void);
|
||||||
|
|
||||||
extern INT32 modulothing;
|
extern INT32 modulothing;
|
||||||
|
|
|
@ -7889,7 +7889,7 @@ static void P_SkidStuff(player_t *player)
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_MovePlayer
|
// P_MovePlayer
|
||||||
static void P_MovePlayer(player_t *player)
|
void P_MovePlayer(player_t *player)
|
||||||
{
|
{
|
||||||
ticcmd_t *cmd;
|
ticcmd_t *cmd;
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
Loading…
Reference in a new issue