From f05d006479217efab7ff37d184b0e71fc971d58a Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Fri, 22 Apr 2022 00:40:22 +0200 Subject: [PATCH] [MOD]Visual & audio Stone of agony (#177) * Visual / Audio Stone of Agony This add Sound and blinking icon for the item Stone of Agony. Useful for peoples that have issues with rumble anything other person that is also blind or deaf. This is made with these second person in mind, home they will like it :) * Adding bool there Yes I do fiels one by one to be sure * Adding the Cvar register 1 file left :D * Adding the main change in func_80848EF8 And that the last file :) --- libultraship/libultraship/GameSettings.cpp | 5 +++ libultraship/libultraship/GameSettings.h | 2 + soh/soh/Enhancements/bootcommands.c | 1 + .../actors/ovl_player_actor/z_player.c | 37 +++++++++++++++++++ 4 files changed, 45 insertions(+) diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp index 5f19d3c4d..2ce22d6f9 100644 --- a/libultraship/libultraship/GameSettings.cpp +++ b/libultraship/libultraship/GameSettings.cpp @@ -67,6 +67,9 @@ namespace Game { Settings.enhancements.minimal_ui = stob(Conf[EnhancementSection]["minimal_ui"]); CVar_SetS32("gMinimalUI", Settings.enhancements.minimal_ui); + Settings.enhancements.visualagony = stob(Conf[EnhancementSection]["visualagony"]); + CVar_SetS32("gVisualAgony", Settings.enhancements.visualagony); + Settings.enhancements.mm_bunny_hood = stob(Conf[EnhancementSection]["mm_bunny_hood"]); CVar_SetS32("gMMBunnyHood", Settings.enhancements.mm_bunny_hood); @@ -175,8 +178,10 @@ namespace Game { Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu); Conf[EnhancementSection]["dynamic_wallet_icon"] = std::to_string(Settings.enhancements.dynamic_wallet_icon); Conf[EnhancementSection]["minimal_ui"] = std::to_string(Settings.enhancements.minimal_ui); + Conf[EnhancementSection]["visualagony"] = std::to_string(Settings.enhancements.visualagony); Conf[EnhancementSection]["mm_bunny_hood"] = std::to_string(Settings.enhancements.mm_bunny_hood); + // Controllers Conf[ControllerSection]["gyro_sensitivity"] = std::to_string(Settings.controller.gyro_sensitivity); Conf[ControllerSection]["rumble_strength"] = std::to_string(Settings.controller.rumble_strength); diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h index 33e0c8b3d..070bdce38 100644 --- a/libultraship/libultraship/GameSettings.h +++ b/libultraship/libultraship/GameSettings.h @@ -26,7 +26,9 @@ struct SoHConfigType { bool animated_pause_menu = false; bool dynamic_wallet_icon = false; bool minimal_ui = false; + bool visualagony = false; bool mm_bunny_hood = false; + } enhancements; // Controller diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index 685593179..c58a11b6b 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -25,6 +25,7 @@ void BootCommands_Init() CVar_RegisterS32("gDebugEnabled", 0); CVar_RegisterS32("gPauseLiveLink", 0); CVar_RegisterS32("gMinimalUI", 0); + CVar_RegisterS32("gVisualAgony", 0); } //void BootCommands_ParseBootArgs(char* str) diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 734ba015e..5ff08df85 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -10274,8 +10274,45 @@ void func_80848EF8(Player* this) { } this->unk_6A0 += temp; + + /*Prevent it on horse, while jumping and on title screen. + If you fly around no stone of agony for you! */ + if (CVar_GetS32("gVisualAgony", 0) !=0 && !this->stateFlags1) { + int rectLeft = OTRGetRectDimensionFromLeftEdge(26); //Left X Pos + int rectTop = 60; //Top Y Pos + int rectWidth = 24; //Texture Width + int rectHeight = 24; //Texture Heigh + int DefaultIconA= 50; //Default icon alphe (55 on 255) + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 2824); + gDPPipeSync(OVERLAY_DISP++); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + if (this->unk_6A0 > 4000000.0f) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); + } else { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA); + } + if (temp == 0 || temp <= 0.1f) { + /*Fail check, it is used to draw off the icon when + link is standing out range but do not refresh unk_6A0. + Also used to make a default value in my case.*/ + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA); + } + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); + gDPSetOtherMode(OVERLAY_DISP++, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_IA16 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); + gDPLoadTextureBlock(OVERLAY_DISP++, gStoneOfAgonyIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gDPSetOtherMode(OVERLAY_DISP++, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_IA16 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); + gSPWideTextureRectangle(OVERLAY_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player.c", 3500); + } + if (this->unk_6A0 > 4000000.0f) { this->unk_6A0 = 0.0f; + if (CVar_GetS32("gVisualAgony", 0) !=0 && !this->stateFlags1) { + //This audio is placed here and not in previous CVar check to prevent ears ra.. :) + Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_WOMAN, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E0); + } func_8083264C(this, 120, 20, 10, 0); } }