From 7b7a6e54586d9c1967d9b7ff2e3bd21eeafe73d4 Mon Sep 17 00:00:00 2001 From: ZTsukei Date: Sun, 19 Feb 2017 12:18:43 -0500 Subject: [PATCH] Added fancypants mega shroom, fixed drift boosting --- src/d_player.h | 6 ++- src/doomdef.h | 10 ++--- src/g_game.c | 3 +- src/k_kart.c | 118 +++++++++++++++++++++++++++++++++++++------------ src/m_menu.c | 4 +- src/p_inter.c | 1 + src/p_map.c | 22 ++++++++- src/p_spec.c | 2 +- src/p_user.c | 42 +++++++++++++++--- 9 files changed, 161 insertions(+), 47 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index fc9865f5..b4e4dffc 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -245,15 +245,17 @@ typedef enum k_throwdir, // Held dir of controls; 1 = forward, 0 = none, -1 = backward (was "player->heldDir") k_turndir, // Turn direction for drifting; -1 = Left, 1 = Right, 0 = none - k_sounds, // Used this to avoid sounds being played every tic + k_sounds, // Used this to stop and then force music restores as it hits zero - k_boosting, // Determines if you're currently shroom-boosting to change how drifting works + k_boosting, // Determines if you're currently shroom-boosting k_floorboost, // Prevents Mushroom 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 k_driftcharge, // Charge your drift so you can release a burst of speed + k_driftboost, // Boost you get from drifting + //k_driftboosting, // Similar to k_boosting, determines if you're currently drift boosting k_boostcharge, // Charge-up for boosting at the start of the race, or when Lakitu drops you k_jmp, // In Mario Kart, letting go of the jump button stops the drift k_lakitu, // > 0 = Lakitu fishing, < 0 = Lakitu lap counter (was "player->airtime") // NOTE: Check for ->lakitu, replace with this diff --git a/src/doomdef.h b/src/doomdef.h index 35af7a0a..71ab0885 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -143,16 +143,16 @@ extern FILE *logstream; #define DEVELOP // Disable this for release builds to remove excessive cheat commands and enable MD5 checking and stuff, all in one go. :3 #ifdef DEVELOP #define VERSION 100 // Game version -#define SUBVERSION 4 // more precise version number +#define SUBVERSION 5 // more precise version number #define VERSIONSTRING "Development EXE" -#define VERSIONSTRINGW L"Development EXE" +#define VERSIONSTRINGW "v1.0.05" // most interface strings are ignored in development mode. // we use comprevision and compbranch instead. #else #define VERSION 100 // Game version -#define SUBVERSION 4 // more precise version number -#define VERSIONSTRING "v1.0.04" -#define VERSIONSTRINGW L"v1.0.04" +#define SUBVERSION 5 // more precise version number +#define VERSIONSTRING "v1.0.05" +#define VERSIONSTRINGW L"v1.0.05" // Hey! If you change this, add 1 to the MODVERSION below! // Otherwise we can't force updates! #endif diff --git a/src/g_game.c b/src/g_game.c index 78a02f4f..20863cee 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1277,7 +1277,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) cmd->angleturn = FixedMul(cmd->angleturn, FixedDiv(80 - (players[consoleplayer].speed >> 16), 80)); - if (players[consoleplayer].kartstuff[k_startimer] || players[consoleplayer].kartstuff[k_mushroomtimer] || players[consoleplayer].kartstuff[k_growshrinktimer] > 0) + if (players[consoleplayer].kartstuff[k_startimer] || players[consoleplayer].kartstuff[k_mushroomtimer] + || players[consoleplayer].kartstuff[k_growshrinktimer] > 0) cmd->angleturn = FixedMul(cmd->angleturn, FixedDiv(5*FRACUNIT, 4*FRACUNIT)); localangle += (cmd->angleturn<kartweight; + fixed_t offroad; sector_t *nextsector = R_PointInSubsector( player->mo->x + player->mo->momx*2, player->mo->y + player->mo->momy*2)->sector; @@ -917,7 +918,12 @@ void K_UpdateOffroad(player_t *player) // 1872 is the magic number - 35 frames adds up to approximately 65536. 1872/4 = 468/3 = 156 // A higher kart weight means you can stay offroad for longer without losing speed - player->kartstuff[k_offroad] += (1872 + 5*156 - kartweight*156); + offroad = (1872 + 5*156 - kartweight*156); + + if (player->kartstuff[k_growshrinktimer] > 1) // megashroom slows down half as fast + offroad /= 2; + + player->kartstuff[k_offroad] += offroad; } if (player->kartstuff[k_offroad] > FRACUNIT) @@ -964,6 +970,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_floorboost]) player->kartstuff[k_floorboost]--; + if (player->kartstuff[k_driftboost]) + player->kartstuff[k_driftboost]--; + if (player->kartstuff[k_startimer]) player->kartstuff[k_startimer]--; @@ -1002,11 +1011,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_sounds]) player->kartstuff[k_sounds]--; - // Restores music if too many sounds are playing (?) - //if (player->kartstuff[k_sounds] >= 1 && player->kartstuff[k_sounds] < 120) - // player->kartstuff[k_sounds] += 1; - //if (player->kartstuff[k_sounds] < 120 && player->kartstuff[k_sounds] > 116) //&& P_IsLocalPlayer(player)) - // P_RestoreMusic(player); + // Restores music automatically for the final lap, among other things + if (player->kartstuff[k_sounds] <= 4 && player->kartstuff[k_sounds] > 0 && P_IsLocalPlayer(player)) + P_RestoreMusic(player); // ??? /* @@ -1076,22 +1083,49 @@ void K_PlayTauntSound(mobj_t *source) fixed_t K_GetKartBoostPower(player_t *player) { fixed_t boostpower = FRACUNIT; + fixed_t boostvalue = 0; + fixed_t numboosts = 0; - if (!(player->kartstuff[k_startimer] || player->kartstuff[k_bootaketimer] || player->kartstuff[k_mushroomtimer] || player->kartstuff[k_growshrinktimer] > 1) + // Offroad is separate, it's difficult to factor it in with a variable value anyway. + if (!(player->kartstuff[k_startimer] || player->kartstuff[k_bootaketimer] || player->kartstuff[k_mushroomtimer]) && player->kartstuff[k_offroad] >= 0) boostpower = FixedDiv(boostpower, player->kartstuff[k_offroad] + FRACUNIT); - if (player->kartstuff[k_growshrinktimer] < -1) - boostpower = FixedMul(boostpower, 6*FRACUNIT/8); // Shrink - if (player->kartstuff[k_squishedtimer] > 0) - boostpower = FixedMul(boostpower, 7*FRACUNIT/8); // Squished - if (player->powers[pw_sneakers]) - boostpower = FixedMul(boostpower, 10*FRACUNIT/8); // Slide Boost - if (player->kartstuff[k_growshrinktimer] > 1) - boostpower = FixedMul(boostpower, 10*FRACUNIT/8); // Mega Mushroom - if (player->kartstuff[k_startimer]) - boostpower = FixedMul(boostpower, 11*FRACUNIT/8); // Star - if (player->kartstuff[k_mushroomtimer]) - boostpower = FixedMul(boostpower, 12*FRACUNIT/8); // Mushroom + + if (player->kartstuff[k_growshrinktimer] < -1) // Shrink + { + boostvalue += 6; // 6/8 speed (*0.750) + numboosts++; + } + if (player->kartstuff[k_squishedtimer] > 0) // Squished + { + boostvalue += 7; // 7/8 speed (*0.875) + numboosts++; + } + if (player->kartstuff[k_growshrinktimer] > 1) // Mega Mushroom + { + boostvalue += 10; // 10/8 speed (*1.250) + numboosts++; + } + if (player->kartstuff[k_startimer]) // Star + { + boostvalue += 11; // 11/8 speed (*1.375) + numboosts++; + } + if (player->kartstuff[k_driftboost]) // Drift Boost + { + boostvalue += 12; // 12/8 speed (*1.500) + numboosts++; + } + if (player->kartstuff[k_mushroomtimer]) // Mushroom + { + boostvalue += 14; // 14/8 speed (*1.750) + numboosts++; + } + if (numboosts) // If any of the above apply... + { + boostvalue = (boostvalue*2)/numboosts; // Doubled to avoid .5's + boostpower = FixedMul(boostpower, boostvalue*FRACUNIT/16); + } return boostpower; } @@ -1122,7 +1156,7 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, boolean forwardmove fixed_t p_accel = K_GetKartAccel(player); // ACCELCODE!!!1!11! - oldspeed = FixedMul(P_AproxDistance(player->rmomx, player->rmomy), player->mo->scale); + oldspeed = P_AproxDistance(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); finalspeed = newspeed - oldspeed; @@ -1144,6 +1178,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source) return; player->kartstuff[k_mushroomtimer] = 0; + player->kartstuff[k_driftboost] = 0; if (player->kartstuff[k_spinouttype] <= 0) { @@ -1182,6 +1217,7 @@ void K_SquishPlayer(player_t *player, mobj_t *source) return; player->kartstuff[k_mushroomtimer] = 0; + player->kartstuff[k_driftboost] = 0; player->kartstuff[k_squishedtimer] = 2*TICRATE; @@ -1210,6 +1246,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju player->mo->momx = player->mo->momy = 0; player->kartstuff[k_mushroomtimer] = 0; + player->kartstuff[k_driftboost] = 0; player->kartstuff[k_spinouttype] = 1; player->kartstuff[k_spinouttimer] = 2*TICRATE+(TICRATE/2); @@ -1688,7 +1725,7 @@ void K_DoMushroom(player_t *player, boolean doPFlag) return; //K_PlayTauntSound(player->mo); - player->kartstuff[k_sounds] = 70; + player->kartstuff[k_sounds] = 50; } void K_DoLightning(player_t *player, boolean bluelightning) @@ -1711,7 +1748,7 @@ void K_DoLightning(player_t *player, boolean bluelightning) return; K_PlayTauntSound(player->mo); - player->kartstuff[k_sounds] = 70; + player->kartstuff[k_sounds] = 50; } void K_KartDrift(player_t *player, ticcmd_t *cmd, boolean onground) @@ -1739,7 +1776,7 @@ void K_KartDrift(player_t *player, ticcmd_t *cmd, boolean onground) && (player->kartstuff[k_driftcharge] >= 30 && player->kartstuff[k_driftcharge] < 60) && onground) { - player->powers[pw_sneakers] += 17; + player->kartstuff[k_driftboost] = 20; S_StartSound(player->mo, sfx_mush); player->kartstuff[k_drift] = 0; player->kartstuff[k_driftcharge] = 0; @@ -1749,7 +1786,7 @@ void K_KartDrift(player_t *player, ticcmd_t *cmd, boolean onground) && player->kartstuff[k_driftcharge] >= 60 && onground) { - player->powers[pw_sneakers] += 35; + player->kartstuff[k_driftboost] = 40; S_StartSound(player->mo, sfx_mush); player->kartstuff[k_drift] = 0; player->kartstuff[k_driftcharge] = 0; @@ -2328,9 +2365,8 @@ void K_MoveKartPlayer(player_t *player, ticcmd_t *cmd, boolean onground) S_ChangeMusicInternal("mega", true); if (!P_IsLocalPlayer(player)) S_StartSound(player->mo, sfx_mega); - K_PlayTauntSound(player->mo); - player->kartstuff[k_growshrinktimer] = bonustime; - player->mo->destscale = FRACUNIT*3/2; + //K_PlayTauntSound(player->mo); + player->kartstuff[k_growshrinktimer] = bonustime/2; S_StartSound(player->mo, sfx_mario3); player->pflags |= PF_ATTACKDOWN; player->kartstuff[k_megashroom] = 0; @@ -2351,6 +2387,7 @@ void K_MoveKartPlayer(player_t *player, ticcmd_t *cmd, boolean onground) player->kartstuff[k_magnet] = 0; } + // Mushroom Boost if (player->kartstuff[k_mushroomtimer] > 0 && player->kartstuff[k_boosting] == 0 && onground) { cmd->forwardmove = 1; @@ -2365,6 +2402,29 @@ void K_MoveKartPlayer(player_t *player, ticcmd_t *cmd, boolean onground) else if (player->kartstuff[k_mushroomtimer] == 0 && player->kartstuff[k_boosting] == 1) player->kartstuff[k_boosting] = 0; + // Megashroom - Make the player grow! + if (player->kartstuff[k_growshrinktimer] > (bonustime/2 - 25)) + { + if (leveltime & 2) + player->mo->destscale = FRACUNIT*3/2; + else + player->mo->destscale = FRACUNIT; + } + else if (player->kartstuff[k_growshrinktimer] > 26 + && player->kartstuff[k_growshrinktimer] <= (bonustime/2 - 25)) + player->mo->destscale = FRACUNIT*3/2; + // Megashroom - Back to normal... + else if (player->kartstuff[k_growshrinktimer] > 1 + && player->kartstuff[k_growshrinktimer] <= 26) + { + if (leveltime & 2) + player->mo->destscale = FRACUNIT; + else + player->mo->destscale = FRACUNIT*3/2; + } + if (player->kartstuff[k_growshrinktimer] == 26) + S_StartSound(player->mo, sfx_mario8); + if (player->kartstuff[k_bootaketimer] > 0) { if ((player == &players[displayplayer] || (splitscreen && player == &players[secondarydisplayplayer])) diff --git a/src/m_menu.c b/src/m_menu.c index 71e0d65c..ebbdca78 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2472,8 +2472,8 @@ void M_Drawer(void) else { #ifdef DEVELOP // Development -- show revision / branch info - V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, compbranch); - V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, comprevision); + V_DrawThinString(vid.dupx, vid.height - 17*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, "KART DEV EXE"); + V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRINGW)); #else // Regular build V_DrawThinString(vid.dupx, vid.height - 9*vid.dupy, V_NOSCALESTART|V_TRANSLUCENT|V_ALLOWLOWERCASE, va("%s", VERSIONSTRING)); #endif diff --git a/src/p_inter.c b/src/p_inter.c index a37c66dd..4a4268f0 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3181,6 +3181,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da damage = player->mo->health - 1; P_RingDamage(player, inflictor, source, damage); player->mo->momx = player->mo->momy = 0; + return true; } /* // SRB2kart - don't need these else if (metalrecording) diff --git a/src/p_map.c b/src/p_map.c index 26a779ab..8b11ba0d 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1332,13 +1332,13 @@ static boolean PIT_CheckThing(mobj_t *thing) } // check for special pickup - if (thing->flags & MF_SPECIAL && tmthing->player) + if (thing->flags & MF_SPECIAL && tmthing->player && thing->type != MT_POKEY) { P_TouchSpecialThing(thing, tmthing, true); // can remove thing return true; } // check again for special pickup - if (tmthing->flags & MF_SPECIAL && thing->player) + if (tmthing->flags & MF_SPECIAL && thing->player && tmthing->type != MT_POKEY) { P_TouchSpecialThing(tmthing, thing, true); // can remove thing return true; @@ -1394,6 +1394,24 @@ static boolean PIT_CheckThing(mobj_t *thing) // Make sure they aren't able to damage you ANYWHERE along the Z axis, you have to be TOUCHING the person. && !(thing->z + thing->height < tmthing->z || thing->z > tmthing->z + tmthing->height)) { + // SRB2kart - Squish! + if ((tmthing->player->kartstuff[k_growshrinktimer] > 0 && thing->player->kartstuff[k_growshrinktimer] <= 0) + || (tmthing->player->kartstuff[k_growshrinktimer] == 0 && thing->player->kartstuff[k_growshrinktimer] < 0)) + { + K_SquishPlayer(thing->player, tmthing); + } + else if ((thing->player->kartstuff[k_growshrinktimer] > 0 && tmthing->player->kartstuff[k_growshrinktimer] <= 0) + || (thing->player->kartstuff[k_growshrinktimer] == 0 && tmthing->player->kartstuff[k_growshrinktimer] < 0)) + { + K_SquishPlayer(tmthing->player, thing); + } + + // SRB2kart - Starpower! + if (tmthing->player->kartstuff[k_startimer] && !thing->player->kartstuff[k_startimer]) + P_DamageMobj(thing, tmthing, tmthing, 1); + else if (thing->player->kartstuff[k_startimer] && !tmthing->player->kartstuff[k_startimer]) + P_DamageMobj(tmthing, thing, thing, 1); + if (G_RingSlingerGametype() && (!G_GametypeHasTeams() || tmthing->player->ctfteam != thing->player->ctfteam)) { if ((tmthing->player->powers[pw_invulnerability] || tmthing->player->powers[pw_super]) diff --git a/src/p_spec.c b/src/p_spec.c index 4050ffdf..00be73a2 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4116,7 +4116,7 @@ DoneSection2: if (!splitscreen || (splitscreen && !players[consoleplayer].exiting && !players[secondarydisplayplayer].exiting)) { - //player->powers[pw_sounds] = 1; + player->kartstuff[k_sounds] = 130; S_ChangeMusicInternal("finlap", false); } } diff --git a/src/p_user.c b/src/p_user.c index 5b29dc25..67a0d60a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -812,7 +812,8 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) if (inflictor) { - ang = R_PointToAngle2(inflictor->x-inflictor->momx, inflictor->y - inflictor->momy, player->mo->x - player->mo->momx, player->mo->y - player->mo->momy); + ang = R_PointToAngle2(inflictor->x, inflictor->y, player->mo->x, player->mo->y); // SRB2kart + //ang = R_PointToAngle2(inflictor->x-inflictor->momx, inflictor->y - inflictor->momy, player->mo->x - player->mo->momx, player->mo->y - player->mo->momy); // explosion and rail rings send you farther back, making it more difficult // to recover @@ -1121,6 +1122,32 @@ void P_RestoreMusic(player_t *player) if (player->powers[pw_extralife] > 1) return; S_SpeedMusic(1.0f); + + if (player->kartstuff[k_sounds] >= 5) // SRB2kart - Don't reset music during the final lap roll! + return; + + // SRB2kart - We have some different powers than vanilla, some of which tweak the music. + if (!player->exiting) + { + // Item - Mega Mushroom + if (player->kartstuff[k_growshrinktimer] > 1) + S_ChangeMusicInternal("mega", true); + + // Item - Star + else if (player->kartstuff[k_startimer] > 1) + S_ChangeMusicInternal("minvnc", false); + + // Event - Final Lap + else if (player->laps == (UINT8)(cv_numlaps.value - 1)) + { + S_SpeedMusic(1.2f); + S_ChangeMusic(mapmusname, mapmusflags, true); + } + else + S_ChangeMusic(mapmusname, mapmusflags, true); + } + + /* SRB2kart - old stuff if (player->powers[pw_super] && !(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) S_ChangeMusicInternal("supers", true); else if (player->powers[pw_invulnerability] > 1) @@ -1137,6 +1164,7 @@ void P_RestoreMusic(player_t *player) } else S_ChangeMusic(mapmusname, mapmusflags, true); + */ } // @@ -2022,8 +2050,8 @@ static void P_CheckSneakerAndLivesTimer(player_t *player) if (player->powers[pw_extralife] == 1) // Extra Life! P_RestoreMusic(player); - if (player->powers[pw_sneakers] == 1) - P_RestoreMusic(player); + //if (player->powers[pw_sneakers] == 1) // SRB2kart + // P_RestoreMusic(player); } // @@ -9170,7 +9198,9 @@ void P_PlayerThink(player_t *player) #if 1 // "Blur" a bit when you have speed shoes and are going fast enough - if ((player->powers[pw_super] || player->powers[pw_sneakers]) && (player->speed + abs(player->mo->momz)) > FixedMul(20*FRACUNIT,player->mo->scale)) + if ((player->powers[pw_super] || player->powers[pw_sneakers] + || player->kartstuff[k_driftboost] || player->kartstuff[k_mushroomtimer]) // SRB2kart + && (player->speed + abs(player->mo->momz)) > FixedMul(20*FRACUNIT,player->mo->scale)) { mobj_t *gmobj = P_SpawnGhostMobj(player->mo); gmobj->fuse = 2; @@ -9309,7 +9339,9 @@ void P_PlayerThink(player_t *player) // Flash player after being hit. if (!(player->pflags & PF_NIGHTSMODE)) { - if (player->kartstuff[k_bootaketimer] == 0) // SRB2kart - fixes boo not flashing when it should + // SRB2kart - fixes boo not flashing when it should. Mega doesn't flash either. Flashing is local. + if ((player == &players[displayplayer] || (splitscreen && player == &players[secondarydisplayplayer])) + && player->kartstuff[k_bootaketimer] == 0 && player->kartstuff[k_growshrinktimer] <= 0) { if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1)) player->mo->flags2 |= MF2_DONTDRAW;