Merge branch 'develop' of garrettjoecox.github.com:HarbourMasters/Shipwright into let-it-snow

This commit is contained in:
Garrett Cox
2024-12-09 19:42:34 -06:00
33 changed files with 202 additions and 143 deletions
+8 -5
View File
@@ -12,6 +12,7 @@
#include "soh/Enhancements/enhancementTypes.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/OTRGlobals.h"
#include "soh/ResourceManagerHelpers.h"
#include "soh/SaveManager.h"
#include "soh/framebuffer_effects.h"
@@ -1336,15 +1337,16 @@ void Play_Draw(PlayState* play) {
// Track render size when paused and that a copy was performed
static u32 lastPauseWidth;
static u32 lastPauseHeight;
static u8 hasCapturedPauseBuffer;
u8 recapturePauseBuffer = false;
static bool lastAltAssets;
static bool hasCapturedPauseBuffer;
bool recapturePauseBuffer = false;
// If the size has changed or dropped frames leading to the buffer not being copied,
// If the size has changed, alt assets toggled, or dropped frames leading to the buffer not being copied,
// set the prerender state back to setup to copy a new frame.
// This requires not rendering kaleido during this copy to avoid kaleido being copied
// This requires not rendering kaleido during this copy to avoid kaleido itself being copied too.
if ((R_PAUSE_MENU_MODE == 2 || R_PAUSE_MENU_MODE == 3) &&
(lastPauseWidth != OTRGetGameRenderWidth() || lastPauseHeight != OTRGetGameRenderHeight() ||
!hasCapturedPauseBuffer)) {
lastAltAssets != ResourceMgr_IsAltAssetsEnabled() || !hasCapturedPauseBuffer)) {
R_PAUSE_MENU_MODE = 1;
recapturePauseBuffer = true;
}
@@ -1603,6 +1605,7 @@ void Play_Draw(PlayState* play) {
// #region SOH [Port] Custom handling for pause prerender background capture
lastPauseWidth = OTRGetGameRenderWidth();
lastPauseHeight = OTRGetGameRenderHeight();
lastAltAssets = ResourceMgr_IsAltAssetsEnabled();
hasCapturedPauseBuffer = false;
FB_CopyToFramebuffer(&gfxP, 0, gPauseFrameBuffer, false, &hasCapturedPauseBuffer);
@@ -14,7 +14,7 @@ void BgSpot01Idomizu_Destroy(Actor* thisx, PlayState* play);
void BgSpot01Idomizu_Update(Actor* thisx, PlayState* play);
void BgSpot01Idomizu_Draw(Actor* thisx, PlayState* play);
void func_808ABB84(BgSpot01Idomizu* this, PlayState* play);
void BgSpot01Idomizu_UpdateWaterLevel(BgSpot01Idomizu* this, PlayState* play);
const ActorInit Bg_Spot01_Idomizu_InitVars = {
ACTOR_BG_SPOT01_IDOMIZU,
@@ -42,14 +42,14 @@ void BgSpot01Idomizu_Init(Actor* thisx, PlayState* play) {
} else {
this->waterHeight = 52.0f;
}
this->actionFunc = func_808ABB84;
this->actionFunc = BgSpot01Idomizu_UpdateWaterLevel;
this->actor.world.pos.y = this->waterHeight;
}
void BgSpot01Idomizu_Destroy(Actor* thisx, PlayState* play) {
}
void func_808ABB84(BgSpot01Idomizu* this, PlayState* play) {
void BgSpot01Idomizu_UpdateWaterLevel(BgSpot01Idomizu* this, PlayState* play) {
if (Flags_GetEventChkInf(EVENTCHKINF_DRAINED_WELL_IN_KAKARIKO)) {
this->waterHeight = -550.0f;
}
@@ -15,7 +15,7 @@ void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play);
void BgSpot03Taki_Update(Actor* thisx, PlayState* play);
void BgSpot03Taki_Draw(Actor* thisx, PlayState* play);
void func_808ADEF0(BgSpot03Taki* this, PlayState* play);
void BgSpot03Taki_HandleWaterfallState(BgSpot03Taki* this, PlayState* play);
const ActorInit Bg_Spot03_Taki_InitVars = {
ACTOR_BG_SPOT03_TAKI,
@@ -60,7 +60,7 @@ void BgSpot03Taki_Init(Actor* thisx, PlayState* play) {
this->openingAlpha = 255.0f;
BgSpot03Taki_ApplyOpeningAlpha(this, 0);
BgSpot03Taki_ApplyOpeningAlpha(this, 1);
this->actionFunc = func_808ADEF0;
this->actionFunc = BgSpot03Taki_HandleWaterfallState;
}
void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play) {
@@ -69,7 +69,7 @@ void BgSpot03Taki_Destroy(Actor* thisx, PlayState* play) {
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
void func_808ADEF0(BgSpot03Taki* this, PlayState* play) {
void BgSpot03Taki_HandleWaterfallState(BgSpot03Taki* this, PlayState* play) {
if (this->state == WATERFALL_CLOSED) {
if (Flags_GetSwitch(play, this->switchFlag)) {
this->state = WATERFALL_OPENING_ANIMATED;
@@ -179,7 +179,8 @@ void func_808BA2CC(BgTokiHikari* this, PlayState* play) {
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayListOffset(POLY_XLU_DISP++, object_toki_objects_DL_0009C0, 10);
// SOH [Port] Index adjust 11 -> 14 (for LUS marker and gsSPVertex) to account for our extraction size changes
gSPDisplayListOffset(POLY_XLU_DISP++, object_toki_objects_DL_0009C0, 10 + 2 + 1);
Matrix_Pop();
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -91,7 +91,7 @@ void EnBombf_Init(Actor* thisx, PlayState* play) {
EnBombf* this = (EnBombf*)thisx;
Actor_SetScale(thisx, 0.01f);
this->unk_200 = 1;
this->isFuseEnabled = 1;
Collider_InitCylinder(play, &this->bombCollider);
Collider_InitJntSph(play, &this->explosionCollider);
Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit);
@@ -174,7 +174,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) {
(EnBombf*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBF, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0, true);
if (bombFlower != NULL) {
bombFlower->unk_200 = 1;
bombFlower->isFuseEnabled = 1;
bombFlower->timer = 0;
this->timer = 180;
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
@@ -323,7 +323,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) {
s32 pad[2];
EnBombf* this = (EnBombf*)thisx;
if ((this->unk_200 != 0) && (this->timer != 0)) {
if ((this->isFuseEnabled != 0) && (this->timer != 0)) {
this->timer--;
}
@@ -367,7 +367,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) {
if ((this->bombCollider.base.acFlags & AC_HIT) || ((this->bombCollider.base.ocFlags1 & OC1_HIT) &&
(this->bombCollider.base.oc->category == ACTORCAT_ENEMY))) {
this->unk_200 = 1;
this->isFuseEnabled = 1;
this->timer = 0;
} else {
// if a lit stick touches the bomb, set timer to 100
@@ -376,7 +376,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) {
}
}
if (this->unk_200 != 0) {
if (this->isFuseEnabled != 0) {
dustAccel.y = 0.2f;
effPos = thisx->world.pos;
effPos.y += 25.0f;
@@ -15,7 +15,7 @@ typedef struct EnBombf {
/* 0x01B8 */ ColliderJntSphElement explosionColliderItems[1];
/* 0x01F8 */ s16 timer;
/* 0x01FC */ EnBombfActionFunc actionFunc;
/* 0x0200 */ s32 unk_200;
/* 0x0200 */ s32 isFuseEnabled;
/* 0x0204 */ u8 bumpOn;
/* 0x0206 */ s16 flashSpeedScale;
/* 0x0208 */ f32 flashIntensity;
@@ -737,6 +737,8 @@ void EnBox_CreateExtraChestTextures() {
gsDPSetTextureImage(G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gChristmasGreenTreasureChestSideAndTopTex),
};
Gfx gNoOp[] = { gsDPNoOp() };
Gfx* frontCmd = ResourceMgr_LoadGfxByName(gTreasureChestChestFrontDL);
int frontIndex = 0;
while (frontCmd->words.w0 >> 24 != G_ENDDL) {
@@ -745,6 +747,20 @@ void EnBox_CreateExtraChestTextures() {
gKeyTreasureChestChestFrontDL[frontIndex] = *frontCmd;
gChristmasRedTreasureChestChestFrontDL[frontIndex] = *frontCmd;
gChristmasGreenTreasureChestChestFrontDL[frontIndex] = *frontCmd;
// Set the second instruction of img OTR hash opcode to noop, since we will replace it with the
// OTR filepath opcode below
if (frontCmd->words.w0 >> 24 == G_SETTIMG_OTR_HASH) {
frontIndex++;
++frontCmd;
gSkullTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
gGoldTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
gKeyTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
gChristmasRedTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
gChristmasGreenTreasureChestChestFrontDL[frontIndex] = gNoOp[0];
}
frontIndex++;
++frontCmd;
}
@@ -783,6 +799,20 @@ void EnBox_CreateExtraChestTextures() {
gKeyTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
gChristmasRedTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
gChristmasGreenTreasureChestChestSideAndLidDL[sideIndex] = *sideCmd;
// Set the second instruction of img OTR hash opcode to noop, since we will replace it with the
// OTR filepath opcode below
if (sideCmd->words.w0 >> 24 == G_SETTIMG_OTR_HASH) {
sideIndex++;
++sideCmd;
gSkullTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
gGoldTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
gKeyTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
gChristmasRedTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
gChristmasGreenTreasureChestChestSideAndLidDL[sideIndex] = gNoOp[0];
}
sideIndex++;
++sideCmd;
}
+20 -10
View File
@@ -437,17 +437,23 @@ void EnKz_SetupMweep(EnKz* this, PlayState* play) {
Vec3f pos;
Vec3f initPos;
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);
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);
}
pos = this->actor.world.pos;
initPos = this->actor.home.pos;
pos.y += 60.0f;
initPos.y += -100.0f;
initPos.z += 260.0f;
Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos);
Player_SetCsActionWithHaltedActors(play, &this->actor, 8);
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);
this->actionFunc = EnKz_Mweep;
}
@@ -462,7 +468,9 @@ void EnKz_Mweep(EnKz* this, PlayState* play) {
pos.y += 60.0f;
initPos.y += -100.0f;
initPos.z += 260.0f;
Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos);
if (GameInteractor_Should(VB_PLAY_MWEEP_CS, true)) {
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);
@@ -477,9 +485,11 @@ void EnKz_Mweep(EnKz* this, PlayState* play) {
}
void EnKz_StopMweep(EnKz* this, PlayState* play) {
Play_ChangeCameraStatus(play, this->gameplayCamera, CAM_STAT_ACTIVE);
Play_ClearCamera(play, this->cutsceneCamera);
Player_SetCsActionWithHaltedActors(play, &this->actor, 7);
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);
}
this->actionFunc = EnKz_Wait;
}
@@ -108,7 +108,8 @@ void OceffWipe4_Draw(Actor* thisx, PlayState* play) {
gSPDisplayList(POLY_XLU_DISP++, sMaterial2DL);
gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 64, 1,
scroll * (-1), scroll, 32, 32));
gSPDisplayListOffset(POLY_XLU_DISP++, sMaterial2DL, 11);
// SOH [Port] Index adjust 11 -> 14 (for LUS marker and load texture) to account for our extraction size changes
gSPDisplayListOffset(POLY_XLU_DISP++, sMaterial2DL, 11 + 2 + 1);
CLOSE_DISPS(play->state.gfxCtx);
}