mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-09-29 03:17:52 -04:00
Hookify Mweep cutscene options (#7199)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
|
||||
extern "C" {
|
||||
#include "src/overlays/actors/ovl_En_Kz/z_en_kz.h"
|
||||
|
||||
void EnKz_Mweep(EnKz* enKz, PlayState* play);
|
||||
}
|
||||
|
||||
#define CVAR_SPEED_NAME CVAR_ENHANCEMENT("MweepSpeed")
|
||||
#define CVAR_SPEED CVarGetFloat(CVAR_SPEED_NAME, 1.0f)
|
||||
|
||||
static void EnKz_SetSpeed(void* actorPtr) {
|
||||
EnKz* enKz = (EnKz*)actorPtr;
|
||||
if (enKz->actionFunc != EnKz_Mweep) {
|
||||
return;
|
||||
}
|
||||
|
||||
enKz->actor.speedXZ = 0.1f * CVAR_SPEED;
|
||||
}
|
||||
|
||||
static void RegisterMweepSpeed() {
|
||||
COND_ID_HOOK(OnActorUpdate, ACTOR_EN_KZ, CVAR_SPEED != 1.0f, EnKz_SetSpeed);
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterMweepSpeed, { CVAR_SPEED_NAME });
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/ShipInit.hpp"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
|
||||
extern "C" {
|
||||
#include "src/overlays/actors/ovl_En_Kz/z_en_kz.h"
|
||||
#include "objects/object_kz/object_kz.h"
|
||||
|
||||
s32 EnKz_FollowPath(EnKz* enKz, PlayState* play);
|
||||
s32 EnKz_SetMovedPos(EnKz* enKz, PlayState* play);
|
||||
void EnKz_SetupMweep(EnKz* enKz, PlayState* play);
|
||||
void EnKz_Wait(EnKz* enKz, PlayState* play);
|
||||
}
|
||||
|
||||
#define CVAR_STORY_NAME CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story")
|
||||
#define CVAR_STORY CVarGetInteger(CVAR_STORY_NAME, IS_RANDO)
|
||||
|
||||
#define CVAR_SPEED_NAME CVAR_ENHANCEMENT("MweepSpeed")
|
||||
#define CVAR_SPEED CVarGetFloat(CVAR_SPEED_NAME, 1.0f)
|
||||
|
||||
static void EnKz_MweepNoCutscene(EnKz* enKz, PlayState* play) {
|
||||
if ((EnKz_FollowPath(enKz, play) == 1) && (enKz->waypoint == 0)) {
|
||||
Animation_Change(&enKz->skelanime, (AnimationHeader*)&gKzIdleAnim, 1.0f, 0.0f,
|
||||
Animation_GetLastFrame((void*)&gKzIdleAnim), ANIMMODE_LOOP, -10.0f);
|
||||
EnKz_SetMovedPos(enKz, play);
|
||||
enKz->actor.speedXZ = 0.0;
|
||||
enKz->actionFunc = EnKz_Wait;
|
||||
} else {
|
||||
enKz->actor.speedXZ = 0.1f * CVAR_SPEED;
|
||||
}
|
||||
if (enKz->skelanime.curFrame == 13.0f) {
|
||||
Audio_PlayActorSound2(&enKz->actor, NA_SE_VO_KZ_MOVE);
|
||||
}
|
||||
}
|
||||
|
||||
static void EnKz_InterceptMweep(void* actorPtr) {
|
||||
EnKz* enKz = (EnKz*)actorPtr;
|
||||
if (enKz->actionFunc != EnKz_SetupMweep) {
|
||||
return;
|
||||
}
|
||||
|
||||
enKz->actor.speedXZ = 0.1f * CVAR_SPEED;
|
||||
Inventory_ReplaceItem(gPlayState, ITEM_LETTER_RUTO, ITEM_BOTTLE);
|
||||
Flags_SetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED);
|
||||
enKz->actionFunc = EnKz_MweepNoCutscene;
|
||||
}
|
||||
|
||||
static void RegisterSkipKingZoraMoveOver() {
|
||||
COND_ID_HOOK(OnActorUpdate, ACTOR_EN_KZ, CVAR_STORY, EnKz_InterceptMweep);
|
||||
}
|
||||
|
||||
static RegisterShipInitFunc initFunc(RegisterSkipKingZoraMoveOver, { CVAR_STORY_NAME, "IS_RANDO" });
|
||||
@@ -574,14 +574,6 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VB_PLAY_MWEEP_CS: {
|
||||
if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), 0)) {
|
||||
*should = false;
|
||||
Inventory_ReplaceItem(gPlayState, ITEM_LETTER_RUTO, ITEM_BOTTLE);
|
||||
Flags_SetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VB_JABU_JABU_EAT_FISH:
|
||||
if (*should && CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO)) {
|
||||
*should = false;
|
||||
|
||||
@@ -2185,14 +2185,6 @@ typedef enum {
|
||||
// - None
|
||||
VB_PLAY_MINUET_OF_FOREST_CS,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// true
|
||||
// ```
|
||||
// #### `args`
|
||||
// - None
|
||||
VB_PLAY_MWEEP_CS,
|
||||
|
||||
// #### `result`
|
||||
// ```c
|
||||
// this->getItemId == GI_GAUNTLETS_SILVER
|
||||
|
||||
@@ -328,7 +328,7 @@ s32 EnKz_FollowPath(EnKz* this, PlayState* play) {
|
||||
pathDiffZ = pointPos->z - this->actor.world.pos.z;
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, (Math_FAtan2F(pathDiffX, pathDiffZ) * (0x8000 / M_PI)), 0xA, 0x3E8, 1);
|
||||
|
||||
if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 10.0f * CVarGetFloat(CVAR_ENHANCEMENT("MweepSpeed"), 1.0f)) {
|
||||
if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 10.0f) {
|
||||
this->waypoint++;
|
||||
if (this->waypoint >= path->count) {
|
||||
this->waypoint = 0;
|
||||
@@ -407,24 +407,18 @@ void EnKz_SetupMweep(EnKz* this, PlayState* play) {
|
||||
Vec3f pos;
|
||||
Vec3f initPos;
|
||||
|
||||
bool shouldPlayCutscene = GameInteractor_Should(VB_PLAY_MWEEP_CS, true);
|
||||
|
||||
if (shouldPlayCutscene) {
|
||||
this->cutsceneCamera = Play_CreateSubCamera(play);
|
||||
this->gameplayCamera = play->activeCamera;
|
||||
Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_WAIT);
|
||||
Play_ChangeCameraStatus(play, this->cutsceneCamera, CAM_STAT_ACTIVE);
|
||||
}
|
||||
this->cutsceneCamera = Play_CreateSubCamera(play);
|
||||
this->gameplayCamera = play->activeCamera;
|
||||
Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_WAIT);
|
||||
Play_ChangeCameraStatus(play, this->cutsceneCamera, CAM_STAT_ACTIVE);
|
||||
pos = this->actor.world.pos;
|
||||
initPos = this->actor.home.pos;
|
||||
pos.y += 60.0f;
|
||||
initPos.y += -100.0f;
|
||||
initPos.z += 260.0f;
|
||||
if (shouldPlayCutscene) {
|
||||
Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos);
|
||||
Player_SetCsActionWithHaltedActors(play, &this->actor, 8);
|
||||
}
|
||||
this->actor.speedXZ = 0.1f * CVarGetFloat(CVAR_ENHANCEMENT("MweepSpeed"), 1.0f);
|
||||
Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos);
|
||||
Player_SetCsActionWithHaltedActors(play, &this->actor, 8);
|
||||
this->actor.speedXZ = 0.1f;
|
||||
this->actionFunc = EnKz_Mweep;
|
||||
}
|
||||
|
||||
@@ -438,9 +432,7 @@ void EnKz_Mweep(EnKz* this, PlayState* play) {
|
||||
pos.y += 60.0f;
|
||||
initPos.y += -100.0f;
|
||||
initPos.z += 260.0f;
|
||||
if (GameInteractor_Should(VB_PLAY_MWEEP_CS, true)) {
|
||||
Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos);
|
||||
}
|
||||
Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos);
|
||||
if ((EnKz_FollowPath(this, play) == 1) && (this->waypoint == 0)) {
|
||||
Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_1);
|
||||
Inventory_ReplaceItem(play, ITEM_LETTER_RUTO, ITEM_BOTTLE);
|
||||
@@ -455,11 +447,9 @@ void EnKz_Mweep(EnKz* this, PlayState* play) {
|
||||
}
|
||||
|
||||
void EnKz_StopMweep(EnKz* this, PlayState* play) {
|
||||
if (GameInteractor_Should(VB_PLAY_MWEEP_CS, true)) {
|
||||
Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_ACTIVE);
|
||||
Play_ClearCamera(play, this->cutsceneCamera);
|
||||
Player_SetCsActionWithHaltedActors(play, &this->actor, 7);
|
||||
}
|
||||
Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_ACTIVE);
|
||||
Play_ClearCamera(play, this->cutsceneCamera);
|
||||
Player_SetCsActionWithHaltedActors(play, &this->actor, 7);
|
||||
this->actionFunc = EnKz_Wait;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user