Add missing K_ functions

This commit is contained in:
TehRealSalt 2018-11-07 18:23:28 -05:00
parent 868118d0cd
commit 7ad0347ab0
3 changed files with 81 additions and 2 deletions

View file

@ -6783,7 +6783,7 @@ static void K_drawKartBumpersOrKarma(void)
}
}
fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my)
static fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my)
{
fixed_t dist, x;
fixed_t range = RING_DIST/3;

View file

@ -64,7 +64,6 @@ void K_CheckSpectateStatus(void);
const char *K_GetItemPatch(UINT8 item, boolean tiny);
INT32 K_calcSplitFlags(INT32 snapflags);
void K_LoadKartHUDGraphics(void);
fixed_t K_FindCheckX(fixed_t px, fixed_t py, angle_t ang, fixed_t mx, fixed_t my);
void K_drawKartHUD(void);
void K_drawKartFreePlay(UINT32 flashtime);
void K_drawKartTimestamp(tic_t drawtime, INT32 TX, INT32 TY, INT16 emblemmap, boolean playing);

View file

@ -2211,6 +2211,17 @@ static int lib_kSpawnKartExplosion(lua_State *L)
return 0;
}
static int lib_kSpawnMineExplosion(lua_State *L)
{
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
UINT8 color = (UINT8)luaL_checkinteger(L, 2);
NOHUD
if (!source)
return LUA_ErrInvalid(L, "mobj_t");
K_SpawnMineExplosion(source, color);
return 0;
}
static int lib_kSpawnBoostTrail(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@ -2301,6 +2312,59 @@ static int lib_kRepairOrbitChain(lua_State *L)
return 0;
}
static int lib_kFindJawzTarget(lua_State *L)
{
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
player_t *source = *((player_t **)luaL_checkudata(L, 2, META_PLAYER));
NOHUD
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
if (!source)
return LUA_ErrInvalid(L, "player_t");
LUA_PushUserdata(L, K_FindJawzTarget(actor, source), META_PLAYER);
return 0;
}
static int lib_kGetKartDriftSparkValue(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
lua_pushfixed(L, K_GetKartDriftSparkValue(player));
return 0;
}
static int lib_kDropItems(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_DropItems(player);
return 0;
}
static int lib_kStripItems(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_StripItems(player);
return 0;
}
static int lib_kStripOther(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_StripOther(player);
return 0;
}
static int lib_kMomentumToFacing(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@ -2342,6 +2406,15 @@ static int lib_kGetKartFlashing(lua_State *L)
return 0;
}
static int lib_kGetItemPatch(lua_State *L)
{
UINT8 item = luaL_checkinteger(L, 1);
boolean tiny = luaL_checkboolean(L, 2);
//HUDSAFE
lua_pushstring(L, K_GetItemPatch(item, tiny));
return 1;
}
static luaL_Reg lib[] = {
{"print", lib_print},
{"chatprint", lib_chatprint},
@ -2532,6 +2605,7 @@ static luaL_Reg lib[] = {
{"K_ExplodePlayer",lib_kExplodePlayer},
{"K_StealBumper",lib_kStealBumper},
{"K_SpawnKartExplosion",lib_kSpawnKartExplosion},
{"K_SpawnMineExplosion",lib_kSpawnMineExplosion},
{"K_SpawnBoostTrail",lib_kSpawnBoostTrail},
{"K_SpawnSparkleTrail",lib_kSpawnSparkleTrail},
{"K_SpawnWipeoutTrail",lib_kSpawnWipeoutTrail},
@ -2540,10 +2614,16 @@ static luaL_Reg lib[] = {
{"K_DoPogoSpring",lib_kDoPogoSpring},
{"K_KillBananaChain",lib_kKillBananaChain},
{"K_RepairOrbitChain",lib_kRepairOrbitChain},
{"K_FindJawzTarget",lib_kFindJawzTarget},
{"K_GetKartDriftSparkValue",lib_kGetKartDriftSparkValue},
{"K_DropItems",lib_kDropItems},
{"K_StripItems",lib_kStripItems},
{"K_StripOther",lib_kStripOther},
{"K_MomentumToFacing",lib_kMomentumToFacing},
{"K_GetKartSpeed",lib_kGetKartSpeed},
{"K_GetKartAccel",lib_kGetKartAccel},
{"K_GetKartFlashing",lib_kGetKartFlashing},
{"K_GetItemPatch",lib_kK_GetItemPatch},
{NULL, NULL}
};