Disable Screen Flash for Finishing Blow option (#5988)

This commit is contained in:
nclok1405
2025-12-04 11:15:49 +09:00
committed by GitHub
parent 9401d4fd71
commit 098cb70460
4 changed files with 47 additions and 8 deletions

View File

@@ -0,0 +1,25 @@
#include <libultraship/bridge.h>
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"
extern "C" {
#include "functions.h"
#include "macros.h"
extern PlayState* gPlayState;
}
static constexpr int32_t CVAR_A11YNOSCREENFLASHFORFINISHINGBLOW_DEFAULT = 0;
#define CVAR_A11YNOSCREENFLASHFORFINISHINGBLOW_NAME CVAR_SETTING("A11yNoScreenFlashForFinishingBlow")
#define CVAR_A11YNOSCREENFLASHFORFINISHINGBLOW_VALUE \
CVarGetInteger(CVAR_A11YNOSCREENFLASHFORFINISHINGBLOW_NAME, CVAR_A11YNOSCREENFLASHFORFINISHINGBLOW_DEFAULT)
static void RegisterA11yNoScreenFlashForFinishingBlow() {
COND_VB_SHOULD(VB_FLASH_SCREEN_FOR_FINISHING_BLOW, CVAR_A11YNOSCREENFLASHFORFINISHINGBLOW_VALUE, {
*should = false;
gPlayState->envCtx.fillScreen = false; // Force screen fill disabled
});
}
static RegisterShipInitFunc initFunc(RegisterA11yNoScreenFlashForFinishingBlow,
{ CVAR_A11YNOSCREENFLASHFORFINISHINGBLOW_NAME });

View File

@@ -535,6 +535,14 @@ typedef enum {
// - None
VB_FIX_SAW_SOFTLOCK,
// #### `result`
// ```c
// true
// ```
// #### `args`
// - None
VB_FLASH_SCREEN_FOR_FINISHING_BLOW,
// #### `result`
// ```c
// true

View File

@@ -231,6 +231,10 @@ void SohMenu::AddMenuSettings() {
.CVar(CVAR_SETTING("A11yDisableIdleCam"))
.RaceDisable(false)
.Options(CheckboxOptions().Tooltip("Disables the automatic re-centering of the camera when idle."));
AddWidget(path, "Disable Screen Flash for Finishing Blow", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_SETTING("A11yNoScreenFlashForFinishingBlow"))
.RaceDisable(false)
.Options(CheckboxOptions().Tooltip("Disables the white screen flash on enemy kill."));
AddWidget(path, "EXPERIMENTAL", WIDGET_SEPARATOR_TEXT).Options(TextOptions().Color(Colors::Orange));
AddWidget(path, "ImGui Menu Scaling", WIDGET_CVAR_COMBOBOX)
.CVar(CVAR_SETTING("ImGuiScale"))

View File

@@ -1180,15 +1180,17 @@ void Play_Update(PlayState* play) {
}
if (play->actorCtx.freezeFlashTimer && (play->actorCtx.freezeFlashTimer-- < 5)) {
osSyncPrintf("FINISH=%d\n", play->actorCtx.freezeFlashTimer);
if (GameInteractor_Should(VB_FLASH_SCREEN_FOR_FINISHING_BLOW, true)) {
osSyncPrintf("FINISH=%d\n", play->actorCtx.freezeFlashTimer);
if ((play->actorCtx.freezeFlashTimer > 0) && ((play->actorCtx.freezeFlashTimer % 2) != 0)) {
play->envCtx.fillScreen = true;
play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] =
play->envCtx.screenFillColor[2] = 150;
play->envCtx.screenFillColor[3] = 80;
} else {
play->envCtx.fillScreen = false;
if ((play->actorCtx.freezeFlashTimer > 0) && ((play->actorCtx.freezeFlashTimer % 2) != 0)) {
play->envCtx.fillScreen = true;
play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] =
play->envCtx.screenFillColor[2] = 150;
play->envCtx.screenFillColor[3] = 80;
} else {
play->envCtx.fillScreen = false;
}
}
} else {
PLAY_LOG(3606);