Spindash: new braking

This commit is contained in:
lachwright 2020-06-09 05:27:05 +08:00
parent b4057d10e7
commit 8087352f9e
7 changed files with 25 additions and 31 deletions

View file

@ -287,7 +287,7 @@ typedef enum
k_jmp, // In Mario Kart, letting go of the jump button stops the drift k_jmp, // In Mario Kart, letting go of the jump button stops the drift
k_offroad, // In Super Mario Kart, going offroad has lee-way of about 1 second before you start losing speed k_offroad, // In Super Mario Kart, going offroad has lee-way of about 1 second before you start losing speed
k_pogospring, // Pogo spring bounce effect k_pogospring, // Pogo spring bounce effect
k_brakestop, // Wait until you've made a complete stop for a few tics before letting brake go in reverse. k_spindash, // Spindash charge
k_waterskip, // Water skipping counter k_waterskip, // Water skipping counter
k_dashpadcooldown, // Separate the vanilla SA-style dash pads from using pw_flashing k_dashpadcooldown, // Separate the vanilla SA-style dash pads from using pw_flashing
k_numboosts, // Count of how many boosts are being stacked, for after image spawning k_numboosts, // Count of how many boosts are being stacked, for after image spawning

View file

@ -42,6 +42,8 @@ typedef enum
BT_CUSTOM3 = 1<<15, BT_CUSTOM3 = 1<<15,
} buttoncode_t; } buttoncode_t;
#define BT_SPINDASHMASK (BT_ACCELERATE|BT_BRAKE)
// The data sampled per tick (single player) // The data sampled per tick (single player)
// and transmitted to other peers (multiplayer). // and transmitted to other peers (multiplayer).
// Mainly movements/button commands per game tick, // Mainly movements/button commands per game tick,

View file

@ -8504,7 +8504,7 @@ static const char *const KARTSTUFF_LIST[] = {
"JMP", "JMP",
"OFFROAD", "OFFROAD",
"POGOSPRING", "POGOSPRING",
"BRAKESTOP", "SPINDASH",
"WATERSKIP", "WATERSKIP",
"DASHPADCOOLDOWN", "DASHPADCOOLDOWN",
"NUMBOOSTS", "NUMBOOSTS",

View file

@ -7404,7 +7404,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
player->mo->friction += 4608; player->mo->friction += 4608;
} }
if ((cmd->buttons & (BT_BRAKE|BT_ACCELERATE)) == (BT_BRAKE|BT_ACCELERATE) && !(player->kartstuff[k_drift])) if ((cmd->buttons & BT_SPINDASHMASK) == BT_SPINDASHMASK
&& !player->kartstuff[k_drift])
player->mo->friction -= 3072; player->mo->friction -= 3072;
else if (player->speed > 0 && cmd->forwardmove < 0) // change friction while braking no matter what, otherwise it's not any more effective than just letting go off accel else if (player->speed > 0 && cmd->forwardmove < 0) // change friction while braking no matter what, otherwise it's not any more effective than just letting go off accel
player->mo->friction -= 2048; player->mo->friction -= 2048;
@ -7454,13 +7455,20 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
K_KartDrift(player, P_IsObjectOnGround(player->mo)); // Not using onground, since we don't want this affected by spring pads K_KartDrift(player, P_IsObjectOnGround(player->mo)); // Not using onground, since we don't want this affected by spring pads
// Quick Turning // Spindash
// You can't turn your kart when you're not moving. if ((cmd->buttons & BT_SPINDASHMASK) == BT_SPINDASHMASK
// So now it's time to burn some rubber! && !player->kartstuff[k_drift]
if (player->speed < 2 && leveltime > starttime && cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE && cmd->driftturn != 0) && !player->kartstuff[k_spinouttimer]
&& leveltime > starttime)
{ {
if (leveltime % 8 == 0) if (player->speed < 6*mapobjectscale)
S_StartSound(player->mo, sfx_s224); {
if (cmd->driftturn != 0 && leveltime % 8 == 0)
S_StartSound(player->mo, sfx_ruburn);
}
else
if (leveltime % 4 == 0)
S_StartSound(player->mo, sfx_s3k36);
} }
// Squishing // Squishing

View file

@ -2796,7 +2796,6 @@ static void P_PlayerZMovement(mobj_t *mo)
// Check if we're on a polyobject // Check if we're on a polyobject
// that triggers a linedef executor. // that triggers a linedef executor.
msecnode_t *node; msecnode_t *node;
boolean stopmovecut = false;
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next) for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
@ -2828,8 +2827,8 @@ static void P_PlayerZMovement(mobj_t *mo)
polysec = po->lines[0]->backsector; polysec = po->lines[0]->backsector;
// Moving polyobjects should act like conveyors if the player lands on one. (I.E. none of the momentum cut thing below) -Red // Moving polyobjects should act like conveyors if the player lands on one. (I.E. none of the momentum cut thing below) -Red
if ((mo->z == polysec->ceilingheight || mo->z+mo->height == polysec->floorheight) && po->thinker) /*if ((mo->z == polysec->ceilingheight || mo->z+mo->height == polysec->floorheight) && po->thinker)
stopmovecut = true; stopmovecut = true;*/
if (!(po->flags & POF_LDEXEC)) if (!(po->flags & POF_LDEXEC))
{ {
@ -2850,24 +2849,7 @@ static void P_PlayerZMovement(mobj_t *mo)
} }
} }
} }
if (!stopmovecut)
#endif #endif
// Cut momentum in half when you hit the ground and
// aren't pressing any controls.
if (!(mo->player->cmd.forwardmove || mo->player->cmd.sidemove) && !mo->player->cmomx && !mo->player->cmomy
&& !(mo->player->kartstuff[k_spinouttimer]))
{
mo->momx = mo->momx/2;
mo->momy = mo->momy/2;
if (mo->player->cmd.buttons & BT_BRAKE && !(mo->player->cmd.forwardmove)) // FURTHER slowdown if you're braking.
{
mo->momx = mo->momx/2;
mo->momy = mo->momy/2;
}
}
} }
if (mo->health) if (mo->health)

View file

@ -884,7 +884,9 @@ void P_ButteredSlope(mobj_t *mo)
if (mo->player) { if (mo->player) {
// SRB2Kart - spindash negates slopes // SRB2Kart - spindash negates slopes
if (((mo->player->cmd.buttons & (BT_BRAKE|BT_ACCELERATE)) == (BT_BRAKE|BT_ACCELERATE)) && !mo->player->kartstuff[k_drift]) if (((mo->player->cmd.buttons & BT_SPINDASHMASK) == BT_SPINDASHMASK)
&& !mo->player->kartstuff[k_drift]
&& !mo->player->kartstuff[k_spinouttimer])
return; return;
// Changed in kart to only not apply physics on very slight slopes (I think about 4 degree angles) // Changed in kart to only not apply physics on very slight slopes (I think about 4 degree angles)

View file

@ -5785,7 +5785,7 @@ static void P_MovePlayer(player_t *player)
// Kart: store the current turn range for later use // Kart: store the current turn range for later use
if ((player->mo && player->speed > 0) // Moving if ((player->mo && player->speed > 0) // Moving
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn || (leveltime > starttime && (cmd->buttons & BT_SPINDASHMASK) == BT_SPINDASHMASK) // Rubber-burn turn
|| (player->respawn.state != RESPAWNST_NONE) // Respawning || (player->respawn.state != RESPAWNST_NONE) // Respawning
|| (player->spectator || objectplacing)) // Not a physical player || (player->spectator || objectplacing)) // Not a physical player
{ {