From c5920b431f1cbade2828f4509cce7e17e6a4adea Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 10 Nov 2017 21:10:01 -0500 Subject: [PATCH] Lots of misc stuff - Bomb overlay is invisible during comeback timer, and flickers back in when it's almost up - Show comeback timer on HUD - Feather is stronger & has more gravity - Option to use SMK star alarm instead of overlapping music - Using P_MobjDamage normally on players now defaults to normal spinout instead of shell's instant stop - Some general gametype case fixes (most notably, being able to spin people out in Race using a mushroom) --- src/d_netcmd.c | 2 ++ src/d_netcmd.h | 1 + src/k_kart.c | 33 +++++++++++++++++++++++---------- src/p_inter.c | 25 ++++++++++++++++--------- src/p_map.c | 25 +++++++++++++++---------- src/p_mobj.c | 2 ++ src/p_user.c | 2 +- src/sounds.c | 11 ++++++----- src/sounds.h | 1 + 9 files changed, 67 insertions(+), 35 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ee26c09a..345e8193 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -317,6 +317,8 @@ consvar_t cv_feather = {"feathers", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NU consvar_t cv_karthud = {"karthud", "Default", CV_SAVE|CV_CALL, karthud_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_kartcheck = {"kartcheck", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t kartstarsfx_cons_t[] = {{0, "Music"}, {1, "SMK"}, {0, NULL}}; +consvar_t cv_kartstarsfx = {"kartstarsfx", "Music", CV_SAVE, kartstarsfx_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // change default to "SMK"? consvar_t cv_kartcc = {"kartcc", "100cc", CV_NETVAR, kartcc_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t kartballoons_cons_t[] = {{1, "MIN"}, {12, "MAX"}, {0, NULL}}; consvar_t cv_kartballoons = {"kartballoons", "3", CV_NETVAR, kartballoons_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index deda42cd..8b3cb3ca 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -107,6 +107,7 @@ extern consvar_t cv_feather; extern consvar_t cv_karthud; extern consvar_t cv_kartcheck; +extern consvar_t cv_kartstarsfx; extern consvar_t cv_kartcc; extern consvar_t cv_kartballoons; extern consvar_t cv_kartfrantic; diff --git a/src/k_kart.c b/src/k_kart.c index e3d703dc..571e4d3e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -303,6 +303,7 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_feather); CV_RegisterVar(&cv_kartcheck); + CV_RegisterVar(&cv_kartstarsfx); CV_RegisterVar(&cv_kartcc); CV_RegisterVar(&cv_kartballoons); CV_RegisterVar(&cv_kartfrantic); @@ -1382,6 +1383,8 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_spinouttimer]) player->kartstuff[k_spinouttimer]--; + else if (player->kartstuff[k_comebacktimer]) + player->kartstuff[k_comebacktimer]--; if (player->kartstuff[k_spinout] == 0 && player->kartstuff[k_spinouttimer] == 0 && player->powers[pw_flashing] == flashingtics) player->powers[pw_flashing]--; @@ -1438,9 +1441,6 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_poweritemtimer]) player->kartstuff[k_poweritemtimer]--; - if (player->kartstuff[k_comebacktimer]) - player->kartstuff[k_comebacktimer]--; - if (player->kartstuff[k_lapanimation]) player->kartstuff[k_lapanimation]--; @@ -1493,6 +1493,15 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) S_StopSoundByID(player->mo, sfx_mega); // Stop it } + if (player->mo->health > 0 && (player->mo->player->kartstuff[k_startimer] > 0 + || player->mo->player->kartstuff[k_growshrinktimer] > 0)) + { + if (leveltime % 13 == 0 && !P_IsLocalPlayer(player)) + S_StartSound(player->mo, sfx_smkinv); + } + else if (S_SoundPlaying(player->mo, sfx_smkinv)) + S_StopSoundByID(player->mo, sfx_smkinv); + // Plays the music after the starting countdown. if (P_IsLocalPlayer(player) && leveltime == 158) S_ChangeMusicInternal(mapmusname, true); @@ -1652,7 +1661,7 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove fixed_t p_speed = K_GetKartSpeed(player, true); fixed_t p_accel = K_GetKartAccel(player); - if (!onground) return 0; // If the player isn't on the ground, there is no change in speed + if (!onground && !(player->kartstuff[k_feather] & 2)) return 0; // If the player isn't on the ground, there is no change in speed // ACCELCODE!!!1!11! oldspeed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); // FixedMul(P_AproxDistance(player->rmomx, player->rmomy), player->mo->scale); @@ -2920,7 +2929,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if (P_IsLocalPlayer(player) && !player->exiting) S_ChangeMusicInternal("minvnc", true); - if (!P_IsLocalPlayer(player)) + if (!cv_kartstarsfx.value && !P_IsLocalPlayer(player)) S_StartSound(player->mo, sfx_star); player->kartstuff[k_startimer] = itemtime; // Activate it K_PlayTauntSound(player->mo); @@ -3235,7 +3244,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { if (P_IsLocalPlayer(player) && !player->exiting) S_ChangeMusicInternal("mega", true); - if (!P_IsLocalPlayer(player)) + if (!cv_kartstarsfx.value && !P_IsLocalPlayer(player)) S_StartSound(player->mo, sfx_mega); K_PlayTauntSound(player->mo); player->kartstuff[k_growshrinktimer] = itemtime + TICRATE*2; @@ -3264,7 +3273,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else if (ATTACK_IS_DOWN && !HOLDING_ITEM && player->kartstuff[k_feather] & 1 && NO_BOO) { K_PlayTauntSound(player->mo); - K_DoBouncePad(player, 16<pflags |= PF_ATTACKDOWN; player->kartstuff[k_feather] |= 2; @@ -3345,10 +3354,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_comebacktimer] > 0) { - if (leveltime & 1) - player->mo->tracer->flags2 |= MF2_DONTDRAW; - else + if (player->kartstuff[k_comebacktimer] < TICRATE && (leveltime & 1)) player->mo->tracer->flags2 &= ~MF2_DONTDRAW; + else + player->mo->tracer->flags2 |= MF2_DONTDRAW; player->powers[pw_flashing] = player->kartstuff[k_comebacktimer]; } @@ -4587,6 +4596,10 @@ void K_drawKartHUD(void) // Draw the speedometer // TODO: Make a better speedometer. K_drawKartSpeedometer(); + + if (gametype != GT_RACE && !stplyr->kartstuff[k_spinouttimer] + && stplyr->kartstuff[k_balloon] <= 0 && stplyr->kartstuff[k_comebacktimer]) + V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(176), 0, va("%d", (stplyr->kartstuff[k_comebacktimer]+TICRATE)/TICRATE)); } //} diff --git a/src/p_inter.c b/src/p_inter.c index ba4c7c93..22e737ae 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3164,17 +3164,24 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da return false; else { - player->kartstuff[k_spinouttype] = 1; - K_SpinPlayer(player, source); - damage = player->mo->health - 1; - P_RingDamage(player, inflictor, source, damage); if (inflictor && (inflictor->type == MT_GREENITEM || inflictor->type == MT_REDITEM || inflictor->type == MT_REDITEMDUD)) - P_PlayerRingBurst(player, 5); - player->mo->momx = player->mo->momy = 0; - if (P_IsLocalPlayer(player)) { - quake.intensity = 32*FRACUNIT; - quake.time = 5; + player->kartstuff[k_spinouttype] = 1; + K_SpinPlayer(player, source); + damage = player->mo->health - 1; + P_RingDamage(player, inflictor, source, damage); + P_PlayerRingBurst(player, 5); + player->mo->momx = player->mo->momy = 0; + if (P_IsLocalPlayer(player)) + { + quake.intensity = 32*FRACUNIT; + quake.time = 5; + } + } + else + { + player->kartstuff[k_spinouttype] = -1; + K_SpinPlayer(player, source); } return true; } diff --git a/src/p_map.c b/src/p_map.c index dd9ce6b4..924ddf46 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1628,6 +1628,7 @@ static boolean PIT_CheckThing(mobj_t *thing) K_StealBalloon(thing->player, tmthing->player); K_ExplodePlayer(tmthing->player, thing); + P_AddPlayerScore(thing->player, 1); // 2 points instead of 1 for getting someone in comeback mode thing->player->kartstuff[k_comebackhits]++; thing->player->kartstuff[k_comebacktimer] = comebacktime * (thing->player->kartstuff[k_comebackhits]+1); @@ -1639,6 +1640,7 @@ static boolean PIT_CheckThing(mobj_t *thing) K_StealBalloon(tmthing->player, thing->player); K_ExplodePlayer(thing->player, tmthing); + P_AddPlayerScore(thing->player, 1); // 2 points instead of 1 for getting someone in comeback mode tmthing->player->kartstuff[k_comebackhits]++; tmthing->player->kartstuff[k_comebacktimer] = comebacktime * (tmthing->player->kartstuff[k_comebackhits]+1); @@ -1663,7 +1665,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (P_IsObjectOnGround(thing) && tmthing->momz < 0) { K_KartBouncing(tmthing, thing, true); - if (tmthing->player->kartstuff[k_feather] & 2) + if (gametype != GT_RACE && tmthing->player->kartstuff[k_feather] & 2) { K_StealBalloon(tmthing->player, thing->player); K_SpinPlayer(thing->player, tmthing); @@ -1672,7 +1674,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (P_IsObjectOnGround(tmthing) && thing->momz < 0) { K_KartBouncing(thing, tmthing, true); - if (thing->player->kartstuff[k_feather] & 2) + if (gametype != GT_RACE && thing->player->kartstuff[k_feather] & 2) { K_StealBalloon(thing->player, tmthing->player); K_SpinPlayer(tmthing->player, thing); @@ -1681,15 +1683,18 @@ static boolean PIT_CheckThing(mobj_t *thing) else K_KartBouncing(tmthing, thing, false); - if (thing->player->kartstuff[k_mushroomtimer] && !(tmthing->player->kartstuff[k_mushroomtimer])) + if (gametype != GT_RACE) { - K_StealBalloon(thing->player, tmthing->player); - K_SpinPlayer(tmthing->player, thing); - } - else if (tmthing->player->kartstuff[k_mushroomtimer] && !(thing->player->kartstuff[k_mushroomtimer])) - { - K_StealBalloon(tmthing->player, thing->player); - K_SpinPlayer(thing->player, tmthing); + if (thing->player->kartstuff[k_mushroomtimer] && !(tmthing->player->kartstuff[k_mushroomtimer])) + { + K_StealBalloon(thing->player, tmthing->player); + K_SpinPlayer(tmthing->player, thing); + } + else if (tmthing->player->kartstuff[k_mushroomtimer] && !(thing->player->kartstuff[k_mushroomtimer])) + { + K_StealBalloon(tmthing->player, thing->player); + K_SpinPlayer(thing->player, tmthing); + } } thing->player->kartstuff[k_justbumped] = 6; diff --git a/src/p_mobj.c b/src/p_mobj.c index 7c5fca01..9382ac00 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1331,6 +1331,8 @@ fixed_t P_GetMobjGravity(mobj_t *mo) } if (wasflip == !(mo->eflags & MFE_VERTICALFLIP)) // note!! == ! is not equivalent to != here - turns numeric into bool this way P_PlayerFlip(mo); + if (mo->player->kartstuff[k_feather] & 2) + gravityadd = FixedMul(gravityadd, 5*FRACUNIT/2); } else { diff --git a/src/p_user.c b/src/p_user.c index f08dfd3e..4dfced7d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9465,7 +9465,7 @@ void P_PlayerThink(player_t *player) // 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_bootimer] == 0 && player->kartstuff[k_growshrinktimer] <= 0 - && (player->kartstuff[k_comebacktimer] == 0 || (gametype != GT_RACE && player->kartstuff[k_balloon] > 0))) + && (player->kartstuff[k_comebacktimer] == 0 || (gametype == GT_RACE || player->kartstuff[k_balloon] > 0))) { if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < flashingtics && (leveltime & 1)) player->mo->flags2 |= MF2_DONTDRAW; diff --git a/src/sounds.c b/src/sounds.c index a968f999..22f966ee 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -498,11 +498,12 @@ sfxinfo_t S_sfx[NUMSFX] = {"mkitm7", true, 72, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"mkitm8", true, 72, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"mkitmF", true, 72, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"clash", false, 64, 8, -1, NULL, 0, -1, -1, LUMPERROR}, - {"tossed", false,150, 8, -1, NULL, 0, -1, -1, LUMPERROR}, - {"shelit", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR}, - {"vroom", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, - {"boing", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"clash", false, 64, 8, -1, NULL, 0, -1, -1, LUMPERROR}, + {"tossed", false, 150, 8, -1, NULL, 0, -1, -1, LUMPERROR}, + {"shelit", false, 64, 16, -1, NULL, 0, -1, -1, LUMPERROR}, + {"vroom", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"boing", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"smkinv", false, 140, 16, -1, NULL, 0, -1, -1, LUMPERROR}, // SRB2kart - Skin sounds {"kwin", false, 64, 0, -1, NULL, 0, SKSWIN, -1, LUMPERROR}, diff --git a/src/sounds.h b/src/sounds.h index df3653d9..9ffc3a87 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -575,6 +575,7 @@ typedef enum sfx_shelit, sfx_vroom, sfx_boing, + sfx_smkinv, sfx_kwin, sfx_klose,