Convert enemy-specific cheats "No ReDead/Gibdo Freeze" and "Keese/Guay don't Target You" to hooks (#5597)
Some checks are pending
generate-builds / generate-soh-otr (push) Waiting to run
generate-builds / build-macos (push) Blocked by required conditions
generate-builds / build-linux (push) Blocked by required conditions
generate-builds / build-windows (push) Blocked by required conditions

This commit is contained in:
nclok1405 2025-06-20 07:06:10 +09:00 committed by GitHub
parent 3943242cb2
commit 7514bdc08b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 86 additions and 6 deletions

View file

@ -0,0 +1,23 @@
#include <libultraship/bridge.h>
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"
extern "C" {
#include "macros.h"
}
static constexpr int32_t CVAR_NOKEESEGUAYTARGET_DEFAULT = 0;
#define CVAR_NOKEESEGUAYTARGET_NAME CVAR_CHEAT("NoKeeseGuayTarget")
#define CVAR_NOKEESEGUAYTARGET_VALUE CVarGetInteger(CVAR_NOKEESEGUAYTARGET_NAME, CVAR_NOKEESEGUAYTARGET_DEFAULT)
void RegisterNoKeeseGuayTarget() {
// Dive Attack
COND_VB_SHOULD(VB_KEESE_DO_DIVE_ATTACK, CVAR_NOKEESEGUAYTARGET_VALUE, { *should = false; });
COND_VB_SHOULD(VB_GUAY_DO_DIVE_ATTACK, CVAR_NOKEESEGUAYTARGET_VALUE, { *should = false; });
// Force Fly Away
COND_VB_SHOULD(VB_KEESE_FORCE_FLY_AWAY, CVAR_NOKEESEGUAYTARGET_VALUE, { *should = true; });
COND_VB_SHOULD(VB_GUAY_FORCE_FLY_AWAY, CVAR_NOKEESEGUAYTARGET_VALUE, { *should = true; });
}
static RegisterShipInitFunc initFunc_NoKeeseGuayTarget(RegisterNoKeeseGuayTarget, { CVAR_NOKEESEGUAYTARGET_NAME });

View file

@ -0,0 +1,17 @@
#include <libultraship/bridge.h>
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/ShipInit.hpp"
extern "C" {
#include "macros.h"
}
static constexpr int32_t CVAR_NOREDEADFREEZE_DEFAULT = 0;
#define CVAR_NOREDEADFREEZE_NAME CVAR_CHEAT("NoRedeadFreeze")
#define CVAR_NOREDEADFREEZE_VALUE CVarGetInteger(CVAR_NOREDEADFREEZE_NAME, CVAR_NOREDEADFREEZE_DEFAULT)
void RegisterNoRedeadFreeze() {
COND_VB_SHOULD(VB_REDEAD_GIBDO_FREEZE_LINK, CVAR_NOREDEADFREEZE_VALUE, { *should = false; });
}
static RegisterShipInitFunc initFunc_NoRedeadFreeze(RegisterNoRedeadFreeze, { CVAR_NOREDEADFREEZE_NAME });

View file

@ -1111,6 +1111,22 @@ typedef enum {
// - None // - None
VB_GTG_GATE_BE_OPEN, VB_GTG_GATE_BE_OPEN,
// #### `result`
// ```c
// true
// ```
// #### `args`
// - `*EnCrow`
VB_GUAY_DO_DIVE_ATTACK,
// #### `result`
// ```c
// false
// ```
// #### `args`
// - `*EnCrow`
VB_GUAY_FORCE_FLY_AWAY,
// #### `result` // #### `result`
// ```c // ```c
// true // true
@ -1199,6 +1215,22 @@ typedef enum {
// - None // - None
VB_KALEIDO_UNPAUSE_CLOSE, VB_KALEIDO_UNPAUSE_CLOSE,
// #### `result`
// ```c
// true
// ```
// #### `args`
// - `*EnFirefly`
VB_KEESE_DO_DIVE_ATTACK,
// #### `result`
// ```c
// false
// ```
// #### `args`
// - `*EnFirefly`
VB_KEESE_FORCE_FLY_AWAY,
// #### `result` // #### `result`
// ```c // ```c
// Flags_GetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED) // Flags_GetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED)
@ -1713,6 +1745,14 @@ typedef enum {
// - None // - None
VB_PREVENT_ADULT_STICK, VB_PREVENT_ADULT_STICK,
// #### `result`
// ```c
// true
// ```
// #### `args`
// - `*EnRd`
VB_REDEAD_GIBDO_FREEZE_LINK,
// #### `result` // #### `result`
// #### `result` // #### `result`
// ```c // ```c

View file

@ -285,7 +285,7 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) {
} }
if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) &&
!(player->stateFlags1 & PLAYER_STATE1_ON_HORSE) && (this->actor.yDistToWater < -40.0f) && !(player->stateFlags1 & PLAYER_STATE1_ON_HORSE) && (this->actor.yDistToWater < -40.0f) &&
(Player_GetMask(play) != PLAYER_MASK_SKULL) && !CVarGetInteger(CVAR_CHEAT("NoKeeseGuayTarget"), 0)) { (Player_GetMask(play) != PLAYER_MASK_SKULL) && GameInteractor_Should(VB_GUAY_DO_DIVE_ATTACK, true, this)) {
EnCrow_SetupDiveAttack(this); EnCrow_SetupDiveAttack(this);
} }
} }
@ -322,7 +322,7 @@ void EnCrow_DiveAttack(EnCrow* this, PlayState* play) {
if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) || (this->collider.base.atFlags & AT_HIT) || if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) || (this->collider.base.atFlags & AT_HIT) ||
(this->actor.bgCheckFlags & 9) || (player->stateFlags1 & PLAYER_STATE1_ON_HORSE) || (this->actor.bgCheckFlags & 9) || (player->stateFlags1 & PLAYER_STATE1_ON_HORSE) ||
(this->actor.yDistToWater > -40.0f) || CVarGetInteger(CVAR_CHEAT("NoKeeseGuayTarget"), 0)) { (this->actor.yDistToWater > -40.0f) || GameInteractor_Should(VB_GUAY_FORCE_FLY_AWAY, false, this)) {
if (this->collider.base.atFlags & AT_HIT) { if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.atFlags &= ~AT_HIT; this->collider.base.atFlags &= ~AT_HIT;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_ATTACK); Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_ATTACK);

