From 9b1ec816220c52b2eade580adc1d0bc5a16c0e89 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sat, 9 May 2020 06:24:53 +0800 Subject: [PATCH 01/23] Start hill-parking --- src/g_game.c | 14 +++++++------- src/k_kart.c | 7 ++++--- src/p_mobj.c | 2 +- src/p_slopes.c | 4 ++++ src/p_user.c | 12 ------------ 5 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index a97143d21..e18f4788c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1248,7 +1248,7 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 p) INT32 localaiming[MAXSPLITSCREENPLAYERS]; angle_t localangle[MAXSPLITSCREENPLAYERS]; -static fixed_t forwardmove[2] = {25<>16, 50<>16}; +static fixed_t forwardmove = 50<>16; static fixed_t sidemove[2] = {2<>16, 4<>16}; static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn @@ -1418,9 +1418,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) cmd->buttons |= BT_BRAKE; axis = JoyAxis(AXISAIM, ssplayer); if (InputDown(gc_aimforward, ssplayer) || (usejoystick && axis < 0)) - forward += forwardmove[1]; + forward += forwardmove; if (InputDown(gc_aimbackward, ssplayer) || (usejoystick && axis > 0)) - forward -= forwardmove[1]; + forward -= forwardmove; } else { @@ -1429,13 +1429,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || EITHERSNEAKER(player)) { cmd->buttons |= BT_ACCELERATE; - forward = forwardmove[1]; // 50 + forward = forwardmove; // 50 } else if (analogjoystickmove && axis > 0) { cmd->buttons |= BT_ACCELERATE; // JOYAXISRANGE is supposed to be 1023 (divide by 1024) - forward += ((axis * forwardmove[1]) >> 10)*2; + forward += ((axis * forwardmove) >> 10)*2; } axis = JoyAxis(AXISBRAKE, ssplayer); @@ -1443,14 +1443,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) { cmd->buttons |= BT_BRAKE; if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0) - forward -= forwardmove[0]; // 25 - Halved value so clutching is possible + forward -= forwardmove; } else if (analogjoystickmove && axis > 0) { cmd->buttons |= BT_BRAKE; // JOYAXISRANGE is supposed to be 1023 (divide by 1024) if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0) - forward -= ((axis * forwardmove[0]) >> 10); + forward -= ((axis * forwardmove) >> 10); } // But forward/backward IS used for aiming. diff --git a/src/k_kart.c b/src/k_kart.c index 2a672af13..bdbd37927 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2728,7 +2728,6 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove // forwardmove is: // 50 while accelerating, - // 25 while clutching, // 0 with no gas, and // -25 when only braking. @@ -7889,11 +7888,13 @@ void K_MoveKartPlayer(player_t *player, boolean onground) // Friction if (!player->kartstuff[k_offroad]) { - if (player->speed > 0 && cmd->forwardmove == 0 && player->mo->friction == 59392) + if (player->speed > 0 && cmd->forwardmove == 0 && !(cmd->buttons & BT_BRAKE) && player->mo->friction == 59392) player->mo->friction += 4608; } - 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 + if ((cmd->buttons & (BT_BRAKE|BT_ACCELERATE)) == (BT_BRAKE|BT_ACCELERATE) && !(player->kartstuff[k_drift])) + 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 player->mo->friction -= 2048; // Karma ice physics diff --git a/src/p_mobj.c b/src/p_mobj.c index 1a7c562a7..56edd4f59 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1439,7 +1439,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) && abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale) && (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING)) #ifdef ESLOPE - && !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)) + && !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)))// && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)) #endif ) { diff --git a/src/p_slopes.c b/src/p_slopes.c index 0825ebca6..ffb50f407 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -883,6 +883,10 @@ void P_ButteredSlope(mobj_t *mo) return; // don't slide down slopes if you can't touch them or you're not affected by gravity if (mo->player) { + // SRB2Kart - spindash negates slopes + if (((mo->player->cmd.buttons & (BT_BRAKE|BT_ACCELERATE)) == (BT_BRAKE|BT_ACCELERATE)) && !mo->player->kartstuff[k_drift]) + return; + // Changed in kart to only not apply physics on very slight slopes (I think about 4 degree angles) if (abs(mo->standingslope->zdelta) < FRACUNIT/21 && !(mo->player->pflags & PF_SPINNING)) return; // Don't slide on non-steep slopes unless spinning diff --git a/src/p_user.c b/src/p_user.c index 54e2350b6..a5bcd5653 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4108,18 +4108,6 @@ static void P_3dMovement(player_t *player) if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration... movepushforward = FixedMul(movepushforward, player->mo->movefactor); - if (cmd->buttons & BT_BRAKE && !cmd->forwardmove) // SRB2kart - braking isn't instant - movepushforward /= 64; - - if (cmd->forwardmove > 0) - player->kartstuff[k_brakestop] = 0; - else if (player->kartstuff[k_brakestop] < 6) // Don't start reversing with brakes until you've made a stop first - { - if (player->speed < 8*FRACUNIT) - player->kartstuff[k_brakestop]++; - movepushforward = 0; - } - #ifdef ESLOPE totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward); totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward); From 8087352f9e6ef949cc5b254cdd99182d34a0f588 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 9 Jun 2020 05:27:05 +0800 Subject: [PATCH 02/23] Spindash: new braking --- src/d_player.h | 2 +- src/d_ticcmd.h | 2 ++ src/dehacked.c | 2 +- src/k_kart.c | 22 +++++++++++++++------- src/p_mobj.c | 22 ++-------------------- src/p_slopes.c | 4 +++- src/p_user.c | 2 +- 7 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 6a06c7493..6a9dbb2fa 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -287,7 +287,7 @@ typedef enum 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_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_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 diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h index c73c161b5..1a37d1b1e 100644 --- a/src/d_ticcmd.h +++ b/src/d_ticcmd.h @@ -42,6 +42,8 @@ typedef enum BT_CUSTOM3 = 1<<15, } buttoncode_t; +#define BT_SPINDASHMASK (BT_ACCELERATE|BT_BRAKE) + // The data sampled per tick (single player) // and transmitted to other peers (multiplayer). // Mainly movements/button commands per game tick, diff --git a/src/dehacked.c b/src/dehacked.c index a0efc5cb2..59c00721a 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8504,7 +8504,7 @@ static const char *const KARTSTUFF_LIST[] = { "JMP", "OFFROAD", "POGOSPRING", - "BRAKESTOP", + "SPINDASH", "WATERSKIP", "DASHPADCOOLDOWN", "NUMBOOSTS", diff --git a/src/k_kart.c b/src/k_kart.c index d3ff34d69..92aaa6b7e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7404,7 +7404,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground) 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; 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; @@ -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 - // Quick Turning - // You can't turn your kart when you're not moving. - // So now it's time to burn some rubber! - if (player->speed < 2 && leveltime > starttime && cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE && cmd->driftturn != 0) + // Spindash + if ((cmd->buttons & BT_SPINDASHMASK) == BT_SPINDASHMASK + && !player->kartstuff[k_drift] + && !player->kartstuff[k_spinouttimer] + && leveltime > starttime) { - if (leveltime % 8 == 0) - S_StartSound(player->mo, sfx_s224); + if (player->speed < 6*mapobjectscale) + { + 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 diff --git a/src/p_mobj.c b/src/p_mobj.c index cfd14efe5..3f37d1d72 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2796,7 +2796,6 @@ static void P_PlayerZMovement(mobj_t *mo) // Check if we're on a polyobject // that triggers a linedef executor. msecnode_t *node; - boolean stopmovecut = false; 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; // 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) - stopmovecut = true; + /*if ((mo->z == polysec->ceilingheight || mo->z+mo->height == polysec->floorheight) && po->thinker) + stopmovecut = true;*/ if (!(po->flags & POF_LDEXEC)) { @@ -2850,24 +2849,7 @@ static void P_PlayerZMovement(mobj_t *mo) } } } - - if (!stopmovecut) #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) diff --git a/src/p_slopes.c b/src/p_slopes.c index ffb50f407..d3faa5e4a 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -884,7 +884,9 @@ void P_ButteredSlope(mobj_t *mo) if (mo->player) { // 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; // Changed in kart to only not apply physics on very slight slopes (I think about 4 degree angles) diff --git a/src/p_user.c b/src/p_user.c index 9fba3b2d6..3cbe533cb 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5785,7 +5785,7 @@ static void P_MovePlayer(player_t *player) // Kart: store the current turn range for later use 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->spectator || objectplacing)) // Not a physical player { From 8ab98011f6a3a6154d5e721561174f43959ad7d2 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 6 Jul 2020 08:10:03 +0800 Subject: [PATCH 03/23] Spindash charge (WIP) --- src/d_ticcmd.h | 4 +- src/k_kart.c | 102 +++++++++++++++++++++++++++++++++++++++---------- src/k_kart.h | 1 + src/p_slopes.c | 4 +- src/p_user.c | 2 +- 5 files changed, 87 insertions(+), 26 deletions(-) diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h index 1a37d1b1e..0340b9f40 100644 --- a/src/d_ticcmd.h +++ b/src/d_ticcmd.h @@ -34,6 +34,8 @@ typedef enum BT_BACKWARD = 1<<6, // Aim Item Backward BT_LOOKBACK = 1<<7, // Look Backward + BT_EBRAKEMASK = (BT_ACCELERATE|BT_BRAKE), + // free: 1<<8 to 1<<12 // Lua garbage @@ -42,8 +44,6 @@ typedef enum BT_CUSTOM3 = 1<<15, } buttoncode_t; -#define BT_SPINDASHMASK (BT_ACCELERATE|BT_BRAKE) - // The data sampled per tick (single player) // and transmitted to other peers (multiplayer). // Mainly movements/button commands per game tick, diff --git a/src/k_kart.c b/src/k_kart.c index 92aaa6b7e..ed4736411 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1588,7 +1588,7 @@ void K_SpawnDashDustRelease(player_t *player) if (!P_IsObjectOnGround(player->mo)) return; - if (!player->speed && !player->kartstuff[k_startboost]) + if (!player->speed && !player->kartstuff[k_startboost] && !player->kartstuff[k_spindash]) return; travelangle = player->mo->angle; @@ -6682,6 +6682,83 @@ static INT32 K_FlameShieldMax(player_t *player) return min(16, 1 + (disttofinish / distv)); } +boolean K_PlayerEBrake(player_t *player) +{ + return (player->cmd.buttons & BT_EBRAKEMASK) == BT_EBRAKEMASK + && !player->kartstuff[k_drift] + && !player->kartstuff[k_spinouttimer] + && !player->kartstuff[k_boostcharge] + && !(player->kartstuff[k_spindash] < 0) + && !player->powers[pw_nocontrol] + && leveltime > starttime; +} + +tic_t K_GetSpindashChargeTime(player_t *player) +{ + return (player->kartspeed + 4)*TICRATE/3; // more charge time for higher speed: Tails = 2s, Mighty = 3s, Fang = 4s +} + +fixed_t K_GetSpindashChargeSpeed(player_t *player) +{ + return FixedMul(FRACUNIT + (player->kartweight - 5)*FRACUNIT/12, K_GetKartSpeed(player, false)); // more speed for higher weight: Tails = 75%, Fang = 100%, Mighty = 125% +} + +void K_KartSpindash(player_t *player) +{ + ticcmd_t *cmd = &player->cmd; + + if (!(K_PlayerEBrake(player) || (player->kartstuff[k_spindash] && !(cmd->buttons & BT_BRAKE)))) + { + if (player->kartstuff[k_spindash]) + player->kartstuff[k_spindash] = 0; + return; + } + + if (player->speed < 6*mapobjectscale) + { + const tic_t MAXCHARGETIME = K_GetSpindashChargeTime(player); + const fixed_t MAXCHARGESPEED = K_GetSpindashChargeSpeed(player); + + if (cmd->driftturn != 0 && leveltime % 8 == 0) + S_StartSound(player->mo, sfx_ruburn); + + if ((cmd->buttons & (BT_DRIFT|BT_BRAKE)) == (BT_DRIFT|BT_BRAKE)) + { + INT16 chargetime = MAXCHARGETIME - ++player->kartstuff[k_spindash]; + if (chargetime > 0) + { + UINT16 soundcharge = 0; + UINT8 add = 0; + while ((soundcharge += ++add) < chargetime); + if (soundcharge == chargetime) + { + K_SpawnDashDustRelease(player); + S_StartSound(player->mo, sfx_s3kab); + } + } + else if (chargetime < -TICRATE) + K_SpinPlayer(player, NULL, 0, NULL, false); + else + { + if (player->kartstuff[k_spindash] % 4 == 0) + { + K_SpawnDashDustRelease(player); + K_FlameDashLeftoverSmoke(player->mo); + } + } + } + else if (player->kartstuff[k_spindash]) + { + fixed_t speed = player->kartstuff[k_spindash]*MAXCHARGESPEED/MAXCHARGETIME; + player->kartstuff[k_spindash] = 0; + S_StartSound(player->mo, sfx_s23c); + } + } + else + if (leveltime % 4 == 0) + S_StartSound(player->mo, sfx_kc2b); +} + // // K_MoveKartPlayer // @@ -7389,6 +7466,8 @@ 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 + if (onground) { fixed_t prevfriction = player->mo->friction; @@ -7404,8 +7483,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->mo->friction += 4608; } - if ((cmd->buttons & BT_SPINDASHMASK) == BT_SPINDASHMASK - && !player->kartstuff[k_drift]) + if (K_PlayerEBrake(player)) 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 player->mo->friction -= 2048; @@ -7451,24 +7529,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { player->mo->friction = K_BotFrictionRubberband(player, player->mo->friction); } - } - K_KartDrift(player, P_IsObjectOnGround(player->mo)); // Not using onground, since we don't want this affected by spring pads - - // Spindash - if ((cmd->buttons & BT_SPINDASHMASK) == BT_SPINDASHMASK - && !player->kartstuff[k_drift] - && !player->kartstuff[k_spinouttimer] - && leveltime > starttime) - { - if (player->speed < 6*mapobjectscale) - { - if (cmd->driftturn != 0 && leveltime % 8 == 0) - S_StartSound(player->mo, sfx_ruburn); - } - else - if (leveltime % 4 == 0) - S_StartSound(player->mo, sfx_s3k36); + K_KartSpindash(player); } // Squishing diff --git a/src/k_kart.h b/src/k_kart.h index af247029d..a5671540d 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -70,6 +70,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower); fixed_t K_GetKartAccel(player_t *player); UINT16 K_GetKartFlashing(player_t *player); fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove); +boolean K_PlayerEBrake(player_t *player); void K_MoveKartPlayer(player_t *player, boolean onground); void K_CheckSpectateStatus(void); diff --git a/src/p_slopes.c b/src/p_slopes.c index d3faa5e4a..0296ef38f 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -884,9 +884,7 @@ void P_ButteredSlope(mobj_t *mo) if (mo->player) { // SRB2Kart - spindash negates slopes - if (((mo->player->cmd.buttons & BT_SPINDASHMASK) == BT_SPINDASHMASK) - && !mo->player->kartstuff[k_drift] - && !mo->player->kartstuff[k_spinouttimer]) + if (K_PlayerEBrake(mo->player)) return; // Changed in kart to only not apply physics on very slight slopes (I think about 4 degree angles) diff --git a/src/p_user.c b/src/p_user.c index 3cbe533cb..49252712d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5785,7 +5785,7 @@ static void P_MovePlayer(player_t *player) // Kart: store the current turn range for later use if ((player->mo && player->speed > 0) // Moving - || (leveltime > starttime && (cmd->buttons & BT_SPINDASHMASK) == BT_SPINDASHMASK) // Rubber-burn turn + || (leveltime > starttime && (cmd->buttons & BT_EBRAKEMASK) == BT_EBRAKEMASK) // Rubber-burn turn || (player->respawn.state != RESPAWNST_NONE) // Respawning || (player->spectator || objectplacing)) // Not a physical player { From 4a9a33130ac84bf7f1b360b4f0b92c9ad42dab6b Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 23 Jul 2020 19:23:27 -0400 Subject: [PATCH 04/23] Make it compile --- src/k_kart.c | 6 +++--- src/p_slopes.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index e8160ac51..1dd48083d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6829,17 +6829,17 @@ boolean K_PlayerEBrake(player_t *player) && leveltime > starttime; } -tic_t K_GetSpindashChargeTime(player_t *player) +static tic_t K_GetSpindashChargeTime(player_t *player) { return (player->kartspeed + 4)*TICRATE/3; // more charge time for higher speed: Tails = 2s, Mighty = 3s, Fang = 4s } -fixed_t K_GetSpindashChargeSpeed(player_t *player) +static fixed_t K_GetSpindashChargeSpeed(player_t *player) { return FixedMul(FRACUNIT + (player->kartweight - 5)*FRACUNIT/12, K_GetKartSpeed(player, false)); // more speed for higher weight: Tails = 75%, Fang = 100%, Mighty = 125% } -void K_KartSpindash(player_t *player) +static void K_KartSpindash(player_t *player) { ticcmd_t *cmd = &player->cmd; diff --git a/src/p_slopes.c b/src/p_slopes.c index 0296ef38f..6c44d2d9e 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -22,6 +22,7 @@ #include "r_main.h" #include "p_maputl.h" #include "w_wad.h" +#include "k_kart.h" // K_PlayerEBrake #ifdef ESLOPE From db230e4d3d7da64259aff69449383ed8fa7e899c Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Thu, 23 Jul 2020 21:31:10 -0400 Subject: [PATCH 05/23] Add spindash launch, prevent charging while flashing Used a timed buff instead of thrust due to friction issues, as a result I had to rebalance some values --- src/d_player.h | 4 ++- src/dehacked.c | 2 ++ src/k_kart.c | 66 +++++++++++++++++++++++++++++++++++++++----------- 3 files changed, 57 insertions(+), 15 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 786c516fb..a133cbadc 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -287,7 +287,9 @@ typedef enum 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_pogospring, // Pogo spring bounce effect - k_spindash, // Spindash charge + k_spindash, // Spindash charge timer + k_spindashspeed, // Spindash release speed + k_spindashboost, // Spindash release boost timer k_waterskip, // Water skipping counter 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 diff --git a/src/dehacked.c b/src/dehacked.c index e3be7d574..b2af81cfb 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8838,6 +8838,8 @@ static const char *const KARTSTUFF_LIST[] = { "OFFROAD", "POGOSPRING", "SPINDASH", + "SPINDASHSPEED", + "SPINDASHBOOST", "WATERSKIP", "DASHPADCOOLDOWN", "NUMBOOSTS", diff --git a/src/k_kart.c b/src/k_kart.c index 1dd48083d..5ce8558ec 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2028,6 +2028,16 @@ static fixed_t K_FlameShieldDashVar(INT32 val) return (3*FRACUNIT/4) + (((val * FRACUNIT) / TICRATE) / 2); } +static tic_t K_GetSpindashChargeTime(player_t *player) +{ + return (player->kartspeed + 4) * (TICRATE/3); // more charge time for higher speed: Tails = 2s, Mighty = 3s, Fang = 4s +} + +static fixed_t K_GetSpindashChargeSpeed(player_t *player) +{ + return player->kartweight * (FRACUNIT/12); // more speed for higher weight: Tails = 116%, Fang = 142%, Mighty = 166% +} + // Light weights have stronger boost stacking -- aka, better metabolism than heavies XD #define METABOLISM @@ -2093,6 +2103,16 @@ static void K_GetKartBoostPower(player_t *player) ADDBOOST(K_FlameShieldDashVar(player->kartstuff[k_flamedash]), 3*FRACUNIT); // + infinite top speed, + 300% acceleration } + if (player->kartstuff[k_spindashboost]) // Spindash boost + { + const fixed_t MAXCHARGESPEED = K_GetSpindashChargeSpeed(player); + + ADDBOOST( + FixedMul(player->kartstuff[k_spindashspeed], MAXCHARGESPEED), + (8*FRACUNIT) + (24*player->kartstuff[k_spindashspeed]) + ); // character & charge time dependent + } + if (player->kartstuff[k_startboost]) // Startup Boost { ADDBOOST(FRACUNIT/4, 6*FRACUNIT); // + 25% top speed, + 600% acceleration @@ -2267,7 +2287,7 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove // 0 with no gas, and // -25 when only braking. - if (player->kartstuff[k_sneakertimer]) + if (player->kartstuff[k_sneakertimer] || player->kartstuff[k_spindashboost]) forwardmove = 50; finalspeed *= forwardmove/25; @@ -5701,6 +5721,17 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_startboost]) player->kartstuff[k_startboost]--; + if (player->kartstuff[k_spindashboost]) + { + player->kartstuff[k_spindashboost]--; + + if (player->kartstuff[k_spindashboost] <= 0) + { + player->kartstuff[k_spindashspeed] = FRACUNIT; + player->kartstuff[k_spindashboost] = 0; + } + } + if (player->kartstuff[k_invincibilitytimer]) player->kartstuff[k_invincibilitytimer]--; @@ -6825,20 +6856,11 @@ boolean K_PlayerEBrake(player_t *player) && !player->kartstuff[k_spinouttimer] && !player->kartstuff[k_boostcharge] && !(player->kartstuff[k_spindash] < 0) + && !player->kartstuff[k_spindashboost] && !player->powers[pw_nocontrol] && leveltime > starttime; } -static tic_t K_GetSpindashChargeTime(player_t *player) -{ - return (player->kartspeed + 4)*TICRATE/3; // more charge time for higher speed: Tails = 2s, Mighty = 3s, Fang = 4s -} - -static fixed_t K_GetSpindashChargeSpeed(player_t *player) -{ - return FixedMul(FRACUNIT + (player->kartweight - 5)*FRACUNIT/12, K_GetKartSpeed(player, false)); // more speed for higher weight: Tails = 75%, Fang = 100%, Mighty = 125% -} - static void K_KartSpindash(player_t *player) { ticcmd_t *cmd = &player->cmd; @@ -6850,10 +6872,9 @@ static void K_KartSpindash(player_t *player) return; } - if (player->speed < 6*mapobjectscale) + if (player->speed < 6*mapobjectscale && player->powers[pw_flashing] == 0) { const tic_t MAXCHARGETIME = K_GetSpindashChargeTime(player); - const fixed_t MAXCHARGESPEED = K_GetSpindashChargeSpeed(player); if (cmd->driftturn != 0 && leveltime % 8 == 0) S_StartSound(player->mo, sfx_ruburn); @@ -6885,7 +6906,24 @@ static void K_KartSpindash(player_t *player) } else if (player->kartstuff[k_spindash]) { - fixed_t speed = player->kartstuff[k_spindash]*MAXCHARGESPEED/MAXCHARGETIME; + player->kartstuff[k_spindashspeed] = (player->kartstuff[k_spindash] * FRACUNIT) / MAXCHARGETIME; + player->kartstuff[k_spindashboost] = TICRATE; + + if (!player->kartstuff[k_tiregrease]) + { + UINT8 i; + for (i = 0; i < 2; i++) + { + mobj_t *grease; + grease = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_TIREGREASE); + P_SetTarget(&grease->target, player->mo); + grease->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); + grease->extravalue1 = i; + } + } + + player->kartstuff[k_tiregrease] = 2*TICRATE; + player->kartstuff[k_spindash] = 0; S_StartSound(player->mo, sfx_s23c); } From e6cc99c8c811d7e057746a80c0929c4e282e489a Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 24 Jul 2020 02:07:06 -0400 Subject: [PATCH 06/23] Rebalanced values, so speed gets better boosts too Also, prevent spindash timer from being stored when mid-air --- src/k_kart.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 5ce8558ec..0b552d42b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2030,12 +2030,17 @@ static fixed_t K_FlameShieldDashVar(INT32 val) static tic_t K_GetSpindashChargeTime(player_t *player) { - return (player->kartspeed + 4) * (TICRATE/3); // more charge time for higher speed: Tails = 2s, Mighty = 3s, Fang = 4s + // more charge time for higher speed + // Tails = 2s, Mighty = 3s, Fang = 4s, Metal = 4s + return (player->kartspeed + 4) * (TICRATE/3); } static fixed_t K_GetSpindashChargeSpeed(player_t *player) { - return player->kartweight * (FRACUNIT/12); // more speed for higher weight: Tails = 116%, Fang = 142%, Mighty = 166% + // more speed for higher weight & speed + // Tails = +6.25%, Fang = +20.31%, Mighty = +20.31%, Metal = +25% + // (can be higher than this value when overcharged) + return (player->kartspeed + player->kartweight) * (FRACUNIT/64); } // Light weights have stronger boost stacking -- aka, better metabolism than heavies XD @@ -2070,8 +2075,8 @@ static void K_GetKartBoostPower(player_t *player) #define ADDBOOST(s,a) { \ numboosts++; \ - speedboost += FixedDiv(s, FRACUNIT + (metabolism * numboosts-1)); \ - accelboost += FixedDiv(a, FRACUNIT + (metabolism * numboosts-1)); \ + speedboost += FixedDiv(s, FRACUNIT + (metabolism * (numboosts-1))); \ + accelboost += FixedDiv(a, FRACUNIT + (metabolism * (numboosts-1))); \ } #else @@ -2107,10 +2112,11 @@ static void K_GetKartBoostPower(player_t *player) { const fixed_t MAXCHARGESPEED = K_GetSpindashChargeSpeed(player); + // character & charge dependent ADDBOOST( - FixedMul(player->kartstuff[k_spindashspeed], MAXCHARGESPEED), - (8*FRACUNIT) + (24*player->kartstuff[k_spindashspeed]) - ); // character & charge time dependent + FixedMul(MAXCHARGESPEED, player->kartstuff[k_spindashspeed]), // + 0 to K_GetSpindashChargeSpeed()% top speed + (4*FRACUNIT) + (36*player->kartstuff[k_spindashspeed]) // + 400% to 4000% acceleration + ); } if (player->kartstuff[k_startboost]) // Startup Boost @@ -6852,6 +6858,7 @@ static INT32 K_FlameShieldMax(player_t *player) boolean K_PlayerEBrake(player_t *player) { return (player->cmd.buttons & BT_EBRAKEMASK) == BT_EBRAKEMASK + && P_IsObjectOnGround(player->mo) && !player->kartstuff[k_drift] && !player->kartstuff[k_spinouttimer] && !player->kartstuff[k_boostcharge] @@ -6929,8 +6936,10 @@ static void K_KartSpindash(player_t *player) } } else + { if (leveltime % 4 == 0) S_StartSound(player->mo, sfx_kc2b); + } } // @@ -7677,10 +7686,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { player->mo->friction = K_BotFrictionRubberband(player, player->mo->friction); } - - K_KartSpindash(player); } + K_KartSpindash(player); + // Squishing // If a Grow player or a sector crushes you, get flattened instead of being killed. From fc89f2cc47646ab395901b422f6ec2f00fb08ff4 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 24 Jul 2020 02:59:47 -0400 Subject: [PATCH 07/23] Remove start boosts, let you roam, kill you for crossing the line before the start --- src/g_game.c | 16 +------ src/k_bot.c | 4 +- src/k_kart.c | 113 +++++++++++++++----------------------------------- src/p_enemy.c | 4 +- src/p_spec.c | 8 ++++ src/p_user.c | 22 ++++------ 6 files changed, 55 insertions(+), 112 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 2f362f7c4..6f4a72676 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1588,12 +1588,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) cmd->angleturn *= realtics; - // SRB2kart - no additional angle if not moving - if ((player->mo && player->speed > 0) // Moving - || (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn - || (player->respawn.state != RESPAWNST_NONE) // Respawning - || (player->spectator || objectplacing)) // Not a physical player - lang += (cmd->angleturn<<16); + lang += (cmd->angleturn<<16); cmd->angleturn = (INT16)(lang >> 16); cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations @@ -5176,14 +5171,7 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum) G_CopyTiccmd(cmd, &oldcmd[playernum], 1); - // SRB2kart: Copy-pasted from ticcmd building, removes that crappy demo cam - if (((players[displayplayers[0]].mo && players[displayplayers[0]].speed > 0) // Moving - || (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn - || (players[displayplayers[0]].respawn.state != RESPAWNST_NONE) // Respawning - || (players[displayplayers[0]].spectator || objectplacing)) // Not a physical player - && !(players[displayplayers[0]].kartstuff[k_spinouttimer] - && players[displayplayers[0]].kartstuff[k_sneakertimer])) // Spinning and boosting cancels out spinout - localangle[0] += (cmd->angleturn<<16); + localangle[0] += (cmd->angleturn<<16); if (!(demoflags & DF_GHOST) && *demo_p == DEMOMARKER) { diff --git a/src/k_bot.c b/src/k_bot.c index 933f6d37e..285f92142 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -700,11 +700,13 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) { tic_t boosthold = starttime - TICRATE; + cmd->buttons |= BT_ACCELERATE|BT_BRAKE; + boosthold -= (MAXBOTDIFFICULTY - player->botvars.difficulty); if (leveltime >= boosthold) { - cmd->buttons |= BT_ACCELERATE; + cmd->buttons |= BT_DRIFT; } return; diff --git a/src/k_kart.c b/src/k_kart.c index 0b552d42b..82eec1caa 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -27,6 +27,7 @@ #include "f_finale.h" #include "lua_hud.h" // For Lua hud checks #include "lua_hook.h" // For MobjDamage and ShouldDamage +#include "m_cheat.h" // objectplacing #include "k_waypoint.h" #include "k_bot.h" @@ -5145,8 +5146,10 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) #endif return; - if ((leveltime >= starttime-(2*TICRATE) && leveltime <= starttime) || (player->respawn.state == RESPAWNST_DROP)) // Startup boosts + if (player->respawn.state == RESPAWNST_DROP) // Dropdashing targetsnd = ((cmd->buttons & BT_ACCELERATE) ? 12 : 0); + else if (K_PlayerEBrake(player)) // Spindashing + targetsnd = ((cmd->buttons & BT_DRIFT) ? 12 : 0); else targetsnd = (((6*cmd->forwardmove)/25) + ((player->speed / mapobjectscale)/5))/2; @@ -5733,8 +5736,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_spindashboost] <= 0) { - player->kartstuff[k_spindashspeed] = FRACUNIT; - player->kartstuff[k_spindashboost] = 0; + player->kartstuff[k_spindashspeed] = player->kartstuff[k_spindashboost] = 0; } } @@ -6385,15 +6387,37 @@ static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer) INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue) { - fixed_t p_maxspeed = K_GetKartSpeed(player, false); - fixed_t p_speed = min(player->speed, (p_maxspeed * 2)); - fixed_t weightadjust = FixedDiv((p_maxspeed * 3) - p_speed, (p_maxspeed * 3) + (player->kartweight * FRACUNIT)); + fixed_t p_maxspeed; + fixed_t p_speed; + fixed_t weightadjust; - if (player->spectator) + if ((player->mo == NULL || P_MobjWasRemoved(player->mo))) + { + return 0; + } + + if (player->spectator || objectplacing) { return turnvalue; } + if (leveltime < introtime) + { + return 0; + } + + // SRB2kart - no additional angle if not moving + if ((player->speed <= 0) // Not moving + && ((player->cmd.buttons & BT_EBRAKEMASK) != BT_EBRAKEMASK) // not e-braking + && (player->respawn.state == RESPAWNST_NONE)) // Not respawning + { + return 0; + } + + p_maxspeed = K_GetKartSpeed(player, false); + p_speed = min(player->speed, (p_maxspeed * 2)); + weightadjust = FixedDiv((p_maxspeed * 3) - p_speed, (p_maxspeed * 3) + (player->kartweight * FRACUNIT)); + if (K_PlayerUsesBotMovement(player)) { turnvalue = 5*turnvalue/4; // Base increase to turning @@ -6864,8 +6888,7 @@ boolean K_PlayerEBrake(player_t *player) && !player->kartstuff[k_boostcharge] && !(player->kartstuff[k_spindash] < 0) && !player->kartstuff[k_spindashboost] - && !player->powers[pw_nocontrol] - && leveltime > starttime; + && !player->powers[pw_nocontrol]; } static void K_KartSpindash(player_t *player) @@ -6990,7 +7013,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else if (cmd->buttons & BT_ATTACK) player->pflags |= PF_ATTACKDOWN; - if (player && player->mo && player->mo->health > 0 && !player->spectator && !mapreset && leveltime > starttime + if (player && player->mo && player->mo->health > 0 && !player->spectator && !mapreset && leveltime > introtime && player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_squishedtimer] == 0 && (player->respawn.state == RESPAWNST_NONE)) { // First, the really specific, finicky items that function without the item being directly in your item slot. @@ -7711,76 +7734,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) S_StopMusic(); // The GO! sound stops the level start ambience } } - - // Start charging once you're given the opportunity. - if (leveltime >= starttime-(2*TICRATE) && leveltime <= starttime) - { - if (cmd->buttons & BT_ACCELERATE) - { - if (player->kartstuff[k_boostcharge] == 0) - player->kartstuff[k_boostcharge] = cmd->latency; - - player->kartstuff[k_boostcharge]++; - } - else - player->kartstuff[k_boostcharge] = 0; - } - - // Increase your size while charging your engine. - if (leveltime < starttime+10) - { - player->mo->scalespeed = mapobjectscale/12; - player->mo->destscale = mapobjectscale + (player->kartstuff[k_boostcharge]*131); - if (cv_kartdebugshrink.value && !modeattacking && !player->bot) - player->mo->destscale = (6*player->mo->destscale)/8; - } - - // Determine the outcome of your charge. - if (leveltime > starttime && player->kartstuff[k_boostcharge]) - { - // Not even trying? - if (player->kartstuff[k_boostcharge] < 35) - { - if (player->kartstuff[k_boostcharge] > 17) - S_StartSound(player->mo, sfx_cdfm00); // chosen instead of a conventional skid because it's more engine-like - } - // Get an instant boost! - else if (player->kartstuff[k_boostcharge] <= 50) - { - player->kartstuff[k_startboost] = (50-player->kartstuff[k_boostcharge])+20; - - if (player->kartstuff[k_boostcharge] <= 36) - { - player->kartstuff[k_startboost] = 0; - K_DoSneaker(player, 0); - player->kartstuff[k_sneakertimer] = 70; // PERFECT BOOST!! - - if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) // Let everyone hear this one - S_StartSound(player->mo, sfx_s25f); - } - else - { - K_SpawnDashDustRelease(player); // already handled for perfect boosts by K_DoSneaker - if ((!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) && P_IsDisplayPlayer(player)) - { - if (player->kartstuff[k_boostcharge] <= 40) - S_StartSound(player->mo, sfx_cdfm01); // You were almost there! - else - S_StartSound(player->mo, sfx_s23c); // Nope, better luck next time. - } - } - } - // You overcharged your engine? Those things are expensive!!! - else if (player->kartstuff[k_boostcharge] > 50) - { - player->powers[pw_nocontrol] = 40; - //S_StartSound(player->mo, sfx_kc34); - S_StartSound(player->mo, sfx_s3k83); - player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse - } - - player->kartstuff[k_boostcharge] = 0; - } } void K_CheckSpectateStatus(void) diff --git a/src/p_enemy.c b/src/p_enemy.c index 06232ddf0..80189f8e7 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -808,10 +808,10 @@ void A_Look(mobj_t *actor) return; #endif - if (!P_LookForPlayers(actor, locvar1 & 65535, false , FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale))) + if (leveltime < starttime) // SRB2kart - no looking before race starts return; - if (leveltime < starttime) // SRB2kart - no looking before race starts + if (!P_LookForPlayers(actor, locvar1 & 65535, false , FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale))) return; // go into chase state diff --git a/src/p_spec.c b/src/p_spec.c index aa5d52927..6dc3bd9de 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2184,6 +2184,14 @@ static void K_HandleLapIncrement(player_t *player) { S_StartSound(player->mo, sfx_s26d); } + + if (leveltime < starttime) + { + // LATER: replace with the rotatey knockback whenever we get around to it + player->powers[pw_nocontrol] = (starttime - leveltime) + 50; + player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse + S_StartSound(player->mo, sfx_s3k83); + } } } diff --git a/src/p_user.c b/src/p_user.c index 47a613994..6a91875b1 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5784,18 +5784,10 @@ static void P_MovePlayer(player_t *player) boolean add_delta = true; // Kart: store the current turn range for later use - if ((player->mo && player->speed > 0) // Moving - || (leveltime > starttime && (cmd->buttons & BT_EBRAKEMASK) == BT_EBRAKEMASK) // Rubber-burn turn - || (player->respawn.state != RESPAWNST_NONE) // Respawning - || (player->spectator || objectplacing)) // Not a physical player - { - player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1; - player->rturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, -KART_FULLTURN)-1; - } else { - player->lturn_max[leveltime%MAXPREDICTTICS] = player->rturn_max[leveltime%MAXPREDICTTICS] = 0; - } + player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1; + player->rturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, -KART_FULLTURN)-1; - if (leveltime >= starttime) + if (leveltime >= introtime) { // KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames. // Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced. @@ -7727,7 +7719,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (timeover) angle = mo->angle + FixedAngle(camrotate*FRACUNIT); - else if (leveltime < starttime) + else if (leveltime < introtime) angle = focusangle + FixedAngle(camrotate*FRACUNIT); else if (camstill || resetcalled || player->playerstate == PST_DEAD) angle = thiscam->angle; @@ -7750,7 +7742,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } } - if (!resetcalled && (leveltime > starttime && timeover != 2) + if (!resetcalled && (leveltime >= introtime && timeover != 2) && ((thiscam == &camera[0] && t_cam_rotate != -42) || (thiscam == &camera[1] && t_cam2_rotate != -42) || (thiscam == &camera[2] && t_cam3_rotate != -42) @@ -8067,7 +8059,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } else if (player->exiting || timeover == 2) thiscam->momx = thiscam->momy = thiscam->momz = 0; - else if (leveltime < starttime) + else if (leveltime < introtime) { thiscam->momx = FixedMul(x - thiscam->x, camspeed); thiscam->momy = FixedMul(y - thiscam->y, camspeed); @@ -8871,7 +8863,7 @@ void P_PlayerThink(player_t *player) } // SRB2kart 010217 - if (leveltime < starttime) + if (leveltime < introtime) { player->powers[pw_nocontrol] = 2; } From 5c1a33f95ca24ab564c17e25d88382e699d50556 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 24 Jul 2020 03:13:17 -0400 Subject: [PATCH 08/23] Increase buffer time so that high speed characters have time to get in position, change ra_timeskip to introtime --- src/g_game.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 6f4a72676..f359b28f4 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -224,8 +224,8 @@ UINT16 spacetimetics = 11*TICRATE + (TICRATE/2); UINT16 extralifetics = 4*TICRATE; // SRB2kart -tic_t introtime = 108+5; // plus 5 for white fade -tic_t starttime = 6*TICRATE + (3*TICRATE/4); +tic_t introtime = (108) + 5; // 108 for rotation, + 5 for white fade +tic_t starttime = (6*TICRATE) + (2*TICRATE); // Start countdown time, + buffer time tic_t raceexittime = 5*TICRATE + (2*TICRATE/3); tic_t battleexittime = 8*TICRATE; INT32 hyudorotime = 7*TICRATE; @@ -2332,7 +2332,7 @@ void G_Ticker(boolean run) UINT32 i; INT32 buf; ticcmd_t *cmd; - UINT32 ra_timeskip = (modeattacking && !demo.playback && leveltime < starttime - TICRATE*4) ? 0 : (starttime - TICRATE*4 - 1); + UINT32 ra_timeskip = (modeattacking && !demo.playback && leveltime < introtime) ? 0 : (introtime - 1); // starttime - TICRATE*4 is where we want RA to start when we PLAY IT, so we will loop the main thinker on RA start to get it to this point, // the reason this is done is to ensure that ghosts won't look out of synch with other map elements (objects, moving platforms...) // when we REPLAY, don't skip, let the camera spin, do its thing etc~ @@ -2409,7 +2409,7 @@ void G_Ticker(boolean run) { case GS_LEVEL: - for (; ra_timeskip < starttime - TICRATE*4; ra_timeskip++) // this looks weird but this is done to not break compability with older demos for now. + for (; ra_timeskip < introtime; ra_timeskip++) // this looks weird but this is done to not break compability with older demos for now. { if (demo.title) F_TitleDemoTicker(); From 660596970b0571c27ee77d9237d735ec922798bd Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 24 Jul 2020 16:47:18 -0400 Subject: [PATCH 09/23] Add FAULT graphic, remove momentum when faulting --- src/d_player.h | 3 +++ src/k_kart.c | 53 +++++++++++++++++++++++++++++++++++++++----------- src/p_spec.c | 2 ++ 3 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index a133cbadc..a357396f2 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -376,6 +376,9 @@ typedef enum khud_lapanimation, // Used to show the lap start wing logo animation khud_laphand, // Lap hand gfx to use; 0 = none, 1 = :ok_hand:, 2 = :thumbs_up:, 3 = :thumps_down: + // Start + khud_fault, // Set when faulting during the starting countdown + // Camera khud_boostcam, // Camera push forward on boost khud_destboostcam, // Ditto diff --git a/src/k_kart.c b/src/k_kart.c index 82eec1caa..f3dbade0b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7856,6 +7856,7 @@ static patch_t *kp_splitkarmabomb; static patch_t *kp_timeoutsticker; static patch_t *kp_startcountdown[16]; +static patch_t *kp_racefault[6]; static patch_t *kp_racefinish[6]; static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES]; @@ -7990,6 +7991,16 @@ void K_LoadKartHUDGraphics(void) kp_startcountdown[14] = W_CachePatchName("K_SMC1B", PU_HUDGFX); kp_startcountdown[15] = W_CachePatchName("K_SMCGOB", PU_HUDGFX); + // Fault + kp_racefault[0] = W_CachePatchName("K_FAULTA", PU_HUDGFX); + kp_racefault[1] = W_CachePatchName("K_FAULTB", PU_HUDGFX); + // Splitscreen + kp_racefault[2] = W_CachePatchName("K_SMFLTA", PU_HUDGFX); + kp_racefault[3] = W_CachePatchName("K_SMFLTB", PU_HUDGFX); + // 2P splitscreen + kp_racefault[4] = W_CachePatchName("K_2PFLTA", PU_HUDGFX); + kp_racefault[5] = W_CachePatchName("K_2PFLTB", PU_HUDGFX); + // Finish kp_racefinish[0] = W_CachePatchName("K_FINA", PU_HUDGFX); kp_racefinish[1] = W_CachePatchName("K_FINB", PU_HUDGFX); @@ -10551,18 +10562,38 @@ static void K_drawKartStartCountdown(void) { INT32 pnum = 0, splitflags = K_calcSplitFlags(0); // 3 - if (leveltime >= starttime-(2*TICRATE)) // 2 - pnum++; - if (leveltime >= starttime-TICRATE) // 1 - pnum++; - if (leveltime >= starttime) // GO! - pnum++; - if ((leveltime % (2*5)) / 5) // blink - pnum += 4; - if (r_splitscreen) // splitscreen - pnum += 8; + if (stplyr->karthud[khud_fault] != 0) + { + if (r_splitscreen > 1) // 3/4p, stationary FIN + { + pnum += 2; + } + else if (r_splitscreen == 1) // wide splitscreen + { + pnum += 4; + } - V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]); + if ((leveltime % (2*5)) / 5) // blink + pnum += 1; + + V_DrawScaledPatch(STCD_X - (SHORT(kp_racefault[pnum]->width)/2), STCD_Y - (SHORT(kp_racefault[pnum]->height)/2), splitflags, kp_racefault[pnum]); + } + else + { + + if (leveltime >= starttime-(2*TICRATE)) // 2 + pnum++; + if (leveltime >= starttime-TICRATE) // 1 + pnum++; + if (leveltime >= starttime) // GO! + pnum++; + if ((leveltime % (2*5)) / 5) // blink + pnum += 4; + if (r_splitscreen) // splitscreen + pnum += 8; + + V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]); + } } static void K_drawKartFinish(void) diff --git a/src/p_spec.c b/src/p_spec.c index 6dc3bd9de..6d1df0ef0 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2191,6 +2191,8 @@ static void K_HandleLapIncrement(player_t *player) player->powers[pw_nocontrol] = (starttime - leveltime) + 50; player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse S_StartSound(player->mo, sfx_s3k83); + player->karthud[khud_fault] = 1; + player->mo->momx = player->mo->momy = 0; } } } From 8acace7a5084e6ce11d45cc1778365e735adf00b Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 24 Jul 2020 17:16:12 -0400 Subject: [PATCH 10/23] Fault on death --- src/k_respawn.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/k_respawn.c b/src/k_respawn.c index 6c20c8f62..ab229605a 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -96,11 +96,20 @@ void K_DoIngameRespawn(player_t *player) return; } - if (leveltime <= starttime) + if (leveltime < introtime) { return; } + if (leveltime < starttime) + { + player->powers[pw_nocontrol] = (starttime - leveltime) + 50; + player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse + S_StartSound(player->mo, sfx_s3k83); + player->karthud[khud_fault] = 1; + player->mo->momx = player->mo->momy = 0; + } + player->kartstuff[k_ringboost] = 0; player->kartstuff[k_driftboost] = 0; player->kartstuff[k_drift] = 0; @@ -108,7 +117,7 @@ void K_DoIngameRespawn(player_t *player) player->kartstuff[k_pogospring] = 0; // Set up respawn position if invalid - if (player->respawn.wp != NULL) + if (player->respawn.wp != NULL && leveltime >= starttime) { const UINT32 dist = RESPAWN_DIST + (player->airtime * 48); player->respawn.distanceleft = (dist * mapobjectscale) / FRACUNIT; From babe71cdeebf31b689bd6e7b53c14623d53ce502 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 24 Jul 2020 18:01:36 -0400 Subject: [PATCH 11/23] Try to avoid respawning you past the finish line --- src/k_respawn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/k_respawn.c b/src/k_respawn.c index ab229605a..360174fa1 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -334,8 +334,9 @@ static void K_MovePlayerToRespawnPoint(player_t *player) dest.x, dest.y ); - if ((player->respawn.distanceleft == 0) - && (K_GetWaypointIsSpawnpoint(player->respawn.wp) == true)) + if ((player->respawn.distanceleft == 0 && K_GetWaypointIsSpawnpoint(player->respawn.wp) == true) + || (player->respawn.wp == K_GetFinishLineWaypoint() + || player->respawn.wp->nextwaypoints[nwp] == K_GetFinishLineWaypoint())) // Try not to allow you to pass the finish line while respawning, because it's janky { // Alright buddy, that's the end of the ride. player->respawn.state = RESPAWNST_DROP; From f0044e05c1ff1d8d73b60b3b47f0e1d75248d224 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 24 Jul 2020 21:41:41 -0400 Subject: [PATCH 12/23] Crossing the finish line first before anyone else gives you a free rainbow boost --- src/doomstat.h | 1 + src/g_game.c | 1 + src/k_kart.c | 2 +- src/k_kart.h | 1 + src/p_saveg.c | 2 ++ src/p_setup.c | 13 +++++++++++++ src/p_spec.c | 7 +++++++ 7 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/doomstat.h b/src/doomstat.h index ffac81726..4e102277a 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -534,6 +534,7 @@ extern tic_t hyubgone; extern tic_t mapreset; extern boolean thwompsactive; extern SINT8 spbplace; +extern boolean rainbowstartavailable; extern tic_t bombflashtimer; // Used to avoid causing seizures if multiple mines explode close to you :) extern boolean legitimateexit; diff --git a/src/g_game.c b/src/g_game.c index f359b28f4..64e69276c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -289,6 +289,7 @@ tic_t hyubgone; // Cooldown before hyudoro is allowed to be rerolled tic_t mapreset; // Map reset delay when enough players have joined an empty game boolean thwompsactive; // Thwomps activate on lap 2 SINT8 spbplace; // SPB exists, give the person behind better items +boolean rainbowstartavailable; // Boolean, keeps track of if the rainbow start was gotten // Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players) tic_t bombflashtimer = 0; // Cooldown before another FlashPal can be intialized by a bomb exploding near a displayplayer. Avoids seizures. diff --git a/src/k_kart.c b/src/k_kart.c index 79e5e355f..d6f678527 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6488,7 +6488,7 @@ Stage 1: red sparks Stage 2: blue sparks Stage 3: big large rainbow sparks */ -static void K_SpawnDriftBoostExplosion(player_t *player, int stage) +void K_SpawnDriftBoostExplosion(player_t *player, int stage) { mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_DRIFTEXPLODE); diff --git a/src/k_kart.h b/src/k_kart.h index d03dd35f7..c06f2bef3 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -63,6 +63,7 @@ void K_UpdateDistanceFromFinishLine(player_t *const player); 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_SpawnDriftBoostExplosion(player_t *player, int stage); void K_KartUpdatePosition(player_t *player); void K_DropItems(player_t *player); void K_StripItems(player_t *player); diff --git a/src/p_saveg.c b/src/p_saveg.c index 82affdd4b..58fe82174 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3472,6 +3472,7 @@ static void P_NetArchiveMisc(void) WRITEUINT8(save_p, thwompsactive); WRITESINT8(save_p, spbplace); + WRITEUINT8(save_p, rainbowstartavailable); // Is it paused? if (paused) @@ -3597,6 +3598,7 @@ static inline boolean P_NetUnArchiveMisc(void) thwompsactive = (boolean)READUINT8(save_p); spbplace = READSINT8(save_p); + rainbowstartavailable = (boolean)READUINT8(save_p); // Is it paused? if (READUINT8(save_p) == 0x2f) diff --git a/src/p_setup.c b/src/p_setup.c index 0f9e98702..406ed347c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2368,6 +2368,7 @@ lumpnum_t lastloadedmaplumpnum; // for comparative savegame static void P_LevelInitStuff(void) { INT32 i; + UINT8 p = 0; leveltime = 0; @@ -2414,6 +2415,9 @@ static void P_LevelInitStuff(void) for (i = 0; i < MAXPLAYERS; i++) { + if (playeringame[i] && !players[i].spectator) + p++; + if (grandprixinfo.gp == false) { players[i].lives = 3; @@ -2463,6 +2467,11 @@ static void P_LevelInitStuff(void) players[i].follower = NULL; } + rainbowstartavailable = false; + + if (p >= 2) + rainbowstartavailable = true; + // SRB2Kart: map load variables if (grandprixinfo.gp == true) { @@ -2505,6 +2514,10 @@ static void P_LevelInitStuff(void) memset(&battleovertime, 0, sizeof(struct battleovertime)); speedscramble = encorescramble = -1; + + + + } // diff --git a/src/p_spec.c b/src/p_spec.c index 6d1df0ef0..ea96ab268 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2194,6 +2194,13 @@ static void K_HandleLapIncrement(player_t *player) player->karthud[khud_fault] = 1; player->mo->momx = player->mo->momy = 0; } + else if (rainbowstartavailable == true) + { + S_StartSound(player->mo, sfx_s23c); + player->kartstuff[k_driftboost] = 125; + K_SpawnDriftBoostExplosion(player, 3); + rainbowstartavailable = false; + } } } From 679f3223b6dc45225a3f36861143b95e49473544 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sat, 25 Jul 2020 21:07:27 -0400 Subject: [PATCH 13/23] Remove silly white space --- src/p_setup.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 406ed347c..72d3867cf 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2514,10 +2514,6 @@ static void P_LevelInitStuff(void) memset(&battleovertime, 0, sizeof(struct battleovertime)); speedscramble = encorescramble = -1; - - - - } // From b4ae2ea896eefd810b2b929cb94af1ca2fbf2f9d Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 27 Jul 2020 01:46:08 -0400 Subject: [PATCH 14/23] Stronger top speed for the startup boost --- src/k_kart.c | 2 +- src/p_spec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d6f678527..50e94d298 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2131,7 +2131,7 @@ static void K_GetKartBoostPower(player_t *player) if (player->kartstuff[k_startboost]) // Startup Boost { - ADDBOOST(FRACUNIT/4, 6*FRACUNIT); // + 25% top speed, + 600% acceleration + ADDBOOST(FRACUNIT/3, 4*FRACUNIT); // + 33% top speed, + 400% acceleration } if (player->kartstuff[k_driftboost]) // Drift Boost diff --git a/src/p_spec.c b/src/p_spec.c index ea96ab268..315e04aa5 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2197,7 +2197,7 @@ static void K_HandleLapIncrement(player_t *player) else if (rainbowstartavailable == true) { S_StartSound(player->mo, sfx_s23c); - player->kartstuff[k_driftboost] = 125; + player->kartstuff[k_startboost] = 125; K_SpawnDriftBoostExplosion(player, 3); rainbowstartavailable = false; } From 1b85f5b5fc2d6eba1b75e2128c5f65e96d747c3f Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 27 Jul 2020 01:50:27 -0400 Subject: [PATCH 15/23] Don't Ebrake when you've just been bumped --- src/k_kart.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/k_kart.c b/src/k_kart.c index 50e94d298..6394b4ee7 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6896,6 +6896,7 @@ boolean K_PlayerEBrake(player_t *player) && !player->kartstuff[k_spinouttimer] && !player->kartstuff[k_boostcharge] && !(player->kartstuff[k_spindash] < 0) + && !player->kartstuff[k_justbumped] && !player->kartstuff[k_spindashboost] && !player->powers[pw_nocontrol]; } From c685f45563db31747bf682feadfd75641afb6efa Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 27 Jul 2020 02:11:18 -0400 Subject: [PATCH 16/23] Make it even stronger --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 6394b4ee7..4f33c1a35 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2131,7 +2131,7 @@ static void K_GetKartBoostPower(player_t *player) if (player->kartstuff[k_startboost]) // Startup Boost { - ADDBOOST(FRACUNIT/3, 4*FRACUNIT); // + 33% top speed, + 400% acceleration + ADDBOOST(FRACUNIT/2, 4*FRACUNIT); // + 50% top speed, + 400% acceleration } if (player->kartstuff[k_driftboost]) // Drift Boost From dfe4d4a2194d2373d4c0de662ded05540b1e2240 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 27 Jul 2020 02:29:43 -0400 Subject: [PATCH 17/23] No tethering off of the person who got the start boost --- src/k_kart.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index 4f33c1a35..7efcc697f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1439,6 +1439,10 @@ static void K_UpdateDraft(player_t *player) if (players[i].speed < 20*players[i].mo->scale) continue; + // No tethering off of the guy who got the starting bonus :P + if (players[i].kartstuff[k_startboost] > 0) + continue; + #ifndef EASYDRAFTTEST yourangle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); theirangle = R_PointToAngle2(0, 0, players[i].mo->momx, players[i].mo->momy); From b08459cbeeb91b22533d38de4773ffe40f82720b Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 27 Jul 2020 23:31:46 -0400 Subject: [PATCH 18/23] Buffer time before countdown depends on player count, no intro spin in 1v1 --- src/g_game.c | 24 ++++++++---------------- src/p_saveg.c | 6 ++++++ src/p_setup.c | 11 +++++++++++ 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 64e69276c..dbc0b66db 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -224,8 +224,8 @@ UINT16 spacetimetics = 11*TICRATE + (TICRATE/2); UINT16 extralifetics = 4*TICRATE; // SRB2kart -tic_t introtime = (108) + 5; // 108 for rotation, + 5 for white fade -tic_t starttime = (6*TICRATE) + (2*TICRATE); // Start countdown time, + buffer time +tic_t introtime = 0; +tic_t starttime = 0; tic_t raceexittime = 5*TICRATE + (2*TICRATE/3); tic_t battleexittime = 8*TICRATE; INT32 hyudorotime = 7*TICRATE; @@ -2333,10 +2333,6 @@ void G_Ticker(boolean run) UINT32 i; INT32 buf; ticcmd_t *cmd; - UINT32 ra_timeskip = (modeattacking && !demo.playback && leveltime < introtime) ? 0 : (introtime - 1); - // starttime - TICRATE*4 is where we want RA to start when we PLAY IT, so we will loop the main thinker on RA start to get it to this point, - // the reason this is done is to ensure that ghosts won't look out of synch with other map elements (objects, moving platforms...) - // when we REPLAY, don't skip, let the camera spin, do its thing etc~ // also the -1 is to ensure that the thinker runs in the loop below. @@ -2409,16 +2405,12 @@ void G_Ticker(boolean run) switch (gamestate) { case GS_LEVEL: - - for (; ra_timeskip < introtime; ra_timeskip++) // this looks weird but this is done to not break compability with older demos for now. - { - if (demo.title) - F_TitleDemoTicker(); - P_Ticker(run); // tic the game - ST_Ticker(); - AM_Ticker(); - HU_Ticker(); - } + if (demo.title) + F_TitleDemoTicker(); + P_Ticker(run); // tic the game + ST_Ticker(); + AM_Ticker(); + HU_Ticker(); break; case GS_INTERMISSION: diff --git a/src/p_saveg.c b/src/p_saveg.c index 58fe82174..c197b5a3c 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3474,6 +3474,9 @@ static void P_NetArchiveMisc(void) WRITESINT8(save_p, spbplace); WRITEUINT8(save_p, rainbowstartavailable); + WRITEUINT32(save_p, introtime); + WRITEUINT32(save_p, starttime); + // Is it paused? if (paused) WRITEUINT8(save_p, 0x2f); @@ -3600,6 +3603,9 @@ static inline boolean P_NetUnArchiveMisc(void) spbplace = READSINT8(save_p); rainbowstartavailable = (boolean)READUINT8(save_p); + introtime = READUINT32(save_p); + starttime = READUINT32(save_p); + // Is it paused? if (READUINT8(save_p) == 0x2f) paused = true; diff --git a/src/p_setup.c b/src/p_setup.c index 72d3867cf..994f7bccb 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2472,6 +2472,17 @@ static void P_LevelInitStuff(void) if (p >= 2) rainbowstartavailable = true; + if (p <= 2) + { + introtime = 0; // No intro in Record Attack / 1v1 + } + else + { + introtime = (108) + 5; // 108 for rotation, + 5 for white fade + } + + starttime = introtime + (6*TICRATE) + (max(p-2, 0) * (TICRATE/2)); // Start countdown time, + buffer time + // SRB2Kart: map load variables if (grandprixinfo.gp == true) { From 69b6ba2f18831ed7cb7729294aaf222dde6e1c89 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Tue, 28 Jul 2020 03:34:39 -0400 Subject: [PATCH 19/23] I tore apart the entire code to try and fix braking friction and gave up, so now it's back to v1 My rewrites clean up a LOT of weird/misleading behavior anyway, so I'm gonna push this regardless. Someone else will have to figure out another way to reimplement braking friction though -- we can't use it as is because it prevents being able to bump people. --- src/d_clisrv.c | 1 - src/d_ticcmd.h | 1 - src/g_game.c | 58 +++++----------- src/k_bot.c | 22 ++++-- src/k_kart.c | 165 ++++++++++++++++++++++++-------------------- src/k_kart.h | 5 +- src/lua_playerlib.c | 4 -- src/p_mobj.c | 18 ++--- src/p_user.c | 71 +++++-------------- 9 files changed, 145 insertions(+), 200 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index a7c6e0e9a..89b96a0d7 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -4315,7 +4315,6 @@ static void HandlePacketFromAwayNode(SINT8 node) static boolean CheckForSpeedHacks(UINT8 p) { if (netcmds[maketic%TICQUEUE][p].forwardmove > MAXPLMOVE || netcmds[maketic%TICQUEUE][p].forwardmove < -MAXPLMOVE - || netcmds[maketic%TICQUEUE][p].sidemove > MAXPLMOVE || netcmds[maketic%TICQUEUE][p].sidemove < -MAXPLMOVE || netcmds[maketic%TICQUEUE][p].driftturn > KART_FULLTURN || netcmds[maketic%TICQUEUE][p].driftturn < -KART_FULLTURN) { XBOXSTATIC char buf[2]; diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h index 0340b9f40..6c14a0f4b 100644 --- a/src/d_ticcmd.h +++ b/src/d_ticcmd.h @@ -60,7 +60,6 @@ typedef enum typedef struct { SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50) - SINT8 sidemove; // -MAXPLMOVE to MAXPLMOVE (50) INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos INT16 aiming; // vertical aiming, see G_BuildTicCmd UINT16 buttons; diff --git a/src/g_game.c b/src/g_game.c index dbc0b66db..eeb1e01fb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1256,13 +1256,12 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 p) INT32 localaiming[MAXSPLITSCREENPLAYERS]; angle_t localangle[MAXSPLITSCREENPLAYERS]; -static fixed_t forwardmove = 50<>16; -static fixed_t sidemove[2] = {2<>16, 4<>16}; +static fixed_t forwardmove = MAXPLMOVE<>16; static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) { - INT32 laim, th, tspeed, forward, side, axis; //i + INT32 laim, th, tspeed, forward, axis; //i const INT32 speed = 1; // these ones used for multiple conditions boolean turnleft, turnright, mouseaiming, analogjoystickmove, gamepadjoystickmove; @@ -1373,7 +1372,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) turnright = turnright || (axis > 0); turnleft = turnleft || (axis < 0); } - forward = side = 0; + forward = 0; // use two stage accelerative turning // on the keyboard and joystick @@ -1394,13 +1393,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) { cmd->angleturn = (INT16)(cmd->angleturn - (angleturn[tspeed])); cmd->driftturn = (INT16)(cmd->driftturn - (angleturn[tspeed])); - side += sidemove[1]; } else if (turnleft && !(turnright)) { cmd->angleturn = (INT16)(cmd->angleturn + (angleturn[tspeed])); cmd->driftturn = (INT16)(cmd->driftturn + (angleturn[tspeed])); - side -= sidemove[1]; } if (analogjoystickmove && axis != 0) @@ -1408,7 +1405,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) // JOYAXISRANGE should be 1023 (divide by 1024) cmd->angleturn = (INT16)(cmd->angleturn - (((axis * angleturn[1]) >> 10))); // ANALOG! cmd->driftturn = (INT16)(cmd->driftturn - (((axis * angleturn[1]) >> 10))); - side += ((axis * sidemove[0]) >> 10); } // Specator mouse turning @@ -1445,7 +1441,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) { cmd->buttons |= BT_ACCELERATE; // JOYAXISRANGE is supposed to be 1023 (divide by 1024) - forward += ((axis * forwardmove) >> 10)*2; + forward += ((axis * forwardmove) >> 10); } axis = JoyAxis(AXISBRAKE, ssplayer); @@ -1555,21 +1551,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) mousex = mousey = mlooky = 0; - if (forward > MAXPLMOVE) - forward = MAXPLMOVE; - else if (forward < -MAXPLMOVE) - forward = -MAXPLMOVE; + cmd->forwardmove += (SINT8)forward; - if (side > MAXPLMOVE) - side = MAXPLMOVE; - else if (side < -MAXPLMOVE) - side = -MAXPLMOVE; - - if (forward || side) - { - cmd->forwardmove = (SINT8)(cmd->forwardmove + forward); - cmd->sidemove = (SINT8)(cmd->sidemove + side); - } + if (cmd->forwardmove > MAXPLMOVE) + cmd->forwardmove = MAXPLMOVE; + else if (cmd->forwardmove < -MAXPLMOVE) + cmd->forwardmove = -MAXPLMOVE; //{ SRB2kart - Drift support // Not grouped with the rest of turn stuff because it needs to know what buttons you're pressing for rubber-burn turn @@ -1619,7 +1606,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) #endif //Reset away view if a command is given. - if ((cmd->forwardmove || cmd->sidemove || cmd->buttons) + if ((cmd->forwardmove || cmd->buttons) && !r_splitscreen && displayplayers[0] != consoleplayer && ssplayer == 1) displayplayers[0] = consoleplayer; } @@ -4771,13 +4758,12 @@ char *G_BuildMapTitle(INT32 mapnum) // For demos #define ZT_FWD 0x01 -#define ZT_SIDE 0x02 -#define ZT_ANGLE 0x04 -#define ZT_BUTTONS 0x08 -#define ZT_AIMING 0x10 -#define ZT_DRIFT 0x20 -#define ZT_LATENCY 0x40 -#define DEMOMARKER 0x80 // demoend +#define ZT_ANGLE 0x02 +#define ZT_BUTTONS 0x04 +#define ZT_AIMING 0x08 +#define ZT_DRIFT 0x10 +#define ZT_LATENCY 0x20 +#define DEMOMARKER 0x40 // demoend UINT8 demo_extradata[MAXPLAYERS]; UINT8 demo_writerng; // 0=no, 1=yes, 2=yes but on a timeout @@ -4840,7 +4826,6 @@ ticcmd_t *G_MoveTiccmd(ticcmd_t* dest, const ticcmd_t* src, const size_t n) for (i = 0; i < n; i++) { dest[i].forwardmove = src[i].forwardmove; - dest[i].sidemove = src[i].sidemove; dest[i].angleturn = SHORT(src[i].angleturn); dest[i].aiming = (INT16)SHORT(src[i].aiming); dest[i].buttons = (UINT16)SHORT(src[i].buttons); @@ -5149,8 +5134,6 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum) if (ziptic & ZT_FWD) oldcmd[playernum].forwardmove = READSINT8(demo_p); - if (ziptic & ZT_SIDE) - oldcmd[playernum].sidemove = READSINT8(demo_p); if (ziptic & ZT_ANGLE) oldcmd[playernum].angleturn = READINT16(demo_p); if (ziptic & ZT_BUTTONS) @@ -5190,13 +5173,6 @@ void G_WriteDemoTiccmd(ticcmd_t *cmd, INT32 playernum) ziptic |= ZT_FWD; } - if (cmd->sidemove != oldcmd[playernum].sidemove) - { - WRITEUINT8(demo_p,cmd->sidemove); - oldcmd[playernum].sidemove = cmd->sidemove; - ziptic |= ZT_SIDE; - } - if (cmd->angleturn != oldcmd[playernum].angleturn) { WRITEINT16(demo_p,cmd->angleturn); @@ -5710,8 +5686,6 @@ void G_GhostTicker(void) if (ziptic & ZT_FWD) g->p++; - if (ziptic & ZT_SIDE) - g->p++; if (ziptic & ZT_ANGLE) g->p += 2; if (ziptic & ZT_BUTTONS) diff --git a/src/k_bot.c b/src/k_bot.c index 285f92142..1cfef7fb9 100644 --- a/src/k_bot.c +++ b/src/k_bot.c @@ -474,6 +474,7 @@ fixed_t K_BotTopSpeedRubberband(player_t *player) fixed_t K_BotFrictionRubberband(player_t *player, fixed_t frict) { fixed_t rubberband = K_BotRubberband(player) - FRACUNIT; + fixed_t newfrict; if (rubberband <= 0) { @@ -481,8 +482,14 @@ fixed_t K_BotFrictionRubberband(player_t *player, fixed_t frict) return frict; } - // 128 is a magic number that felt good in-game - return FixedDiv(frict, FRACUNIT + (rubberband / 2)); + newfrict = FixedDiv(frict, FRACUNIT + (rubberband / 2)); + + if (newfrict < 0) + newfrict = 0; + if (newfrict > FRACUNIT) + newfrict = FRACUNIT; + + return newfrict; } /*-------------------------------------------------- @@ -698,11 +705,12 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) // Start boost handler if (leveltime <= starttime) { - tic_t boosthold = starttime - TICRATE; + tic_t length = (TICRATE/6); + tic_t boosthold = starttime - K_GetSpindashChargeTime(player); - cmd->buttons |= BT_ACCELERATE|BT_BRAKE; + cmd->buttons |= BT_EBRAKEMASK; - boosthold -= (MAXBOTDIFFICULTY - player->botvars.difficulty); + boosthold -= (MAXBOTDIFFICULTY - player->botvars.difficulty) * length; if (leveltime >= boosthold) { @@ -743,7 +751,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) if (anglediff > 90) { // Wrong way! - cmd->forwardmove = -25; + cmd->forwardmove = -MAXPLMOVE; cmd->buttons |= BT_BRAKE; } else @@ -777,7 +785,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd) cmd->buttons |= BT_ACCELERATE; // Full speed ahead! - cmd->forwardmove = 50; + cmd->forwardmove = MAXPLMOVE; if (dirdist <= rad) { diff --git a/src/k_kart.c b/src/k_kart.c index 7efcc697f..90afd4451 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1143,10 +1143,13 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) { // Normalize distance to the sum of the two objects' radii, since in a perfect world that would be the distance at the point of collision... fixed_t dist = P_AproxDistance(distx, disty); - fixed_t nx = FixedDiv(distx, dist); - fixed_t ny = FixedDiv(disty, dist); + fixed_t nx, ny; dist = dist ? dist : 1; + + nx = FixedDiv(distx, dist); + ny = FixedDiv(disty, dist); + distx = FixedMul(mobj1->radius+mobj2->radius, nx); disty = FixedMul(mobj1->radius+mobj2->radius, ny); @@ -1222,6 +1225,7 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) mobj1->player->rmomx = mobj1->momx - mobj1->player->cmomx; mobj1->player->rmomy = mobj1->momy - mobj1->player->cmomy; mobj1->player->kartstuff[k_justbumped] = bumptime; + mobj1->player->kartstuff[k_spindash] = 0; if (mobj1->player->kartstuff[k_spinouttimer]) { @@ -1247,6 +1251,7 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) mobj2->player->rmomx = mobj2->momx - mobj2->player->cmomx; mobj2->player->rmomy = mobj2->momy - mobj2->player->cmomy; mobj2->player->kartstuff[k_justbumped] = bumptime; + mobj2->player->kartstuff[k_spindash] = 0; if (mobj2->player->kartstuff[k_spinouttimer]) { @@ -2042,14 +2047,14 @@ static fixed_t K_FlameShieldDashVar(INT32 val) return (3*FRACUNIT/4) + (((val * FRACUNIT) / TICRATE) / 2); } -static tic_t K_GetSpindashChargeTime(player_t *player) +tic_t K_GetSpindashChargeTime(player_t *player) { // more charge time for higher speed // Tails = 2s, Mighty = 3s, Fang = 4s, Metal = 4s return (player->kartspeed + 4) * (TICRATE/3); } -static fixed_t K_GetSpindashChargeSpeed(player_t *player) +fixed_t K_GetSpindashChargeSpeed(player_t *player) { // more speed for higher weight & speed // Tails = +6.25%, Fang = +20.31%, Mighty = +20.31%, Metal = +25% @@ -2266,13 +2271,32 @@ UINT16 K_GetKartFlashing(player_t *player) return tics; } -fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove) +SINT8 K_GetForwardMove(player_t *player) +{ + SINT8 forwardmove = player->cmd.forwardmove; + + if ((player->pflags & PF_STASIS) || (player->pflags & PF_SLIDING) || player->kartstuff[k_spinouttimer] || K_PlayerEBrake(player)) + { + return 0; + } + + if (player->kartstuff[k_sneakertimer] || player->kartstuff[k_spindashboost]) + { + return MAXPLMOVE; + } + + return forwardmove; +} + +fixed_t K_3dKartMovement(player_t *player, boolean onground) { const fixed_t accelmax = 4000; const fixed_t p_speed = K_GetKartSpeed(player, true); const fixed_t p_accel = K_GetKartAccel(player); fixed_t newspeed, oldspeed, finalspeed; + fixed_t movemul = FRACUNIT; fixed_t orig = ORIG_FRICTION; + SINT8 forwardmove = K_GetForwardMove(player); if (!onground) return 0; // If the player isn't on the ground, there is no change in speed @@ -2301,25 +2325,20 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove } finalspeed = newspeed - oldspeed; + movemul = abs(forwardmove * FRACUNIT) / 50; // forwardmove is: // 50 while accelerating, // 0 with no gas, and // -25 when only braking. - - if (player->kartstuff[k_sneakertimer] || player->kartstuff[k_spindashboost]) - forwardmove = 50; - - finalspeed *= forwardmove/25; - finalspeed /= 2; - - if (forwardmove < 0 && finalspeed > mapobjectscale*2) - return finalspeed/2; - else if (forwardmove < 0) - return -mapobjectscale/2; - - if (finalspeed < 0) - finalspeed = 0; + if (forwardmove >= 0) + { + finalspeed = FixedMul(finalspeed, movemul); + } + else + { + finalspeed = FixedMul(-mapobjectscale/2, movemul); + } return finalspeed; } @@ -3579,7 +3598,7 @@ void K_DriftDustHandling(mobj_t *spawner) if (spawner->player->speed < 5*spawner->scale) return; - if (spawner->player->cmd.forwardmove < 0) + if (K_GetForwardMove(spawner->player) < 0) playerangle += ANGLE_180; anglediff = abs((signed)(playerangle - R_PointToAngle2(0, 0, spawner->player->rmomx, spawner->player->rmomy))); @@ -5161,10 +5180,10 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) if (player->respawn.state == RESPAWNST_DROP) // Dropdashing targetsnd = ((cmd->buttons & BT_ACCELERATE) ? 12 : 0); - else if (K_PlayerEBrake(player)) // Spindashing + else if (K_PlayerEBrake(player) == true) // Spindashing targetsnd = ((cmd->buttons & BT_DRIFT) ? 12 : 0); else - targetsnd = (((6*cmd->forwardmove)/25) + ((player->speed / mapobjectscale)/5))/2; + targetsnd = (((6*K_GetForwardMove(player))/25) + ((player->speed / mapobjectscale)/5))/2; if (targetsnd < 0) targetsnd = 0; @@ -5809,7 +5828,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) } } - if (player->kartstuff[k_justbumped]) + if (player->kartstuff[k_justbumped] > 0) player->kartstuff[k_justbumped]--; if (player->kartstuff[k_tiregrease]) @@ -6895,31 +6914,52 @@ static INT32 K_FlameShieldMax(player_t *player) boolean K_PlayerEBrake(player_t *player) { return (player->cmd.buttons & BT_EBRAKEMASK) == BT_EBRAKEMASK - && P_IsObjectOnGround(player->mo) - && !player->kartstuff[k_drift] - && !player->kartstuff[k_spinouttimer] - && !player->kartstuff[k_boostcharge] - && !(player->kartstuff[k_spindash] < 0) - && !player->kartstuff[k_justbumped] - && !player->kartstuff[k_spindashboost] - && !player->powers[pw_nocontrol]; + && P_IsObjectOnGround(player->mo) == true + && player->kartstuff[k_drift] == 0 + && player->kartstuff[k_spinouttimer] == 0 + && player->kartstuff[k_justbumped] == 0 + && player->kartstuff[k_spindash] >= 0 + && player->kartstuff[k_spindashboost] == 0 + && player->powers[pw_nocontrol] == 0; } static void K_KartSpindash(player_t *player) { + const tic_t MAXCHARGETIME = K_GetSpindashChargeTime(player); ticcmd_t *cmd = &player->cmd; - if (!(K_PlayerEBrake(player) || (player->kartstuff[k_spindash] && !(cmd->buttons & BT_BRAKE)))) + if (player->kartstuff[k_spindash] > 0 && (cmd->buttons & (BT_DRIFT|BT_BRAKE)) != (BT_DRIFT|BT_BRAKE)) { - if (player->kartstuff[k_spindash]) - player->kartstuff[k_spindash] = 0; + player->kartstuff[k_spindashspeed] = (player->kartstuff[k_spindash] * FRACUNIT) / MAXCHARGETIME; + player->kartstuff[k_spindashboost] = TICRATE; + + if (!player->kartstuff[k_tiregrease]) + { + UINT8 i; + for (i = 0; i < 2; i++) + { + mobj_t *grease; + grease = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_TIREGREASE); + P_SetTarget(&grease->target, player->mo); + grease->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); + grease->extravalue1 = i; + } + } + + player->kartstuff[k_tiregrease] = 2*TICRATE; + + player->kartstuff[k_spindash] = 0; + S_StartSound(player->mo, sfx_s23c); + } + + if (K_PlayerEBrake(player) == false) + { + player->kartstuff[k_spindash] = 0; return; } if (player->speed < 6*mapobjectscale && player->powers[pw_flashing] == 0) { - const tic_t MAXCHARGETIME = K_GetSpindashChargeTime(player); - if (cmd->driftturn != 0 && leveltime % 8 == 0) S_StartSound(player->mo, sfx_ruburn); @@ -6948,29 +6988,6 @@ static void K_KartSpindash(player_t *player) } } } - else if (player->kartstuff[k_spindash]) - { - player->kartstuff[k_spindashspeed] = (player->kartstuff[k_spindash] * FRACUNIT) / MAXCHARGETIME; - player->kartstuff[k_spindashboost] = TICRATE; - - if (!player->kartstuff[k_tiregrease]) - { - UINT8 i; - for (i = 0; i < 2; i++) - { - mobj_t *grease; - grease = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_TIREGREASE); - P_SetTarget(&grease->target, player->mo); - grease->angle = R_PointToAngle2(0, 0, player->mo->momx, player->mo->momy); - grease->extravalue1 = i; - } - } - - player->kartstuff[k_tiregrease] = 2*TICRATE; - - player->kartstuff[k_spindash] = 0; - S_StartSound(player->mo, sfx_s23c); - } } else { @@ -7670,17 +7687,12 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_tiregrease]) player->mo->friction += ((FRACUNIT - prevfriction) / greasetics) * player->kartstuff[k_tiregrease]; - // Friction - if (!player->kartstuff[k_offroad]) - { - if (player->speed > 0 && cmd->forwardmove == 0 && !(cmd->buttons & BT_BRAKE) && player->mo->friction == 59392) - player->mo->friction += 4608; - } - - if (K_PlayerEBrake(player)) - 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 - player->mo->friction -= 2048; + /* + if (K_PlayerEBrake(player) == true) + player->mo->friction -= 1024; + else if (player->speed > 0 && cmd->forwardmove < 0) + player->mo->friction -= 512; + */ // Karma ice physics if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) @@ -7698,14 +7710,15 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->mo->friction -= 9824; } - // Friction was changed, so we must recalculate a bunch of stuff + // Cap between intended values + if (player->mo->friction > FRACUNIT) + player->mo->friction = FRACUNIT; + if (player->mo->friction < 0) + player->mo->friction = 0; + + // Friction was changed, so we must recalculate movefactor if (player->mo->friction != prevfriction) { - if (player->mo->friction > FRACUNIT) - player->mo->friction = FRACUNIT; - if (player->mo->friction < 0) - player->mo->friction = 0; - player->mo->movefactor = FixedDiv(ORIG_FRICTION, player->mo->friction); if (player->mo->movefactor < FRACUNIT) diff --git a/src/k_kart.h b/src/k_kart.h index c06f2bef3..d44be14f4 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -70,11 +70,14 @@ void K_StripItems(player_t *player); void K_StripOther(player_t *player); void K_MomentumToFacing(player_t *player); boolean K_ApplyOffroad(player_t *player); +tic_t K_GetSpindashChargeTime(player_t *player); +fixed_t K_GetSpindashChargeSpeed(player_t *player); fixed_t K_GetKartSpeedFromStat(UINT8 kartspeed); fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower); fixed_t K_GetKartAccel(player_t *player); UINT16 K_GetKartFlashing(player_t *player); -fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove); +SINT8 K_GetForwardMove(player_t *player); +fixed_t K_3dKartMovement(player_t *player, boolean onground); boolean K_PlayerEBrake(player_t *player); void K_MoveKartPlayer(player_t *player, boolean onground); void K_CheckSpectateStatus(void); diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 1e93e5687..436a7161b 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -767,8 +767,6 @@ static int ticcmd_get(lua_State *L) if (fastcmp(field,"forwardmove")) lua_pushinteger(L, cmd->forwardmove); - else if (fastcmp(field,"sidemove")) - lua_pushinteger(L, cmd->sidemove); else if (fastcmp(field,"angleturn")) lua_pushinteger(L, cmd->angleturn); else if (fastcmp(field,"aiming")) @@ -797,8 +795,6 @@ static int ticcmd_set(lua_State *L) if (fastcmp(field,"forwardmove")) cmd->forwardmove = (SINT8)luaL_checkinteger(L, 3); - else if (fastcmp(field,"sidemove")) - cmd->sidemove = (SINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"angleturn")) cmd->angleturn = (INT16)luaL_checkinteger(L, 3); else if (fastcmp(field,"aiming")) diff --git a/src/p_mobj.c b/src/p_mobj.c index c5cddef5a..734a6e3f3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1461,8 +1461,8 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) mo->momy = FixedMul(mo->momy, ns); } else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale) - && abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale) - && (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING)) + && abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale) + && (!(K_GetForwardMove(player) && !(twodlevel || mo->flags2 & MF2_TWOD)) && !(player->pflags & PF_SPINNING)) #ifdef ESLOPE && !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)))// && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)) #endif @@ -1476,16 +1476,8 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) } else { - if (oldx == mo->x && oldy == mo->y) // didn't go anywhere - { - mo->momx = FixedMul(mo->momx, ORIG_FRICTION); - mo->momy = FixedMul(mo->momy, ORIG_FRICTION); - } - else - { - mo->momx = FixedMul(mo->momx, mo->friction); - mo->momy = FixedMul(mo->momy, mo->friction); - } + mo->momx = FixedMul(mo->momx, mo->friction); + mo->momy = FixedMul(mo->momy, mo->friction); mo->friction = ORIG_FRICTION; } @@ -1961,7 +1953,7 @@ void P_XYMovement(mobj_t *mo) if (mo->type == MT_FLINGRING || mo->type == MT_BALLHOG || mo->type == MT_BUBBLESHIELDTRAP) return; - if (mo->player && (mo->player->kartstuff[k_spinouttimer] && !mo->player->kartstuff[k_wipeoutslow]) && mo->player->speed <= K_GetKartSpeed(mo->player, false)/2) + if (player && (player->kartstuff[k_spinouttimer] && !player->kartstuff[k_wipeoutslow]) && player->speed <= FixedDiv(20*mapobjectscale, player->kartstuff[k_offroad] + FRACUNIT)) return; //} diff --git a/src/p_user.c b/src/p_user.c index 6a91875b1..8d6014926 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4020,9 +4020,9 @@ static void P_2dMovement(player_t *player) static void P_3dMovement(player_t *player) { ticcmd_t *cmd; - angle_t movepushangle, movepushsideangle; // Analog + angle_t movepushangle; // Analog //INT32 topspeed, acceleration, thrustfactor; - fixed_t movepushforward = 0, movepushside = 0; + fixed_t movepushforward = 0; angle_t dangle; // replaces old quadrants bits //boolean dangleflip = false; // SRB2kart - toaster //fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale); @@ -4039,14 +4039,6 @@ static void P_3dMovement(player_t *player) cmd = &player->cmd; - if (player->pflags & PF_STASIS || player->kartstuff[k_spinouttimer]) // pw_introcam? - { - cmd->forwardmove = cmd->sidemove = 0; - } - - if (!(player->pflags & PF_FORCESTRAFE) && !player->kartstuff[k_pogospring]) - cmd->sidemove = 0; - if (player->kartstuff[k_drift] != 0) movepushangle = player->mo->angle-(ANGLE_45/5)*player->kartstuff[k_drift]; else if (player->kartstuff[k_spinouttimer] || player->kartstuff[k_wipeoutslow]) // if spun out, use the boost angle @@ -4054,8 +4046,6 @@ static void P_3dMovement(player_t *player) else movepushangle = player->mo->angle; - movepushsideangle = movepushangle-ANGLE_90; - // cmomx/cmomy stands for the conveyor belt speed. if (player->onconveyor == 2) // Wind/Current { @@ -4108,10 +4098,6 @@ static void P_3dMovement(player_t *player) */ //} - // When sliding, don't allow forward/back - if (player->pflags & PF_SLIDING) - cmd->forwardmove = 0; - // Do not let the player control movement if not onground. // SRB2Kart: pogo spring and speed bumps are supposed to control like you're on the ground onground = (P_IsObjectOnGround(player->mo) || (player->kartstuff[k_pogospring])); @@ -4121,7 +4107,7 @@ static void P_3dMovement(player_t *player) // Forward movement if (!(P_PlayerInPain(player) && !onground)) { - movepushforward = K_3dKartMovement(player, onground, cmd->forwardmove); + movepushforward = K_3dKartMovement(player, onground); if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration... movepushforward = FixedMul(movepushforward, player->mo->movefactor); @@ -4134,18 +4120,6 @@ static void P_3dMovement(player_t *player) K_MomentumToFacing(player); } - // Sideways movement - if (cmd->sidemove != 0 && !((player->exiting || mapreset) || player->kartstuff[k_spinouttimer])) - { - if (cmd->sidemove > 0) - movepushside = (cmd->sidemove * FRACUNIT/128) + FixedDiv(player->speed, K_GetKartSpeed(player, true)); - else - movepushside = (cmd->sidemove * FRACUNIT/128) - FixedDiv(player->speed, K_GetKartSpeed(player, true)); - - totalthrust.x += P_ReturnThrustX(player->mo, movepushsideangle, movepushside); - totalthrust.y += P_ReturnThrustY(player->mo, movepushsideangle, movepushside); - } - if ((totalthrust.x || totalthrust.y) && player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) { // Factor thrust to slope, but only for the part pushing up it! @@ -7223,8 +7197,7 @@ fixed_t t_cam4_rotate = -42; // we then throw that ticcmd garbage in the camera and make it move // redefine this -static fixed_t forwardmove[2] = {25<>16, 50<>16}; -static fixed_t sidemove[2] = {2<>16, 4<>16}; +static fixed_t forwardmove = MAXPLMOVE<>16; static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn static ticcmd_t cameracmd; @@ -7239,7 +7212,7 @@ void P_InitCameraCmd(void) static ticcmd_t *P_CameraCmd(camera_t *cam) { - INT32 laim, th, tspeed, forward, side, axis; //i + INT32 laim, th, tspeed, forward, axis; //i const INT32 speed = 1; // these ones used for multiple conditions boolean turnleft, turnright, mouseaiming; @@ -7288,7 +7261,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam) turnright = turnright || (axis > 0); turnleft = turnleft || (axis < 0); } - forward = side = 0; + forward = 0; // use two stage accelerative turning // on the keyboard and joystick @@ -7306,12 +7279,10 @@ static ticcmd_t *P_CameraCmd(camera_t *cam) if (turnright && !(turnleft)) { cmd->angleturn = (INT16)(cmd->angleturn - (angleturn[tspeed])); - side += sidemove[1]; } else if (turnleft && !(turnright)) { cmd->angleturn = (INT16)(cmd->angleturn + (angleturn[tspeed])); - side -= sidemove[1]; } cmd->angleturn = (INT16)(cmd->angleturn - ((mousex*(encoremode ? -1 : 1)*8))); @@ -7324,9 +7295,9 @@ static ticcmd_t *P_CameraCmd(camera_t *cam) cmd->buttons |= BT_BRAKE; axis = JoyAxis(AXISAIM, 1); if (InputDown(gc_aimforward, 1) || (usejoystick && axis < 0)) - forward += forwardmove[1]; + forward += forwardmove; if (InputDown(gc_aimbackward, 1) || (usejoystick && axis > 0)) - forward -= forwardmove[1]; + forward -= forwardmove; // fire with any button/key axis = JoyAxis(AXISFIRE, 1); @@ -7367,21 +7338,12 @@ static ticcmd_t *P_CameraCmd(camera_t *cam) mousex = mousey = mlooky = 0; - if (forward > MAXPLMOVE) - forward = MAXPLMOVE; - else if (forward < -MAXPLMOVE) - forward = -MAXPLMOVE; + cmd->forwardmove += (SINT8)forward; - if (side > MAXPLMOVE) - side = MAXPLMOVE; - else if (side < -MAXPLMOVE) - side = -MAXPLMOVE; - - if (forward || side) - { - cmd->forwardmove = (SINT8)(cmd->forwardmove + forward); - cmd->sidemove = (SINT8)(cmd->sidemove + side); - } + if (cmd->forwardmove > MAXPLMOVE) + cmd->forwardmove = MAXPLMOVE; + else if (cmd->forwardmove < -MAXPLMOVE) + cmd->forwardmove = -MAXPLMOVE; lang += (cmd->angleturn<<16); @@ -7426,11 +7388,10 @@ void P_DemoCameraMovement(camera_t *cam) cam->aiming = R_PointToAngle2(0, cam->z, R_PointToDist2(cam->x, cam->y, lastp->mo->x, lastp->mo->y), lastp->mo->z + lastp->mo->scale*128*P_MobjFlip(lastp->mo)); // This is still unholy. Aim a bit above their heads. } - cam->momx = cam->momy = cam->momz = 0; + if (cmd->forwardmove != 0) { - thrustangle = cam->angle >> ANGLETOFINESHIFT; cam->x += FixedMul(cmd->forwardmove*mapobjectscale, FINECOSINE(thrustangle)); @@ -9493,8 +9454,8 @@ void P_PlayerAfterThink(player_t *player) if (!(player->mo->tracer->target->flags & MF_SLIDEME) // Noclimb on chain parameters gives this && !(twodlevel || player->mo->flags2 & MF2_TWOD)) // why on earth would you want to turn them in 2D mode? { - player->mo->tracer->target->health += cmd->sidemove; - player->mo->angle += cmd->sidemove< ANGLE_MAX + //player->mo->tracer->target->health += cmd->sidemove; + //player->mo->angle += cmd->sidemove< ANGLE_MAX if (player == &players[consoleplayer]) localangle[0] = player->mo->angle; // Adjust the local control angle. From c45a67c3f92687ee342516bf180acc41a6201491 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 29 Jul 2020 01:19:53 -0400 Subject: [PATCH 20/23] Pre start bulbs --- src/doomstat.h | 5 ++ src/g_game.c | 5 ++ src/k_kart.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++++- src/p_setup.c | 9 ++- 4 files changed, 170 insertions(+), 2 deletions(-) diff --git a/src/doomstat.h b/src/doomstat.h index 4e102277a..e678886a8 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -482,8 +482,13 @@ extern UINT16 extralifetics; // SRB2kart extern tic_t introtime; extern tic_t starttime; + +extern const tic_t bulbtime; +extern UINT8 numbulbs; + extern tic_t raceexittime; extern tic_t battleexittime; + extern INT32 hyudorotime; extern INT32 stealtime; extern INT32 sneakertime; diff --git a/src/g_game.c b/src/g_game.c index eeb1e01fb..21bd0fa4f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -226,8 +226,13 @@ UINT16 extralifetics = 4*TICRATE; // SRB2kart tic_t introtime = 0; tic_t starttime = 0; + +const tic_t bulbtime = TICRATE/2; +UINT8 numbulbs = 0; + tic_t raceexittime = 5*TICRATE + (2*TICRATE/3); tic_t battleexittime = 8*TICRATE; + INT32 hyudorotime = 7*TICRATE; INT32 stealtime = TICRATE/2; INT32 sneakertime = TICRATE + (TICRATE/3); diff --git a/src/k_kart.c b/src/k_kart.c index 90afd4451..7e649ac43 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7882,6 +7882,9 @@ static patch_t *kp_karmasticker; static patch_t *kp_splitkarmabomb; static patch_t *kp_timeoutsticker; +static patch_t *kp_prestartbulb[15]; +static patch_t *kp_prestartletters[7]; + static patch_t *kp_startcountdown[16]; static patch_t *kp_racefault[6]; static patch_t *kp_racefinish[6]; @@ -7999,6 +8002,24 @@ void K_LoadKartHUDGraphics(void) kp_splitkarmabomb = W_CachePatchName("K_SPTKRM", PU_HUDGFX); kp_timeoutsticker = W_CachePatchName("K_STTOUT", PU_HUDGFX); + // Pre-start countdown bulbs + sprintf(buffer, "K_BULBxx"); + for (i = 0; i < 15; i++) + { + buffer[6] = '0'+((i+1)/10); + buffer[7] = '0'+((i+1)%10); + kp_prestartbulb[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + } + + // Pre-start position letters + kp_prestartletters[0] = W_CachePatchName("K_PL_P", PU_HUDGFX); + kp_prestartletters[1] = W_CachePatchName("K_PL_O", PU_HUDGFX); + kp_prestartletters[2] = W_CachePatchName("K_PL_S", PU_HUDGFX); + kp_prestartletters[3] = W_CachePatchName("K_PL_I", PU_HUDGFX); + kp_prestartletters[4] = W_CachePatchName("K_PL_T", PU_HUDGFX); + kp_prestartletters[5] = W_CachePatchName("K_PL_N", PU_HUDGFX); + kp_prestartletters[6] = W_CachePatchName("K_PL_EX", PU_HUDGFX); + // Starting countdown kp_startcountdown[0] = W_CachePatchName("K_CNT3A", PU_HUDGFX); kp_startcountdown[1] = W_CachePatchName("K_CNT2A", PU_HUDGFX); @@ -10586,6 +10607,130 @@ static void K_drawKartMinimap(void) } } +static void K_drawKartStartBulbs(void) +{ + const UINT8 start_animation[14] = { + 1, 2, 3, 4, 5, 6, 7, 8, + 7, 6, + 9, 10, 11, 12 + }; + + const UINT8 loop_animation[4] = { + 12, 13, 12, 14 + }; + + const UINT8 chillloop_animation[2] = { + 11, 12 + }; + + const UINT8 letters_order[10] = { + 0, 1, 2, 3, 4, 3, 1, 5, 6, 6 + }; + + const UINT8 letters_transparency[40] = { + 0, 2, 4, 6, 8, + 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, + 10, 8, 6, 4, 2 + }; + + fixed_t spacing = 24*FRACUNIT; + + fixed_t startx = (BASEVIDWIDTH/2)*FRACUNIT + (spacing/2); + fixed_t x, y = 48*FRACUNIT; + + UINT8 numperrow = numbulbs/2; + UINT8 i; + + if (numbulbs <= 10) + { + // No second row + numperrow = numbulbs; + } + else + { + if (numbulbs & 1) + { + numperrow++; + } + + y -= (spacing/2); + } + + startx -= (spacing/2) * numperrow; + x = startx; + + for (i = 0; i < numbulbs; i++) + { + UINT8 patchnum = 0; + INT32 bulbtic = (leveltime - introtime - TICRATE) - (bulbtime * i); + + if (i == numperrow) + { + y += spacing; + x = startx + (spacing/2); + } + + if (bulbtic > 0) + { + if (bulbtic < 14) + { + patchnum = start_animation[bulbtic]; + } + else + { + const INT32 length = (bulbtime * 3); + + bulbtic -= 14; + + if (bulbtic > length) + { + bulbtic -= length; + patchnum = chillloop_animation[bulbtic % 2]; + } + else + { + patchnum = loop_animation[bulbtic % 4]; + } + } + } + + V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP, kp_prestartbulb[patchnum], NULL); + x += spacing; + } + + x = 70*FRACUNIT; + y = 48*FRACUNIT; + + for (i = 0; i < 10; i++) + { + UINT8 patchnum = letters_order[i]; + INT32 transflag = letters_transparency[(leveltime - i) % 40]; + + if (transflag >= 10) + ; + else + { + if (transflag != 0) + transflag = transflag << FF_TRANSSHIFT; + + V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP|transflag, kp_prestartletters[patchnum], NULL); + } + + if (i < 9) + { + x += (SHORT(kp_prestartletters[patchnum]->width)/2) * FRACUNIT; + + patchnum = letters_order[i+1]; + x += (SHORT(kp_prestartletters[patchnum]->width)/2) * FRACUNIT; + } + } +} + static void K_drawKartStartCountdown(void) { INT32 pnum = 0, splitflags = K_calcSplitFlags(0); // 3 @@ -11451,9 +11596,15 @@ void K_drawKartHUD(void) } // Draw the countdowns after everything else. - if (leveltime >= starttime-(3*TICRATE) + if (leveltime >= introtime && leveltime < starttime-(3*TICRATE)) + { + K_drawKartStartBulbs(); + } + else if (leveltime >= starttime-(3*TICRATE) && leveltime < starttime+TICRATE) + { K_drawKartStartCountdown(); + } else if (racecountdown && (!r_splitscreen || !stplyr->exiting)) { char *countstr = va("%d", racecountdown/TICRATE); diff --git a/src/p_setup.c b/src/p_setup.c index 994f7bccb..eb64639c2 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2481,7 +2481,14 @@ static void P_LevelInitStuff(void) introtime = (108) + 5; // 108 for rotation, + 5 for white fade } - starttime = introtime + (6*TICRATE) + (max(p-2, 0) * (TICRATE/2)); // Start countdown time, + buffer time + numbulbs = 5; + + if (p > 2) + { + numbulbs += (p-2); + } + + starttime = (introtime + (3*TICRATE)) + ((2*TICRATE) + (numbulbs * bulbtime)); // Start countdown time, + buffer time // SRB2Kart: map load variables if (grandprixinfo.gp == true) From b39c8562a6e3bd25fed680c303fd90d066bbf7c8 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 29 Jul 2020 01:47:00 -0400 Subject: [PATCH 21/23] Fault HUD scrolls, faulting respawns you & holds you until the countdown's over --- src/k_kart.c | 35 ++++++++++++++++++++++++++++------- src/k_respawn.c | 8 ++++---- src/p_spec.c | 32 ++++++++++++++------------------ 3 files changed, 46 insertions(+), 29 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 7e649ac43..47bb1ad05 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5293,6 +5293,11 @@ void K_KartPlayerHUDUpdate(player_t *player) if (player->karthud[khud_tauntvoices]) player->karthud[khud_tauntvoices]--; + if (!(player->pflags & PF_SKIDDOWN)) + player->karthud[khud_fault] = 0; + else if (player->karthud[khud_fault] > 0 && player->karthud[khud_fault] < 2*TICRATE) + player->karthud[khud_fault]++; + if (G_RaceGametype()) { // 0 is the fast spin animation, set at 30 tics of ring boost or higher! @@ -10737,6 +10742,8 @@ static void K_drawKartStartCountdown(void) if (stplyr->karthud[khud_fault] != 0) { + INT32 x, xval; + if (r_splitscreen > 1) // 3/4p, stationary FIN { pnum += 2; @@ -10749,7 +10756,25 @@ static void K_drawKartStartCountdown(void) if ((leveltime % (2*5)) / 5) // blink pnum += 1; - V_DrawScaledPatch(STCD_X - (SHORT(kp_racefault[pnum]->width)/2), STCD_Y - (SHORT(kp_racefault[pnum]->height)/2), splitflags, kp_racefault[pnum]); + if (r_splitscreen == 0) + { + x = ((vid.width<width)<karthud[khud_fault])*(xval > x ? xval : x))/TICRATE; + + V_DrawFixedPatch(x + (STCD_X<>1), + (STCD_Y<height)<<(FRACBITS-1)), + FRACUNIT, + splitflags, kp_racefault[pnum], NULL); + } + else + { + V_DrawScaledPatch(STCD_X - (SHORT(kp_racefault[pnum]->width)/2), STCD_Y - (SHORT(kp_racefault[pnum]->height)/2), splitflags, kp_racefault[pnum]); + } + } + else if (leveltime >= introtime && leveltime < starttime-(3*TICRATE)) + { + K_drawKartStartBulbs(); } else { @@ -11596,12 +11621,8 @@ void K_drawKartHUD(void) } // Draw the countdowns after everything else. - if (leveltime >= introtime && leveltime < starttime-(3*TICRATE)) - { - K_drawKartStartBulbs(); - } - else if (leveltime >= starttime-(3*TICRATE) - && leveltime < starttime+TICRATE) + if (leveltime >= introtime + && leveltime < starttime+TICRATE) { K_drawKartStartCountdown(); } diff --git a/src/k_respawn.c b/src/k_respawn.c index 360174fa1..28f4b432c 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -101,13 +101,12 @@ void K_DoIngameRespawn(player_t *player) return; } - if (leveltime < starttime) + if (leveltime < starttime) // FAULT { player->powers[pw_nocontrol] = (starttime - leveltime) + 50; player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse S_StartSound(player->mo, sfx_s3k83); player->karthud[khud_fault] = 1; - player->mo->momx = player->mo->momy = 0; } player->kartstuff[k_ringboost] = 0; @@ -288,7 +287,7 @@ static void K_MovePlayerToRespawnPoint(player_t *player) player->mo->momx = player->mo->momy = player->mo->momz = 0; player->powers[pw_flashing] = 2; - player->powers[pw_nocontrol] = 2; + player->powers[pw_nocontrol] = max(2, player->powers[pw_nocontrol]); if (leveltime % 8 == 0 && !mapreset) { @@ -541,7 +540,8 @@ static void K_MovePlayerToRespawnPoint(player_t *player) --------------------------------------------------*/ static void K_DropDashWait(player_t *player) { - player->respawn.timer--; + if (player->powers[pw_nocontrol] == 0) + player->respawn.timer--; if (leveltime % 8 == 0) { diff --git a/src/p_spec.c b/src/p_spec.c index 315e04aa5..1e3c30299 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2066,7 +2066,12 @@ static void K_HandleLapIncrement(player_t *player) { if (player) { - if ((player->starpostnum == numstarposts) || (player->laps == 0)) + if (leveltime < starttime) + { + // Will fault the player + K_DoIngameRespawn(player); + } + else if ((player->starpostnum == numstarposts) || (player->laps == 0)) { size_t i = 0; UINT8 nump = 0; @@ -2101,6 +2106,14 @@ static void K_HandleLapIncrement(player_t *player) player->karthud[khud_lapanimation] = 80; } + if (rainbowstartavailable == true) + { + S_StartSound(player->mo, sfx_s23c); + player->kartstuff[k_startboost] = 125; + K_SpawnDriftBoostExplosion(player, 3); + rainbowstartavailable = false; + } + if (netgame && player->laps >= (UINT8)cv_numlaps.value) CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players])); @@ -2184,23 +2197,6 @@ static void K_HandleLapIncrement(player_t *player) { S_StartSound(player->mo, sfx_s26d); } - - if (leveltime < starttime) - { - // LATER: replace with the rotatey knockback whenever we get around to it - player->powers[pw_nocontrol] = (starttime - leveltime) + 50; - player->pflags |= PF_SKIDDOWN; // cheeky pflag reuse - S_StartSound(player->mo, sfx_s3k83); - player->karthud[khud_fault] = 1; - player->mo->momx = player->mo->momy = 0; - } - else if (rainbowstartavailable == true) - { - S_StartSound(player->mo, sfx_s23c); - player->kartstuff[k_startboost] = 125; - K_SpawnDriftBoostExplosion(player, 3); - rainbowstartavailable = false; - } } } From 1bbe4ede705d20b2eb44a13e9d823ffef5ee9f5c Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 29 Jul 2020 04:13:35 -0400 Subject: [PATCH 22/23] Duel graphic for 1v1s Yu-Gi-Oh! Prison --- src/k_kart.c | 55 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 47bb1ad05..b06c90a3b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7890,7 +7890,7 @@ static patch_t *kp_timeoutsticker; static patch_t *kp_prestartbulb[15]; static patch_t *kp_prestartletters[7]; -static patch_t *kp_startcountdown[16]; +static patch_t *kp_startcountdown[20]; static patch_t *kp_racefault[6]; static patch_t *kp_racefinish[6]; @@ -8030,19 +8030,23 @@ void K_LoadKartHUDGraphics(void) kp_startcountdown[1] = W_CachePatchName("K_CNT2A", PU_HUDGFX); kp_startcountdown[2] = W_CachePatchName("K_CNT1A", PU_HUDGFX); kp_startcountdown[3] = W_CachePatchName("K_CNTGOA", PU_HUDGFX); - kp_startcountdown[4] = W_CachePatchName("K_CNT3B", PU_HUDGFX); - kp_startcountdown[5] = W_CachePatchName("K_CNT2B", PU_HUDGFX); - kp_startcountdown[6] = W_CachePatchName("K_CNT1B", PU_HUDGFX); - kp_startcountdown[7] = W_CachePatchName("K_CNTGOB", PU_HUDGFX); + kp_startcountdown[4] = W_CachePatchName("K_DUEL1", PU_HUDGFX); + kp_startcountdown[5] = W_CachePatchName("K_CNT3B", PU_HUDGFX); + kp_startcountdown[6] = W_CachePatchName("K_CNT2B", PU_HUDGFX); + kp_startcountdown[7] = W_CachePatchName("K_CNT1B", PU_HUDGFX); + kp_startcountdown[8] = W_CachePatchName("K_CNTGOB", PU_HUDGFX); + kp_startcountdown[9] = W_CachePatchName("K_DUEL2", PU_HUDGFX); // Splitscreen - kp_startcountdown[8] = W_CachePatchName("K_SMC3A", PU_HUDGFX); - kp_startcountdown[9] = W_CachePatchName("K_SMC2A", PU_HUDGFX); - kp_startcountdown[10] = W_CachePatchName("K_SMC1A", PU_HUDGFX); - kp_startcountdown[11] = W_CachePatchName("K_SMCGOA", PU_HUDGFX); - kp_startcountdown[12] = W_CachePatchName("K_SMC3B", PU_HUDGFX); - kp_startcountdown[13] = W_CachePatchName("K_SMC2B", PU_HUDGFX); - kp_startcountdown[14] = W_CachePatchName("K_SMC1B", PU_HUDGFX); - kp_startcountdown[15] = W_CachePatchName("K_SMCGOB", PU_HUDGFX); + kp_startcountdown[10] = W_CachePatchName("K_SMC3A", PU_HUDGFX); + kp_startcountdown[11] = W_CachePatchName("K_SMC2A", PU_HUDGFX); + kp_startcountdown[12] = W_CachePatchName("K_SMC1A", PU_HUDGFX); + kp_startcountdown[13] = W_CachePatchName("K_SMCGOA", PU_HUDGFX); + kp_startcountdown[14] = W_CachePatchName("K_SDUEL1", PU_HUDGFX); + kp_startcountdown[15] = W_CachePatchName("K_SMC3B", PU_HUDGFX); + kp_startcountdown[16] = W_CachePatchName("K_SMC2B", PU_HUDGFX); + kp_startcountdown[17] = W_CachePatchName("K_SMC1B", PU_HUDGFX); + kp_startcountdown[18] = W_CachePatchName("K_SMCGOB", PU_HUDGFX); + kp_startcountdown[19] = W_CachePatchName("K_SDUEL2", PU_HUDGFX); // Fault kp_racefault[0] = W_CachePatchName("K_FAULTA", PU_HUDGFX); @@ -10783,12 +10787,33 @@ static void K_drawKartStartCountdown(void) pnum++; if (leveltime >= starttime-TICRATE) // 1 pnum++; + if (leveltime >= starttime) // GO! + { + UINT8 i; + UINT8 numplayers = 0; + pnum++; + + for (i = 0; i < MAXPLAYERS; i++) + { + if (playeringame[i] && !players[i].spectator) + numplayers++; + + if (numplayers > 2) + break; + } + + if (numplayers == 2) + { + pnum++; // DUEL + } + } + if ((leveltime % (2*5)) / 5) // blink - pnum += 4; + pnum += 5; if (r_splitscreen) // splitscreen - pnum += 8; + pnum += 10; V_DrawScaledPatch(STCD_X - (SHORT(kp_startcountdown[pnum]->width)/2), STCD_Y - (SHORT(kp_startcountdown[pnum]->height)/2), splitflags, kp_startcountdown[pnum]); } From 4044a153caf498382b33a282104e3241afd1debe Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 29 Jul 2020 05:00:12 -0400 Subject: [PATCH 23/23] Splitscreen support for the prestart counter --- src/k_kart.c | 68 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b06c90a3b..0af1ec658 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7890,6 +7890,9 @@ static patch_t *kp_timeoutsticker; static patch_t *kp_prestartbulb[15]; static patch_t *kp_prestartletters[7]; +static patch_t *kp_prestartbulb_split[15]; +static patch_t *kp_prestartletters_split[7]; + static patch_t *kp_startcountdown[20]; static patch_t *kp_racefault[6]; static patch_t *kp_racefinish[6]; @@ -8016,6 +8019,14 @@ void K_LoadKartHUDGraphics(void) kp_prestartbulb[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); } + sprintf(buffer, "K_SBLBxx"); + for (i = 0; i < 15; i++) + { + buffer[6] = '0'+((i+1)/10); + buffer[7] = '0'+((i+1)%10); + kp_prestartbulb_split[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + } + // Pre-start position letters kp_prestartletters[0] = W_CachePatchName("K_PL_P", PU_HUDGFX); kp_prestartletters[1] = W_CachePatchName("K_PL_O", PU_HUDGFX); @@ -8025,6 +8036,14 @@ void K_LoadKartHUDGraphics(void) kp_prestartletters[5] = W_CachePatchName("K_PL_N", PU_HUDGFX); kp_prestartletters[6] = W_CachePatchName("K_PL_EX", PU_HUDGFX); + kp_prestartletters_split[0] = W_CachePatchName("K_SPL_P", PU_HUDGFX); + kp_prestartletters_split[1] = W_CachePatchName("K_SPL_O", PU_HUDGFX); + kp_prestartletters_split[2] = W_CachePatchName("K_SPL_S", PU_HUDGFX); + kp_prestartletters_split[3] = W_CachePatchName("K_SPL_I", PU_HUDGFX); + kp_prestartletters_split[4] = W_CachePatchName("K_SPL_T", PU_HUDGFX); + kp_prestartletters_split[5] = W_CachePatchName("K_SPL_N", PU_HUDGFX); + kp_prestartletters_split[6] = W_CachePatchName("K_SPL_EX", PU_HUDGFX); + // Starting countdown kp_startcountdown[0] = W_CachePatchName("K_CNT3A", PU_HUDGFX); kp_startcountdown[1] = W_CachePatchName("K_CNT2A", PU_HUDGFX); @@ -10649,12 +10668,28 @@ static void K_drawKartStartBulbs(void) fixed_t spacing = 24*FRACUNIT; - fixed_t startx = (BASEVIDWIDTH/2)*FRACUNIT + (spacing/2); - fixed_t x, y = 48*FRACUNIT; + fixed_t startx = (BASEVIDWIDTH/2)*FRACUNIT; + fixed_t starty = 48*FRACUNIT; + fixed_t x, y; UINT8 numperrow = numbulbs/2; UINT8 i; + UINT32 splitflag = K_calcSplitFlags(0); + + if (r_splitscreen >= 1) + { + spacing /= 2; + starty /= 3; + + if (r_splitscreen > 1) + { + startx /= 2; + } + } + + startx += (spacing/2); + if (numbulbs <= 10) { // No second row @@ -10667,11 +10702,13 @@ static void K_drawKartStartBulbs(void) numperrow++; } - y -= (spacing/2); + starty -= (spacing/2); } startx -= (spacing/2) * numperrow; + x = startx; + y = starty; for (i = 0; i < numbulbs; i++) { @@ -10708,17 +10745,28 @@ static void K_drawKartStartBulbs(void) } } - V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP, kp_prestartbulb[patchnum], NULL); + V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP|splitflag, + (r_splitscreen ? kp_prestartbulb_split[patchnum] : kp_prestartbulb[patchnum]), NULL); x += spacing; } x = 70*FRACUNIT; - y = 48*FRACUNIT; + y = starty; + + if (r_splitscreen == 1) + { + x = 106*FRACUNIT; + } + else if (r_splitscreen > 1) + { + x = 28*FRACUNIT; + } for (i = 0; i < 10; i++) { UINT8 patchnum = letters_order[i]; INT32 transflag = letters_transparency[(leveltime - i) % 40]; + patch_t *patch = (r_splitscreen ? kp_prestartletters_split[patchnum] : kp_prestartletters[patchnum]); if (transflag >= 10) ; @@ -10727,15 +10775,19 @@ static void K_drawKartStartBulbs(void) if (transflag != 0) transflag = transflag << FF_TRANSSHIFT; - V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP|transflag, kp_prestartletters[patchnum], NULL); + V_DrawFixedPatch(x, y, FRACUNIT, V_SNAPTOTOP|splitflag|transflag, patch, NULL); } if (i < 9) { - x += (SHORT(kp_prestartletters[patchnum]->width)/2) * FRACUNIT; + x += (SHORT(patch->width)) * FRACUNIT/2; patchnum = letters_order[i+1]; - x += (SHORT(kp_prestartletters[patchnum]->width)/2) * FRACUNIT; + patch = (r_splitscreen ? kp_prestartletters_split[patchnum] : kp_prestartletters[patchnum]); + x += (SHORT(patch->width)) * FRACUNIT/2; + + if (r_splitscreen) + x -= FRACUNIT; } } }