Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link can move around while carpenters escape #5055

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,14 @@ typedef enum {
// - None
VB_PLAY_BOLERO_OF_FIRE_CS,

// #### `result`
// ```c
// true
// ```
// #### `args`
// - `*EnDaiku`
VB_PLAY_CARPENTER_FREE_CS,

// #### `result`
// Close enough & various cutscene checks
// ```c
Expand Down
14 changes: 14 additions & 0 deletions soh/soh/Enhancements/timesaver_hook_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern "C" {
#include "src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h"
#include "src/overlays/actors/ovl_En_Tk/z_en_tk.h"
#include "src/overlays/actors/ovl_En_Fu/z_en_fu.h"
#include "src/overlays/actors/ovl_En_Daiku/z_en_daiku.h"
#include "src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.h"
#include "src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h"
#include "src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.h"
Expand All @@ -42,6 +43,8 @@ extern void BgSpot03Taki_ApplyOpeningAlpha(BgSpot03Taki* bgSpot03Taki, s32 buffe
extern void EnGo2_CurledUp(EnGo2* enGo2, PlayState* play);

extern void EnRu2_SetEncounterSwitchFlag(EnRu2* enRu2, PlayState* play);

extern void EnDaiku_EscapeSuccess(EnDaiku* enDaiku, PlayState* play);
}

#define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).Get()
Expand Down Expand Up @@ -549,6 +552,17 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li
}
break;
}
case VB_PLAY_CARPENTER_FREE_CS: {
if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), IS_RANDO)) {
EnDaiku* enDaiku = va_arg(args, EnDaiku*);
if (enDaiku->subCamActive) {
enDaiku->subCamActive = false;
EnDaiku_EscapeSuccess(enDaiku, gPlayState);
}
*should = false;
}
break;
}
case VB_PLAY_GORON_FREE_CS: {
if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) {
*should = false;
Expand Down
14 changes: 12 additions & 2 deletions soh/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ void EnDaiku_InitSubCamera(EnDaiku* this, PlayState* play) {
this->subCamActive = true;
this->escapeSubCamTimer = sEscapeSubCamParams[this->actor.params & 3].maxFramesActive;

if (!GameInteractor_Should(VB_PLAY_CARPENTER_FREE_CS, true, this)) {
return;
}

eyePosDeltaLocal.x = sEscapeSubCamParams[this->actor.params & 3].eyePosDeltaLocal.x;
eyePosDeltaLocal.y = sEscapeSubCamParams[this->actor.params & 3].eyePosDeltaLocal.y;
eyePosDeltaLocal.z = sEscapeSubCamParams[this->actor.params & 3].eyePosDeltaLocal.z;
Expand All @@ -477,6 +481,10 @@ void EnDaiku_InitSubCamera(EnDaiku* this, PlayState* play) {
void EnDaiku_UpdateSubCamera(EnDaiku* this, PlayState* play) {
s32 pad;

if (!GameInteractor_Should(VB_PLAY_CARPENTER_FREE_CS, true, this)) {
return;
}

this->subCamAtTarget.x = this->actor.world.pos.x;
this->subCamAtTarget.y = this->actor.world.pos.y + 60.0f;
this->subCamAtTarget.z = this->actor.world.pos.z;
Expand All @@ -493,8 +501,10 @@ void EnDaiku_EscapeSuccess(EnDaiku* this, PlayState* play) {
Actor* gerudoGuard;
Vec3f vec;

Play_ClearCamera(play, this->subCamId);
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE);
if (GameInteractor_Should(VB_PLAY_CARPENTER_FREE_CS, true, this)) {
Play_ClearCamera(play, this->subCamId);
Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE);
}
this->subCamActive = false;

if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
Expand Down