mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 14:23:44 -07:00
hookify
This commit is contained in:
parent
1b63c3fb65
commit
a1bd17b2d6
2 changed files with 25 additions and 11 deletions
25
soh/soh/Enhancements/RebottleBlueFire.cpp
Normal file
25
soh/soh/Enhancements/RebottleBlueFire.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.h"
|
||||
void EnIceHono_CapturableFlame(EnIceHono* thisx, PlayState* play);
|
||||
u32 EnIceHono_InBottleRange(EnIceHono* thisx, PlayState* play);
|
||||
}
|
||||
|
||||
extern PlayState* gPlayState;
|
||||
|
||||
void OnEnIceHonoUpdate(void* actor) {
|
||||
EnIceHono* thisx = (EnIceHono*)actor;
|
||||
if (thisx->actionFunc != EnIceHono_CapturableFlame && EnIceHono_InBottleRange(thisx, gPlayState)) {
|
||||
// GI_MAX in this case allows the player to catch the actor in a bottle
|
||||
Actor_OfferGetItem(&thisx->actor, gPlayState, GI_MAX, 60.0f, 100.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void RegisterRebottleBlueFire() {
|
||||
COND_ID_HOOK(OnActorUpdate, ACTOR_EN_ICE_HONO, CVarGetInteger(CVAR_ENHANCEMENT("RebottleBlueFire"), 0),
|
||||
OnEnIceHonoUpdate);
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterRebottleBlueFire, { CVAR_ENHANCEMENT("RebottleBlueFire") });
|
|
@ -7,8 +7,6 @@
|
|||
#include "z_en_ice_hono.h"
|
||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||
|
||||
#include <libultraship/libultra.h>
|
||||
|
||||
#define FLAGS 0
|
||||
|
||||
void EnIceHono_Init(Actor* thisx, PlayState* play);
|
||||
|
@ -298,10 +296,6 @@ void EnIceHono_SpreadFlames(EnIceHono* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
if (CVarGetInteger(CVAR_ENHANCEMENT("RebottleBlueFire"), 0)) {
|
||||
EnIceHono_CapturableFlame(this, play);
|
||||
}
|
||||
|
||||
if (this->timer <= 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
|
@ -337,11 +331,6 @@ void EnIceHono_SmallFlameMove(EnIceHono* this, PlayState* play) {
|
|||
this->alpha -= 10;
|
||||
this->alpha = CLAMP(this->alpha, 0, 255);
|
||||
}
|
||||
|
||||
if (CVarGetInteger(CVAR_ENHANCEMENT("RebottleBlueFire"), 0)) {
|
||||
EnIceHono_CapturableFlame(this, play);
|
||||
}
|
||||
|
||||
if (this->timer <= 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue