mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +00:00
Merge branch 'expose-thrust-funcs-to-lua' into 'next'
Expose more thrust functions to Lua See merge request STJr/SRB2!1493
This commit is contained in:
commit
6976f8524d
3 changed files with 55 additions and 4 deletions
|
@ -1567,6 +1567,19 @@ static int lib_pInstaThrust(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pInstaThrustEvenIn2D(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
angle_t angle = luaL_checkangle(L, 2);
|
||||||
|
fixed_t move = luaL_checkfixed(L, 3);
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!mo)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
P_InstaThrustEvenIn2D(mo, angle, move);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_pReturnThrustX(lua_State *L)
|
static int lib_pReturnThrustX(lua_State *L)
|
||||||
{
|
{
|
||||||
angle_t angle;
|
angle_t angle;
|
||||||
|
@ -2214,6 +2227,40 @@ static int lib_pThrust(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lib_pThrustEvenIn2D(lua_State *L)
|
||||||
|
{
|
||||||
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||||
|
angle_t angle = luaL_checkangle(L, 2);
|
||||||
|
fixed_t move = luaL_checkfixed(L, 3);
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!mo)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
P_ThrustEvenIn2D(mo, angle, move);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int lib_pVectorInstaThrust(lua_State *L)
|
||||||
|
{
|
||||||
|
fixed_t xa = luaL_checkfixed(L, 1);
|
||||||
|
fixed_t xb = luaL_checkfixed(L, 2);
|
||||||
|
fixed_t xc = luaL_checkfixed(L, 3);
|
||||||
|
fixed_t ya = luaL_checkfixed(L, 4);
|
||||||
|
fixed_t yb = luaL_checkfixed(L, 5);
|
||||||
|
fixed_t yc = luaL_checkfixed(L, 6);
|
||||||
|
fixed_t za = luaL_checkfixed(L, 7);
|
||||||
|
fixed_t zb = luaL_checkfixed(L, 8);
|
||||||
|
fixed_t zc = luaL_checkfixed(L, 9);
|
||||||
|
fixed_t momentum = luaL_checkfixed(L, 10);
|
||||||
|
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 11, META_MOBJ));
|
||||||
|
NOHUD
|
||||||
|
INLEVEL
|
||||||
|
if (!mo)
|
||||||
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
|
P_VectorInstaThrust(xa, xb, xc, ya, yb, yc, za, zb, zc, momentum, mo);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int lib_pSetMobjStateNF(lua_State *L)
|
static int lib_pSetMobjStateNF(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));
|
||||||
|
@ -4123,6 +4170,7 @@ static luaL_Reg lib[] = {
|
||||||
{"P_DoPlayerFinish",lib_pDoPlayerFinish},
|
{"P_DoPlayerFinish",lib_pDoPlayerFinish},
|
||||||
{"P_DoPlayerExit",lib_pDoPlayerExit},
|
{"P_DoPlayerExit",lib_pDoPlayerExit},
|
||||||
{"P_InstaThrust",lib_pInstaThrust},
|
{"P_InstaThrust",lib_pInstaThrust},
|
||||||
|
{"P_InstaThrustEvenIn2D",lib_pInstaThrustEvenIn2D},
|
||||||
{"P_ReturnThrustX",lib_pReturnThrustX},
|
{"P_ReturnThrustX",lib_pReturnThrustX},
|
||||||
{"P_ReturnThrustY",lib_pReturnThrustY},
|
{"P_ReturnThrustY",lib_pReturnThrustY},
|
||||||
{"P_LookForEnemies",lib_pLookForEnemies},
|
{"P_LookForEnemies",lib_pLookForEnemies},
|
||||||
|
@ -4176,6 +4224,8 @@ static luaL_Reg lib[] = {
|
||||||
|
|
||||||
// p_spec
|
// p_spec
|
||||||
{"P_Thrust",lib_pThrust},
|
{"P_Thrust",lib_pThrust},
|
||||||
|
{"P_ThrustEvenIn2D",lib_pThrustEvenIn2D},
|
||||||
|
{"P_VectorInstaThrust",lib_pVectorInstaThrust},
|
||||||
{"P_SetMobjStateNF",lib_pSetMobjStateNF},
|
{"P_SetMobjStateNF",lib_pSetMobjStateNF},
|
||||||
{"P_DoSuperTransformation",lib_pDoSuperTransformation},
|
{"P_DoSuperTransformation",lib_pDoSuperTransformation},
|
||||||
{"P_ExplodeMissile",lib_pExplodeMissile},
|
{"P_ExplodeMissile",lib_pExplodeMissile},
|
||||||
|
|
|
@ -535,6 +535,9 @@ boolean P_Teleport(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle
|
||||||
boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state);
|
boolean P_SetMobjStateNF(mobj_t *mobj, statenum_t state);
|
||||||
boolean P_CheckMissileSpawn(mobj_t *th);
|
boolean P_CheckMissileSpawn(mobj_t *th);
|
||||||
void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move);
|
void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move);
|
||||||
|
void P_ThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move);
|
||||||
|
void P_VectorInstaThrust(fixed_t xa, fixed_t xb, fixed_t xc, fixed_t ya, fixed_t yb, fixed_t yc,
|
||||||
|
fixed_t za, fixed_t zb, fixed_t zc, fixed_t momentum, mobj_t *mo);
|
||||||
void P_DoSuperTransformation(player_t *player, boolean giverings);
|
void P_DoSuperTransformation(player_t *player, boolean giverings);
|
||||||
void P_ExplodeMissile(mobj_t *mo);
|
void P_ExplodeMissile(mobj_t *mo);
|
||||||
void P_CheckGravity(mobj_t *mo, boolean affect);
|
void P_CheckGravity(mobj_t *mo, boolean affect);
|
||||||
|
|
|
@ -106,8 +106,7 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move)
|
||||||
mo->momy += FixedMul(move, FINESINE(angle));
|
mo->momy += FixedMul(move, FINESINE(angle));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
void P_ThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move)
|
||||||
static inline void P_ThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move)
|
|
||||||
{
|
{
|
||||||
angle >>= ANGLETOFINESHIFT;
|
angle >>= ANGLETOFINESHIFT;
|
||||||
|
|
||||||
|
@ -115,7 +114,7 @@ static inline void P_ThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move)
|
||||||
mo->momy += FixedMul(move, FINESINE(angle));
|
mo->momy += FixedMul(move, FINESINE(angle));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void P_VectorInstaThrust(fixed_t xa, fixed_t xb, fixed_t xc, fixed_t ya, fixed_t yb, fixed_t yc,
|
void P_VectorInstaThrust(fixed_t xa, fixed_t xb, fixed_t xc, fixed_t ya, fixed_t yb, fixed_t yc,
|
||||||
fixed_t za, fixed_t zb, fixed_t zc, fixed_t momentum, mobj_t *mo)
|
fixed_t za, fixed_t zb, fixed_t zc, fixed_t momentum, mobj_t *mo)
|
||||||
{
|
{
|
||||||
fixed_t a1, b1, c1, a2, b2, c2, i, j, k;
|
fixed_t a1, b1, c1, a2, b2, c2, i, j, k;
|
||||||
|
@ -145,7 +144,6 @@ static inline void P_VectorInstaThrust(fixed_t xa, fixed_t xb, fixed_t xc, fixed
|
||||||
mo->momy = j;
|
mo->momy = j;
|
||||||
mo->momz = k;
|
mo->momz = k;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_InstaThrust
|
// P_InstaThrust
|
||||||
|
|
Loading…
Reference in a new issue