diff --git a/src/g_game.h b/src/g_game.h index deec04226..7b8e73175 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -170,6 +170,7 @@ extern consvar_t cv_smallposnum; extern consvar_t cv_newspeedometer; extern consvar_t cv_saltyhop; +extern consvar_t cv_saltyheight; extern consvar_t cv_saltyhopsfx; extern consvar_t cv_saltysquish; diff --git a/src/k_kart.c b/src/k_kart.c index d6d8618b2..5773dbe9b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -144,9 +144,12 @@ consvar_t cv_spinoutroll = {"spinoutroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NU //hardcode saltyhop mhhm static void saltyhop_onchange(void); +static void saltyheight_onchange(void); consvar_t cv_saltyhop = {"hardcodehop", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, saltyhop_onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_saltyhopsfx = {"hardcodehopsfx", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_saltysquish = {"hardcodehopsquish", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t saltyheight_t[] = {{FRACUNIT/4, "MIN"}, {2*FRACUNIT, "MAX"}, {0, NULL}}; +consvar_t cv_saltyheight = {"hardcodehopheight", "1", CV_FLOAT|CV_SAVE|CV_CALL|CV_NOINIT, saltyheight_t, saltyheight_onchange, 0, NULL, NULL, 0, 0, NULL}; static void saltyhop_onchange(void) { @@ -160,7 +163,7 @@ static void saltyhop_onchange(void) { player_t *player = &players[i]; - if (!playeringame[i] || P_MobjWasRemoved(player->mo)) + if (!player || !playeringame[i] || P_MobjWasRemoved(player->mo)) continue; player->mo->salty_jump = false; @@ -174,7 +177,30 @@ static void saltyhop_onchange(void) } } -//Colourized HUD +static void saltyheight_onchange(void) +{ + // reset everything when toggling saltyhop height + if (gamestate != GS_LEVEL) + return; + + for (INT32 i = 0; i < MAXPLAYERS; i++) + { + player_t *player = &players[i]; + + if (!player || !playeringame[i] || P_MobjWasRemoved(player->mo)) + continue; + + player->mo->salty_jump = false; + player->mo->salty_zoffset = 0; + player->mo->salty_momz = 0; + + player->mo->salty_ready = false; + player->mo->salty_tapping = false; + player->mo->init_salty = false; + } +} + +// Colourized HUD consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE|CV_CALL, CV_OnOff, SaturnHud_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_colorizeditembox = {"colorizeditembox", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -913,6 +939,7 @@ void K_RegisterClientKartStuff(void) CV_RegisterVar(&cv_saltyhop); CV_RegisterVar(&cv_saltyhopsfx); CV_RegisterVar(&cv_saltysquish); + CV_RegisterVar(&cv_saltyheight); CV_RegisterVar(&cv_slamsound); CV_RegisterVar(&cv_lessflicker); @@ -3510,7 +3537,7 @@ static void K_QuiteSaltyHop(player_t *p) p->mo->spritexscale -= (mos/8); } - p->mo->spriteyoffset = p->mo->salty_zoffset; + p->mo->spriteyoffset = FixedMul(p->mo->salty_zoffset, cv_saltyheight.value); if (cv_saltyhopsfx.value) { diff --git a/src/m_menu.c b/src/m_menu.c index efd6a276a..2993c2c44 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2298,8 +2298,9 @@ static menuitem_t OP_PlayerDistortMenu[] = {IT_STRING | IT_CVAR, NULL, "Player Stretch Factor", &cv_gravstretch, 90}, {IT_STRING | IT_CVAR, NULL, "Squish Sound Effect", &cv_slamsound, 105}, {IT_STRING | IT_CVAR, NULL, "Saltyhop", &cv_saltyhop, 120}, - {IT_STRING | IT_CVAR, NULL, "Saltyhop Sound Effect", &cv_saltyhopsfx, 135}, - {IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 150}, + {IT_STRING | IT_CVAR, NULL, "Saltyhop Height", &cv_saltyheight, 135}, + {IT_STRING | IT_CVAR, NULL, "Saltyhop Sound Effect", &cv_saltyhopsfx, 150}, + {IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 175}, }; static const char* OP_PlayerDistortTooltips[] = @@ -2313,6 +2314,7 @@ static const char* OP_PlayerDistortTooltips[] = "Player squash and stretch.", "Player landing sound effect.", "Kart hopping while drifting. This is purely visual.", + "Jump Height for Kart hopping.", "Player hop sound effect.", "Player hop squash and stretch.", }; @@ -2328,6 +2330,7 @@ enum stretchyplayer, squishsound, salthmmm, + saltheight, saltsound, saltsquishy, };