Fix exit music occasionally being wrong on race exit, add K_KartUpdatePosition to Lua

This commit is contained in:
TehRealSalt 2018-11-28 00:45:33 -05:00
parent 29410bb93d
commit 7b475d0f91
4 changed files with 16 additions and 3 deletions

View file

@ -4660,7 +4660,7 @@ static void K_KartDrift(player_t *player, boolean onground)
//
// K_KartUpdatePosition
//
static void K_KartUpdatePosition(player_t *player)
void K_KartUpdatePosition(player_t *player)
{
fixed_t position = 1;
fixed_t oldposition = player->kartstuff[k_position];

View file

@ -49,6 +49,7 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source);
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
INT32 K_GetKartDriftSparkValue(player_t *player);
void K_KartUpdatePosition(player_t *player);
void K_DropItems(player_t *player);
void K_StripItems(player_t *player);
void K_StripOther(player_t *player);

View file

@ -2386,6 +2386,16 @@ static int lib_kGetKartDriftSparkValue(lua_State *L)
return 1;
}
static int lib_kKartUpdatePosition(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
K_KartUpdatePosition(player);
return 0;
}
static int lib_kDropItems(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
@ -2677,6 +2687,7 @@ static luaL_Reg lib[] = {
{"K_RepairOrbitChain",lib_kRepairOrbitChain},
{"K_FindJawzTarget",lib_kFindJawzTarget},
{"K_GetKartDriftSparkValue",lib_kGetKartDriftSparkValue},
{"K_KartUpdatePosition",lib_kKartUpdatePosition},
{"K_DropItems",lib_kDropItems},
{"K_StripItems",lib_kStripItems},
{"K_StripOther",lib_kStripOther},

View file

@ -1778,6 +1778,9 @@ void P_DoPlayerExit(player_t *player)
if (G_RaceGametype()) // If in Race Mode, allow
{
player->exiting = raceexittime+2;
K_KartUpdatePosition(player);
if (cv_kartvoices.value)
{
if (P_IsLocalPlayer(player))
@ -1798,8 +1801,6 @@ void P_DoPlayerExit(player_t *player)
}
}
player->exiting = raceexittime+2;
if (cv_inttime.value > 0)
P_EndingMusic(player);