mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Merge branch 'fastfall-with-speed' into 'master'
Scale fast fall momentum with speed at time of trigger See merge request KartKrew/Kart!1047
This commit is contained in:
commit
b8f3c7e357
6 changed files with 21 additions and 1 deletions
|
|
@ -524,6 +524,7 @@ struct player_t
|
||||||
UINT8 spindashboost; // Spindash release boost timer
|
UINT8 spindashboost; // Spindash release boost timer
|
||||||
|
|
||||||
fixed_t fastfall; // Fast fall momentum
|
fixed_t fastfall; // Fast fall momentum
|
||||||
|
fixed_t fastfallBase; // Fast fall base speed multiplier
|
||||||
|
|
||||||
UINT8 numboosts; // Count of how many boosts are being stacked, for after image spawning
|
UINT8 numboosts; // Count of how many boosts are being stacked, for after image spawning
|
||||||
fixed_t boostpower; // Base boost value, for offroad
|
fixed_t boostpower; // Base boost value, for offroad
|
||||||
|
|
|
||||||
|
|
@ -9946,6 +9946,13 @@ static void K_KartSpindash(player_t *player)
|
||||||
// Update fastfall.
|
// Update fastfall.
|
||||||
player->fastfall = player->mo->momz;
|
player->fastfall = player->mo->momz;
|
||||||
player->spindash = 0;
|
player->spindash = 0;
|
||||||
|
|
||||||
|
if (player->fastfallBase == 0)
|
||||||
|
{
|
||||||
|
// Factors 3D momentum.
|
||||||
|
player->fastfallBase = FixedHypot(player->speed, player->mo->momz);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (player->fastfall != 0)
|
else if (player->fastfall != 0)
|
||||||
|
|
@ -10057,6 +10064,7 @@ boolean K_FastFallBounce(player_t *player)
|
||||||
player->mo->momz = bounce * P_MobjFlip(player->mo);
|
player->mo->momz = bounce * P_MobjFlip(player->mo);
|
||||||
|
|
||||||
player->fastfall = 0;
|
player->fastfall = 0;
|
||||||
|
player->fastfallBase = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,8 @@ static int player_get(lua_State *L)
|
||||||
lua_pushinteger(L, plr->spindashboost);
|
lua_pushinteger(L, plr->spindashboost);
|
||||||
else if (fastcmp(field,"fastfall"))
|
else if (fastcmp(field,"fastfall"))
|
||||||
lua_pushfixed(L, plr->fastfall);
|
lua_pushfixed(L, plr->fastfall);
|
||||||
|
else if (fastcmp(field,"fastfallBase"))
|
||||||
|
lua_pushfixed(L, plr->fastfallBase);
|
||||||
else if (fastcmp(field,"numboosts"))
|
else if (fastcmp(field,"numboosts"))
|
||||||
lua_pushinteger(L, plr->numboosts);
|
lua_pushinteger(L, plr->numboosts);
|
||||||
else if (fastcmp(field,"boostpower"))
|
else if (fastcmp(field,"boostpower"))
|
||||||
|
|
@ -664,6 +666,8 @@ static int player_set(lua_State *L)
|
||||||
plr->spindashboost = luaL_checkinteger(L, 3);
|
plr->spindashboost = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"fastfall"))
|
else if (fastcmp(field,"fastfall"))
|
||||||
plr->fastfall = luaL_checkfixed(L, 3);
|
plr->fastfall = luaL_checkfixed(L, 3);
|
||||||
|
else if (fastcmp(field,"fastfallBase"))
|
||||||
|
plr->fastfallBase = luaL_checkfixed(L, 3);
|
||||||
else if (fastcmp(field,"numboosts"))
|
else if (fastcmp(field,"numboosts"))
|
||||||
plr->numboosts = luaL_checkinteger(L, 3);
|
plr->numboosts = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"boostpower"))
|
else if (fastcmp(field,"boostpower"))
|
||||||
|
|
|
||||||
|
|
@ -1148,7 +1148,11 @@ fixed_t P_GetMobjGravity(mobj_t *mo)
|
||||||
else if (mo->player->fastfall != 0)
|
else if (mo->player->fastfall != 0)
|
||||||
{
|
{
|
||||||
// Fast falling
|
// Fast falling
|
||||||
gravityadd *= 4;
|
|
||||||
|
const fixed_t unit = 64 * mapobjectscale;
|
||||||
|
const fixed_t mult = 3*FRACUNIT + (3 * FixedDiv(mo->player->fastfallBase, unit));
|
||||||
|
|
||||||
|
gravityadd = FixedMul(gravityadd, mult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -311,6 +311,7 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
||||||
WRITEUINT8(save->p, players[i].spindashboost);
|
WRITEUINT8(save->p, players[i].spindashboost);
|
||||||
|
|
||||||
WRITEFIXED(save->p, players[i].fastfall);
|
WRITEFIXED(save->p, players[i].fastfall);
|
||||||
|
WRITEFIXED(save->p, players[i].fastfallBase);
|
||||||
|
|
||||||
WRITEUINT8(save->p, players[i].numboosts);
|
WRITEUINT8(save->p, players[i].numboosts);
|
||||||
WRITEFIXED(save->p, players[i].boostpower);
|
WRITEFIXED(save->p, players[i].boostpower);
|
||||||
|
|
@ -686,6 +687,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
||||||
players[i].spindashboost = READUINT8(save->p);
|
players[i].spindashboost = READUINT8(save->p);
|
||||||
|
|
||||||
players[i].fastfall = READFIXED(save->p);
|
players[i].fastfall = READFIXED(save->p);
|
||||||
|
players[i].fastfallBase = READFIXED(save->p);
|
||||||
|
|
||||||
players[i].numboosts = READUINT8(save->p);
|
players[i].numboosts = READUINT8(save->p);
|
||||||
players[i].boostpower = READFIXED(save->p);
|
players[i].boostpower = READFIXED(save->p);
|
||||||
|
|
|
||||||
|
|
@ -482,6 +482,7 @@ void P_ResetPlayer(player_t *player)
|
||||||
player->trickpanel = 0;
|
player->trickpanel = 0;
|
||||||
player->glanceDir = 0;
|
player->glanceDir = 0;
|
||||||
player->fastfall = 0;
|
player->fastfall = 0;
|
||||||
|
player->fastfallBase = 0;
|
||||||
|
|
||||||
if (player->mo != NULL && P_MobjWasRemoved(player->mo) == false)
|
if (player->mo != NULL && P_MobjWasRemoved(player->mo) == false)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue