mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-04-23 08:14:31 +00:00
Hookify DropsDontDie, NoFishDespawn, NoBugsDespawn (#6513)
This commit is contained in:
parent
27d35e5a92
commit
aedae12e63
12
soh/soh/Enhancements/Cheats/DropsDontDie.cpp
Normal file
12
soh/soh/Enhancements/Cheats/DropsDontDie.cpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
|
||||
static void RegisterDropsDontDie() {
|
||||
COND_VB_SHOULD(VB_ITEM00_TIMER_TICK, CVarGetInteger(CVAR_CHEAT("DropsDontDie"), 0), {
|
||||
EnItem00* item00 = va_arg(args, EnItem00*);
|
||||
if (item00->unk_154 <= 0)
|
||||
*should = false;
|
||||
});
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterDropsDontDie, { CVAR_CHEAT("DropsDontDie") });
|
||||
25
soh/soh/Enhancements/Cheats/NoBugsDespawn.cpp
Normal file
25
soh/soh/Enhancements/Cheats/NoBugsDespawn.cpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "macros.h"
|
||||
#include "src/overlays/actors/ovl_En_Insect/z_en_insect.h"
|
||||
|
||||
extern s16 D_80A7DEB8;
|
||||
}
|
||||
|
||||
static void OnActorInitNoBugsDespawn(void* refActor) {
|
||||
EnInsect* insect = reinterpret_cast<EnInsect*>(refActor);
|
||||
|
||||
if ((insect->actor.params & 2) && insect->soilActor == NULL) {
|
||||
insect->insectFlags &= ~4;
|
||||
D_80A7DEB8--;
|
||||
}
|
||||
}
|
||||
|
||||
static void RegisterNoBugsDespawn() {
|
||||
COND_ID_HOOK(OnActorInit, ACTOR_EN_INSECT, CVarGetInteger(CVAR_CHEAT("NoBugsDespawn"), 0),
|
||||
OnActorInitNoBugsDespawn);
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterNoBugsDespawn, { CVAR_CHEAT("NoBugsDespawn") });
|
||||
8
soh/soh/Enhancements/Cheats/NoFishDespawn.cpp
Normal file
8
soh/soh/Enhancements/Cheats/NoFishDespawn.cpp
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
|
||||
static void RegisterNoFishDespawn() {
|
||||
COND_VB_SHOULD(VB_FISH_TIMER_TICK, CVarGetInteger(CVAR_CHEAT("NoFishDespawn"), 0), { *should = false; });
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterNoFishDespawn, { CVAR_CHEAT("NoFishDespawn") });
|
||||
|
|
@ -1315,6 +1315,14 @@ typedef enum {
|
|||
// - `*EnItem00`
|
||||
VB_ITEM00_DESPAWN,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// this->unk_15A > 0
|
||||
// ```
|
||||
// #### `args`
|
||||
// - `*EnItem00`
|
||||
VB_ITEM00_TIMER_TICK,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true
|
||||
|
|
@ -2672,14 +2680,6 @@ typedef enum {
|
|||
// - `*BgHidanDalm`
|
||||
VB_HAMMER_TOTEM_BREAK,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// Actor_GetCollidedExplosive(play, &this->collider.base) != NULL
|
||||
// ```
|
||||
// #### `args`
|
||||
// - `*BgHidanKowarerukabe`
|
||||
VB_FIRE_TEMPLE_BOMBABLE_WALL_BREAK,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true
|
||||
|
|
@ -2714,6 +2714,22 @@ typedef enum {
|
|||
// - `*FileChooseContext`
|
||||
VB_FILE_SELECT_DRAW_FILE_INFO_BOX,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// Actor_GetCollidedExplosive(play, &this->collider.base) != NULL
|
||||
// ```
|
||||
// #### `args`
|
||||
// - `*BgHidanKowarerukabe`
|
||||
VB_FIRE_TEMPLE_BOMBABLE_WALL_BREAK,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// this->timer > 0
|
||||
// ```
|
||||
// #### `args`
|
||||
// - None
|
||||
VB_FISH_TIMER_TICK,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h"
|
||||
#include "textures/icon_item_static/icon_item_static.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/OTRGlobals.h"
|
||||
|
||||
|
|
@ -781,11 +780,8 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
if (this->unk_15A > 0) {
|
||||
if (GameInteractor_Should(VB_ITEM00_TIMER_TICK, this->unk_15A > 0, this)) {
|
||||
this->unk_15A--;
|
||||
if (CVarGetInteger(CVAR_CHEAT("DropsDontDie"), 0) && (this->unk_154 <= 0)) {
|
||||
this->unk_15A++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((this->unk_15A > 0) && (this->unk_15A < 41) && (this->unk_154 <= 0)) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
#include "vt.h"
|
||||
#include "soh/ResourceManagerHelpers.h"
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
|
||||
#define FLAGS 0
|
||||
|
||||
|
|
@ -679,7 +680,7 @@ void EnFish_UpdateCutscene(EnFish* this, PlayState* play) {
|
|||
// Update functions and Draw
|
||||
|
||||
void EnFish_OrdinaryUpdate(EnFish* this, PlayState* play) {
|
||||
if (this->timer > 0 && CVarGetInteger(CVAR_CHEAT("NoFishDespawn"), 0) == 0) {
|
||||
if (GameInteractor_Should(VB_FISH_TIMER_TICK, this->timer > 0)) {
|
||||
this->timer--;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -212,13 +212,6 @@ void EnInsect_Init(Actor* thisx, PlayState* play2) {
|
|||
|
||||
func_80A7D39C(this);
|
||||
|
||||
// For bugs that aren't linked to a soil patch, we remove the "short lived" flag to prevent them from despawning
|
||||
// And exit early to not increment the "bugs dropped count"
|
||||
if (CVarGetInteger(CVAR_CHEAT("NoBugsDespawn"), 0) && this->soilActor == NULL) {
|
||||
this->insectFlags &= ~4;
|
||||
return;
|
||||
}
|
||||
|
||||
D_80A7DEB8++;
|
||||
} else {
|
||||
rand = Rand_ZeroOne();
|
||||
|
|
|
|||
Loading…
Reference in a new issue