Add save state wiring for Barinade, Bongo Bongo, & Morpha (#6914)

Rename various variables across codebase to match decomp,
many had been renamed when exposed for previous save state mechanism
This commit is contained in:
Philip Dubé
2026-07-12 22:35:19 +00:00
committed by GitHub
parent ba08197d3b
commit 66bb7888b0
38 changed files with 1304 additions and 1240 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ extern "C"
extern u8 D_8011FB34;
extern u8 D_8011FB38;
extern u8 gSkyboxBlendingEnabled;
extern u16 gTimeIncrement;
extern u16 gTimeSpeed;
extern struct_8011FC1C D_8011FC1C[][9];
extern SkyboxFile gSkyboxFiles[];
extern s32 gZeldaArenaLogSeverity;
@@ -4,7 +4,7 @@
extern "C" {
#include "src/overlays/actors/ovl_En_Insect/z_en_insect.h"
extern s16 D_80A7DEB8;
extern s16 sDroppedCount;
}
static void OnActorInitNoBugsDespawn(void* refActor) {
@@ -12,7 +12,7 @@ static void OnActorInitNoBugsDespawn(void* refActor) {
if ((insect->actor.params & 2) && insect->soilActor == NULL) {
insect->insectFlags &= ~4;
D_80A7DEB8--;
sDroppedCount--;
}
}
@@ -22,7 +22,7 @@ typedef enum {
// #### `result`
// ```c
// sBgPoEventPuzzleState == 0xF
// sPuzzleState == 0xF
// ```
// #### `args`
// - None
+12
View File
@@ -28,7 +28,10 @@ extern "C" void BgRelayObjects_SaveState(SaveStateCtx* ctx);
extern "C" void BgSpot18Basket_SaveState(SaveStateCtx* ctx);
extern "C" void BossGanon_SaveState(SaveStateCtx* ctx);
extern "C" void BossGanon2_SaveState(SaveStateCtx* ctx);
extern "C" void BossMo_SaveState(SaveStateCtx* ctx);
extern "C" void BossSst_SaveState(SaveStateCtx* ctx);
extern "C" void BossTw_SaveState(SaveStateCtx* ctx);
extern "C" void BossVa_SaveState(SaveStateCtx* ctx);
extern "C" void Demo6k_SaveState(SaveStateCtx* ctx);
extern "C" void DemoDu_SaveState(SaveStateCtx* ctx);
extern "C" void DemoKekkai_SaveState(SaveStateCtx* ctx);
@@ -123,7 +126,10 @@ typedef struct SaveStateInfo {
std::unique_ptr<uint8_t[]> bgSpot18BasketState;
std::unique_ptr<uint8_t[]> bossGanonState;
std::unique_ptr<uint8_t[]> bossGanon2State;
std::unique_ptr<uint8_t[]> bossMoState;
std::unique_ptr<uint8_t[]> bossSstState;
std::unique_ptr<uint8_t[]> bossTwState;
std::unique_ptr<uint8_t[]> bossVaState;
std::unique_ptr<uint8_t[]> demo6kState;
std::unique_ptr<uint8_t[]> demoDuState;
std::unique_ptr<uint8_t[]> demoKekkaiState;
@@ -254,7 +260,10 @@ void SaveState::SaveOverlayStaticData(void) {
SaveOverlayState(info->bgSpot18BasketState, BgSpot18Basket_SaveState);
SaveOverlayState(info->bossGanonState, BossGanon_SaveState);
SaveOverlayState(info->bossGanon2State, BossGanon2_SaveState);
SaveOverlayState(info->bossMoState, BossMo_SaveState);
SaveOverlayState(info->bossSstState, BossSst_SaveState);
SaveOverlayState(info->bossTwState, BossTw_SaveState);
SaveOverlayState(info->bossVaState, BossVa_SaveState);
SaveOverlayState(info->demo6kState, Demo6k_SaveState);
SaveOverlayState(info->demoDuState, DemoDu_SaveState);
SaveOverlayState(info->demoKekkaiState, DemoKekkai_SaveState);
@@ -296,7 +305,10 @@ void SaveState::LoadOverlayStaticData(void) {
LoadOverlayState(info->bgSpot18BasketState, BgSpot18Basket_SaveState);
LoadOverlayState(info->bossGanonState, BossGanon_SaveState);
LoadOverlayState(info->bossGanon2State, BossGanon2_SaveState);
LoadOverlayState(info->bossMoState, BossMo_SaveState);
LoadOverlayState(info->bossSstState, BossSst_SaveState);
LoadOverlayState(info->bossTwState, BossTw_SaveState);
LoadOverlayState(info->bossVaState, BossVa_SaveState);
LoadOverlayState(info->demo6kState, Demo6k_SaveState);
LoadOverlayState(info->demoDuState, DemoDu_SaveState);
LoadOverlayState(info->demoKekkaiState, DemoKekkai_SaveState);
@@ -5,7 +5,7 @@ extern "C" {
#include "functions.h"
#include "variables.h"
extern PlayState* gPlayState;
extern f32 D_80130F28;
extern f32 sRelativeOcarinaVolume;
}
/**
@@ -53,7 +53,7 @@ void Anchor::HandlePacket_OcarinaSfx(nlohmann::json payload) {
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, client.ocarinaBend - 1);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, note);
Audio_PlaySoundGeneral(NA_SE_OC_OCARINA, &client.player->actor.projectedPos, 4, &client.ocarinaModulator,
&D_80130F28, &gSfxDefaultReverb);
&sRelativeOcarinaVolume, &gSfxDefaultReverb);
} else if ((client.ocarinaNote != 0xFF) && (note == 0xFF)) {
Audio_StopSfxById(NA_SE_OC_OCARINA);
}
+1 -1
View File
@@ -259,7 +259,7 @@ bool Scene_CommandTimeSettings(PlayState* play, SOH::ISceneCommand* cmd) {
}
if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) {
gTimeIncrement = play->envCtx.timeIncrement;
gTimeSpeed = play->envCtx.timeIncrement;
}
play->envCtx.sunPos.x = -(Math_SinS(gSaveContext.dayTime - 0x8000) * 120.0f) * 25.0f;
+279 -270
View File
@@ -849,24 +849,24 @@ s32 sOcarinaB4BtnMap = BTN_CLEFT;
s32 sOcarinaA4BtnMap = BTN_CRIGHT;
s32 sOcarinaF4BtnMap = BTN_CDOWN;
s32 sOcarinaD4BtnMap = BTN_A;
static u8 sOcarinaInpEnabled = 0;
static s8 D_80130F10 = 0; // "OCA", ocarina active?
static u8 sCurOcarinaBtnVal = 0xFF;
static u8 sPrevOcarinaNoteVal = 0;
static u8 sCurOcarinaBtnIdx = 0; // note index?
static u8 sLearnSongLastBtn = 0;
static f32 D_80130F24 = 1.0f;
f32 D_80130F28 = 87.0f / 127.0f;
static s8 D_80130F2C = 0; // pitch?
static s8 D_80130F30 = 0x57;
static s8 D_80130F34 = 0;
static u8 sIsOcarinaInputEnabled = 0;
static s8 sOcarinaInstrumentId = 0; // "OCA", ocarina active?
static u8 sCurOcarinaPitch = 0xFF;
static u8 sPrevOcarinaPitch = 0;
static u8 sCurOcarinaButtonIndex = 0; // note index?
static u8 sMusicStaffPrevPitch = 0;
static f32 sCurOcarinaBendFreq = 1.0f;
f32 sRelativeOcarinaVolume = 87.0f / 127.0f;
static s8 sCurOcarinaBendIndex = 0; // pitch?
static s8 sCurOcarinaVolume = 0x57;
static s8 sCurOcarinaVibrato = 0;
static u8 sPlaybackState = 0; // 80130F38
static u32 D_80130F3C = 0; // "SEQ"
static u32 sNotePlaybackTimer = 0;
static u32 sOcarinaFlags = 0; // "SEQ"
static u32 sPlaybackNoteTimer = 0;
static u16 sPlaybackNotePos = 0;
static u16 sStaffPlaybackPos = 0;
static u16 sPlaybackStaffPos = 0;
u16 D_80130F4C = 0;
static u8 sDisplayedNoteValue = 0xFF; // Note to display on screen?
static u8 sPlaybackPitch = 0xFF; // Note to display on screen?
u8 sNotePlaybackVolume = 0;
u8 sNotePlaybackVibrato = 0;
s8 sNotePlaybackTone = 0;
@@ -1232,63 +1232,63 @@ typedef struct {
s8 y;
} OcarinaStick;
OcarinaStick sCurOcaStick;
static u32 sCurOcarinaBtnPress;
static u32 D_8016BA10;
static u32 sPrevOcarinaBtnPress;
static s32 D_8016BA18;
static u32 sOcarinaInputButtonCur;
static u32 sOcarinaInputButtonStart;
static u32 sOcarinaInputButtonPrev;
static s32 sOcarinaInputButtonPress;
static s32 D_8016BA1C;
static u8 sCurOcarinaSong[8];
static u8 sOcarinaSongAppendPos;
static u8 sCurOcarinaSongWithoutMusicStaff[8];
static u8 sOcarinaWithoutMusicStaffPos;
static u8 sOcarinaHasStartedSong;
static u8 sOcarinaSongNoteStartIdx;
static u8 sOcarinaSongCnt;
static u16 sOcarinaAvailSongs;
static u8 sStaffPlayingPos;
static u16 sLearnSongPos[0x10];
static u16 D_8016BA50[0x10];
static u16 D_8016BA70[0x10];
static u8 sLearnSongExpectedNote[0x10];
static OcarinaNote D_8016BAA0;
static u8 sAudioHasMalonBgm;
static f32 sAudioMalonBgmDist;
static u8 sFirstOcarinaSongIndex;
static u8 sLastOcarinaSongIndex;
static u16 sAvailOcarinaSongFlags;
static u8 sStaffOcarinaPlayingPos;
static u16 sMusicStaffPos[0x10];
static u16 sMusicStaffCurHeldLength[0x10];
static u16 sMusicStaffExpectedLength[0x10];
static u8 sMusicStaffExpectedPitch[0x10];
static OcarinaNote sScarecrowsLongSongSecondNote;
static u8 sIsMalonSinging;
static f32 sMalonSingingDist;
#define AUDIO_OCA_SHIP_SAVESTATE_FIELDS(F) \
F(sOcarinaInpEnabled) \
F(D_80130F10) \
F(sCurOcarinaBtnVal) \
F(sPrevOcarinaNoteVal) \
F(sCurOcarinaBtnIdx) \
F(sLearnSongLastBtn) \
F(D_80130F24) \
F(D_80130F28) \
F(D_80130F2C) \
F(D_80130F30) \
F(D_80130F34) \
F(sIsOcarinaInputEnabled) \
F(sOcarinaInstrumentId) \
F(sCurOcarinaPitch) \
F(sPrevOcarinaPitch) \
F(sCurOcarinaButtonIndex) \
F(sMusicStaffPrevPitch) \
F(sCurOcarinaBendFreq) \
F(sRelativeOcarinaVolume) \
F(sCurOcarinaBendIndex) \
F(sCurOcarinaVolume) \
F(sCurOcarinaVibrato) \
F(sPlaybackState) \
F(D_80130F3C) \
F(sNotePlaybackTimer) \
F(sOcarinaFlags) \
F(sPlaybackNoteTimer) \
F(sPlaybackNotePos) \
F(sStaffPlaybackPos) \
F(sCurOcarinaBtnPress) \
F(D_8016BA10) \
F(sPrevOcarinaBtnPress) \
F(D_8016BA18) \
F(sPlaybackStaffPos) \
F(sOcarinaInputButtonCur) \
F(sOcarinaInputButtonStart) \
F(sOcarinaInputButtonPrev) \
F(sOcarinaInputButtonPress) \
F(D_8016BA1C) \
F(sCurOcarinaSong) \
F(sOcarinaSongAppendPos) \
F(sCurOcarinaSongWithoutMusicStaff) \
F(sOcarinaWithoutMusicStaffPos) \
F(sOcarinaHasStartedSong) \
F(sOcarinaSongNoteStartIdx) \
F(sOcarinaSongCnt) \
F(sOcarinaAvailSongs) \
F(sStaffPlayingPos) \
F(sLearnSongPos) \
F(D_8016BA50) \
F(D_8016BA70) \
F(sLearnSongExpectedNote) \
F(D_8016BAA0) \
F(sAudioHasMalonBgm) \
F(sAudioMalonBgmDist) \
F(sDisplayedNoteValue)
F(sFirstOcarinaSongIndex) \
F(sLastOcarinaSongIndex) \
F(sAvailOcarinaSongFlags) \
F(sStaffOcarinaPlayingPos) \
F(sMusicStaffPos) \
F(sMusicStaffCurHeldLength) \
F(sMusicStaffExpectedLength) \
F(sMusicStaffExpectedPitch) \
F(sScarecrowsLongSongSecondNote) \
F(sIsMalonSinging) \
F(sMalonSingingDist) \
F(sPlaybackPitch)
SHIP_SAVESTATE_DEFINE(AudioOca, AUDIO_OCA_SHIP_SAVESTATE_FIELDS)
// Start debug bss
@@ -1343,26 +1343,26 @@ void Audio_GetOcaInput(void) {
Input* input = &inputs[0];
u32 sp18;
sp18 = sCurOcarinaBtnPress;
sp18 = sOcarinaInputButtonCur;
PadMgr_RequestPadData(&gPadMgr, inputs, 0);
sCurOcarinaBtnPress = input->cur.button;
sPrevOcarinaBtnPress = sp18;
sOcarinaInputButtonCur = input->cur.button;
sOcarinaInputButtonPrev = sp18;
sCurOcaStick.x = input->rel.stick_x;
sCurOcaStick.y = input->rel.stick_y;
s8 rstick_x = input->cur.right_stick_x;
s8 rstick_y = input->cur.right_stick_y;
const s8 sensitivity = 64;
if (rstick_x > sensitivity) {
sCurOcarinaBtnPress |= BTN_CUSTOM_RSTICK_RIGHT;
sOcarinaInputButtonCur |= BTN_CUSTOM_RSTICK_RIGHT;
}
if (rstick_x < -sensitivity) {
sCurOcarinaBtnPress |= BTN_CUSTOM_RSTICK_LEFT;
sOcarinaInputButtonCur |= BTN_CUSTOM_RSTICK_LEFT;
}
if (rstick_y > sensitivity) {
sCurOcarinaBtnPress |= BTN_CUSTOM_RSTICK_UP;
sOcarinaInputButtonCur |= BTN_CUSTOM_RSTICK_UP;
}
if (rstick_y < -sensitivity) {
sCurOcarinaBtnPress |= BTN_CUSTOM_RSTICK_DOWN;
sOcarinaInputButtonCur |= BTN_CUSTOM_RSTICK_DOWN;
}
}
@@ -1389,7 +1389,7 @@ u8 Audio_OcaGetPlayingState(void) {
if (D_80131878 != 0) {
ret = D_80131878 - 1;
D_80131878 = 0;
} else if (D_80130F3C != 0) {
} else if (sOcarinaFlags != 0) {
ret = 0xFE;
} else {
ret = 0xFF;
@@ -1443,25 +1443,25 @@ void func_800ECC04(u16 flg) {
}
if (flg != 0xFFFF) {
D_80130F3C = 0x80000000 + (u32)flg;
sOcarinaSongNoteStartIdx = 0;
sOcarinaSongCnt = 0xE;
sOcarinaFlags = 0x80000000 + (u32)flg;
sFirstOcarinaSongIndex = 0;
sLastOcarinaSongIndex = 0xE;
if (flg != 0xA000) {
sOcarinaSongCnt--;
sLastOcarinaSongIndex--;
}
sOcarinaAvailSongs = flg & 0x3FFF;
sAvailOcarinaSongFlags = flg & 0x3FFF;
D_8013187C = 8;
sOcarinaHasStartedSong = 0;
D_80131878 = 0;
sStaffPlayingPos = 0;
sStaffOcarinaPlayingPos = 0;
sPlayingStaff.state = Audio_OcaGetPlayingState();
sOcarinaInpEnabled = 1;
sIsOcarinaInputEnabled = 1;
D_80130F4C = 0;
for (i = 0; i < 0xE; i++) {
sLearnSongPos[i] = 0;
D_8016BA50[i] = 0;
D_8016BA70[i] = 0;
sLearnSongExpectedNote[i] = 0;
sMusicStaffPos[i] = 0;
sMusicStaffCurHeldLength[i] = 0;
sMusicStaffExpectedLength[i] = 0;
sMusicStaffExpectedPitch[i] = 0;
}
if (flg & 0x8000) {
@@ -1469,22 +1469,22 @@ void func_800ECC04(u16 flg) {
}
if (flg & 0x4000) {
sOcarinaSongAppendPos = 0;
sOcarinaWithoutMusicStaffPos = 0;
}
if (flg & 0xD000) {
func_800ECB7C(OCARINA_SONG_SCARECROW);
}
} else {
D_80130F3C = 0;
sOcarinaInpEnabled = 0;
sOcarinaFlags = 0;
sIsOcarinaInputEnabled = 0;
}
}
void func_800ECDBC(void) {
if (sCurOcarinaBtnVal != 0xFF && sOcarinaHasStartedSong == 0) {
if (sCurOcarinaPitch != 0xFF && sOcarinaHasStartedSong == 0) {
sOcarinaHasStartedSong = 1;
sLearnSongLastBtn = 0xFF;
sMusicStaffPrevPitch = 0xFF;
}
}
@@ -1501,76 +1501,77 @@ void func_800ECDF8(void) {
func_800ECDBC();
if (sOcarinaHasStartedSong) {
if ((D_80130F2C < 0 ? -D_80130F2C : D_80130F2C) >= 0x15) {
D_80130F3C = 0;
if ((sCurOcarinaBendIndex < 0 ? -sCurOcarinaBendIndex : sCurOcarinaBendIndex) >= 0x15) {
sOcarinaFlags = 0;
return;
}
// clang-format off
if (sPrevOcarinaNoteVal == sCurOcarinaBtnVal || sCurOcarinaBtnVal == 0xFF) { inputChanged = 1; }
if (sPrevOcarinaPitch == sCurOcarinaPitch || sCurOcarinaPitch == 0xFF) { inputChanged = 1; }
// clang-format on
for (i = sOcarinaSongNoteStartIdx; i < sOcarinaSongCnt; i++) {
for (i = sFirstOcarinaSongIndex; i < sLastOcarinaSongIndex; i++) {
sh = 1 << i;
if (sOcarinaAvailSongs & sh) {
D_8016BA50[i] = D_8016BA70[i] + 0x12;
if (sAvailOcarinaSongFlags & sh) {
sMusicStaffCurHeldLength[i] = sMusicStaffExpectedLength[i] + 0x12;
if (inputChanged) {
// (pointless if check, this is always true)
if ((D_8016BA50[i] >= D_8016BA70[i] - 0x12) && (D_8016BA50[i] >= D_8016BA70[i] + 0x12) &&
(sOcarinaSongs[i][sLearnSongPos[i]].unk_02 == 0) &&
(sLearnSongLastBtn == sLearnSongExpectedNote[i])) {
if ((sMusicStaffCurHeldLength[i] >= sMusicStaffExpectedLength[i] - 0x12) &&
(sMusicStaffCurHeldLength[i] >= sMusicStaffExpectedLength[i] + 0x12) &&
(sOcarinaSongs[i][sMusicStaffPos[i]].unk_02 == 0) &&
(sMusicStaffPrevPitch == sMusicStaffExpectedPitch[i])) {
D_80131878 = i + 1;
sOcarinaInpEnabled = 0;
D_80130F3C = 0;
sIsOcarinaInputEnabled = 0;
sOcarinaFlags = 0;
}
} else if (D_8016BA50[i] >= (D_8016BA70[i] - 0x12)) {
if (sLearnSongLastBtn != 0xFF) {
if (sLearnSongLastBtn == sLearnSongExpectedNote[i]) {
} else if (sMusicStaffCurHeldLength[i] >= (sMusicStaffExpectedLength[i] - 0x12)) {
if (sMusicStaffPrevPitch != 0xFF) {
if (sMusicStaffPrevPitch == sMusicStaffExpectedPitch[i]) {
if (i == 12) {
D_8016BA50[i] = 0;
sMusicStaffCurHeldLength[i] = 0;
}
} else {
sOcarinaAvailSongs ^= sh;
sAvailOcarinaSongFlags ^= sh;
}
}
prevNote = &sOcarinaSongs[i][sLearnSongPos[i]];
note = &sOcarinaSongs[i][++sLearnSongPos[i]];
D_8016BA70[i] = prevNote->unk_02;
sLearnSongExpectedNote[i] = prevNote->noteIdx;
prevNote = &sOcarinaSongs[i][sMusicStaffPos[i]];
note = &sOcarinaSongs[i][++sMusicStaffPos[i]];
sMusicStaffExpectedLength[i] = prevNote->unk_02;
sMusicStaffExpectedPitch[i] = prevNote->noteIdx;
if (sCurOcarinaBtnVal != sLearnSongExpectedNote[i]) {
sOcarinaAvailSongs ^= sh;
if (sCurOcarinaPitch != sMusicStaffExpectedPitch[i]) {
sAvailOcarinaSongFlags ^= sh;
}
while (prevNote->noteIdx == note->noteIdx ||
(note->noteIdx == OCARINA_NOTE_INVALID && note->unk_02 != 0)) {
D_8016BA70[i] += note->unk_02;
prevNote = &sOcarinaSongs[i][sLearnSongPos[i]];
note = &sOcarinaSongs[i][sLearnSongPos[i] + 1];
sLearnSongPos[i]++;
sMusicStaffExpectedLength[i] += note->unk_02;
prevNote = &sOcarinaSongs[i][sMusicStaffPos[i]];
note = &sOcarinaSongs[i][sMusicStaffPos[i] + 1];
sMusicStaffPos[i]++;
}
} else if (D_8016BA50[i] < 0xA) {
} else if (sMusicStaffCurHeldLength[i] < 0xA) {
sp57 = -1;
D_8016BA50[i] = 0;
sLearnSongLastBtn = sCurOcarinaBtnVal;
sMusicStaffCurHeldLength[i] = 0;
sMusicStaffPrevPitch = sCurOcarinaPitch;
} else {
sOcarinaAvailSongs ^= sh;
sAvailOcarinaSongFlags ^= sh;
}
}
if (sOcarinaAvailSongs == 0 && sStaffPlayingPos >= D_8013187C) {
sOcarinaInpEnabled = 0;
if (CHECK_BTN_ANY(D_80130F3C, BTN_B) && sCurOcarinaBtnVal == sOcarinaSongs[i][0].noteIdx) {
D_80130F4C = D_80130F3C;
if (sAvailOcarinaSongFlags == 0 && sStaffOcarinaPlayingPos >= D_8013187C) {
sIsOcarinaInputEnabled = 0;
if (CHECK_BTN_ANY(sOcarinaFlags, BTN_B) && sCurOcarinaPitch == sOcarinaSongs[i][0].noteIdx) {
D_80130F4C = sOcarinaFlags;
}
D_80130F3C = 0;
sOcarinaFlags = 0;
return;
}
}
if (!inputChanged) {
sLearnSongLastBtn = sCurOcarinaBtnVal;
sStaffPlayingPos += sp57 + 1;
sMusicStaffPrevPitch = sCurOcarinaPitch;
sStaffOcarinaPlayingPos += sp57 + 1;
}
}
}
@@ -1588,40 +1589,42 @@ void func_800ED200(void) {
disableSongBtnMap = BTN_L;
}
if (CHECK_BTN_ANY(sCurOcarinaBtnPress, disableSongBtnMap) &&
CHECK_BTN_ANY(sCurOcarinaBtnPress, sOcarinaAllowedBtnMask)) {
func_800ECC04((u16)D_80130F3C);
if (CHECK_BTN_ANY(sOcarinaInputButtonCur, disableSongBtnMap) &&
CHECK_BTN_ANY(sOcarinaInputButtonCur, sOcarinaAllowedBtnMask)) {
func_800ECC04((u16)sOcarinaFlags);
return;
}
func_800ECDBC();
if (sOcarinaHasStartedSong) {
if ((sPrevOcarinaNoteVal != sCurOcarinaBtnVal) && (sCurOcarinaBtnVal != 0xFF)) {
sStaffPlayingPos++;
if (sStaffPlayingPos >= 9) {
sStaffPlayingPos = 1;
if ((sPrevOcarinaPitch != sCurOcarinaPitch) && (sCurOcarinaPitch != 0xFF)) {
sStaffOcarinaPlayingPos++;
if (sStaffOcarinaPlayingPos >= 9) {
sStaffOcarinaPlayingPos = 1;
}
if (sOcarinaSongAppendPos == 8) {
if (sOcarinaWithoutMusicStaffPos == 8) {
for (i = 0; i < 7; i++) {
sCurOcarinaSong[i] = sCurOcarinaSong[i + 1];
sCurOcarinaSongWithoutMusicStaff[i] = sCurOcarinaSongWithoutMusicStaff[i + 1];
}
} else {
sOcarinaSongAppendPos++;
sOcarinaWithoutMusicStaffPos++;
}
if ((D_80130F2C < 0 ? -D_80130F2C : D_80130F2C) >= 0x15) {
sCurOcarinaSong[sOcarinaSongAppendPos - 1] = 0xFF;
if ((sCurOcarinaBendIndex < 0 ? -sCurOcarinaBendIndex : sCurOcarinaBendIndex) >= 0x15) {
sCurOcarinaSongWithoutMusicStaff[sOcarinaWithoutMusicStaffPos - 1] = 0xFF;
} else {
sCurOcarinaSong[sOcarinaSongAppendPos - 1] = sCurOcarinaBtnVal;
sCurOcarinaSongWithoutMusicStaff[sOcarinaWithoutMusicStaffPos - 1] = sCurOcarinaPitch;
}
for (i = sOcarinaSongNoteStartIdx; i < sOcarinaSongCnt; i++) {
if (sOcarinaAvailSongs & (u16)(1 << i)) {
for (j = 0, k = 0;
j < gOcarinaSongNotes[i].len && k == 0 && sOcarinaSongAppendPos >= gOcarinaSongNotes[i].len;) {
temp_v0 = sCurOcarinaSong[(sOcarinaSongAppendPos - gOcarinaSongNotes[i].len) + j];
for (i = sFirstOcarinaSongIndex; i < sLastOcarinaSongIndex; i++) {
if (sAvailOcarinaSongFlags & (u16)(1 << i)) {
for (j = 0, k = 0; j < gOcarinaSongNotes[i].len && k == 0 &&
sOcarinaWithoutMusicStaffPos >= gOcarinaSongNotes[i].len;) {
temp_v0 =
sCurOcarinaSongWithoutMusicStaff[(sOcarinaWithoutMusicStaffPos - gOcarinaSongNotes[i].len) +
j];
if (temp_v0 == sOcarinaNoteValues[gOcarinaSongNotes[i].notesIdx[j]]) {
j++;
} else {
@@ -1631,8 +1634,8 @@ void func_800ED200(void) {
if (j == gOcarinaSongNotes[i].len) {
D_80131878 = i + 1;
sOcarinaInpEnabled = 0;
D_80130F3C = 0;
sIsOcarinaInputEnabled = 0;
sOcarinaFlags = 0;
}
}
}
@@ -1644,46 +1647,51 @@ void func_800ED458(s32 arg0) {
u32 phi_v1_2;
bool customControls = CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0);
if (D_80130F3C != 0 && sOcarinaDropInputTimer != 0) {
if (sOcarinaFlags != 0 && sOcarinaDropInputTimer != 0) {
sOcarinaDropInputTimer--;
if (!CVarGetInteger(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 0)) {
return;
}
}
if ((D_8016BA10 == 0) ||
((D_8016BA10 & sOcarinaAllowedBtnMask) != (sCurOcarinaBtnPress & sOcarinaAllowedBtnMask))) {
D_8016BA10 = 0;
sCurOcarinaBtnVal = 0xFF;
sCurOcarinaBtnIdx = 0xFF;
phi_v1_2 = (sCurOcarinaBtnPress & sOcarinaAllowedBtnMask) & (sPrevOcarinaBtnPress & sOcarinaAllowedBtnMask);
if (!(D_8016BA18 & phi_v1_2) && (sCurOcarinaBtnPress != 0)) {
D_8016BA18 = sCurOcarinaBtnPress;
if ((sOcarinaInputButtonStart == 0) ||
((sOcarinaInputButtonStart & sOcarinaAllowedBtnMask) != (sOcarinaInputButtonCur & sOcarinaAllowedBtnMask))) {
sOcarinaInputButtonStart = 0;
sCurOcarinaPitch = 0xFF;
sCurOcarinaButtonIndex = 0xFF;
phi_v1_2 =
(sOcarinaInputButtonCur & sOcarinaAllowedBtnMask) & (sOcarinaInputButtonPrev & sOcarinaAllowedBtnMask);
if (!(sOcarinaInputButtonPress & phi_v1_2) && (sOcarinaInputButtonCur != 0)) {
sOcarinaInputButtonPress = sOcarinaInputButtonCur;
} else {
D_8016BA18 &= phi_v1_2;
sOcarinaInputButtonPress &= phi_v1_2;
}
Audio_OcaUpdateBtnMap(customControls);
if (D_8016BA18 & sOcarinaD4BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_D4, true)) {
if (sOcarinaInputButtonPress & sOcarinaD4BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_D4, true)) {
osSyncPrintf("Presss NA_KEY_D4 %08x\n", sOcarinaD4BtnMap);
sCurOcarinaBtnVal = 2;
sCurOcarinaBtnIdx = 0;
} else if (D_8016BA18 & sOcarinaF4BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_F4, true)) {
sCurOcarinaPitch = 2;
sCurOcarinaButtonIndex = 0;
} else if (sOcarinaInputButtonPress & sOcarinaF4BtnMap &&
GameInteractor_Should(VB_HAVE_OCARINA_NOTE_F4, true)) {
osSyncPrintf("Presss NA_KEY_F4 %08x\n", sOcarinaF4BtnMap);
sCurOcarinaBtnVal = 5;
sCurOcarinaBtnIdx = 1;
} else if (D_8016BA18 & sOcarinaA4BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_A4, true)) {
sCurOcarinaPitch = 5;
sCurOcarinaButtonIndex = 1;
} else if (sOcarinaInputButtonPress & sOcarinaA4BtnMap &&
GameInteractor_Should(VB_HAVE_OCARINA_NOTE_A4, true)) {
osSyncPrintf("Presss NA_KEY_A4 %08x\n", sOcarinaA4BtnMap);
sCurOcarinaBtnVal = 9;
sCurOcarinaBtnIdx = 2;
} else if (D_8016BA18 & sOcarinaB4BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_B4, true)) {
sCurOcarinaPitch = 9;
sCurOcarinaButtonIndex = 2;
} else if (sOcarinaInputButtonPress & sOcarinaB4BtnMap &&
GameInteractor_Should(VB_HAVE_OCARINA_NOTE_B4, true)) {
osSyncPrintf("Presss NA_KEY_B4 %08x\n", sOcarinaA4BtnMap);
sCurOcarinaBtnVal = 0xB;
sCurOcarinaBtnIdx = 3;
} else if (D_8016BA18 & sOcarinaD5BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_D5, true)) {
sCurOcarinaPitch = 0xB;
sCurOcarinaButtonIndex = 3;
} else if (sOcarinaInputButtonPress & sOcarinaD5BtnMap &&
GameInteractor_Should(VB_HAVE_OCARINA_NOTE_D5, true)) {
osSyncPrintf("Presss NA_KEY_D5 %08x\n", sOcarinaD5BtnMap);
sCurOcarinaBtnVal = 0xE;
sCurOcarinaBtnIdx = 4;
sCurOcarinaPitch = 0xE;
sCurOcarinaButtonIndex = 4;
}
u32 noteSharpBtnMap;
@@ -1692,9 +1700,9 @@ void func_800ED458(s32 arg0) {
} else {
noteSharpBtnMap = BTN_R;
}
if ((sCurOcarinaBtnVal != 0xFF) && (sCurOcarinaBtnPress & noteSharpBtnMap) && (sRecordingState != 2)) {
sCurOcarinaBtnIdx += 0x80;
sCurOcarinaBtnVal++;
if ((sCurOcarinaPitch != 0xFF) && (sOcarinaInputButtonCur & noteSharpBtnMap) && (sRecordingState != 2)) {
sCurOcarinaButtonIndex += 0x80;
sCurOcarinaPitch++;
}
u32 noteFlatBtnMap;
@@ -1703,39 +1711,40 @@ void func_800ED458(s32 arg0) {
} else {
noteFlatBtnMap = BTN_Z;
}
if ((sCurOcarinaBtnVal != 0xFF) && (sCurOcarinaBtnPress & noteFlatBtnMap) && (sRecordingState != 2)) {
sCurOcarinaBtnIdx += 0x40;
sCurOcarinaBtnVal--;
if ((sCurOcarinaPitch != 0xFF) && (sOcarinaInputButtonCur & noteFlatBtnMap) && (sRecordingState != 2)) {
sCurOcarinaButtonIndex += 0x40;
sCurOcarinaPitch--;
}
if (sRecordingState != 2) {
D_80130F2C = sCurOcaStick.y;
D_80130F24 = Audio_OcaAdjStick(D_80130F2C);
sCurOcarinaBendIndex = sCurOcaStick.y;
sCurOcarinaBendFreq = Audio_OcaAdjStick(sCurOcarinaBendIndex);
D_80130F34 = (sCurOcaStick.x < 0 ? -sCurOcaStick.x : sCurOcaStick.x) >> 2;
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD06, D_80130F34);
sCurOcarinaVibrato = (sCurOcaStick.x < 0 ? -sCurOcaStick.x : sCurOcaStick.x) >> 2;
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD06, sCurOcarinaVibrato);
} else {
D_80130F2C = 0;
D_80130F24 = 1.0f;
sCurOcarinaBendIndex = 0;
sCurOcarinaBendFreq = 1.0f;
}
if ((sCurOcarinaBtnVal != 0xFF) && (sPrevOcarinaNoteVal != sCurOcarinaBtnVal)) {
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, D_80130F10 - 1);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, sCurOcarinaBtnVal);
Audio_PlaySoundGeneral(NA_SE_OC_OCARINA, &gSfxDefaultPos, 4, &D_80130F24, &D_80130F28, &gSfxDefaultReverb);
} else if ((sPrevOcarinaNoteVal != 0xFF) && (sCurOcarinaBtnVal == 0xFF)) {
if ((sCurOcarinaPitch != 0xFF) && (sPrevOcarinaPitch != sCurOcarinaPitch)) {
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, sOcarinaInstrumentId - 1);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, sCurOcarinaPitch);
Audio_PlaySoundGeneral(NA_SE_OC_OCARINA, &gSfxDefaultPos, 4, &sCurOcarinaBendFreq, &sRelativeOcarinaVolume,
&gSfxDefaultReverb);
} else if ((sPrevOcarinaPitch != 0xFF) && (sCurOcarinaPitch == 0xFF)) {
Audio_StopSfxById(NA_SE_OC_OCARINA);
}
GameInteractor_ExecuteOnOcarinaNote(sCurOcarinaBtnVal, D_80130F24, D_80130F10);
GameInteractor_ExecuteOnOcarinaNote(sCurOcarinaPitch, sCurOcarinaBendFreq, sOcarinaInstrumentId);
}
}
void func_800ED848(u8 inputEnabled) {
sOcarinaInpEnabled = inputEnabled;
sIsOcarinaInputEnabled = inputEnabled;
}
void AudioOcarina_SetInstrument(u8 arg0) {
if (D_80130F10 == arg0) {
if (sOcarinaInstrumentId == arg0) {
return;
}
@@ -1747,24 +1756,24 @@ void AudioOcarina_SetInstrument(u8 arg0) {
}
Audio_SeqCmd8(SEQ_PLAYER_SFX, 1, SFX_PLAYER_CHANNEL_OCARINA, arg0);
D_80130F10 = arg0;
sOcarinaInstrumentId = arg0;
if (arg0 == 0) {
sCurOcarinaBtnPress = 0;
sPrevOcarinaBtnPress = 0;
D_8016BA18 = 0;
D_8016BA10 = 0xFFFF;
sOcarinaInputButtonCur = 0;
sOcarinaInputButtonPrev = 0;
sOcarinaInputButtonPress = 0;
sOcarinaInputButtonStart = 0xFFFF;
func_800ED458(0);
Audio_StopSfxById(NA_SE_OC_OCARINA);
Audio_SetSoundBanksMute(0);
sPlaybackState = 0;
sStaffPlaybackPos = 0;
sOcarinaInpEnabled = 0;
D_80130F3C = 0;
sPlaybackStaffPos = 0;
sIsOcarinaInputEnabled = 0;
sOcarinaFlags = 0;
Audio_ClearBGMMute(SFX_PLAYER_CHANNEL_OCARINA);
} else {
sCurOcarinaBtnPress = 0;
sOcarinaInputButtonCur = 0;
Audio_GetOcaInput();
D_8016BA10 = sCurOcarinaBtnPress;
sOcarinaInputButtonStart = sOcarinaInputButtonCur;
Audio_QueueSeqCmdMute(SFX_PLAYER_CHANNEL_OCARINA);
}
}
@@ -1783,10 +1792,10 @@ void Audio_OcaSetSongPlayback(s8 songIdxPlusOne, s8 playbackState) {
}
sPlaybackState = playbackState;
sNotePlaybackTimer = 0;
sDisplayedNoteValue = 0xFF;
sPlaybackNoteTimer = 0;
sPlaybackPitch = 0xFF;
sPlaybackNotePos = 0;
sStaffPlaybackPos = 0;
sPlaybackStaffPos = 0;
while (sPlaybackSong[sPlaybackNotePos].noteIdx == OCARINA_NOTE_INVALID) {
sPlaybackNotePos++;
}
@@ -1797,39 +1806,39 @@ void Audio_OcaPlayback(void) {
u32 nextNoteTimerStep = 0;
if (sPlaybackState != 0) {
if (sStaffPlaybackPos == 0) {
if (sPlaybackStaffPos == 0) {
noteTimerStep = 3;
} else {
noteTimerStep = D_8016BA04 - D_80130F68;
}
if (noteTimerStep < sNotePlaybackTimer) {
sNotePlaybackTimer -= noteTimerStep;
if (noteTimerStep < sPlaybackNoteTimer) {
sPlaybackNoteTimer -= noteTimerStep;
} else {
nextNoteTimerStep = noteTimerStep - sNotePlaybackTimer;
sNotePlaybackTimer = 0;
nextNoteTimerStep = noteTimerStep - sPlaybackNoteTimer;
sPlaybackNoteTimer = 0;
}
if (sNotePlaybackTimer == 0) {
if (sPlaybackNoteTimer == 0) {
sNotePlaybackTimer = sPlaybackSong[sPlaybackNotePos].unk_02;
sPlaybackNoteTimer = sPlaybackSong[sPlaybackNotePos].unk_02;
if (sPlaybackNotePos == 1) {
sNotePlaybackTimer++;
sPlaybackNoteTimer++;
}
if (sNotePlaybackTimer == 0) {
if (sPlaybackNoteTimer == 0) {
sPlaybackState--;
if (sPlaybackState != 0) {
sPlaybackNotePos = 0;
sStaffPlaybackPos = 0;
sDisplayedNoteValue = 0xFF;
sPlaybackStaffPos = 0;
sPlaybackPitch = 0xFF;
} else {
Audio_StopSfxById(NA_SE_OC_OCARINA);
}
return;
} else {
sNotePlaybackTimer -= nextNoteTimerStep;
sPlaybackNoteTimer -= nextNoteTimerStep;
}
if (sNotePlaybackVolume != sPlaybackSong[sPlaybackNotePos].volume) {
@@ -1850,22 +1859,22 @@ void Audio_OcaPlayback(void) {
if ((sPlaybackSong[sPlaybackNotePos].volume == sPlaybackSong[sPlaybackNotePos - 1].volume &&
(sPlaybackSong[sPlaybackNotePos].vibrato == sPlaybackSong[sPlaybackNotePos - 1].vibrato) &&
(sPlaybackSong[sPlaybackNotePos].tone == sPlaybackSong[sPlaybackNotePos - 1].tone))) {
sDisplayedNoteValue = 0xFE;
sPlaybackPitch = 0xFE;
}
if (sDisplayedNoteValue != sPlaybackSong[sPlaybackNotePos].noteIdx) {
if (sPlaybackPitch != sPlaybackSong[sPlaybackNotePos].noteIdx) {
u8 tmp = sPlaybackSong[sPlaybackNotePos].noteIdx;
if (tmp == 0xA) {
sDisplayedNoteValue = tmp + sPlaybackSong[sPlaybackNotePos].semitone;
sPlaybackPitch = tmp + sPlaybackSong[sPlaybackNotePos].semitone;
} else {
sDisplayedNoteValue = tmp;
sPlaybackPitch = tmp;
}
if (sDisplayedNoteValue != 0xFF) {
sStaffPlaybackPos++;
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, D_80130F10 - 1);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, sDisplayedNoteValue & 0x3F);
if (sPlaybackPitch != 0xFF) {
sPlaybackStaffPos++;
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, sOcarinaInstrumentId - 1);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, sPlaybackPitch & 0x3F);
Audio_PlaySoundGeneral(NA_SE_OC_OCARINA, &gSfxDefaultPos, 4, &sNormalizedNotePlaybackTone,
&sNormalizedNotePlaybackVolume, &gSfxDefaultReverb);
} else {
@@ -1899,11 +1908,11 @@ void func_800EDD68(u8 arg0) {
song[sRecordSongPos].vibrato = D_8013186C;
song[sRecordSongPos].tone = D_80131870;
song[sRecordSongPos].semitone = D_80131874 & 0xC0;
D_80131864 = sCurOcarinaBtnVal;
D_80131868 = D_80130F30;
D_8013186C = D_80130F34;
D_80131870 = D_80130F2C;
D_80131874 = sCurOcarinaBtnIdx;
D_80131864 = sCurOcarinaPitch;
D_80131868 = sCurOcarinaVolume;
D_8013186C = sCurOcarinaVibrato;
D_80131870 = sCurOcarinaBendIndex;
D_80131874 = sCurOcarinaButtonIndex;
sRecordSongPos++;
if ((sRecordSongPos != 107) && (arg0 == 0)) {
@@ -1925,7 +1934,7 @@ void func_800EDD68(u8 arg0) {
song[sRecordSongPos].unk_02 = 0;
if (sRecordingState == 2) {
if (sStaffPlayingPos >= 8) {
if (sStaffOcarinaPlayingPos >= 8) {
for (i = 0; i < sRecordSongPos; i++) {
song[i] = song[i + 1];
}
@@ -1969,7 +1978,7 @@ void func_800EDD68(u8 arg0) {
sOcarinaSongs[OCARINA_SONG_SCARECROW][i] = sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][i];
}
sOcarinaInpEnabled = 0;
sIsOcarinaInputEnabled = 0;
} else {
sOcarinaSongs[OCARINA_SONG_SCARECROW][1].volume = 0xFF;
}
@@ -1996,22 +2005,22 @@ void Audio_OcaSetRecordingState(u8 recordingState) {
D_80131870 = 0;
D_80131874 = 0;
sRecordSongPos = 0;
sOcarinaInpEnabled = 1;
sStaffPlayingPos = 0;
D_8016BAA0 = sPierresSong[1];
sIsOcarinaInputEnabled = 1;
sStaffOcarinaPlayingPos = 0;
sScarecrowsLongSongSecondNote = sPierresSong[1];
} else {
if (sRecordSongPos == 0) {
sPierresSong[1] = D_8016BAA0;
sPierresSong[1] = sScarecrowsLongSongSecondNote;
} else {
if (sRecordingState == 2) {
sStaffPlayingPos = 1;
sStaffOcarinaPlayingPos = 1;
}
func_800EDD68(1);
}
sOcarinaInpEnabled = 0;
sStaffPlayingPos = 0;
sIsOcarinaInputEnabled = 0;
sStaffOcarinaPlayingPos = 0;
}
sRecordingState = recordingState;
@@ -2019,31 +2028,31 @@ void Audio_OcaSetRecordingState(u8 recordingState) {
void Audio_OcaUpdateRecordingStaff(void) {
sRecordingStaff.state = sRecordingState;
sRecordingStaff.pos = sStaffPlayingPos;
sRecordingStaff.pos = sStaffOcarinaPlayingPos;
if (sRecordingState == 0xFF) {
sRecordingState = 0;
}
}
void Audio_OcaUpdatePlayingStaff(void) {
sPlayingStaff.noteIdx = sCurOcarinaBtnIdx & 0x3F;
sPlayingStaff.noteIdx = sCurOcarinaButtonIndex & 0x3F;
sPlayingStaff.state = Audio_OcaGetPlayingState();
sPlayingStaff.pos = sStaffPlayingPos;
sPlayingStaff.pos = sStaffOcarinaPlayingPos;
}
void Audio_OcaUpdateDisplayedStaff(void) {
if ((sDisplayedNoteValue & 0x3F) < 0x10) {
sDisplayedStaff.noteIdx = Audio_OcaMapNoteValue(sDisplayedNoteValue);
if ((sPlaybackPitch & 0x3F) < 0x10) {
sDisplayedStaff.noteIdx = Audio_OcaMapNoteValue(sPlaybackPitch);
}
sDisplayedStaff.state = sPlaybackState;
if (sPlaybackSong != sPierresSong) {
sDisplayedStaff.pos = sStaffPlaybackPos;
} else if (sStaffPlaybackPos == 0) {
sDisplayedStaff.pos = sPlaybackStaffPos;
} else if (sPlaybackStaffPos == 0) {
sDisplayedStaff.pos = 0;
} else {
sDisplayedStaff.pos = ((sStaffPlaybackPos - 1) % 8) + 1;
sDisplayedStaff.pos = ((sPlaybackStaffPos - 1) % 8) + 1;
}
}
@@ -2053,7 +2062,7 @@ OcarinaStaff* Audio_OcaGetRecordingStaff(void) {
OcarinaStaff* Audio_OcaGetPlayingStaff(void) {
if (sPlayingStaff.state < 0xFE) {
D_80130F3C = 0;
sOcarinaFlags = 0;
}
return &sPlayingStaff;
}
@@ -2067,30 +2076,30 @@ void func_800EE404(void) {
if ((sRecordingState != 0) && ((D_8016BA04 - D_80131860) >= 3)) {
noteChanged = false;
if (D_80131864 != sCurOcarinaBtnVal) {
if (sCurOcarinaBtnVal != 0xFF) {
sRecordingStaff.noteIdx = sCurOcarinaBtnIdx & 0x3F;
sStaffPlayingPos++;
} else if ((sRecordingState == 2) && (sStaffPlayingPos == 8)) {
if (D_80131864 != sCurOcarinaPitch) {
if (sCurOcarinaPitch != 0xFF) {
sRecordingStaff.noteIdx = sCurOcarinaButtonIndex & 0x3F;
sStaffOcarinaPlayingPos++;
} else if ((sRecordingState == 2) && (sStaffOcarinaPlayingPos == 8)) {
func_800EDD68(1);
return;
}
if (sStaffPlayingPos > 8) {
if (sStaffOcarinaPlayingPos > 8) {
if (sRecordingState == 2) {
// notes played are over 8 and in recording mode.
func_800EDD68(1);
return;
}
sStaffPlayingPos = true;
sStaffOcarinaPlayingPos = true;
}
noteChanged = true;
} else if (D_80131868 != D_80130F30) {
} else if (D_80131868 != sCurOcarinaVolume) {
noteChanged = true;
} else if (D_8013186C != D_80130F34) {
} else if (D_8013186C != sCurOcarinaVibrato) {
noteChanged = true;
} else if (D_80131870 != D_80130F2C) {
} else if (D_80131870 != sCurOcarinaBendIndex) {
noteChanged = true;
}
@@ -2185,15 +2194,15 @@ s32 Audio_OcaMemoryGameGenNote(void) {
// input update?
void func_800EE6F4(void) {
D_8016BA04 = gAudioContext.totalTaskCnt;
if (D_80130F10 != 0) {
if (sOcarinaInpEnabled == 1) {
if (sOcarinaInstrumentId != 0) {
if (sIsOcarinaInputEnabled == 1) {
Audio_GetOcaInput();
}
if ((sPlaybackState == 0) && (sOcarinaInpEnabled == 1)) {
if ((sPlaybackState == 0) && (sIsOcarinaInputEnabled == 1)) {
func_800ED458(0);
}
if (D_80130F3C != 0) {
if (D_80130F3C & 0x4000) {
if (sOcarinaFlags != 0) {
if (sOcarinaFlags & 0x4000) {
func_800ED200();
} else {
func_800ECDF8();
@@ -2207,11 +2216,11 @@ void func_800EE6F4(void) {
func_800EE404();
}
if ((D_80130F3C != 0) && (sPrevOcarinaNoteVal != sCurOcarinaBtnVal)) {
if ((sOcarinaFlags != 0) && (sPrevOcarinaPitch != sCurOcarinaPitch)) {
sOcarinaDropInputTimer = 1;
}
sPrevOcarinaNoteVal = sCurOcarinaBtnVal;
sPrevOcarinaPitch = sCurOcarinaPitch;
}
Audio_OcaUpdatePlayingStaff();
@@ -2943,8 +2952,8 @@ void AudioDebug_Draw(GfxPrint* printer) {
}
GfxPrint_SetPos(printer, 3, 24);
GfxPrint_Printf(printer, "OCA:%02x SEQ:%04x PLAY:%02x REC:%02x", D_80130F10, D_80130F3C, sPlaybackState,
sRecordingState);
GfxPrint_Printf(printer, "OCA:%02x SEQ:%04x PLAY:%02x REC:%02x", sOcarinaInstrumentId, sOcarinaFlags,
sPlaybackState, sRecordingState);
break;
case PAGE_SFX_PARAMETER_CHANGE:
@@ -3014,9 +3023,9 @@ void AudioDebug_Draw(GfxPrint* printer) {
GfxPrint_Printf(printer, "DEMO FLAG %d", sAudioCutsceneFlag);
GfxPrint_SetPos(printer, 3, 12);
if (sAudioHasMalonBgm == true) {
GfxPrint_Printf(printer, "MARON BGM DIST %f", sAudioMalonBgmDist);
sAudioHasMalonBgm = false;
if (sIsMalonSinging == true) {
GfxPrint_Printf(printer, "MARON BGM DIST %f", sMalonSingingDist);
sIsMalonSinging = false;
}
GfxPrint_SetPos(printer, 3, 23);
@@ -4908,8 +4917,8 @@ void Audio_UpdateMalonSinging(f32 dist, u16 arg1) {
s8 phi_v1;
s16 temp_a0;
sAudioHasMalonBgm = true;
sAudioMalonBgmDist = dist;
sIsMalonSinging = true;
sMalonSingingDist = dist;
if (D_8016B9F2 == 0) {
temp_a0 = (s8)(func_800FA0B4(SEQ_PLAYER_BGM_MAIN) & 0xFF);
if (temp_a0 == (arg1 & 0xFF)) {
+2 -2
View File
@@ -421,9 +421,9 @@ void func_80064824(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
break;
case 34:
if (IS_DAY) {
gSaveContext.dayTime -= gTimeIncrement;
gSaveContext.dayTime -= gTimeSpeed;
} else {
gSaveContext.dayTime -= gTimeIncrement * 2;
gSaveContext.dayTime -= gTimeSpeed * 2;
}
break;
case 35:
+11 -11
View File
@@ -58,9 +58,9 @@ u8 D_8011FB38 = 0;
u8 gSkyboxBlendingEnabled = false;
u16 gTimeIncrement = 0;
u16 gTimeSpeed = 0;
#define ENVIRONMENT_SHIP_SAVESTATE_FIELDS(F) F(gTimeIncrement)
#define ENVIRONMENT_SHIP_SAVESTATE_FIELDS(F) F(gTimeSpeed)
SHIP_SAVESTATE_DEFINE(Environment, ENVIRONMENT_SHIP_SAVESTATE_FIELDS)
u16 D_8011FB44 = 0xFFFC;
@@ -325,7 +325,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
envCtx->blendIndoorLights = false;
envCtx->unk_BF = 0xFF;
envCtx->unk_D6 = 0xFFFF;
R_ENV_TIME_INCREMENT = gTimeIncrement = envCtx->timeIncrement = 0;
R_ENV_TIME_INCREMENT = gTimeSpeed = envCtx->timeIncrement = 0;
R_ENV_DISABLE_DBG = true;
if (CREG(3) != 0) {
@@ -842,7 +842,7 @@ void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) {
GfxPrint_SetColor(&printer, 255, 255, 255, 64);
GfxPrint_Printf(&printer, "%02d", (u8)(24 * 60 / (f32)0x10000 * ((void)0, gSaveContext.dayTime) / 60.0f));
if ((gSaveContext.dayTime & 0x1F) >= 0x10 || gTimeIncrement >= 6) {
if ((gSaveContext.dayTime & 0x1F) >= 0x10 || gTimeSpeed >= 6) {
GfxPrint_Printf(&printer, "%s", ":");
} else {
GfxPrint_Printf(&printer, "%s", " ");
@@ -857,7 +857,7 @@ void Environment_PrintDebugInfo(PlayState* play, Gfx** gfx) {
GfxPrint_SetColor(&printer, 255, 255, 255, 64);
GfxPrint_Printf(&printer, "%02d", (u8)(24 * 60 / (f32)0x10000 * ((void)0, gSaveContext.skyboxTime) / 60.0f));
if ((((void)0, gSaveContext.skyboxTime) & 0x1F) >= 0x10 || gTimeIncrement >= 6) {
if ((((void)0, gSaveContext.skyboxTime) & 0x1F) >= 0x10 || gTimeSpeed >= 6) {
GfxPrint_Printf(&printer, "%s", ":");
} else {
GfxPrint_Printf(&printer, "%s", " ");
@@ -930,19 +930,19 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
if ((envCtx->unk_1A == 0) && !FrameAdvance_IsEnabled(play) &&
(play->transitionMode == TRANS_MODE_OFF || ((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL)) {
if (IS_DAY || gTimeIncrement >= 0x190) {
gSaveContext.dayTime += gTimeIncrement;
if (IS_DAY || gTimeSpeed >= 0x190) {
gSaveContext.dayTime += gTimeSpeed;
} else {
gSaveContext.dayTime += gTimeIncrement * 2; // time moves twice as fast at night
gSaveContext.dayTime += gTimeSpeed * 2; // time moves twice as fast at night
}
}
}
}
//! @bug `gTimeIncrement` is unsigned, it can't be negative
if (((((void)0, gSaveContext.sceneLayer) >= 5 || gTimeIncrement != 0) &&
//! @bug `gTimeSpeed` is unsigned, it can't be negative
if (((((void)0, gSaveContext.sceneLayer) >= 5 || gTimeSpeed != 0) &&
((void)0, gSaveContext.dayTime) > gSaveContext.skyboxTime) ||
(((void)0, gSaveContext.dayTime) < 0xAAB || gTimeIncrement < 0)) {
(((void)0, gSaveContext.dayTime) < 0xAAB || gTimeSpeed < 0)) {
gSaveContext.skyboxTime = ((void)0, gSaveContext.dayTime);
}
+112 -109
View File
@@ -24,11 +24,11 @@ static u16 sTextBoxNum = 0;
s16 sTextFade = false; // original name: key_off_flag ?
static u8 D_8014B2F4 = 0;
static u8 sMessageStartFrameCount = 0;
static s16 sOcarinaNoteBufPos = 0;
static s16 sOcarinaButtonIndexBufPos = 0;
static s16 sOcarinaNoteBufLen = 0;
static s16 sOcarinaButtonIndexBufLen = 0;
static u8 sTextboxSkipped = false;
@@ -72,7 +72,7 @@ s16 sTextboxBackgroundYOffsets[] = {
};
// original name: onpu_buff
static u8 sOcarinaNoteBuf[12] = { 0 };
static u8 sOcarinaButtonIndexBuf[12] = { 0 };
s16 sOcarinaNotesAlphaValues[9] = { 0 };
@@ -102,7 +102,7 @@ void Message_ResetOcarinaNoteState(void) {
R_OCARINA_NOTES_YPOS(2) = 179;
R_OCARINA_NOTES_YPOS(3) = 174;
R_OCARINA_NOTES_YPOS(4) = 169;
sOcarinaNoteBuf[0] = 0xFF;
sOcarinaButtonIndexBuf[0] = 0xFF;
sOcarinaNotesAlphaValues[0] = sOcarinaNotesAlphaValues[1] = sOcarinaNotesAlphaValues[2] =
sOcarinaNotesAlphaValues[3] = sOcarinaNotesAlphaValues[4] = sOcarinaNotesAlphaValues[5] =
sOcarinaNotesAlphaValues[6] = sOcarinaNotesAlphaValues[7] = sOcarinaNotesAlphaValues[8] = 0;
@@ -145,13 +145,13 @@ void Message_UpdateOcarinaGame(PlayState* play) {
if (play->msgCtx.msgMode == MSGMODE_MEMORY_GAME_PLAYER_PLAYING) {
AudioOcarina_SetInstrument(1);
msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
func_800ECC04((1 << OCARINA_SONG_MEMORY_GAME) + 0x8000);
msgCtx->textDrawPos = msgCtx->decodedTextLen;
} else if (msgCtx->msgMode == MSGMODE_MEMORY_GAME_RIGHT_SKULLKID_PLAYING) {
AudioOcarina_SetInstrument(6);
msgCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
Audio_OcaSetSongPlayback(OCARINA_SONG_MEMORY_GAME + 1, 1);
msgCtx->stateTimer = 2;
}
@@ -895,8 +895,8 @@ void Message_HandleOcarina(PlayState* play) {
AudioOcarina_SetInstrument(1);
AudioOcarina_SetInstrument(1);
msgCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
sOcarinaNoteBufPos = sOcarinaNoteBufLen = 0;
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos;
sOcarinaButtonIndexBufPos = sOcarinaButtonIndexBufLen = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos;
Message_ResetOcarinaNoteState();
msgCtx->stateTimer = 3;
msgCtx->msgMode = MSGMODE_SCARECROW_LONG_PLAYBACK;
@@ -911,8 +911,8 @@ void Message_HandleOcarina(PlayState* play) {
AudioOcarina_SetInstrument(1);
AudioOcarina_SetInstrument(1);
msgCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
sOcarinaNoteBufPos = sOcarinaNoteBufLen = 0;
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos;
sOcarinaButtonIndexBufPos = sOcarinaButtonIndexBufLen = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos;
Message_ResetOcarinaNoteState();
msgCtx->stateTimer = 3;
msgCtx->msgMode = MSGMODE_SCARECROW_PLAYBACK;
@@ -2701,7 +2701,7 @@ void Message_OpenText(PlayState* play, u16 textId) {
Interface_ChangeHudVisibilityMode(5);
}
sMessageHasSetSfx = D_8014B2F4 = sTextboxSkipped = sTextIsCredits = 0;
sMessageHasSetSfx = sMessageStartFrameCount = sTextboxSkipped = sTextIsCredits = 0;
if ((msgCtx->msgMode >= MSGMODE_OCARINA_STARTING && msgCtx->msgMode <= MSGMODE_OCARINA_AWAIT_INPUT) ||
msgCtx->textBoxType == TEXTBOX_TYPE_OCARINA) {
// TODO: Figure out what specific textures to invalidate to prevent the ocarina textboxes from flashing
@@ -2924,8 +2924,8 @@ void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) {
sHasSunsSong = CHECK_QUEST_ITEM(QUEST_SONG_SUN);
msgCtx->ocarinaStaff = Audio_OcaGetRecordingStaff();
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
sOcarinaNoteBufLen = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
sOcarinaButtonIndexBufLen = 0;
Message_ResetOcarinaNoteState();
sLastPlayedSong = msgCtx->unk_E3F2 = msgCtx->lastOcaNoteIdx = 0xFF;
@@ -3009,8 +3009,8 @@ void Message_StartOcarina(PlayState* play, u16 ocarinaActionId) {
AudioOcarina_SetInstrument(1);
AudioOcarina_SetInstrument(1);
msgCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
sOcarinaNoteBufPos = sOcarinaNoteBufLen = 0;
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos;
sOcarinaButtonIndexBufPos = sOcarinaButtonIndexBufLen = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos;
Message_ResetOcarinaNoteState();
msgCtx->stateTimer = 3;
msgCtx->msgMode = MSGMODE_SCARECROW_LONG_PLAYBACK;
@@ -3367,7 +3367,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
case MSGMODE_SONG_PLAYBACK_STARTING:
AudioOcarina_SetInstrument(1);
msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
play->msgCtx.ocarinaMode = OCARINA_MODE_01;
Message_ResetOcarinaNoteState();
sOcarinaNoteFlashTimer = 3;
@@ -3412,15 +3412,15 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
case MSGMODE_OCARINA_PLAYING:
msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
if (msgCtx->ocarinaStaff->pos) {
osSyncPrintf("locate=%d onpu_pt=%d\n", msgCtx->ocarinaStaff->pos, sOcarinaNoteBufPos);
if (msgCtx->ocarinaStaff->pos == 1 && sOcarinaNoteBufPos == 8) {
sOcarinaNoteBufPos = 0;
osSyncPrintf("locate=%d onpu_pt=%d\n", msgCtx->ocarinaStaff->pos, sOcarinaButtonIndexBufPos);
if (msgCtx->ocarinaStaff->pos == 1 && sOcarinaButtonIndexBufPos == 8) {
sOcarinaButtonIndexBufPos = 0;
}
if (sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
msgCtx->lastOcaNoteIdx = sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos - 1] =
if (sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
msgCtx->lastOcaNoteIdx = sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] =
msgCtx->ocarinaStaff->noteIdx;
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaNoteBufPos++;
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaButtonIndexBufPos++;
}
}
msgCtx->lastPlayedSong = msgCtx->ocarinaStaff->state;
@@ -3604,7 +3604,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
}
R_OCARINA_NOTES_YPOS_OFFSET += R_OCARINA_NOTES_YPOS_OFFSET;
if (R_OCARINA_NOTES_YPOS_OFFSET >= 550) {
sOcarinaNoteBuf[0] = OCARINA_NOTE_INVALID;
sOcarinaButtonIndexBuf[0] = OCARINA_NOTE_INVALID;
sOcarinaNotesAlphaValues[0] = sOcarinaNotesAlphaValues[1] = sOcarinaNotesAlphaValues[2] =
sOcarinaNotesAlphaValues[3] = sOcarinaNotesAlphaValues[4] = sOcarinaNotesAlphaValues[5] =
sOcarinaNotesAlphaValues[6] = sOcarinaNotesAlphaValues[7] = sOcarinaNotesAlphaValues[8] = 0;
@@ -3627,7 +3627,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
Message_Decode(play);
msgCtx->msgMode = MSGMODE_SETUP_DISPLAY_SONG_PLAYED;
msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
Message_ResetOcarinaNoteState();
if (msgCtx->lastPlayedSong >= OCARINA_SONG_SARIAS &&
msgCtx->lastPlayedSong < OCARINA_SONG_MEMORY_GAME) {
@@ -3666,7 +3666,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
if (msgCtx->ocarinaAction == OCARINA_ACTION_CHECK_NOWARP) {
msgCtx->ocarinaAction = OCARINA_ACTION_CHECK_NOWARP_DONE;
}
sOcarinaNoteBufPos = 0;
sOcarinaButtonIndexBufPos = 0;
msgCtx->msgMode = MSGMODE_DISPLAY_SONG_PLAYED;
break;
case MSGMODE_SONG_DEMONSTRATION_SELECT_INSTRUMENT:
@@ -3688,7 +3688,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
// "Example Performance"
osSyncPrintf("模範演奏=%x\n", msgCtx->ocarinaAction - OCARINA_ACTION_TEACH_MINUET);
Audio_OcaSetSongPlayback(msgCtx->ocarinaAction - OCARINA_ACTION_TEACH_MINUET + 1, 2);
sOcarinaNoteBufPos = 0;
sOcarinaButtonIndexBufPos = 0;
msgCtx->msgMode = MSGMODE_SONG_DEMONSTRATION;
}
if (gSaveContext.language == LANGUAGE_JPN && !sDisplayNextMessageAsEnglish) {
@@ -3803,16 +3803,16 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
msgCtx->msgMode = MSGMODE_SONG_DEMONSTRATION_DONE;
}
osSyncPrintf("onpu_buff[%d]=%x\n", msgCtx->ocarinaStaff->pos,
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos]);
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos]);
} else {
if (sOcarinaNoteBufPos != 0 && msgCtx->ocarinaStaff->pos == 1) {
sOcarinaNoteBufPos = 0;
if (sOcarinaButtonIndexBufPos != 0 && msgCtx->ocarinaStaff->pos == 1) {
sOcarinaButtonIndexBufPos = 0;
}
if (msgCtx->ocarinaStaff->pos && sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
msgCtx->lastOcaNoteIdx = sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos - 1] =
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
msgCtx->lastOcaNoteIdx = sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] =
msgCtx->ocarinaStaff->noteIdx;
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaNoteBufPos++;
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaButtonIndexBufPos++;
}
}
case MSGMODE_SONG_DEMONSTRATION_DONE:
@@ -3824,10 +3824,10 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
break;
case MSGMODE_SONG_PLAYBACK:
msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
if (msgCtx->ocarinaStaff->pos && sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaNoteBufPos++;
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaButtonIndexBufPos++;
}
if (msgCtx->ocarinaStaff->state < OCARINA_SONG_MEMORY_GAME) {
osSyncPrintf("M_OCARINA20 : ocarina_no=%x status=%x\n", msgCtx->ocarinaAction,
@@ -3876,8 +3876,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
Audio_OcaSetRecordingState(1);
AudioOcarina_SetInstrument(1);
msgCtx->ocarinaStaff = Audio_OcaGetRecordingStaff();
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
sOcarinaNoteBufLen = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
sOcarinaButtonIndexBufLen = 0;
Message_ResetOcarinaNoteState();
msgCtx->msgMode = MSGMODE_SCARECROW_LONG_RECORDING_ONGOING;
if (gSaveContext.language == LANGUAGE_JPN && !sDisplayNextMessageAsEnglish) {
@@ -3888,26 +3888,27 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
break;
case MSGMODE_SCARECROW_LONG_RECORDING_ONGOING:
msgCtx->ocarinaStaff = Audio_OcaGetRecordingStaff();
osSyncPrintf("\nonpu_pt=%d, locate=%d", sOcarinaNoteBufPos, msgCtx->ocarinaStaff->pos);
if (msgCtx->ocarinaStaff->pos && sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
if (sOcarinaNoteBufLen >= 8) {
for (noteBufPos = sOcarinaNoteBufLen - 8, i = 0; i < 8; i++, noteBufPos++) {
sOcarinaNoteBuf[noteBufPos] = sOcarinaNoteBuf[noteBufPos + 1];
osSyncPrintf("\nonpu_pt=%d, locate=%d", sOcarinaButtonIndexBufPos, msgCtx->ocarinaStaff->pos);
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
if (sOcarinaButtonIndexBufLen >= 8) {
for (noteBufPos = sOcarinaButtonIndexBufLen - 8, i = 0; i < 8; i++, noteBufPos++) {
sOcarinaButtonIndexBuf[noteBufPos] = sOcarinaButtonIndexBuf[noteBufPos + 1];
}
sOcarinaNoteBufLen--;
sOcarinaButtonIndexBufLen--;
}
// "Button Entered"
osSyncPrintf(" 入力ボタン【%d】=%d", sOcarinaNoteBufLen, msgCtx->ocarinaStaff->noteIdx);
msgCtx->lastOcaNoteIdx = sOcarinaNoteBuf[sOcarinaNoteBufLen] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaNoteBufLen++;
sOcarinaNoteBuf[sOcarinaNoteBufLen] = OCARINA_NOTE_INVALID;
sOcarinaNoteBufPos++;
osSyncPrintf(" 入力ボタン【%d】=%d", sOcarinaButtonIndexBufLen, msgCtx->ocarinaStaff->noteIdx);
msgCtx->lastOcaNoteIdx = sOcarinaButtonIndexBuf[sOcarinaButtonIndexBufLen] =
msgCtx->ocarinaStaff->noteIdx;
sOcarinaButtonIndexBufLen++;
sOcarinaButtonIndexBuf[sOcarinaButtonIndexBufLen] = OCARINA_NOTE_INVALID;
sOcarinaButtonIndexBufPos++;
if (msgCtx->ocarinaStaff->pos == 8) {
sOcarinaNoteBufPos = 0;
sOcarinaButtonIndexBufPos = 0;
}
}
if (msgCtx->ocarinaStaff->state == 0 || isB_Held) {
if (sOcarinaNoteBufLen != 0) {
if (sOcarinaButtonIndexBufLen != 0) {
// "Recording complete!!!!!!!!!"
osSyncPrintf("録音終了!!!!!!!!! message->info->status=%d \n",
msgCtx->ocarinaStaff->state);
@@ -3941,19 +3942,19 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
case MSGMODE_SCARECROW_LONG_PLAYBACK:
case MSGMODE_SCARECROW_PLAYBACK:
msgCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
if (msgCtx->ocarinaStaff->pos && sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
if (sOcarinaNoteBufLen >= 8) {
for (noteBufPos = sOcarinaNoteBufLen - 8, i = 0; i < 8; i++, noteBufPos++) {
sOcarinaNoteBuf[noteBufPos] = sOcarinaNoteBuf[noteBufPos + 1];
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
if (sOcarinaButtonIndexBufLen >= 8) {
for (noteBufPos = sOcarinaButtonIndexBufLen - 8, i = 0; i < 8; i++, noteBufPos++) {
sOcarinaButtonIndexBuf[noteBufPos] = sOcarinaButtonIndexBuf[noteBufPos + 1];
}
sOcarinaNoteBufLen--;
sOcarinaButtonIndexBufLen--;
}
sOcarinaNoteBuf[sOcarinaNoteBufLen] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaNoteBufLen++;
sOcarinaNoteBuf[sOcarinaNoteBufLen] = OCARINA_NOTE_INVALID;
sOcarinaNoteBufPos++;
sOcarinaButtonIndexBuf[sOcarinaButtonIndexBufLen] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaButtonIndexBufLen++;
sOcarinaButtonIndexBuf[sOcarinaButtonIndexBufLen] = OCARINA_NOTE_INVALID;
sOcarinaButtonIndexBufPos++;
if (msgCtx->ocarinaStaff->pos == 8) {
sOcarinaNoteBufLen = sOcarinaNoteBufPos = 0;
sOcarinaButtonIndexBufLen = sOcarinaButtonIndexBufPos = 0;
}
}
osSyncPrintf("status=%d (%d)\n", msgCtx->ocarinaStaff->state, 0);
@@ -3980,10 +3981,11 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
break;
case MSGMODE_SCARECROW_RECORDING_ONGOING:
msgCtx->ocarinaStaff = Audio_OcaGetRecordingStaff();
if (msgCtx->ocarinaStaff->pos && sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
msgCtx->lastOcaNoteIdx = sOcarinaNoteBuf[sOcarinaNoteBufPos] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaNoteBufPos++;
sOcarinaNoteBuf[sOcarinaNoteBufPos] = OCARINA_NOTE_INVALID;
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
msgCtx->lastOcaNoteIdx = sOcarinaButtonIndexBuf[sOcarinaButtonIndexBufPos] =
msgCtx->ocarinaStaff->noteIdx;
sOcarinaButtonIndexBufPos++;
sOcarinaButtonIndexBuf[sOcarinaButtonIndexBufPos] = OCARINA_NOTE_INVALID;
}
if (msgCtx->ocarinaStaff->state == 0) {
// "8 Note Recording OK!"
@@ -4028,7 +4030,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
AudioOcarina_SetInstrument(6);
Audio_OcaMemoryGameStart(gSaveContext.ocarinaGameRoundNum);
msgCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
Message_ResetOcarinaNoteState();
Audio_OcaSetSongPlayback(OCARINA_SONG_MEMORY_GAME + 1, 1);
msgCtx->msgMode = MSGMODE_MEMORY_GAME_LEFT_SKULLKID_PLAYING;
@@ -4039,10 +4041,10 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
Audio_PlaySoundGeneral(NA_SE_SY_METRONOME_LV - SFX_FLAG, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
msgCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
if (msgCtx->ocarinaStaff->pos && sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaNoteBufPos++;
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaButtonIndexBufPos++;
}
if (msgCtx->stateTimer == 0) {
if (msgCtx->ocarinaStaff->state == 0) {
@@ -4063,20 +4065,20 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
case MSGMODE_MEMORY_GAME_LEFT_SKULLKID_WAIT:
case MSGMODE_MEMORY_GAME_RIGHT_SKULLKID_WAIT:
msgCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
if (msgCtx->ocarinaStaff->pos && sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaNoteBufPos++;
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaButtonIndexBufPos++;
}
break;
case MSGMODE_MEMORY_GAME_PLAYER_PLAYING:
Audio_PlaySoundGeneral(NA_SE_SY_METRONOME_LV - SFX_FLAG, &gSfxDefaultPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
if (msgCtx->ocarinaStaff->pos && sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaNoteBufPos++;
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaButtonIndexBufPos++;
}
if (msgCtx->ocarinaStaff->state == 0xFF) {
// "Musical round failed!!!!!!!!!"
@@ -4102,10 +4104,10 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
break;
case MSGMODE_MEMORY_GAME_ROUND_SUCCESS:
msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
if (msgCtx->ocarinaStaff->pos && sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaNoteBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaNoteBufPos++;
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos - 1] = msgCtx->ocarinaStaff->noteIdx;
sOcarinaButtonIndexBuf[msgCtx->ocarinaStaff->pos] = OCARINA_NOTE_INVALID;
sOcarinaButtonIndexBufPos++;
}
msgCtx->stateTimer--;
if (msgCtx->stateTimer == 0) {
@@ -4113,7 +4115,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
Audio_PlaySoundGeneral(NA_SE_SY_METRONOME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
Message_ResetOcarinaNoteState();
msgCtx->msgMode = MSGMODE_MEMORY_GAME_START_NEXT_ROUND;
} else {
@@ -4129,7 +4131,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
case MSGMODE_MEMORY_GAME_START_NEXT_ROUND:
if (!Audio_IsSfxPlaying(NA_SE_SY_METRONOME)) {
msgCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
Message_ResetOcarinaNoteState();
Audio_OcaSetSongPlayback(OCARINA_SONG_MEMORY_GAME + 1, 1);
}
@@ -4137,7 +4139,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
case MSGMODE_FROGS_START:
AudioOcarina_SetInstrument(1);
msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
play->msgCtx.ocarinaMode = OCARINA_MODE_01;
Message_ResetOcarinaNoteState();
func_800ECC04(sOcarinaSongBitFlags + 0xC000);
@@ -4145,9 +4147,9 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
break;
case MSGMODE_FROGS_PLAYING:
msgCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
if (msgCtx->ocarinaStaff->pos && sOcarinaNoteBufPos == msgCtx->ocarinaStaff->pos - 1) {
if (msgCtx->ocarinaStaff->pos && sOcarinaButtonIndexBufPos == msgCtx->ocarinaStaff->pos - 1) {
msgCtx->lastOcaNoteIdx = msgCtx->ocarinaStaff->noteIdx;
msgCtx->ocarinaStaff->pos = sOcarinaNoteBufPos = 0;
msgCtx->ocarinaStaff->pos = sOcarinaButtonIndexBufPos = 0;
Message_ResetOcarinaNoteState();
msgCtx->msgMode = MSGMODE_FROGS_WAITING;
}
@@ -4227,7 +4229,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
if (msgCtx->msgMode != MSGMODE_SCARECROW_LONG_RECORDING_START &&
msgCtx->msgMode != MSGMODE_MEMORY_GAME_START) {
for (notePosX = R_OCARINA_NOTES_XPOS, i = 0; i < 8; i++, notePosX += R_OCARINA_NOTES_XPOS_OFFSET) {
if (sOcarinaNoteBuf[i] == OCARINA_NOTE_INVALID) {
if (sOcarinaButtonIndexBuf[i] == OCARINA_NOTE_INVALID) {
break;
}
@@ -4243,34 +4245,35 @@ void Message_DrawMain(PlayState* play, Gfx** p) {
// Since I don't know what exactly these Env vars are used for, I elected keep their usage
// consistent with the note played, rather than having AEnv be used for whatever note A happens to
// play at the moment and CEnv for everything else, even with custom controls enabled.
if (sOcarinaNoteBuf[i] == OCARINA_NOTE_D4) {
if (sOcarinaButtonIndexBuf[i] == OCARINA_NOTE_D4) {
gDPSetPrimColor(gfx++, 0, 0, sOcarinaNoteABtnPrim.r, sOcarinaNoteABtnPrim.g,
sOcarinaNoteABtnPrim.b, sOcarinaNotesAlphaValues[i]);
gDPSetEnvColor(gfx++, sOcarinaNoteABtnEnv.r, sOcarinaNoteABtnEnv.g, sOcarinaNoteABtnEnv.b, 0);
} else {
if (sOcarinaNoteBuf[i] == OCARINA_NOTE_D5) {
if (sOcarinaButtonIndexBuf[i] == OCARINA_NOTE_D5) {
gDPSetPrimColor(gfx++, 0, 0, sOcarinaNoteCUpBtnPrim.r, sOcarinaNoteCUpBtnPrim.g,
sOcarinaNoteCUpBtnPrim.b, sOcarinaNotesAlphaValues[i]);
} else if (sOcarinaNoteBuf[i] == OCARINA_NOTE_B4) {
} else if (sOcarinaButtonIndexBuf[i] == OCARINA_NOTE_B4) {
gDPSetPrimColor(gfx++, 0, 0, sOcarinaNoteCLeftBtnPrim.r, sOcarinaNoteCLeftBtnPrim.g,
sOcarinaNoteCLeftBtnPrim.b, sOcarinaNotesAlphaValues[i]);
} else if (sOcarinaNoteBuf[i] == OCARINA_NOTE_A4) {
} else if (sOcarinaButtonIndexBuf[i] == OCARINA_NOTE_A4) {
gDPSetPrimColor(gfx++, 0, 0, sOcarinaNoteCRightBtnPrim.r, sOcarinaNoteCRightBtnPrim.g,
sOcarinaNoteCRightBtnPrim.b, sOcarinaNotesAlphaValues[i]);
} else if (sOcarinaNoteBuf[i] == OCARINA_NOTE_F4) {
} else if (sOcarinaButtonIndexBuf[i] == OCARINA_NOTE_F4) {
gDPSetPrimColor(gfx++, 0, 0, sOcarinaNoteCDownBtnPrim.r, sOcarinaNoteCDownBtnPrim.g,
sOcarinaNoteCDownBtnPrim.b, sOcarinaNotesAlphaValues[i]);
}
gDPSetEnvColor(gfx++, sOcarinaNoteCBtnEnv.r, sOcarinaNoteCBtnEnv.g, sOcarinaNoteCBtnEnv.b, 0);
}
gDPLoadTextureBlock(gfx++, sOcarinaNoteTextures[sOcarinaNoteBuf[i]], G_IM_FMT_IA, G_IM_SIZ_8b, 16,
16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gDPLoadTextureBlock(gfx++, sOcarinaNoteTextures[sOcarinaButtonIndexBuf[i]], G_IM_FMT_IA,
G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(gfx++, notePosX << 2, R_OCARINA_NOTES_YPOS(sOcarinaNoteBuf[i]) << 2,
(notePosX + 16) << 2, (R_OCARINA_NOTES_YPOS(sOcarinaNoteBuf[i]) + 16) << 2,
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
gSPTextureRectangle(gfx++, notePosX << 2, R_OCARINA_NOTES_YPOS(sOcarinaButtonIndexBuf[i]) << 2,
(notePosX + 16) << 2,
(R_OCARINA_NOTES_YPOS(sOcarinaButtonIndexBuf[i]) + 16) << 2, G_TX_RENDERTILE, 0,
0, 1 << 10, 1 << 10);
}
}
}
@@ -4433,16 +4436,16 @@ void Message_Update(PlayState* play) {
switch (msgCtx->msgMode) {
case MSGMODE_TEXT_START:
D_8014B2F4++;
sMessageStartFrameCount++;
var = false;
if (YREG(15) == 0x40) {
if (D_8014B2F4 >= 4) {
if (sMessageStartFrameCount >= 4) {
var = true;
}
} else if (YREG(15) != 0 || play->sceneNum == SCENE_CASTLE_COURTYARD_GUARDS_DAY) {
var = true;
} else if (D_8014B2F4 >= 4 || msgCtx->talkActor == NULL) {
} else if (sMessageStartFrameCount >= 4 || msgCtx->talkActor == NULL) {
var = true;
}
@@ -4709,10 +4712,10 @@ UNK_TYPE D_80153D7C = 0x00000000;
s16 gGameOverTimer = 0;
#define MESSAGE_PAL_SHIP_SAVESTATE_FIELDS(F) \
F(sOcarinaNoteBufPos) \
F(sOcarinaNoteBufLen) \
F(sOcarinaNoteBuf) \
F(D_8014B2F4) \
F(sOcarinaButtonIndexBufPos) \
F(sOcarinaButtonIndexBufLen) \
F(sOcarinaButtonIndexBuf) \
F(sMessageStartFrameCount) \
F(sTextboxSkipped) \
F(sNextTextId) \
F(sLastPlayedSong) \
+5 -5
View File
@@ -6476,7 +6476,7 @@ void Interface_DrawTotalGameplayTimer(PlayState* play) {
void Interface_Update(PlayState* play) {
static u8 D_80125B60 = 0;
static s16 sPrevTimeIncrement = 0;
static s16 sPrevTimeSpeed = 0;
MessageContext* msgCtx = &play->msgCtx;
InterfaceContext* interfaceCtx = &play->interfaceCtx;
Player* player = GET_PLAYER(play);
@@ -6848,17 +6848,17 @@ void Interface_Update(PlayState* play) {
}
gSaveContext.sunsSongState = SUNSSONG_SPEED_TIME;
sPrevTimeIncrement = gTimeIncrement;
gTimeIncrement = 400;
sPrevTimeSpeed = gTimeSpeed;
gTimeSpeed = 400;
} else if (D_80125B60 == 0) {
if ((gSaveContext.dayTime >= 0x4555) && (gSaveContext.dayTime <= 0xC001)) {
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
gTimeIncrement = sPrevTimeIncrement;
gTimeSpeed = sPrevTimeSpeed;
play->msgCtx.ocarinaMode = OCARINA_MODE_04;
}
} else if (gSaveContext.dayTime > 0xC001) {
gSaveContext.sunsSongState = SUNSSONG_INACTIVE;
gTimeIncrement = sPrevTimeIncrement;
gTimeSpeed = sPrevTimeSpeed;
play->msgCtx.ocarinaMode = OCARINA_MODE_04;
}
} else if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_1) &&
+1 -1
View File
@@ -364,7 +364,7 @@ void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) {
}
if (gSaveContext.sunsSongState == SUNSSONG_INACTIVE) {
gTimeIncrement = play->envCtx.timeIncrement;
gTimeSpeed = play->envCtx.timeIncrement;
}
play->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.dayTime) - 0x8000) * 120.0f) * 25.0f;
@@ -122,12 +122,12 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, PlayState* play) {
}
}
static Vec3f sBgDdanKdVelocity = { 0.0f, 5.0f, 0.0f };
static Vec3f sBgDdanKdAccel = { 0.0f, -0.45f, 0.0f };
static Vec3f velocity = { 0.0f, 5.0f, 0.0f };
static Vec3f accel = { 0.0f, -0.45f, 0.0f };
#define BG_DDAN_KD_SHIP_SAVESTATE_FIELDS(F) \
F(sBgDdanKdVelocity) \
F(sBgDdanKdAccel)
F(velocity) \
F(accel)
SHIP_SAVESTATE_DEFINE(BgDdanKd, BG_DDAN_KD_SHIP_SAVESTATE_FIELDS)
@@ -165,11 +165,11 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) {
func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_80033480(play, &pos2, 20.0f, 1, effectStrength * 135.0f, 60, 1);
sBgDdanKdVelocity.x = Rand_CenteredFloat(3.0f);
sBgDdanKdVelocity.z = Rand_CenteredFloat(3.0f);
velocity.x = Rand_CenteredFloat(3.0f);
velocity.z = Rand_CenteredFloat(3.0f);
func_8003555C(play, &pos1, &sBgDdanKdVelocity, &sBgDdanKdAccel);
func_8003555C(play, &pos2, &sBgDdanKdVelocity, &sBgDdanKdAccel);
func_8003555C(play, &pos1, &velocity, &accel);
func_8003555C(play, &pos2, &velocity, &accel);
pos1 = this->dyna.actor.world.pos;
pos1.z += 560.0f + Rand_ZeroOne() * 5.0f;
@@ -177,7 +177,7 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) {
pos1.y = Rand_ZeroOne() * 3.0f + (this->dyna.actor.floorHeight + 20.0f);
func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_8003555C(play, &pos1, &sBgDdanKdVelocity, &sBgDdanKdAccel);
func_8003555C(play, &pos1, &velocity, &accel);
}
Camera_AddQuake(&play->mainCamera, 0, effectStrength * 0.6f, 3);
Audio_PlaySoundGeneral(NA_SE_EV_PILLAR_SINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4,
@@ -199,11 +199,11 @@ void BgDdanKd_Draw(Actor* thisx, PlayState* play) {
}
void BgDdanKd_Reset(void) {
sBgDdanKdVelocity.x = 0.0f;
sBgDdanKdVelocity.y = 5.0f;
sBgDdanKdVelocity.z = 0.0f;
velocity.x = 0.0f;
velocity.y = 5.0f;
velocity.z = 0.0f;
sBgDdanKdAccel.x = 0.0f;
sBgDdanKdAccel.y = -0.45f;
sBgDdanKdAccel.z = 0.0f;
accel.x = 0.0f;
accel.y = -0.45f;
accel.z = 0.0f;
}
@@ -75,18 +75,18 @@ static ColliderCylinderInit sColCylinderInitLeftRight = {
{ 50, 60, 280, { 0, 0, 0 } },
};
static s16 sBgDodoagoFirstExplosiveFlag = false;
static s16 sFirstExplosiveFlag = false;
static u8 sBgDodoagoDisableBombCatcher;
static u8 sDisableBombCatcher;
// static u8 sUnused[90]; // unknown length
static s32 sBgDodoagoTimer;
static s32 sTimer;
#define BG_DODOAGO_SHIP_SAVESTATE_FIELDS(F) \
F(sBgDodoagoFirstExplosiveFlag) \
F(sBgDodoagoDisableBombCatcher) \
F(sBgDodoagoTimer)
F(sFirstExplosiveFlag) \
F(sDisableBombCatcher) \
F(sTimer)
SHIP_SAVESTATE_DEFINE(BgDodoago, BG_DODOAGO_SHIP_SAVESTATE_FIELDS)
@@ -143,7 +143,7 @@ void BgDodoago_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->colliderRight, &this->dyna.actor, &sColCylinderInitLeftRight);
BgDodoago_SetupAction(this, BgDodoago_WaitExplosives);
sBgDodoagoDisableBombCatcher = false;
sDisableBombCatcher = false;
}
void BgDodoago_Destroy(Actor* thisx, PlayState* play) {
@@ -181,16 +181,16 @@ void BgDodoago_WaitExplosives(BgDodoago* this, PlayState* play) {
OnePointCutscene_Init(play, 3065, 20, &this->dyna.actor, CAM_ID_MAIN);
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sBgDodoagoTimer += 30;
sTimer += 30;
return;
}
// the flag is never set back to false, so this only runs once
if (!sBgDodoagoFirstExplosiveFlag) {
if (!sFirstExplosiveFlag) {
// this disables the bomb catcher (see BgDodoago_Update) for a few seconds
this->dyna.actor.parent = explosive;
sBgDodoagoFirstExplosiveFlag = true;
sBgDodoagoTimer = 50;
sFirstExplosiveFlag = true;
sTimer = 50;
}
} else if (Flags_GetEventChkInf(EVENTCHKINF_ENTERED_DODONGOS_CAVERN)) {
Collider_UpdateCylinder(&this->dyna.actor, &this->colliderMain);
@@ -230,11 +230,11 @@ void BgDodoago_OpenJaw(BgDodoago* this, PlayState* play) {
}
if (play->roomCtx.unk_74[BGDODOAGO_EYE_LEFT] != 255 || play->roomCtx.unk_74[BGDODOAGO_EYE_RIGHT] != 255) {
sBgDodoagoTimer--;
sTimer--;
return;
}
if (sBgDodoagoTimer == 108) {
if (sTimer == 108) {
for (i = ARRAY_COUNT(dustOffsets) - 1; i >= 0; i--) {
pos.x = dustOffsets[i].x + this->dyna.actor.world.pos.x;
pos.y = dustOffsets[i].y + this->dyna.actor.world.pos.y;
@@ -301,16 +301,16 @@ void BgDodoago_Update(Actor* thisx, PlayState* play) {
this->dyna.actor.parent = &bomb->actor;
bomb->timer = 50;
bomb->actor.speedXZ = 0.0f;
sBgDodoagoTimer = 0;
sTimer = 0;
}
}
} else {
sBgDodoagoTimer++;
sTimer++;
Flags_GetSwitch(play, this->dyna.actor.params & 0x3F);
if (!sBgDodoagoDisableBombCatcher && sBgDodoagoTimer > 140) {
if (!sDisableBombCatcher && sTimer > 140) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
// this prevents clearing the actor's parent pointer, effectively disabling the bomb catcher
sBgDodoagoDisableBombCatcher++;
sDisableBombCatcher++;
} else {
this->dyna.actor.parent = NULL;
}
@@ -332,7 +332,7 @@ void BgDodoago_Draw(Actor* thisx, PlayState* play) {
}
void BgDodoago_Reset(void) {
sBgDodoagoFirstExplosiveFlag = false;
sBgDodoagoDisableBombCatcher = 0;
sBgDodoagoTimer = 0;
sFirstExplosiveFlag = false;
sDisableBombCatcher = 0;
sTimer = 0;
}
@@ -29,7 +29,7 @@ void BgHakaTrap_FireBarrier_Idle(BgHakaTrap* this, PlayState* play);
void BgHakaTrap_FireBarrier_UpdateLayout(BgHakaTrap* this, PlayState* play);
void BgHakaTrap_GetSwitchFlag(BgHakaTrap* this);
static UNK_TYPE D_80880F30 = 0;
static UNK_TYPE sIsSpikeWallBurning = 0;
const ActorInit Bg_Haka_Trap_InitVars = {
ACTOR_BG_HAKA_TRAP,
@@ -108,11 +108,11 @@ static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
static UNK_TYPE D_80881014 = 0;
static UNK_TYPE sSpikedCrusherFlip = 0;
#define BG_HAKA_TRAP_SHIP_SAVESTATE_FIELDS(F) \
F(D_80880F30) \
F(D_80881014)
F(sIsSpikeWallBurning) \
F(sSpikedCrusherFlip)
SHIP_SAVESTATE_DEFINE(BgHakaTrap, BG_HAKA_TRAP_SHIP_SAVESTATE_FIELDS)
@@ -147,11 +147,11 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) {
CollisionHeader_GetVirtual(&object_haka_objects_Col_009CD0, &colHeader);
this->timer = 30;
if (D_80881014 != 0) {
if (sSpikedCrusherFlip != 0) {
this->actionFunc = BgHakaTrap_SpikedCrusher_Lift;
D_80881014 = 0;
sSpikedCrusherFlip = 0;
} else {
D_80881014 = 1;
sSpikedCrusherFlip = 1;
this->actionFunc = BgHakaTrap_SpikedCrusher_Fall;
thisx->velocity.y = 0.5f;
}
@@ -236,17 +236,17 @@ void BgHakaTrap_UpdateBodyColliderPos(BgHakaTrap* this, PlayState* play) {
this->colliderCylinder.dim.pos.z = this->dyna.actor.world.pos.z + sp28.x * sine + sp28.z * cosine;
}
static UNK_TYPE D_80881018 = 0;
static UNK_TYPE sSpikedWallFlags = 0;
void BgHakaTrap_SpikedWall_CloseIn(BgHakaTrap* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if ((D_80880F30 == 0) && (!Player_InCsMode(play))) {
if ((sIsSpikeWallBurning == 0) && (!Player_InCsMode(play))) {
if (!Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x, 0.5f)) {
Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG);
} else if (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL) {
D_80881018 |= 1;
sSpikedWallFlags |= 1;
} else if (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL_2) {
D_80881018 |= 2;
sSpikedWallFlags |= 2;
}
}
@@ -254,10 +254,10 @@ void BgHakaTrap_SpikedWall_CloseIn(BgHakaTrap* this, PlayState* play) {
if (this->colliderSpikes.base.acFlags & AC_HIT) {
this->timer = 20;
D_80880F30 = 1;
sIsSpikeWallBurning = 1;
this->actionFunc = BgHakaTrap_SpikedWall_Burn;
} else if (D_80881018 == 3) {
D_80881018 = 4;
} else if (sSpikedWallFlags == 3) {
sSpikedWallFlags = 4;
player->actor.bgCheckFlags |= 0x100;
}
}
@@ -287,7 +287,7 @@ void BgHakaTrap_SpikedWall_Burn(BgHakaTrap* this, PlayState* play) {
}
if (this->timer == 0) {
D_80880F30 = 0;
sIsSpikeWallBurning = 0;
Actor_Kill(&this->dyna.actor);
}
}
@@ -559,7 +559,7 @@ void BgHakaTrap_Draw(Actor* thisx, PlayState* play) {
}
void BgHakaTrap_Reset(void) {
D_80880F30 = 0;
D_80881014 = 0;
D_80881018 = 0;
sIsSpikeWallBurning = 0;
sSpikedCrusherFlip = 0;
sSpikedWallFlags = 0;
}
@@ -30,9 +30,9 @@ const ActorInit Bg_Menkuri_Eye_InitVars = {
(ActorResetFunc)BgMenkuriEye_Reset,
};
static s32 D_8089C1A0;
static s32 sNumEyesShot;
#define BG_MENKURI_EYE_SHIP_SAVESTATE_FIELDS(F) F(D_8089C1A0)
#define BG_MENKURI_EYE_SHIP_SAVESTATE_FIELDS(F) F(sNumEyesShot)
SHIP_SAVESTATE_DEFINE(BgMenkuriEye, BG_MENKURI_EYE_SHIP_SAVESTATE_FIELDS)
@@ -80,7 +80,7 @@ void BgMenkuriEye_Init(Actor* thisx, PlayState* play) {
colliderList = this->collider.elements;
colliderList->dim.worldSphere.radius = colliderList->dim.modelSphere.radius;
if (!Flags_GetSwitch(play, this->actor.params)) {
D_8089C1A0 = 0;
sNumEyesShot = 0;
}
this->framesUntilDisable = -1;
}
@@ -102,7 +102,7 @@ void BgMenkuriEye_Update(Actor* thisx, PlayState* play) {
}
if (this->framesUntilDisable == 0) {
this->framesUntilDisable = -1;
D_8089C1A0 -= 1;
sNumEyesShot -= 1;
}
}
}
@@ -111,11 +111,11 @@ void BgMenkuriEye_Update(Actor* thisx, PlayState* play) {
this->collider.base.acFlags &= ~AC_HIT;
if (this->framesUntilDisable == -1) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_AMOS_DAMAGE);
D_8089C1A0 += 1;
D_8089C1A0 = CLAMP_MAX(D_8089C1A0, 4);
sNumEyesShot += 1;
sNumEyesShot = CLAMP_MAX(sNumEyesShot, 4);
}
this->framesUntilDisable = 416;
if (D_8089C1A0 == 4) {
if (sNumEyesShot == 4) {
Flags_SetSwitch(play, this->actor.params);
Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME);
}
@@ -149,5 +149,5 @@ void BgMenkuriEye_Draw(Actor* thisx, PlayState* play) {
}
void BgMenkuriEye_Reset(void) {
D_8089C1A0 = 0;
sNumEyesShot = 0;
}
@@ -31,9 +31,9 @@ void func_808A3D58(BgMoriHineri* this, PlayState* play);
s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId);
static s16 sBgMoriHineriNextCamIdx = SUBCAM_NONE;
static s16 sSubCamId = SUBCAM_NONE;
#define BG_MORI_HINERI_SHIP_SAVESTATE_FIELDS(F) F(sBgMoriHineriNextCamIdx)
#define BG_MORI_HINERI_SHIP_SAVESTATE_FIELDS(F) F(sSubCamId)
SHIP_SAVESTATE_DEFINE(BgMoriHineri, BG_MORI_HINERI_SHIP_SAVESTATE_FIELDS)
@@ -208,29 +208,28 @@ void func_808A3D58(BgMoriHineri* this, PlayState* play) {
OnePointCutscene_EndCutscene(play, mainCamChildIdx);
}
OnePointCutscene_Init(play, 3260, 40, &this->dyna.actor, CAM_ID_MAIN);
sBgMoriHineriNextCamIdx = OnePointCutscene_Init(play, 3261, 40, &this->dyna.actor, CAM_ID_MAIN);
sSubCamId = OnePointCutscene_Init(play, 3261, 40, &this->dyna.actor, CAM_ID_MAIN);
}
}
void func_808A3E54(BgMoriHineri* this, PlayState* play) {
s8 objBankIndex;
if (play->activeCamera == sBgMoriHineriNextCamIdx) {
if (sBgMoriHineriNextCamIdx != CAM_ID_MAIN) {
if (play->activeCamera == sSubCamId) {
if (sSubCamId != CAM_ID_MAIN) {
objBankIndex = this->dyna.actor.objBankIndex;
this->dyna.actor.objBankIndex = this->moriHineriObjIdx;
this->moriHineriObjIdx = objBankIndex;
this->dyna.actor.params ^= 1;
sBgMoriHineriNextCamIdx = CAM_ID_MAIN;
sSubCamId = CAM_ID_MAIN;
Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR);
} else {
this->dyna.actor.draw = NULL;
this->actionFunc = func_808A3D58;
sBgMoriHineriNextCamIdx = SUBCAM_NONE;
sSubCamId = SUBCAM_NONE;
}
}
if ((sBgMoriHineriNextCamIdx >= CAM_ID_SUB_FIRST) &&
((GET_ACTIVE_CAM(play)->eye.z - this->dyna.actor.world.pos.z) < 1100.0f)) {
if ((sSubCamId >= CAM_ID_SUB_FIRST) && ((GET_ACTIVE_CAM(play)->eye.z - this->dyna.actor.world.pos.z) < 1100.0f)) {
Actor_PlaySfx_FlaggedCentered2(&this->dyna.actor, NA_SE_EV_FLOOR_ROLLING - SFX_FLAG);
}
}
@@ -272,5 +271,5 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) {
}
void BgMoriHineri_Reset() {
sBgMoriHineriNextCamIdx = SUBCAM_NONE;
sSubCamId = SUBCAM_NONE;
}
@@ -83,11 +83,11 @@ static ColliderTrisInit sTrisInit = {
sTrisElementsInit,
};
static u8 sBgPoEventBlocksAtRest = 0;
static u8 sBlocksAtRest = 0;
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
static u8 sBgPoEventPuzzleState;
static u8 sPuzzleState;
void BgPoEvent_InitPaintings(BgPoEvent* this, PlayState* play) {
static s16 paintingPosX[] = { -1302, -866, 1421, 985 };
@@ -144,10 +144,10 @@ void BgPoEvent_InitPaintings(BgPoEvent* this, PlayState* play) {
}
this->timer = 0;
if (this->type == 4) {
sBgPoEventPuzzleState = 0;
sPuzzleState = 0;
this->actionFunc = BgPoEvent_AmyWait;
} else {
sBgPoEventPuzzleState = (s32)(Rand_ZeroOne() * 3.0f) % 3;
sPuzzleState = (s32)(Rand_ZeroOne() * 3.0f) % 3;
this->actionFunc = BgPoEvent_PaintingEmpty;
}
}
@@ -238,7 +238,7 @@ void BgPoEvent_Destroy(Actor* thisx, PlayState* play) {
void BgPoEvent_BlockWait(BgPoEvent* this, PlayState* play) {
this->dyna.actor.world.pos.y = 833.0f;
if (sBgPoEventPuzzleState == 0x3F) {
if (sPuzzleState == 0x3F) {
if (this->type == 1) {
OnePointCutscene_Init(play, 3150, 65, NULL, CAM_ID_MAIN);
}
@@ -246,14 +246,14 @@ void BgPoEvent_BlockWait(BgPoEvent* this, PlayState* play) {
this->actionFunc = BgPoEvent_BlockShake;
} else if (this->dyna.actor.xzDistToPlayer > 50.0f) {
if (this->type != 1) {
sBgPoEventPuzzleState |= (1 << this->index);
sPuzzleState |= (1 << this->index);
} else {
sBgPoEventPuzzleState |= 0x10;
sPuzzleState |= 0x10;
}
} else if (this->type != 1) {
sBgPoEventPuzzleState &= ~(1 << this->index);
sPuzzleState &= ~(1 << this->index);
} else {
sBgPoEventPuzzleState &= ~0x10;
sPuzzleState &= ~0x10;
}
}
@@ -267,7 +267,7 @@ void BgPoEvent_BlockShake(BgPoEvent* this, PlayState* play) {
}
if (this->timer == 0) {
this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x;
sBgPoEventPuzzleState = 0;
sPuzzleState = 0;
this->timer = 60;
this->actionFunc = BgPoEvent_BlockFall;
}
@@ -301,9 +301,9 @@ void BgPoEvent_CheckBlock(BgPoEvent* this) {
}
}
if ((phi_v1 == phi_a1) && ((phi_t0 - phi_a3) == 60)) {
sBgPoEventPuzzleState |= (1 << this->index);
sPuzzleState |= (1 << this->index);
} else {
sBgPoEventPuzzleState &= ~(1 << this->index);
sPuzzleState &= ~(1 << this->index);
}
}
@@ -314,7 +314,7 @@ void BgPoEvent_BlockFall(BgPoEvent* this, PlayState* play) {
if (Math_StepToF(&this->dyna.actor.world.pos.y, 433.0f, this->dyna.actor.velocity.y)) {
this->dyna.actor.flags &= ~ACTOR_FLAG_DRAW_CULLING_DISABLED;
this->dyna.actor.velocity.y = 0.0f;
sBgPoEventBlocksAtRest++;
sBlocksAtRest++;
if (this->type != 1) {
BgPoEvent_CheckBlock(this);
} else {
@@ -336,7 +336,7 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Actor* amy;
if (GameInteractor_Should(VB_AMY_SOLVE, sBgPoEventPuzzleState == 0xF)) {
if (GameInteractor_Should(VB_AMY_SOLVE, sPuzzleState == 0xF)) {
this->actionFunc = BgPoEvent_BlockSolved;
if ((this->type == 0) && (this->index == 0)) {
amy = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->dyna.actor.world.pos.x + 30.0f,
@@ -349,23 +349,23 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) {
gSaveContext.timerState = TIMER_STATE_STOP;
}
} else {
if ((gSaveContext.timerSeconds == 0) && (sBgPoEventBlocksAtRest == 5)) {
if ((gSaveContext.timerSeconds == 0) && (sBlocksAtRest == 5)) {
player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY;
sBgPoEventPuzzleState = 0x10;
sBgPoEventBlocksAtRest = 0;
sPuzzleState = 0x10;
sBlocksAtRest = 0;
}
if ((sBgPoEventPuzzleState == 0x40) || ((sBgPoEventPuzzleState == 0x10) && !Player_InCsMode(play))) {
if ((sPuzzleState == 0x40) || ((sPuzzleState == 0x10) && !Player_InCsMode(play))) {
this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z;
this->actionFunc = BgPoEvent_BlockReset;
if (sBgPoEventPuzzleState == 0x10) {
sBgPoEventPuzzleState = 0x40;
if (sPuzzleState == 0x10) {
sPuzzleState = 0x40;
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_RISING);
Player_SetCsActionWithHaltedActors(play, &player->actor, 8);
}
} else if (this->dyna.unk_150 != 0.0f) {
if (this->direction == 0) {
if (func_800435D8(play, &this->dyna, 0x1E, 0x32, -0x14) != 0) {
sBgPoEventBlocksAtRest--;
sBlocksAtRest--;
this->direction = (this->dyna.unk_150 >= 0.0f) ? 1.0f : -1.0f;
this->actionFunc = BgPoEvent_BlockPush;
} else {
@@ -383,12 +383,12 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) {
}
}
static f32 sBgPoEventblockPushDist = 0.0f;
static f32 blockPushDist = 0.0f;
#define BG_PO_EVENT_SHIP_SAVESTATE_FIELDS(F) \
F(sBgPoEventBlocksAtRest) \
F(sBgPoEventPuzzleState) \
F(sBgPoEventblockPushDist)
F(sBlocksAtRest) \
F(sPuzzleState) \
F(blockPushDist)
SHIP_SAVESTATE_DEFINE(BgPoEvent, BG_PO_EVENT_SHIP_SAVESTATE_FIELDS)
@@ -401,8 +401,8 @@ void BgPoEvent_BlockPush(BgPoEvent* this, PlayState* play) {
this->dyna.actor.speedXZ + (CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 0.3) + 0.5f;
this->dyna.actor.speedXZ =
CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f + (CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 0.5));
blockStop = Math_StepToF(&sBgPoEventblockPushDist, 20.0f, this->dyna.actor.speedXZ);
displacement = this->direction * sBgPoEventblockPushDist;
blockStop = Math_StepToF(&blockPushDist, 20.0f, this->dyna.actor.speedXZ);
displacement = this->direction * blockPushDist;
this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.x;
this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.z;
if (blockStop) {
@@ -413,10 +413,10 @@ void BgPoEvent_BlockPush(BgPoEvent* this, PlayState* play) {
this->dyna.unk_150 = 0.0f;
this->dyna.actor.home.pos.x = this->dyna.actor.world.pos.x;
this->dyna.actor.home.pos.z = this->dyna.actor.world.pos.z;
sBgPoEventblockPushDist = 0.0f;
blockPushDist = 0.0f;
this->dyna.actor.speedXZ = 0.0f;
this->direction = 5 - ((CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 3) / 5);
sBgPoEventBlocksAtRest++;
sBlocksAtRest++;
this->actionFunc = BgPoEvent_BlockIdle;
if (this->type == 1) {
return;
@@ -439,7 +439,7 @@ void BgPoEvent_BlockReset(BgPoEvent* this, PlayState* play) {
this->index = (this->index + 1) % 4;
this->actionFunc = BgPoEvent_BlockFall;
sBgPoEventPuzzleState = 0;
sPuzzleState = 0;
if (this->type == 1) {
this->timer += 10;
this->timer = CLAMP_MAX(this->timer, 120);
@@ -454,14 +454,14 @@ void BgPoEvent_BlockSolved(BgPoEvent* this, PlayState* play) {
player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY;
}
if (Math_StepToF(&this->dyna.actor.world.pos.y, 369.0f, 2.0f)) {
sBgPoEventPuzzleState = 0x20;
sPuzzleState = 0x20;
Actor_Kill(&this->dyna.actor);
}
}
void BgPoEvent_AmyWait(BgPoEvent* this, PlayState* play) {
if (this->collider.base.acFlags & AC_HIT) {
sBgPoEventPuzzleState |= 0x20;
sPuzzleState |= 0x20;
this->timer = 5;
Actor_SetColorFilter(&this->dyna.actor, 0x4000, 0xFF, 0, 5);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EN_PO_LAUGH2);
@@ -472,12 +472,12 @@ void BgPoEvent_AmyWait(BgPoEvent* this, PlayState* play) {
void BgPoEvent_AmyPuzzle(BgPoEvent* this, PlayState* play) {
Vec3f pos;
if (sBgPoEventPuzzleState == 0xF) {
if (sPuzzleState == 0xF) {
pos.x = this->dyna.actor.world.pos.x - 5.0f;
pos.y = Rand_CenteredFloat(120.0f) + this->dyna.actor.world.pos.y;
pos.z = Rand_CenteredFloat(120.0f) + this->dyna.actor.world.pos.z;
EffectSsDeadDb_Spawn(play, &pos, &sZeroVec, &sZeroVec, 170, 0, 200, 255, 100, 170, 0, 255, 0, 1, 9, true);
} else if (sBgPoEventPuzzleState == 0x20) {
} else if (sPuzzleState == 0x20) {
Actor_Kill(&this->dyna.actor);
} else {
DECR(this->timer);
@@ -487,14 +487,14 @@ void BgPoEvent_AmyPuzzle(BgPoEvent* this, PlayState* play) {
s32 BgPoEvent_NextPainting(BgPoEvent* this) {
if ((this->dyna.actor.parent != NULL) && (this->dyna.actor.child != NULL)) {
if (Rand_ZeroOne() < 0.5f) {
sBgPoEventPuzzleState = ((BgPoEvent*)this->dyna.actor.parent)->index;
sPuzzleState = ((BgPoEvent*)this->dyna.actor.parent)->index;
} else {
sBgPoEventPuzzleState = ((BgPoEvent*)this->dyna.actor.child)->index;
sPuzzleState = ((BgPoEvent*)this->dyna.actor.child)->index;
}
} else if (this->dyna.actor.parent != NULL) {
sBgPoEventPuzzleState = ((BgPoEvent*)this->dyna.actor.parent)->index;
sPuzzleState = ((BgPoEvent*)this->dyna.actor.parent)->index;
} else if (this->dyna.actor.child != NULL) {
sBgPoEventPuzzleState = ((BgPoEvent*)this->dyna.actor.child)->index;
sPuzzleState = ((BgPoEvent*)this->dyna.actor.child)->index;
} else {
return false;
}
@@ -502,7 +502,7 @@ s32 BgPoEvent_NextPainting(BgPoEvent* this) {
}
void BgPoEvent_PaintingEmpty(BgPoEvent* this, PlayState* play) {
if (sBgPoEventPuzzleState == this->index) {
if (sPuzzleState == this->index) {
this->timer = 255;
this->actionFunc = BgPoEvent_PaintingAppear;
}
@@ -644,7 +644,7 @@ void BgPoEvent_Draw(Actor* thisx, PlayState* play) {
}
void BgPoEvent_Reset(void) {
sBgPoEventBlocksAtRest = 0;
sBgPoEventPuzzleState = 0;
sBgPoEventblockPushDist = 0.0f;
sBlocksAtRest = 0;
sPuzzleState = 0;
blockPushDist = 0.0f;
}
@@ -239,20 +239,20 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) {
u16 dayTime;
s32 tmp;
if (gTimeIncrement == 50) {
if (gTimeSpeed == 50) {
tmp = 0xD556;
if (gSaveContext.dayTime >= 0xD557) {
tmp = 0x1D556;
}
gTimeIncrement = (tmp - gSaveContext.dayTime) * (1.0f / 350.0f);
gTimeSpeed = (tmp - gSaveContext.dayTime) * (1.0f / 350.0f);
}
dayTime = gSaveContext.dayTime;
if ((dayTime >= 0x2AAC) && (dayTime < 0x3000) && (gSaveContext.sceneLayer == 5)) {
gTimeIncrement = 0;
gTimeSpeed = 0;
}
}
}
@@ -86,9 +86,9 @@ void BgSpot18Basket_InitColliderJntSph(Actor* thisx, PlayState* play) {
this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE;
}
static s16 D_808B85D0 = 0;
static s16 spawnPos = 0;
#define BG_SPOT18_BASKET_SHIP_SAVESTATE_FIELDS(F) F(D_808B85D0)
#define BG_SPOT18_BASKET_SHIP_SAVESTATE_FIELDS(F) F(spawnPos)
SHIP_SAVESTATE_DEFINE(BgSpot18Basket, BG_SPOT18_BASKET_SHIP_SAVESTATE_FIELDS)
@@ -105,10 +105,10 @@ void BgSpot18Basket_SpawnDustClouds(BgSpot18Basket* this, PlayState* play, f32 a
for (i = 0, count = 2; i != count; i++) {
if (play) {}
if (!(arg2 < Rand_ZeroOne())) {
D_808B85D0 += 0x7530;
spawnPos += 0x7530;
sinValue = Math_SinS(D_808B85D0);
cosValue = Math_CosS(D_808B85D0);
sinValue = Math_SinS(spawnPos);
cosValue = Math_CosS(spawnPos);
randomValue = (Rand_ZeroOne() * 35.0f) + 35.0f;
@@ -464,5 +464,5 @@ void BgSpot18Basket_Draw(Actor* thisx, PlayState* play) {
}
void BgSpot18Basket_Reset(void) {
D_808B85D0 = 0;
spawnPos = 0;
}
@@ -113,26 +113,26 @@ static ColliderCylinderInit sLightBallCylinderInit = {
static u8 D_808E4C58[] = { 0, 12, 10, 12, 14, 16, 12, 14, 16, 12, 14, 16, 12, 14, 16, 10, 16, 14 };
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
static EnGanonMant* sBossGanonCape;
static EnGanonMant* sCape;
static s32 sBossGanonSeed1;
static s32 sBossGanonSeed3;
static s32 sBossGanonSeed2;
static s32 sSeed1;
static s32 sSeed3;
static s32 sSeed2;
static BossGanon* sBossGanonGanondorf;
static BossGanon* sGanondorf;
static EnZl3* sBossGanonZelda;
static EnZl3* sZelda;
static GanondorfEffect sBossGanonEffectBuf[200];
static GanondorfEffect sEffects[200];
#define BOSS_GANON_SHIP_SAVESTATE_FIELDS(F) \
F(sBossGanonSeed1) \
F(sBossGanonSeed2) \
F(sBossGanonSeed3) \
F(sBossGanonGanondorf) \
F(sBossGanonZelda) \
F(sBossGanonCape) \
F(sBossGanonEffectBuf)
F(sSeed1) \
F(sSeed2) \
F(sSeed3) \
F(sGanondorf) \
F(sZelda) \
F(sCape) \
F(sEffects)
SHIP_SAVESTATE_DEFINE(BossGanon, BOSS_GANON_SHIP_SAVESTATE_FIELDS)
static u8 sWindowShatterTex[2048] = { { 0 } };
@@ -358,13 +358,13 @@ void BossGanon_Init(Actor* thisx, PlayState* play2) {
if (thisx->params < 0x64) {
Flags_SetSwitch(play, 0x14);
play->specialEffects = sBossGanonEffectBuf;
play->specialEffects = sEffects;
for (i = 0; i < ARRAY_COUNT(sBossGanonEffectBuf); i++) {
sBossGanonEffectBuf[i].type = GDF_EFF_NONE;
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
sEffects[i].type = GDF_EFF_NONE;
}
sBossGanonGanondorf = this;
sGanondorf = this;
thisx->colChkInfo.health = 40;
Actor_ProcessInitChain(thisx, sInitChain);
ActorShape_Init(&thisx->shape, 0, NULL, 0);
@@ -392,8 +392,8 @@ void BossGanon_Init(Actor* thisx, PlayState* play2) {
BossGanon_SetupTowerCutscene(this, play);
}
sBossGanonCape = (EnGanonMant*)Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_GANON_MANT, 0.0f, 0.0f,
0.0f, 0, 0, 0, 1);
sCape = (EnGanonMant*)Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_EN_GANON_MANT, 0.0f, 0.0f, 0.0f, 0,
0, 0, 1);
Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_BOSS);
} else {
thisx->flags &= ~ACTOR_FLAG_ATTENTION_ENABLED;
@@ -555,10 +555,10 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment);
sBossGanonCape->backPush = -2.0f;
sBossGanonCape->backSwayMagnitude = 0.25f;
sBossGanonCape->sideSwayMagnitude = -1.0f;
sBossGanonCape->minDist = 0.0f;
sCape->backPush = -2.0f;
sCape->backSwayMagnitude = 0.25f;
sCape->sideSwayMagnitude = -1.0f;
sCape->minDist = 0.0f;
this->csTimer++;
@@ -603,12 +603,12 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
this->useOpenHand = true;
BossGanon_SetIntroCsCamera(this, 0);
this->csState = 1;
sBossGanonZelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 0.0f,
220.0f, -150.0f, 0, 0, 0, 0x2000);
sZelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 0.0f, 220.0f,
-150.0f, 0, 0, 0, 0x2000);
}
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_GANON_ORGAN, 0.0f, 0.0f, 0.0f, 0, 0, 0, 1);
sBossGanonCape->minY = 57.0f;
sCape->minY = 57.0f;
// fallthrough
case 1:
this->envLightMode = 3;
@@ -754,7 +754,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
this->csState = 9;
this->csTimer = 0;
Player_SetCsActionWithHaltedActors(play, &this->actor, 8);
sBossGanonZelda->unk_3C8 = 0;
sZelda->unk_3C8 = 0;
this->triforceType = GDF_TRIFORCE_ZELDA;
this->fwork[GDF_TRIFORCE_SCALE] = 10.0f;
this->fwork[GDF_TRIFORCE_PRIM_A] = 0.0f;
@@ -773,7 +773,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
Math_ApproachF(&this->fwork[GDF_TRIFORCE_ENV_G], 200.0f, 1.0f, 3.0f);
if (this->csTimer == 30) {
sBossGanonZelda->unk_3C8 = 1;
sZelda->unk_3C8 = 1;
}
if (this->csTimer >= 32) {
@@ -865,7 +865,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
this->csTimer = 0;
BossGanon_SetIntroCsCamera(this, 11);
this->unk_198 = 2;
sBossGanonZelda->unk_3C8 = 2;
sZelda->unk_3C8 = 2;
this->timers[2] = 110;
this->envLightMode = 3;
}
@@ -901,7 +901,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
if (this->csTimer > 10) {
if (this->csTimer == 62) {
sBossGanonCape->attachRightArmTimer = 20.0f;
sCape->attachRightArmTimer = 20.0f;
}
if (this->csTimer == 57) {
@@ -1111,7 +1111,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfGetUp3Anim, 0.0f);
SkelAnime_Update(&this->skelAnime);
this->actor.shape.yOffset = 0.0f;
sBossGanonCape->attachShouldersTimer = 18.0f;
sCape->attachShouldersTimer = 18.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
this->unk_198 = 0;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_GANONDORF_BOSS);
@@ -1136,9 +1136,9 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
Math_ApproachF(&this->actor.world.pos.y, 228.0f, 0.05f, 2.0f);
Math_ApproachF(&this->actor.world.pos.z, -230.0f, 0.05f, 4.0f);
sBossGanonCape->backPush = -3.0f;
sBossGanonCape->backSwayMagnitude = 0.25f;
sBossGanonCape->sideSwayMagnitude = -3.0f;
sCape->backPush = -3.0f;
sCape->backSwayMagnitude = 0.25f;
sCape->sideSwayMagnitude = -3.0f;
sin = Math_SinS(this->csTimer * 1500);
this->actor.velocity.y = this->fwork[GDF_FWORK_0] * sin * 0.04f;
@@ -1171,10 +1171,10 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
BossGanon_SetupWait(this, play);
}
if (sBossGanonZelda != NULL) {
sBossGanonZelda->actor.world.pos.x = 0.0f;
sBossGanonZelda->actor.world.pos.y = 350.0f;
sBossGanonZelda->actor.world.pos.z = 0.0f;
if (sZelda != NULL) {
sZelda->actor.world.pos.x = 0.0f;
sZelda->actor.world.pos.y = 350.0f;
sZelda->actor.world.pos.z = 0.0f;
}
}
@@ -1566,17 +1566,17 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfCollapseAnim, 0.0f);
this->fwork[1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim);
this->skelAnime.playSpeed = 0.0f;
sBossGanonZelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 0.0f,
6000.0f, 0.0f, 0, 0, 0, 0x2000);
sZelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 0.0f, 6000.0f, 0.0f,
0, 0, 0, 0x2000);
if (!IS_RANDO && !IS_BOSS_RUSH) {
this->csState = 101;
} else {
this->skelAnime.playSpeed = 1.0f;
sBossGanonZelda->actor.world.pos.x = -472.0f;
sBossGanonZelda->actor.world.pos.y = 4102.0f;
sBossGanonZelda->actor.world.pos.z = -200.0f;
sBossGanonZelda->unk_3C8 = 3;
sZelda->actor.world.pos.x = -472.0f;
sZelda->actor.world.pos.y = 4102.0f;
sZelda->actor.world.pos.z = -200.0f;
sZelda->unk_3C8 = 3;
this->csState = 104;
}
@@ -1599,12 +1599,12 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
this->csCamAt.z = -100.0f;
sBossGanonCape->backPush = -2.0f;
sBossGanonCape->backSwayMagnitude = 0.25f;
sBossGanonCape->sideSwayMagnitude = -1.0f;
sBossGanonCape->minDist = 0.0f;
sBossGanonCape->minY = 4104.0f;
sBossGanonCape->tearTimer = 20;
sCape->backPush = -2.0f;
sCape->backSwayMagnitude = 0.25f;
sCape->sideSwayMagnitude = -1.0f;
sCape->minDist = 0.0f;
sCape->minY = 4104.0f;
sCape->tearTimer = 20;
this->whiteFillAlpha = 255.0f;
play->envCtx.unk_D8 = 1.0f;
@@ -1668,27 +1668,27 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
if (this->csTimer == 90) {
this->csState = 103;
this->csTimer = 0;
sBossGanonZelda->actor.world.pos.x = -472.0f;
sBossGanonZelda->actor.world.pos.y = 4352.0f;
sBossGanonZelda->actor.world.pos.z = -200.0f;
sBossGanonZelda->unk_3C8 = 3;
sZelda->actor.world.pos.x = -472.0f;
sZelda->actor.world.pos.y = 4352.0f;
sZelda->actor.world.pos.z = -200.0f;
sZelda->unk_3C8 = 3;
}
break;
case 103:
Audio_PlayActorSound2(&sBossGanonZelda->actor, NA_SE_EV_DOWN_TO_GROUND - SFX_FLAG);
Math_ApproachF(&sBossGanonZelda->actor.world.pos.y, 4102.0f, 0.05f, 1.5f);
Audio_PlayActorSound2(&sZelda->actor, NA_SE_EV_DOWN_TO_GROUND - SFX_FLAG);
Math_ApproachF(&sZelda->actor.world.pos.y, 4102.0f, 0.05f, 1.5f);
this->csCamEye.x = -242.0f;
this->csCamEye.y = 4122.0f;
this->csCamEye.z = -190.0f;
this->csCamAt.x = sBossGanonZelda->actor.world.pos.x;
this->csCamAt.y = sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sBossGanonZelda->actor.world.pos.z;
this->csCamAt.x = sZelda->actor.world.pos.x;
this->csCamAt.y = sZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sZelda->actor.world.pos.z;
if (this->csTimer == 200) {
sBossGanonZelda->actor.world.pos.y = 4102.0f;
sZelda->actor.world.pos.y = 4102.0f;
this->csState = 104;
this->csTimer = 0;
} else {
@@ -1705,26 +1705,26 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
this->csCamEye.y = 4147.0f;
this->csCamEye.z = -200.0f;
this->csCamAt.x = sBossGanonZelda->actor.world.pos.x;
this->csCamAt.y = sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sBossGanonZelda->actor.world.pos.z;
this->csCamAt.x = sZelda->actor.world.pos.x;
this->csCamAt.y = sZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sZelda->actor.world.pos.z;
if (this->csTimer >= 10) {
Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.05f);
}
if (this->csTimer == 10) {
sBossGanonZelda->unk_3C8 = 8;
sZelda->unk_3C8 = 8;
}
if (this->csTimer == 50) {
// In rando, skip the rest of the cutscene after the crystal around Zelda dissapears.
if (!IS_RANDO && !IS_BOSS_RUSH) {
sBossGanonZelda->unk_3C8 = 4;
sZelda->unk_3C8 = 4;
} else {
this->csState = 108;
this->csTimer = 0;
sBossGanonZelda->unk_3C8 = 7;
sZelda->unk_3C8 = 7;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ESCAPE);
break;
}
@@ -1741,9 +1741,9 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
this->csCamEye.y = 4154.0f;
this->csCamEye.z = -182.0f;
this->csCamAt.x = sBossGanonZelda->actor.world.pos.x - 5.0f;
this->csCamAt.y = sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sBossGanonZelda->actor.world.pos.z - 25.0f;
this->csCamAt.x = sZelda->actor.world.pos.x - 5.0f;
this->csCamAt.y = sZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sZelda->actor.world.pos.z - 25.0f;
if (this->csTimer == 10) {
Message_StartTextbox(play, 0x70D0, NULL);
@@ -1760,7 +1760,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
Sfx_PlaySfxCentered(NA_SE_EV_EARTHQUAKE - SFX_FLAG);
if (this->csTimer == 20) {
sBossGanonZelda->unk_3C8 = 5;
sZelda->unk_3C8 = 5;
Player_SetCsActionWithHaltedActors(play, &this->actor, 0x39);
}
@@ -1809,15 +1809,15 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
this->csCamEye.y = 4154.0f;
this->csCamEye.z = -182.0f;
this->csCamAt.x = sBossGanonZelda->actor.world.pos.x - 5.0f;
this->csCamAt.y = sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sBossGanonZelda->actor.world.pos.z - 25.0f;
this->csCamAt.x = sZelda->actor.world.pos.x - 5.0f;
this->csCamAt.y = sZelda->actor.world.pos.y + 40.0f + 5.0f;
this->csCamAt.z = sZelda->actor.world.pos.z - 25.0f;
this->unk_70C = Math_SinS(this->csTimer * 0x6300) * 0.3f;
Sfx_PlaySfxCentered(NA_SE_EV_EARTHQUAKE - SFX_FLAG);
if (this->csTimer == 70) {
sBossGanonZelda->unk_3C8 = 6;
sZelda->unk_3C8 = 6;
}
if (this->csTimer == 90) {
@@ -1840,12 +1840,12 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
this->csCamEye.y = 4154.0f;
this->csCamEye.z = -242.0f;
this->csCamAt.x = (sBossGanonZelda->actor.world.pos.x - 5.0f) - 30.0f;
this->csCamAt.y = (sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f) - 20.0f;
this->csCamAt.z = (sBossGanonZelda->actor.world.pos.z - 25.0f) + 80.0f;
this->csCamAt.x = (sZelda->actor.world.pos.x - 5.0f) - 30.0f;
this->csCamAt.y = (sZelda->actor.world.pos.y + 40.0f + 5.0f) - 20.0f;
this->csCamAt.z = (sZelda->actor.world.pos.z - 25.0f) + 80.0f;
if ((this->csTimer > 50) && (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE)) {
sBossGanonZelda->unk_3C8 = 7;
sZelda->unk_3C8 = 7;
this->csState = 108;
this->csTimer = 0;
}
@@ -1855,9 +1855,9 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
this->unk_70C = Math_SinS(this->csTimer * 0x6300) * 0.8f;
Sfx_PlaySfxCentered(NA_SE_EV_EARTHQUAKE - SFX_FLAG);
this->csCamAt.x = (sBossGanonZelda->actor.world.pos.x - 5.0f) - 30.0f;
this->csCamAt.y = (sBossGanonZelda->actor.world.pos.y + 40.0f + 5.0f) - 20.0f;
this->csCamAt.z = (sBossGanonZelda->actor.world.pos.z - 25.0f) + 80.0f;
this->csCamAt.x = (sZelda->actor.world.pos.x - 5.0f) - 30.0f;
this->csCamAt.y = (sZelda->actor.world.pos.y + 40.0f + 5.0f) - 20.0f;
this->csCamAt.z = (sZelda->actor.world.pos.z - 25.0f) + 80.0f;
if (this->csTimer > 50) {
mainCam = Play_GetCamera(play, CAM_ID_MAIN);
@@ -1967,7 +1967,7 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) {
break;
case 1:
sBossGanonCape->gravity = -1.0f;
sCape->gravity = -1.0f;
this->envLightMode = 1;
Math_ApproachF(&this->actor.velocity.y, -50.0f, 1.0f, 10.0f);
this->actor.world.pos.y += this->actor.velocity.y;
@@ -2014,7 +2014,7 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) {
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfGetUp3Anim);
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfGetUp3Anim, 0.0f);
SkelAnime_Update(&this->skelAnime);
sBossGanonCape->attachShouldersTimer = 18.0f;
sCape->attachShouldersTimer = 18.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
this->unk_1C2 = 4;
}
@@ -2198,7 +2198,7 @@ void BossGanon_ChargeBigMagic(BossGanon* this, PlayState* play) {
}
if (this->timers[0] == 1) {
sBossGanonCape->attachLeftArmTimer = 15.0f;
sCape->attachLeftArmTimer = 15.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
}
@@ -2236,7 +2236,7 @@ void BossGanon_ChargeBigMagic(BossGanon* this, PlayState* play) {
}
if (Animation_OnFrame(&this->skelAnime, 3.0f)) {
sBossGanonCape->attachShouldersTimer = 26.0f;
sCape->attachShouldersTimer = 26.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
}
@@ -2264,7 +2264,7 @@ void BossGanon_SetupWait(BossGanon* this, PlayState* play) {
this->fwork[GDF_FWORK_0] = 0.0f;
this->timers[0] = (s16)Rand_ZeroFloat(64.0f) + 30;
this->unk_1C2 = 0;
sBossGanonCape->minY = 2.0f;
sCape->minY = 2.0f;
}
void BossGanon_Wait(BossGanon* this, PlayState* play) {
@@ -2275,10 +2275,10 @@ void BossGanon_Wait(BossGanon* this, PlayState* play) {
this->legSwayEnabled = true;
sBossGanonCape->backPush = -3.0f;
sBossGanonCape->backSwayMagnitude = 0.25f;
sBossGanonCape->sideSwayMagnitude = -3.0f;
sBossGanonCape->minDist = 20.0f;
sCape->backPush = -3.0f;
sCape->backSwayMagnitude = 0.25f;
sCape->sideSwayMagnitude = -3.0f;
sCape->minDist = 20.0f;
SkelAnime_Update(&this->skelAnime);
@@ -2333,10 +2333,10 @@ void BossGanon_SetupChargeLightBall(BossGanon* this, PlayState* play) {
void BossGanon_ChargeLightBall(BossGanon* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
sBossGanonCape->backPush = -3.0f;
sBossGanonCape->backSwayMagnitude = 1.25f;
sBossGanonCape->sideSwayMagnitude = -2.0f;
sBossGanonCape->minDist = 10.0f;
sCape->backPush = -3.0f;
sCape->backSwayMagnitude = 1.25f;
sCape->sideSwayMagnitude = -2.0f;
sCape->minDist = 10.0f;
if (this->timers[0] < 17) {
this->envLightMode = 1;
@@ -2417,7 +2417,7 @@ void BossGanon_PlayTennis(BossGanon* this, PlayState* play) {
rand = Rand_ZeroOne() * 1.99f;
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(volleyAnims[rand]);
Animation_MorphToPlayOnce(&this->skelAnime, volleyAnims[rand], 0.0f);
sBossGanonCape->attachRightArmTimer = capeRightArmDurations[rand];
sCape->attachRightArmTimer = capeRightArmDurations[rand];
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
this->startVolley = false;
}
@@ -2445,7 +2445,7 @@ void BossGanon_SetupBlock(BossGanon* this, PlayState* play) {
}
this->unk_1C2 = 0;
sBossGanonCape->attachLeftArmTimer = this->timers[0] = 10;
sCape->attachLeftArmTimer = this->timers[0] = 10;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
this->handLightBallScale = 0.0f;
}
@@ -2453,10 +2453,10 @@ void BossGanon_SetupBlock(BossGanon* this, PlayState* play) {
void BossGanon_Block(BossGanon* this, PlayState* play) {
this->collider.base.colType = 9;
SkelAnime_Update(&this->skelAnime);
sBossGanonCape->backPush = -9.0f;
sBossGanonCape->backSwayMagnitude = 0.25f;
sBossGanonCape->sideSwayMagnitude = -2.0f;
sBossGanonCape->minDist = 13.0f;
sCape->backPush = -9.0f;
sCape->backSwayMagnitude = 0.25f;
sCape->sideSwayMagnitude = -2.0f;
sCape->minDist = 13.0f;
if (this->unk_1C2 == 0) {
if (this->timers[0] == 0) {
@@ -2464,11 +2464,11 @@ void BossGanon_Block(BossGanon* this, PlayState* play) {
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfBlockReleaseAnim, 0.0f);
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfBlockReleaseAnim);
SkelAnime_Update(&this->skelAnime);
sBossGanonCape->attachShouldersTimer = 15.0f;
sCape->attachShouldersTimer = 15.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
}
} else {
sBossGanonCape->sideSwayMagnitude = -13.0f;
sCape->sideSwayMagnitude = -13.0f;
if (Animation_OnFrame(&this->skelAnime, this->fwork[GDF_FWORK_1])) {
BossGanon_SetupWait(this, play);
@@ -2491,7 +2491,7 @@ void BossGanon_SetupHitByLightBall(BossGanon* this, PlayState* play) {
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfBigMagicHitAnim);
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfBigMagicHitAnim, 0);
this->timers[0] = 70;
sBossGanonCape->attachRightArmTimer = sBossGanonCape->attachLeftArmTimer = 0;
sCape->attachRightArmTimer = sCape->attachLeftArmTimer = 0;
for (i = 1; i < 15; i++) {
this->unk_4E4[i] = D_808E4C58[i];
@@ -2528,7 +2528,7 @@ void BossGanon_HitByLightBall(BossGanon* this, PlayState* play) {
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfGetUp3Anim, 0.0f);
this->unk_1C2 = 2;
SkelAnime_Update(&this->skelAnime);
sBossGanonCape->attachShouldersTimer = 18.0f;
sCape->attachShouldersTimer = 18.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_RESTORE);
this->timers[2] = 130;
@@ -2562,7 +2562,7 @@ void BossGanon_SetupVulnerable(BossGanon* this, PlayState* play) {
BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1);
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfLightArrowHitAnim);
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfLightArrowHitAnim, 0.0f);
sBossGanonCape->attachRightArmTimer = sBossGanonCape->attachLeftArmTimer = 0;
sCape->attachRightArmTimer = sCape->attachLeftArmTimer = 0;
this->actionFunc = BossGanon_Vulnerable;
this->actor.velocity.x = 0.0f;
@@ -2570,10 +2570,10 @@ void BossGanon_SetupVulnerable(BossGanon* this, PlayState* play) {
this->actor.velocity.z = 0.0f;
this->unk_1C2 = 0;
sBossGanonCape->backPush = -4.0f;
sBossGanonCape->backSwayMagnitude = 0.75f;
sBossGanonCape->sideSwayMagnitude = -3.0f;
sBossGanonCape->minDist = 20.0f;
sCape->backPush = -4.0f;
sCape->backSwayMagnitude = 0.75f;
sCape->sideSwayMagnitude = -3.0f;
sCape->minDist = 20.0f;
for (i = 0; i < 10; i++) {
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BOSS_GANON, this->unk_1FC.x, this->unk_1FC.y,
@@ -2633,7 +2633,7 @@ void BossGanon_Vulnerable(BossGanon* this, PlayState* play) {
break;
case 2:
sBossGanonCape->minDist = 0.0f;
sCape->minDist = 0.0f;
this->actor.velocity.y = this->actor.velocity.y - 0.5f;
if (this->actor.world.pos.y < 40.0f) {
@@ -2687,7 +2687,7 @@ void BossGanon_Vulnerable(BossGanon* this, PlayState* play) {
this->unk_1C2 = 6;
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfGetUp2Anim);
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfGetUp2Anim, 0.0f);
sBossGanonCape->minDist = 20.0f;
sCape->minDist = 20.0f;
this->unk_19F = 1;
}
break;
@@ -2708,7 +2708,7 @@ void BossGanon_Vulnerable(BossGanon* this, PlayState* play) {
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfGetUp3Anim, 0.0f);
this->unk_1C2 = 8;
SkelAnime_Update(&this->skelAnime);
sBossGanonCape->attachShouldersTimer = 18.0f;
sCape->attachShouldersTimer = 18.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_GANON_MANTLE);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_RESTORE);
break;
@@ -2805,10 +2805,10 @@ void BossGanon_UpdateDamage(BossGanon* this, PlayState* play) {
this->actor.colChkInfo.health -= damage;
}
for (i = 0; i < ARRAY_COUNT(sBossGanonCape->strands); i++) {
for (i = 0; i < ARRAY_COUNT(sCape->strands); i++) {
for (j = 1; j < 12; j++) {
sBossGanonCape->strands[i].velocities[j].x = Rand_CenteredFloat(15.0f);
sBossGanonCape->strands[i].velocities[j].z = Rand_CenteredFloat(15.0f);
sCape->strands[i].velocities[j].x = Rand_CenteredFloat(15.0f);
sCape->strands[i].velocities[j].z = Rand_CenteredFloat(15.0f);
}
}
@@ -2825,16 +2825,16 @@ void BossGanon_UpdateDamage(BossGanon* this, PlayState* play) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_CUTBODY);
BossGanon_SetupDamaged(this, play);
this->unk_1A6 = 15;
sBossGanonCape->tearTimer = 1;
sCape->tearTimer = 1;
}
}
} else if (acHitInfo->toucher.dmgFlags & 0x1F8A4) {
Audio_PlayActorSound2(&this->actor, 0);
for (i = 0; i < ARRAY_COUNT(sBossGanonCape->strands); i++) {
for (i = 0; i < ARRAY_COUNT(sCape->strands); i++) {
for (j = 1; j < 12; j++) {
sBossGanonCape->strands[i].velocities[j].x = Rand_CenteredFloat(15.0f);
sBossGanonCape->strands[i].velocities[j].z = Rand_CenteredFloat(15.0f);
sCape->strands[i].velocities[j].x = Rand_CenteredFloat(15.0f);
sCape->strands[i].velocities[j].z = Rand_CenteredFloat(15.0f);
}
}
}
@@ -2904,7 +2904,7 @@ void BossGanon_Update(Actor* thisx, PlayState* play2) {
}
this->collider.base.colType = 3;
sBossGanonCape->gravity = -3.0f;
sCape->gravity = -3.0f;
this->shockGlow = false;
this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED;
this->unk_1A2++;
@@ -3393,20 +3393,20 @@ void BossGanon_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s*
}
void BossGanon_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) {
sBossGanonSeed1 = seedInit0;
sBossGanonSeed2 = seedInit1;
sBossGanonSeed3 = seedInit2;
sSeed1 = seedInit0;
sSeed2 = seedInit1;
sSeed3 = seedInit2;
}
f32 BossGanon_RandZeroOne(void) {
// Wichmann-Hill algorithm
f32 randFloat;
sBossGanonSeed1 = (sBossGanonSeed1 * 171) % 30269;
sBossGanonSeed2 = (sBossGanonSeed2 * 172) % 30307;
sBossGanonSeed3 = (sBossGanonSeed3 * 170) % 30323;
sSeed1 = (sSeed1 * 171) % 30269;
sSeed2 = (sSeed2 * 172) % 30307;
sSeed3 = (sSeed3 * 170) % 30323;
randFloat = (sBossGanonSeed1 / 30269.0f) + (sBossGanonSeed2 / 30307.0f) + (sBossGanonSeed3 / 30323.0f);
randFloat = (sSeed1 / 30269.0f) + (sSeed2 / 30307.0f) + (sSeed3 / 30323.0f);
while (randFloat >= 1.0f) {
randFloat -= 1.0f;
@@ -3622,7 +3622,7 @@ void BossGanon_DrawTriforce(BossGanon* this, PlayState* play) {
this->triforcePos.y += 3.0f;
this->triforcePos.z += -2.0f;
} else if (this->triforceType == GDF_TRIFORCE_ZELDA) {
this->triforcePos = sBossGanonZelda->unk_31C;
this->triforcePos = sZelda->unk_31C;
this->triforcePos.y += 1.8f;
this->triforcePos.z += 4.0f;
@@ -3795,9 +3795,9 @@ void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, PlayState* play) {
for (i = 0; i < 12; i++) {
for (j = 0; j < 12; j++) {
sp7C.x = sBossGanonCape->strands[i].joints[j].x - this->actor.world.pos.x;
sp7C.y = sBossGanonCape->strands[i].joints[j].y - this->actor.world.pos.y + 76.0f + 100.0f + 30.0f;
sp7C.z = sBossGanonCape->strands[i].joints[j].z - this->actor.world.pos.z;
sp7C.x = sCape->strands[i].joints[j].x - this->actor.world.pos.x;
sp7C.y = sCape->strands[i].joints[j].y - this->actor.world.pos.y + 76.0f + 100.0f + 30.0f;
sp7C.z = sCape->strands[i].joints[j].z - this->actor.world.pos.z;
Matrix_MultVec3f(&sp7C, &sp70);
@@ -3807,7 +3807,7 @@ void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, PlayState* play) {
baseX = (s32)(sp70.x + 32.0f);
baseY = (s16)sp70.y * 0x40;
if (!sBossGanonCape->strands[i].torn[j]) {
if (!sCape->strands[i].torn[j]) {
for (y = -1, addY = -0x40; y <= 1; y++, addY += 0x40) {
for (x = -3; x <= 3; x++) {
index = baseX + x + baseY + addY;
@@ -3892,13 +3892,13 @@ void BossGanon_Draw(Actor* thisx, PlayState* play) {
BossGanon_DrawEffects(play);
sBossGanonCape->actor.world.pos = this->actor.world.pos;
sCape->actor.world.pos = this->actor.world.pos;
sBossGanonCape->rightForearmPos = this->unk_214;
sBossGanonCape->leftForearmPos = this->unk_220;
sCape->rightForearmPos = this->unk_214;
sCape->leftForearmPos = this->unk_220;
sBossGanonCape->rightShoulderPos = this->unk_22C;
sBossGanonCape->leftShoulderPos = this->unk_238;
sCape->rightShoulderPos = this->unk_22C;
sCape->leftShoulderPos = this->unk_238;
BossGanon_DrawShock(this, play);
BossGanon_DrawHandLightBall(this, play);
@@ -4691,7 +4691,7 @@ void BossGanon_UpdateEffects(PlayState* play) {
spA0.x = 0.0f;
spA0.y = 0.0f;
for (i = 0; i < ARRAY_COUNT(sBossGanonEffectBuf); i++, eff++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, eff++) {
if (eff->type != GDF_EFF_NONE) {
eff->pos.x += eff->velocity.x;
eff->pos.y += eff->velocity.y;
@@ -4725,9 +4725,9 @@ void BossGanon_UpdateEffects(PlayState* play) {
eff->alpha = 255;
}
} else if (eff->type == GDF_EFF_BLACK_DOT) {
xDiff = sBossGanonGanondorf->unk_278.x - eff->pos.x;
yDiff = sBossGanonGanondorf->unk_278.y - eff->pos.y;
zDiff = sBossGanonGanondorf->unk_278.z - eff->pos.z;
xDiff = sGanondorf->unk_278.x - eff->pos.x;
yDiff = sGanondorf->unk_278.y - eff->pos.y;
zDiff = sGanondorf->unk_278.z - eff->pos.z;
yRot = Math_FAtan2F(xDiff, zDiff);
@@ -4767,9 +4767,9 @@ void BossGanon_UpdateEffects(PlayState* play) {
if (eff->unk_2E == GDF_SHOCK_DORF_YELLOW) {
bodyPart = (s16)Rand_ZeroFloat(13.9f) + 1;
eff->pos.x = sBossGanonGanondorf->unk_2EC[bodyPart].x + Rand_CenteredFloat(20.0f);
eff->pos.y = sBossGanonGanondorf->unk_2EC[bodyPart].y + Rand_CenteredFloat(20.0f);
eff->pos.z = sBossGanonGanondorf->unk_2EC[bodyPart].z + Rand_CenteredFloat(20.0f);
eff->pos.x = sGanondorf->unk_2EC[bodyPart].x + Rand_CenteredFloat(20.0f);
eff->pos.y = sGanondorf->unk_2EC[bodyPart].y + Rand_CenteredFloat(20.0f);
eff->pos.z = sGanondorf->unk_2EC[bodyPart].z + Rand_CenteredFloat(20.0f);
} else {
bodyPart = (s16)Rand_ZeroFloat(17.9f);
@@ -4862,8 +4862,8 @@ void BossGanon_UpdateEffects(PlayState* play) {
if (((eff->scale * 150.0f) < distToPlayer) && (distToPlayer < (eff->scale * 300.0f))) {
eff->timer = 150;
Actor_SetPlayerKnockbackLarge(play, &sBossGanonGanondorf->actor, 7.0f,
sBossGanonGanondorf->actor.yawTowardsPlayer, 0.0f, 0x20);
Actor_SetPlayerKnockbackLarge(play, &sGanondorf->actor, 7.0f,
sGanondorf->actor.yawTowardsPlayer, 0.0f, 0x20);
}
}
}
@@ -5009,8 +5009,7 @@ void BossGanon_DrawEffects(PlayState* play) {
255);
gDPSetEnvColor(POLY_XLU_DISP++, sLightningEnvColors[(eff->timer * 3) + 0],
sLightningEnvColors[(eff->timer * 3) + 1], sLightningEnvColors[(eff->timer * 3) + 2], 0);
Matrix_Translate(sBossGanonGanondorf->unk_260.x, sBossGanonGanondorf->unk_260.y,
sBossGanonGanondorf->unk_260.z, MTXMODE_NEW);
Matrix_Translate(sGanondorf->unk_260.x, sGanondorf->unk_260.y, sGanondorf->unk_260.z, MTXMODE_NEW);
Matrix_RotateY(eff->unk_48, MTXMODE_APPLY);
Matrix_RotateZ(eff->unk_3C, MTXMODE_APPLY);
Matrix_Scale(eff->scale, eff->scale, eff->scale, MTXMODE_APPLY);
@@ -5106,11 +5105,11 @@ void BossGanon_DrawEffects(PlayState* play) {
#include "overlays/ovl_Boss_Ganon/ovl_Boss_Ganon.h"
void BossGanon_Reset(void) {
sBossGanonSeed1 = 0;
sBossGanonSeed2 = 0;
sBossGanonSeed3 = 0;
sBossGanonGanondorf = NULL;
sBossGanonZelda = NULL;
sBossGanonCape = NULL;
memset(sBossGanonEffectBuf, 0, sizeof(sBossGanonEffectBuf));
sSeed1 = 0;
sSeed2 = 0;
sSeed3 = 0;
sGanondorf = NULL;
sZelda = NULL;
sCape = NULL;
memset(sEffects, 0, sizeof(sEffects));
}
@@ -59,15 +59,15 @@ const ActorInit Boss_Ganon2_InitVars = {
static Vec3f D_8090EB20;
static EnZl3* sBossGanon2Zelda;
static EnZl3* sZelda;
static Actor* D_8090EB30;
static BossGanon2Effect sBossGanon2Particles[100];
static BossGanon2Effect sEffects[100];
static s32 sBossGanon2Seed1;
static s32 sBossGanon2Seed2;
static s32 sBossGanon2Seed3;
static s32 sSeed1;
static s32 sSeed2;
static s32 sSeed3;
static Vec3f D_809105D8[4];
@@ -78,31 +78,31 @@ static s8 D_80910638;
#define BOSS_GANON2_SHIP_SAVESTATE_FIELDS(F) \
F(D_8090EB20) \
F(D_80910638) \
F(sBossGanon2Zelda) \
F(sZelda) \
F(D_8090EB30) \
F(sBossGanon2Seed1) \
F(sBossGanon2Seed2) \
F(sBossGanon2Seed3) \
F(sSeed1) \
F(sSeed2) \
F(sSeed3) \
F(D_809105D8) \
F(D_80910608) \
F(sBossGanon2Particles)
F(sEffects)
SHIP_SAVESTATE_DEFINE(BossGanon2, BOSS_GANON2_SHIP_SAVESTATE_FIELDS)
void BossGanon2_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) {
sBossGanon2Seed1 = seedInit0;
sBossGanon2Seed2 = seedInit1;
sBossGanon2Seed3 = seedInit2;
sSeed1 = seedInit0;
sSeed2 = seedInit1;
sSeed3 = seedInit2;
}
f32 BossGanon2_RandZeroOne(void) {
// Wichmann-Hill algorithm
f32 randFloat;
sBossGanon2Seed1 = (sBossGanon2Seed1 * 171) % 30269;
sBossGanon2Seed2 = (sBossGanon2Seed2 * 172) % 30307;
sBossGanon2Seed3 = (sBossGanon2Seed3 * 170) % 30323;
sSeed1 = (sSeed1 * 171) % 30269;
sSeed2 = (sSeed2 * 172) % 30307;
sSeed3 = (sSeed3 * 170) % 30323;
randFloat = (sBossGanon2Seed1 / 30269.0f) + (sBossGanon2Seed2 / 30307.0f) + (sBossGanon2Seed3 / 30323.0f);
randFloat = (sSeed1 / 30269.0f) + (sSeed2 / 30307.0f) + (sSeed3 / 30323.0f);
while (randFloat >= 1.0f) {
randFloat -= 1.0f;
}
@@ -153,7 +153,7 @@ void func_808FD27C(PlayState* play, Vec3f* position, Vec3f* velocity, f32 scale)
BossGanon2Effect* effect = play->specialEffects;
s16 i;
for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == 0) {
effect->type = 2;
effect->position = *position;
@@ -177,10 +177,10 @@ void BossGanon2_Init(Actor* thisx, PlayState* play) {
s32 pad;
s16 i;
play->specialEffects = sBossGanon2Particles;
play->specialEffects = sEffects;
for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++) {
sBossGanon2Particles[i].type = 0;
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
sEffects[i].type = 0;
}
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
@@ -250,13 +250,13 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
this->subCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE);
sBossGanon2Zelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 970.0f,
1086.0f, -200.0f, 0, 0, 0, 1);
sBossGanon2Zelda->unk_3C8 = 0;
sBossGanon2Zelda->actor.world.pos.x = 970.0f;
sBossGanon2Zelda->actor.world.pos.y = 1086.0f;
sBossGanon2Zelda->actor.world.pos.z = -214.0f;
sBossGanon2Zelda->actor.shape.rot.y = -0x7000;
sZelda = (EnZl3*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ZL3, 970.0f, 1086.0f,
-200.0f, 0, 0, 0, 1);
sZelda->unk_3C8 = 0;
sZelda->actor.world.pos.x = 970.0f;
sZelda->actor.world.pos.y = 1086.0f;
sZelda->actor.world.pos.z = -214.0f;
sZelda->actor.shape.rot.y = -0x7000;
// In rando, skip past the cutscene to the part where the player takes control again.
if (!IS_RANDO && !IS_BOSS_RUSH) {
@@ -265,7 +265,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
} else {
this->csState = 4;
this->csTimer = 99;
sBossGanon2Zelda->unk_3C8 = 4;
sZelda->unk_3C8 = 4;
}
this->subCamUp.x = 0.0f;
@@ -314,20 +314,20 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
player->actor.world.pos.x = 970.0f;
player->actor.world.pos.y = 1086.0f;
player->actor.world.pos.z = -166.0f;
sBossGanon2Zelda->actor.world.pos.x = 974.0f;
sBossGanon2Zelda->actor.world.pos.y = 1086.0f;
sBossGanon2Zelda->actor.world.pos.z = -186.0f;
sZelda->actor.world.pos.x = 974.0f;
sZelda->actor.world.pos.y = 1086.0f;
sZelda->actor.world.pos.z = -186.0f;
player->actor.shape.rot.y = -0x5000;
sBossGanon2Zelda->actor.shape.rot.y = -0x5000;
sZelda->actor.shape.rot.y = -0x5000;
if (this->csTimer == 60) {
Message_StartTextbox(play, 0x70D4, NULL);
}
if (this->csTimer == 40) {
sBossGanon2Zelda->unk_3C8 = 1;
sZelda->unk_3C8 = 1;
Player_SetCsActionWithHaltedActors(play, &this->actor, 0x4E);
}
if (this->csTimer == 85) {
sBossGanon2Zelda->unk_3C8 = 2;
sZelda->unk_3C8 = 2;
Player_SetCsActionWithHaltedActors(play, &this->actor, 0x4F);
}
this->subCamEye.x = 930.0f;
@@ -356,14 +356,14 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP);
}
if (this->csTimer == 20) {
sBossGanon2Zelda->unk_3C8 = 3;
sZelda->unk_3C8 = 3;
Player_SetCsActionWithHaltedActors(play, &this->actor, 0x50);
}
if (this->csTimer == 55) {
this->csState = 4;
this->csTimer = 0;
this->unk_410.x = 0.0f;
sBossGanon2Zelda->unk_3C8 = 4;
sZelda->unk_3C8 = 4;
Player_SetCsActionWithHaltedActors(play, &this->actor, 0x50);
}
break;
@@ -403,11 +403,11 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
player->actor.world.pos.x = 490.0f;
player->actor.world.pos.y = 1086.0f;
player->actor.world.pos.z = -166.0f;
sBossGanon2Zelda->actor.world.pos.x = 724.0f;
sBossGanon2Zelda->actor.world.pos.y = 1086.0f;
sBossGanon2Zelda->actor.world.pos.z = -186.0f;
sZelda->actor.world.pos.x = 724.0f;
sZelda->actor.world.pos.y = 1086.0f;
sZelda->actor.world.pos.z = -186.0f;
player->actor.shape.rot.y = -0x4000;
sBossGanon2Zelda->actor.shape.rot.y = -0x5000;
sZelda->actor.shape.rot.y = -0x5000;
this->subCamEye.x = 410.0f;
this->subCamEye.y = 1096.0f;
this->subCamEye.z = -110.0f;
@@ -426,7 +426,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
this->unk_339 = 4;
}
if (this->csTimer == 30) {
sBossGanon2Zelda->unk_3C8 = 5;
sZelda->unk_3C8 = 5;
Player_SetCsActionWithHaltedActors(play, &this->actor, 0x51);
}
if (this->csTimer == 50) {
@@ -440,11 +440,11 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
player->actor.world.pos.x = 490.0f;
player->actor.world.pos.y = 1086.0f;
player->actor.world.pos.z = -166.0f;
sBossGanon2Zelda->actor.world.pos.x = 724.0f;
sBossGanon2Zelda->actor.world.pos.y = 1086.0f;
sBossGanon2Zelda->actor.world.pos.z = -186.0f;
sZelda->actor.world.pos.x = 724.0f;
sZelda->actor.world.pos.y = 1086.0f;
sZelda->actor.world.pos.z = -186.0f;
player->actor.shape.rot.y = -0x4000;
sBossGanon2Zelda->actor.shape.rot.y = -0x5000;
sZelda->actor.shape.rot.y = -0x5000;
this->subCamEye.x = 450.0f;
this->subCamEye.y = 1121.0f;
this->subCamEye.z = -158.0f;
@@ -513,9 +513,9 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
player->actor.world.pos.y = 1086.0f;
player->actor.world.pos.z = -266.0f;
player->actor.shape.rot.y = -0x4000;
sBossGanon2Zelda->actor.world.pos.x = 724.0f;
sBossGanon2Zelda->actor.world.pos.y = 1086.0f;
sBossGanon2Zelda->actor.world.pos.z = -186.0f;
sZelda->actor.world.pos.x = 724.0f;
sZelda->actor.world.pos.y = 1086.0f;
sZelda->actor.world.pos.z = -186.0f;
this->subCamEye.x = this->actor.world.pos.x + -10.0f;
this->subCamEye.y = this->actor.world.pos.y + 80.0f;
this->subCamEye.z = this->actor.world.pos.z + 50.0f;
@@ -834,9 +834,9 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
BossGanon2Effect* effect = play->specialEffects;
effect->unk_2E = 1;
effect->position.x = sBossGanon2Zelda->actor.world.pos.x + 50.0f + 10.0f;
effect->position.y = sBossGanon2Zelda->actor.world.pos.y + 350.0f;
effect->position.z = sBossGanon2Zelda->actor.world.pos.z - 25.0f;
effect->position.x = sZelda->actor.world.pos.x + 50.0f + 10.0f;
effect->position.y = sZelda->actor.world.pos.y + 350.0f;
effect->position.z = sZelda->actor.world.pos.z - 25.0f;
effect->velocity.x = 0.0f;
effect->velocity.z = 0.0f;
effect->velocity.y = -30.0f;
@@ -846,15 +846,15 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
break;
}
case 26:
this->subCamEye.x = sBossGanon2Zelda->actor.world.pos.x + 100.0f + 30.0f;
this->subCamEye.y = sBossGanon2Zelda->actor.world.pos.y + 10.0f;
this->subCamEye.z = sBossGanon2Zelda->actor.world.pos.z + 5.0f;
this->subCamAt.x = sBossGanon2Zelda->actor.world.pos.x;
this->subCamAt.y = sBossGanon2Zelda->actor.world.pos.y + 30.0f;
this->subCamAt.z = sBossGanon2Zelda->actor.world.pos.z - 20.0f;
this->subCamEye.x = sZelda->actor.world.pos.x + 100.0f + 30.0f;
this->subCamEye.y = sZelda->actor.world.pos.y + 10.0f;
this->subCamEye.z = sZelda->actor.world.pos.z + 5.0f;
this->subCamAt.x = sZelda->actor.world.pos.x;
this->subCamAt.y = sZelda->actor.world.pos.y + 30.0f;
this->subCamAt.z = sZelda->actor.world.pos.z - 20.0f;
this->subCamUp.z = -0.5f;
if (this->csTimer == 13) {
sBossGanon2Zelda->unk_3C8 = 6;
sZelda->unk_3C8 = 6;
}
if (this->csTimer == 50) {
this->csState = 27;
@@ -943,7 +943,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
func_808FFDB0(this, play);
this->unk_1A2[1] = 50;
this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED;
sBossGanon2Zelda->unk_3C8 = 7;
sZelda->unk_3C8 = 7;
}
break;
}
@@ -1387,12 +1387,12 @@ void func_80900890(BossGanon2* this, PlayState* play) {
break;
case 2:
this->unk_1A2[0] = 300;
this->subCamEye.x = sBossGanon2Zelda->actor.world.pos.x - 100.0f;
this->subCamEye.y = sBossGanon2Zelda->actor.world.pos.y + 30.0f;
this->subCamEye.z = (sBossGanon2Zelda->actor.world.pos.z + 30.0f) - 60.0f;
this->subCamAt.x = sBossGanon2Zelda->actor.world.pos.x;
this->subCamAt.y = sBossGanon2Zelda->actor.world.pos.y + 30.0f;
this->subCamAt.z = sBossGanon2Zelda->actor.world.pos.z - 10.0f;
this->subCamEye.x = sZelda->actor.world.pos.x - 100.0f;
this->subCamEye.y = sZelda->actor.world.pos.y + 30.0f;
this->subCamEye.z = (sZelda->actor.world.pos.z + 30.0f) - 60.0f;
this->subCamAt.x = sZelda->actor.world.pos.x;
this->subCamAt.y = sZelda->actor.world.pos.y + 30.0f;
this->subCamAt.z = sZelda->actor.world.pos.z - 10.0f;
Math_ApproachZeroF(&this->unk_324, 1.0f, 5.0f);
Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 1.0f / 51);
if (this->unk_1A2[1] == 80) {
@@ -1420,8 +1420,8 @@ void func_80900890(BossGanon2* this, PlayState* play) {
Player_SetCsActionWithHaltedActors(play, &this->actor, 0x60);
this->csTimer = 0;
case 11:
player->actor.world.pos.x = sBossGanon2Zelda->actor.world.pos.x + 50.0f + 10.0f;
player->actor.world.pos.z = sBossGanon2Zelda->actor.world.pos.z - 25.0f;
player->actor.world.pos.x = sZelda->actor.world.pos.x + 50.0f + 10.0f;
player->actor.world.pos.z = sZelda->actor.world.pos.z - 25.0f;
player->actor.shape.rot.y = -0x8000;
this->subCamEye.x = (player->actor.world.pos.x + 100.0f) - 80.0f;
this->subCamEye.y = (player->actor.world.pos.y + 60.0f) - 40.0f;
@@ -1556,7 +1556,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
Player_SetCsActionWithHaltedActors(play, &this->actor, 8);
this->csState = 1;
this->csTimer = 0;
sBossGanon2Zelda->unk_3C8 = 9;
sZelda->unk_3C8 = 9;
this->unk_31C = 0;
this->unk_1A2[2] = 0;
this->unk_336 = 0;
@@ -1596,9 +1596,9 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
player->actor.shape.rot.y = -0x4000;
player->actor.world.pos.x = 200.0f;
player->actor.world.pos.z = 30.0f;
sBossGanon2Zelda->actor.world.pos.x = 340.0f;
sBossGanon2Zelda->actor.world.pos.z = -250.0f;
sBossGanon2Zelda->actor.world.rot.y = sBossGanon2Zelda->actor.shape.rot.y = -0x2000;
sZelda->actor.world.pos.x = 340.0f;
sZelda->actor.world.pos.z = -250.0f;
sZelda->actor.world.rot.y = sZelda->actor.shape.rot.y = -0x2000;
this->subCamEye.x = 250;
this->subCamEye.y = 1150.0f;
this->subCamEye.z = 0.0f;
@@ -1617,9 +1617,9 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
this->subCamEye.x = 250;
this->subCamEye.y = 1150.0f;
this->subCamEye.z = 0.0f;
Math_ApproachF(&this->subCamAt.x, sBossGanon2Zelda->actor.world.pos.x, 0.2f, 20.0f);
Math_ApproachF(&this->subCamAt.y, sBossGanon2Zelda->actor.world.pos.y + 50.0f, 0.2f, 10.0f);
Math_ApproachF(&this->subCamAt.z, sBossGanon2Zelda->actor.world.pos.z, 0.2f, 20.0f);
Math_ApproachF(&this->subCamAt.x, sZelda->actor.world.pos.x, 0.2f, 20.0f);
Math_ApproachF(&this->subCamAt.y, sZelda->actor.world.pos.y + 50.0f, 0.2f, 10.0f);
Math_ApproachF(&this->subCamAt.z, sZelda->actor.world.pos.z, 0.2f, 20.0f);
if (this->csTimer == 50) {
this->csState = 3;
this->csTimer = 0;
@@ -1631,9 +1631,9 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
this->subCamEye.x = 330.0f;
this->subCamEye.y = 1120.0f;
this->subCamEye.z = -150.0f;
this->subCamAt.x = sBossGanon2Zelda->actor.world.pos.x;
this->subCamAt.y = sBossGanon2Zelda->actor.world.pos.y + 40.0f;
this->subCamAt.z = sBossGanon2Zelda->actor.world.pos.z;
this->subCamAt.x = sZelda->actor.world.pos.x;
this->subCamAt.y = sZelda->actor.world.pos.y + 40.0f;
this->subCamAt.z = sZelda->actor.world.pos.z;
if (this->csTimer == 10) {
Message_StartTextbox(play, 0x70D8, NULL);
}
@@ -1646,7 +1646,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
if (this->csTimer > 10) {
Math_ApproachZeroF(&this->unk_37C, 1.0f, 10.0f);
if (this->csTimer == 30) {
sBossGanon2Zelda->unk_3C8 = 10;
sZelda->unk_3C8 = 10;
}
this->unk_339 = 23;
Math_ApproachZeroF(&play->envCtx.unk_D8, 1.0f, 0.05f);
@@ -1822,7 +1822,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
if (this->csTimer == 40) {
this->csState = 9;
this->csTimer = 0;
sBossGanon2Zelda->unk_3C8 = 11;
sZelda->unk_3C8 = 11;
Message_StartTextbox(play, 0x70D9, NULL);
this->unk_336 = 0;
play->envCtx.unk_D8 = 0.0f;
@@ -1833,9 +1833,9 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
this->subCamEye.x = 330.0f;
this->subCamEye.y = 1120.0f;
this->subCamEye.z = -150.0f;
this->subCamAt.x = sBossGanon2Zelda->actor.world.pos.x;
this->subCamAt.y = sBossGanon2Zelda->actor.world.pos.y + 40.0f;
this->subCamAt.z = sBossGanon2Zelda->actor.world.pos.z;
this->subCamAt.x = sZelda->actor.world.pos.x;
this->subCamAt.y = sZelda->actor.world.pos.y + 40.0f;
this->subCamAt.z = sZelda->actor.world.pos.z;
if (this->csTimer > 60) {
this->csState = 10;
this->csTimer = 0;
@@ -1850,26 +1850,26 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
if ((this->csTimer >= 40) && (this->csTimer <= 110)) {
Math_ApproachF(&play->envCtx.unk_D8, 1.0f, 1.0f, 0.02f);
Math_ApproachF(&this->unk_384, 10.0f, 0.1f, 0.2f);
Audio_PlayActorSound2(&sBossGanon2Zelda->actor, NA_SE_EV_GOD_LIGHTBALL_2 - SFX_FLAG);
Audio_PlayActorSound2(&sZelda->actor, NA_SE_EV_GOD_LIGHTBALL_2 - SFX_FLAG);
} else {
Math_ApproachZeroF(&this->unk_384, 1.0f, 0.2f);
}
if (this->csTimer > 130) {
Math_ApproachF(&this->subCamAt.y, (sBossGanon2Zelda->actor.world.pos.y + 40.0f + 10.0f) - 20.0f, 0.1f,
Math_ApproachF(&this->subCamAt.y, (sZelda->actor.world.pos.y + 40.0f + 10.0f) - 20.0f, 0.1f,
this->unk_410.x);
} else {
Math_ApproachF(&this->subCamAt.y, sBossGanon2Zelda->actor.world.pos.y + 40.0f + 10.0f, 0.05f,
Math_ApproachF(&this->subCamAt.y, sZelda->actor.world.pos.y + 40.0f + 10.0f, 0.05f,
this->unk_410.x * 0.25f);
}
Math_ApproachF(&this->unk_410.x, 1.0f, 1.0f, 0.01f);
if (this->csTimer == 10) {
sBossGanon2Zelda->unk_3C8 = 12;
sZelda->unk_3C8 = 12;
}
if (this->csTimer == 110) {
sBossGanon2Zelda->unk_3C8 = 13;
sZelda->unk_3C8 = 13;
}
if (this->csTimer == 140) {
Audio_PlayActorSound2(&sBossGanon2Zelda->actor, NA_SE_EV_HUMAN_BOUND);
Audio_PlayActorSound2(&sZelda->actor, NA_SE_EV_HUMAN_BOUND);
}
if (this->csTimer < 160) {
break;
@@ -1925,7 +1925,7 @@ void func_80902348(BossGanon2* this, PlayState* play) {
Actor_SetPlayerKnockbackLarge(play, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f,
0);
sBossGanon2Zelda->unk_3C8 = 8;
sZelda->unk_3C8 = 8;
this->unk_316 = 10;
break;
}
@@ -1944,7 +1944,7 @@ void func_80902348(BossGanon2* this, PlayState* play) {
player->bodyIsBurning = true;
Actor_SetPlayerKnockbackLarge(play, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10);
sBossGanon2Zelda->unk_3C8 = 8;
sZelda->unk_3C8 = 8;
}
}
}
@@ -2246,7 +2246,7 @@ void BossGanon2_Update(Actor* thisx, PlayState* play) {
if (D_80906D78 != 0) {
D_80906D78 = 0;
for (i2 = 0; i2 < ARRAY_COUNT(sBossGanon2Particles); i2++) {
for (i2 = 0; i2 < ARRAY_COUNT(sEffects); i2++) {
angle = Rand_ZeroFloat(2 * M_PI);
sp44 = Rand_ZeroFloat(40.0f) + 10.0f;
sp58 = this->actor.world.pos;
@@ -2716,8 +2716,8 @@ void func_80904FC8(BossGanon2* this, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 200);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 0);
gSPDisplayList(POLY_XLU_DISP++, gGanonLightOrbMaterialDL);
Matrix_Translate(sBossGanon2Zelda->actor.world.pos.x, sBossGanon2Zelda->actor.world.pos.y + 80.0f,
sBossGanon2Zelda->actor.world.pos.z, MTXMODE_NEW);
Matrix_Translate(sZelda->actor.world.pos.x, sZelda->actor.world.pos.y + 80.0f, sZelda->actor.world.pos.z,
MTXMODE_NEW);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(this->unk_384, this->unk_384, this->unk_384, MTXMODE_APPLY);
Matrix_RotateZ(this->unk_388, MTXMODE_APPLY);
@@ -2803,9 +2803,8 @@ void func_80905674(BossGanon2* this, PlayState* play) {
this->unk_19C * -8, 32, 32, -8, 0, -4, -8));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s16)this->unk_37C);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 128);
Matrix_Translate(sBossGanon2Zelda->actor.world.pos.x + 100.0f,
sBossGanon2Zelda->actor.world.pos.y + 35.0f + 7.0f,
sBossGanon2Zelda->actor.world.pos.z - 100.0f, MTXMODE_NEW);
Matrix_Translate(sZelda->actor.world.pos.x + 100.0f, sZelda->actor.world.pos.y + 35.0f + 7.0f,
sZelda->actor.world.pos.z - 100.0f, MTXMODE_NEW);
Matrix_RotateY(-M_PI / 4.0f, MTXMODE_APPLY);
Matrix_Scale(0.040000003f, 0.040000003f, this->unk_380, MTXMODE_APPLY);
Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY);
@@ -2898,7 +2897,7 @@ void BossGanon2_UpdateEffects(BossGanon2* this, PlayState* play) {
Vec3f sp78;
s16 i;
for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type != 0) {
effect->position.x += effect->velocity.x;
effect->position.y += effect->velocity.y;
@@ -3018,7 +3017,7 @@ void BossGanon2_DrawEffects(PlayState* play) {
effect = effects;
for (i = 0; i < ARRAY_COUNT(sBossGanon2Particles); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == 2) {
FrameInterpolation_RecordOpenChild("Ganon 809060E8 1", i);
@@ -3166,12 +3165,12 @@ void BossGanon2_Reset(void) {
D_8090EB20.y = 0;
D_8090EB20.z = 0;
D_80910638 = 0;
sBossGanon2Zelda = NULL;
sZelda = NULL;
D_8090EB30 = NULL;
sBossGanon2Seed1 = 0;
sBossGanon2Seed2 = 0;
sBossGanon2Seed3 = 0;
sSeed1 = 0;
sSeed2 = 0;
sSeed3 = 0;
memset(D_809105D8, 0, sizeof(D_809105D8));
memset(D_80910608, 0, sizeof(D_80910608));
memset(sBossGanon2Particles, 0, sizeof(sBossGanon2Particles));
memset(sEffects, 0, sizeof(sEffects));
}
+25 -13
View File
@@ -14,6 +14,7 @@
#include "soh/frame_interpolation.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/Enhancements/savestate_serialize.h"
#include <string.h>
@@ -155,25 +156,36 @@ static f32 sFlatWidth[41] = {
#include "z_boss_mo_colchk.c"
static BossMoEffect sEffects[300];
static s32 sBossGanonSeed1;
static s32 sBossGanonSeed2;
static s32 sBossGanonSeed3;
static s32 sSeed1;
static s32 sSeed2;
static s32 sSeed3;
#define BOSS_MO_SHIP_SAVESTATE_FIELDS(F) \
F(sMorphaCore) \
F(sMorphaTent1) \
F(sMorphaTent2) \
F(sEffects) \
F(sSeed1) \
F(sSeed2) \
F(sSeed3)
SHIP_SAVESTATE_DEFINE(BossMo, BOSS_MO_SHIP_SAVESTATE_FIELDS)
void BossMo_InitRand(s32 seedInit0, s32 seedInit1, s32 seedInit2) {
sBossGanonSeed1 = seedInit0;
sBossGanonSeed2 = seedInit1;
sBossGanonSeed3 = seedInit2;
sSeed1 = seedInit0;
sSeed2 = seedInit1;
sSeed3 = seedInit2;
}
f32 BossMo_RandZeroOne(void) {
// Wichmann-Hill algorithm
f32 randFloat;
sBossGanonSeed1 = (sBossGanonSeed1 * 171) % 30269;
sBossGanonSeed2 = (sBossGanonSeed2 * 172) % 30307;
sBossGanonSeed3 = (sBossGanonSeed3 * 170) % 30323;
sSeed1 = (sSeed1 * 171) % 30269;
sSeed2 = (sSeed2 * 172) % 30307;
sSeed3 = (sSeed3 * 170) % 30323;
randFloat = (sBossGanonSeed1 / 30269.0f) + (sBossGanonSeed2 / 30307.0f) + (sBossGanonSeed3 / 30323.0f);
randFloat = (sSeed1 / 30269.0f) + (sSeed2 / 30307.0f) + (sSeed3 / 30323.0f);
while (randFloat >= 1.0f) {
randFloat -= 1.0f;
}
@@ -3620,7 +3632,7 @@ void BossMo_Reset(void) {
sMorphaTent1 = NULL;
sMorphaTent2 = NULL;
memset(sEffects, 0, sizeof(sEffects));
sBossGanonSeed1 = 0;
sBossGanonSeed2 = 0;
sBossGanonSeed3 = 0;
sSeed1 = 0;
sSeed2 = 0;
sSeed3 = 0;
}
+163 -149
View File
@@ -14,6 +14,7 @@
#include "soh/ResourceManagerHelpers.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/Enhancements/savestate_serialize.h"
#define FLAGS \
(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \
@@ -204,13 +205,13 @@ static Vec3f sRoomCenter = { ROOM_CENTER_X, ROOM_CENTER_Y, ROOM_CENTER_Z };
static Vec3f sHandOffsets[2];
static s16 sHandYawOffsets[2];
static s16 sCutsceneCamera;
static Vec3f sCameraAt = { ROOM_CENTER_X + 50.0f, ROOM_CENTER_Y + 0.0f, ROOM_CENTER_Z + 0.0f };
static Vec3f sCameraEye = { ROOM_CENTER_X + 150.0f, ROOM_CENTER_Y + 100.0f, ROOM_CENTER_Z + 0.0f };
static Vec3f sCameraAtVel = { 0.0f, 0.0f, 0.0f };
static Vec3f sCameraEyeVel = { 0.0f, 0.0f, 0.0f };
static s16 sSubCamId;
static Vec3f sSubCamAt = { ROOM_CENTER_X + 50.0f, ROOM_CENTER_Y + 0.0f, ROOM_CENTER_Z + 0.0f };
static Vec3f sSubCamEye = { ROOM_CENTER_X + 150.0f, ROOM_CENTER_Y + 100.0f, ROOM_CENTER_Z + 0.0f };
static Vec3f sSubCamAtVel = { 0.0f, 0.0f, 0.0f };
static Vec3f sSubCamEyeVel = { 0.0f, 0.0f, 0.0f };
static Vec3f sCameraAtPoints[] = {
static Vec3f sSubCamAtPoints[] = {
{ ROOM_CENTER_X - 50.0f, ROOM_CENTER_Y + 300.0f, ROOM_CENTER_Z + 0.0f },
{ ROOM_CENTER_X + 150.0f, ROOM_CENTER_Y + 300.0f, ROOM_CENTER_Z + 100.0f },
{ ROOM_CENTER_X + 0.0f, ROOM_CENTER_Y + 600.0f, ROOM_CENTER_Z + 100.0f },
@@ -221,7 +222,7 @@ static Vec3f sCameraAtPoints[] = {
{ ROOM_CENTER_X - 60.0f, ROOM_CENTER_Y + 180.0f, ROOM_CENTER_Z + 730.0f },
};
static Vec3f sCameraEyePoints[] = {
static Vec3f sSubCamEyePoints[] = {
{ ROOM_CENTER_X + 250.0f, ROOM_CENTER_Y + 800.0f, ROOM_CENTER_Z + 800.0f },
{ ROOM_CENTER_X - 150.0f, ROOM_CENTER_Y + 700.0f, ROOM_CENTER_Z + 1400.0f },
{ ROOM_CENTER_X + 250.0f, ROOM_CENTER_Y + 100.0f, ROOM_CENTER_Z + 750.0f },
@@ -242,6 +243,19 @@ static Color_RGBA8 sBodyColor = { 255, 255, 255, 255 };
static Color_RGBA8 sStaticColor = { 0, 0, 0, 255 };
static s32 sHandState[] = { HAND_WAIT, HAND_WAIT };
#define BOSS_SST_SHIP_SAVESTATE_FIELDS(F) \
F(sHead) \
F(sHands) \
F(sFloor) \
F(sHandOffsets) \
F(sHandYawOffsets) \
F(sSubCamId) \
F(sBodyStatic) \
F(sBodyColor) \
F(sStaticColor)
SHIP_SAVESTATE_DEFINE(BossSst, BOSS_SST_SHIP_SAVESTATE_FIELDS)
const ActorInit Boss_Sst_InitVars = {
ACTOR_BOSS_SST,
ACTORCAT_BOSS,
@@ -396,15 +410,15 @@ void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) {
func_80064520(play, &play->csCtx);
Player_SetCsActionWithHaltedActors(play, &this->actor, 8);
sCutsceneCamera = Play_CreateSubCamera(play);
sSubCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, sCutsceneCamera, CAM_STAT_ACTIVE);
Math_Vec3f_Copy(&sCameraAt, &player->actor.world.pos);
Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE);
Math_Vec3f_Copy(&sSubCamAt, &player->actor.world.pos);
if (Flags_GetEventChkInf(EVENTCHKINF_BEGAN_BONGO_BONGO_BATTLE)) {
sCameraEye.z = ROOM_CENTER_Z - 100.0f;
sSubCamEye.z = ROOM_CENTER_Z - 100.0f;
}
Play_CameraSetAtEye(play, sCutsceneCamera, &sCameraAt, &sCameraEye);
Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye);
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
this->actionFunc = BossSst_HeadIntro;
}
@@ -429,13 +443,13 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) {
player->stateFlags1 &= ~PLAYER_STATE1_INPUT_DISABLED;
func_80064534(play, &play->csCtx);
Player_SetCsActionWithHaltedActors(play, &this->actor, 7);
sCameraAt.y += 30.0f;
sCameraAt.z += 300.0f;
Play_CameraSetAtEye(play, sCutsceneCamera, &sCameraAt, &sCameraEye);
Play_CopyCamera(play, CAM_ID_MAIN, sCutsceneCamera);
Play_ChangeCameraStatus(play, sCutsceneCamera, CAM_STAT_WAIT);
sSubCamAt.y += 30.0f;
sSubCamAt.z += 300.0f;
Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye);
Play_CopyCamera(play, CAM_ID_MAIN, sSubCamId);
Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE);
Play_ClearCamera(play, sCutsceneCamera);
Play_ClearCamera(play, sSubCamId);
Flags_SetEventChkInf(EVENTCHKINF_BEGAN_BONGO_BONGO_BATTLE);
BossSst_HeadSetupNeutral(this);
this->colliderJntSph.base.ocFlags1 |= OC1_ON;
@@ -452,7 +466,7 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) {
player->yaw = -0x8000;
}
Math_Vec3f_Copy(&sCameraAt, &player->actor.world.pos);
Math_Vec3f_Copy(&sSubCamAt, &player->actor.world.pos);
if (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
if (!this->ready) {
sFloor->dyna.actor.params = BONGOFLOOR_HIT;
@@ -464,17 +478,17 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) {
sHands[LEFT]->actor.draw = BossSst_DrawHand;
this->actor.draw = BossSst_DrawHead;
this->timer = 178;
sCameraAt.x = ROOM_CENTER_X - 23.0f;
sCameraAt.y = ROOM_CENTER_Y + 0.0f;
sCameraAt.z = ROOM_CENTER_Z + 0.0f;
sSubCamAt.x = ROOM_CENTER_X - 23.0f;
sSubCamAt.y = ROOM_CENTER_Y + 0.0f;
sSubCamAt.z = ROOM_CENTER_Z + 0.0f;
} else {
this->timer = 546;
}
}
} else if (this->timer >= 478) {
sCameraEye.x += 10.0f;
sCameraEye.y += 10.0f;
sCameraEye.z -= 10.0f;
sSubCamEye.x += 10.0f;
sSubCamEye.y += 10.0f;
sSubCamEye.z -= 10.0f;
} else if (this->timer >= 448) {
if (this->timer == 460) {
sHands[RIGHT]->actor.draw = BossSst_DrawHand;
@@ -485,94 +499,94 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) {
BossSst_HandSetupDownbeat(sHands[RIGHT]);
}
if (this->timer > 460) {
sCameraEye.x -= 40.0f;
sCameraEye.y -= 40.0f;
sCameraEye.z += 20.0f;
sSubCamEye.x -= 40.0f;
sSubCamEye.y -= 40.0f;
sSubCamEye.z += 20.0f;
} else if (this->timer == 460) {
sCameraAt.x = sHands[RIGHT]->actor.home.pos.x + 0.0f;
sCameraAt.y = sHands[RIGHT]->actor.home.pos.y - 20.0f;
sCameraAt.z = sHands[RIGHT]->actor.home.pos.z + 10.0f;
sCameraEye.x = sHands[RIGHT]->actor.home.pos.x + 150.0f;
sCameraEye.y = sHands[RIGHT]->actor.home.pos.y + 100.0f;
sCameraEye.z = sHands[RIGHT]->actor.home.pos.z + 80.0f;
sSubCamAt.x = sHands[RIGHT]->actor.home.pos.x + 0.0f;
sSubCamAt.y = sHands[RIGHT]->actor.home.pos.y - 20.0f;
sSubCamAt.z = sHands[RIGHT]->actor.home.pos.z + 10.0f;
sSubCamEye.x = sHands[RIGHT]->actor.home.pos.x + 150.0f;
sSubCamEye.y = sHands[RIGHT]->actor.home.pos.y + 100.0f;
sSubCamEye.z = sHands[RIGHT]->actor.home.pos.z + 80.0f;
}
} else {
if (this->timer >= 372) {
introStateTimer = this->timer - 372;
tempo = 6;
if (this->timer == 447) {
sCameraAt = player->actor.world.pos;
sCameraEye.x = ROOM_CENTER_X - 200.0f;
sCameraEye.y = ROOM_CENTER_Y + 160.0f;
sCameraEye.z = ROOM_CENTER_Z - 190.0f;
sSubCamAt = player->actor.world.pos;
sSubCamEye.x = ROOM_CENTER_X - 200.0f;
sSubCamEye.y = ROOM_CENTER_Y + 160.0f;
sSubCamEye.z = ROOM_CENTER_Z - 190.0f;
} else if (introStateTimer == 11) {
sCameraAt.x = sHands[RIGHT]->actor.home.pos.x + 30.0f;
sCameraAt.y = sHands[RIGHT]->actor.home.pos.y + 0.0f;
sCameraAt.z = sHands[RIGHT]->actor.home.pos.z + 20.0f;
sCameraEye.x = sHands[RIGHT]->actor.home.pos.x + 100.0f;
sCameraEye.y = sHands[RIGHT]->actor.home.pos.y + 10.0f;
sCameraEye.z = sHands[RIGHT]->actor.home.pos.z - 210.0f;
sSubCamAt.x = sHands[RIGHT]->actor.home.pos.x + 30.0f;
sSubCamAt.y = sHands[RIGHT]->actor.home.pos.y + 0.0f;
sSubCamAt.z = sHands[RIGHT]->actor.home.pos.z + 20.0f;
sSubCamEye.x = sHands[RIGHT]->actor.home.pos.x + 100.0f;
sSubCamEye.y = sHands[RIGHT]->actor.home.pos.y + 10.0f;
sSubCamEye.z = sHands[RIGHT]->actor.home.pos.z - 210.0f;
} else if (introStateTimer == 62) {
sCameraAt.x = sHands[LEFT]->actor.home.pos.x + 0.0f;
sCameraAt.y = sHands[LEFT]->actor.home.pos.y + 50.0f;
sCameraAt.z = sHands[LEFT]->actor.home.pos.z + 100.0f;
sCameraEye.x = sHands[LEFT]->actor.home.pos.x + 110.0f;
sCameraEye.y = sHands[LEFT]->actor.home.pos.y + 180.0f;
sCameraEye.z = sHands[LEFT]->actor.home.pos.z - 70.0f;
sSubCamAt.x = sHands[LEFT]->actor.home.pos.x + 0.0f;
sSubCamAt.y = sHands[LEFT]->actor.home.pos.y + 50.0f;
sSubCamAt.z = sHands[LEFT]->actor.home.pos.z + 100.0f;
sSubCamEye.x = sHands[LEFT]->actor.home.pos.x + 110.0f;
sSubCamEye.y = sHands[LEFT]->actor.home.pos.y + 180.0f;
sSubCamEye.z = sHands[LEFT]->actor.home.pos.z - 70.0f;
}
} else if (this->timer >= 304) {
introStateTimer = this->timer - 304;
tempo = 5;
if (introStateTimer == 11) {
sCameraAt.x = sHands[RIGHT]->actor.home.pos.x + 40.0f;
sCameraAt.y = sHands[RIGHT]->actor.home.pos.y - 90.0f;
sCameraAt.z = sHands[RIGHT]->actor.home.pos.z - 40.0f;
sCameraEye.x = sHands[RIGHT]->actor.home.pos.x - 20.0f;
sCameraEye.y = sHands[RIGHT]->actor.home.pos.y + 210.0f;
sCameraEye.z = sHands[RIGHT]->actor.home.pos.z + 170.0f;
sSubCamAt.x = sHands[RIGHT]->actor.home.pos.x + 40.0f;
sSubCamAt.y = sHands[RIGHT]->actor.home.pos.y - 90.0f;
sSubCamAt.z = sHands[RIGHT]->actor.home.pos.z - 40.0f;
sSubCamEye.x = sHands[RIGHT]->actor.home.pos.x - 20.0f;
sSubCamEye.y = sHands[RIGHT]->actor.home.pos.y + 210.0f;
sSubCamEye.z = sHands[RIGHT]->actor.home.pos.z + 170.0f;
} else if (this->timer == 368) {
sCameraAt.x = sHands[LEFT]->actor.home.pos.x - 20.0f;
sCameraAt.y = sHands[LEFT]->actor.home.pos.y + 0.0f;
sCameraAt.z = sHands[LEFT]->actor.home.pos.z + 0.0f;
sCameraEye.x = sHands[LEFT]->actor.home.pos.x - 70.0f;
sCameraEye.y = sHands[LEFT]->actor.home.pos.y + 170.0f;
sCameraEye.z = sHands[LEFT]->actor.home.pos.z + 150.0f;
sSubCamAt.x = sHands[LEFT]->actor.home.pos.x - 20.0f;
sSubCamAt.y = sHands[LEFT]->actor.home.pos.y + 0.0f;
sSubCamAt.z = sHands[LEFT]->actor.home.pos.z + 0.0f;
sSubCamEye.x = sHands[LEFT]->actor.home.pos.x - 70.0f;
sSubCamEye.y = sHands[LEFT]->actor.home.pos.y + 170.0f;
sSubCamEye.z = sHands[LEFT]->actor.home.pos.z + 150.0f;
}
} else if (this->timer >= 244) {
introStateTimer = this->timer - 244;
tempo = 4;
if (introStateTimer == 11) {
sCameraAt.x = sHands[RIGHT]->actor.home.pos.x + 30.0f;
sCameraAt.y = sHands[RIGHT]->actor.home.pos.y + 70.0f;
sCameraAt.z = sHands[RIGHT]->actor.home.pos.z + 40.0f;
sCameraEye.x = sHands[RIGHT]->actor.home.pos.x + 110.0f;
sCameraEye.y = sHands[RIGHT]->actor.home.pos.y - 140.0f;
sCameraEye.z = sHands[RIGHT]->actor.home.pos.z - 10.0f;
sSubCamAt.x = sHands[RIGHT]->actor.home.pos.x + 30.0f;
sSubCamAt.y = sHands[RIGHT]->actor.home.pos.y + 70.0f;
sSubCamAt.z = sHands[RIGHT]->actor.home.pos.z + 40.0f;
sSubCamEye.x = sHands[RIGHT]->actor.home.pos.x + 110.0f;
sSubCamEye.y = sHands[RIGHT]->actor.home.pos.y - 140.0f;
sSubCamEye.z = sHands[RIGHT]->actor.home.pos.z - 10.0f;
} else if (this->timer == 300) {
sCameraAt.x = sHands[LEFT]->actor.home.pos.x - 20.0f;
sCameraAt.y = sHands[LEFT]->actor.home.pos.y - 80.0f;
sCameraAt.z = sHands[LEFT]->actor.home.pos.z + 320.0f;
sCameraEye.x = sHands[LEFT]->actor.home.pos.x - 130.0f;
sCameraEye.y = sHands[LEFT]->actor.home.pos.y + 130.0f;
sCameraEye.z = sHands[LEFT]->actor.home.pos.z - 150.0f;
sSubCamAt.x = sHands[LEFT]->actor.home.pos.x - 20.0f;
sSubCamAt.y = sHands[LEFT]->actor.home.pos.y - 80.0f;
sSubCamAt.z = sHands[LEFT]->actor.home.pos.z + 320.0f;
sSubCamEye.x = sHands[LEFT]->actor.home.pos.x - 130.0f;
sSubCamEye.y = sHands[LEFT]->actor.home.pos.y + 130.0f;
sSubCamEye.z = sHands[LEFT]->actor.home.pos.z - 150.0f;
}
} else if (this->timer >= 192) {
introStateTimer = this->timer - 192;
tempo = 3;
if (this->timer == 240) {
sCameraAt.x = sHands[LEFT]->actor.home.pos.x - 190.0f;
sCameraAt.y = sHands[LEFT]->actor.home.pos.y - 110.0f;
sCameraAt.z = sHands[LEFT]->actor.home.pos.z + 40.0f;
sCameraEye.x = sHands[LEFT]->actor.home.pos.x + 120.0f;
sCameraEye.y = sHands[LEFT]->actor.home.pos.y + 130.0f;
sCameraEye.z = sHands[LEFT]->actor.home.pos.z + 50.0f;
sSubCamAt.x = sHands[LEFT]->actor.home.pos.x - 190.0f;
sSubCamAt.y = sHands[LEFT]->actor.home.pos.y - 110.0f;
sSubCamAt.z = sHands[LEFT]->actor.home.pos.z + 40.0f;
sSubCamEye.x = sHands[LEFT]->actor.home.pos.x + 120.0f;
sSubCamEye.y = sHands[LEFT]->actor.home.pos.y + 130.0f;
sSubCamEye.z = sHands[LEFT]->actor.home.pos.z + 50.0f;
} else if (introStateTimer == 12) {
sCameraAt.x = sRoomCenter.x + 50.0f;
sCameraAt.y = sRoomCenter.y - 90.0f;
sCameraAt.z = sRoomCenter.z - 200.0f;
sCameraEye.x = sRoomCenter.x + 50.0f;
sCameraEye.y = sRoomCenter.y + 350.0f;
sCameraEye.z = sRoomCenter.z + 150.0f;
sSubCamAt.x = sRoomCenter.x + 50.0f;
sSubCamAt.y = sRoomCenter.y - 90.0f;
sSubCamAt.z = sRoomCenter.z - 200.0f;
sSubCamEye.x = sRoomCenter.x + 50.0f;
sSubCamEye.y = sRoomCenter.y + 350.0f;
sSubCamEye.z = sRoomCenter.z + 150.0f;
}
} else if (this->timer >= 148) {
introStateTimer = this->timer - 148;
@@ -587,33 +601,33 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) {
if (this->timer <= 198) {
revealStateTimer = 198 - this->timer;
if ((Flags_GetEventChkInf(EVENTCHKINF_BEGAN_BONGO_BONGO_BATTLE)) && (revealStateTimer <= 44)) {
sCameraAt.x += 492.0f * 0.01f;
sCameraAt.y += 200.0f * 0.01f;
sCameraEye.x -= 80.0f * 0.01f;
sCameraEye.y -= 360.0f * 0.01f;
sCameraEye.z += 1000.0f * 0.01f;
sSubCamAt.x += 492.0f * 0.01f;
sSubCamAt.y += 200.0f * 0.01f;
sSubCamEye.x -= 80.0f * 0.01f;
sSubCamEye.y -= 360.0f * 0.01f;
sSubCamEye.z += 1000.0f * 0.01f;
} else if (this->timer <= 20) {
sCameraAt.y -= 700.0f * 0.01f;
sCameraAt.z += 900.0f * 0.01f;
sCameraEye.x += 650.0f * 0.01f;
sCameraEye.y += 400.0f * 0.01f;
sCameraEye.z += 1550.0f * 0.01f;
sSubCamAt.y -= 700.0f * 0.01f;
sSubCamAt.z += 900.0f * 0.01f;
sSubCamEye.x += 650.0f * 0.01f;
sSubCamEye.y += 400.0f * 0.01f;
sSubCamEye.z += 1550.0f * 0.01f;
this->vVanish = true;
this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS;
} else if (revealStateTimer < 40) {
sCameraAt.x += 125.0f * 0.01f;
sCameraAt.y += 350.0f * 0.01f;
sCameraAt.z += 500.0f * 0.01f;
sCameraEye.x += 200.0f * 0.01f;
sCameraEye.y -= 850.0f * 0.01f;
sSubCamAt.x += 125.0f * 0.01f;
sSubCamAt.y += 350.0f * 0.01f;
sSubCamAt.z += 500.0f * 0.01f;
sSubCamEye.x += 200.0f * 0.01f;
sSubCamEye.y -= 850.0f * 0.01f;
} else if (revealStateTimer >= 45) {
if (revealStateTimer < 85) {
sCameraAt.x -= 250.0f * 0.01f;
sCameraAt.y += 425.0f * 0.01f;
sCameraAt.z -= 1200.0f * 0.01f;
sCameraEye.x -= 650.0f * 0.01f;
sCameraEye.y += 125.0f * 0.01f;
sCameraEye.z -= 350.0f * 0.01f;
sSubCamAt.x -= 250.0f * 0.01f;
sSubCamAt.y += 425.0f * 0.01f;
sSubCamAt.z -= 1200.0f * 0.01f;
sSubCamEye.x -= 650.0f * 0.01f;
sSubCamEye.y += 125.0f * 0.01f;
sSubCamEye.z -= 350.0f * 0.01f;
} else if (revealStateTimer == 85) {
if (!Flags_GetEventChkInf(EVENTCHKINF_BEGAN_BONGO_BONGO_BATTLE)) {
TitleCard_InitBossName(play, &play->actorCtx.titleCtx,
@@ -634,7 +648,7 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) {
}
if (this->actionFunc != BossSst_HeadNeutral) {
Play_CameraSetAtEye(play, sCutsceneCamera, &sCameraAt, &sCameraEye);
Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye);
}
}
@@ -980,21 +994,21 @@ void BossSst_HeadRecover(BossSst* this, PlayState* play) {
}
void BossSst_SetCameraTargets(f32 cameraSpeedMod, s32 targetIndex) {
Vec3f* nextAt = &sCameraAtPoints[targetIndex];
Vec3f* nextEye = &sCameraEyePoints[targetIndex];
Vec3f* nextAt = &sSubCamAtPoints[targetIndex];
Vec3f* nextEye = &sSubCamEyePoints[targetIndex];
if (targetIndex != 0) {
Math_Vec3f_Copy(&sCameraAt, &sCameraAtPoints[targetIndex - 1]);
Math_Vec3f_Copy(&sCameraEye, &sCameraEyePoints[targetIndex - 1]);
Math_Vec3f_Copy(&sSubCamAt, &sSubCamAtPoints[targetIndex - 1]);
Math_Vec3f_Copy(&sSubCamEye, &sSubCamEyePoints[targetIndex - 1]);
}
sCameraAtVel.x = (nextAt->x - sCameraAt.x) * cameraSpeedMod;
sCameraAtVel.y = (nextAt->y - sCameraAt.y) * cameraSpeedMod;
sCameraAtVel.z = (nextAt->z - sCameraAt.z) * cameraSpeedMod;
sSubCamAtVel.x = (nextAt->x - sSubCamAt.x) * cameraSpeedMod;
sSubCamAtVel.y = (nextAt->y - sSubCamAt.y) * cameraSpeedMod;
sSubCamAtVel.z = (nextAt->z - sSubCamAt.z) * cameraSpeedMod;
sCameraEyeVel.x = (nextEye->x - sCameraEye.x) * cameraSpeedMod;
sCameraEyeVel.y = (nextEye->y - sCameraEye.y) * cameraSpeedMod;
sCameraEyeVel.z = (nextEye->z - sCameraEye.z) * cameraSpeedMod;
sSubCamEyeVel.x = (nextEye->x - sSubCamEye.x) * cameraSpeedMod;
sSubCamEyeVel.y = (nextEye->y - sSubCamEye.y) * cameraSpeedMod;
sSubCamEyeVel.z = (nextEye->z - sSubCamEye.z) * cameraSpeedMod;
}
void BossSst_UpdateDeathCamera(BossSst* this, PlayState* play) {
@@ -1003,22 +1017,22 @@ void BossSst_UpdateDeathCamera(BossSst* this, PlayState* play) {
f32 sn;
f32 cs;
sCameraAt.x += sCameraAtVel.x;
sCameraAt.y += sCameraAtVel.y;
sCameraAt.z += sCameraAtVel.z;
sCameraEye.x += sCameraEyeVel.x;
sCameraEye.y += sCameraEyeVel.y;
sCameraEye.z += sCameraEyeVel.z;
sSubCamAt.x += sSubCamAtVel.x;
sSubCamAt.y += sSubCamAtVel.y;
sSubCamAt.z += sSubCamAtVel.z;
sSubCamEye.x += sSubCamEyeVel.x;
sSubCamEye.y += sSubCamEyeVel.y;
sSubCamEye.z += sSubCamEyeVel.z;
sn = Math_SinS(this->actor.shape.rot.y);
cs = Math_CosS(this->actor.shape.rot.y);
cameraAt.x = this->actor.world.pos.x + (sCameraAt.z * sn) + (sCameraAt.x * cs);
cameraAt.y = this->actor.home.pos.y - 140.0f + sCameraAt.y;
cameraAt.z = this->actor.world.pos.z + (sCameraAt.z * cs) - (sCameraAt.x * sn);
cameraEye.x = this->actor.world.pos.x + (sCameraEye.z * sn) + (sCameraEye.x * cs);
cameraEye.y = this->actor.home.pos.y - 140.0f + sCameraEye.y;
cameraEye.z = this->actor.world.pos.z + (sCameraEye.z * cs) - (sCameraEye.x * sn);
Play_CameraSetAtEye(play, sCutsceneCamera, &cameraAt, &cameraEye);
cameraAt.x = this->actor.world.pos.x + (sSubCamAt.z * sn) + (sSubCamAt.x * cs);
cameraAt.y = this->actor.home.pos.y - 140.0f + sSubCamAt.y;
cameraAt.z = this->actor.world.pos.z + (sSubCamAt.z * cs) - (sSubCamAt.x * sn);
cameraEye.x = this->actor.world.pos.x + (sSubCamEye.z * sn) + (sSubCamEye.x * cs);
cameraEye.y = this->actor.home.pos.y - 140.0f + sSubCamEye.y;
cameraEye.z = this->actor.world.pos.z + (sSubCamEye.z * cs) - (sSubCamEye.x * sn);
Play_CameraSetAtEye(play, sSubCamId, &cameraAt, &cameraEye);
}
void BossSst_HeadSetupDeath(BossSst* this, PlayState* play) {
@@ -1035,13 +1049,13 @@ void BossSst_HeadSetupDeath(BossSst* this, PlayState* play) {
sHands[LEFT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON;
sHands[RIGHT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
sCutsceneCamera = Play_CreateSubCamera(play);
sSubCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, sCutsceneCamera, CAM_STAT_ACTIVE);
Play_CopyCamera(play, sCutsceneCamera, CAM_ID_MAIN);
Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE);
Play_CopyCamera(play, sSubCamId, CAM_ID_MAIN);
Player_SetCsActionWithHaltedActors(play, &player->actor, 8);
func_80064520(play, &play->csCtx);
Math_Vec3f_Copy(&sCameraEye, &GET_ACTIVE_CAM(play)->eye);
Math_Vec3f_Copy(&sSubCamEye, &GET_ACTIVE_CAM(play)->eye);
this->actionFunc = BossSst_HeadDeath;
}
@@ -1057,7 +1071,7 @@ void BossSst_HeadDeath(BossSst* this, PlayState* play) {
BossSst_HandSetupThrash(sHands[RIGHT]);
BossSst_HeadSetupThrash(this);
} else if (this->timer > 48) {
Play_CameraSetAtEye(play, sCutsceneCamera, &this->actor.focus.pos, &sCameraEye);
Play_CameraSetAtEye(play, sSubCamId, &this->actor.focus.pos, &sSubCamEye);
Math_StepToF(&this->radius, -350.0f, 10.0f);
} else if (this->timer == 48) {
Player* player = GET_PLAYER(play);
@@ -1067,8 +1081,8 @@ void BossSst_HeadDeath(BossSst* this, PlayState* play) {
player->actor.world.pos.z = sRoomCenter.z + (400.0f * Math_CosS(this->actor.shape.rot.y)) -
(Math_SinS(this->actor.shape.rot.y) * -120.0f);
player->actor.shape.rot.y = Actor_WorldYawTowardPoint(&player->actor, &sRoomCenter);
Actor_WorldToActorCoords(&this->actor, &sCameraEye, &GET_ACTIVE_CAM(play)->eye);
Actor_WorldToActorCoords(&this->actor, &sCameraAt, &GET_ACTIVE_CAM(play)->at);
Actor_WorldToActorCoords(&this->actor, &sSubCamEye, &GET_ACTIVE_CAM(play)->eye);
Actor_WorldToActorCoords(&this->actor, &sSubCamAt, &GET_ACTIVE_CAM(play)->at);
this->radius = -350.0f;
this->actor.world.pos.x = sRoomCenter.x - (Math_SinS(this->actor.shape.rot.y) * 350.0f);
this->actor.world.pos.z = sRoomCenter.z - (Math_CosS(this->actor.shape.rot.y) * 350.0f);
@@ -1132,12 +1146,12 @@ void BossSst_HeadDarken(BossSst* this, PlayState* play) {
void BossSst_HeadSetupFall(BossSst* this) {
this->actor.speedXZ = 1.0f;
Math_Vec3f_Copy(&sCameraAt, &sCameraAtPoints[3]);
Math_Vec3f_Copy(&sCameraEye, &sCameraEyePoints[3]);
sCameraAtVel.x = 0.0f;
sCameraAtVel.z = 0.0f;
sCameraAtVel.y = -50.0f;
Math_Vec3f_Copy(&sCameraEyeVel, &sZeroVec);
Math_Vec3f_Copy(&sSubCamAt, &sSubCamAtPoints[3]);
Math_Vec3f_Copy(&sSubCamEye, &sSubCamEyePoints[3]);
sSubCamAtVel.x = 0.0f;
sSubCamAtVel.z = 0.0f;
sSubCamAtVel.y = -50.0f;
Math_Vec3f_Copy(&sSubCamEyeVel, &sZeroVec);
this->actionFunc = BossSst_HeadFall;
}
@@ -1147,7 +1161,7 @@ void BossSst_HeadFall(BossSst* this, PlayState* play) {
BossSst_HeadSetupMelt(this);
}
if (sCameraAt.y > 200.0f) {
if (sSubCamAt.y > 200.0f) {
BossSst_UpdateDeathCamera(this, play);
}
}
@@ -1197,10 +1211,10 @@ void BossSst_HeadFinish(BossSst* this, PlayState* play) {
if (this->effectMode == BONGO_NULL) {
if (this->timer < -170) {
BossSst_UpdateDeathCamera(this, play);
Play_CopyCamera(play, CAM_ID_MAIN, sCutsceneCamera);
Play_ChangeCameraStatus(play, sCutsceneCamera, CAM_STAT_WAIT);
Play_CopyCamera(play, CAM_ID_MAIN, sSubCamId);
Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE);
Play_ClearCamera(play, sCutsceneCamera);
Play_ClearCamera(play, sSubCamId);
Player_SetCsActionWithHaltedActors(play, &GET_PLAYER(play)->actor, 7);
func_80064534(play, &play->csCtx);
Actor_Kill(&this->actor);
@@ -3291,7 +3305,7 @@ void BossSst_Reset(void) {
sHandYawOffsets[0] = 0;
sHandYawOffsets[1] = 0;
sCutsceneCamera = 0;
sSubCamId = 0;
sBodyStatic = false;
// Reset death colors
sBodyColor.a = 255;
+28 -28
View File
@@ -166,7 +166,7 @@ static Vec3f sTwinrovaPillarPos[] = {
{ 0.0f, 380.0f, -580.0f },
};
static u8 sTwInitalized = false;
static u8 sTwInitialized = false;
static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, 5, ICHAIN_CONTINUE),
@@ -199,11 +199,11 @@ static u8 D_8094C878;
static s16 D_8094C87A;
static s16 D_8094C87C;
static u8 D_8094C87E;
static BossTwEffect sTwEffects[150];
static BossTwEffect sEffects[150];
#define BOSS_TW_SHIP_SAVESTATE_FIELDS(F) \
F(sTwInitalized) \
F(sTwEffects)
F(sTwInitialized) \
F(sEffects)
SHIP_SAVESTATE_DEFINE(BossTw, BOSS_TW_SHIP_SAVESTATE_FIELDS)
@@ -274,7 +274,7 @@ void BossTw_AddPlayerFreezeEffect(PlayState* play, Actor* target) {
BossTwEffect* eff;
s16 i;
for (eff = play->specialEffects, i = 0; i < ARRAY_COUNT(sTwEffects); i++, eff++) {
for (eff = play->specialEffects, i = 0; i < ARRAY_COUNT(sEffects); i++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_PLYR_FRZ;
eff->curSpeed = sZeroVector;
@@ -298,7 +298,7 @@ void BossTw_AddFlameEffect(PlayState* play, Vec3f* initalPos, Vec3f* initalSpeed
s16 i;
BossTwEffect* eff;
for (i = 0, eff = play->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) {
for (i = 0, eff = play->specialEffects; i < ARRAY_COUNT(sEffects); i++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_FLAME;
eff->pos = *initalPos;
@@ -318,7 +318,7 @@ void BossTw_AddMergeFlameEffect(PlayState* play, Vec3f* initialPos, f32 scale, f
s16 i;
BossTwEffect* eff;
for (i = 0, eff = play->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) {
for (i = 0, eff = play->specialEffects; i < ARRAY_COUNT(sEffects); i++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_MERGEFLAME;
eff->pos = *initialPos;
@@ -341,7 +341,7 @@ void BossTw_AddShieldBlastEffect(PlayState* play, Vec3f* initalPos, Vec3f* inita
s16 i;
BossTwEffect* eff;
for (i = 0, eff = play->specialEffects; i < ARRAY_COUNT(sTwEffects); i++, eff++) {
for (i = 0, eff = play->specialEffects; i < ARRAY_COUNT(sEffects); i++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_SHLD_BLST;
eff->pos = *initalPos;
@@ -368,7 +368,7 @@ void BossTw_AddShieldDeflectEffect(PlayState* play, f32 arg1, s16 arg2) {
sShieldHitYaw = player->actor.shape.rot.y;
for (i = 0; i < 8; i++) {
for (eff = play->specialEffects, j = 0; j < ARRAY_COUNT(sTwEffects); j++, eff++) {
for (eff = play->specialEffects, j = 0; j < ARRAY_COUNT(sEffects); j++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_SHLD_DEFL;
eff->pos = sShieldHitPos;
@@ -398,7 +398,7 @@ void BossTw_AddShieldHitEffect(PlayState* play, f32 arg1, s16 arg2) {
sShieldHitYaw = player->actor.shape.rot.y;
for (i = 0; i < 8; i++) {
for (eff = play->specialEffects, j = 0; j < ARRAY_COUNT(sTwEffects); j++, eff++) {
for (eff = play->specialEffects, j = 0; j < ARRAY_COUNT(sEffects); j++, eff++) {
if (eff->type == TWEFF_NONE) {
eff->type = TWEFF_SHLD_HIT;
eff->pos = sShieldHitPos;
@@ -462,8 +462,8 @@ void BossTw_Init(Actor* thisx, PlayState* play2) {
this->actor.colChkInfo.health = 0;
Collider_InitCylinder(play, &this->collider);
if (!sTwInitalized) {
sTwInitalized = true;
if (!sTwInitialized) {
sTwInitialized = true;
play->envCtx.unk_BF = 1;
play->envCtx.unk_BE = 1;
play->envCtx.unk_BD = 1;
@@ -475,11 +475,11 @@ void BossTw_Init(Actor* thisx, PlayState* play2) {
D_8094C858 = D_8094C854 = 0.0f;
sFixedBlastType = Rand_ZeroFloat(1.99f);
play->specialEffects = sTwEffects;
play->specialEffects = sEffects;
for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
sTwEffects[i].type = TWEFF_NONE;
sTwEffects[i].epoch++;
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
sEffects[i].type = TWEFF_NONE;
sEffects[i].epoch++;
}
}
@@ -580,7 +580,7 @@ void BossTw_Destroy(Actor* thisx, PlayState* play) {
}
if (thisx->params == TW_TWINROVA) {
sTwInitalized = false;
sTwInitialized = false;
}
}
@@ -715,7 +715,7 @@ void BossTw_SpawnGroundBlast(BossTw* this, PlayState* play, s16 blastType) {
Vec3f velocity;
Vec3f accel;
for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
velocity.x = Rand_CenteredFloat(20.0f);
velocity.y = Rand_ZeroFloat(10.0f);
velocity.z = Rand_CenteredFloat(20.0f);
@@ -1078,7 +1078,7 @@ void BossTw_ShootBeam(BossTw* this, PlayState* play) {
Vec3f velocity;
Vec3f accel = { 0.0f, 0.0f, 0.0f };
for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
velocity.x = Rand_CenteredFloat(15.0f);
velocity.y = Rand_CenteredFloat(15.0f);
velocity.z = Rand_CenteredFloat(15.0f);
@@ -4571,7 +4571,7 @@ void BossTw_UpdateEffects(PlayState* play) {
f32 phi_f0;
Actor* unk44;
for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
if (eff->type != 0) {
eff->pos.x += eff->curSpeed.x;
eff->pos.y += eff->curSpeed.y;
@@ -4903,7 +4903,7 @@ void BossTw_DrawEffects(PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
if (currentEffect->type == 1) {
FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch);
@@ -4928,7 +4928,7 @@ void BossTw_DrawEffects(PlayState* play) {
sp18F = 0;
currentEffect = effectHead;
for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
if (currentEffect->type == 3) {
FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch);
@@ -4956,7 +4956,7 @@ void BossTw_DrawEffects(PlayState* play) {
sp18F = 0;
currentEffect = effectHead;
for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
if (currentEffect->type == 2) {
FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch);
@@ -4986,7 +4986,7 @@ void BossTw_DrawEffects(PlayState* play) {
sp18F = 0;
currentEffect = effectHead;
for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
if (currentEffect->type == 4) {
FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch);
@@ -5034,7 +5034,7 @@ void BossTw_DrawEffects(PlayState* play) {
sp18F = 0;
currentEffect = effectHead;
for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
Actor* actor;
Vec3f off;
@@ -5083,7 +5083,7 @@ void BossTw_DrawEffects(PlayState* play) {
sp18F = 0;
currentEffect = effectHead;
for (i = 0; i < ARRAY_COUNT(sTwEffects); i++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++) {
if (currentEffect->type >= 6) {
FrameInterpolation_RecordOpenChild(currentEffect, currentEffect->epoch);
@@ -5474,6 +5474,6 @@ void BossTw_TwinrovaLaugh(BossTw* this, PlayState* play) {
}
void BossTw_Reset(void) {
sTwInitalized = false;
memset(sTwEffects, 0, sizeof(sTwEffects));
sTwInitialized = false;
memset(sEffects, 0, sizeof(sEffects));
}
+192 -175
View File
@@ -18,6 +18,7 @@
#include "soh/frame_interpolation.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/Enhancements/savestate_serialize.h"
#define FLAGS \
(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \
@@ -387,24 +388,40 @@ static DamageTable sDamageTable[] = {
static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f };
static u8 sKillBari = 0;
static u8 sBodyBari[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static s16 sCsCamera = 0;
static s16 sSubCamId = 0;
static BossVaEffect sVaEffects[400];
static BossVaEffect sEffects[400];
static u8 sBodyState;
static u8 sFightPhase;
static s8 sCsState;
static Vec3f sCameraEye;
static Vec3f sCameraAt;
static Vec3f sCameraNextEye;
static Vec3f sCameraNextAt;
static Vec3f sCameraEyeMaxVel;
static Vec3f sCameraAtMaxVel;
static Vec3f sSubCamEye;
static Vec3f sSubCamAt;
static Vec3f sSubCamEyeNext;
static Vec3f sSubCamAtNext;
static Vec3f sSubCamEyeMaxVelFrac;
static Vec3f sSubCamAtMaxVelFrac;
static s16 sDoorState;
static u8 sPhase3StopMoving;
static Vec3s sZapperRot;
static u16 sPhase2Timer;
static s8 sPhase4HP;
#define BOSS_VA_SHIP_SAVESTATE_FIELDS(F) \
F(sKillBari) \
F(sBodyBari) \
F(sSubCamId) \
F(sEffects) \
F(sBodyState) \
F(sFightPhase) \
F(sCsState) \
F(sDoorState) \
F(sPhase3StopMoving) \
F(sZapperRot) \
F(sPhase2Timer) \
F(sPhase4HP)
SHIP_SAVESTATE_DEFINE(BossVa, BOSS_VA_SHIP_SAVESTATE_FIELDS)
void BossVa_SetupAction(BossVa* this, BossVaActionFunc func) {
this->actionFunc = func;
}
@@ -452,7 +469,7 @@ void BossVa_BloodDroplets(PlayState* play, Vec3f* pos, s16 phase, s16 yaw) {
spawnPos.x = Rand_CenteredFloat(10.0f) + pos->x;
spawnPos.y = pos->y - (Rand_ZeroOne() * 15.0f);
spawnPos.z = Rand_CenteredFloat(10.0f) + pos->z;
BossVa_SpawnBloodDroplets(play, sVaEffects, &spawnPos, 65, phase, yaw);
BossVa_SpawnBloodDroplets(play, sEffects, &spawnPos, 65, phase, yaw);
}
}
@@ -464,7 +481,7 @@ void BossVa_BloodSplatter(PlayState* play, BossVaEffect* src, s16 yaw, s16 scale
pos.x = Rand_CenteredFloat(10.0f) + src->pos.x;
pos.y = src->pos.y - (Rand_ZeroOne() * 15.0f);
pos.z = Rand_CenteredFloat(10.0f) + src->pos.z;
BossVa_SpawnBloodSplatter(play, sVaEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale);
BossVa_SpawnBloodSplatter(play, sEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale);
}
}
@@ -476,7 +493,7 @@ void BossVa_Gore(PlayState* play, BossVaEffect* src, s16 yaw, s16 scale) {
pos.x = Rand_CenteredFloat(10.0f) + src->pos.x;
pos.y = Rand_CenteredFloat(10.0f) + src->pos.y;
pos.z = Rand_CenteredFloat(10.0f) + src->pos.z;
BossVa_SpawnGore(play, sVaEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale);
BossVa_SpawnGore(play, sEffects, &pos, (s16)Rand_CenteredFloat(0x6590) + yaw, scale);
}
}
@@ -495,7 +512,7 @@ void BossVa_Spark(PlayState* play, BossVa* this, s32 count, s16 scale, f32 xzSpr
offset.x = Rand_CenteredFloat(xzSpread) + this->effectPos[index].x - this->actor.world.pos.x;
offset.y = Rand_CenteredFloat(ySpread) + this->effectPos[index].y - this->actor.world.pos.y;
offset.z = Rand_CenteredFloat(xzSpread) + this->effectPos[index].z - this->actor.world.pos.z;
BossVa_SpawnSpark(play, sVaEffects, this, &offset, scale, mode);
BossVa_SpawnSpark(play, sEffects, this, &offset, scale, mode);
}
}
@@ -515,7 +532,7 @@ void BossVa_Tumor(PlayState* play, BossVa* this, s32 count, s16 scale, f32 xzSpr
offset.x = Rand_CenteredFloat(xzSpread) + this->effectPos[index].x - this->actor.world.pos.x;
offset.y = Rand_CenteredFloat(ySpread) + this->effectPos[index].y - this->actor.world.pos.y;
offset.z = Rand_CenteredFloat(xzSpread) + this->effectPos[index].z - this->actor.world.pos.z;
BossVa_SpawnTumor(play, sVaEffects, this, &offset, scale, mode);
BossVa_SpawnTumor(play, sEffects, this, &offset, scale, mode);
}
}
@@ -670,16 +687,16 @@ void BossVa_Init(Actor* thisx, PlayState* play2) {
play->envCtx.screenFillColor[2] = 0xBE;
play->envCtx.screenFillColor[3] = 0xD2;
func_80064520(play, &play->csCtx);
sCsCamera = Play_CreateSubCamera(play);
sSubCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, sCsCamera, CAM_STAT_ACTIVE);
sCameraNextEye.x = sCameraEye.x = 140.0f;
sCameraNextEye.y = sCameraEye.y = 205.0f;
sCameraNextEye.z = sCameraEye.z = -20.0f;
sCameraNextAt.x = sCameraAt.x = 10.0f;
sCameraNextAt.y = sCameraAt.y = 50.0f;
sCameraNextAt.z = sCameraAt.z = -220.0f;
Play_CameraSetAtEye(play, sCsCamera, &sCameraAt, &sCameraEye);
Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE);
sSubCamEyeNext.x = sSubCamEye.x = 140.0f;
sSubCamEyeNext.y = sSubCamEye.y = 205.0f;
sSubCamEyeNext.z = sSubCamEye.z = -20.0f;
sSubCamAtNext.x = sSubCamAt.x = 10.0f;
sSubCamAtNext.y = sSubCamAt.y = 50.0f;
sSubCamAtNext.z = sSubCamAt.z = -220.0f;
Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye);
this->timer = 20;
for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_UPPER_1; i--) {
@@ -691,7 +708,7 @@ void BossVa_Init(Actor* thisx, PlayState* play2) {
sInitRot[i].y + this->actor.world.rot.y, sInitRot[i].z + this->actor.world.rot.z, i);
}
sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec;
}
} else {
@@ -711,7 +728,7 @@ void BossVa_Init(Actor* thisx, PlayState* play2) {
sInitRot[i].y + this->actor.world.rot.y, sInitRot[i].z + this->actor.world.rot.z, i);
}
memset((u8*)sVaEffects, 0, ARRAY_COUNT(sVaEffects) * sizeof(BossVaEffect));
memset((u8*)sEffects, 0, ARRAY_COUNT(sEffects) * sizeof(BossVaEffect));
if (sCsState < BOSSVA_BATTLE) {
BossVa_SetupIntro(this);
} else {
@@ -812,21 +829,21 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
break;
case INTRO_LOOK_DOOR:
func_80064520(play, &play->csCtx);
if (sCsCamera == SUBCAM_FREE) {
sCsCamera = Play_CreateSubCamera(play);
if (sSubCamId == SUBCAM_FREE) {
sSubCamId = Play_CreateSubCamera(play);
}
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, sCsCamera, CAM_STAT_ACTIVE);
Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE);
sCameraNextEye.x = sCameraEye.x = 13.0f;
sCameraNextEye.y = sCameraEye.y = 124.0f;
sCameraNextEye.z = sCameraEye.z = 167.0f;
sSubCamEyeNext.x = sSubCamEye.x = 13.0f;
sSubCamEyeNext.y = sSubCamEye.y = 124.0f;
sSubCamEyeNext.z = sSubCamEye.z = 167.0f;
sCameraNextAt.x = sCameraAt.x = player->actor.world.pos.x;
sCameraNextAt.y = sCameraAt.y = player->actor.world.pos.y;
sCameraNextAt.z = sCameraAt.z = player->actor.world.pos.z;
sSubCamAtNext.x = sSubCamAt.x = player->actor.world.pos.x;
sSubCamAtNext.y = sSubCamAt.y = player->actor.world.pos.y;
sSubCamAtNext.z = sSubCamAt.z = player->actor.world.pos.z;
sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec;
this->timer = 10;
sCsState++;
@@ -854,21 +871,21 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
break;
case INTRO_SPAWN_BARI:
func_80064520(play, &play->csCtx);
if (sCsCamera == SUBCAM_FREE) {
sCsCamera = Play_CreateSubCamera(play);
if (sSubCamId == SUBCAM_FREE) {
sSubCamId = Play_CreateSubCamera(play);
}
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, sCsCamera, CAM_STAT_ACTIVE);
Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE);
sCameraNextEye.x = sCameraEye.x = 13.0f;
sCameraNextEye.y = sCameraEye.y = 124.0f;
sCameraNextEye.z = sCameraEye.z = 167.0f;
sSubCamEyeNext.x = sSubCamEye.x = 13.0f;
sSubCamEyeNext.y = sSubCamEye.y = 124.0f;
sSubCamEyeNext.z = sSubCamEye.z = 167.0f;
sCameraNextAt.x = sCameraAt.x = player->actor.world.pos.x;
sCameraNextAt.y = sCameraAt.y = player->actor.world.pos.y;
sCameraNextAt.z = sCameraAt.z = player->actor.world.pos.z;
sSubCamAtNext.x = sSubCamAt.x = player->actor.world.pos.x;
sSubCamAtNext.y = sSubCamAt.y = player->actor.world.pos.y;
sSubCamAtNext.z = sSubCamAt.z = player->actor.world.pos.z;
sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec;
for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_UPPER_1; i--) {
Actor_SpawnAsChild(
@@ -882,16 +899,16 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
sCsState++;
break;
case INTRO_REVERSE_CAMERA:
sCameraNextEye.x = -92.0f;
sCameraNextEye.y = 22.0f;
sCameraNextEye.z = 360.0f;
sCameraNextAt.x = 63.0f;
sCameraNextAt.y = 104.0f;
sCameraNextAt.z = 248.0f;
Math_SmoothStepToF(&sCameraEyeMaxVel.x, 7.0f, 0.3f, 0.7f, 0.05f);
sCameraEyeMaxVel.z = sCameraEyeMaxVel.x;
sCameraEyeMaxVel.y = sCameraEyeMaxVel.z;
sCameraAtMaxVel = sCameraEyeMaxVel;
sSubCamEyeNext.x = -92.0f;
sSubCamEyeNext.y = 22.0f;
sSubCamEyeNext.z = 360.0f;
sSubCamAtNext.x = 63.0f;
sSubCamAtNext.y = 104.0f;
sSubCamAtNext.z = 248.0f;
Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 7.0f, 0.3f, 0.7f, 0.05f);
sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x;
sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.z;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac;
this->timer--;
if (this->timer == 0) {
@@ -900,25 +917,25 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
}
break;
case INTRO_SUPPORT_CAMERA:
sCameraNextEye.x = sCameraEye.x = 140.0f;
sCameraNextEye.y = sCameraEye.y = 205.0f;
sCameraNextEye.z = sCameraEye.z = -20.0f;
sSubCamEyeNext.x = sSubCamEye.x = 140.0f;
sSubCamEyeNext.y = sSubCamEye.y = 205.0f;
sSubCamEyeNext.z = sSubCamEye.z = -20.0f;
sCameraNextAt.x = sCameraAt.x = 10.0f;
sCameraNextAt.y = sCameraAt.y = 247.0f;
sCameraNextAt.z = sCameraAt.z = -220.0f;
sSubCamAtNext.x = sSubCamAt.x = 10.0f;
sSubCamAtNext.y = sSubCamAt.y = 247.0f;
sSubCamAtNext.z = sSubCamAt.z = -220.0f;
sCsState++;
this->timer = 1;
break;
case INTRO_BODY_SOUND:
sCameraNextAt.x = 10.0f;
sCameraNextAt.y = 247.0f;
sCameraNextAt.z = -220.0f;
Math_SmoothStepToF(&sCameraEyeMaxVel.x, 7.0f, 0.3f, 0.7f, 0.05f);
sCameraEyeMaxVel.z = sCameraEyeMaxVel.x;
sCameraEyeMaxVel.y = sCameraEyeMaxVel.z;
sCameraAtMaxVel = sCameraEyeMaxVel;
sSubCamAtNext.x = 10.0f;
sSubCamAtNext.y = 247.0f;
sSubCamAtNext.z = -220.0f;
Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 7.0f, 0.3f, 0.7f, 0.05f);
sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x;
sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.z;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac;
this->timer--;
if (this->timer == 0) {
@@ -929,11 +946,11 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
case INTRO_LOOK_SUPPORT:
this->timer--;
if (this->timer == 0) {
sCameraNextAt.x = 10.0f;
sCameraNextAt.y = 50.0f;
sCameraNextAt.z = -220.0f;
sSubCamAtNext.x = 10.0f;
sSubCamAtNext.y = 50.0f;
sSubCamAtNext.z = -220.0f;
sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec;
sCsState++;
sCsState++;
@@ -941,13 +958,13 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
}
break;
case INTRO_CALL_BARI:
Math_SmoothStepToF(&sCameraEyeMaxVel.x, 14.0f, 0.3f, 1.0f, 0.25f);
Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 14.0f, 0.3f, 1.0f, 0.25f);
sCameraEyeMaxVel.y = sCameraEyeMaxVel.x * 0.7f;
sCameraEyeMaxVel.z = sCameraEyeMaxVel.x;
sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.x * 0.7f;
sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x;
sCameraAtMaxVel = sCameraEyeMaxVel;
sCameraAtMaxVel.z = sCameraAtMaxVel.z * 1.75f;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac;
sSubCamAtMaxVelFrac.z = sSubCamAtMaxVelFrac.z * 1.75f;
this->timer--;
if (this->timer == 0) {
@@ -975,9 +992,9 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
}
}
Math_SmoothStepToS(&this->unk_1F2, 0x280, 1, 0x32, 0);
Math_SmoothStepToF(&sCameraEyeMaxVel.x, 14.0f, 0.3f, 1.0f, 0.25f);
sCameraEyeMaxVel.z = sCameraEyeMaxVel.x;
sCameraAtMaxVel = sCameraEyeMaxVel;
Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 14.0f, 0.3f, 1.0f, 0.25f);
sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac;
if (this->timer >= 45000) {
play->envCtx.unk_BF = 1;
Player_SetCsActionWithHaltedActors(play, &this->actor, 8);
@@ -987,15 +1004,15 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
this->timer += this->unk_1F2;
if (this->timer >= 65536) {
sCameraEyeMaxVel.y = sCameraAtMaxVel.y = 9.8f;
sSubCamEyeMaxVelFrac.y = sSubCamAtMaxVelFrac.y = 9.8f;
sCsState++;
sCameraNextEye.x = 10.0f;
sCameraNextEye.z = 0.0f;
sSubCamEyeNext.x = 10.0f;
sSubCamEyeNext.z = 0.0f;
sCameraNextAt.x = 10.0f;
sCameraNextAt.y = 140.0f;
sCameraNextAt.z = -200.0f;
sSubCamAtNext.x = 10.0f;
sSubCamAtNext.y = 140.0f;
sSubCamAtNext.z = -200.0f;
if (!Flags_GetEventChkInf(EVENTCHKINF_BEGAN_BARINA_BATTLE)) {
TitleCard_InitBossName(play, &play->actorCtx.titleCtx,
@@ -1008,10 +1025,10 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
this->timer = 40;
} else {
sCameraEyeMaxVel.y = 1.6f;
sCameraNextEye.y = 5.0f;
sCameraNextEye.x = Math_SinS(this->timer) * 200.0f;
sCameraNextEye.z = (Math_CosS(this->timer) * 200.0f) + -200.0f;
sSubCamEyeMaxVelFrac.y = 1.6f;
sSubCamEyeNext.y = 5.0f;
sSubCamEyeNext.x = Math_SinS(this->timer) * 200.0f;
sSubCamEyeNext.z = (Math_CosS(this->timer) * 200.0f) + -200.0f;
}
break;
case INTRO_TITLE:
@@ -1033,8 +1050,8 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
case INTRO_FINISH:
this->timer--;
if (this->timer == 0) {
Play_ClearCamera(play, sCsCamera);
sCsCamera = 0;
Play_ClearCamera(play, sSubCamId);
sSubCamId = 0;
func_80064534(play, &play->csCtx);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE);
Player_SetCsActionWithHaltedActors(play, &this->actor, 7);
@@ -1057,14 +1074,14 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
this->unk_1B0 += 0xCE4;
this->bodyGlow = (s16)(Math_SinS(this->unk_1B0) * 50.0f) + 150;
if ((sCsCamera != 0) && (sCsState <= INTRO_TITLE)) {
Math_SmoothStepToF(&sCameraEye.x, sCameraNextEye.x, 0.3f, sCameraEyeMaxVel.x, 0.075f);
Math_SmoothStepToF(&sCameraEye.y, sCameraNextEye.y, 0.3f, sCameraEyeMaxVel.y, 0.075f);
Math_SmoothStepToF(&sCameraEye.z, sCameraNextEye.z, 0.3f, sCameraEyeMaxVel.z, 0.075f);
Math_SmoothStepToF(&sCameraAt.x, sCameraNextAt.x, 0.3f, sCameraAtMaxVel.x, 0.075f);
Math_SmoothStepToF(&sCameraAt.y, sCameraNextAt.y, 0.3f, sCameraAtMaxVel.y, 0.075f);
Math_SmoothStepToF(&sCameraAt.z, sCameraNextAt.z, 0.3f, sCameraAtMaxVel.z, 0.075f);
Play_CameraSetAtEye(play, sCsCamera, &sCameraAt, &sCameraEye);
if ((sSubCamId != 0) && (sCsState <= INTRO_TITLE)) {
Math_SmoothStepToF(&sSubCamEye.x, sSubCamEyeNext.x, 0.3f, sSubCamEyeMaxVelFrac.x, 0.075f);
Math_SmoothStepToF(&sSubCamEye.y, sSubCamEyeNext.y, 0.3f, sSubCamEyeMaxVelFrac.y, 0.075f);
Math_SmoothStepToF(&sSubCamEye.z, sSubCamEyeNext.z, 0.3f, sSubCamEyeMaxVelFrac.z, 0.075f);
Math_SmoothStepToF(&sSubCamAt.x, sSubCamAtNext.x, 0.3f, sSubCamAtMaxVelFrac.x, 0.075f);
Math_SmoothStepToF(&sSubCamAt.y, sSubCamAtNext.y, 0.3f, sSubCamAtMaxVelFrac.y, 0.075f);
Math_SmoothStepToF(&sSubCamAt.z, sSubCamAtNext.z, 0.3f, sSubCamAtMaxVelFrac.z, 0.075f);
Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye);
}
}
@@ -1195,7 +1212,7 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) {
sp48.y += 310.0f + (this->actor.shape.yOffset * this->actor.scale.y);
sp48.x += -10.0f;
sp48.z += 220.0f;
BossVa_SpawnSparkBall(play, sVaEffects, this, &sp48, 4, 0);
BossVa_SpawnSparkBall(play, sEffects, this, &sp48, 4, 0);
}
if (Rand_ZeroOne() < 0.1f) {
@@ -1558,24 +1575,24 @@ void BossVa_BodyDeath(BossVa* this, PlayState* play) {
case DEATH_START:
Player_SetCsActionWithHaltedActors(play, &this->actor, 1);
func_80064520(play, &play->csCtx);
sCsCamera = Play_CreateSubCamera(play);
sSubCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, sCsCamera, CAM_STAT_ACTIVE);
Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE);
sCameraNextAt.x = this->actor.world.pos.x;
sCameraNextAt.y = this->actor.world.pos.y;
sCameraNextAt.z = this->actor.world.pos.z;
sSubCamAtNext.x = this->actor.world.pos.x;
sSubCamAtNext.y = this->actor.world.pos.y;
sSubCamAtNext.z = this->actor.world.pos.z;
sCameraAt = camera->at;
sSubCamAt = camera->at;
sCameraNextEye = sCameraEye = camera->eye;
sSubCamEyeNext = sSubCamEye = camera->eye;
sCameraNextEye.y = 40.0f;
sCameraNextAt.y = 140.0f;
sSubCamEyeNext.y = 40.0f;
sSubCamAtNext.y = 140.0f;
sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec;
this->unk_1AC = Math_Vec3f_Yaw(&sCameraEye, &sCameraNextAt) - 0x100;
this->unk_1AC = Math_Vec3f_Yaw(&sSubCamEye, &sSubCamAtNext) - 0x100;
this->unk_1B0 = 15;
play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[2] = 0xFF;
play->envCtx.screenFillColor[3] = 0;
@@ -1583,13 +1600,13 @@ void BossVa_BodyDeath(BossVa* this, PlayState* play) {
sCsState++;
case DEATH_BODY_TUMORS:
this->unk_1AC += 0x100;
sCameraNextEye.x = (Math_SinS(this->unk_1AC) * (160.0f + this->unk_1A8)) + sCameraNextAt.x;
sCameraNextEye.z = (Math_CosS(this->unk_1AC) * (160.0f + this->unk_1A8)) + sCameraNextAt.z;
Math_SmoothStepToF(&sCameraEyeMaxVel.x, 16.0f, 0.4f, 1.5f, 0.5f);
sCameraEyeMaxVel.z = sCameraEyeMaxVel.x;
sCameraEyeMaxVel.y = sCameraEyeMaxVel.x * 0.5f;
sCameraAtMaxVel = sCameraEyeMaxVel;
tmp16 = Rand_CenteredFloat(0.5f) + ((sCameraEyeMaxVel.x * 0.5f) + 0.6f);
sSubCamEyeNext.x = (Math_SinS(this->unk_1AC) * (160.0f + this->unk_1A8)) + sSubCamAtNext.x;
sSubCamEyeNext.z = (Math_CosS(this->unk_1AC) * (160.0f + this->unk_1A8)) + sSubCamAtNext.z;
Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 16.0f, 0.4f, 1.5f, 0.5f);
sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x;
sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.x * 0.5f;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac;
tmp16 = Rand_CenteredFloat(0.5f) + ((sSubCamEyeMaxVelFrac.x * 0.5f) + 0.6f);
if (((play->gameplayFrames % 4) == 0) && (this->unk_1B0 != 0)) {
for (i = 6; i > 1; i--) {
BossVa_Tumor(play, this, 1, tmp16, 0.0f, 0.0f, TUMOR_BODY, i, true);
@@ -1602,7 +1619,7 @@ void BossVa_BodyDeath(BossVa* this, PlayState* play) {
if (this->unk_1B0 == 0) {
sCsState++;
sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec;
}
break;
case DEATH_CORE_DEAD:
@@ -1627,36 +1644,36 @@ void BossVa_BodyDeath(BossVa* this, PlayState* play) {
this->timer--;
if (this->timer == 0) {
sCameraNextAt.x = this->actor.world.pos.x;
sCameraNextAt.y = this->actor.world.pos.y + 30.0f;
sCameraNextAt.z = this->actor.world.pos.z;
sSubCamAtNext.x = this->actor.world.pos.x;
sSubCamAtNext.y = this->actor.world.pos.y + 30.0f;
sSubCamAtNext.z = this->actor.world.pos.z;
sCameraNextEye.x = (Math_SinS(player->actor.shape.rot.y) * -130.0f) + player->actor.world.pos.x;
sCameraNextEye.z = (Math_CosS(player->actor.shape.rot.y) * -130.0f) + player->actor.world.pos.z;
sCameraNextEye.y = player->actor.world.pos.y + 55.0f;
sSubCamEyeNext.x = (Math_SinS(player->actor.shape.rot.y) * -130.0f) + player->actor.world.pos.x;
sSubCamEyeNext.z = (Math_CosS(player->actor.shape.rot.y) * -130.0f) + player->actor.world.pos.z;
sSubCamEyeNext.y = player->actor.world.pos.y + 55.0f;
sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec;
sCsState++;
this->timer = 133;
}
break;
case DEATH_MUSIC:
Math_SmoothStepToF(&sCameraEyeMaxVel.x, 1.5f, 0.3f, 0.05f, 0.015f);
sCameraEyeMaxVel.z = sCameraEyeMaxVel.x;
sCameraEyeMaxVel.y = sCameraEyeMaxVel.z;
sCameraAtMaxVel = sCameraEyeMaxVel;
Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 1.5f, 0.3f, 0.05f, 0.015f);
sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x;
sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.z;
sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac;
this->timer--;
if (this->timer == 0) {
Play_ClearCamera(play, sCsCamera);
sCsCamera = 0;
Play_ClearCamera(play, sSubCamId);
sSubCamId = 0;
func_80064534(play, &play->csCtx);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE);
camera->eyeNext = camera->eye = sCameraEye;
camera->eyeNext = camera->eye = sSubCamEye;
camera->at = sCameraAt;
camera->at = sSubCamAt;
Player_SetCsActionWithHaltedActors(play, &this->actor, 7);
sCsState++;
@@ -1684,14 +1701,14 @@ void BossVa_BodyDeath(BossVa* this, PlayState* play) {
break;
}
if (sCsCamera != 0) {
Math_SmoothStepToF(&sCameraEye.x, sCameraNextEye.x, 0.3f, sCameraEyeMaxVel.x, 0.15f);
Math_SmoothStepToF(&sCameraEye.y, sCameraNextEye.y, 0.3f, sCameraEyeMaxVel.y, 0.15f);
Math_SmoothStepToF(&sCameraEye.z, sCameraNextEye.z, 0.3f, sCameraEyeMaxVel.z, 0.15f);
Math_SmoothStepToF(&sCameraAt.x, sCameraNextAt.x, 0.3f, sCameraAtMaxVel.x, 0.15f);
Math_SmoothStepToF(&sCameraAt.y, sCameraNextAt.y, 0.3f, sCameraAtMaxVel.y, 0.15f);
Math_SmoothStepToF(&sCameraAt.z, sCameraNextAt.z, 0.3f, sCameraAtMaxVel.z, 0.15f);
Play_CameraSetAtEye(play, sCsCamera, &sCameraAt, &sCameraEye);
if (sSubCamId != 0) {
Math_SmoothStepToF(&sSubCamEye.x, sSubCamEyeNext.x, 0.3f, sSubCamEyeMaxVelFrac.x, 0.15f);
Math_SmoothStepToF(&sSubCamEye.y, sSubCamEyeNext.y, 0.3f, sSubCamEyeMaxVelFrac.y, 0.15f);
Math_SmoothStepToF(&sSubCamEye.z, sSubCamEyeNext.z, 0.3f, sSubCamEyeMaxVelFrac.z, 0.15f);
Math_SmoothStepToF(&sSubCamAt.x, sSubCamAtNext.x, 0.3f, sSubCamAtMaxVelFrac.x, 0.15f);
Math_SmoothStepToF(&sSubCamAt.y, sSubCamAtNext.y, 0.3f, sSubCamAtMaxVelFrac.y, 0.15f);
Math_SmoothStepToF(&sSubCamAt.z, sSubCamAtNext.z, 0.3f, sSubCamAtMaxVelFrac.z, 0.15f);
Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye);
}
SkelAnime_Update(&this->skelAnime);
@@ -1842,11 +1859,11 @@ void BossVa_SupportCut(BossVa* this, PlayState* play) {
switch (sCsState) {
case DEATH_SHELL_BURST:
sCameraEye = sCameraNextEye;
sCameraAt = sCameraNextAt;
Math_SmoothStepToF(&sCameraEye.x, sCameraNextAt.x, 1.0f, 10.0f, 0.0f);
Math_SmoothStepToF(&sCameraEye.z, sCameraNextAt.z, 1.0f, 10.0f, 0.0f);
sCameraEye.y += 20.0f;
sSubCamEye = sSubCamEyeNext;
sSubCamAt = sSubCamAtNext;
Math_SmoothStepToF(&sSubCamEye.x, sSubCamAtNext.x, 1.0f, 10.0f, 0.0f);
Math_SmoothStepToF(&sSubCamEye.z, sSubCamAtNext.z, 1.0f, 10.0f, 0.0f);
sSubCamEye.y += 20.0f;
sCsState++;
case DEATH_CORE_TUMORS:
@@ -2122,7 +2139,7 @@ void BossVa_ZapperAttack(BossVa* this, PlayState* play) {
if (this->timer2 == 20) {
Vec3f sp44 = this->zapHeadPos;
BossVa_SpawnZapperCharge(play, sVaEffects, this, &sp44, &this->headRot, 100, 0);
BossVa_SpawnZapperCharge(play, sEffects, this, &sp44, &this->headRot, 100, 0);
}
}
@@ -2233,11 +2250,11 @@ void BossVa_ZapperDeath(BossVa* this, PlayState* play) {
}
if ((this->actor.params - BOSSVA_ZAPPER_1 + DEATH_ZAPPER_1) == sCsState) {
sCameraAt.x = this->zapNeckPos.x;
sCameraEye.y = sCameraAt.y = this->zapNeckPos.y;
sCameraAt.z = this->zapNeckPos.z;
sCameraEye.x = (Math_CosS(-(this->actor.shape.rot.y + this->unk_1B0)) * sp3C) + this->zapNeckPos.x;
sCameraEye.z = (Math_SinS(-(this->actor.shape.rot.y + this->unk_1B0)) * sp3C) + this->zapNeckPos.z;
sSubCamAt.x = this->zapNeckPos.x;
sSubCamEye.y = sSubCamAt.y = this->zapNeckPos.y;
sSubCamAt.z = this->zapNeckPos.z;
sSubCamEye.x = (Math_CosS(-(this->actor.shape.rot.y + this->unk_1B0)) * sp3C) + this->zapNeckPos.x;
sSubCamEye.z = (Math_SinS(-(this->actor.shape.rot.y + this->unk_1B0)) * sp3C) + this->zapNeckPos.z;
this->unk_1B0 += 0x15E;
}
} else {
@@ -2382,7 +2399,7 @@ void BossVa_ZapperEnraged(BossVa* this, PlayState* play) {
if (this->timer2 == 4) {
Vec3f sp48 = this->zapHeadPos;
BossVa_SpawnZapperCharge(play, sVaEffects, this, &sp48, &this->headRot, 100, 0);
BossVa_SpawnZapperCharge(play, sEffects, this, &sp48, &this->headRot, 100, 0);
}
}
@@ -3296,7 +3313,7 @@ void BossVa_Draw(Actor* thisx, PlayState* play) {
}
if (*paramsPtr == BOSSVA_BODY) {
BossVa_DrawEffects(sVaEffects, play);
BossVa_DrawEffects(sEffects, play);
} else if (*paramsPtr == BOSSVA_DOOR) {
BossVa_DrawDoor(play, sDoorState);
}
@@ -3307,7 +3324,7 @@ void BossVa_Draw(Actor* thisx, PlayState* play) {
static s32 sUnkValue = 0x009B0000; // Unreferenced? Possibly a color
void BossVa_UpdateEffects(PlayState* play) {
BossVaEffect* effect = sVaEffects;
BossVaEffect* effect = sEffects;
Player* player = GET_PLAYER(play);
s16 spB6;
s16 i;
@@ -3325,7 +3342,7 @@ void BossVa_UpdateEffects(PlayState* play) {
f32 pad78;
f32 pad74;
for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type != VA_NONE) {
effect->timer--;
@@ -3523,11 +3540,11 @@ void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play) {
GraphicsContext* gfxCtx = play->state.gfxCtx;
u8 flag = 0;
BossVaEffect* effectHead = effect;
Camera* camera = Play_GetCamera(play, sCsCamera);
Camera* camera = Play_GetCamera(play, sSubCamId);
OPEN_DISPS(gfxCtx);
for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_LARGE_SPARK) {
FrameInterpolation_RecordOpenChild(effect, effect->epoch);
if (!flag) {
@@ -3549,7 +3566,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play) {
}
effect = effectHead;
for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0, flag = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_SPARK_BALL) {
FrameInterpolation_RecordOpenChild(effect, effect->epoch);
if (!flag) {
@@ -3576,7 +3593,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play) {
}
effect = effectHead;
for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0, flag = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_BLOOD) {
FrameInterpolation_RecordOpenChild(effect, effect->epoch);
if (!flag) {
@@ -3607,7 +3624,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play) {
}
effect = effectHead;
for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0, flag = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_TUMOR) {
BossVa* parent = effect->parent;
@@ -3632,7 +3649,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play) {
}
effect = effectHead;
for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0, flag = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_GORE) {
FrameInterpolation_RecordOpenChild(effect, effect->epoch);
if (!flag) {
@@ -3664,7 +3681,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play) {
}
effect = effectHead;
for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0, flag = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_ZAP_CHARGE) {
FrameInterpolation_RecordOpenChild(effect, effect->epoch);
if (!flag) {
@@ -3688,7 +3705,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play) {
}
effect = effectHead;
for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0, flag = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_BLAST_SPARK) {
FrameInterpolation_RecordOpenChild(effect, effect->epoch);
if (!flag) {
@@ -3711,7 +3728,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, PlayState* play) {
}
effect = effectHead;
for (i = 0, flag = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0, flag = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_SMALL_SPARK) {
FrameInterpolation_RecordOpenChild(effect, effect->epoch);
if (!flag) {
@@ -3743,7 +3760,7 @@ void BossVa_SpawnSpark(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3
Vec3f tempVec;
s16 i;
for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_LARGE_SPARK;
effect->parent = this;
@@ -3800,7 +3817,7 @@ void BossVa_SpawnSparkBall(PlayState* play, BossVaEffect* effect, BossVa* this,
Vec3f pos = { 0.0f, -1000.0f, 0.0f };
s16 i;
for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_SPARK_BALL;
effect->parent = this;
@@ -3832,7 +3849,7 @@ void BossVa_SpawnBloodDroplets(PlayState* play, BossVaEffect* effect, Vec3f* pos
Vec3f velocity = { 0.0f, 0.0f, 0.0f };
f32 xzVel;
for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_BLOOD;
effect->pos = *pos;
@@ -3862,7 +3879,7 @@ void BossVa_SpawnBloodSplatter(PlayState* play, BossVaEffect* effect, Vec3f* pos
Vec3f accel = { 0.0f, 0.0f, 0.0f };
Vec3f velocity;
for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_BLOOD;
effect->pos = *pos;
@@ -3895,7 +3912,7 @@ void BossVa_SpawnTumor(PlayState* play, BossVaEffect* effect, BossVa* this, Vec3
Vec3f pos = { 0.0f, -1000.0f, 0.0f };
s16 i;
for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_TUMOR;
effect->parent = this;
@@ -3930,7 +3947,7 @@ void BossVa_SpawnGore(PlayState* play, BossVaEffect* effect, Vec3f* pos, s16 yaw
Vec3f accel = { 0.0f, 0.0f, 0.0f };
Vec3f velocity;
for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_GORE;
effect->pos = *pos;
@@ -3972,7 +3989,7 @@ void BossVa_SpawnZapperCharge(PlayState* play, BossVaEffect* effect, BossVa* thi
Vec3f unused = { 0.0f, -1000.0f, 0.0f };
s16 i;
for (i = 0; i < ARRAY_COUNT(sVaEffects); i++, effect++) {
for (i = 0; i < ARRAY_COUNT(sEffects); i++, effect++) {
if (effect->type == VA_NONE) {
effect->type = VA_ZAP_CHARGE;
effect->parent = this;
@@ -4037,8 +4054,8 @@ void BossVa_DrawDoor(PlayState* play, s16 scale) {
void BossVa_Reset(void) {
sKillBari = 0;
sCsCamera = 0;
memset(sVaEffects, 0, sizeof(sVaEffects));
sSubCamId = 0;
memset(sEffects, 0, sizeof(sEffects));
sBodyState = 0;
sFightPhase = 0;
sCsState = 0;
@@ -40,7 +40,7 @@ const ActorInit En_Clear_Tag_InitVars = {
(ActorResetFunc)EnClearTag_Reset,
};
static u8 sClearTagIsEffectsInitialized = false;
static u8 sIsEffectsInitialized = false;
static Vec3f sZeroVector = { 0.0f, 0.0f, 0.0f };
@@ -87,11 +87,11 @@ static ColliderCylinderInit sLaserCylinderInit = {
// static UNK_TYPE4 D_809D5C98 = 0; // unused
// static UNK_TYPE4 D_809D5C9C = 0; // unused
static EnClearTagEffect sClearTagEffects[CLEAR_TAG_EFFECT_MAX_COUNT];
static EnClearTagEffect sEffects[CLEAR_TAG_EFFECT_MAX_COUNT];
#define EN_CLEAR_TAG_SHIP_SAVESTATE_FIELDS(F) \
F(sClearTagIsEffectsInitialized) \
F(sClearTagEffects)
F(sIsEffectsInitialized) \
F(sEffects)
SHIP_SAVESTATE_DEFINE(EnClearTag, EN_CLEAR_TAG_SHIP_SAVESTATE_FIELDS)
@@ -291,12 +291,12 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) {
}
// Initialize all effects to available if effects have not been initialized.
if (!sClearTagIsEffectsInitialized) {
sClearTagIsEffectsInitialized = true;
play->specialEffects = &sClearTagEffects[0];
if (!sIsEffectsInitialized) {
sIsEffectsInitialized = true;
play->specialEffects = &sEffects[0];
for (i = 0; i < CLEAR_TAG_EFFECT_MAX_COUNT; i++) {
sClearTagEffects[i].type = CLEAR_TAG_EFFECT_AVAILABLE;
sClearTagEffects[i].epoch++;
sEffects[i].type = CLEAR_TAG_EFFECT_AVAILABLE;
sEffects[i].epoch++;
}
this->drawMode = CLEAR_TAG_DRAW_MODE_ALL;
}
@@ -1059,6 +1059,6 @@ void EnClearTag_DrawEffects(PlayState* play) {
}
void EnClearTag_Reset(void) {
memset(sClearTagEffects, 0, sizeof(sClearTagEffects));
sClearTagIsEffectsInitialized = false;
memset(sEffects, 0, sizeof(sEffects));
sIsEffectsInitialized = false;
}
@@ -33,9 +33,9 @@ void EnHeishi1_TurnTowardLink(EnHeishi1* this, PlayState* play);
void EnHeishi1_Kick(EnHeishi1* this, PlayState* play);
void EnHeishi1_WaitNight(EnHeishi1* this, PlayState* play);
static s32 sHeishi1PlayerIsCaught = false;
static s32 sPlayerIsCaught = false;
#define EN_HEISHI1_SHIP_SAVESTATE_FIELDS(F) F(sHeishi1PlayerIsCaught)
#define EN_HEISHI1_SHIP_SAVESTATE_FIELDS(F) F(sPlayerIsCaught)
SHIP_SAVESTATE_DEFINE(EnHeishi1, EN_HEISHI1_SHIP_SAVESTATE_FIELDS)
@@ -73,7 +73,7 @@ static s32 sCamDataIdxs[] = {
static s16 sWaypoints[] = { 0, 4, 1, 5, 2, 6, 3, 7 };
void EnHeishi1_Reset(void) {
sHeishi1PlayerIsCaught = false;
sPlayerIsCaught = false;
}
void EnHeishi1_Init(Actor* thisx, PlayState* play) {
@@ -182,7 +182,7 @@ void EnHeishi1_Walk(EnHeishi1* this, PlayState* play) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_KNIGHT_WALK);
}
if (!sHeishi1PlayerIsCaught) {
if (!sPlayerIsCaught) {
path = &play->setupPathList[this->path];
pointPos = SEGMENTED_TO_VIRTUAL(path->points);
pointPos += this->waypoint;
@@ -287,7 +287,7 @@ void EnHeishi1_Wait(EnHeishi1* this, PlayState* play) {
s32 i;
SkelAnime_Update(&this->skelAnime);
if (!sHeishi1PlayerIsCaught) {
if (!sPlayerIsCaught) {
switch (this->headBehaviorDecided) {
case false:
this->headDirection++;
@@ -380,7 +380,7 @@ void EnHeishi1_Kick(EnHeishi1* this, PlayState* play) {
play->nextEntranceIndex = ENTR_HYRULE_CASTLE_3;
play->transitionTrigger = TRANS_TRIGGER_START;
this->loadStarted = true;
sHeishi1PlayerIsCaught = false;
sPlayerIsCaught = false;
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST);
gSaveContext.nextTransitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST);
}
@@ -441,7 +441,7 @@ void EnHeishi1_Update(Actor* thisx, PlayState* play) {
if (this->type != 5) {
path = this->path * 2;
if ((sCamDataIdxs[path] == activeCam->camDataIdx) || (sCamDataIdxs[path + 1] == activeCam->camDataIdx)) {
if (!sHeishi1PlayerIsCaught) {
if (!sPlayerIsCaught) {
if ((this->actionFunc == EnHeishi1_Walk) || (this->actionFunc == EnHeishi1_Wait)) {
Vec3f searchBallVel;
Vec3f searchBallAccel = { 0.0f, 0.0f, 0.0f };
@@ -487,7 +487,7 @@ void EnHeishi1_Update(Actor* thisx, PlayState* play) {
// "Discovered!"
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 発見! ☆☆☆☆☆ \n" VT_RST);
Player_SetCsActionWithHaltedActors(play, &this->actor, 1);
sHeishi1PlayerIsCaught = true;
sPlayerIsCaught = true;
this->actionFunc = EnHeishi1_SetupMoveToLink;
}
}
@@ -35,13 +35,13 @@ void EnInsect_SetupDropped(EnInsect* this);
void EnInsect_Dropped(EnInsect* this, PlayState* play);
static f32 D_80A7DEB0 = 0.0f;
static s16 D_80A7DEB4 = 0;
s16 D_80A7DEB8 = 0; // not static: read by NoBugsDespawn.cpp
static s16 sCaughtCount = 0;
s16 sDroppedCount = 0; // not static: read by NoBugsDespawn.cpp
#define EN_INSECT_SHIP_SAVESTATE_FIELDS(F) \
F(D_80A7DEB0) \
F(D_80A7DEB4) \
F(D_80A7DEB8)
F(sCaughtCount) \
F(sDroppedCount)
SHIP_SAVESTATE_DEFINE(EnInsect, EN_INSECT_SHIP_SAVESTATE_FIELDS)
@@ -220,7 +220,7 @@ void EnInsect_Init(Actor* thisx, PlayState* play2) {
EnInsect_SetupDropped(this);
D_80A7DEB8++;
sDroppedCount++;
} else {
rand = Rand_ZeroOne();
@@ -240,8 +240,8 @@ void EnInsect_Destroy(Actor* thisx, PlayState* play) {
temp_v0 = this->actor.params & 3;
Collider_DestroyJntSph(play, &this->collider);
if ((temp_v0 == 2 || temp_v0 == 3) && D_80A7DEB8 > 0) {
D_80A7DEB8--;
if ((temp_v0 == 2 || temp_v0 == 3) && sDroppedCount > 0) {
sDroppedCount--;
}
ResourceMgr_UnregisterSkeleton(&this->skelAnime);
@@ -274,7 +274,7 @@ void EnInsect_SlowDown(EnInsect* this, PlayState* play) {
if (((this->insectFlags & 4) && this->lifeTimer <= 0) ||
((sp2E == 2 || sp2E == 3) && (this->insectFlags & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
D_80A7DEB8 >= 4)) {
sDroppedCount >= 4)) {
EnInsect_SetupDig(this);
} else if ((this->insectFlags & 1) && (this->actor.bgCheckFlags & 0x40)) {
EnInsect_SetupWalkOnWater(this);
@@ -318,7 +318,7 @@ void EnInsect_Crawl(EnInsect* this, PlayState* play) {
if (((this->insectFlags & 4) && this->lifeTimer <= 0) ||
((sp34 == 2 || sp34 == 3) && (this->insectFlags & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
D_80A7DEB8 >= 4)) {
sDroppedCount >= 4)) {
EnInsect_SetupDig(this);
} else if ((this->insectFlags & 1) && (this->actor.bgCheckFlags & 0x40)) {
EnInsect_SetupWalkOnWater(this);
@@ -524,7 +524,7 @@ void EnInsect_WalkOnWater(EnInsect* this, PlayState* play) {
}
if (this->actionTimer <= 0 || ((this->insectFlags & 4) && this->lifeTimer <= 0) ||
((sp4E == 2 || sp4E == 3) && (this->insectFlags & 1) && D_80A7DEB8 >= 4)) {
((sp4E == 2 || sp4E == 3) && (this->insectFlags & 1) && sDroppedCount >= 4)) {
EnInsect_SetupDrown(this);
} else if (!(this->actor.bgCheckFlags & 0x40)) {
if (this->insectFlags & 0x10) {
@@ -703,7 +703,7 @@ void EnInsect_Dropped(EnInsect* this, PlayState* play) {
if (sp40 < 9.0f) {
EnInsect_SetupDig(this);
} else if (this->actionTimer <= 0 || this->lifeTimer <= 0 ||
((this->insectFlags & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && D_80A7DEB8 >= 4 &&
((this->insectFlags & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && sDroppedCount >= 4 &&
(sp3A == 2 || sp3A == 3))) {
EnInsect_SetupDig(this);
} else {
@@ -789,10 +789,10 @@ void EnInsect_Update(Actor* thisx, PlayState* play) {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
}
if (!(this->insectFlags & 8) && D_80A7DEB4 < 4 && EnInsect_InBottleRange(this, play) &&
if (!(this->insectFlags & 8) && sCaughtCount < 4 && EnInsect_InBottleRange(this, play) &&
// GI_MAX in this case allows the player to catch the actor in a bottle
Actor_OfferGetItem(&this->actor, play, GI_MAX, 60.0f, 30.0f)) {
D_80A7DEB4++;
sCaughtCount++;
}
}
@@ -806,11 +806,11 @@ void EnInsect_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
SkelAnime_DrawSkeletonOpa(play, &this->skelAnime, NULL, NULL, NULL);
Collider_UpdateSpheres(0, &this->collider);
D_80A7DEB4 = 0;
sCaughtCount = 0;
}
void EnInsect_Reset(void) {
D_80A7DEB0 = 0.0f;
D_80A7DEB4 = 0;
D_80A7DEB8 = 0;
sCaughtCount = 0;
sDroppedCount = 0;
}
+14 -14
View File
@@ -32,12 +32,12 @@ void EnIshi_SpawnFragmentsLarge(EnIshi* this, PlayState* play);
void EnIshi_SpawnDustSmall(EnIshi* this, PlayState* play);
void EnIshi_SpawnDustLarge(EnIshi* this, PlayState* play);
static s16 sRockRotSpeedX = 0;
static s16 sRockRotSpeedY = 0;
static s16 sRotSpeedX = 0;
static s16 sRotSpeedY = 0;
#define EN_ISHI_SHIP_SAVESTATE_FIELDS(F) \
F(sRockRotSpeedX) \
F(sRockRotSpeedY)
F(sRotSpeedX) \
F(sRotSpeedY)
SHIP_SAVESTATE_DEFINE(EnIshi, EN_ISHI_SHIP_SAVESTATE_FIELDS)
@@ -421,11 +421,11 @@ void EnIshi_SetupFly(EnIshi* this) {
this->actor.velocity.x = Math_SinS(this->actor.world.rot.y) * this->actor.speedXZ;
this->actor.velocity.z = Math_CosS(this->actor.world.rot.y) * this->actor.speedXZ;
if ((this->actor.params & 1) == ROCK_SMALL) {
sRockRotSpeedX = (Rand_ZeroOne() - 0.5f) * 16000.0f;
sRockRotSpeedY = (Rand_ZeroOne() - 0.5f) * 2400.0f;
sRotSpeedX = (Rand_ZeroOne() - 0.5f) * 16000.0f;
sRotSpeedY = (Rand_ZeroOne() - 0.5f) * 2400.0f;
} else {
sRockRotSpeedX = (Rand_ZeroOne() - 0.5f) * 8000.0f;
sRockRotSpeedY = (Rand_ZeroOne() - 0.5f) * 1600.0f;
sRotSpeedX = (Rand_ZeroOne() - 0.5f) * 8000.0f;
sRotSpeedY = (Rand_ZeroOne() - 0.5f) * 1600.0f;
}
this->actor.colChkInfo.mass = 240;
this->actionFunc = EnIshi_Fly;
@@ -471,8 +471,8 @@ void EnIshi_Fly(EnIshi* this, PlayState* play) {
EffectSsGRipple_Spawn(play, &contactPos, 500, 1300, 8);
}
this->actor.minVelocityY = -6.0f;
sRockRotSpeedX >>= 2;
sRockRotSpeedY >>= 2;
sRotSpeedX >>= 2;
sRotSpeedY >>= 2;
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L);
this->actor.bgCheckFlags &= ~0x40;
}
@@ -480,8 +480,8 @@ void EnIshi_Fly(EnIshi* this, PlayState* play) {
EnIshi_Fall(this);
func_80A7ED94(&this->actor.velocity, D_80A7FA28[type]);
Actor_UpdatePos(&this->actor);
this->actor.shape.rot.x += sRockRotSpeedX;
this->actor.shape.rot.y += sRockRotSpeedY;
this->actor.shape.rot.x += sRotSpeedX;
this->actor.shape.rot.y += sRotSpeedY;
Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, 0xC5);
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
@@ -517,6 +517,6 @@ void EnIshi_Draw(Actor* thisx, PlayState* play) {
}
void EnIshi_Reset(void) {
sRockRotSpeedX = 0;
sRockRotSpeedY = 0;
sRotSpeedX = 0;
sRotSpeedY = 0;
}
@@ -966,7 +966,7 @@ void func_80ACC00C(EnOwl* this, PlayState* play) {
this->actionFunc = EnOwl_WaitDefault;
this->unk_40A = 0;
this->actionFlags |= 0x80;
gTimeIncrement = 0;
gTimeSpeed = 0;
}
}
@@ -131,7 +131,7 @@ static DamageTable sDamageTable = {
/* Unknown 2 */ DMG_ENTRY(0, 0x0),
};
static s32 sEnPoFieldNumSpawned = 0;
static s32 sNumSpawned = 0;
static Vec3f sFieldMiddle = { -1000.0f, 0.0f, 6500.0f };
@@ -150,14 +150,14 @@ static EnPoFieldInfo sPoFieldInfo[2] = {
static Vec3f D_80AD714C = { 0.0f, 1400.0f, 0.0f };
static Vec3s sEnPoFieldSpawnPositions[10];
static u8 sEnPoFieldSpawnSwitchFlags[10];
static Vec3s sSpawnPositions[10];
static u8 sSpawnSwitchFlags[10];
static MtxF sLimb7Mtx;
#define EN_PO_FIELD_SHIP_SAVESTATE_FIELDS(F) \
F(sEnPoFieldNumSpawned) \
F(sEnPoFieldSpawnPositions) \
F(sEnPoFieldSpawnSwitchFlags)
F(sNumSpawned) \
F(sSpawnPositions) \
F(sSpawnSwitchFlags)
SHIP_SAVESTATE_DEFINE(EnPoField, EN_PO_FIELD_SHIP_SAVESTATE_FIELDS)
@@ -165,14 +165,14 @@ void EnPoField_Init(Actor* thisx, PlayState* play) {
EnPoField* this = (EnPoField*)thisx;
s32 pad;
if (sEnPoFieldNumSpawned != 10) {
sEnPoFieldSpawnPositions[sEnPoFieldNumSpawned].x = this->actor.world.pos.x;
sEnPoFieldSpawnPositions[sEnPoFieldNumSpawned].y = this->actor.world.pos.y;
sEnPoFieldSpawnPositions[sEnPoFieldNumSpawned].z = this->actor.world.pos.z;
sEnPoFieldSpawnSwitchFlags[sEnPoFieldNumSpawned] = this->actor.params & 0xFF;
sEnPoFieldNumSpawned++;
if (sNumSpawned != 10) {
sSpawnPositions[sNumSpawned].x = this->actor.world.pos.x;
sSpawnPositions[sNumSpawned].y = this->actor.world.pos.y;
sSpawnPositions[sNumSpawned].z = this->actor.world.pos.z;
sSpawnSwitchFlags[sNumSpawned] = this->actor.params & 0xFF;
sNumSpawned++;
}
if (sEnPoFieldNumSpawned >= 2) {
if (sNumSpawned >= 2) {
this->actor.params = 0xFF;
Actor_Kill(&this->actor);
return;
@@ -422,10 +422,10 @@ void EnPoField_WaitForSpawn(EnPoField* this, PlayState* play) {
this->actionTimer--;
}
if (this->actionTimer == 0) {
for (i = 0; i < sEnPoFieldNumSpawned; i++) {
if (fabsf(sEnPoFieldSpawnPositions[i].x - player->actor.world.pos.x) < 150.0f &&
fabsf(sEnPoFieldSpawnPositions[i].z - player->actor.world.pos.z) < 150.0f) {
if (Flags_GetSwitch(play, sEnPoFieldSpawnSwitchFlags[i])) {
for (i = 0; i < sNumSpawned; i++) {
if (fabsf(sSpawnPositions[i].x - player->actor.world.pos.x) < 150.0f &&
fabsf(sSpawnPositions[i].z - player->actor.world.pos.z) < 150.0f) {
if (Flags_GetSwitch(play, sSpawnSwitchFlags[i])) {
if (player->stateFlags1 & PLAYER_STATE1_ON_HORSE) { // Player riding Epona
return;
} else {
@@ -723,7 +723,7 @@ void EnPoField_SoulInteract(EnPoField* this, PlayState* play) {
} else if (GameInteractor_Should(VB_BOTTLE_BIG_POE, true, this)) {
this->actor.textId = 0x508F;
Item_Give(play, ITEM_BIG_POE);
Flags_SetSwitch(play, sEnPoFieldSpawnSwitchFlags[this->spawnFlagIndex]);
Flags_SetSwitch(play, sSpawnSwitchFlags[this->spawnFlagIndex]);
}
} else {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH);
@@ -1014,8 +1014,8 @@ void EnPoField_DrawSoul(Actor* thisx, PlayState* play) {
}
void EnPoField_Reset(void) {
sEnPoFieldNumSpawned = 0;
sNumSpawned = 0;
memset(sEnPoFieldSpawnPositions, 0, sizeof(sEnPoFieldSpawnPositions));
memset(sEnPoFieldSpawnSwitchFlags, 0, sizeof(sEnPoFieldSpawnSwitchFlags));
memset(sSpawnPositions, 0, sizeof(sSpawnPositions));
memset(sSpawnSwitchFlags, 0, sizeof(sSpawnSwitchFlags));
}
@@ -161,7 +161,7 @@ u8 WeatherTag_CheckEnableWeatherEffect(EnWeatherTag* this, PlayState* play, u8 a
ret = true;
}
} else {
if (gTimeIncrement != 0) {
if (gTimeSpeed != 0) {
gSaveContext.dayTime += 0x14;
}
}
@@ -196,7 +196,7 @@ u8 WeatherTag_CheckRestoreWeather(EnWeatherTag* this, PlayState* play, u8 arg2,
ret = true;
}
} else if (gTimeIncrement != 0) {
} else if (gTimeSpeed != 0) {
gSaveContext.dayTime += 0x14;
}
}
+5 -5
View File
@@ -529,17 +529,17 @@ void EnXc_SetColossusWindSFX(PlayState* play) {
}
}
static s32 sEnXcFlameSpawned = false;
static s32 sFlameSpawned = false;
void EnXc_SpawnFlame(EnXc* this, PlayState* play) {
if (!sEnXcFlameSpawned) {
if (!sFlameSpawned) {
CsCmdActorCue* npcAction = EnXc_GetCsCmd(play, 0);
f32 xPos = npcAction->startPos.x;
f32 yPos = npcAction->startPos.y;
f32 zPos = npcAction->startPos.z;
this->flameActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_LIGHT, xPos, yPos, zPos, 0, 0, 0, 5);
sEnXcFlameSpawned = true;
sFlameSpawned = true;
}
}
@@ -1447,7 +1447,7 @@ static s32 D_80B41DAC = 1;
#define EN_XC_SHIP_SAVESTATE_FIELDS(F) \
F(D_80B41D90) \
F(sEnXcFlameSpawned) \
F(sFlameSpawned) \
F(D_80B41DA8) \
F(D_80B41DAC)
@@ -2489,7 +2489,7 @@ const ActorInit En_Xc_InitVars = {
void EnXc_Reset(void) {
D_80B41D90 = 0;
sEnXcFlameSpawned = false;
sFlameSpawned = false;
D_80B41DA8 = 1;
D_80B41DAC = 1;
}
@@ -897,7 +897,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) {
sOwnerTheftTimer = 20;
play->specialEffects = sFishingEffects;
gTimeIncrement = 1;
gTimeSpeed = 1;
sFishingPlayingState = 0;
sFishingMusicDelay = 10;
@@ -61,11 +61,11 @@ const ActorInit Object_Kankyo_InitVars = {
(ActorResetFunc)ObjectKankyo_Reset,
};
static u8 sKankyoIsSpawned = false;
static u8 sIsSpawned = false;
static s16 sTrailingFairies = 0;
#define OBJECT_KANKYO_SHIP_SAVESTATE_FIELDS(F) \
F(sKankyoIsSpawned) \
F(sIsSpawned) \
F(sTrailingFairies)
SHIP_SAVESTATE_DEFINE(ObjectKankyo, OBJECT_KANKYO_SHIP_SAVESTATE_FIELDS)
@@ -86,18 +86,18 @@ void ObjectKankyo_Init(Actor* thisx, PlayState* play) {
this->actor.room = -1;
switch (this->actor.params) {
case 0:
if (!sKankyoIsSpawned) {
if (!sIsSpawned) {
ObjectKankyo_SetupAction(this, ObjectKankyo_Fairies);
sKankyoIsSpawned = true;
sIsSpawned = true;
} else {
Actor_Kill(&this->actor);
}
break;
case 3:
if (!sKankyoIsSpawned) {
if (!sIsSpawned) {
ObjectKankyo_SetupAction(this, ObjectKankyo_Snow);
sKankyoIsSpawned = true;
sIsSpawned = true;
} else {
Actor_Kill(&this->actor);
}
@@ -954,6 +954,6 @@ void ObjectKankyo_DrawBeams(ObjectKankyo* this2, PlayState* play2) {
}
void ObjectKankyo_Reset(void) {
sKankyoIsSpawned = false;
sIsSpawned = false;
sTrailingFairies = 0;
}
@@ -81,7 +81,7 @@ void OceffSpot_End(OceffSpot* this, PlayState* play) {
this->unk_174 -= 0.05f;
} else {
Actor_Kill(&this->actor);
if (gTimeIncrement != 400 && play->msgCtx.unk_E40E == 0 && (gSaveContext.eventInf[0] & 0xF) != 1) {
if (gTimeSpeed != 400 && play->msgCtx.unk_E40E == 0 && (gSaveContext.eventInf[0] & 0xF) != 1) {
if (play->msgCtx.ocarinaAction != OCARINA_ACTION_CHECK_NOWARP_DONE ||
play->msgCtx.ocarinaMode != OCARINA_MODE_08) {
gSaveContext.sunsSongState = SUNSSONG_START;
@@ -3069,7 +3069,7 @@ void FileChoose_InitContext(GameState* thisx) {
Skybox_Init(&this->state, &this->skyboxCtx, SKYBOX_NORMAL_SKY);
gTimeIncrement = 10;
gTimeSpeed = 10;
envCtx->unk_19 = 0;
envCtx->unk_1A = 0;