diff --git a/src/d_player.h b/src/d_player.h index d02a3947..bf4e91bf 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -282,9 +282,7 @@ typedef enum k_voices, // Used to stop the player saying more voices than it should k_tauntvoices, // Used to specifically stop taunt voice spam - k_boosting, // Determines if you're currently shroom-boosting k_floorboost, // Prevents Sneaker sounds for a breif duration when triggered by a floor panel - k_spinout, // Separate confirmation to prevent endless wipeout loops k_spinouttype, // Determines whether to thrust forward or not while spinning out; 0 = move forwards, 1 = stay still k_drift, // Drifting Left or Right, plus a bigger counter = sharper turn @@ -319,7 +317,6 @@ typedef enum k_eggmanheld, // Eggman monitor held, separate from k_itemheld so it doesn't stop you from getting items k_spinouttimer, // Spin-out from a banana peel or oil slick (was "pw_bananacam") k_justbumped, // Prevent players from endlessly bumping into each other - k_poweritemtimer, // Battle mode, how long before you're allowed another power item (Invincibility, Grow) k_comebacktimer, // Battle mode, how long before you become a bomb after death k_sadtimer, // How long you've been sad diff --git a/src/doomdata.h b/src/doomdata.h index e916a151..1b91c94d 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -207,8 +207,8 @@ typedef struct #define ZSHIFT 4 -extern const char *Color_Names[MAXSKINCOLORS]; -extern const UINT8 Color_Opposite[MAXSKINCOLORS*2]; +//extern const char *Color_Names[MAXSKINCOLORS]; +//extern const UINT8 Color_Opposite[MAXSKINCOLORS*2]; #define NUMMAPS 1035 diff --git a/src/g_game.c b/src/g_game.c index de47d643..0e1648c8 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1320,7 +1320,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) cmd->driftturn = (INT16)(cmd->driftturn - (mousex*(mirrormode ? -1 : 1)*8)); } - // Bounce pad strafing + // Speed bump strafing if (!demoplayback && ((player->pflags & PF_FORCESTRAFE) || (player->kartstuff[k_pogospring]))) { if (turnright) @@ -1334,25 +1334,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) } } - //{ SRB2kart - Drift support - // limit turning to angleturn[1] to stop mouselook letting you look too fast - if (cmd->angleturn > angleturn[1]) - cmd->angleturn = angleturn[1]; - else if (cmd->angleturn < -angleturn[1]) - cmd->angleturn = -angleturn[1]; - - if (cmd->driftturn > angleturn[1]) - cmd->driftturn = angleturn[1]; - else if (cmd->driftturn < -angleturn[1]) - cmd->driftturn = -angleturn[1]; - - if (player->mo) - cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn); - - // SRB2kart - no additional angle if not moving - if ((player->mo && player->speed > 0) || (leveltime > 140 && cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE) || (player->spectator || objectplacing)) - lang += (cmd->angleturn<<16); - if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls { if (InputDown(gc_accelerate, ssplayer) || (cv_usejoystick.value && axis > 0)) @@ -1508,6 +1489,29 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) cmd->sidemove = (SINT8)(cmd->sidemove + side); } + //{ 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 + // limit turning to angleturn[1] to stop mouselook letting you look too fast + if (cmd->angleturn > angleturn[1]) + cmd->angleturn = angleturn[1]; + else if (cmd->angleturn < -angleturn[1]) + cmd->angleturn = -angleturn[1]; + + if (cmd->driftturn > angleturn[1]) + cmd->driftturn = angleturn[1]; + else if (cmd->driftturn < -angleturn[1]) + cmd->driftturn = -angleturn[1]; + + if (player->mo) + cmd->angleturn = K_GetKartTurnValue(player, cmd->angleturn); + + // SRB2kart - no additional angle if not moving + if (((player->mo && player->speed > 0) // Moving + || (leveltime > 140 && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn + || (player->spectator || objectplacing)) // Not a physical player + && !(player->kartstuff[k_spinouttimer] && player->kartstuff[k_sneakertimer])) // Spinning and boosting cancels out spinout + lang += (cmd->angleturn<<16); + cmd->angleturn = (INT16)(lang >> 16); if (!hu_stopped) @@ -2290,7 +2294,6 @@ void G_PlayerReborn(INT32 player) // SRB2kart INT32 starpostwp; - INT32 offroad; INT32 balloon; INT32 comebackpoints; @@ -2347,7 +2350,6 @@ void G_PlayerReborn(INT32 player) // SRB2kart starpostwp = players[player].kartstuff[k_starpostwp]; - offroad = players[player].kartstuff[k_offroad]; balloon = players[player].kartstuff[k_balloon]; comebackpoints = players[player].kartstuff[k_comebackpoints]; @@ -2405,8 +2407,6 @@ void G_PlayerReborn(INT32 player) // SRB2kart p->kartstuff[k_starpostwp] = starpostwp; // TODO: get these out of kartstuff, it causes desync - p->kartstuff[k_offroad] = offroad; - p->kartstuff[k_balloon] = balloon; p->kartstuff[k_comebackpoints] = comebackpoints; p->kartstuff[k_comebacktimer] = comebacktime; diff --git a/src/k_kart.c b/src/k_kart.c index 3b15b9e0..7b1ced80 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -86,7 +86,7 @@ const char *KartColor_Names[MAXSKINCOLORS] = "Dark Green", // 44 // SKINCOLOR_DARKGREEN "Swamp", // 45 // SKINCOLOR_SWAMP "Frost", // 46 // SKINCOLOR_FROST - "Slate", // 47 // SKINCOLOR_SLATEBLUE + "Slate", // 47 // SKINCOLOR_SLATE "Light Blue", // 48 // SKINCOLOR_LIGHTBLUE "Cyan", // 49 // SKINCOLOR_CYAN "Cerulean", // 50 // SKINCOLOR_CERULEAN @@ -105,6 +105,75 @@ const char *KartColor_Names[MAXSKINCOLORS] = "Indigo" // 63 // SKINCOLOR_INDIGO }; +// Color_Opposite replacement; frame setting has not been changed from 8 for most, should be done later +const UINT8 KartColor_Opposite[MAXSKINCOLORS*2] = +{ + SKINCOLOR_NONE,8, // 00 // SKINCOLOR_NONE + SKINCOLOR_BLACK,8, // 01 // SKINCOLOR_IVORY + SKINCOLOR_BLACK,8, // 02 // SKINCOLOR_WHITE + SKINCOLOR_DARKGREY,8, // 03 // SKINCOLOR_SILVER + SKINCOLOR_CLOUDY,8, // 04 // SKINCOLOR_CLOUDY + SKINCOLOR_GREY,8, // 05 // SKINCOLOR_GREY + SKINCOLOR_SILVER,8, // 06 // SKINCOLOR_DARKGREY + SKINCOLOR_WHITE,8, // 07 // SKINCOLOR_BLACK + SKINCOLOR_SWAMP,8, // 08 // SKINCOLOR_SALMON + SKINCOLOR_ARMY,8, // 09 // SKINCOLOR_PINK + SKINCOLOR_DARKGREEN,8, // 10 // SKINCOLOR_LIGHTRED + SKINCOLOR_UGLYGREEN,8, // 11 // SKINCOLOR_SHINYRED + SKINCOLOR_GREEN,8, // 12 // SKINCOLOR_RED + SKINCOLOR_DARKARMY,8, // 13 // SKINCOLOR_DARKPINK + SKINCOLOR_LIGHTGREEN,8, // 14 // SKINCOLOR_DARKRED + SKINCOLOR_NAVY,8, // 15 // SKINCOLOR_DAWN + SKINCOLOR_BLUE,8, // 16 // SKINCOLOR_ORANGE + SKINCOLOR_SHINYBLUE,8, // 17 // SKINCOLOR_SHINYORANGE + SKINCOLOR_LIGHTBLUE,8, // 18 // SKINCOLOR_DARKORANGE + SKINCOLOR_STEELBLUE,8, // 19 // SKINCOLOR_GOLDENBROWN + SKINCOLOR_STEELBLUE,8, // 20 // SKINCOLOR_ROSEWOOD + SKINCOLOR_SLATE,8, // 21 // SKINCOLOR_DARKROSEWOOD + SKINCOLOR_LEATHER,8, // 22 // SKINCOLOR_SEPIA + SKINCOLOR_BROWN,8, // 23 // SKINCOLOR_BEIGE + SKINCOLOR_BEIGE,8, // 24 // SKINCOLOR_BROWN + SKINCOLOR_SEPIA,8, // 25 // SKINCOLOR_LEATHER + SKINCOLOR_INDIGO,8, // 26 // SKINCOLOR_YELLOW + SKINCOLOR_BROWN,8, // 27 // SKINCOLOR_PEACH + SKINCOLOR_DARKBLUE,8, // 28 // SKINCOLOR_LIGHTORANGE + SKINCOLOR_SEPIA,8, // 29 // SKINCOLOR_CARAMEL + SKINCOLOR_LAVENDER,8, // 30 // SKINCOLOR_GOLD + SKINCOLOR_BEIGE,8, // 31 // SKINCOLOR_SHINYCARAMEL + SKINCOLOR_PURPLE,8, // 32 // SKINCOLOR_VOMIT + SKINCOLOR_BYZANTIUM,8, // 33 // SKINCOLOR_GARDEN + SKINCOLOR_LAVENDER,8, // 34 // SKINCOLOR_LIGHTARMY + SKINCOLOR_LAVENDER,8, // 35 // SKINCOLOR_ARMY + SKINCOLOR_PURPLE,8, // 36 // SKINCOLOR_PISTACHIO + SKINCOLOR_LILAC,8, // 37 // SKINCOLOR_ROBOHOOD + SKINCOLOR_LILAC,8, // 38 // SKINCOLOR_OLIVE + SKINCOLOR_LAVENDER,8, // 39 // SKINCOLOR_DARKARMY + SKINCOLOR_DARKRED,8, // 40 // SKINCOLOR_LIGHTGREEN + SKINCOLOR_SHINYRED,8, // 41 // SKINCOLOR_UGLYGREEN + SKINCOLOR_SHINYRED,8, // 42 // SKINCOLOR_NEONGREEN + SKINCOLOR_RED,8, // 43 // SKINCOLOR_GREEN + SKINCOLOR_LIGHTRED,8, // 44 // SKINCOLOR_DARKGREEN + SKINCOLOR_SALMON,8, // 45 // SKINCOLOR_SWAMP + SKINCOLOR_DARKRED,8, // 46 // SKINCOLOR_FROST + SKINCOLOR_PINK,8, // 47 // SKINCOLOR_SLATE + SKINCOLOR_LIGHTORANGE,8, // 48 // SKINCOLOR_LIGHTBLUE + SKINCOLOR_CARAMEL,8, // 49 // SKINCOLOR_CYAN + SKINCOLOR_GOLD,8, // 50 // SKINCOLOR_CERULEAN + SKINCOLOR_SHINYCARAMEL,8,// 51 // SKINCOLOR_TURQUOISE + SKINCOLOR_RED,8, // 52 // SKINCOLOR_TEAL + SKINCOLOR_PEACH,8, // 53 // SKINCOLOR_STEELBLUE + SKINCOLOR_ORANGE,8, // 54 // SKINCOLOR_BLUE + SKINCOLOR_SHINYORANGE,8, // 55 // SKINCOLOR_SHINYBLUE + SKINCOLOR_DAWN,8, // 56 // SKINCOLOR_NAVY + SKINCOLOR_LIGHTORANGE,8, // 57 // SKINCOLOR_DARKBLUE + SKINCOLOR_SLATE,8, // 58 // SKINCOLOR_JETBLACK + SKINCOLOR_YELLOW,4, // 59 // SKINCOLOR_LILAC + SKINCOLOR_YELLOW,8, // 60 // SKINCOLOR_PURPLE + SKINCOLOR_GOLD,8, // 61 // SKINCOLOR_LAVENDER + SKINCOLOR_GARDEN,8, // 62 // SKINCOLOR_BYZANTIUM + SKINCOLOR_YELLOW,8 // 63 // SKINCOLOR_INDIGO +}; + UINT8 colortranslations[MAXSKINCOLORS][16] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, // SKINCOLOR_NONE {120, 120, 120, 120, 0, 0, 0, 0, 1, 1, 2, 2, 4, 6, 8, 10}, // SKINCOLOR_IVORY @@ -376,7 +445,7 @@ static INT32 K_KartItemOddsRace[NUMKARTRESULTS][9] = /*Jawz*/ { 0, 0, 3, 2, 2, 1, 0, 0, 0 }, // Jawz /*Mine*/ { 0, 1, 1, 2, 1, 0, 0, 0, 0 }, // Mine /*Ballhog*/ { 0, 0, 1, 2, 1, 0, 0, 0, 0 }, // Ballhog - /*Self-Propelled Bomb*/ { 0, 0, 1, 1, 2, 3, 4, 3, 2 }, // Self-Propelled Bomb + /*Self-Propelled Bomb*/ { 0, 0, 1, 1, 1, 1, 2, 2, 2 }, // Self-Propelled Bomb /*Grow*/ { 0, 0, 0, 0, 0, 0, 1, 1, 2 }, // Grow /*Shrink*/ { 0, 0, 0, 0, 0, 0, 1, 1, 2 }, // Shrink /*Lightning Shield*/ { 0, 1, 2, 0, 0, 0, 0, 0, 0 }, // Lightning Shield @@ -474,7 +543,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, player_t *player, boolean const INT32 distvar = (64*14); INT32 newodds; INT32 i; - UINT8 pingame = 0, pexiting = 0; + UINT8 pingame = 0, pexiting = 0, pinvin = 0; SINT8 first = -1; SINT8 second = -1; INT32 secondist = 0; @@ -486,19 +555,24 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, player_t *player, boolean for (i = 0; i < MAXPLAYERS; i++) { - if (playeringame[i] && !players[i].spectator) - { - pingame++; - if (players[i].mo) - { - if (players[i].kartstuff[k_position] == 1 && first == -1) - first = i; - if (players[i].kartstuff[k_position] == 2 && second == -1) - second = i; - } - } + if (!playeringame[i] || players[i].spectator) + continue; + + pingame++; if (players[i].exiting) pexiting++; + if (players[i].mo) + { + if (players[i].kartstuff[k_position] == 1 && first == -1) + first = i; + if (players[i].kartstuff[k_position] == 2 && second == -1) + second = i; + if (players[i].kartstuff[k_itemtype] == KITEM_INVINCIBILITY + || players[i].kartstuff[k_itemtype] == KITEM_GROW + || players[i].kartstuff[k_invincibilitytimer] + || players[i].kartstuff[k_growshrinktimer] > 0) + pinvin++; + } } if (first != -1 && second != -1) // calculate 2nd's distance from 1st, for SPB @@ -525,8 +599,7 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, player_t *player, boolean case KITEM_INVINCIBILITY: if (franticitems) newodds *= 2; if (mashed) newodds /= 2; - if ((!cv_invincibility.value) - || (player->kartstuff[k_poweritemtimer])) newodds = 0; + if ((!cv_invincibility.value) || (pinvin > 2)) newodds = 0; break; case KITEM_BANANA: if (!cv_banana.value) newodds = 0; @@ -558,13 +631,14 @@ static INT32 K_KartGetItemOdds(UINT8 pos, SINT8 item, player_t *player, boolean if ((!cv_selfpropelledbomb.value) || (indirectitemcooldown > 0) || (pexiting > 0) - || (secondist <= distvar*4)) newodds = 0; + || (secondist/distvar < 4)) + newodds = 0; + newodds *= min((secondist/distvar)-3, 3); break; case KITEM_GROW: if (franticitems) newodds *= 2; if (mashed) newodds /= 2; - if ((!cv_grow.value) - || (player->kartstuff[k_poweritemtimer])) newodds = 0; + if ((!cv_grow.value) || (pinvin > 2)) newodds = 0; break; case KITEM_SHRINK: if (franticitems) newodds *= 2; @@ -1218,7 +1292,7 @@ static fixed_t K_GetKartBoostPower(player_t *player, boolean speed) // Offroad is separate, it's difficult to factor it in with a variable value anyway. if (!(player->kartstuff[k_invincibilitytimer] || player->kartstuff[k_hyudorotimer] || player->kartstuff[k_sneakertimer]) && player->kartstuff[k_offroad] >= 0 && speed) - boostpower = FixedDiv(boostpower, player->kartstuff[k_offroad] + FRACUNIT); + boostpower = FixedDiv(boostpower, player->kartstuff[k_offroad] + FRACUNIT); if (player->kartstuff[k_growshrinktimer] > 0) { // Grow @@ -1334,15 +1408,6 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove if (!onground) return 0; // If the player isn't on the ground, there is no change in speed - if (forwardmove <= 0 && 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]++; - return 0; - } - else if (forwardmove > 0) - player->kartstuff[k_brakestop] = 0; - // ACCELCODE!!!1!11! oldspeed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); // FixedMul(P_AproxDistance(player->rmomx, player->rmomy), player->mo->scale); newspeed = FixedDiv(FixedDiv(FixedMul(oldspeed, accelmax - p_accel) + FixedMul(p_speed, p_accel), accelmax), ORIG_FRICTION); @@ -1373,7 +1438,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source) if (player->health <= 0) return; - if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinout] > 0) + if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_spinouttimer] > 0 || player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 || (G_BattleGametype() && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) return; @@ -1381,7 +1446,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source) if (source && source != player->mo && source->player) K_PlayHitEmSound(source); - player->kartstuff[k_sneakertimer] = 0; + //player->kartstuff[k_sneakertimer] = 0; player->kartstuff[k_driftboost] = 0; if (G_BattleGametype()) @@ -1409,24 +1474,19 @@ void K_SpinPlayer(player_t *player, mobj_t *source) if (player->kartstuff[k_spinouttype] <= 0) { - if (player->kartstuff[k_spinouttype] == 0) - player->kartstuff[k_spinouttimer] = 3*TICRATE/2; // Explosion/Banana Wipeout - else - player->kartstuff[k_spinouttimer] = 3*TICRATE/2; // Oil Slick Wipeout + player->kartstuff[k_spinouttimer] = 3*TICRATE/2; // Banana Spinout - // At Wipeout, playerspeed is increased to 1/4 their regular speed, moving them forward + // At spinout, player speed is increased to 1/4 their regular speed, moving them forward if (player->speed < K_GetKartSpeed(player, true)/4) P_InstaThrust(player->mo, player->mo->angle, FixedMul(K_GetKartSpeed(player, true)/4, player->mo->scale)); S_StartSound(player->mo, sfx_slip); } else - player->kartstuff[k_spinouttimer] = 1*TICRATE; // ? Whipeout + player->kartstuff[k_spinouttimer] = 1*TICRATE; // Wipeout player->powers[pw_flashing] = K_GetKartFlashing(); - player->kartstuff[k_spinout] = player->kartstuff[k_spinouttimer]; - if (player->mo->state != &states[S_KART_SPIN]) P_SetPlayerMobjState(player->mo, S_KART_SPIN); @@ -1490,7 +1550,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju if (player->health <= 0) return; - if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinout] > 0) + if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_spinouttimer] > 0 || player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 || (G_BattleGametype() && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) return; @@ -1526,7 +1586,6 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju player->kartstuff[k_spinouttype] = 1; player->kartstuff[k_spinouttimer] = 2*TICRATE+(TICRATE/2); - player->kartstuff[k_spinout] = player->kartstuff[k_spinouttimer]; player->powers[pw_flashing] = K_GetKartFlashing(); @@ -1559,17 +1618,15 @@ void K_StealBalloon(player_t *player, player_t *victim, boolean force) if (player->health <= 0 || victim->health <= 0) return; - if (force) - ; - else + if (!force) { if (victim->kartstuff[k_balloon] <= 0) // || player->kartstuff[k_balloon] >= cv_kartballoons.value+2 return; - if ((player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinout] > 0) + if ((player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_spinouttimer] > 0 || player->kartstuff[k_invincibilitytimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_hyudorotimer] > 0 || (player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer])) - || (victim->powers[pw_flashing] > 0 || victim->kartstuff[k_squishedtimer] > 0 || (victim->kartstuff[k_spinouttimer] > 0 && victim->kartstuff[k_spinout] > 0) + || (victim->powers[pw_flashing] > 0 || victim->kartstuff[k_squishedtimer] > 0 || victim->kartstuff[k_spinouttimer] > 0 || victim->kartstuff[k_invincibilitytimer] > 0 || victim->kartstuff[k_growshrinktimer] > 0 || victim->kartstuff[k_hyudorotimer] > 0)) return; } @@ -2360,17 +2417,17 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed) thrust = FixedMul(thrust, 5*FRACUNIT/4); else if (mo->player->kartstuff[k_invincibilitytimer]) thrust = FixedMul(thrust, 9*FRACUNIT/8); - mo->momz = FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), FixedMul(thrust, mo->scale)); } else { - thrust = P_AproxDistance(mo->momx,mo->momy); - if (thrust < 8< 16<momx, mo->momy)/2, 5*FRACUNIT/2); + if (thrust < 16<momz = FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), FixedMul(thrust, mo->scale)); + if (thrust > 32<momz = FixedMul(FINESINE(ANGLE_22h>>ANGLETOFINESHIFT), FixedMul(thrust, mo->scale)); } else mo->momz = FixedMul(vertispeed, mo->scale); @@ -2424,10 +2481,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->mo->colorized = false; } - if (player->kartstuff[k_spinout] && P_IsObjectOnGround(player->mo)) - player->kartstuff[k_spinout]--; - - if (player->kartstuff[k_spinouttimer] && (P_IsObjectOnGround(player->mo) || player->kartstuff[k_spinouttype])) + if (player->kartstuff[k_spinouttimer] + && (P_IsObjectOnGround(player->mo) || player->kartstuff[k_spinouttype] == 1)) player->kartstuff[k_spinouttimer]--; else if (!comeback) player->kartstuff[k_comebacktimer] = comebacktime; @@ -2438,13 +2493,13 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) comebackshowninfo = true; // client has already seen the message } - if (player->kartstuff[k_spinout] == 0 && player->kartstuff[k_spinouttimer] == 0 && player->powers[pw_flashing] == K_GetKartFlashing()) + if (player->kartstuff[k_spinouttimer] == 0 && player->powers[pw_flashing] == K_GetKartFlashing()) player->powers[pw_flashing]--; if (player->kartstuff[k_attractiontimer]) player->kartstuff[k_attractiontimer]--; - if (player->kartstuff[k_sneakertimer] && (P_IsObjectOnGround(player->mo) && !player->kartstuff[k_spinouttimer])) + if (player->kartstuff[k_sneakertimer]) player->kartstuff[k_sneakertimer]--; if (player->kartstuff[k_floorboost]) @@ -2497,9 +2552,6 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) player->kartstuff[k_deathsentence]--; } - if (player->kartstuff[k_poweritemtimer]) - player->kartstuff[k_poweritemtimer]--; - if (player->kartstuff[k_lapanimation]) player->kartstuff[k_lapanimation]--; @@ -2758,8 +2810,7 @@ static void K_KartDrift(player_t *player, boolean onground) } // Incease/decrease the drift value to continue drifting in that direction - if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_jmp] == 1 && onground - && player->kartstuff[k_drift] != 0) + if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_jmp] == 1 && onground && player->kartstuff[k_drift] != 0) { fixed_t driftadditive = 24; @@ -3219,7 +3270,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) P_SetTarget(&player->mo->hnext, mo); } } - else if (!(cmd->buttons & BT_ATTACK) && HOLDING_ITEM && player->kartstuff[k_itemheld]) + else if (ATTACK_IS_DOWN && player->kartstuff[k_itemheld]) { K_ThrowKartItem(player, false, MT_SSMINE, 1, true); K_PlayTauntSound(player->mo); @@ -3343,25 +3394,9 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (!player->kartstuff[k_itemamount] && !player->kartstuff[k_itemheld]) player->kartstuff[k_itemtype] = KITEM_NONE; - // Sneaker Boost - if (((player->kartstuff[k_sneakertimer] > 0 && player->kartstuff[k_boosting] == 0) - || (player->kartstuff[k_sneakertimer] > 0 && ATTACK_IS_DOWN && NO_HYUDORO)) && onground) - { - player->kartstuff[k_boosting] = 1; - } - else if (player->kartstuff[k_sneakertimer] == 0 && player->kartstuff[k_boosting] == 1) - player->kartstuff[k_boosting] = 0; - // Grow - Make the player grow! /*if (player->kartstuff[k_growshrinktimer] > 1) player->mo->destscale = (mapheaderinfo[gamemap-1]->mobj_scale)*3/2;*/ - - if (G_BattleGametype() - && (player->kartstuff[k_itemtype] == KITEM_INVINCIBILITY - || player->kartstuff[k_itemtype] == KITEM_GROW - || player->kartstuff[k_invincibilitytimer] - || player->kartstuff[k_growshrinktimer] > 0)) - player->kartstuff[k_poweritemtimer] = 10*TICRATE; if (player->kartstuff[k_itemtype] == KITEM_SPB || player->kartstuff[k_itemtype] == KITEM_SHRINK diff --git a/src/k_kart.h b/src/k_kart.h index 32dbbbd6..1728740e 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -11,6 +11,7 @@ UINT8 colortranslations[MAXSKINCOLORS][16]; extern const char *KartColor_Names[MAXSKINCOLORS]; +extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2]; void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor); void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color); UINT8 K_GetKartColorByName(const char *name); diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 96d50b77..50a194c8 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -16,6 +16,7 @@ #include "tables.h" #include "p_local.h" #include "doomstat.h" // for ALL7EMERALDS +#include "k_kart.h" // KartColor_Opposite #include "lua_script.h" #include "lua_libs.h" @@ -191,8 +192,8 @@ static int lib_coloropposite(lua_State *L) UINT8 colornum = (UINT8)luaL_checkinteger(L, 1); if (colornum >= MAXSKINCOLORS) return luaL_error(L, "skincolor %d out of range (0 - %d).", colornum, MAXSKINCOLORS-1); - lua_pushinteger(L, Color_Opposite[colornum*2]); // push color - lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame + lua_pushinteger(L, KartColor_Opposite[colornum*2]); // push color + lua_pushinteger(L, KartColor_Opposite[colornum*2+1]); // push frame return 2; } diff --git a/src/p_enemy.c b/src/p_enemy.c index 08aeabcd..228c2dec 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4043,8 +4043,8 @@ void A_SignPlayer(mobj_t *actor) return; // Set the sign to be an appropriate background color for this player's skincolor. - actor->color = Color_Opposite[actor->target->player->skincolor*2]; - actor->frame += Color_Opposite[actor->target->player->skincolor*2+1]; + actor->color = KartColor_Opposite[actor->target->player->skincolor*2]; + actor->frame += KartColor_Opposite[actor->target->player->skincolor*2+1]; // spawn an overlay of the player's face. ov = P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY); diff --git a/src/p_inter.c b/src/p_inter.c index 9a07e933..aac513b1 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -429,6 +429,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; if (player->kartstuff[k_balloon] <= 0) return; + if (special->target->player->exiting || player->exiting) + return; if (special->target->player->kartstuff[k_comebacktimer] || special->target->player->kartstuff[k_spinouttimer] @@ -3184,8 +3186,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da //{ SRB2kart - special damage sources - player->kartstuff[k_sneakertimer] = 0; - // Shrink if (damage == 64) { @@ -3222,6 +3222,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da { player->kartstuff[k_growshrinktimer] = 2; } + player->kartstuff[k_sneakertimer] = 0; // Invincible or not, we still need this. //P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_LIGHTNING); S_StartSound(player->mo, sfx_kc59); @@ -3271,6 +3272,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da || inflictor->type == MT_FAKEITEM || inflictor->type == MT_FAKESHIELD || inflictor->player)) { + player->kartstuff[k_sneakertimer] = 0; player->kartstuff[k_spinouttype] = 1; K_SpinPlayer(player, source); damage = player->mo->health - 1; diff --git a/src/p_map.c b/src/p_map.c index e6c07afa..01a16242 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3137,11 +3137,11 @@ static void P_HitSlideLine(line_t *ld) } // -// P_HitBounceLine +// P_PlayerHitBounceLine // -// Adjusts the xmove / ymove so that the next move will bounce off the wall. +// HitBounceLine, for players // -static void P_HitBounceLine(line_t *ld) +static void P_PlayerHitBounceLine(line_t *ld) { INT32 side; angle_t lineangle; @@ -3164,6 +3164,47 @@ static void P_HitBounceLine(line_t *ld) tmymove += FixedMul(movelen, FINESINE(lineangle)); } +// +// P_HitBounceLine +// +// Adjusts the xmove / ymove so that the next move will bounce off the wall. +// +static void P_HitBounceLine(line_t *ld) +{ + angle_t lineangle, moveangle, deltaangle; + fixed_t movelen; + + if (ld->slopetype == ST_HORIZONTAL) + { + tmymove = -tmymove; + return; + } + + if (ld->slopetype == ST_VERTICAL) + { + tmxmove = -tmxmove; + return; + } + + lineangle = R_PointToAngle2(0, 0, ld->dx, ld->dy); + + if (lineangle >= ANGLE_180) + lineangle -= ANGLE_180; + + moveangle = R_PointToAngle2(0, 0, tmxmove, tmymove); + deltaangle = moveangle + 2*(lineangle - moveangle); + + lineangle >>= ANGLETOFINESHIFT; + deltaangle >>= ANGLETOFINESHIFT; + + movelen = P_AproxDistance(tmxmove, tmymove); + + tmxmove = FixedMul(movelen, FINECOSINE(deltaangle)); + tmymove = FixedMul(movelen, FINESINE(deltaangle)); + + deltaangle = R_PointToAngle2(0, 0, tmxmove, tmymove); +} + // // PTR_SlideCameraTraverse // @@ -3782,18 +3823,20 @@ stairstep: } // -// P_BounceMove +// P_PlayerBounceMove // -// The momx / momy move is bad, so try to bounce off a wall. +// Bounce move, for players. // -void P_BounceMove(mobj_t *mo) + +void P_PlayerBounceMove(mobj_t *mo) { fixed_t leadx, leady; fixed_t trailx, traily; - //fixed_t newx, newy; - //INT32 hitcount; fixed_t mmomx = 0, mmomy = 0; + if (!mo->player) + return; + if (mo->eflags & MFE_JUSTBOUNCEDWALL) { P_SlideMove(mo, true); @@ -3801,22 +3844,14 @@ void P_BounceMove(mobj_t *mo) } slidemo = mo; - //hitcount = 0; -/*retry: - if (++hitcount == 3) - goto bounceback; // don't loop forever*/ + mmomx = mo->player->rmomx; + mmomy = mo->player->rmomy; - if (mo->player) + if (mo->player->kartstuff[k_drift] != 0) // SRB2kart { - mmomx = mo->player->rmomx; - mmomy = mo->player->rmomy; - - if (mo->player->kartstuff[k_drift] != 0) // SRB2kart - { - mo->player->kartstuff[k_drift] = 0; - mo->player->kartstuff[k_driftcharge] = 0; - } + mo->player->kartstuff[k_drift] = 0; + mo->player->kartstuff[k_driftcharge] = 0; } else { @@ -3853,8 +3888,107 @@ void P_BounceMove(mobj_t *mo) P_PathTraverse(trailx, leady, trailx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse); P_PathTraverse(leadx, traily, leadx + mmomx, traily + mmomy, PT_ADDLINES, PTR_SlideTraverse); + // Now continue along the wall. + // First calculate remainder. + bestslidefrac = FRACUNIT - bestslidefrac; + + if (bestslidefrac > FRACUNIT) + bestslidefrac = FRACUNIT; + + if (bestslidefrac <= 0) + return; + + tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); + tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); + + { + mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP); + if (mo->eflags & MFE_VERTICALFLIP) + fx->eflags |= MFE_VERTICALFLIP; + else + fx->eflags &= ~MFE_VERTICALFLIP; + fx->scale = mo->scale; + + S_StartSound(mo, sfx_s3k49); + } + + P_PlayerHitBounceLine(bestslideline); + mo->eflags |= MFE_JUSTBOUNCEDWALL; + + mo->momx = tmxmove; + mo->momy = tmymove; + mo->player->cmomx = tmxmove; + mo->player->cmomy = tmymove; + + P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true); +} + +// +// P_BounceMove +// +// The momx / momy move is bad, so try to bounce off a wall. +// +void P_BounceMove(mobj_t *mo) +{ + fixed_t leadx, leady; + fixed_t trailx, traily; + fixed_t newx, newy; + INT32 hitcount; + fixed_t mmomx = 0, mmomy = 0; + + if (mo->eflags & MFE_JUSTBOUNCEDWALL) + { + P_SlideMove(mo, true); + return; + } + + if (mo->player) + { + P_PlayerBounceMove(mo); + return; + } + + slidemo = mo; + hitcount = 0; + +retry: + if (++hitcount == 3) + goto bounceback; // don't loop forever + + mmomx = mo->momx; + mmomy = mo->momy; + + // trace along the three leading corners + if (mo->momx > 0) + { + leadx = mo->x + mo->radius; + trailx = mo->x - mo->radius; + } + else + { + leadx = mo->x - mo->radius; + trailx = mo->x + mo->radius; + } + + if (mo->momy > 0) + { + leady = mo->y + mo->radius; + traily = mo->y - mo->radius; + } + else + { + leady = mo->y - mo->radius; + traily = mo->y + mo->radius; + } + + bestslidefrac = FRACUNIT + 1; + + P_PathTraverse(leadx, leady, leadx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse); + P_PathTraverse(trailx, leady, trailx + mmomx, leady + mmomy, PT_ADDLINES, PTR_SlideTraverse); + P_PathTraverse(leadx, traily, leadx + mmomx, traily + mmomy, PT_ADDLINES, PTR_SlideTraverse); + // move up to the wall - /*if (bestslidefrac == FRACUNIT + 1) + if (bestslidefrac == FRACUNIT + 1) { // the move must have hit the middle, so bounce straight back bounceback: @@ -3864,22 +3998,12 @@ bounceback: mo->momy *= -1; mo->momx = FixedMul(mo->momx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); mo->momy = FixedMul(mo->momy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); - - if (mo->player) - { - mo->player->cmomx *= -1; - mo->player->cmomy *= -1; - mo->player->cmomx = FixedMul(mo->player->cmomx, - (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); - mo->player->cmomy = FixedMul(mo->player->cmomy, - (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); - } } return; - }*/ + } // fudge a bit to make sure it doesn't hit - /*bestslidefrac -= 0x800; + bestslidefrac -= 0x800; if (bestslidefrac > 0) { newx = FixedMul(mmomx, bestslidefrac); @@ -3887,7 +4011,7 @@ bounceback: if (!P_TryMove(mo, mo->x + newx, mo->y + newy, true)) goto bounceback; - }*/ + } // Now continue along the wall. // First calculate remainder. @@ -3919,34 +4043,15 @@ bounceback: { tmxmove = FixedMul(mmomx, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); tmymove = FixedMul(mmomy, (FRACUNIT - (FRACUNIT>>2) - (FRACUNIT>>3))); - if (mo->player) - { - mobj_t *fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP); - if (mo->eflags & MFE_VERTICALFLIP) - fx->eflags |= MFE_VERTICALFLIP; - else - fx->eflags &= ~MFE_VERTICALFLIP; - fx->scale = mo->scale; - - S_StartSound(mo, sfx_s3k49); - } } - P_HitBounceLine(bestslideline); - mo->eflags |= MFE_JUSTBOUNCEDWALL; + P_HitBounceLine(bestslideline); // clip the moves mo->momx = tmxmove; mo->momy = tmymove; - if (mo->player) - { - mo->player->cmomx = tmxmove; - mo->player->cmomy = tmymove; - } - - /*if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) - goto retry;*/ - P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true); + if (!P_TryMove(mo, mo->x + tmxmove, mo->y + tmymove, true)) + goto retry; } // diff --git a/src/p_mobj.c b/src/p_mobj.c index e6255d07..55c5c5ff 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2907,7 +2907,7 @@ static void P_PlayerZMovement(mobj_t *mo) mo->tics = -1; } else if ((mo->player->pflags & PF_JUMPED || (mo->player->pflags & (PF_SPINNING|PF_USEDOWN)) != (PF_SPINNING|PF_USEDOWN) - || mo->player->powers[pw_tailsfly]) && (mo->player->kartstuff[k_spinouttimer] == 0)) // SRB2kart + || mo->player->powers[pw_tailsfly]) && (mo->player->kartstuff[k_spinouttimer] == 0)) // SRB2kart { K_KartMoveAnimation(mo->player); } @@ -9907,7 +9907,7 @@ void P_SpawnPlayer(INT32 playernum) fixed_t newy; mobj_t *mo; - if (leveltime < 1 /*|| pcount <= 1*/) // Start of the map? + if (leveltime < 1 && !p->spectator /*|| pcount <= 1*/) // Start of the map? p->kartstuff[k_balloon] = cv_kartballoons.value; // Reset those balloons! if (p->kartstuff[k_balloon] <= 1) diff --git a/src/p_spec.c b/src/p_spec.c index 37797a9c..474c73bf 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3753,7 +3753,7 @@ DoneSection2: // Process Section 3 switch (special) { - case 1: // SRB2kart: bounce pad + case 1: // SRB2kart: Speed Bumps if (roversector || P_MobjReadyToTrigger(player->mo, sector)) { if (player->mo->eflags & MFE_SPRUNG) diff --git a/src/p_user.c b/src/p_user.c index a3d5bfdd..901ad958 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4015,7 +4015,6 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // SRB2kart - unused. // void P_DoJumpShield(player_t *player) { - return; // SRB2kart - Would be useful for feathers, but those are impossible to balance, so nuts to it. if (player->pflags & PF_THOKKED) return; @@ -4707,6 +4706,8 @@ static void P_3dMovement(player_t *player) if (player->exiting || player->pflags & PF_STASIS || player->kartstuff[k_spinouttimer]) // pw_introcam? { cmd->forwardmove = cmd->sidemove = 0; + if (player->kartstuff[k_sneakertimer]) + cmd->forwardmove = 50; if (player->pflags & PF_GLIDING) { if (!player->skidtime) @@ -4797,7 +4798,7 @@ static void P_3dMovement(player_t *player) cmd->forwardmove = 0; // Do not let the player control movement if not onground. - // SRB2Kart: feather and speed bumps are supposed to control like you're on the ground + // 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])); player->aiming = cmd->aiming<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); @@ -4834,7 +4844,7 @@ static void P_3dMovement(player_t *player) } // Sideways movement - if (cmd->sidemove != 0 && !(player->exiting || (P_PlayerInPain(player)))) + if (cmd->sidemove != 0 && !(player->exiting || player->kartstuff[k_spinouttimer])) { if (cmd->sidemove > 0) movepushside = (cmd->sidemove * FRACUNIT/128) + FixedDiv(player->speed, K_GetKartSpeed(player, true)); @@ -6543,23 +6553,6 @@ static void P_MovePlayer(player_t *player) // MOVEMENT CODE // ////////////////////// - //{ SRB2kart slip net - - if (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinout] == 0) - { - K_SpinPlayer(player, NULL); // Here just for in-level oil spills now - } - // If you have one but not the other, we should get rid of the one we have - else if (player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_spinout] > 0) - player->kartstuff[k_spinout] = 0; - - // If somehow the power has gotten larger than the timer, it should be lowered back to it - if (player->kartstuff[k_spinouttimer] > player->kartstuff[k_spinout]) - player->kartstuff[k_spinouttimer] = player->kartstuff[k_spinout]; - - //} - - if (twodlevel || player->mo->flags2 & MF2_TWOD) // 2d-level, so special control applies. P_2dMovement(player); else diff --git a/src/r_draw.c b/src/r_draw.c index 5703f781..2e651ae3 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -175,7 +175,6 @@ const char *Color_Names[MAXSKINCOLORS] = "Yellow", // SKINCOLOR_YELLOW "Gold" // SKINCOLOR_GOLD }; -*/ const UINT8 Color_Opposite[MAXSKINCOLORS*2] = { @@ -206,6 +205,7 @@ const UINT8 Color_Opposite[MAXSKINCOLORS*2] = SKINCOLOR_NONE,8, // SKINCOLOR_YELLOW SKINCOLOR_NONE,8 // SKINCOLOR_GOLD }; +*/ CV_PossibleValue_t Color_cons_t[MAXSKINCOLORS+1];