View file

@ -416,7 +416,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300);
} }
if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL) && if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL) &&
!CVarGetInteger(CVAR_CHEAT("NoKeeseGuayTarget"), 0)) { GameInteractor_Should(VB_KEESE_DO_DIVE_ATTACK, true, this)) {
EnFirefly_SetupDiveAttack(this); EnFirefly_SetupDiveAttack(this);
} }
} }
@ -495,7 +495,7 @@ void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play) {
Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100);
} }
if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) || if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) ||
CVarGetInteger(CVAR_CHEAT("NoKeeseGuayTarget"), 0)) { GameInteractor_Should(VB_KEESE_FORCE_FLY_AWAY, false, this)) {
EnFirefly_SetupFlyAway(this); EnFirefly_SetupFlyAway(this);
} }
} }

View file

@ -344,7 +344,7 @@ void func_80AE2C1C(EnRd* this, PlayState* play) {
!(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { !(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) {
if (this->unk_306 == 0) { if (this->unk_306 == 0) {
if (!(this->unk_312 & PLAYER_STATE2_GRABBED_BY_ENEMY) && if (!(this->unk_312 & PLAYER_STATE2_GRABBED_BY_ENEMY) &&
!CVarGetInteger(CVAR_CHEAT("NoRedeadFreeze"), 0)) { GameInteractor_Should(VB_REDEAD_GIBDO_FREEZE_LINK, true, this)) {
player->actor.freezeTimer = 40; player->actor.freezeTimer = 40;
Player_SetAutoLockOnActor(play, &this->actor); Player_SetAutoLockOnActor(play, &this->actor);
GET_PLAYER(play)->autoLockOnActor = &this->actor; GET_PLAYER(play)->autoLockOnActor = &this->actor;
@ -575,7 +575,7 @@ void func_80AE3834(EnRd* this, PlayState* play) {
s16 temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->unk_30E - this->unk_310; s16 temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->unk_30E - this->unk_310;
if (ABS(temp_v0) < 0x2008) { if (ABS(temp_v0) < 0x2008) {
if (!(this->unk_312 & 0x80) && !CVarGetInteger(CVAR_CHEAT("NoRedeadFreeze"), 0)) { if (!(this->unk_312 & 0x80) && GameInteractor_Should(VB_REDEAD_GIBDO_FREEZE_LINK, true, this)) {
player->actor.freezeTimer = 60; player->actor.freezeTimer = 60;
func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96);
Player_SetAutoLockOnActor(play, &this->actor); Player_SetAutoLockOnActor(play, &this->actor);