mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'sliptide-improvements' into 'master'
Wavedash refinement See merge request KartKrew/Kart!1040
This commit is contained in:
commit
e70c23fe0f
4 changed files with 32 additions and 21 deletions
49
src/k_kart.c
49
src/k_kart.c
|
|
@ -4064,10 +4064,14 @@ void K_UpdateStumbleIndicator(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MIN_WAVEDASH_CHARGE (5*TICRATE/8)
|
||||||
|
|
||||||
static boolean K_IsLosingSliptideZip(player_t *player)
|
static boolean K_IsLosingSliptideZip(player_t *player)
|
||||||
{
|
{
|
||||||
if (player->mo == NULL || P_MobjWasRemoved(player->mo) == true)
|
if (player->mo == NULL || P_MobjWasRemoved(player->mo) == true)
|
||||||
return true;
|
return true;
|
||||||
|
if (!K_Sliptiding(player) && player->sliptideZip < MIN_WAVEDASH_CHARGE)
|
||||||
|
return true;
|
||||||
if (!K_Sliptiding(player) && player->drift == 0
|
if (!K_Sliptiding(player) && player->drift == 0
|
||||||
&& P_IsObjectOnGround(player->mo) && player->sneakertimer == 0
|
&& P_IsObjectOnGround(player->mo) && player->sneakertimer == 0
|
||||||
&& player->driftboost == 0)
|
&& player->driftboost == 0)
|
||||||
|
|
@ -9393,6 +9397,8 @@ static void K_KartDrift(player_t *player, boolean onground)
|
||||||
K_SpawnAIZDust(player);
|
K_SpawnAIZDust(player);
|
||||||
|
|
||||||
player->sliptideZip++;
|
player->sliptideZip++;
|
||||||
|
if (player->sliptideZip == MIN_WAVEDASH_CHARGE)
|
||||||
|
S_StartSound(player->mo, sfx_waved5);
|
||||||
|
|
||||||
if (abs(player->aizdrifttilt) < ANGLE_22h)
|
if (abs(player->aizdrifttilt) < ANGLE_22h)
|
||||||
{
|
{
|
||||||
|
|
@ -9420,35 +9426,38 @@ static void K_KartDrift(player_t *player, boolean onground)
|
||||||
player->sliptideZipDelay++;
|
player->sliptideZipDelay++;
|
||||||
if (player->sliptideZipDelay > TICRATE/2)
|
if (player->sliptideZipDelay > TICRATE/2)
|
||||||
{
|
{
|
||||||
fixed_t maxZipPower = 2*FRACUNIT;
|
if (player->sliptideZip >= MIN_WAVEDASH_CHARGE)
|
||||||
fixed_t minZipPower = 1*FRACUNIT;
|
{
|
||||||
fixed_t powerSpread = maxZipPower - minZipPower;
|
fixed_t maxZipPower = 2*FRACUNIT;
|
||||||
|
fixed_t minZipPower = 1*FRACUNIT;
|
||||||
|
fixed_t powerSpread = maxZipPower - minZipPower;
|
||||||
|
|
||||||
int minPenalty = 2*1 + (9-9); // Kinda doing a similar thing to driftspark stage timers here.
|
int minPenalty = 2*1 + (9-9); // Kinda doing a similar thing to driftspark stage timers here.
|
||||||
int maxPenalty = 2*9 + (9-1); // 1/9 gets max, 9/1 gets min, everyone else gets something in between.
|
int maxPenalty = 2*9 + (9-1); // 1/9 gets max, 9/1 gets min, everyone else gets something in between.
|
||||||
int penaltySpread = maxPenalty - minPenalty;
|
int penaltySpread = maxPenalty - minPenalty;
|
||||||
int yourPenalty = 2*player->kartspeed + (9 - player->kartweight); // And like driftsparks, speed hurts double.
|
int yourPenalty = 2*player->kartspeed + (9 - player->kartweight); // And like driftsparks, speed hurts double.
|
||||||
|
|
||||||
yourPenalty -= minPenalty; // Normalize; minimum penalty should take away 0 power.
|
yourPenalty -= minPenalty; // Normalize; minimum penalty should take away 0 power.
|
||||||
|
|
||||||
fixed_t yourPowerReduction = FixedDiv(yourPenalty * FRACUNIT, penaltySpread * FRACUNIT);
|
fixed_t yourPowerReduction = FixedDiv(yourPenalty * FRACUNIT, penaltySpread * FRACUNIT);
|
||||||
fixed_t yourPower = maxZipPower - FixedMul(yourPowerReduction, powerSpread);
|
fixed_t yourPower = maxZipPower - FixedMul(yourPowerReduction, powerSpread);
|
||||||
int yourBoost = FixedInt(FixedMul(yourPower, player->sliptideZip * FRACUNIT));
|
int yourBoost = FixedInt(FixedMul(yourPower, player->sliptideZip * FRACUNIT));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CONS_Printf("SZ %d MZ %d mZ %d pwS %d mP %d MP %d peS %d yPe %d yPR %d yPw %d yB %d\n",
|
CONS_Printf("SZ %d MZ %d mZ %d pwS %d mP %d MP %d peS %d yPe %d yPR %d yPw %d yB %d\n",
|
||||||
player->sliptideZip, maxZipPower, minZipPower, powerSpread, minPenalty, maxPenalty, penaltySpread, yourPenalty, yourPowerReduction, yourPower, yourBoost);
|
player->sliptideZip, maxZipPower, minZipPower, powerSpread, minPenalty, maxPenalty, penaltySpread, yourPenalty, yourPowerReduction, yourPower, yourBoost);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
player->sliptideZipBoost += yourBoost;
|
player->sliptideZipBoost += yourBoost;
|
||||||
|
|
||||||
K_SpawnDriftBoostExplosion(player, 0);
|
K_SpawnDriftBoostExplosion(player, 0);
|
||||||
player->sliptideZip = 0;
|
S_StartSoundAtVolume(player->mo, sfx_waved3, 2*255/3); // Boost
|
||||||
player->sliptideZipDelay = 0;
|
}
|
||||||
S_StopSoundByID(player->mo, sfx_waved1);
|
S_StopSoundByID(player->mo, sfx_waved1);
|
||||||
S_StopSoundByID(player->mo, sfx_waved2);
|
S_StopSoundByID(player->mo, sfx_waved2);
|
||||||
S_StopSoundByID(player->mo, sfx_waved4);
|
S_StopSoundByID(player->mo, sfx_waved4);
|
||||||
S_StartSoundAtVolume(player->mo, sfx_waved3, 2*255/3); // Boost
|
player->sliptideZip = 0;
|
||||||
|
player->sliptideZipDelay = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -2241,7 +2241,7 @@ static void P_UpdatePlayerAngle(player_t *player)
|
||||||
angle_t leniency = (2*ANG1/3) * min(player->cmd.latency, 6);
|
angle_t leniency = (2*ANG1/3) * min(player->cmd.latency, 6);
|
||||||
// Don't force another turning tic, just give them the desired angle!
|
// Don't force another turning tic, just give them the desired angle!
|
||||||
|
|
||||||
if (targetDelta == angleChange || player->pflags & PF_DRIFTEND || (maxTurnRight == 0 && maxTurnLeft == 0))
|
if (targetDelta == angleChange || player->pflags & PF_DRIFTEND || K_Sliptiding(player) || (maxTurnRight == 0 && maxTurnLeft == 0))
|
||||||
{
|
{
|
||||||
// We are where we need to be.
|
// We are where we need to be.
|
||||||
// ...Or we aren't, but shouldn't be able to steer.
|
// ...Or we aren't, but shouldn't be able to steer.
|
||||||
|
|
|
||||||
|
|
@ -1135,6 +1135,7 @@ sfxinfo_t S_sfx[NUMSFX] =
|
||||||
{"waved2", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
{"waved2", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
||||||
{"waved3", false, 32, 64, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
{"waved3", false, 32, 64, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
||||||
{"waved4", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
{"waved4", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
||||||
|
{"waved5", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
||||||
|
|
||||||
// Passing sounds
|
// Passing sounds
|
||||||
{"pass01", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
{"pass01", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""},
|
||||||
|
|
|
||||||
|
|
@ -1204,6 +1204,7 @@ typedef enum
|
||||||
sfx_waved2,
|
sfx_waved2,
|
||||||
sfx_waved3,
|
sfx_waved3,
|
||||||
sfx_waved4,
|
sfx_waved4,
|
||||||
|
sfx_waved5,
|
||||||
|
|
||||||
// Passing sounds
|
// Passing sounds
|
||||||
sfx_pass01,
|
sfx_pass01,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue