implement RemoveSpinAttackDarkness using shipinit and custom update func (#4987)

Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>
This commit is contained in:
briaguya 2025-02-04 01:49:31 -08:00 committed by GitHub
parent 40f2e16842
commit e44877cca8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,36 @@
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"
extern "C" {
#include "src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h"
}
void Custom_EnMThunder_Update(Actor* thisx, PlayState* play) {
EnMThunder* enMThunder = (EnMThunder*)thisx;
f32 blueRadius;
s32 redGreen;
enMThunder->actionFunc(enMThunder, play);
// don't call this part, it's what makes the spin attack darkness happen
// func_80A9F314(play, this->unk_1BC);
blueRadius = enMThunder->unk_1AC;
redGreen = (u32)(blueRadius * 255.0f) & 0xFF;
Lights_PointNoGlowSetInfo(&enMThunder->lightInfo, enMThunder->actor.world.pos.x, enMThunder->actor.world.pos.y,
enMThunder->actor.world.pos.z, redGreen, redGreen, (u32)(blueRadius * 100.0f),
(s32)(blueRadius * 800.0f));
}
void OnEnMThunderInitReplaceUpdateWithCustom(void* thunder) {
EnMThunder* enMThunder = (EnMThunder*)thunder;
enMThunder->actor.update = Custom_EnMThunder_Update;
}
#define CVAR_REMOVESPINATTACKDARKNESS_NAME CVAR_ENHANCEMENT("RemoveSpinAttackDarkness")
#define CVAR_REMOVESPINATTACKDARKNESS_DEFAULT 0
#define CVAR_REMOVESPINATTACKDARKNESS_VALUE CVarGetInteger(CVAR_REMOVESPINATTACKDARKNESS_NAME, CVAR_REMOVESPINATTACKDARKNESS_DEFAULT)
void RegisterCustomEnMThunderUpdate() {
COND_ID_HOOK(OnActorInit, ACTOR_EN_M_THUNDER, CVAR_REMOVESPINATTACKDARKNESS_VALUE != CVAR_REMOVESPINATTACKDARKNESS_DEFAULT, OnEnMThunderInitReplaceUpdateWithCustom);
}
static RegisterShipInitFunc initFunc(RegisterCustomEnMThunderUpdate, { CVAR_REMOVESPINATTACKDARKNESS_NAME });

View File

@ -1460,6 +1460,8 @@ void DrawEnhancementsMenu() {
UIWidgets::Tooltip("Shows what items you have collected in the file select screen, like in N64 randomizer");
UIWidgets::PaddedEnhancementCheckbox("Better ammo rendering in pause menu", CVAR_ENHANCEMENT("BetterAmmoRendering"), true, false);
UIWidgets::Tooltip("Ammo counts in the pause menu will work correctly regardless of the position of items in the inventory");
UIWidgets::PaddedEnhancementCheckbox("Remove spin attack darkness", CVAR_ENHANCEMENT("RemoveSpinAttackDarkness"), true, false);
UIWidgets::Tooltip("Remove the darkness that appears when charging a spin attack");
ImGui::EndMenu();
}