From 213718d1bd2695ae12de74dee0c4e2a4b09cf6e9 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 8 Jan 2024 08:34:32 +0100 Subject: [PATCH] add toggle to be able to either rotate just players or everything you can either just having Players be rotated on slopes, or every mobj more customizable and also for performance concerns for some also some stuff i forgor --- src/g_game.c | 3 ++- src/k_kart.c | 2 +- src/m_menu.c | 7 ++++--- src/p_mobj.c | 5 ++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index fe0a6a8ec..38f063f62 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -511,8 +511,9 @@ static CV_PossibleValue_t sloperolldist_cons_t[] = { {3072, "3072"}, {4096, "4096"}, {6144, "6144"}, {8192, "8192"}, {0, "Infinite"}, {0, NULL}}; consvar_t cv_sloperolldist = {"sloperolldist", "Infinite", CV_SAVE, sloperolldist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t sloperoll_cons_t[] = {{0, "Off"}, {1, "Players"}, {2, "Everything"}, {0, NULL}}; consvar_t cv_spriteroll = {"spriteroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, sloperoll_cons_t, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_sparkroll = {"sparkroll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_sliptideroll = {"sliptideroll", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/k_kart.c b/src/k_kart.c index 971bc6c01..46d891890 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6446,7 +6446,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (cv_sloperolldist.value > 0) usedist = true; - if (cv_sloperoll.value == 1) + if ((cv_spriteroll.value) && (cv_sloperoll.value)) { if ((!player->mo->salty_jump)) // seeing a character rotate mid-hop looks really janky K_RollMobjBySlopes(player->mo, usedist); diff --git a/src/m_menu.c b/src/m_menu.c index 81f815b91..9691e9bd5 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2061,15 +2061,16 @@ static menuitem_t OP_PlayerDistortMenu[] = { {IT_HEADER, NULL, "Sprite Distortion", NULL, 0}, - {IT_STRING | IT_CVAR, NULL, "Rotate Objects on Slopes", &cv_sloperoll, 20}, + {IT_STRING | IT_CVAR, NULL, "Sprite Rotation", &cv_spriteroll, 10}, + {IT_STRING | IT_CVAR, NULL, "Sprite Slope Rotation", &cv_sloperoll, 20}, {IT_STRING | IT_CVAR, NULL, "Slope Rotation Distance", &cv_sloperolldist, 35}, {IT_STRING | IT_CVAR, NULL, "Rotate Players when Sliptiding", &cv_sliptideroll, 50}, {IT_STRING | IT_CVAR, NULL, "Rotate Sparks and Boost Trails", &cv_sparkroll, 65}, {IT_STRING | IT_CVAR, NULL, "Player Stretch Factor", &cv_gravstretch, 80}, {IT_STRING | IT_CVAR, NULL, "Squish Sound Effect", &cv_slamsound, 95}, - {IT_STRING | IT_CVAR, NULL, "Saltyhop", &cv_saltyhop, 110}, + {IT_STRING | IT_CVAR, NULL, "Saltyhop", &cv_saltyhop, 110}, {IT_STRING | IT_CVAR, NULL, "Saltyhop Sound Effect", &cv_saltyhopsfx, 125}, - {IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 140}, + {IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 140}, }; static const char* OP_PlayerDistortTooltips[] = diff --git a/src/p_mobj.c b/src/p_mobj.c index d8237ff7b..5d9d5db2d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6263,7 +6263,7 @@ void P_RollPitchMobj(mobj_t* mobj) if (cv_sloperolldist.value > 0) usedist = true; - if (cv_sloperoll.value == 1) + if ((cv_spriteroll.value) && (cv_sloperoll.value == 2)) { K_RollMobjBySlopes(mobj, usedist); } @@ -6284,6 +6284,9 @@ angle_t P_MobjPitchAndRoll(mobj_t *mobj) if (P_MobjWasRemoved(mobj)) return 0; + + if (cv_spriteroll.value) + return 0; size_t rot = mobj->frame & FF_FRAMEMASK; boolean papersprite = (mobj->frame & FF_PAPERSPRITE);