diff --git a/assets/xml/objects/object_crace_object.xml b/assets/xml/objects/object_crace_object.xml index 06c007989..af0cb89e0 100644 --- a/assets/xml/objects/object_crace_object.xml +++ b/assets/xml/objects/object_crace_object.xml @@ -1,8 +1,9 @@  + - - - - + + + + diff --git a/assets/xml/objects/object_dnj.xml b/assets/xml/objects/object_dnj.xml index 95b563913..3b4f27579 100644 --- a/assets/xml/objects/object_dnj.xml +++ b/assets/xml/objects/object_dnj.xml @@ -1,86 +1,96 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_mu.xml b/assets/xml/objects/object_mu.xml index 1f246b07b..37886e8f5 100644 --- a/assets/xml/objects/object_mu.xml +++ b/assets/xml/objects/object_mu.xml @@ -1,62 +1,63 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ru2.xml b/assets/xml/objects/object_ru2.xml index 08f182bb9..72510149c 100644 --- a/assets/xml/objects/object_ru2.xml +++ b/assets/xml/objects/object_ru2.xml @@ -1,78 +1,98 @@  + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/overlays/ovl_Oceff_Wipe.xml b/assets/xml/overlays/ovl_Oceff_Wipe.xml new file mode 100644 index 000000000..17a056175 --- /dev/null +++ b/assets/xml/overlays/ovl_Oceff_Wipe.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/assets/xml/overlays/ovl_Oceff_Wipe5.xml b/assets/xml/overlays/ovl_Oceff_Wipe5.xml new file mode 100644 index 000000000..52f197428 --- /dev/null +++ b/assets/xml/overlays/ovl_Oceff_Wipe5.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/include/PR/gbi.h b/include/PR/gbi.h index 2c29420ea..ff4776560 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -2599,8 +2599,8 @@ _DW({ \ gsSPLoadUcodeEx((uc_start), (uc_dstart), SP_UCODE_DATA_SIZE) #define gSPLoadUcodeL(pkt, ucode) \ - gSPLoadUcode((pkt), OS_K0_TO_PHYSICAL(&##ucode##TextStart), \ - OS_K0_TO_PHYSICAL(&##ucode##DataStart)) + gSPLoadUcode((pkt), OS_K0_TO_PHYSICAL(& ucode##TextStart), \ + OS_K0_TO_PHYSICAL(& ucode##DataStart)) #define gsSPLoadUcodeL(ucode) \ gsSPLoadUcode(OS_K0_TO_PHYSICAL(&##ucode##TextStart), \ OS_K0_TO_PHYSICAL(&##ucode##DataStart)) diff --git a/include/functions.h b/include/functions.h index 755e9a367..bee8e6a5c 100644 --- a/include/functions.h +++ b/include/functions.h @@ -745,8 +745,8 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 s32 Actor_IsTargeted(PlayState* play, Actor* actor); s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor); void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play); -void func_800BC770(PlayState* play, s16 y, s16 countdown); -void func_800BC7D8(PlayState* play, s16 y, s16 countdown, s16 speed); +void Actor_AddQuake(PlayState* play, s16 verticalMag, s16 countdown); +void Actor_AddQuakeWithSpeed(PlayState* play, s16 verticalMag, s16 countdown, s16 speed); void func_800BC848(Actor* actor, PlayState* play, s16 y, s16 countdown); void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type); void Actor_SetColorFilter(Actor* actor, u16 colorFlag, u16 colorIntensityMax, u16 xluFlag, u16 duration); @@ -923,7 +923,7 @@ u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); -s32 SurfaceType_GetConveyorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); +s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); s32 func_800C9DDC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId); @@ -1356,7 +1356,7 @@ void Cutscene_ActorTranslate(Actor* actor, PlayState* play, s32 actorActionIndex void Cutscene_ActorTranslateAndYaw(Actor* actor, PlayState* play, s32 actorActionIndex); void Cutscene_ActorTranslateAndYawSmooth(Actor* actor, PlayState* play, s32 actorActionIndex); void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, PlayState* play, s32 actorActionIndex); -s32 Cutscene_GetSceneSetupIndex(PlayState* play); +s32 Cutscene_GetSceneLayer(PlayState* play); s32 Cutscene_GetActorActionIndex(PlayState* play, u16 actorActionCmd); s32 Cutscene_CheckActorAction(PlayState* play, u16 actorActionCmd); u8 Cutscene_IsPlaying(PlayState* play); @@ -1935,37 +1935,6 @@ s32 func_80128640(PlayState* play, Player* player, Gfx* dlist); void func_80128B74(PlayState* play, Player* player, s32 limbIndex); void func_80128BD0(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot, Actor* actor); -f32 Quake_Random(void); -void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 verticalPertubation, f32 horizontalPertubation); -s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake); -s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake); -s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake); -s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake); -s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake); -s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake); -s16 Quake_GetFreeIndex(void); -QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx); -void Quake_Remove(QuakeRequest* req); -QuakeRequest* Quake_GetRequest(s16 idx); -u32 Quake_SetValue(s16 idx, s16 valueType, s16 value); -u32 Quake_SetSpeed(s16 idx, s16 value); -u32 Quake_SetCountdown(s16 idx, s16 value); -s16 Quake_GetCountdown(s16 idx); -u32 Quake_SetQuakeValues(s16 idx, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset); -u32 Quake_SetQuakeValues2(s16 idx, s16 isShakePerpendicular, Vec3s shakePlaneOffset); -void Quake_Init(void); -s16 Quake_Add(Camera* camera, u32 callbackIdx); -u32 Quake_RemoveFromIdx(s16 idx); -s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData); -void Distortion_Init(PlayState* play); -void Distortion_SetCountdown(s16 countdown); -s16 Distortion_GetCountdown(void); -s16 Distortion_GetType(void); -void Distortion_SetType(s32 type); -void Distortion_ClearType(s32 type); -s32 Distortion_GetUnderwaterCurrentSpeed(Player* player); -void Distortion_Update(void); -s32 Quake_NumActiveQuakes(void); Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f); Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f); Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f); @@ -2064,7 +2033,7 @@ s32 Inventory_GetBtnBItem(PlayState* play); void Inventory_ChangeEquipment(s16 value); u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment); void Inventory_ChangeUpgrade(s16 upgrade, u32 value); -s32 Inventory_IsMapVisible(s16 sceneNum); +s32 Inventory_IsMapVisible(s16 sceneId); void Inventory_SetMapVisibility(s16 tingleIndex); void Inventory_SaveDekuPlaygroundHighScore(s16 timerId); void Inventory_IncrementSkullTokenCount(s16 sceneIndex); @@ -2150,8 +2119,8 @@ void Scene_DrawConfig5(PlayState* play); void Scene_DrawConfigMatAnimManualStep(PlayState* play); void Scene_DrawConfigGreatBayTemple(PlayState* play); EntranceTableEntry* Entrance_GetTableEntry(u16 entrance); -s32 Entrance_GetSceneNum(u16 entrance); -s32 Entrance_GetSceneNumAbsolute(u16 entrance); +s32 Entrance_GetSceneId(u16 entrance); +s32 Entrance_GetSceneIdAbsolute(u16 entrance); s32 Entrance_GetSpawnNum(u16 entrance); s32 Entrance_GetTransitionFlags(u16 entrance); s32 Schedule_RunScript(PlayState* play, u8* script, ScheduleOutput* output); @@ -2534,7 +2503,7 @@ s32 Play_ChangeCameraSetting(PlayState* play, s16 camId, s16 setting); void func_80169AFC(PlayState* play, s16 camId, s16 arg2); u16 Play_GetActorCsCamSetting(PlayState* play, s32 csCamDataIndex); Vec3s* Play_GetActorCsCamFuncData(PlayState* play, s32 csCamDataIndex); -s16 Play_GetOriginalSceneNumber(s16 sceneNum); +s16 Play_GetOriginalSceneId(s16 sceneId); void Play_SaveCycleSceneFlags(GameState* gameState); void Play_SetRespawnData(GameState* gameState, s32 respawnNumber, u16 sceneSetup, s32 roomIndex, s32 playerParams, Vec3f* pos, s16 yaw); void Play_SetupRespawnPoint(GameState* gameState, s32 respawnNumber, s32 playerParams); @@ -2588,7 +2557,7 @@ void PreRender_ApplyFiltersSlowlyInit(PreRender* this); void PreRender_ApplyFiltersSlowlyDestroy(PreRender* this); void func_801720C4(PreRender* this); void func_801720FC(PreRenderParams* params, Gfx** gfxp); -void func_80172758(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags); +void func_80172758(Gfx** gfxp, TexturePtr timg, TexturePtr tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags); void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, size_t size); void THGA_Dt(TwoHeadGfxArena* thga); u32 THGA_IsCrash(TwoHeadGfxArena* thga); @@ -3135,7 +3104,7 @@ OcarinaStaff* AudioOcarina_GetPlaybackStaff(void); void AudioOcarina_TerminaWallGenerateNotes(void); void AudioOcarina_PlayLongScarecrowAfterCredits(void); -void func_8019E014(void); +void Audio_Update(void); // void func_8019E110(void); void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex); void play_sound(u16 sfxId); @@ -3201,31 +3170,27 @@ void func_801A1F88(void); void func_801A1FB4(u8 playerIndex, Vec3f* pos, u16 seqId, f32 maxDist); // void func_801A2090(void); void func_801A246C(u8 param_1, u8 param_2); -// void func_801A2544(void); -// void func_801A257C(void); -void func_801A25E4(u16 seqId, u8 dayMinusOne); -// void func_801A2670(void); -// void func_801A2778(void); +void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne); +void Audio_PlaySceneSequence(u16 seqId, u8 dayMinusOne); // void func_801A27E8(void); // void func_801A281C(void); void func_801A29D4(UNK_TYPE arg0, f32 arg1, UNK_TYPE arg2); void func_801A2BB8(s32 seqId); void func_801A2C20(void); // void func_801A2C44(void); -void func_801A2C88(u16 seqId); -void func_801A2D54(u16 seqId); +void Audio_PlaySequenceInCutscene(u16 seqId); +void Audio_StopSequenceInCutscene(u16 seqId); s32 Audio_IsSequencePlaying(u8 seqId); -void func_801A2E54(s32 bgmId); -void func_801A2ED8(void); -// void func_801A2F88(void); +void Audio_PlayBgm_StorePrevBgm(u16 seqId); +void Audio_RestorePrevBgm(void); // void func_801A3000(void); // void func_801A3038(void); -void func_801A3098(u16 seqId); +void Audio_PlayFanfare(u16 seqId); // void func_801A312C(void); void func_801A31EC(u16 seqId, s8 arg1, u8 arg2); -// void func_801A3238(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5); -// void func_801A32CC(void); -// void func_801A3590(void); +void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeTimer, s8 ioPort, u8 ioData); +void Audio_SetSequenceMode(u8 seqMode); +void Audio_UpdateEnemyBgmVolume(f32 dist); u8 func_801A3950(s32 playerIndex, s32 isChannelIOSet); u8 func_801A39F8(void); void func_801A3A7C(s32 arg0); @@ -3238,11 +3203,11 @@ void func_801A3CD8(s8 param_1); void func_801A3D98(s8 audioSetting); // void func_801A3E38(void); // void func_801A3EC0(void); -void Audio_SetCutsceneFlag(u8 flag); +void Audio_SetCutsceneFlag(s8 flag); // void func_801A3F6C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // void func_801A3FB4(void); // void func_801A3FFC(UNK_TYPE1 param_1); -void audio_setBGM(u32 bgmID); +void Audio_SetSpec(u32 specId); void func_801A4058(UNK_TYPE arg0); // void func_801A41C8(void); // void func_801A41F8(void); @@ -3253,15 +3218,13 @@ void func_801A4058(UNK_TYPE arg0); void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 arg0); void func_801A4428(u8 reverbIndex); void Audio_PreNMI(void); -// void func_801A44C4(void); +// void Audio_ResetRequestedSceneSeqId(void); // void func_801A44D4(void); s32 func_801A46F8(void); void func_801A4748(Vec3f* pos, u16 sfxId); void func_801A479C(Vec3f* arg0, u16 sfxId, s32 arg2); -void func_801A47DC(u8 channelIndexRange, u8 port, u8 val); -// void func_801A48E0(void); -void func_801A4A28(u8 natureSeqId); -// void Audio_SetNatureAmbienceRandomBend(void); +void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData); +void Audio_PlayAmbience(u8 ambienceId); void Audio_Init(void); void func_801A4D00(void); // void func_801A4D50(void); @@ -3274,7 +3237,7 @@ void func_801A4D00(void); // void func_801A4FD8(void); void func_801A5080(u16 arg0); u16 func_801A5100(void); -// void func_801A5118(void); +void func_801A5118(void); UNK_TYPE func_801A51F0(UNK_TYPE arg0); // void func_801A5228(void); // void func_801A5390(void); @@ -3305,17 +3268,17 @@ u8 AudioSfx_IsPlaying(u32 sfxId); void AudioSfx_Reset(void); void Audio_StartSequence(u8 playerIndex, u8 seqId, u8 seqArgs, u16 fadeTimer); -// void func_801A7D04(void); +void Audio_StopSequence(u8 playerIndex, u16 fadeTimer); // void func_801A7D84(void); void Audio_QueueSeqCmd(u32 cmd); -// void func_801A89D0(void); -s32 func_801A8A50(s32 param1); -// void func_801A8ABC(void); +void func_801A89D0(void); +u16 Audio_GetActiveSequence(u8 playerIndex); +s32 func_801A8ABC(u32 cmdVal, u32 cmdMask); void Audio_SetVolumeScale(u8 playerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer); -// void func_801A8D5C(void); +void func_801A8D5C(void); // void func_801A8E90(void); -// void func_801A9768(void); -// void func_801A982C(void); +u8 func_801A9768(void); +u8 func_801A982C(void); // void func_801A99B8(void); // void func_801A9A74(void); diff --git a/include/regs.h b/include/regs.h index cf15b236a..592d2089a 100644 --- a/include/regs.h +++ b/include/regs.h @@ -73,6 +73,7 @@ #define R_MAGIC_CONSUME_TIMER_GIANTS_MASK XREG(41) #define R_MOON_CRASH_TIMER_Y XREG(80) #define R_MOON_CRASH_TIMER_X XREG(81) +#define R_STORY_FILL_SCREEN_ALPHA XREG(91) #define R_MINIMAP_DISABLED XREG(95) #define R_B_LABEL_DD WREG(0) #define R_OW_MINIMAP_X WREG(29) diff --git a/include/sequence.h b/include/sequence.h index d46e96aea..857609d4b 100644 --- a/include/sequence.h +++ b/include/sequence.h @@ -4,7 +4,7 @@ #define NA_BGM_STOP 0x100000FF #define NA_BGM_GENERAL_SFX 0x00 // General Sound Effects -#define NA_BGM_NATURE_AMBIENCE 0x01 // Ambient background noises +#define NA_BGM_AMBIENCE 0x01 // Ambient background noises #define NA_BGM_TERMINA_FIELD 0x02 // Termina Field #define NA_BGM_CHASE 0x03 // Forest Chase #define NA_BGM_MAJORAS_THEME 0x04 // Majora's Theme "STALKID" @@ -40,7 +40,7 @@ #define NA_BGM_GET_ITEM 0x22 // Item Catch #define NA_BGM_GATE_OPEN 0x23 // Clock Town Day 2 Duplicate of #16. In MM3D, it shares its filename with the Door of Time song from OoT #define NA_BGM_GET_HEART 0x24 // Complete a Heart Piece -#define NA_BGM_MINI_GAME_2 0x25 // Playing Minigame +#define NA_BGM_TIMED_MINI_GAME 0x25 // Playing a timed Minigame #define NA_BGM_GORON_RACE 0x26 // Goron Race #define NA_BGM_MUSIC_BOX_HOUSE 0x27 // Music Box House "ORGEL_HOUSE" #define NA_BGM_FAIRY_FOUNTAIN 0x28 // Fairy's Fountain In MM3D, it shares its filename with the Door of Time song from OoT "GODESS" @@ -134,11 +134,12 @@ #define NA_BGM_DISABLED 0xFFFF typedef enum { - /* 0 */ SEQ_PLAYER_BGM_MAIN, - /* 1 */ SEQ_PLAYER_FANFARE, - /* 2 */ SEQ_PLAYER_SFX, - /* 3 */ SEQ_PLAYER_BGM_SUB, - /* 4 */ SEQ_PLAYER_NATURE + /* 0 */ SEQ_PLAYER_BGM_MAIN, + /* 1 */ SEQ_PLAYER_FANFARE, + /* 2 */ SEQ_PLAYER_SFX, + /* 3 */ SEQ_PLAYER_BGM_SUB, + /* 4 */ SEQ_PLAYER_AMBIENCE, + /* 0xFF */ SEQ_PLAYER_INVALID = 0xFF } SequencePlayerId; typedef enum { @@ -160,119 +161,120 @@ typedef enum { } ChannelIOPort; typedef enum { - /* 0x0 */ NATURE_CHANNEL_STREAM_0, - /* 0x1 */ NATURE_CHANNEL_CRITTER_0, - /* 0x2 */ NATURE_CHANNEL_CRITTER_1, - /* 0x3 */ NATURE_CHANNEL_CRITTER_2, - /* 0x4 */ NATURE_CHANNEL_CRITTER_3, - /* 0x5 */ NATURE_CHANNEL_CRITTER_4, - /* 0x6 */ NATURE_CHANNEL_CRITTER_5, - /* 0x7 */ NATURE_CHANNEL_CRITTER_6, - /* 0x8 */ NATURE_CHANNEL_CRITTER_7, - /* 0xC */ NATURE_CHANNEL_STREAM_1 = 12, - /* 0xD */ NATURE_CHANNEL_UNK, - /* 0xE */ NATURE_CHANNEL_RAIN, - /* 0xF */ NATURE_CHANNEL_LIGHTNING -} NatureChannelIdx; // playerIdx = 4 + /* 0x0 */ AMBIENCE_CHANNEL_STREAM_0, + /* 0x1 */ AMBIENCE_CHANNEL_CRITTER_0, + /* 0x2 */ AMBIENCE_CHANNEL_CRITTER_1, + /* 0x3 */ AMBIENCE_CHANNEL_CRITTER_2, + /* 0x4 */ AMBIENCE_CHANNEL_CRITTER_3, + /* 0x5 */ AMBIENCE_CHANNEL_CRITTER_4, + /* 0x6 */ AMBIENCE_CHANNEL_CRITTER_5, + /* 0x7 */ AMBIENCE_CHANNEL_CRITTER_6, + /* 0x8 */ AMBIENCE_CHANNEL_CRITTER_7, + /* 0xC */ AMBIENCE_CHANNEL_STREAM_1 = 12, + /* 0xD */ AMBIENCE_CHANNEL_SOUND_MODE, + /* 0xE */ AMBIENCE_CHANNEL_RAIN, + /* 0xF */ AMBIENCE_CHANNEL_LIGHTNING +} AmbienceChannelIndex; // playerIndex = SEQ_PLAYER_AMBIENCE typedef enum { - /* 0x00 */ NATURE_AMBIENCE_0, - /* 0x01 */ NATURE_AMBIENCE_1, - /* 0x02 */ NATURE_AMBIENCE_2, - /* 0x03 */ NATURE_AMBIENCE_3, - /* 0x04 */ NATURE_AMBIENCE_4, - /* 0x05 */ NATURE_AMBIENCE_5, - /* 0x06 */ NATURE_AMBIENCE_6, - /* 0x07 */ NATURE_AMBIENCE_7, - /* 0x08 */ NATURE_AMBIENCE_8, - /* 0x09 */ NATURE_AMBIENCE_9, - /* 0x0A */ NATURE_AMBIENCE_A, - /* 0x0B */ NATURE_AMBIENCE_B, - /* 0x0C */ NATURE_AMBIENCE_C, - /* 0x0D */ NATURE_AMBIENCE_D, - /* 0x0E */ NATURE_AMBIENCE_E, - /* 0x0F */ NATURE_AMBIENCE_F, - /* 0x10 */ NATURE_AMBIENCE_10, - /* 0x11 */ NATURE_AMBIENCE_11, - /* 0x12 */ NATURE_AMBIENCE_12, - /* 0x13 */ NATURE_AMBIENCE_13 -} NatureAmbienceId; // playerIdx = 4 + /* 0x00 */ AMBIENCE_ID_00, + /* 0x01 */ AMBIENCE_ID_01, + /* 0x02 */ AMBIENCE_ID_02, + /* 0x03 */ AMBIENCE_ID_03, + /* 0x04 */ AMBIENCE_ID_04, + /* 0x05 */ AMBIENCE_ID_05, + /* 0x06 */ AMBIENCE_ID_06, + /* 0x07 */ AMBIENCE_ID_07, + /* 0x08 */ AMBIENCE_ID_08, + /* 0x09 */ AMBIENCE_ID_09, + /* 0x0A */ AMBIENCE_ID_0A, + /* 0x0B */ AMBIENCE_ID_0B, + /* 0x0C */ AMBIENCE_ID_0C, + /* 0x0D */ AMBIENCE_ID_0D, + /* 0x0E */ AMBIENCE_ID_0E, + /* 0x0F */ AMBIENCE_ID_0F, + /* 0x10 */ AMBIENCE_ID_10, + /* 0x11 */ AMBIENCE_ID_11, + /* 0x12 */ AMBIENCE_ID_12, + /* 0x13 */ AMBIENCE_ID_13, + /* 0xFF */ AMBIENCE_ID_DISABLED = 0xFF +} AmbienceId; // playerIndex = SEQ_PLAYER_AMBIENCE typedef enum { - /* 0x00 */ NATURE_STREAM_0, - /* 0x01 */ NATURE_STREAM_1, - /* 0x02 */ NATURE_STREAM_2, - /* 0x03 */ NATURE_STREAM_3 -} NatureStreamId; + /* 0x00 */ AMBIENCE_STREAM_0, + /* 0x01 */ AMBIENCE_STREAM_1, + /* 0x02 */ AMBIENCE_STREAM_2, + /* 0x03 */ AMBIENCE_STREAM_3 +} AmbienceStreamId; typedef enum { - /* 0x00 */ NATURE_CRITTER_00, - /* 0x01 */ NATURE_CRITTER_01, - /* 0x02 */ NATURE_CRITTER_02, - /* 0x03 */ NATURE_CRITTER_03, - /* 0x04 */ NATURE_CRITTER_04, - /* 0x05 */ NATURE_CRITTER_05, - /* 0x06 */ NATURE_CRITTER_06, - /* 0x07 */ NATURE_CRITTER_07, - /* 0x08 */ NATURE_CRITTER_08, - /* 0x09 */ NATURE_CRITTER_09, - /* 0x0A */ NATURE_CRITTER_10, - /* 0x0B */ NATURE_CRITTER_11, - /* 0x0C */ NATURE_CRITTER_12, - /* 0x0D */ NATURE_CRITTER_13, - /* 0x0E */ NATURE_CRITTER_14, - /* 0x0F */ NATURE_CRITTER_15, - /* 0x10 */ NATURE_CRITTER_16, - /* 0x11 */ NATURE_CRITTER_17, - /* 0x12 */ NATURE_CRITTER_18, - /* 0x13 */ NATURE_CRITTER_19 -} NatureAmimalId; + /* 0x00 */ AMBIENCE_CRITTER_00, + /* 0x01 */ AMBIENCE_CRITTER_01, + /* 0x02 */ AMBIENCE_CRITTER_02, + /* 0x03 */ AMBIENCE_CRITTER_03, + /* 0x04 */ AMBIENCE_CRITTER_04, + /* 0x05 */ AMBIENCE_CRITTER_05, + /* 0x06 */ AMBIENCE_CRITTER_06, + /* 0x07 */ AMBIENCE_CRITTER_07, + /* 0x08 */ AMBIENCE_CRITTER_08, + /* 0x09 */ AMBIENCE_CRITTER_09, + /* 0x0A */ AMBIENCE_CRITTER_10, + /* 0x0B */ AMBIENCE_CRITTER_11, + /* 0x0C */ AMBIENCE_CRITTER_12, + /* 0x0D */ AMBIENCE_CRITTER_13, + /* 0x0E */ AMBIENCE_CRITTER_14, + /* 0x0F */ AMBIENCE_CRITTER_15, + /* 0x10 */ AMBIENCE_CRITTER_16, + /* 0x11 */ AMBIENCE_CRITTER_17, + /* 0x12 */ AMBIENCE_CRITTER_18, + /* 0x13 */ AMBIENCE_CRITTER_19 +} AmbienceCritterId; -#define NATURE_IO_CRITTER_0_TYPE(type) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_0_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_0_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_0_PORT5(reverb) NATURE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_0_TYPE(type) AMBIENCE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_0_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_0_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_0_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_0, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_1_TYPE(type) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_1_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_1_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_1_PORT5(reverb) NATURE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_1_TYPE(type) AMBIENCE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_1_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_1_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_1_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_1, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_2_TYPE(type) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_2_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_2_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_2_PORT5(reverb) NATURE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_2_TYPE(type) AMBIENCE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_2_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_2_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_2_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_2, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_3_TYPE(type) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_3_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_3_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_3_PORT5(reverb) NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_3_TYPE(type) AMBIENCE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_3_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_3_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_3_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_4_TYPE(type) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_4_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_4_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_4_PORT5(reverb) NATURE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_4_TYPE(type) AMBIENCE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_4_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_4_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_4_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_4, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_5_TYPE(type) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_5_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_5_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_5_PORT5(reverb) NATURE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_5_TYPE(type) AMBIENCE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_5_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_5_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_5_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_5, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_CRITTER_6_TYPE(type) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_2, type -#define NATURE_IO_CRITTER_6_BEND_PITCH(bend) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_3, bend -#define NATURE_IO_CRITTER_6_NUM_LAYERS(num) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_4, num -#define NATURE_IO_CRITTER_6_PORT5(reverb) NATURE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_5, reverb +#define AMBIENCE_IO_CRITTER_6_TYPE(type) AMBIENCE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_CRITTER_6_BEND_PITCH(bend) AMBIENCE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_3, bend +#define AMBIENCE_IO_CRITTER_6_NUM_LAYERS(num) AMBIENCE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_4, num +#define AMBIENCE_IO_CRITTER_6_PORT5(reverb) AMBIENCE_CHANNEL_CRITTER_6, CHANNEL_IO_PORT_5, reverb -#define NATURE_IO_STREAM_0_TYPE(type) NATURE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_2, type -#define NATURE_IO_STREAM_0_PORT3(data) NATURE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_3, data -#define NATURE_IO_STREAM_0_PORT4(data) NATURE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_4, data +#define AMBIENCE_IO_STREAM_0_TYPE(type) AMBIENCE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_STREAM_0_PORT3(data) AMBIENCE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_3, data +#define AMBIENCE_IO_STREAM_0_PORT4(data) AMBIENCE_CHANNEL_STREAM_0, CHANNEL_IO_PORT_4, data -#define NATURE_IO_STREAM_1_TYPE(type) NATURE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_2, type -#define NATURE_IO_STREAM_1_PORT3(data) NATURE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_3, data -#define NATURE_IO_STREAM_1_PORT4(data) NATURE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_4, data +#define AMBIENCE_IO_STREAM_1_TYPE(type) AMBIENCE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_2, type +#define AMBIENCE_IO_STREAM_1_PORT3(data) AMBIENCE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_3, data +#define AMBIENCE_IO_STREAM_1_PORT4(data) AMBIENCE_CHANNEL_STREAM_1, CHANNEL_IO_PORT_4, data -#define NATURE_IO_RAIN_PORT4(data) NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_4, data +#define AMBIENCE_IO_RAIN_PORT4(data) AMBIENCE_CHANNEL_RAIN, CHANNEL_IO_PORT_4, data -#define NATURE_IO_ENTRIES_END 0xFF +#define AMBIENCE_IO_ENTRIES_END 0xFF #endif diff --git a/include/variables.h b/include/variables.h index 4fbdccd9b..e31025743 100644 --- a/include/variables.h +++ b/include/variables.h @@ -1146,15 +1146,15 @@ extern UNK_PTR D_801BF5C0; // extern UNK_TYPE2 sTimerBeepSfxSeconds; // extern UNK_TYPE2 sTimerDigitsOffsetX; // extern UNK_TYPE2 sTimerDigitsWidth; -// extern UNK_TYPE1 D_801BFD1C; -// extern UNK_TYPE1 D_801BFD24; -// extern UNK_TYPE1 D_801BFD2C; -// extern UNK_TYPE1 D_801BFD40; +// extern UNK_TYPE1 sRupeeDigitsFirst; +// extern UNK_TYPE1 sRupeeDigitsCount; +// extern UNK_TYPE1 sRupeeCounterIconPrimColors; +// extern UNK_TYPE1 sRupeeCounterIconEnvColors; // extern UNK_TYPE1 sMinigameCountdownTextures; // extern UNK_TYPE1 sMinigameCountdownTexWidths; // extern UNK_TYPE2 sMinigameCountdownPrimColors; -// extern UNK_TYPE1 D_801BFD84; -// extern UNK_TYPE1 D_801BFD8C; +// extern UNK_TYPE1 gStoryTextures; +// extern UNK_TYPE1 gStoryTLUTs; // extern UNK_TYPE1 D_801BFD94; // extern UNK_TYPE2 D_801BFD98; @@ -1312,7 +1312,7 @@ extern u32 gGsFlagsShift[]; extern void* gItemIcons[]; extern u8 gItemSlots[]; extern s16 gItemPrices[]; -extern u16 gScenesPerRegion[11][27]; +extern u16 gSceneIdsPerRegion[11][27]; extern u8 D_801C2410[5][114]; extern s16 gPlayerFormObjectIndices[8]; extern RomFile gObjectTable[643]; @@ -3416,7 +3416,7 @@ extern s32 D_801FD120; // extern UNK_TYPE1 D_801FD434; // extern UNK_TYPE1 D_801FD435; // extern UNK_TYPE1 D_801FD436; -// extern UNK_TYPE1 D_801FD438; +// extern UNK_TYPE1 sPrevAmbienceSeqId; // extern UNK_TYPE1 D_801FD43A; // extern UNK_TYPE1 D_801FD43B; // extern UNK_TYPE1 D_801FD43E; @@ -3477,7 +3477,7 @@ extern ActiveSfx gActiveSfx[7][3]; // extern UNK_TYPE1 D_8020001E; // extern UNK_TYPE1 D_802000C9; // extern UNK_TYPE1 D_802000D4; -// extern UNK_TYPE1 D_80200140; +extern ActiveSequence gActiveSeqs[]; // extern UNK_TYPE1 D_8020034A; // extern UNK_TYPE1 D_80200B88; // extern UNK_TYPE1 D_80200BBA; diff --git a/include/z64.h b/include/z64.h index 9e619ba60..53f70c497 100644 --- a/include/z64.h +++ b/include/z64.h @@ -440,13 +440,12 @@ typedef struct { /* 0x220 */ f32 unk_220; /* 0x224 */ u16 alpha; /* 0x226 */ s16 offsetY; - /* 0x228 */ s32 unk_228; - /* 0x22C */ s32 unk_22C; - /* 0x230 */ s32 stickRelX; - /* 0x234 */ s32 stickRelY; + /* 0x228 */ UNK_TYPE1 unk_228[0x8]; + /* 0x230 */ s32 stickAdjX; + /* 0x234 */ s32 stickAdjY; /* 0x238 */ s16 cursorPoint[5]; - /* 0x242 */ s16 cursorX[5]; - /* 0x24C */ s16 cursorY[5]; + /* 0x242 */ s16 cursorXIndex[5]; + /* 0x24C */ s16 cursorYIndex[5]; /* 0x256 */ s16 unk_256; /* 0x258 */ s16 cursorSpecialPos; /* 0x25A */ s16 pageSwitchTimer; @@ -532,17 +531,17 @@ typedef enum { typedef enum { /* 0 */ MINIGAME_STATE_NONE, - /* 1 */ MINIGAME_STATE_COUNTDOWN_START_3, + /* 1 */ MINIGAME_STATE_COUNTDOWN_SETUP_3, /* 2 */ MINIGAME_STATE_COUNTDOWN_3, - /* 3 */ MINIGAME_STATE_COUNTDOWN_START_2, + /* 3 */ MINIGAME_STATE_COUNTDOWN_SETUP_2, /* 4 */ MINIGAME_STATE_COUNTDOWN_2, - /* 5 */ MINIGAME_STATE_COUNTDOWN_START_1, + /* 5 */ MINIGAME_STATE_COUNTDOWN_SETUP_1, /* 6 */ MINIGAME_STATE_COUNTDOWN_1, - /* 7 */ MINIGAME_STATE_COUNTDOWN_START_GO, + /* 7 */ MINIGAME_STATE_COUNTDOWN_SETUP_GO, /* 8 */ MINIGAME_STATE_COUNTDOWN_GO, - /* 20 */ MINIGAME_STATE_20 = 20, - /* 21 */ MINIGAME_STATE_21, - /* 30 */ MINIGAME_STATE_30 = 30 + /* 20 */ MINIGAME_STATE_NO_COUNTDOWN_SETUP = 20, + /* 21 */ MINIGAME_STATE_NO_COUNTDOWN, + /* 30 */ MINIGAME_STATE_PLAYING = 30 } MinigameState; typedef enum { @@ -562,6 +561,27 @@ typedef enum { /* 6 */ MINIGAME_PERFECT_STATE_6 } MinigamePerfectState; +typedef enum { + /* 0 */ STORY_LOAD_STATUS_REQUESTED, + /* 1 */ STORY_LOAD_STATUS_WAITING, + /* 2 */ STORY_LOAD_STATUS_FINISHED +} StoryLoadStatus; + +typedef enum { + /* 0 */ STORY_STATE_OFF, + /* 1 */ STORY_STATE_INIT, + /* 2 */ STORY_STATE_IDLE, + /* 3 */ STORY_STATE_DESTROY, + /* 4 */ STORY_STATE_SETUP_IDLE, + /* 5 */ STORY_STATE_FADE_OUT, + /* 6 */ STORY_STATE_FADE_IN +} StoryState; + +typedef enum { + /* 0 */ STORY_TYPE_MASK_FESTIVAL, + /* 1 */ STORY_TYPE_GIANTS_LEAVING +} StoryType; + typedef struct { /* 0x000 */ View view; /* 0x168 */ Vtx* aButtonVtx; @@ -652,14 +672,14 @@ typedef struct { /* 0x318 */ u8 pictographBox; /* 0x319 */ u8 all; // "another"; enables all item restrictions } restrictions; // size = 0xC - /* 0x31A */ u8 unk_31A; + /* 0x31A */ u8 storyState; /* 0x31B */ u8 storyType; - /* 0x31C */ u8 storyState; + /* 0x31C */ u8 storyLoadStatus; /* 0x320 */ OSMesgQueue storyMsgQueue; /* 0x338 */ OSMesg storyMsgBuf; - /* 0x33C */ void* storySegment; - /* 0x340 */ u32 storyAddr; - /* 0x344 */ u32 storySize; + /* 0x33C */ u8* storySegment; + /* 0x340 */ uintptr_t storyAddr; + /* 0x344 */ size_t storySize; } InterfaceContext; // size = 0x348 typedef struct { @@ -802,8 +822,8 @@ typedef struct { } PreRender; // size = 0x50 typedef struct { - /* 0x00 */ void* timg; - /* 0x04 */ void* tlut; + /* 0x00 */ TexturePtr timg; + /* 0x04 */ TexturePtr tlut; /* 0x08 */ u16 width; /* 0x0A */ u16 height; /* 0x0C */ u8 fmt; @@ -975,63 +995,6 @@ typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec typedef void(*room_draw_func)(PlayState* play, Room* room, u32 flags); -typedef struct { - /* 0x00 */ Vec3f atOffset; - /* 0x0C */ Vec3f eyeOffset; - /* 0x18 */ s16 rollOffset; - /* 0x1A */ s16 zoom; -} ShakeInfo; // size = 0x1C - -typedef struct { - /* 0x00 */ s16 randIdx; - /* 0x02 */ s16 countdownMax; - /* 0x04 */ Camera* camera; - /* 0x08 */ u32 callbackIdx; - /* 0x0C */ s16 verticalMag; - /* 0x0E */ s16 horizontalMag; - /* 0x10 */ s16 zoom; - /* 0x12 */ s16 rollOffset; - /* 0x14 */ Vec3s shakePlaneOffset; // angle deviations from shaking in the perpendicular plane - /* 0x1A */ s16 speed; - /* 0x1C */ s16 isShakePerpendicular; - /* 0x1E */ s16 countdown; - /* 0x20 */ s16 camId; -} QuakeRequest; // size = 0x24 - -typedef struct { - /* 0x00 */ Vec3f atOffset; - /* 0x0C */ Vec3f eyeOffset; - /* 0x18 */ s16 rollOffset; - /* 0x1A */ s16 zoom; - /* 0x1C */ f32 max; // Set to scaled max data of struct (mag for Vec3f), never used -} QuakeCamCalc; // size = 0x20 - -typedef s16 (*QuakeCallbackFunc)(QuakeRequest*, ShakeInfo*); - -#define QUAKE_SPEED (1 << 0) -#define QUAKE_VERTICAL_MAG (1 << 1) -#define QUAKE_HORIZONTAL_MAG (1 << 2) -#define QUAKE_ZOOM (1 << 3) -#define QUAKE_ROLL_OFFSET (1 << 4) -#define QUAKE_SHAKE_PLANE_OFFSET_X (1 << 5) -#define QUAKE_SHAKE_PLANE_OFFSET_Y (1 << 6) -#define QUAKE_SHAKE_PLANE_OFFSET_Z (1 << 7) -#define QUAKE_COUNTDOWN (1 << 8) -#define QUAKE_IS_SHAKE_PERPENDICULAR (1 << 9) - -typedef struct { - /* 0x0 */ PlayState* play; - /* 0x4 */ s32 type; // bitfield, highest set bit determines type - /* 0x8 */ s16 countdown; - /* 0xA */ s16 state; -} DistortionContext; // size = 0xC - -typedef enum { - /* 0 */ DISTORTION_INACTIVE, - /* 1 */ DISTORTION_ACTIVE, - /* 2 */ DISTORTION_SETUP -} DistortionState; - typedef struct { /* 0x000 */ u8 controllers; // bit 0 is set if controller 1 is plugged in, etc. /* 0x001 */ UNK_TYPE1 pad1[0x13]; @@ -1134,10 +1097,9 @@ struct FireObj { }; // size = 0x8B typedef struct { - /* 0x0 */ u8 seqIndex; - /* 0x1 */ u8 nightSeqIndex; - /* 0x2 */ u8 unk_02; -} SoundContext; // size = 0x3 + /* 0x0 */ u8 seqId; + /* 0x1 */ u8 ambienceId; +} SequenceContext; // size = 0x2 typedef struct { /* 0x0 */ s32 enabled; @@ -1162,7 +1124,7 @@ typedef struct { struct PlayState { /* 0x00000 */ GameState state; - /* 0x000A4 */ s16 sceneNum; + /* 0x000A4 */ s16 sceneId; /* 0x000A6 */ u8 sceneConfig; /* 0x000A7 */ char unk_A7[0x9]; /* 0x000B0 */ void* sceneSegment; @@ -1173,7 +1135,7 @@ struct PlayState { /* 0x00800 */ Camera* cameraPtrs[NUM_CAMS]; /* 0x00810 */ s16 activeCamId; /* 0x00812 */ s16 nextCamera; - /* 0x00814 */ SoundContext soundCtx; + /* 0x00814 */ SequenceContext sequenceCtx; /* 0x00818 */ LightContext lightCtx; /* 0x00828 */ FrameAdvanceContext frameAdvCtx; /* 0x00830 */ CollisionContext colCtx; diff --git a/include/z64audio.h b/include/z64audio.h index fc9bf9f4c..c5045e34f 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -9,6 +9,7 @@ #define IS_SEQUENCE_CHANNEL_VALID(ptr) ((uintptr_t)(ptr) != (uintptr_t)&gAudioContext.sequenceChannelNone) #define SEQ_NUM_CHANNELS 16 +#define SEQ_IO_VAL_NONE -1 typedef enum { /* 0 */ SEQPLAYER_STATE_0, @@ -51,9 +52,9 @@ typedef enum { typedef enum { /* 0 */ SOUNDMODE_STEREO, /* 1 */ SOUNDMODE_HEADSET, - /* 2 */ SOUNDMODE_SURROUND, + /* 2 */ SOUNDMODE_SURROUND_EXTERNAL, /* 3 */ SOUNDMODE_MONO, - /* 4 */ SOUNDMODE_SURROUND_EXTERNAL, + /* 4 */ SOUNDMODE_SURROUND, } SoundMode; typedef enum { @@ -1068,7 +1069,7 @@ typedef struct { /* 0x204 */ u16 unk_28; /* 0x206 */ u16 unk_250; /* 0x208 */ u16 unk_252; - /* 0x20A */ u16 unk_254; + /* 0x20A */ u16 seqId; /* 0x20C */ u16 unk_256; /* 0x20E */ u16 unk_258; /* 0x210 */ u8 unk_260; @@ -1080,7 +1081,7 @@ typedef struct { /* 0x219 */ u8 unk_4D; /* 0x21A */ u8 unk_4E; /* 0x21B */ u8 unk_21B; -} unk_D_8016E750; // size = 0x21C +} ActiveSequence; // size = 0x21C typedef struct { /* 0x0 */ u8 unk_0; @@ -1095,7 +1096,7 @@ typedef enum { /* 4 */ BANK_SYSTEM, /* 5 */ BANK_OCARINA, /* 6 */ BANK_VOICE -} SoundBankTypes; +} SfxBankType; typedef enum { /* 0 */ SFX_STATE_EMPTY, diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index b42938354..c2a9bab7c 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -56,11 +56,6 @@ struct DynaPolyActor; // CollisionContext flags #define BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW 1 -typedef enum { - /* 0 */ CONVEYOR_WATER, - /* 1 */ CONVEYOR_FLOOR -} ConveyorType; - typedef struct { /* 0x0 */ Vec3s pos; } BgVertex; // size = 0x6 diff --git a/include/z64quake.h b/include/z64quake.h new file mode 100644 index 000000000..468f56793 --- /dev/null +++ b/include/z64quake.h @@ -0,0 +1,69 @@ +#ifndef Z64QUAKE_H +#define Z64QUAKE_H + +#include "z64math.h" + +struct PlayState; +struct Camera; + +typedef struct { + /* 0x00 */ Vec3f atOffset; + /* 0x0C */ Vec3f eyeOffset; + /* 0x18 */ s16 rollOffset; + /* 0x1A */ s16 zoom; + /* 0x1C */ f32 max; // Set to scaled max data of struct (mag for Vec3f), never used +} QuakeCamCalc; // size = 0x20 + +#define QUAKE_SPEED (1 << 0) +#define QUAKE_VERTICAL_MAG (1 << 1) +#define QUAKE_HORIZONTAL_MAG (1 << 2) +#define QUAKE_ZOOM (1 << 3) +#define QUAKE_ROLL_OFFSET (1 << 4) +#define QUAKE_SHAKE_PLANE_OFFSET_X (1 << 5) +#define QUAKE_SHAKE_PLANE_OFFSET_Y (1 << 6) +#define QUAKE_SHAKE_PLANE_OFFSET_Z (1 << 7) +#define QUAKE_COUNTDOWN (1 << 8) +#define QUAKE_IS_SHAKE_PERPENDICULAR (1 << 9) + +typedef enum { + /* 1 */ QUAKE_TYPE_1 = 1, + /* 2 */ QUAKE_TYPE_2, + /* 3 */ QUAKE_TYPE_3, + /* 4 */ QUAKE_TYPE_4, + /* 5 */ QUAKE_TYPE_5, + /* 6 */ QUAKE_TYPE_6 +} QuakeType; + +u32 Quake_SetValue(s16 quakeIndex, s16 valueType, s16 value); +u32 Quake_SetSpeed(s16 quakeIndex, s16 speed); +u32 Quake_SetCountdown(s16 quakeIndex, s16 countdown); +s16 Quake_GetCountdown(s16 quakeIndex); +u32 Quake_SetQuakeValues(s16 quakeIndex, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset); +u32 Quake_SetQuakeValues2(s16 quakeIndex, s16 isShakePerpendicular, Vec3s shakePlaneOffset); +s16 Quake_Add(Camera* camera, u32 type); +s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData); +u32 Quake_Remove(s16 quakeIndex); +s32 Quake_NumActiveQuakes(void); +void Quake_Init(void); + +#define DISTORTION_TYPE_0 (1 << 0) +#define DISTORTION_TYPE_2 (1 << 2) +#define DISTORTION_TYPE_3 (1 << 3) +#define DISTORTION_TYPE_4 (1 << 4) +#define DISTORTION_TYPE_5 (1 << 5) +#define DISTORTION_TYPE_6 (1 << 6) +#define DISTORTION_TYPE_7 (1 << 7) +#define DISTORTION_TYPE_8 (1 << 8) +#define DISTORTION_TYPE_9 (1 << 9) +#define DISTORTION_TYPE_A (1 << 10) +#define DISTORTION_TYPE_B (1 << 11) + +void Distortion_SetCountdown(s16 countdown); +s16 Distortion_GetCountdown(void); +s16 Distortion_GetType(void); +void Distortion_SetType(s32 type); +void Distortion_ClearType(s32 type); +void Distortion_Init(PlayState* play); +void Distortion_Update(void); + +#endif diff --git a/include/z64save.h b/include/z64save.h index 2cbd88c39..c73a5cb94 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -172,7 +172,7 @@ typedef struct Inventory { } Inventory; // size = 0x88 typedef struct HorseData { - /* 0x0 */ s16 scene; // "spot_no" + /* 0x0 */ s16 sceneId; // "spot_no" /* 0x2 */ Vec3s pos; // "horse_x", "horse_y" and "horse_z" /* 0x8 */ s16 yaw; // "horse_a" } HorseData; // size = 0xA @@ -233,7 +233,7 @@ typedef struct SavePlayerData { /* 0x20 */ u8 unk_20; // "first_memory" /* 0x22 */ u16 owlActivationFlags; // "memory_warp_point" /* 0x24 */ u8 unk_24; // "last_warp_pt" - /* 0x26 */ s16 savedSceneNum; // "scene_data_ID" + /* 0x26 */ s16 savedSceneId; // "scene_data_ID" } SavePlayerData; // size = 0x28 typedef struct Save { @@ -311,7 +311,7 @@ typedef struct SaveContext { /* 0x3CA6 */ u8 unk_3CA6; /* 0x3CA7 */ u8 unk_3CA7; // "day_night_flag" /* 0x3CA8 */ s32 gameMode; // "mode" - /* 0x3CAC */ s32 sceneSetupIndex; // "counter" + /* 0x3CAC */ s32 sceneLayer; // "counter" /* 0x3CB0 */ s32 respawnFlag; // "restart_flag" /* 0x3CB4 */ RespawnData respawn[RESPAWN_MODE_MAX]; // "restart_data" /* 0x3DB4 */ f32 entranceSpeed; // "player_wipe_speedF" @@ -334,8 +334,8 @@ typedef struct SaveContext { /* 0x3EF8 */ s16 timerX[TIMER_ID_MAX]; // "event_xp" /* 0x3F06 */ s16 timerY[TIMER_ID_MAX]; // "event_yp" /* 0x3F14 */ s16 unk_3F14; // "character_change" - /* 0x3F16 */ u8 seqIndex; // "old_bgm" - /* 0x3F17 */ u8 nightSeqIndex; // "old_env" + /* 0x3F16 */ u8 seqId; // "old_bgm" + /* 0x3F17 */ u8 ambienceId; // "old_env" /* 0x3F18 */ u8 buttonStatus[6]; // "button_item" /* 0x3F1E */ u8 hudVisibilityForceButtonAlphasByStatus; // if btn alphas are updated through Interface_UpdateButtonAlphas, instead update them through Interface_UpdateButtonAlphasByStatus "ck_fg" /* 0x3F20 */ u16 nextHudVisibility; // triggers the hud to change visibility to the requested value. Reset to HUD_VISIBILITY_IDLE when target is reached "alpha_type" @@ -352,7 +352,7 @@ typedef struct SaveContext { /* 0x3F36 */ u16 mapIndex; // "scene_ID" /* 0x3F38 */ u16 minigameStatus; // "yabusame_mode" /* 0x3F3A */ u16 minigameScore; // "yabusame_total" - /* 0x3F3C */ u16 minigameHiddenScore; // "yabusame_out_ct" + /* 0x3F3C */ u16 minigameHiddenScore; // "yabusame_out_ct" /* 0x3F3E */ u8 unk_3F3E; // "no_save" /* 0x3F3F */ u8 unk_3F3F; // "flash_flag" /* 0x3F40 */ SaveOptions options; @@ -375,7 +375,7 @@ typedef struct SaveContext { /* 0x3F64 */ f32 screenScale; // "framescale_scale" /* 0x3F68 */ CycleSceneFlags cycleSceneFlags[120]; // Scene flags that are temporarily stored over the duration of a single 3-day cycle /* 0x48C8 */ u16 dungeonIndex; // "scene_id_mix" - /* 0x48CA */ u8 maskMaskBit[27]; // "mask_mask_bit", masks given away on the Moon + /* 0x48CA */ u8 masksGivenOnMoon[27]; // bit-packed, masks given away on the Moon. "mask_mask_bit" } SaveContext; // size = 0x48C8 typedef enum ButtonStatus { diff --git a/include/z64scene.h b/include/z64scene.h index 180405f30..9658c4f4d 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -153,16 +153,16 @@ typedef struct { typedef struct { /* 0x0 */ u8 code; - /* 0x1 */ u8 bgmId; - /* 0x2 */ UNK_TYPE1 pad2[4]; - /* 0x6 */ u8 nighttimeSFX; - /* 0x7 */ u8 musicSeq; + /* 0x1 */ u8 specId; + /* 0x2 */ UNK_TYPE1 unk_02[4]; + /* 0x6 */ u8 ambienceId; + /* 0x7 */ u8 seqId; } SCmdSoundSettings; // size = 0x8 typedef struct { /* 0x0 */ u8 code; /* 0x1 */ u8 data1; - /* 0x2 */ UNK_TYPE1 pad2[5]; + /* 0x2 */ UNK_TYPE1 unk_02[5]; /* 0x7 */ u8 echo; } SCmdEchoSettings; // size = 0x8 @@ -316,7 +316,7 @@ typedef struct { } EntranceEntry; // size = 0x2 typedef struct { - /* 0x0 */ s8 sceneNum; + /* 0x0 */ s8 sceneId; /* 0x1 */ s8 spawnNum; /* 0x2 */ u16 flags; } EntranceTableEntry; // size = 0x4 @@ -767,7 +767,7 @@ typedef enum { /* * 0xFE00: Index into sSceneEntranceTable (Scene) * 0x01F0: Index into the scenes specific entrance table (Spawn) -* 0x000F: Index into the specific entrance table (Layer), stored seperately in sceneSetupIndex +* 0x000F: Index into the specific entrance table (Layer), stored seperately in sceneLayer */ #define ENTRANCE(scene, spawn) ((((ENTR_SCENE_##scene) & 0x7F) << 9) | (((spawn) & 0x1F) << 4)) @@ -817,7 +817,7 @@ typedef enum { /* 0x1D */ SCENE_CMD_ID_UNUSED_1D, /* 0x1E */ SCENE_CMD_ID_MINIMAP_COMPASS_ICON_INFO, /* 0x1F */ SCENE_CMD_MAX -} SceneCommandTypeID; +} SceneCommandTypeId; #define SCENE_CMD_SPAWN_LIST(numSpawns, spawnList) \ { SCENE_CMD_ID_SPAWN_LIST, numSpawns, CMD_PTR(spawnList) } @@ -887,8 +887,8 @@ typedef enum { #define SCENE_CMD_END() \ { SCENE_CMD_ID_END, 0, CMD_W(0) } -#define SCENE_CMD_SOUND_SETTINGS(audioSessionId, nighttimeSfx, bgmId) \ - { SCENE_CMD_ID_SOUND_SETTINGS, audioSessionId, CMD_BBBB(0, 0, nighttimeSfx, bgmId) } +#define SCENE_CMD_SOUND_SETTINGS(specId, ambienceId, seqId) \ + { SCENE_CMD_ID_SOUND_SETTINGS, specId, CMD_BBBB(0, 0, ambienceId, seqId) } #define SCENE_CMD_ECHO_SETTINGS(echo) \ { SCENE_CMD_ID_ECHO_SETTINGS, 0, CMD_BBBB(0, 0, 0, echo) } diff --git a/include/z64schedule.h b/include/z64schedule.h index cff6224f4..69906e584 100644 --- a/include/z64schedule.h +++ b/include/z64schedule.h @@ -42,8 +42,8 @@ typedef enum { /* 0x07 */ SCHEDULE_CMD_ID_NOP, // No-Op /* 0x08 */ SCHEDULE_CMD_ID_CHECK_MISC_S, // Special check based on items or masks and branches if check passes, short range branch /* 0x09 */ SCHEDULE_CMD_ID_RET_VAL_S, // Ends script and returns byte value - /* 0x0A */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_S, // Checks if the current scene is not SceneNum and branches if so, short range branch - /* 0x0B */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_L, // Checks if the current scene is not SceneNum and branches if so, long range branch + /* 0x0A */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_S, // Checks if the current scene is not SceneId and branches if so, short range branch + /* 0x0B */ SCHEDULE_CMD_ID_CHECK_NOT_IN_SCENE_L, // Checks if the current scene is not SceneId and branches if so, long range branch /* 0x0C */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_S, // Checks if the current day is not Day and branches if so, short range branch /* 0x0D */ SCHEDULE_CMD_ID_CHECK_NOT_IN_DAY_L, // Checks if the current day is not Day and branches if so, long range branch /* 0x0E */ SCHEDULE_CMD_ID_RET_TIME, // Returns 2 time values @@ -130,15 +130,15 @@ typedef struct { typedef struct { /* 0x0 */ ScheduleCmdBase base; - /* 0x1 */ u8 sceneH; - /* 0x2 */ u8 sceneL; + /* 0x1 */ u8 sceneIdH; + /* 0x2 */ u8 sceneIdL; /* 0x3 */ s8 offset; } ScheduleCmdCheckNotInSceneS; // size = 0x4 typedef struct { /* 0x0 */ ScheduleCmdBase base; - /* 0x1 */ u8 sceneH; - /* 0x2 */ u8 sceneL; + /* 0x1 */ u8 sceneIdH; + /* 0x2 */ u8 sceneIdL; /* 0x3 */ u8 offsetH; /* 0x4 */ u8 offsetL; } ScheduleCmdCheckNotInSceneL; // size = 0x5 diff --git a/spec b/spec index c894dabef..b4a8a6108 100644 --- a/spec +++ b/spec @@ -1730,9 +1730,7 @@ beginseg name "ovl_Oceff_Wipe" compress include "build/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.o" - include "build/data/ovl_Oceff_Wipe/ovl_Oceff_Wipe.data.o" - include "build/data/ovl_Oceff_Wipe/ovl_Oceff_Wipe.bss.o" - include "build/data/ovl_Oceff_Wipe/ovl_Oceff_Wipe.reloc.o" + include "build/src/overlays/actors/ovl_Oceff_Wipe/ovl_Oceff_Wipe_reloc.o" endseg beginseg @@ -2029,8 +2027,7 @@ beginseg name "ovl_En_Tg" compress include "build/src/overlays/actors/ovl_En_Tg/z_en_tg.o" - include "build/data/ovl_En_Tg/ovl_En_Tg.data.o" - include "build/data/ovl_En_Tg/ovl_En_Tg.reloc.o" + include "build/src/overlays/actors/ovl_En_Tg/ovl_En_Tg_reloc.o" endseg beginseg @@ -2638,8 +2635,7 @@ beginseg name "ovl_En_Ru" compress include "build/src/overlays/actors/ovl_En_Ru/z_en_ru.o" - include "build/data/ovl_En_Ru/ovl_En_Ru.data.o" - include "build/data/ovl_En_Ru/ovl_En_Ru.reloc.o" + include "build/src/overlays/actors/ovl_En_Ru/ovl_En_Ru_reloc.o" endseg beginseg @@ -4367,9 +4363,7 @@ beginseg name "ovl_Oceff_Wipe5" compress include "build/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.o" - include "build/data/ovl_Oceff_Wipe5/ovl_Oceff_Wipe5.data.o" - include "build/data/ovl_Oceff_Wipe5/ovl_Oceff_Wipe5.bss.o" - include "build/data/ovl_Oceff_Wipe5/ovl_Oceff_Wipe5.reloc.o" + include "build/src/overlays/actors/ovl_Oceff_Wipe5/ovl_Oceff_Wipe5_reloc.o" endseg beginseg diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 46fd8ee6b..ea8c8dd24 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -87,8 +87,8 @@ void func_8016FF90(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, s32 en gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, this->width, this->height); - func_80172758(&gfx, buf, 0, this->width, this->height, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TT_NONE, 0, 0.0f, 0.0f, 1.0f, - 1.0f, 0xB); + func_80172758(&gfx, buf, NULL, this->width, this->height, G_IM_FMT_RGBA, G_IM_SIZ_16b, G_TT_NONE, 0, 0.0f, 0.0f, + 1.0f, 1.0f, 0xB); gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); @@ -450,8 +450,8 @@ void func_801720C4(PreRender* this) { #pragma GLOBAL_ASM("asm/non_matchings/code/PreRender/func_801720FC.s") -void func_80172758(Gfx** gfxp, void* timg, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, u16 arg8, f32 x, - f32 y, f32 xScale, f32 yScale, u32 flags) { +void func_80172758(Gfx** gfxp, TexturePtr timg, TexturePtr tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 tt, + u16 arg8, f32 x, f32 y, f32 xScale, f32 yScale, u32 flags) { PreRenderParams params; PreRenderParams* paramsp = ¶ms; diff --git a/src/code/audio/audio_seqplayer.c b/src/code/audio/audio_seqplayer.c index ea5c5ed5e..a8573e33d 100644 --- a/src/code/audio/audio_seqplayer.c +++ b/src/code/audio/audio_seqplayer.c @@ -315,7 +315,7 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) { channel->freqScale = 1.0f; for (i = 0; i < ARRAY_COUNT(channel->soundScriptIO); i++) { - channel->soundScriptIO[i] = -1; + channel->soundScriptIO[i] = SEQ_IO_VAL_NONE; } channel->unused = false; @@ -1791,12 +1791,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { case 0x10: // channel: load sample if (lowBits < 8) { - channel->soundScriptIO[lowBits] = -1; + channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE; if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value, &channel->soundScriptIO[lowBits]) == -1) {} } else { lowBits -= 8; - channel->soundScriptIO[lowBits] = -1; + channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE; if (AudioLoad_SlowLoadSample(channel->fontId, channel->unk_22 + 0x100, &channel->soundScriptIO[lowBits]) == -1) {} } @@ -1805,7 +1805,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { case 0x60: // channel: io read value scriptState->value = channel->soundScriptIO[lowBits]; if (lowBits < 2) { - channel->soundScriptIO[lowBits] = -1; + channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE; } break; @@ -2150,7 +2150,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) { case 0x80: // seqPlayer: io read value seqScript->value = seqPlayer->soundScriptIO[cmdLowBits]; if (cmdLowBits < 2) { - seqPlayer->soundScriptIO[cmdLowBits] = -1; + seqPlayer->soundScriptIO[cmdLowBits] = SEQ_IO_VAL_NONE; } break; @@ -2286,7 +2286,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) { seqPlayer->applyBend = false; for (j = 0; j < ARRAY_COUNT(seqPlayer->soundScriptIO); j++) { - seqPlayer->soundScriptIO[j] = -1; + seqPlayer->soundScriptIO[j] = SEQ_IO_VAL_NONE; } seqPlayer->muteFlags = MUTE_FLAGS_SOFTEN | MUTE_FLAGS_STOP_NOTES; diff --git a/src/code/audio/code_8019AF00.c b/src/code/audio/code_8019AF00.c index b896facbc..007d7ca85 100644 --- a/src/code/audio/code_8019AF00.c +++ b/src/code/audio/code_8019AF00.c @@ -5,12 +5,6 @@ typedef struct { /* 0x1 */ s8 y; } OcarinaControlStick; // size = 0x2 -typedef struct { - /* 0x0 */ u16 playerIO; - /* 0x2 */ u16 channelMask; - /* 0x4 */ u8 channelIO[3 * 33 + 1]; -} NatureAmbienceDataIO; // size = 0x68 - typedef struct { /* 0x0 */ Vec3f* pos; /* 0x4 */ f32 freqScale; @@ -67,8 +61,30 @@ typedef struct { } FreqLerp; // size = 0x10 s32 AudioOcarina_MemoryGameNextNote(void); + +void AudioSfx_ProcessSfxSettings(void); +void func_8019FEDC(void); +void Audio_StepFreqLerp(FreqLerp* lerp); + s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume); -void func_801A3238(s8 playerIndex, u16 seqId, u8 fadeTimer, s8 arg3, u8 arg4); + +void Audio_StartMorningSceneSequence(u16 seqId); +void Audio_StartSceneSequence(u16 seqId); +void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeTimer, s8 arg3, u8 arg4); +void func_801A4428(u8 reverbIndex); +void func_801A3038(void); +void Audio_PlayAmbience(u8 ambienceId); +void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 volume); + +void Audio_UpdateRiverSoundVolumes(void); +void func_801A1290(void); +void func_801A1904(void); +void func_801A1E0C(void); +void func_801A2090(void); +void Audio_UpdateSceneSequenceResumePoint(void); +void func_801A312C(void); +void func_801A3AC0(void); +void Audio_ResetRequestedSceneSeqId(void); // Sfx bss SfxSettings sSfxSettings[8]; @@ -90,7 +106,7 @@ u8 sGanonsTowerVol; f32* sSfxVolumeCur; f32 sSfxVolumeTarget; f32 sSfxVolumeRate; -u16 sSceneSeqId1; +u16 sRequestedSceneSeqId; SfxChannelState sSfxChannelState[16]; // Sequence bss @@ -99,7 +115,7 @@ u8 D_801FD3A9; u8 sRiverSoundBgmTimer; u8 sFanfareState; u16 sFanfareSeqId; -u8 sMuteOnlySfxAndNatureSeq; +u8 sMuteOnlySfxAndAmbienceSeq; u8 sAllPlayersMutedExceptOcaAndSys; u8 sAudioPauseState; u8 sSpatialSeqIsActive[4]; @@ -125,7 +141,7 @@ u8 sSpatialSubBgmFadeTimer; u8 D_801FD434; u8 sSpatialSeqPlayerIndex; u8 sSpatialSeqFadeTimer; -u16 D_801FD438; +u16 sPrevAmbienceSeqId; // AudioOcarina bss OcarinaStaff sPlayingStaff; @@ -202,11 +218,14 @@ s8 sAudioCodeReverb = 0; // Sequence Data u8 sPrevSeqMode = 0; -f32 sAudioEnemyDist = 0.0f; -s8 sAudioEnemyVol = 127; +f32 sBgmEnemyDist = 0.0f; +s8 sBgmEnemyVolume = 127; u16 sPrevMainBgmSeqId = NA_BGM_DISABLED; -u8 sBgmPlayerIOPort7 = 0; -u8 sSceneSeqId2 = NA_BGM_GENERAL_SFX; + +#define SEQ_RESUME_POINT_NONE 0xC0 +u8 sSeqResumePoint = 0; +u8 sPrevSceneSeqId = NA_BGM_GENERAL_SFX; + u32 sNumFramesStill = 0; u32 sNumFramesMoving = 0; u8 sAudioBaseFilter = 0; @@ -217,768 +236,893 @@ s8 gUnderwaterSfxReverbAdd = 0; Vec3f* sRiverSoundBgmPos = NULL; f32 sRiverSoundXZDistToPlayer = 2000.0f; u8 sObjSoundMainBgmSeqId = NA_BGM_GENERAL_SFX; + +// Allows enemy bgm +#define SEQ_FLAG_ENEMY (1 << 0) + +#define SEQ_FLAG_FANFARE (1 << 1) +#define SEQ_FLAG_FANFARE_KAMARO (1 << 2) + +// required for Audio_RestorePrevBgm to restore a sequence after Audio_PlayBgm_StorePrevBgm +#define SEQ_FLAG_RESTORE (1 << 3) + +/** + * These two sequence flags work together to implement a “resume playing from where you left off” system for scene + * sequences when leaving and returning to a scene. For a scene to resume playing from the point where it left off, it + * must have `SEQ_FLAG_RESUME` attached to it. Then, if the scene changes and the new scene sequence contain + * `SEQ_FLAG_RESUME_PREV`, the point from the previous scene sequence will be stored. Then, when returning to the + * scene with the sequence `SEQ_FLAG_RESUME`, then the sequence will resume playing from where it left off. + * + * TODO: Confirm which sequences properly implement this system after sequence extraction + */ +#define SEQ_FLAG_RESUME (1 << 4) +#define SEQ_FLAG_RESUME_PREV (1 << 5) + +/** + * Will write a value of 1 to ioPort 7 when called through the scene. How it's used depends on the sequence: + * NA_BGM_FILE_SELECT - ioPort 7 skips the harp intro when a value of 1 is written to it. + */ +#define SEQ_FLAG_SKIP_HARP_INTRO (1 << 6) + +// Unused, repurposed for SubBgm +#define SEQ_FLAG_NO_AMBIENCE (1 << 7) + u8 sSeqFlags[] = { - 0x3, // NA_BGM_GENERAL_SFX - 0x1, // NA_BGM_NATURE_AMBIENCE - 0x1, // NA_BGM_TERMINA_FIELD - 0x8, // NA_BGM_CHASE - 0, // NA_BGM_MAJORAS_THEME - 0, // NA_BGM_CLOCK_TOWER - 0x1, // NA_BGM_STONE_TOWER_TEMPLE - 0x1, // NA_BGM_INV_STONE_TOWER_TEMPLE - 0x2, // NA_BGM_FAILURE_0 - 0x2, // NA_BGM_FAILURE_1 - 0, // NA_BGM_HAPPY_MASK_SALESMAN - 0, // NA_BGM_SONG_OF_HEALING - 0x1, // NA_BGM_SWAMP_REGION - 0, // NA_BGM_ALIEN_INVASION - 0x2, // NA_BGM_SWAMP_CRUISE - 0, // NA_BGM_SHARPS_CURSE - 0x1, // NA_BGM_GREAT_BAY_REGION - 0x1, // NA_BGM_IKANA_REGION - 0, // NA_BGM_DEKU_KING - 0x1, // NA_BGM_MOUNTAIN_REGION - 0, // NA_BGM_PIRATES_FORTRESS - 0, // NA_BGM_CLOCK_TOWN_DAY_1 - 0, // NA_BGM_CLOCK_TOWN_DAY_2 - 0, // NA_BGM_CLOCK_TOWN_DAY_3 - 0x40, // NA_BGM_FILE_SELECT - 0x10, // NA_BGM_CLEAR_EVENT - 0, // NA_BGM_ENEMY - 0x8, // NA_BGM_BOSS - 0x1, // NA_BGM_WOODFALL_TEMPLE - 0, // NA_BGM_MARKET - 0, // NA_BGM_OPENING - 0x20, // NA_BGM_INSIDE_A_HOUSE - 0x2, // NA_BGM_GAME_OVER - 0, // NA_BGM_CLEAR_BOSS - 0x2, // NA_BGM_GET_ITEM - 0x2, // NA_BGM_GATE_OPEN - 0x2, // NA_BGM_GET_HEART - 0x8, // NA_BGM_TIMED_MINI_GAME - 0, // NA_BGM_GORON_RACE - 0, // NA_BGM_MUSIC_BOX_HOUSE - 0, // NA_BGM_FAIRY_FOUNTAIN - 0, // NA_BGM_ZELDAS_LULLABY - 0, // NA_BGM_ROSA_SISTERS - 0x2, // NA_BGM_OPEN_CHEST - 0, // NA_BGM_MARINE_RESEARCH_LAB - 0x40, // NA_BGM_GIANTS_THEME - 0, // NA_BGM_SONG_OF_STORMS - 0, // NA_BGM_ROMANI_RANCH - 0, // NA_BGM_GORON_VILLAGE - 0, // NA_BGM_MAYORS_OFFICE - 0x2, // NA_BGM_OCA_EPONA - 0x2, // NA_BGM_OCA_SUNS - 0x2, // NA_BGM_OCA_TIME - 0x2, // NA_BGM_OCA_STORM - 0x10, // NA_BGM_ZORA_HALL - 0x2, // NA_BGM_GET_NEW_MASK - 0x8, // NA_BGM_MINI_BOSS - 0x2, // NA_BGM_GET_SMALL_ITEM - 0, // NA_BGM_ASTRAL_OBSERVATORY - 0x1, // NA_BGM_CAVERN - 0x11, // NA_BGM_MILK_BAR - 0x2, // NA_BGM_ZELDA_APPEAR - 0, // NA_BGM_SARIAS_SONG - 0, // NA_BGM_GORON_GOAL - 0, // NA_BGM_HORSE - 0, // NA_BGM_HORSE_GOAL - 0, // NA_BGM_INGO - 0, // NA_BGM_KOTAKE_POTION_SHOP - 0x20, // NA_BGM_SHOP - 0x2, // NA_BGM_OWL - 0x20, // NA_BGM_MINI_GAME - 0x2, // NA_BGM_OCA_SOARING - 0x2, // NA_BGM_OCA_HEALING - 0x2, // NA_BGM_INVERTED_SONG_OF_TIME - 0x2, // NA_BGM_SONG_OF_DOUBLE_TIME - 0x2, // NA_BGM_SONATA_OF_AWAKENING - 0x2, // NA_BGM_GORON_LULLABY - 0x2, // NA_BGM_NEW_WAVE_BOSSA_NOVA - 0x2, // NA_BGM_ELEGY_OF_EMPTINESS - 0x2, // NA_BGM_OATH_TO_ORDER - 0, // NA_BGM_SWORD_TRAINING_HALL - 0x2, // NA_BGM_GORON_LULLABY_INTRO - 0x2, // NA_BGM_OCA_FAIRY - 0x2, // NA_BGM_BREMEN_MARCH - 0x2, // NA_BGM_BALLAD_OF_THE_WIND_FISH - 0x8, // NA_BGM_SONG_OF_SOARING - 0, // NA_BGM_MILK_BAR_DUPLICATE - 0, // NA_BGM_FINAL_HOURS - 0x2, // NA_BGM_MIKAU_RIFF - 0x2, // NA_BGM_MIKAU_FINALE - 0, // NA_BGM_FROG_SONG - 0x2, // NA_BGM_OCA_SONATA - 0x2, // NA_BGM_OCA_LULLABY - 0x2, // NA_BGM_OCA_NEW_WAVE - 0x2, // NA_BGM_OCA_ELEGY - 0x2, // NA_BGM_OCA_OATH - 0, // NA_BGM_MAJORAS_LAIR - 0x2, // NA_BGM_OCA_LULLABY_INTRO - 0x2, // NA_BGM_OCA_GUITAR_BASS_SESSION - 0x2, // NA_BGM_PIANO_SESSION - 0x2, // NA_BGM_INDIGO_GO_SESSION - 0x1, // NA_BGM_SNOWHEAD_TEMPLE - 0x1, // NA_BGM_GREAT_BAY_TEMPLE - 0x2, // NA_BGM_NEW_WAVE_SAXOPHONE - 0x2, // NA_BGM_NEW_WAVE_VOCAL - 0, // NA_BGM_MAJORAS_WRATH - 0, // NA_BGM_MAJORAS_INCARNATION - 0, // NA_BGM_MAJORAS_MASK - 0x2, // NA_BGM_BASS_PLAY - 0x2, // NA_BGM_DRUMS_PLAY - 0x2, // NA_BGM_PIANO_PLAY - 0x1, // NA_BGM_IKANA_CASTLE - 0, // NA_BGM_GATHERING_GIANTS - 0x4, // NA_BGM_KAMARO_DANCE - 0, // NA_BGM_CREMIA_CARRIAGE - 0x2, // NA_BGM_KEATON_QUIZ - 0, // NA_BGM_END_CREDITS_1 - 0, // NA_BGM_OPENING_LOOP - 0, // NA_BGM_TITLE_THEME - 0x2, // NA_BGM_DUNGEON_APPEAR - 0x2, // NA_BGM_WOODFALL_CLEAR - 0x2, // NA_BGM_SNOWHEAD_CLEAR - 0, // - 0, // NA_BGM_INTO_THE_MOON - 0, // NA_BGM_GOODBYE_GIANT - 0, // NA_BGM_TATL_AND_TAEL - 0, // NA_BGM_MOONS_DESTRUCTION - 0, // NA_BGM_END_CREDITS_2 + SEQ_FLAG_FANFARE | SEQ_FLAG_ENEMY, // NA_BGM_GENERAL_SFX + SEQ_FLAG_ENEMY, // NA_BGM_AMBIENCE + SEQ_FLAG_ENEMY, // NA_BGM_TERMINA_FIELD + SEQ_FLAG_RESTORE, // NA_BGM_CHASE + 0, // NA_BGM_MAJORAS_THEME + 0, // NA_BGM_CLOCK_TOWER + SEQ_FLAG_ENEMY, // NA_BGM_STONE_TOWER_TEMPLE + SEQ_FLAG_ENEMY, // NA_BGM_INV_STONE_TOWER_TEMPLE + SEQ_FLAG_FANFARE, // NA_BGM_FAILURE_0 + SEQ_FLAG_FANFARE, // NA_BGM_FAILURE_1 + 0, // NA_BGM_HAPPY_MASK_SALESMAN + 0, // NA_BGM_SONG_OF_HEALING + SEQ_FLAG_ENEMY, // NA_BGM_SWAMP_REGION + 0, // NA_BGM_ALIEN_INVASION + SEQ_FLAG_FANFARE, // NA_BGM_SWAMP_CRUISE + 0, // NA_BGM_SHARPS_CURSE + SEQ_FLAG_ENEMY, // NA_BGM_GREAT_BAY_REGION + SEQ_FLAG_ENEMY, // NA_BGM_IKANA_REGION + 0, // NA_BGM_DEKU_KING + SEQ_FLAG_ENEMY, // NA_BGM_MOUNTAIN_REGION + 0, // NA_BGM_PIRATES_FORTRESS + 0, // NA_BGM_CLOCK_TOWN_DAY_1 + 0, // NA_BGM_CLOCK_TOWN_DAY_2 + 0, // NA_BGM_CLOCK_TOWN_DAY_3 + SEQ_FLAG_SKIP_HARP_INTRO, // NA_BGM_FILE_SELECT + SEQ_FLAG_RESUME, // NA_BGM_CLEAR_EVENT + 0, // NA_BGM_ENEMY + SEQ_FLAG_RESTORE, // NA_BGM_BOSS + SEQ_FLAG_ENEMY, // NA_BGM_WOODFALL_TEMPLE + 0, // NA_BGM_MARKET + 0, // NA_BGM_OPENING + SEQ_FLAG_RESUME_PREV, // NA_BGM_INSIDE_A_HOUSE + SEQ_FLAG_FANFARE, // NA_BGM_GAME_OVER + 0, // NA_BGM_CLEAR_BOSS + SEQ_FLAG_FANFARE, // NA_BGM_GET_ITEM + SEQ_FLAG_FANFARE, // NA_BGM_GATE_OPEN + SEQ_FLAG_FANFARE, // NA_BGM_GET_HEART + SEQ_FLAG_RESTORE, // NA_BGM_TIMED_MINI_GAME + 0, // NA_BGM_GORON_RACE + 0, // NA_BGM_MUSIC_BOX_HOUSE + 0, // NA_BGM_FAIRY_FOUNTAIN + 0, // NA_BGM_ZELDAS_LULLABY + 0, // NA_BGM_ROSA_SISTERS + SEQ_FLAG_FANFARE, // NA_BGM_OPEN_CHEST + 0, // NA_BGM_MARINE_RESEARCH_LAB + SEQ_FLAG_SKIP_HARP_INTRO, // NA_BGM_GIANTS_THEME + 0, // NA_BGM_SONG_OF_STORMS + 0, // NA_BGM_ROMANI_RANCH + 0, // NA_BGM_GORON_VILLAGE + 0, // NA_BGM_MAYORS_OFFICE + SEQ_FLAG_FANFARE, // NA_BGM_OCA_EPONA + SEQ_FLAG_FANFARE, // NA_BGM_OCA_SUNS + SEQ_FLAG_FANFARE, // NA_BGM_OCA_TIME + SEQ_FLAG_FANFARE, // NA_BGM_OCA_STORM + SEQ_FLAG_RESUME, // NA_BGM_ZORA_HALL + SEQ_FLAG_FANFARE, // NA_BGM_GET_NEW_MASK + SEQ_FLAG_RESTORE, // NA_BGM_MINI_BOSS + SEQ_FLAG_FANFARE, // NA_BGM_GET_SMALL_ITEM + 0, // NA_BGM_ASTRAL_OBSERVATORY + SEQ_FLAG_ENEMY, // NA_BGM_CAVERN + SEQ_FLAG_RESUME | SEQ_FLAG_ENEMY, // NA_BGM_MILK_BAR + SEQ_FLAG_FANFARE, // NA_BGM_ZELDA_APPEAR + 0, // NA_BGM_SARIAS_SONG + 0, // NA_BGM_GORON_GOAL + 0, // NA_BGM_HORSE + 0, // NA_BGM_HORSE_GOAL + 0, // NA_BGM_INGO + 0, // NA_BGM_KOTAKE_POTION_SHOP + SEQ_FLAG_RESUME_PREV, // NA_BGM_SHOP + SEQ_FLAG_FANFARE, // NA_BGM_OWL + SEQ_FLAG_RESUME_PREV, // NA_BGM_MINI_GAME + SEQ_FLAG_FANFARE, // NA_BGM_OCA_SOARING + SEQ_FLAG_FANFARE, // NA_BGM_OCA_HEALING + SEQ_FLAG_FANFARE, // NA_BGM_INVERTED_SONG_OF_TIME + SEQ_FLAG_FANFARE, // NA_BGM_SONG_OF_DOUBLE_TIME + SEQ_FLAG_FANFARE, // NA_BGM_SONATA_OF_AWAKENING + SEQ_FLAG_FANFARE, // NA_BGM_GORON_LULLABY + SEQ_FLAG_FANFARE, // NA_BGM_NEW_WAVE_BOSSA_NOVA + SEQ_FLAG_FANFARE, // NA_BGM_ELEGY_OF_EMPTINESS + SEQ_FLAG_FANFARE, // NA_BGM_OATH_TO_ORDER + 0, // NA_BGM_SWORD_TRAINING_HALL + SEQ_FLAG_FANFARE, // NA_BGM_GORON_LULLABY_INTRO + SEQ_FLAG_FANFARE, // NA_BGM_OCA_FAIRY + SEQ_FLAG_FANFARE, // NA_BGM_BREMEN_MARCH + SEQ_FLAG_FANFARE, // NA_BGM_BALLAD_OF_THE_WIND_FISH + SEQ_FLAG_RESTORE, // NA_BGM_SONG_OF_SOARING + 0, // NA_BGM_MILK_BAR_DUPLICATE + 0, // NA_BGM_FINAL_HOURS + SEQ_FLAG_FANFARE, // NA_BGM_MIKAU_RIFF + SEQ_FLAG_FANFARE, // NA_BGM_MIKAU_FINALE + 0, // NA_BGM_FROG_SONG + SEQ_FLAG_FANFARE, // NA_BGM_OCA_SONATA + SEQ_FLAG_FANFARE, // NA_BGM_OCA_LULLABY + SEQ_FLAG_FANFARE, // NA_BGM_OCA_NEW_WAVE + SEQ_FLAG_FANFARE, // NA_BGM_OCA_ELEGY + SEQ_FLAG_FANFARE, // NA_BGM_OCA_OATH + 0, // NA_BGM_MAJORAS_LAIR + SEQ_FLAG_FANFARE, // NA_BGM_OCA_LULLABY_INTRO + SEQ_FLAG_FANFARE, // NA_BGM_OCA_GUITAR_BASS_SESSION + SEQ_FLAG_FANFARE, // NA_BGM_PIANO_SESSION + SEQ_FLAG_FANFARE, // NA_BGM_INDIGO_GO_SESSION + SEQ_FLAG_ENEMY, // NA_BGM_SNOWHEAD_TEMPLE + SEQ_FLAG_ENEMY, // NA_BGM_GREAT_BAY_TEMPLE + SEQ_FLAG_FANFARE, // NA_BGM_NEW_WAVE_SAXOPHONE + SEQ_FLAG_FANFARE, // NA_BGM_NEW_WAVE_VOCAL + 0, // NA_BGM_MAJORAS_WRATH + 0, // NA_BGM_MAJORAS_INCARNATION + 0, // NA_BGM_MAJORAS_MASK + SEQ_FLAG_FANFARE, // NA_BGM_BASS_PLAY + SEQ_FLAG_FANFARE, // NA_BGM_DRUMS_PLAY + SEQ_FLAG_FANFARE, // NA_BGM_PIANO_PLAY + SEQ_FLAG_ENEMY, // NA_BGM_IKANA_CASTLE + 0, // NA_BGM_GATHERING_GIANTS + SEQ_FLAG_FANFARE_KAMARO, // NA_BGM_KAMARO_DANCE + 0, // NA_BGM_CREMIA_CARRIAGE + SEQ_FLAG_FANFARE, // NA_BGM_KEATON_QUIZ + 0, // NA_BGM_END_CREDITS_1 + 0, // NA_BGM_OPENING_LOOP + 0, // NA_BGM_TITLE_THEME + SEQ_FLAG_FANFARE, // NA_BGM_DUNGEON_APPEAR + SEQ_FLAG_FANFARE, // NA_BGM_WOODFALL_CLEAR + SEQ_FLAG_FANFARE, // NA_BGM_SNOWHEAD_CLEAR + 0, // + 0, // NA_BGM_INTO_THE_MOON + 0, // NA_BGM_GOODBYE_GIANT + 0, // NA_BGM_TATL_AND_TAEL + 0, // NA_BGM_MOONS_DESTRUCTION + 0, // NA_BGM_END_CREDITS_2 }; -s8 sSpecReverbs[20] = { +s8 sSpecReverbs[] = { 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -NatureAmbienceDataIO sNatureAmbienceData[20] = { - // natureSeqId: 0 +#define AMBIENCE_CHANNEL_PROPERTIES_ENTRIES_MAX 33 + +typedef struct { + /* 0x0 */ u16 initChannelMask; // bitwise flag for 16 channels, channels to initialize + /* 0x2 */ u16 initMuteChannelMask; // bitwise flag for 16 channels, channels to mute upon initialization + /* 0x4 */ u8 channelProperties[3 * AMBIENCE_CHANNEL_PROPERTIES_ENTRIES_MAX + 1]; +} AmbienceDataIO; // size = 0x68 + +AmbienceDataIO sAmbienceData[20] = { + // AMBIENCE_ID_00 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_09), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(32), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_09), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(32), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_1_BEND_PITCH(0), - NATURE_IO_CRITTER_1_NUM_LAYERS(1), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_10), - NATURE_IO_CRITTER_2_BEND_PITCH(112), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(48), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_10), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(48), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_03), - NATURE_IO_CRITTER_3_BEND_PITCH(127), - NATURE_IO_CRITTER_3_NUM_LAYERS(0), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_03), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_00), - NATURE_IO_CRITTER_4_BEND_PITCH(127), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(16), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_00), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(16), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(3), - NATURE_IO_CRITTER_5_PORT5(16), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_5_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 1 + // AMBIENCE_ID_01 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(32), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(32), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_16), - NATURE_IO_CRITTER_1_BEND_PITCH(0), - NATURE_IO_CRITTER_1_NUM_LAYERS(1), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_16), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_12), - NATURE_IO_CRITTER_2_BEND_PITCH(112), - NATURE_IO_CRITTER_2_NUM_LAYERS(0), - NATURE_IO_CRITTER_2_PORT5(48), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_12), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_2_PORT5(48), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_15), - NATURE_IO_CRITTER_3_BEND_PITCH(127), - NATURE_IO_CRITTER_3_NUM_LAYERS(1), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_15), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_06), - NATURE_IO_CRITTER_4_BEND_PITCH(127), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(16), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_06), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(16), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(3), - NATURE_IO_CRITTER_5_PORT5(16), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_5_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 2 + // AMBIENCE_ID_02 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(48), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(48), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_10), - NATURE_IO_CRITTER_1_BEND_PITCH(0), - NATURE_IO_CRITTER_1_NUM_LAYERS(1), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_10), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_2_BEND_PITCH(48), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(32), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(48), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(32), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_03), - NATURE_IO_CRITTER_3_BEND_PITCH(127), - NATURE_IO_CRITTER_3_NUM_LAYERS(0), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_03), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_4_BEND_PITCH(64), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(0), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(0), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(0), - NATURE_IO_CRITTER_5_PORT5(63), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_5_PORT5(63), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 3 + // AMBIENCE_ID_03 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_09), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(32), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_09), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(32), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_1_BEND_PITCH(64), - NATURE_IO_CRITTER_1_NUM_LAYERS(0), - NATURE_IO_CRITTER_1_PORT5(48), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_1_PORT5(48), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_10), - NATURE_IO_CRITTER_2_BEND_PITCH(32), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(32), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_10), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(32), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(32), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_14), - NATURE_IO_CRITTER_3_BEND_PITCH(64), - NATURE_IO_CRITTER_3_NUM_LAYERS(1), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_14), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_00), - NATURE_IO_CRITTER_4_BEND_PITCH(127), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(16), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_00), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(16), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(3), - NATURE_IO_CRITTER_5_PORT5(16), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_5_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 4 + // AMBIENCE_ID_04 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(32), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(32), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_02), - NATURE_IO_CRITTER_1_BEND_PITCH(64), - NATURE_IO_CRITTER_1_NUM_LAYERS(1), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_02), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_12), - NATURE_IO_CRITTER_2_BEND_PITCH(112), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(48), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_12), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(48), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_13), - NATURE_IO_CRITTER_3_BEND_PITCH(64), - NATURE_IO_CRITTER_3_NUM_LAYERS(1), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_13), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_4_BEND_PITCH(64), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(16), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(16), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_02), - NATURE_IO_CRITTER_5_BEND_PITCH(112), - NATURE_IO_CRITTER_5_NUM_LAYERS(0), - NATURE_IO_CRITTER_5_PORT5(48), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_02), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_5_PORT5(48), // Channel 14 - NATURE_IO_RAIN_PORT4(63), + AMBIENCE_IO_RAIN_PORT4(63), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 5 + // AMBIENCE_ID_05 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_09), - NATURE_IO_CRITTER_0_BEND_PITCH(64), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(32), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_09), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(64), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(32), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_1_BEND_PITCH(0), - NATURE_IO_CRITTER_1_NUM_LAYERS(1), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_10), - NATURE_IO_CRITTER_2_BEND_PITCH(112), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(48), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_10), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(48), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_13), - NATURE_IO_CRITTER_3_BEND_PITCH(127), - NATURE_IO_CRITTER_3_NUM_LAYERS(0), - NATURE_IO_CRITTER_3_PORT5(63), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_13), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_3_PORT5(63), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_00), - NATURE_IO_CRITTER_4_BEND_PITCH(127), - NATURE_IO_CRITTER_4_NUM_LAYERS(1), - NATURE_IO_CRITTER_4_PORT5(16), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_00), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_4_PORT5(16), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(3), - NATURE_IO_CRITTER_5_PORT5(16), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_5_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 6 + // AMBIENCE_ID_06 { - 0xC0FF, // PlayerIO Data - 0xC0FE, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | + (1 << AMBIENCE_CHANNEL_CRITTER_5) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | (1 << AMBIENCE_CHANNEL_CRITTER_2) | + (1 << AMBIENCE_CHANNEL_CRITTER_3) | (1 << AMBIENCE_CHANNEL_CRITTER_4) | (1 << AMBIENCE_CHANNEL_CRITTER_5) | + (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_11), - NATURE_IO_CRITTER_0_BEND_PITCH(112), - NATURE_IO_CRITTER_0_NUM_LAYERS(0), - NATURE_IO_CRITTER_0_PORT5(48), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_11), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_0_PORT5(48), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_15), - NATURE_IO_CRITTER_1_BEND_PITCH(112), - NATURE_IO_CRITTER_1_NUM_LAYERS(0), - NATURE_IO_CRITTER_1_PORT5(63), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_15), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_1_PORT5(63), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_11), - NATURE_IO_CRITTER_2_BEND_PITCH(48), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(16), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_11), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(48), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(16), // Channel 4 - NATURE_IO_CRITTER_3_TYPE(NATURE_CRITTER_14), - NATURE_IO_CRITTER_3_BEND_PITCH(48), - NATURE_IO_CRITTER_3_NUM_LAYERS(1), - NATURE_IO_CRITTER_3_PORT5(16), + AMBIENCE_IO_CRITTER_3_TYPE(AMBIENCE_CRITTER_14), + AMBIENCE_IO_CRITTER_3_BEND_PITCH(48), + AMBIENCE_IO_CRITTER_3_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_3_PORT5(16), // Channel 5 - NATURE_IO_CRITTER_4_TYPE(NATURE_CRITTER_11), - NATURE_IO_CRITTER_4_BEND_PITCH(127), - NATURE_IO_CRITTER_4_NUM_LAYERS(0), - NATURE_IO_CRITTER_4_PORT5(32), + AMBIENCE_IO_CRITTER_4_TYPE(AMBIENCE_CRITTER_11), + AMBIENCE_IO_CRITTER_4_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_4_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_4_PORT5(32), // Channel 6 - NATURE_IO_CRITTER_5_TYPE(NATURE_CRITTER_02), - NATURE_IO_CRITTER_5_BEND_PITCH(127), - NATURE_IO_CRITTER_5_NUM_LAYERS(0), - NATURE_IO_CRITTER_5_PORT5(48), + AMBIENCE_IO_CRITTER_5_TYPE(AMBIENCE_CRITTER_02), + AMBIENCE_IO_CRITTER_5_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_5_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_5_PORT5(48), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 7 + // AMBIENCE_ID_07 { - 0xC001, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 8 + // AMBIENCE_ID_08 { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_0_BEND_PITCH(127), - NATURE_IO_CRITTER_0_NUM_LAYERS(3), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 9 + // AMBIENCE_ID_09 { - 0xC00F, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_16), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(2), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_16), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(2), + AMBIENCE_IO_CRITTER_0_PORT5(16), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_12), - NATURE_IO_CRITTER_1_BEND_PITCH(112), - NATURE_IO_CRITTER_1_NUM_LAYERS(0), - NATURE_IO_CRITTER_1_PORT5(48), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_12), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(0), + AMBIENCE_IO_CRITTER_1_PORT5(48), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_15), - NATURE_IO_CRITTER_2_BEND_PITCH(127), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(16), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_15), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 10 + // AMBIENCE_ID_0A { - 0xC081, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_6) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_1), - NATURE_IO_STREAM_0_PORT3(8), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_1), + AMBIENCE_IO_STREAM_0_PORT3(8), // Channel 7 - NATURE_IO_CRITTER_6_TYPE(NATURE_CRITTER_11), - NATURE_IO_CRITTER_6_BEND_PITCH(112), - NATURE_IO_CRITTER_6_NUM_LAYERS(2), - NATURE_IO_CRITTER_6_PORT5(32), + AMBIENCE_IO_CRITTER_6_TYPE(AMBIENCE_CRITTER_11), + AMBIENCE_IO_CRITTER_6_BEND_PITCH(112), + AMBIENCE_IO_CRITTER_6_NUM_LAYERS(2), + AMBIENCE_IO_CRITTER_6_PORT5(32), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 11 + // AMBIENCE_ID_0B { - 0xC00F, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_CRITTER_2) | (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_3), - NATURE_IO_STREAM_0_PORT3(8), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_3), + AMBIENCE_IO_STREAM_0_PORT3(8), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_0_BEND_PITCH(127), - NATURE_IO_CRITTER_0_NUM_LAYERS(3), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_0_PORT5(16), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_00), - NATURE_IO_CRITTER_1_BEND_PITCH(127), - NATURE_IO_CRITTER_1_NUM_LAYERS(2), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_00), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(2), + AMBIENCE_IO_CRITTER_1_PORT5(16), // Channel 3 - NATURE_IO_CRITTER_2_TYPE(NATURE_CRITTER_06), - NATURE_IO_CRITTER_2_BEND_PITCH(127), - NATURE_IO_CRITTER_2_NUM_LAYERS(1), - NATURE_IO_CRITTER_2_PORT5(16), + AMBIENCE_IO_CRITTER_2_TYPE(AMBIENCE_CRITTER_06), + AMBIENCE_IO_CRITTER_2_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_2_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_2_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 12 + // AMBIENCE_ID_0C { - 0xC007, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_CRITTER_1) | + (1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_00), - NATURE_IO_CRITTER_0_BEND_PITCH(127), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_00), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // Channel 2 - NATURE_IO_CRITTER_1_TYPE(NATURE_CRITTER_01), - NATURE_IO_CRITTER_1_BEND_PITCH(127), - NATURE_IO_CRITTER_1_NUM_LAYERS(3), - NATURE_IO_CRITTER_1_PORT5(16), + AMBIENCE_IO_CRITTER_1_TYPE(AMBIENCE_CRITTER_01), + AMBIENCE_IO_CRITTER_1_BEND_PITCH(127), + AMBIENCE_IO_CRITTER_1_NUM_LAYERS(3), + AMBIENCE_IO_CRITTER_1_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 13 + // AMBIENCE_ID_0D { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 14 + // AMBIENCE_ID_0E { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 15 + // AMBIENCE_ID_0F { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 16 + // AMBIENCE_ID_10 { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 17 + // AMBIENCE_ID_11 { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 18 + // AMBIENCE_ID_12 { - 0xC000, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { // Channel 0 - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, - // natureSeqId: 19 + // AMBIENCE_ID_13 { - 0xC003, // PlayerIO Data - 0xC000, // Channel Mask + // Init channel mask + ((1 << AMBIENCE_CHANNEL_STREAM_0) | (1 << AMBIENCE_CHANNEL_CRITTER_0) | (1 << AMBIENCE_CHANNEL_RAIN) | + (1 << AMBIENCE_CHANNEL_LIGHTNING)), + // Init mute channel mask + ((1 << AMBIENCE_CHANNEL_RAIN) | (1 << AMBIENCE_CHANNEL_LIGHTNING)), { - NATURE_IO_STREAM_0_TYPE(NATURE_STREAM_0), - NATURE_IO_STREAM_0_PORT3(0), + AMBIENCE_IO_STREAM_0_TYPE(AMBIENCE_STREAM_0), + AMBIENCE_IO_STREAM_0_PORT3(0), // Channel 1 - NATURE_IO_CRITTER_0_TYPE(NATURE_CRITTER_04), - NATURE_IO_CRITTER_0_BEND_PITCH(0), - NATURE_IO_CRITTER_0_NUM_LAYERS(1), - NATURE_IO_CRITTER_0_PORT5(16), + AMBIENCE_IO_CRITTER_0_TYPE(AMBIENCE_CRITTER_04), + AMBIENCE_IO_CRITTER_0_BEND_PITCH(0), + AMBIENCE_IO_CRITTER_0_NUM_LAYERS(1), + AMBIENCE_IO_CRITTER_0_PORT5(16), // End - NATURE_IO_ENTRIES_END, + AMBIENCE_IO_ENTRIES_END, }, }, @@ -3256,7 +3400,7 @@ u8 sRequestCustomSequence = false; void AudioOcarina_SetCustomSequence(void) { // Never passes true as sRequestCustomSequence is never set true if (sRequestCustomSequence && gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].enabled && - ((u8)gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].soundScriptIO[0] == 0xFF)) { + ((u8)gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].soundScriptIO[0] == (u8)SEQ_IO_VAL_NONE)) { gAudioContext.seqPlayers[SEQ_PLAYER_FANFARE].seqData = sCustomSequenceScript; sRequestCustomSequence = false; } @@ -3477,17 +3621,46 @@ void AudioOcarina_ResetStaffs(void) { D_801D8534 = 0; } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019DFF8.s") +void Audio_Noop1(s32 arg0) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E000.s") +void Audio_Noop2(s32 arg0, s32 arg1) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E00C.s") +void Audio_Noop3(void) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E014.s") +void Audio_Update(void) { + if ((func_801A9768() == 0) && (func_801A982C() == 0)) { + AudioOcarina_SetCustomSequence(); + AudioOcarina_Update(); + func_801A5118(); + Audio_StepFreqLerp(&sRiverFreqScaleLerp); + Audio_StepFreqLerp(&sWaterfallFreqScaleLerp); + Audio_UpdateRiverSoundVolumes(); + Audio_UpdateSceneSequenceResumePoint(); + func_801A312C(); + func_8019FEDC(); + func_801A1E0C(); + func_801A1904(); + func_801A2090(); + func_801A3AC0(); + func_801A1290(); + Audio_ResetRequestedSceneSeqId(); + AudioSfx_ProcessRequests(); + func_801A89D0(); + AudioSfx_ProcessActiveSfx(); + func_801A8D5C(); + AudioSfx_ProcessSfxSettings(); + AudioThread_ScheduleProcessCmds(); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E0FC.s") +void Audio_Noop4(s32 arg0) { +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E104.s") +void Audio_Noop5(s32 arg0, s32 arg1) { +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_8019E110.s") @@ -3582,7 +3755,7 @@ s8 AudioSfx_ComputeReverb(u8 bankId, u8 entryIndex, u8 channelIndex) { if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex])) { scriptAdd = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[1]; - if (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[1] < 0) { + if (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[1] <= SEQ_IO_VAL_NONE) { scriptAdd = 0; } } @@ -3815,7 +3988,7 @@ void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex) { case BANK_ENV: case BANK_ENEMY: case BANK_VOICE: - if (sSoundMode == SOUNDMODE_SURROUND) { + if (sSoundMode == SOUNDMODE_SURROUND_EXTERNAL) { combFilterGain = AudioSfx_ComputeCombFilter(*entry->posY, entry->sfxParams); } // fallthrough @@ -3826,7 +3999,7 @@ void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex) { panSigned = AudioSfx_ComputePanSigned(*entry->posX, *entry->posZ, entry->token); freqScale = AudioSfx_ComputeFreqScale(bankId, entryIndex) * *entry->freqScale; - if (sSoundMode == SOUNDMODE_SURROUND) { + if (sSoundMode == SOUNDMODE_SURROUND_EXTERNAL) { if (*entry->posZ >= 0.0f) { if (*entry->posZ < 200.0f) { zVolume = 32.0f - ((*entry->posZ / 300.0f) * 32.0f); @@ -3859,7 +4032,7 @@ void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex) { ((entry->sfxFlags & SFX_FLAG2_APPLY_LOWPASS_FILTER) >> 2)) * 2); filter &= 0xFF; - } else if ((sSoundMode == SOUNDMODE_SURROUND) && !(entry->sfxParams & SFX_FLAG_VOLUME_NO_DIST)) { + } else if ((sSoundMode == SOUNDMODE_SURROUND_EXTERNAL) && !(entry->sfxParams & SFX_FLAG_VOLUME_NO_DIST)) { filter = AudioSfx_ComputeSurroundSoundFilter(behindScreenZ, entry, panSigned); } break; @@ -4189,7 +4362,7 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVolume) { gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIndex]) { // soundScriptIO[5] was set to 0x40 in channels 0, 1, and 4 (BGM no longer in OoT) if ((u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIndex]->soundScriptIO[5] != - 0xFF) { + (u8)SEQ_IO_VAL_NONE) { // Higher volume leads to lower reverb reverb = (((u16)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIndex]->soundScriptIO[5] - @@ -4350,9 +4523,51 @@ void Audio_ClearSariaBgmAtPos(Vec3f* pos) { } } -u8 sBgmPlayers[2] = { SEQ_PLAYER_BGM_MAIN, SEQ_PLAYER_BGM_SUB }; -void Audio_SplitBgmChannels(s8 volumeSplit); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SplitBgmChannels.s") +/** + * Turns on and off channels from both bgm players in a way that splits + * equally between the two bgm channels. Split based on note priority + */ +void Audio_SplitBgmChannels(s8 volumeSplit) { + u8 volume; + u8 notePriority; + u16 channelBits; + u8 sBgmPlayers[2] = { SEQ_PLAYER_BGM_MAIN, SEQ_PLAYER_BGM_SUB }; + u8 i; + u8 channelIndex; + + if ((Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) == NA_BGM_DISABLED) && + (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { + for (i = 0; i < ARRAY_COUNT(sBgmPlayers); i++) { + if (i == 0) { + // Main Bgm SeqPlayer + volume = volumeSplit; + } else { + // Sub Bgm SeqPlayer + volume = 0x7F - volumeSplit; + } + + if (volume > 100) { + notePriority = 11; + } else if (volume < 20) { + notePriority = 2; + } else { + notePriority = ((volume - 20) / 10) + 2; + } + + channelBits = 0; + for (channelIndex = 0; channelIndex < SEQ_NUM_CHANNELS; channelIndex++) { + if (gAudioContext.seqPlayers[sBgmPlayers[i]].channels[channelIndex]->notePriority < notePriority) { + // If the note currently playing in the channel is a high enough priority, + // then keep the channel on by setting a channelBit + // If this condition fails, then the channel will be shut off + channelBits += (1 << channelIndex); + } + } + + Audio_QueueSeqCmd(0xA0000000 | ((u32)(sBgmPlayers[i]) << 24) | ((u32)(channelBits))); + } + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A0E44.s") @@ -4404,7 +4619,7 @@ void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax) { if (sRiverSoundBgmPos == NULL) { sRiverSoundBgmPos = pos; - func_801A3238(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2); + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2); } else { prevDist = sqrtf(SQ(sRiverSoundBgmPos->z) + SQ(sRiverSoundBgmPos->x)); if (dist < prevDist) { @@ -4441,15 +4656,80 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A246C.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2544.s") +void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne) { + Audio_StartMorningSceneSequence(seqId); + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(4) << 0x10) | (u32)(dayMinusOne)); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A257C.s") +void Audio_StartMorningSceneSequence(u16 seqId) { + if (seqId != NA_BGM_AMBIENCE) { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_AMBIENCE) << 24) | ((0) << 16)); + Audio_StartSceneSequence(seqId); + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 0, 1); + } else { + Audio_PlayAmbience(AMBIENCE_ID_08); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A25E4.s") +void Audio_PlaySceneSequence(u16 seqId, u8 dayMinusOne) { + if (sRequestedSceneSeqId != seqId) { + if (seqId == NA_BGM_AMBIENCE) { + Audio_PlayAmbience(AMBIENCE_ID_08); + } else if ((seqId != NA_BGM_FINAL_HOURS) || (sPrevMainBgmSeqId == NA_BGM_DISABLED)) { + Audio_StartSceneSequence(seqId); + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(4) << 0x10) | + (u32)(dayMinusOne)); + } + sRequestedSceneSeqId = seqId; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2670.s") +void Audio_StartSceneSequence(u16 seqId) { + u8 fadeInDuration = 0; + u8 skipHarpIntro; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2778.s") + if ((sSeqFlags[sPrevSceneSeqId] & SEQ_FLAG_RESUME_PREV) && (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_RESUME)) { + // Resume the sequence from the point where it left off last time it was played in the scene + if ((sSeqResumePoint & 0x3F) != 0) { + fadeInDuration = 30; + } + + // Write the sequence resumePoint to resume from into ioPort 7 + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, fadeInDuration, 7, sSeqResumePoint); + + sSeqResumePoint = 0; + } else { + // Start the sequence from the beginning + + // Writes to ioPort 7. See `SEQ_FLAG_SKIP_HARP_INTRO` for writing a value of 1 to ioPort 7. + if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_SKIP_HARP_INTRO) { + skipHarpIntro = 1; + } else { + skipHarpIntro = (u8)SEQ_IO_VAL_NONE; + } + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, skipHarpIntro); + + if (!(sSeqFlags[seqId] & SEQ_FLAG_RESUME_PREV)) { + // Reset the sequence resumePoint + sSeqResumePoint = SEQ_RESUME_POINT_NONE; + } + } + sPrevSceneSeqId = seqId & 0xFF; +} + +void Audio_UpdateSceneSequenceResumePoint(void) { + u16 seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + + if ((seqId != NA_BGM_DISABLED) && (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_RESUME)) { + if (sSeqResumePoint != SEQ_RESUME_POINT_NONE) { + // Get the current point to resume from + sSeqResumePoint = gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3]; + } else { + // Initialize the point to resume from to the start of the sequence + sSeqResumePoint = 0; + } + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A27E8.s") @@ -4463,35 +4743,238 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2C44.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2C88.s") +void Audio_PlaySequenceInCutscene(u16 seqId) { + if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE) { + Audio_PlayFanfare(seqId); + } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_FANFARE) << 24) | ((u32)(0) << 0x10) | (u32)(seqId)); + } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_NO_AMBIENCE) { + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(0) << 0x10) | (u32)(seqId)); + } else { + Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, SEQ_IO_VAL_NONE); + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 1, 0x7F, 0); + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, 0); + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2D54.s") +void Audio_StopSequenceInCutscene(u16 seqId) { + if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE) { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_FANFARE) << 24) | ((0) << 16)); + } else if (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_NO_AMBIENCE) { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_SUB) << 24) | ((0) << 16)); + } else { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_MAIN) << 24) | ((0) << 16)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_IsSequencePlaying.s") +s32 Audio_IsSequencePlaying(u8 seqId) { + u8 playerIndex = SEQ_PLAYER_BGM_MAIN; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2E54.s") + if (sSeqFlags[seqId & 0xFF] & SEQ_FLAG_FANFARE) { + playerIndex = SEQ_PLAYER_FANFARE; + } else if (sSeqFlags[seqId & 0xFF] & SEQ_FLAG_FANFARE_KAMARO) { + playerIndex = SEQ_PLAYER_FANFARE; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2ED8.s") + if (seqId == (Audio_GetActiveSequence(playerIndex) & 0xFF)) { + return true; + } else { + return false; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2F88.s") +void Audio_PlayBgm_StorePrevBgm(u16 seqId) { + u16 curSeqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A2FC4.s") + if (curSeqId == NA_BGM_DISABLED) { + curSeqId = NA_BGM_GENERAL_SFX; + } + + if (curSeqId != seqId) { + Audio_SetSequenceMode(SEQ_MODE_IGNORE); + + // Ensure the sequence about to be stored isn't also storing a separate sequence + if (!(sSeqFlags[curSeqId] & SEQ_FLAG_RESTORE)) { + sPrevMainBgmSeqId = curSeqId; + } + + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | (u32)(seqId + 0x8000)); + } +} + +/** + * To be used in conjunction with Audio_PlayBgm_StorePrevBgm + */ +void Audio_RestorePrevBgm(void) { + if ((Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && + (sSeqFlags[Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) & 0xFF] & SEQ_FLAG_RESTORE)) { + if ((sPrevMainBgmSeqId == NA_BGM_DISABLED) || (sPrevMainBgmSeqId == NA_BGM_GENERAL_SFX)) { + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_MAIN) << 24) | ((0) << 16)); + } else { + if (sPrevMainBgmSeqId == NA_BGM_AMBIENCE) { + sPrevMainBgmSeqId = sPrevAmbienceSeqId; + } + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | + (u32)(sPrevMainBgmSeqId + 0x8000)); + } + sPrevMainBgmSeqId = NA_BGM_DISABLED; + } +} + +// Unused +void Audio_PlayAmbience_StorePrevBgm(u8 ambienceId) { + u16 seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); + + if (seqId != NA_BGM_AMBIENCE) { + sPrevMainBgmSeqId = seqId; + } + + Audio_PlayAmbience(ambienceId); +} + +// Unused +void Audio_ForceRestorePreviousBgm(void) { + if (sPrevMainBgmSeqId != NA_BGM_DISABLED) { + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(0) << 0x10) | + (u32)(sPrevMainBgmSeqId + 0x8000)); + } + + sPrevMainBgmSeqId = NA_BGM_DISABLED; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3000.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3038.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3098.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_PlayFanfare.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A312C.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A31EC.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3238.s") +void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData) { + u16 flaggedSeqId; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A32CC.s") + Audio_QueueSeqCmd(0x70000000 | ((u32)(playerIndex) << 24) | ((u32)(ioPort) << 0x10) | (u32)(ioData)); + if ((seqId & 0xFF) < 2) { + flaggedSeqId = seqId; + } else { + flaggedSeqId = seqId | 0x8000; + } + Audio_QueueSeqCmd(0x00000000 | ((u32)(playerIndex) << 24) | ((u32)(fadeInDuration) << 0x10) | (u32)(flaggedSeqId)); +} -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3590.s") +void Audio_SetSequenceMode(u8 seqMode) { + s32 volumeFadeInTimer; + u16 seqId; + u8 volumeFadeOutTimer; + + if ((sPrevMainBgmSeqId == NA_BGM_DISABLED) && (sPrevMainBgmSeqId == NA_BGM_DISABLED)) { + // clang-format off + if (sAudioCutsceneFlag || sSpatialSeqIsActive[SEQ_PLAYER_BGM_SUB]) { \ + seqMode = SEQ_MODE_IGNORE; + } + // clang-format on + + seqId = gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId; + + if ((seqId == NA_BGM_DISABLED) || (sSeqFlags[(u8)(seqId & 0xFF)] & SEQ_FLAG_ENEMY) || + ((sPrevSeqMode & 0x7F) == SEQ_MODE_ENEMY)) { + if (seqMode != (sPrevSeqMode & 0x7F)) { + if (seqMode == SEQ_MODE_ENEMY) { + // If only seqMode = SEQ_MODE_ENEMY (Start) + if (gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume < 0) { + volumeFadeInTimer = -(gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume); + } else { + volumeFadeInTimer = gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume; + } + + Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 3, sBgmEnemyVolume, volumeFadeInTimer); + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(10) << 0x10) | + (u32)(NA_BGM_ENEMY | 0x800)); + + if (seqId >= NA_BGM_TERMINA_FIELD) { + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F - sBgmEnemyVolume, 10); + Audio_SplitBgmChannels(sBgmEnemyVolume); + } + } else if ((sPrevSeqMode & 0x7F) == SEQ_MODE_ENEMY) { + // If only sPrevSeqMode = SEQ_MODE_ENEMY (End) + Audio_QueueSeqCmd(0x100000FF | ((u8)(SEQ_PLAYER_BGM_SUB) << 24) | ((10) << 16)); + + if (seqMode == SEQ_MODE_IGNORE) { + volumeFadeOutTimer = 0; + } else { + volumeFadeOutTimer = 10; + } + + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, volumeFadeOutTimer); + Audio_SplitBgmChannels(0); + } + + sPrevSeqMode = seqMode + 0x80; + } else { + if (seqMode == SEQ_MODE_ENEMY) { + // If both seqMode = sPrevSeqMode = SEQ_MODE_ENEMY + if ((Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) == NA_BGM_DISABLED) && + (seqId != NA_BGM_DISABLED) && (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_ENEMY)) { + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_BGM_SUB) << 24) | ((u32)(10) << 0x10) | + (u32)(NA_BGM_ENEMY | 0x800)); + sPrevSeqMode = seqMode + 0x80; + } + } + } + } else { + // Remnant of OoT's Hyrule Field Sequence + if (seqMode == SEQ_MODE_DEFAULT) { + if (sPrevSeqMode == SEQ_MODE_STILL) { + sNumFramesMoving = 0; + } + sNumFramesStill = 0; + sNumFramesMoving++; + } else { + sNumFramesStill++; + } + + if ((seqMode == SEQ_MODE_STILL) && (sNumFramesStill < 30) && (sNumFramesMoving > 20)) { + seqMode = SEQ_MODE_DEFAULT; + } + + sPrevSeqMode = seqMode; + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_BGM_MAIN) << 24) | ((u32)(2) << 0x10) | (u32)(seqMode)); + } + } +} + +void Audio_UpdateEnemyBgmVolume(f32 dist) { + f32 adjDist; + u16 seqId = gActiveSeqs[SEQ_PLAYER_BGM_MAIN].seqId; + + if (sPrevSeqMode == (SEQ_MODE_ENEMY | 0x80)) { + if (dist != sBgmEnemyDist) { + // clamp (dist - 150.0f) between 0 and 350 + if (dist < 150.0f) { + adjDist = 0.0f; + } else if (dist > 500.0f) { + adjDist = 350.0f; + } else { + adjDist = dist - 150.0f; + } + + sBgmEnemyVolume = ((350.0f - adjDist) * 127.0f) / 350.0f; + Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, 3, sBgmEnemyVolume, 10); + + if ((seqId >= NA_BGM_TERMINA_FIELD) && !(sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_FANFARE_KAMARO)) { + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, (0x7F - sBgmEnemyVolume), 10); + } + } + + Audio_SplitBgmChannels(sBgmEnemyVolume); + } + sBgmEnemyDist = dist; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A36F0.s") @@ -4521,7 +5004,9 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3EC0.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SetCutsceneFlag.s") +void Audio_SetCutsceneFlag(s8 flag) { + sAudioCutsceneFlag = flag; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3F6C.s") @@ -4529,7 +5014,7 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A3FFC.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/audio_setBGM.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SetSpec.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4058.s") @@ -4551,7 +5036,9 @@ void Audio_ClearSariaBgm2(void) { #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_PreNMI.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A44C4.s") +void Audio_ResetRequestedSceneSeqId(void) { + sRequestedSceneSeqId = NA_BGM_DISABLED; +} #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A44D4.s") @@ -4562,14 +5049,111 @@ f32 sSfxOriginalPos[] = { 0.0f, 0.0f, 0.0f }; #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A479C.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A47DC.s") +void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData) { + u8 firstChannelIndex; + u8 lastChannelIndex; + u8 channelIndex; -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A48E0.s") + if ((gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId != NA_BGM_AMBIENCE) && func_801A8ABC(NA_BGM_AMBIENCE, 0xF00000FF)) { + return; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4A28.s") + // channelIndexRange = 01 on ioPort 1 + if ((((channelIndexRange << 8) + (u32)ioPort) == ((1 << 8) | (u32)1)) && + (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) != NA_BGM_ROMANI_RANCH)) { + D_801FD3A8 = 0; + } -u32 Audio_SetNatureAmbienceRandomBend(u8 seqScriptValIn, SequenceChannel* channel); -#pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/Audio_SetNatureAmbienceRandomBend.s") + firstChannelIndex = channelIndexRange >> 4; + lastChannelIndex = channelIndexRange & 0xF; + + if (firstChannelIndex == 0) { + firstChannelIndex = channelIndexRange & 0xF; + } + + for (channelIndex = firstChannelIndex; channelIndex <= lastChannelIndex; channelIndex++) { + Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(ioPort) << 16) | + ((u32)(channelIndex) << 8) | (u32)(ioData)); + } +} + +void Audio_StartAmbience(u16 initChannelMask, u16 initMuteChannelMask) { + u8 channelIndex; + + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_0) << 0x10) | + (u32)(1)); + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_4) << 0x10) | + (u32)((u8)(initChannelMask >> 8))); + Audio_QueueSeqCmd(0x70000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(SEQ_PLAYER_IO_PORT_5) << 0x10) | + (u32)((u8)(initChannelMask & 0xFF))); + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 0, 0x7F, 1); + + if ((Audio_GetActiveSequence(SEQ_PLAYER_AMBIENCE) != NA_BGM_DISABLED) && + (Audio_GetActiveSequence(SEQ_PLAYER_AMBIENCE) != NA_BGM_AMBIENCE)) { + Audio_StopSequence(SEQ_PLAYER_AMBIENCE, 0); + AudioThread_QueueCmdS32(0xF8 << 24, 0); + } + + if (Audio_GetActiveSequence(SEQ_PLAYER_BGM_SUB) == (NA_BGM_ENEMY | 0x800)) { + Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, 1); + } + + Audio_QueueSeqCmd(0x00000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(0) << 0x10) | (u32)(NA_BGM_AMBIENCE)); + + for (channelIndex = 0; channelIndex < 16; channelIndex++) { + if (!(initMuteChannelMask & (1 << channelIndex)) && (initChannelMask & (1 << channelIndex))) { + Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(CHANNEL_IO_PORT_1) << 16) | + ((u32)(channelIndex) << 8) | (u32)(1)); + } + } +} + +void Audio_PlayAmbience(u8 ambienceId) { + u8 i = 0; + u8 channelIndex; + u8 ioPort; + u8 ioData; + + if (!((gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId != NA_BGM_DISABLED) && + (sSeqFlags[gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId & 0xFF & 0xFF] & SEQ_FLAG_NO_AMBIENCE))) { + if (gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId != NA_BGM_AMBIENCE) { + sPrevAmbienceSeqId = gActiveSeqs[SEQ_PLAYER_AMBIENCE].seqId; + } + + Audio_StartAmbience(sAmbienceData[ambienceId].initChannelMask, sAmbienceData[ambienceId].initMuteChannelMask); + + while ((sAmbienceData[ambienceId].channelProperties[i] != 0xFF) && + (i < ARRAY_COUNT(sAmbienceData[ambienceId].channelProperties))) { + channelIndex = sAmbienceData[ambienceId].channelProperties[i++]; + ioPort = sAmbienceData[ambienceId].channelProperties[i++]; + ioData = sAmbienceData[ambienceId].channelProperties[i++]; + Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(ioPort) << 16) | + ((u32)(channelIndex) << 8) | (u32)(ioData)); + } + + Audio_QueueSeqCmd(0x80000000 | ((u32)(SEQ_PLAYER_AMBIENCE) << 24) | ((u32)(CHANNEL_IO_PORT_7) << 16) | + ((u32)(AMBIENCE_CHANNEL_SOUND_MODE) << 8) | (u32)(sSoundMode)); + } +} + +u32 Audio_SetAmbienceRandomBend(u8 seqScriptValIn, SequenceChannel* channel) { + u32 seqScriptValOut = seqScriptValIn; + + gAudioContext.seqPlayers[SEQ_PLAYER_AMBIENCE].applyBend = true; + + if ((seqScriptValIn == 0) || (seqScriptValIn == 0xFF)) { + gAudioContext.seqPlayers[SEQ_PLAYER_AMBIENCE].bend = 1.0f; + } else { + seqScriptValOut = AudioThread_NextRandom(); + gAudioContext.seqPlayers[SEQ_PLAYER_AMBIENCE].bend = 1.0293 - ((gAudioContext.audioRandom & 0xF) / 144.0f); + + return seqScriptValOut; + } + +#ifdef AVOID_UB + return seqScriptValOut; +#endif +} void Audio_Init(void) { AudioLoad_Init(NULL, 0); @@ -4587,7 +5171,7 @@ void AudioSfx_Init(u16 fadeTimer) { } AudioThread_QueueCmdS32(0xE4000000, AudioSfx_SetFreqAndStereoBits); - AudioThread_QueueCmdS32(0xE4000001, Audio_SetNatureAmbienceRandomBend); + AudioThread_QueueCmdS32(0xE4000001, Audio_SetAmbienceRandomBend); } #pragma GLOBAL_ASM("asm/non_matchings/code/code_8019AF00/func_801A4D00.s") diff --git a/src/code/audio/code_801A5BD0.c b/src/code/audio/code_801A5BD0.c index 4cf1147bf..d76970829 100644 --- a/src/code/audio/code_801A5BD0.c +++ b/src/code/audio/code_801A5BD0.c @@ -671,7 +671,7 @@ void AudioSfx_PlayActiveSfx(u8 bankId) { // "one-frame" sfx entry->state = SFX_STATE_PLAYING_ONE_FRAME; } - } else if ((u8)channel->soundScriptIO[1] == 0xFF) { + } else if ((u8)channel->soundScriptIO[1] == (u8)SEQ_IO_VAL_NONE) { // Signal from seq 0 that the sfx is finished playing. Remove entry AudioSfx_RemoveBankEntry(bankId, entryIndex); } else if (entry->state == SFX_STATE_PLAYING_REFRESH) { diff --git a/src/code/audio/code_801A7B10.c b/src/code/audio/code_801A7B10.c index f2f37a013..3f8446036 100644 --- a/src/code/audio/code_801A7B10.c +++ b/src/code/audio/code_801A7B10.c @@ -2,7 +2,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StartSequence.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7D04.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StopSequence.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7D84.s") @@ -10,7 +10,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A89D0.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8A50.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_GetActiveSequence.s") #pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8ABC.s") diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index a572e61ee..be13b050a 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -365,7 +365,7 @@ s16 gItemPrices[] = { }; // Used to map scene indexes to their region in Termina -u16 gScenesPerRegion[11][27] = { +u16 gSceneIdsPerRegion[11][27] = { // Great Bay { SCENE_30GYOSON, @@ -522,7 +522,7 @@ void Inventory_ChangeUpgrade(s16 upgrade, u32 value) { gSaveContext.save.inventory.upgrades = upgrades; } -s32 Inventory_IsMapVisible(s16 sceneNum) { +s32 Inventory_IsMapVisible(s16 sceneId) { s16 index = 0; /** @@ -530,30 +530,30 @@ s32 Inventory_IsMapVisible(s16 sceneNum) { * increment to the next index of scenesVisible so that every scene gets a unique flag in scenesVisible, * 224 bits were allocated to this although there are only 112 scenes */ - if (sceneNum >= 0x20) { - if (sceneNum < 0x40) { + if (sceneId >= 0x20) { + if (sceneId < 0x40) { index = 1; - } else if (sceneNum < 0x60) { + } else if (sceneId < 0x60) { index = 2; - } else if (sceneNum < 0x80) { + } else if (sceneId < 0x80) { index = 3; - } else if (sceneNum < 0xA0) { + } else if (sceneId < 0xA0) { index = 4; - } else if (sceneNum < 0xC0) { + } else if (sceneId < 0xC0) { index = 5; - } else if (sceneNum < 0xE0) { + } else if (sceneId < 0xE0) { index = 6; } } - if (gSaveContext.save.scenesVisible[index] & gBitFlags[sceneNum - (index << 5)]) { + if (gSaveContext.save.scenesVisible[index] & gBitFlags[sceneId - (index << 5)]) { return true; } return false; } -static u16 sScenesPerTingleMap[6][12] = { +static u16 sSceneIdsPerTingleMap[6][12] = { { // Clock Town Tingle Map SCENE_00KEIKOKU, @@ -630,11 +630,11 @@ static u16 sScenesPerTingleMap[6][12] = { void Inventory_SetMapVisibility(s16 tingleIndex) { s16 i = 0; s16 index = 0; - u16(*tingleMapSceneIndices)[] = &sScenesPerTingleMap[tingleIndex]; + u16(*tingleMapSceneIds)[] = &sSceneIdsPerTingleMap[tingleIndex]; if ((tingleIndex >= 0) && (tingleIndex < 6)) { while (true) { - if ((*tingleMapSceneIndices)[i] == 0xFFFF) { + if ((*tingleMapSceneIds)[i] == 0xFFFF) { break; } @@ -643,38 +643,38 @@ void Inventory_SetMapVisibility(s16 tingleIndex) { * increment to the next index of scenesVisible so that every scene gets a unique flag in scenesVisible, * 224 bits were allocated to this although there are only 112 scenes */ - if (((s16)(*tingleMapSceneIndices)[i]) < 0x20) { + if (((s16)(*tingleMapSceneIds)[i]) < 0x20) { index = 0; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0x40) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0x40) { index = 1; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0x60) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0x60) { index = 2; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0x80) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0x80) { index = 3; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0xA0) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0xA0) { index = 4; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0xC0) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0xC0) { index = 5; - } else if (((s16)(*tingleMapSceneIndices)[i]) < 0xE0) { + } else if (((s16)(*tingleMapSceneIds)[i]) < 0xE0) { index = 6; } gSaveContext.save.scenesVisible[index] = - gSaveContext.save.scenesVisible[index] | gBitFlags[(s16)(*tingleMapSceneIndices)[i] - (index << 5)]; + gSaveContext.save.scenesVisible[index] | gBitFlags[(s16)(*tingleMapSceneIds)[i] - (index << 5)]; i++; } - if ((*tingleMapSceneIndices) == sScenesPerTingleMap[0]) { + if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[0]) { gSaveContext.save.mapsVisible |= 3; - } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[1]) { + } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[1]) { gSaveContext.save.mapsVisible |= 0x1C; - } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[2]) { + } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[2]) { gSaveContext.save.mapsVisible |= 0xE0; - } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[3]) { + } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[3]) { gSaveContext.save.mapsVisible |= 0x100; - } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[4]) { + } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[4]) { gSaveContext.save.mapsVisible |= 0x1E00; - } else if ((*tingleMapSceneIndices) == sScenesPerTingleMap[5]) { + } else if ((*tingleMapSceneIds) == sSceneIdsPerTingleMap[5]) { gSaveContext.save.mapsVisible |= 0x6000; } } diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 0bc978160..a22b62a0e 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -1,6 +1,6 @@ /** * File: flg_set.c - * Description: Event Editor, used to view and edit weekEventReg, eventInf and maskMaskBit flags. + * Description: Event Editor, used to view and edit weekEventReg, eventInf and masksGivenOnMoon flags. * Controls: * + Left and Right: select different flags/bits in array element * + Up and Down: select array element (byte) 1 up/down @@ -123,9 +123,9 @@ static FlagSetEntry sFlagEntries[] = { { &gSaveContext.eventInf[6], "event_inf[6]" }, { &gSaveContext.eventInf[7], "event_inf[7]" }, - { &gSaveContext.maskMaskBit[0], "mask_mask_bit[0]" }, - { &gSaveContext.maskMaskBit[1], "mask_mask_bit[1]" }, - { &gSaveContext.maskMaskBit[2], "mask_mask_bit[2]" }, + { &gSaveContext.masksGivenOnMoon[0], "mask_mask_bit[0]" }, + { &gSaveContext.masksGivenOnMoon[1], "mask_mask_bit[1]" }, + { &gSaveContext.masksGivenOnMoon[2], "mask_mask_bit[2]" }, { NULL, NULL }, // used in the code to detect array end }; diff --git a/src/code/game.c b/src/code/game.c index da21de17f..73352379f 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -225,7 +225,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g void GameState_Destroy(GameState* gameState) { AudioMgr_StopAllSfxExceptSystem(); - func_8019E014(); + Audio_Update(); osRecvMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK); if (gameState->destroy != NULL) { diff --git a/src/code/graph.c b/src/code/graph.c index c67bffd7e..f0d365d6c 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -232,7 +232,7 @@ void Graph_UpdateGame(GameState* gameState) { Game_UpdateInput(gameState); Game_IncrementFrameCount(gameState); if (SREG(20) < 3) { - func_8019E014(); + Audio_Update(); } } diff --git a/src/code/title_setup.c b/src/code/title_setup.c index 46e239787..374a7373a 100644 --- a/src/code/title_setup.c +++ b/src/code/title_setup.c @@ -27,7 +27,7 @@ void Setup_SetRegs(void) { XREG(88) = 86; XREG(89) = 600; XREG(90) = 450; - XREG(91) = 0; + R_STORY_FILL_SCREEN_ALPHA = 0; XREG(94) = 0; XREG(95) = 0; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 0195ac650..389f7a051 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -5,6 +5,7 @@ #include "global.h" #include "z64load.h" +#include "z64quake.h" #include "z64rumble.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #include "overlays/actors/ovl_En_Part/z_en_part.h" @@ -2235,7 +2236,7 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto s32 i; gSaveContext.save.weekEventReg[92] |= 0x80; - cycleFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(play->sceneNum)]; + cycleFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneId(play->sceneId)]; bzero(actorCtx, sizeof(ActorContext)); ActorOverlayTable_Init(); @@ -2252,8 +2253,8 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto actorCtx->sceneFlags.chest = cycleFlags->chest; actorCtx->sceneFlags.switches[0] = cycleFlags->switch0; actorCtx->sceneFlags.switches[1] = cycleFlags->switch1; - if (play->sceneNum == SCENE_INISIE_R) { - cycleFlags = &gSaveContext.cycleSceneFlags[play->sceneNum]; + if (play->sceneId == SCENE_INISIE_R) { + cycleFlags = &gSaveContext.cycleSceneFlags[play->sceneId]; } actorCtx->sceneFlags.collectible[0] = cycleFlags->collectible; actorCtx->sceneFlags.clearedRoom = cycleFlags->clearedRoom; @@ -3777,20 +3778,20 @@ void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -void func_800BC770(PlayState* play, s16 y, s16 countdown) { - s16 idx = Quake_Add(&play->mainCamera, 3); +void Actor_AddQuake(PlayState* play, s16 verticalMag, s16 countdown) { + s16 quakeIndex = Quake_Add(&play->mainCamera, QUAKE_TYPE_3); - Quake_SetSpeed(idx, 20000); - Quake_SetQuakeValues(idx, y, 0, 0, 0); - Quake_SetCountdown(idx, countdown); + Quake_SetSpeed(quakeIndex, 20000); + Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0); + Quake_SetCountdown(quakeIndex, countdown); } -void func_800BC7D8(PlayState* play, s16 y, s16 countdown, s16 speed) { - s16 idx = Quake_Add(&play->mainCamera, 3); +void Actor_AddQuakeWithSpeed(PlayState* play, s16 verticalMag, s16 countdown, s16 speed) { + s16 quakeIndex = Quake_Add(&play->mainCamera, QUAKE_TYPE_3); - Quake_SetSpeed(idx, speed); - Quake_SetQuakeValues(idx, y, 0, 0, 0); - Quake_SetCountdown(idx, countdown); + Quake_SetSpeed(quakeIndex, speed); + Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0); + Quake_SetCountdown(quakeIndex, countdown); } // Actor_RequestRumble? @@ -3800,7 +3801,7 @@ void func_800BC848(Actor* actor, PlayState* play, s16 y, s16 countdown) { } else { Rumble_Request(actor->xyzDistToPlayerSq, 180, 20, 100); } - func_800BC770(play, y, countdown); + Actor_AddQuake(play, y, countdown); } typedef struct { diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index f9b23ac79..7f4247b0d 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -47,7 +47,7 @@ u8 D_801B46C0[] = { /* 0x0E */ 1 }; -s16 sSmallMemScenes[] = { +s16 sSmallMemSceneIds[] = { SCENE_F01, }; @@ -1463,10 +1463,10 @@ u32 BgCheck_InitStaticLookup(CollisionContext* colCtx, PlayState* play, StaticLo * Returns whether the current scene should reserve less memory for it's collision lookup */ s32 BgCheck_IsSmallMemScene(PlayState* play) { - s16* i; + s16* sceneId; - for (i = sSmallMemScenes; i < sSmallMemScenes + ARRAY_COUNT(sSmallMemScenes); i++) { - if (play->sceneNum == *i) { + for (sceneId = sSmallMemSceneIds; sceneId < sSmallMemSceneIds + ARRAY_COUNT(sSmallMemSceneIds); sceneId++) { + if (play->sceneId == *sceneId) { return true; } } @@ -1505,7 +1505,7 @@ s32 BgCheck_GetSpecialSceneMaxObjects(PlayState* play, s32* maxNodes, s32* maxPo s32 i; for (i = 0; i < ARRAY_COUNT(sCustomDynapolyMem); i++) { - if (play->sceneNum == sCustomDynapolyMem[i].sceneId) { + if (play->sceneId == sCustomDynapolyMem[i].sceneId) { *maxNodes = sCustomDynapolyMem[i].maxNodes; *maxPolygons = sCustomDynapolyMem[i].maxPolygons; *maxVertices = sCustomDynapolyMem[i].maxVertices; @@ -1542,7 +1542,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader s32 useCustomSubdivisions; s32 i; - if (BgCheck_TryGetCustomMemsize(play->sceneNum, &customMemSize)) { + if (BgCheck_TryGetCustomMemsize(play->sceneId, &customMemSize)) { colCtx->memSize = customMemSize; } else { colCtx->memSize = 0x23000; @@ -1555,7 +1555,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader useCustomSubdivisions = false; for (i = 0; i < ARRAY_COUNT(sSceneSubdivisionList); i++) { - if (play->sceneNum == sSceneSubdivisionList[i].sceneId) { + if (play->sceneId == sSceneSubdivisionList[i].sceneId) { colCtx->subdivAmount.x = sSceneSubdivisionList[i].subdivAmount.x; colCtx->subdivAmount.y = sSceneSubdivisionList[i].subdivAmount.y; colCtx->subdivAmount.z = sSceneSubdivisionList[i].subdivAmount.z; @@ -4331,18 +4331,22 @@ s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* } /** - * SurfaceType Get Conveyor Surface Type - * Return type 0 (CONVEYOR_WATER) if 'poly' is a surface that will only move player underwater - * Return type 1 (CONVEYOR_FLOOR) if `poly` is a surface that must be stood on to move player + * Checks if poly is a floor conveyor + * + * A conveyor surface is enabled with non-zero speed. + * When enabled, the conveyor will exhibit two types of behaviour depending on the return value: + * + * If true, then it is a floor conveyor and will push player only while being stood on + * If false, then it is a water conveyor and will push player only while in water */ -s32 SurfaceType_GetConveyorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { +s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { u32 flags; if (BgCheck_GetCollisionHeader(colCtx, bgId) == NULL) { - return CONVEYOR_FLOOR; + return true; } if (poly == NULL) { - return CONVEYOR_WATER; + return false; } flags = poly->flags_vIB & 0x2000; return !!flags; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 027b78a4a..c26947b21 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1,4 +1,5 @@ #include "global.h" +#include "z64quake.h" /** * Returns the absolute value for floats diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index c970282a8..0e682231f 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -6,8 +6,8 @@ void SaveContext_Init(void) { bzero(&gSaveContext, sizeof(SaveContext)); gSaveContext.save.playerForm = 0; - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; gSaveContext.unk_3F46 = NA_BGM_GENERAL_SFX; gSaveContext.nextCutsceneIndex = 0xFFEF; gSaveContext.cutsceneTrigger = 0; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 69b015ff3..ea4a9828a 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,4 +1,5 @@ #include "global.h" +#include "z64quake.h" #include "z64rumble.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" @@ -152,7 +153,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c break; case 0x2: if (isStartFrame) { - func_801A47DC(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0); + Audio_SetAmbienceChannelIO(AMBIENCE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0); Environment_AddLightningBolts(play, 3); D_801F4E68 = 1; } @@ -191,7 +192,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c case 0x8: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG); if (isStartFrame) { - sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6); + sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); Quake_SetSpeed(sCutsceneQuakeIndex, 22000); Quake_SetQuakeValues(sCutsceneQuakeIndex, 6, 4, 0, 0); Quake_SetCountdown(sCutsceneQuakeIndex, 800); @@ -281,7 +282,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c case 0x1A: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG); if (isStartFrame) { - sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6); + sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); Quake_SetSpeed(sCutsceneQuakeIndex, 30000); Quake_SetQuakeValues(sCutsceneQuakeIndex, 20, 10, 0, 0); Quake_SetCountdown(sCutsceneQuakeIndex, 800); @@ -333,7 +334,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c case 0x24: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG); if (isStartFrame) { - sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6); + sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); Quake_SetSpeed(sCutsceneQuakeIndex, 22000); Quake_SetQuakeValues(sCutsceneQuakeIndex, 2, 1, 0, 0); Quake_SetCountdown(sCutsceneQuakeIndex, 800); @@ -376,14 +377,14 @@ void Cutscene_Command_SetLighting(PlayState* play, CutsceneContext* csCtx, CsCmd // Command 0x12C: Plays a sequence (Background music or Fanfare) void Cutscene_Command_PlaySequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) { if (csCtx->frames == cmd->startFrame) { - func_801A2C88(cmd->sequence - 1); + Audio_PlaySequenceInCutscene(cmd->sequence - 1); } } // Command 0x12D: Stops a sequence (Background music or Fanfare) void Cutscene_Command_StopSequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) { if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) { - func_801A2D54(cmd->sequence - 1); + Audio_StopSequenceInCutscene(cmd->sequence - 1); } } @@ -403,9 +404,7 @@ void Cutscene_Command_FadeSequence(PlayState* play, CutsceneContext* csCtx, CsCm // Command 0x12E: Play Ambience sequence void Cutscene_Command_PlayAmbienceSequence(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { if (csCtx->frames == cmd->startFrame) { - // Audio_PlayNatureAmbienceSequence - // nightSeqIndex is natureAmbienceId - func_801A4A28(play->soundCtx.nightSeqIndex); + Audio_PlayAmbience(play->sequenceCtx.ambienceId); } } @@ -455,29 +454,27 @@ void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { break; case 4: - // func_801A246C(SEQ_PLAYER_NATURE, TYPE_1); - func_801A246C(SEQ_PLAYER_NATURE, 1); + // func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_1); + func_801A246C(SEQ_PLAYER_AMBIENCE, 1); break; case 5: - // func_801A246C(SEQ_PLAYER_NATURE, TYPE_0); - func_801A246C(SEQ_PLAYER_NATURE, 0); + // func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_0); + func_801A246C(SEQ_PLAYER_AMBIENCE, 0); break; case 6: - // func_801A246C(SEQ_PLAYER_NATURE, TYPE_2); - func_801A246C(SEQ_PLAYER_NATURE, 2); + // func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_2); + func_801A246C(SEQ_PLAYER_AMBIENCE, 2); break; case 7: - // Audio_GetActiveSequence - seqId = func_801A8A50(0); + seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN); break; case 8: if (seqId != NA_BGM_DISABLED) { - // Audio_PlayBgmForDayScene - func_801A25E4(seqId, dayMinusOne); + Audio_PlaySceneSequence(seqId, dayMinusOne); } break; } @@ -647,7 +644,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB // Command 0x15F: Chooses between a cutscene or a rotating mask depending on whether the player has the corresponding // mask void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) { - if ((csCtx->frames >= cmd->startFrame) && (func_801A3950(0, true) != 0xFF)) { + if ((csCtx->frames >= cmd->startFrame) && (func_801A3950(SEQ_PLAYER_BGM_MAIN, true) != 0xFF)) { switch (cmd->base) { case 1: Cutscene_TerminatorImpl(play, csCtx, cmd); @@ -1500,7 +1497,7 @@ void func_800EDBE0(PlayState* play) { sp24 = play->loadedScene; if ((sp24->titleTextId != 0) && gSaveContext.showTitleCard) { if ((Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entrance) + - ((void)0, gSaveContext.sceneSetupIndex)) & + ((void)0, gSaveContext.sceneLayer)) & 0x4000) != 0) { func_80151A68(play, sp24->titleTextId); } @@ -1611,13 +1608,13 @@ void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, PlayState* play, s32 ac actor->shape.rot.y = actor->world.rot.y; } -s32 Cutscene_GetSceneSetupIndex(PlayState* play) { - s32 sceneSetupIndex = 0; +s32 Cutscene_GetSceneLayer(PlayState* play) { + s32 sceneLayer = 0; - if (gSaveContext.sceneSetupIndex > 0) { - sceneSetupIndex = gSaveContext.sceneSetupIndex; + if (gSaveContext.sceneLayer > 0) { + sceneLayer = gSaveContext.sceneLayer; } - return sceneSetupIndex; + return sceneLayer; } s32 Cutscene_GetActorActionIndex(PlayState* play, u16 actorActionCmd) { diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index 25d6f8ca8..11e4a2743 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -20,7 +20,7 @@ u16 ElfMessage_GetFirstCycleHint(PlayState* play) { if (gSaveContext.save.weekEventReg[9] & 1) { return 0x21E; } - if (play->sceneNum == SCENE_YOUSEI_IZUMI) { + if (play->sceneId == SCENE_YOUSEI_IZUMI) { return 0; } return 0x21D; @@ -29,7 +29,7 @@ u16 ElfMessage_GetFirstCycleHint(PlayState* play) { return 0x21F; } if (INV_CONTENT(ITEM_DEED_LAND) == ITEM_DEED_LAND) { - if (play->sceneNum != SCENE_OKUJOU) { + if (play->sceneId != SCENE_OKUJOU) { return 0x244; } return 0; diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 9fc3dee25..776dc75d7 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -46,8 +46,8 @@ void GameOver_Update(PlayState* play) { gSaveContext.unk_3DC0 = 2000; gSaveContext.save.playerData.tatlTimer = 0; - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; gSaveContext.eventInf[0] = 0; gSaveContext.eventInf[1] = 0; gSaveContext.eventInf[2] = 0; @@ -67,7 +67,7 @@ void GameOver_Update(PlayState* play) { gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND; break; case GAMEOVER_DEATH_FADE_OUT: - if (func_801A8A50(1) != NA_BGM_GAME_OVER) { + if (Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) != NA_BGM_GAME_OVER) { func_80169F78(&play->state); if (gSaveContext.respawnFlag != -7) { gSaveContext.respawnFlag = -6; diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index ffad44e6e..2b5eb1aac 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -5,7 +5,7 @@ s16 sMinimapInitPosX = 0; s16 sMinimapInitPosZ = 0; s16 sMinimapInitDir = 0; -s32 sDungeonAndBossScenes[] = { +s32 sDungeonAndBossSceneIds[] = { SCENE_MITURIN, SCENE_HAKUGIN, SCENE_SEA, SCENE_INISIE_N, SCENE_INISIE_R, SCENE_MITURIN_BS, SCENE_HAKUGIN_BS, SCENE_SEA_BS, SCENE_INISIE_BS, }; @@ -17,8 +17,8 @@ s32 sDungeonAndBossScenes[] = { s32 Map_GetDungeonOrBossAreaIndex(PlayState* play) { s32 i; - for (i = 0; i < ARRAY_COUNT(sDungeonAndBossScenes); i++) { - if (Play_GetOriginalSceneNumber(play->sceneNum) == sDungeonAndBossScenes[i]) { + for (i = 0; i < ARRAY_COUNT(sDungeonAndBossSceneIds); i++) { + if (Play_GetOriginalSceneId(play->sceneId) == sDungeonAndBossSceneIds[i]) { return i; } } @@ -45,7 +45,7 @@ s32 func_8010A0A4(PlayState* play) { return true; } -s32 sDungeonScenes[] = { +s32 sDungeonSceneIds[] = { SCENE_MITURIN, SCENE_HAKUGIN, SCENE_SEA, SCENE_INISIE_N, SCENE_INISIE_R, }; @@ -56,8 +56,8 @@ s32 sDungeonScenes[] = { s32 Map_GetDungeonAreaIndex(PlayState* play) { s32 i; - for (i = 0; i < ARRAY_COUNT(sDungeonScenes); i++) { - if (Play_GetOriginalSceneNumber(play->sceneNum) == sDungeonScenes[i]) { + for (i = 0; i < ARRAY_COUNT(sDungeonSceneIds); i++) { + if (Play_GetOriginalSceneId(play->sceneId) == sDungeonSceneIds[i]) { return i; } } @@ -76,7 +76,7 @@ s32 Map_IsInDungeonArea(PlayState* play) { return true; } -s32 sBossScenes[] = { +s32 sBossSceneIds[] = { SCENE_MITURIN_BS, // DUNGEON_INDEX_WOODFALL_TEMPLE SCENE_HAKUGIN_BS, // DUNGEON_INDEX_SNOWHEAD_TEMPLE SCENE_SEA_BS, // DUNGEON_INDEX_GREAT_BAY_TEMPLE @@ -90,8 +90,8 @@ s32 sBossScenes[] = { s32 Map_GetBossAreaIndex(PlayState* play) { s32 i; - for (i = 0; i < ARRAY_COUNT(sBossScenes); i++) { - if (Play_GetOriginalSceneNumber(play->sceneNum) == sBossScenes[i]) { + for (i = 0; i < ARRAY_COUNT(sBossSceneIds); i++) { + if (Play_GetOriginalSceneId(play->sceneId) == sBossSceneIds[i]) { return i; } } @@ -120,7 +120,7 @@ s32 func_8010A238(PlayState* play) { s32 i; for (i = 0; i < ARRAY_COUNT(D_801BF5A4); i++) { - if (Play_GetOriginalSceneNumber(play->sceneNum) == D_801BF5A4[i]) { + if (Play_GetOriginalSceneId(play->sceneId) == D_801BF5A4[i]) { return i; } } @@ -156,7 +156,7 @@ void Map_InitRoomData(PlayState* play, s16 room) { if (room >= 0) { if (Map_IsInDungeonOrBossArea(play)) { - gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneNumber(play->sceneNum)].rooms |= gBitFlags[room]; + gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].rooms |= gBitFlags[room]; interfaceCtx->mapRoomNum = room; interfaceCtx->dungeonOrBossAreaMapIndex = mapIndex; } @@ -189,7 +189,7 @@ void Map_Init(PlayState* play) { if (Map_IsInDungeonOrBossArea(play)) { dungeonIndex = Map_GetDungeonOrBossAreaIndex(play); gSaveContext.mapIndex = dungeonIndex; - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_MITURIN_BS: dungeonIndex = DUNGEON_INDEX_WOODFALL_TEMPLE; break; @@ -243,7 +243,7 @@ void Map_Update(PlayState* play) { if (Map_IsInDungeonArea(play)) { floor = func_80109124(player->actor.world.pos.y); if (floor != -1) { - gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneNumber(play->sceneNum)].unk_14 |= + gSaveContext.save.permanentSceneFlags[Play_GetOriginalSceneId(play->sceneId)].unk_14 |= gBitFlags[FLOOR_INDEX_MAX - floor]; XREG(94) = FLOOR_INDEX_MAX - floor; if (interfaceCtx->mapRoomNum != sLastRoomNum) { diff --git a/src/code/z_message.c b/src/code/z_message.c index c93a0e037..df9d160a2 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -267,7 +267,7 @@ void func_8014D62C(PlayState* play, s32* arg1, f32* arg2, s16* arg3) { s16 phi_v0; s16 phi_s0; - if ((func_8010A0A4(play) != 0) || (play->sceneNum == 0x4F)) { + if ((func_8010A0A4(play) != 0) || (play->sceneId == SCENE_SECOM)) { phi_v0 = 0xA; } else { phi_v0 = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index 1ac301f20..fef293b46 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -254,7 +254,7 @@ void Message_LoadAreaTextNES(PlayState* play, s32* offset, f32* arg2, s16* decod s16 currentArea; s16 stringLimit; - if ((func_8010A0A4(play) != 0) || (play->sceneNum == SCENE_SECOM)) { + if ((func_8010A0A4(play) != 0) || (play->sceneId == SCENE_SECOM)) { currentArea = 10; } else { currentArea = play->pauseCtx.cursorPoint[PAUSE_WORLD_MAP]; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 449576e73..70cf0732d 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -974,7 +974,7 @@ void Interface_UpdateHudAlphas(PlayState* play, s16 dimmingAlpha) { interfaceCtx->magicAlpha = risingAlpha; } - if (play->sceneNum == SCENE_SPOT00) { + if (play->sceneId == SCENE_SPOT00) { if (interfaceCtx->minimapAlpha < 170) { interfaceCtx->minimapAlpha = risingAlpha; } else { @@ -1576,7 +1576,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) { } } } - } else if ((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 6)) { + } else if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 6)) { for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { if (gSaveContext.buttonStatus[i] == BTN_ENABLED) { restoreHudVisibility = true; @@ -1824,7 +1824,7 @@ void Interface_UpdateButtonsPart2(PlayState* play) { gSaveContext.buttonStatus[i] = BTN_ENABLED; } } else if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_MASK_GIANT) { - if (play->sceneNum != SCENE_INISIE_BS) { + if (play->sceneId != SCENE_INISIE_BS) { if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { gSaveContext.buttonStatus[i] = BTN_DISABLED; restoreHudVisibility = true; @@ -1834,9 +1834,9 @@ void Interface_UpdateButtonsPart2(PlayState* play) { gSaveContext.buttonStatus[i] = BTN_ENABLED; } } else if (GET_CUR_FORM_BTN_ITEM(i) == ITEM_MASK_FIERCE_DEITY) { - if ((play->sceneNum != SCENE_MITURIN_BS) && (play->sceneNum != SCENE_HAKUGIN_BS) && - (play->sceneNum != SCENE_SEA_BS) && (play->sceneNum != SCENE_INISIE_BS) && - (play->sceneNum != SCENE_LAST_BS)) { + if ((play->sceneId != SCENE_MITURIN_BS) && (play->sceneId != SCENE_HAKUGIN_BS) && + (play->sceneId != SCENE_SEA_BS) && (play->sceneId != SCENE_INISIE_BS) && + (play->sceneId != SCENE_LAST_BS)) { if (gSaveContext.buttonStatus[i] != BTN_DISABLED) { gSaveContext.buttonStatus[i] = BTN_DISABLED; restoreHudVisibility = true; @@ -1967,7 +1967,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) != ITEM_NONE) { if ((player->transformation == PLAYER_FORM_DEKU) && (gSaveContext.save.weekEventReg[8] & 1)) { gSaveContext.hudVisibilityForceButtonAlphasByStatus = true; - if (play->sceneNum == SCENE_BOWLING) { + if (play->sceneId == SCENE_BOWLING) { if (gSaveContext.buttonStatus[EQUIP_SLOT_B] == BTN_DISABLED) { gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; @@ -1991,7 +1991,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; - if (play->sceneNum == SCENE_BOWLING) { + if (play->sceneId == SCENE_BOWLING) { if (CURRENT_DAY == 1) { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOMBCHU; } else if (CURRENT_DAY == 2) { @@ -2025,8 +2025,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { Interface_SetHudVisibility(HUD_VISIBILITY_NONE); } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && - (Cutscene_GetSceneSetupIndex(play) != 0) && - (play->transitionTrigger == TRANS_TRIGGER_OFF)) { + (Cutscene_GetSceneLayer(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && (gSaveContext.eventInf[3] & 0x20)) { @@ -2050,7 +2049,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); } - if (play->sceneNum == SCENE_BOWLING) { + if (play->sceneId == SCENE_BOWLING) { if (CURRENT_DAY == 1) { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOMBCHU; } else if (CURRENT_DAY == 2) { @@ -2087,7 +2086,7 @@ void Interface_UpdateButtonsPart1(PlayState* play) { Interface_SetHudVisibility(HUD_VISIBILITY_NONE); } else if ((gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && - (Cutscene_GetSceneSetupIndex(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { + (Cutscene_GetSceneLayer(play) != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { Interface_SetHudVisibility(HUD_VISIBILITY_A_B_MINIMAP); } else if (gSaveContext.minigameStatus == MINIGAME_STATUS_ACTIVE) { Interface_SetHudVisibility(HUD_VISIBILITY_B); @@ -2202,7 +2201,7 @@ void Interface_SetSceneRestrictions(PlayState* play) { u8 currentScene; do { - currentScene = (u8)play->sceneNum; + currentScene = (u8)play->sceneId; if (sRestrictionFlags[i].scene == currentScene) { interfaceCtx->restrictions.hGauge = (sRestrictionFlags[i].flags1 & 0xC0) >> 6; interfaceCtx->restrictions.bButton = (sRestrictionFlags[i].flags1 & 0x30) >> 4; @@ -2302,7 +2301,7 @@ u8 Item_Give(PlayState* play, u8 item) { if (item == ITEM_SKULL_TOKEN) { SET_QUEST_ITEM(item - ITEM_SKULL_TOKEN + QUEST_SKULL_TOKEN); - Inventory_IncrementSkullTokenCount(play->sceneNum); + Inventory_IncrementSkullTokenCount(play->sceneId); return ITEM_NONE; } else if (item == ITEM_TINGLE_MAP) { @@ -3484,7 +3483,7 @@ void Magic_Update(PlayState* play) { // Add magic until magicFillTarget is reached gSaveContext.save.playerData.magic += 0x10; - if ((gSaveContext.gameMode == 0) && (gSaveContext.sceneSetupIndex < 4)) { + if ((gSaveContext.gameMode == 0) && (gSaveContext.sceneLayer < 4)) { play_sound(NA_SE_SY_GAUGE_UP - SFX_FLAG); } @@ -3955,8 +3954,8 @@ void func_80118084(PlayState* play) { gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - if ((play->sceneNum != SCENE_SYATEKI_MIZU) && (play->sceneNum != SCENE_SYATEKI_MORI) && - (play->sceneNum != SCENE_BOWLING) && + if ((play->sceneId != SCENE_SYATEKI_MIZU) && (play->sceneId != SCENE_SYATEKI_MORI) && + (play->sceneId != SCENE_BOWLING) && ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || (gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 0))) && ((gSaveContext.minigameStatus != MINIGAME_STATUS_ACTIVE) || @@ -5401,7 +5400,7 @@ void Interface_DrawTimers(PlayState* play) { } if ((interfaceCtx->minigameState == MINIGAME_STATE_COUNTDOWN_GO) || - (interfaceCtx->minigameState == MINIGAME_STATE_30)) { + (interfaceCtx->minigameState == MINIGAME_STATE_PLAYING)) { if (gSaveContext.timerStates[sTimerId] == TIMER_STATE_START) { gSaveContext.timerStates[sTimerId] = TIMER_STATE_COUNTING; } else { @@ -5509,7 +5508,7 @@ void Interface_DrawTimers(PlayState* play) { if (sTimerId == TIMER_ID_MOON_CRASH) { gSaveContext.save.day = 4; - if ((play->sceneNum == SCENE_OKUJOU) && (gSaveContext.sceneSetupIndex == 3)) { + if ((play->sceneId == SCENE_OKUJOU) && (gSaveContext.sceneLayer == 3)) { play->nextEntrance = ENTRANCE(TERMINA_FIELD, 1); gSaveContext.nextCutsceneIndex = 0xFFF0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -5538,7 +5537,7 @@ void Interface_DrawTimers(PlayState* play) { gSaveContext.timerStopTimes[sTimerId] = SECONDS_TO_TIMER(120); gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(120); } - } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneNum == SCENE_DEKUTES) && + } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES) && (gSaveContext.timerStopTimes[sTimerId] >= SECONDS_TO_TIMER(120))) { gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(120); } @@ -5638,7 +5637,7 @@ void Interface_DrawTimers(PlayState* play) { if (osTime >= SECONDS_TO_TIMER(120)) { osTime = SECONDS_TO_TIMER(120); } - } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneNum == SCENE_DEKUTES) && + } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES) && (osTime >= SECONDS_TO_TIMER(120))) { osTime = SECONDS_TO_TIMER(120); } @@ -5655,7 +5654,7 @@ void Interface_DrawTimers(PlayState* play) { play_sound(NA_SE_SY_WARNING_COUNT_E); sTimerBeepSfxSeconds = sTimerDigits[4]; } - } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneNum == SCENE_DEKUTES)) { + } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES)) { if ((((void)0, gSaveContext.timerCurTimes[sTimerId]) > (gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] - SECONDS_TO_TIMER(9))) && (sTimerBeepSfxSeconds != sTimerDigits[4])) { @@ -5692,7 +5691,7 @@ void Interface_DrawTimers(PlayState* play) { } else { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); } - } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneNum == SCENE_DEKUTES)) { + } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneId == SCENE_DEKUTES)) { if (((void)0, gSaveContext.timerCurTimes[sTimerId]) >= gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1]) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 50, 0, 255); @@ -5868,13 +5867,13 @@ void Interface_DrawMinigameIcons(PlayState* play) { gDPLoadTextureBlock(OVERLAY_DISP++, gBeaverRingIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 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); - } else if (play->sceneNum == SCENE_DOUJOU) { + } else if (play->sceneId == SCENE_DOUJOU) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 140, 50, interfaceCtx->bAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); gDPLoadTextureBlock(OVERLAY_DISP++, gSwordTrainingLogIconTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 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); - } else if (play->sceneNum == SCENE_30GYOSON) { + } else if (play->sceneId == SCENE_30GYOSON) { phi_a0 = 0x10; phi_a1 = 0x1E; sp3E = 0x18; @@ -5898,7 +5897,7 @@ void Interface_DrawMinigameIcons(PlayState* play) { gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - if (play->sceneNum == SCENE_30GYOSON) { + if (play->sceneId == SCENE_30GYOSON) { sp3E += 0x14; if (gSaveContext.save.playerData.healthCapacity > 0xA0) { sp3C = 0x57; @@ -5927,18 +5926,14 @@ void Interface_DrawMinigameIcons(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -// rupeeDigitsFirst -s16 D_801BFD1C[] = { 1, 0, 0, 0 }; -// rupeeDigitsCount -s16 D_801BFD24[] = { 2, 3, 3, 0 }; -// rupeeIconPrimColor -Color_RGB16 D_801BFD2C[] = { +s16 sRupeeDigitsFirst[] = { 1, 0, 0, 0 }; +s16 sRupeeDigitsCount[] = { 2, 3, 3, 0 }; +Color_RGB16 sRupeeCounterIconPrimColors[] = { { 200, 255, 100 }, { 170, 170, 255 }, { 255, 105, 105 }, }; -// rupeeIconEnvColor -Color_RGB16 D_801BFD40[] = { +Color_RGB16 sRupeeCounterIconEnvColors[] = { { 0, 80, 0 }, { 10, 10, 80 }, { 40, 10, 0 }, @@ -5956,17 +5951,18 @@ Color_RGB16 sMinigameCountdownPrimColors[] = { { 255, 100, 0 }, { 120, 170, 255 }, }; -// grandma's story pictures -s32 D_801BFD84[] = { +TexturePtr gStoryTextures[] = { gStoryMaskFestivalTex, gStoryGiantsLeavingTex, }; -// grandma's story TLUT -u32 D_801BFD8C[] = { +TexturePtr gStoryTLUTs[] = { gStoryMaskFestivalTLUT, gStoryGiantsLeavingTLUT, }; +// TODO: ucode.h? (see OoT) +#define SP_UCODE_DATA_SIZE 0x800 + void Interface_Draw(PlayState* play) { s32 pad; InterfaceContext* interfaceCtx = &play->interfaceCtx; @@ -5992,41 +5988,46 @@ void Interface_Draw(PlayState* play) { Interface_InitVertices(play); Interface_SetView2(interfaceCtx); - if (interfaceCtx->storyState == 2) { + // Draw Grandma's Story + if (interfaceCtx->storyLoadStatus == STORY_LOAD_STATUS_FINISHED) { gSPSegment(OVERLAY_DISP++, 0x07, interfaceCtx->storySegment); func_8012C628(play->state.gfxCtx); gDPSetTextureFilter(POLY_OPA_DISP++, G_TF_POINT); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); - gSPLoadUcodeEx(OVERLAY_DISP++, OS_K0_TO_PHYSICAL(gspS2DEX2_fifoTextStart), - OS_K0_TO_PHYSICAL(gspS2DEX2_fifoDataStart), 0x800); + // Load in Grandma's Story + gSPLoadUcodeL(OVERLAY_DISP++, gspS2DEX2_fifo); gfx = OVERLAY_DISP; - func_80172758(&gfx, D_801BFD84[interfaceCtx->storyType], D_801BFD8C[interfaceCtx->storyType], 0x140, 0xF0, - 2, 1, 0x8000, 0x100, 0.0f, 0.0f, 1.0f, 1.0f, 0); + func_80172758(&gfx, gStoryTextures[interfaceCtx->storyType], gStoryTLUTs[interfaceCtx->storyType], + SCREEN_WIDTH, SCREEN_HEIGHT, 2, 1, 0x8000, 0x100, 0.0f, 0.0f, 1.0f, 1.0f, 0); OVERLAY_DISP = gfx; + gSPLoadUcode(OVERLAY_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData()); - gSPLoadUcodeEx(OVERLAY_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData(), 0x800); gDPPipeSync(OVERLAY_DISP++); + + // Fill the screen with a black rectangle gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); gDPSetCombineMode(OVERLAY_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, XREG(91)); - gDPFillRectangle(OVERLAY_DISP++, 0, 0, 320, 240); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, R_STORY_FILL_SCREEN_ALPHA); + gDPFillRectangle(OVERLAY_DISP++, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } LifeMeter_Draw(play); func_8012C654(play->state.gfxCtx); - // Rupee Icon - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, D_801BFD2C[CUR_UPG_VALUE(4)].r, D_801BFD2C[CUR_UPG_VALUE(4)].g, - D_801BFD2C[CUR_UPG_VALUE(4)].b, interfaceCtx->magicAlpha); - gDPSetEnvColor(OVERLAY_DISP++, D_801BFD40[CUR_UPG_VALUE(4)].r, D_801BFD40[CUR_UPG_VALUE(4)].g, - D_801BFD40[CUR_UPG_VALUE(4)].b, 255); + // Draw Rupee Icon + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sRupeeCounterIconPrimColors[CUR_UPG_VALUE(4)].r, + sRupeeCounterIconPrimColors[CUR_UPG_VALUE(4)].g, + sRupeeCounterIconPrimColors[CUR_UPG_VALUE(4)].b, interfaceCtx->magicAlpha); + gDPSetEnvColor(OVERLAY_DISP++, sRupeeCounterIconEnvColors[CUR_UPG_VALUE(4)].r, + sRupeeCounterIconEnvColors[CUR_UPG_VALUE(4)].g, sRupeeCounterIconEnvColors[CUR_UPG_VALUE(4)].b, + 255); OVERLAY_DISP = Gfx_DrawRectTextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, 26, 206, 16, 16, 1 << 10, 1 << 10); - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_INISIE_N: case SCENE_INISIE_R: case SCENE_MITURIN: @@ -6102,7 +6103,7 @@ void Interface_Draw(PlayState* play) { TEXEL0, 0, PRIMITIVE, 0); counterDigits[2] = 0; - counterDigits[3] = Inventory_GetSkullTokenCount(play->sceneNum); + counterDigits[3] = Inventory_GetSkullTokenCount(play->sceneId); while (counterDigits[3] >= 10) { counterDigits[2]++; @@ -6164,8 +6165,8 @@ void Interface_Draw(PlayState* play) { counterDigits[2] -= 10; } - sp2CC = D_801BFD1C[CUR_UPG_VALUE(UPG_WALLET)]; - sp2C8 = D_801BFD24[CUR_UPG_VALUE(UPG_WALLET)]; + sp2CC = sRupeeDigitsFirst[CUR_UPG_VALUE(UPG_WALLET)]; + sp2C8 = sRupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)]; sp4C = interfaceCtx->magicAlpha; if (sp4C > 180) { @@ -6214,7 +6215,7 @@ void Interface_Draw(PlayState* play) { if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if ((interfaceCtx->minigameState != MINIGAME_STATE_NONE) && - (interfaceCtx->minigameState < MINIGAME_STATE_20)) { + (interfaceCtx->minigameState < MINIGAME_STATE_NO_COUNTDOWN_SETUP)) { // Minigame Countdown if (((u32)interfaceCtx->minigameState % 2) == 0) { @@ -6356,19 +6357,19 @@ void Interface_Draw(PlayState* play) { void Interface_LoadStory(PlayState* play, s32 block) { InterfaceContext* interfaceCtx = &play->interfaceCtx; - switch (interfaceCtx->storyState) { - case 0: + switch (interfaceCtx->storyLoadStatus) { + case STORY_LOAD_STATUS_REQUESTED: if (interfaceCtx->storySegment == NULL) { break; } osCreateMesgQueue(&interfaceCtx->storyMsgQueue, &interfaceCtx->storyMsgBuf, 1); DmaMgr_SendRequestImpl(&interfaceCtx->dmaRequest_184, interfaceCtx->storySegment, interfaceCtx->storyAddr, interfaceCtx->storySize, 0, &interfaceCtx->storyMsgQueue, NULL); - interfaceCtx->storyState = 1; + interfaceCtx->storyLoadStatus = STORY_LOAD_STATUS_WAITING; // fallthrough - case 1: + case STORY_LOAD_STATUS_WAITING: if (osRecvMesg(&interfaceCtx->storyMsgQueue, NULL, block) == 0) { - interfaceCtx->storyState = 2; + interfaceCtx->storyLoadStatus = STORY_LOAD_STATUS_FINISHED; } break; @@ -6485,7 +6486,7 @@ void Interface_Update(PlayState* play) { interfaceCtx->magicAlpha = risingAlpha; } - if (play->sceneNum == SCENE_SPOT00) { + if (play->sceneId == SCENE_SPOT00) { if (interfaceCtx->minimapAlpha < 170) { interfaceCtx->minimapAlpha = risingAlpha; } else { @@ -6591,10 +6592,10 @@ void Interface_Update(PlayState* play) { if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if (interfaceCtx->minigameState) { // != MINIGAME_STATE_NONE switch (interfaceCtx->minigameState) { - case MINIGAME_STATE_COUNTDOWN_START_3: // minigame countdown 3 - case MINIGAME_STATE_COUNTDOWN_START_2: // minigame countdown 2 - case MINIGAME_STATE_COUNTDOWN_START_1: // minigame countdown 1 - case MINIGAME_STATE_COUNTDOWN_START_GO: // minigame countdown Go! + case MINIGAME_STATE_COUNTDOWN_SETUP_3: // minigame countdown 3 + case MINIGAME_STATE_COUNTDOWN_SETUP_2: // minigame countdown 2 + case MINIGAME_STATE_COUNTDOWN_SETUP_1: // minigame countdown 1 + case MINIGAME_STATE_COUNTDOWN_SETUP_GO: // minigame countdown Go! interfaceCtx->minigameCountdownAlpha = 255; interfaceCtx->minigameCountdownScale = 100; interfaceCtx->minigameState++; @@ -6619,19 +6620,19 @@ void Interface_Update(PlayState* play) { case MINIGAME_STATE_COUNTDOWN_GO: interfaceCtx->minigameCountdownAlpha -= 10; if (interfaceCtx->minigameCountdownAlpha <= 150) { - interfaceCtx->minigameState = MINIGAME_STATE_30; + interfaceCtx->minigameState = MINIGAME_STATE_PLAYING; } break; - case MINIGAME_STATE_20: + case MINIGAME_STATE_NO_COUNTDOWN_SETUP: interfaceCtx->minigameCountdownAlpha = 0; interfaceCtx->minigameState++; break; - case MINIGAME_STATE_21: + case MINIGAME_STATE_NO_COUNTDOWN: interfaceCtx->minigameCountdownAlpha++; if (interfaceCtx->minigameCountdownAlpha >= 18) { - interfaceCtx->minigameState = MINIGAME_STATE_30; + interfaceCtx->minigameState = MINIGAME_STATE_PLAYING; } break; } @@ -6823,35 +6824,35 @@ void Interface_Update(PlayState* play) { Interface_UpdateBottleTimers(play); // Update Grandma's Story - if (interfaceCtx->unk_31A != 0) { - if (interfaceCtx->unk_31A == 1) { - interfaceCtx->storyState = 0; - interfaceCtx->unk_31A = 2; - XREG(91) = 0; + if (interfaceCtx->storyState != STORY_STATE_OFF) { + if (interfaceCtx->storyState == STORY_STATE_INIT) { + interfaceCtx->storyLoadStatus = STORY_LOAD_STATUS_REQUESTED; + interfaceCtx->storyState = STORY_STATE_IDLE; + R_STORY_FILL_SCREEN_ALPHA = 0; } Interface_AllocStory(play); - if (interfaceCtx->unk_31A == 3) { - interfaceCtx->unk_31A = 0; - interfaceCtx->storyState = 0; + if (interfaceCtx->storyState == STORY_STATE_DESTROY) { + interfaceCtx->storyState = STORY_STATE_OFF; + interfaceCtx->storyLoadStatus = STORY_LOAD_STATUS_REQUESTED; if (interfaceCtx->storySegment != NULL) { ZeldaArena_Free(interfaceCtx->storySegment); interfaceCtx->storySegment = NULL; } - } else if (interfaceCtx->unk_31A == 4) { - interfaceCtx->unk_31A = 2; - } else if (interfaceCtx->unk_31A == 5) { - XREG(91) += 10; - if (XREG(91) >= 250) { - XREG(91) = 255; - interfaceCtx->unk_31A = 2; + } else if (interfaceCtx->storyState == STORY_STATE_SETUP_IDLE) { + interfaceCtx->storyState = STORY_STATE_IDLE; + } else if (interfaceCtx->storyState == STORY_STATE_FADE_OUT) { + R_STORY_FILL_SCREEN_ALPHA += 10; + if (R_STORY_FILL_SCREEN_ALPHA >= 250) { + R_STORY_FILL_SCREEN_ALPHA = 255; + interfaceCtx->storyState = STORY_STATE_IDLE; } - } else if (interfaceCtx->unk_31A == 6) { - XREG(91) -= 10; - if (XREG(91) < 0) { - XREG(91) = 0; - interfaceCtx->unk_31A = 2; + } else if (interfaceCtx->storyState == STORY_STATE_FADE_IN) { + R_STORY_FILL_SCREEN_ALPHA -= 10; + if (R_STORY_FILL_SCREEN_ALPHA < 0) { + R_STORY_FILL_SCREEN_ALPHA = 0; + interfaceCtx->storyState = STORY_STATE_IDLE; } } } @@ -6948,12 +6949,12 @@ void Interface_Init(PlayState* play) { sPictographState = PICTOGRAPH_STATE_OFF; sPictographPhotoBeingTaken = false; - if ((play->sceneNum != SCENE_MITURIN_BS) && (play->sceneNum != SCENE_HAKUGIN_BS) && - (play->sceneNum != SCENE_SEA_BS) && (play->sceneNum != SCENE_INISIE_BS) && (play->sceneNum != SCENE_LAST_BS) && - (play->sceneNum != SCENE_MITURIN) && (play->sceneNum != SCENE_HAKUGIN) && (play->sceneNum != SCENE_SEA) && - (play->sceneNum != SCENE_INISIE_N) && (play->sceneNum != SCENE_INISIE_R) && - (play->sceneNum != SCENE_LAST_DEKU) && (play->sceneNum != SCENE_LAST_GORON) && - (play->sceneNum != SCENE_LAST_ZORA) && (play->sceneNum != SCENE_LAST_LINK)) { + if ((play->sceneId != SCENE_MITURIN_BS) && (play->sceneId != SCENE_HAKUGIN_BS) && (play->sceneId != SCENE_SEA_BS) && + (play->sceneId != SCENE_INISIE_BS) && (play->sceneId != SCENE_LAST_BS) && (play->sceneId != SCENE_MITURIN) && + (play->sceneId != SCENE_HAKUGIN) && (play->sceneId != SCENE_SEA) && (play->sceneId != SCENE_INISIE_N) && + (play->sceneId != SCENE_INISIE_R) && (play->sceneId != SCENE_LAST_DEKU) && + (play->sceneId != SCENE_LAST_GORON) && (play->sceneId != SCENE_LAST_ZORA) && + (play->sceneId != SCENE_LAST_LINK)) { gSaveContext.eventInf[5] &= (u8)~0x8; gSaveContext.eventInf[5] &= (u8)~0x10; diff --git a/src/code/z_play.c b/src/code/z_play.c index 5a60a615e..06ec9c21e 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,4 +1,5 @@ #include "global.h" +#include "z64quake.h" #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165460.s") @@ -302,38 +303,38 @@ Vec3s* Play_GetActorCsCamFuncData(PlayState* this, s32 csCamDataIndex) { * Converts the number of a scene to its "original" equivalent, the default version of the area which the player first * enters. */ -s16 Play_GetOriginalSceneNumber(s16 sceneNum) { +s16 Play_GetOriginalSceneId(s16 sceneId) { // Inverted Stone Tower Temple -> Stone Tower Temple - if (sceneNum == SCENE_INISIE_R) { + if (sceneId == SCENE_INISIE_R) { return SCENE_INISIE_N; } // Purified Southern Swamp -> Poisoned Sothern Swamp - if (sceneNum == SCENE_20SICHITAI2) { + if (sceneId == SCENE_20SICHITAI2) { return SCENE_20SICHITAI; } // Spring Mountain Village -> Winter Mountain Village - if (sceneNum == SCENE_10YUKIYAMANOMURA2) { + if (sceneId == SCENE_10YUKIYAMANOMURA2) { return SCENE_10YUKIYAMANOMURA; } // Spring Goron Village -> Winter Goron Village - if (sceneNum == SCENE_11GORONNOSATO2) { + if (sceneId == SCENE_11GORONNOSATO2) { return SCENE_11GORONNOSATO; } // Spring Path to Goron Village -> Winter Path to Goron Village - if (sceneNum == SCENE_17SETUGEN2) { + if (sceneId == SCENE_17SETUGEN2) { return SCENE_17SETUGEN; } // Inverted Stone Tower -> Stone Tower - if (sceneNum == SCENE_F41) { + if (sceneId == SCENE_F41) { return SCENE_F40; } - return sceneNum; + return sceneId; } /** @@ -344,13 +345,13 @@ void Play_SaveCycleSceneFlags(GameState* thisx) { PlayState* this = (PlayState*)thisx; CycleSceneFlags* cycleSceneFlags; - cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(this->sceneNum)]; + cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneId(this->sceneId)]; cycleSceneFlags->chest = this->actorCtx.sceneFlags.chest; cycleSceneFlags->switch0 = this->actorCtx.sceneFlags.switches[0]; cycleSceneFlags->switch1 = this->actorCtx.sceneFlags.switches[1]; - if (this->sceneNum == SCENE_INISIE_R) { // Inverted Stone Tower Temple - cycleSceneFlags = &gSaveContext.cycleSceneFlags[this->sceneNum]; + if (this->sceneId == SCENE_INISIE_R) { // Inverted Stone Tower Temple + cycleSceneFlags = &gSaveContext.cycleSceneFlags[this->sceneId]; } cycleSceneFlags->collectible = this->actorCtx.sceneFlags.collectible[0]; @@ -375,7 +376,7 @@ void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) PlayState* this = (PlayState*)thisx; Player* player = GET_PLAYER(this); - if (this->sceneNum != SCENE_KAKUSIANA) { // Grottos + if (this->sceneId != SCENE_KAKUSIANA) { // Grottos Play_SetRespawnData(&this->state, respawnMode, (u16)((void)0, gSaveContext.save.entrance), this->roomCtx.curRoom.num, playerParams, &player->actor.world.pos, player->actor.shape.rot.y); @@ -384,7 +385,7 @@ void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) // Override respawn data in Sakon's Hideout void func_80169ECC(PlayState* this) { - if (this->sceneNum == SCENE_SECOM) { + if (this->sceneId == SCENE_SECOM) { this->nextEntrance = ENTRANCE(IKANA_CANYON, 6); gSaveContext.respawnFlag = -7; } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index d1de60c7c..e0a73cafb 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -30,7 +30,7 @@ void func_80127B64(struct_801F58B0 arg0[], UNK_TYPE arg1, Vec3f* arg2); s32 func_801226E0(PlayState* play, s32 arg1) { if (arg1 == 0) { Play_SetupRespawnPoint(&play->state, RESPAWN_MODE_DOWN, 0xBFF); - if (play->sceneNum == SCENE_KAKUSIANA) { + if (play->sceneId == SCENE_KAKUSIANA) { return 1; } } diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 7caa0f426..2b66a39f8 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -1,7 +1,46 @@ #include "global.h" +#include "z64quake.h" + +typedef struct { + /* 0x00 */ s16 randIndex; + /* 0x02 */ s16 countdownMax; + /* 0x04 */ Camera* camera; + /* 0x08 */ u32 type; + /* 0x0C */ s16 verticalMag; + /* 0x0E */ s16 horizontalMag; + /* 0x10 */ s16 zoom; + /* 0x12 */ s16 rollOffset; + /* 0x14 */ Vec3s shakePlaneOffset; // angle deviations from shaking in the perpendicular plane + /* 0x1A */ s16 speed; + /* 0x1C */ s16 isShakePerpendicular; + /* 0x1E */ s16 countdown; + /* 0x20 */ s16 camId; +} QuakeRequest; // size = 0x24 + +typedef struct { + /* 0x0 */ PlayState* play; + /* 0x4 */ s32 type; // bitfield, highest set bit determines type + /* 0x8 */ s16 countdown; + /* 0xA */ s16 state; +} DistortionRequest; // size = 0xC + +typedef struct { + /* 0x00 */ Vec3f atOffset; + /* 0x0C */ Vec3f eyeOffset; + /* 0x18 */ s16 rollOffset; + /* 0x1A */ s16 zoom; +} ShakeInfo; // size = 0x1C + +typedef s16 (*QuakeCallbackFunc)(QuakeRequest*, ShakeInfo*); + +typedef enum { + /* 0 */ DISTORTION_INACTIVE, + /* 1 */ DISTORTION_ACTIVE, + /* 2 */ DISTORTION_SETUP +} DistortionState; QuakeRequest sQuakeRequest[4]; -DistortionContext sDistortionContext; +DistortionRequest sDistortionRequest; static s16 sIsQuakeInitialized = true; static s16 sQuakeRequestCount = 0; @@ -51,7 +90,7 @@ void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 verticalPert shake->zoom = req->zoom * verticalPertubation; } -s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) { +s16 Quake_CallbackType1(QuakeRequest* req, ShakeInfo* shake) { if (req->countdown > 0) { f32 perpendicularPertubation = Math_SinS(req->speed * req->countdown); @@ -61,7 +100,7 @@ s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) { return req->countdown; } -s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) { +s16 Quake_CallbackType5(QuakeRequest* req, ShakeInfo* shake) { if (req->countdown > 0) { f32 perpendicularPertubation = Math_SinS(req->speed * req->countdown); @@ -71,7 +110,7 @@ s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) { return req->countdown; } -s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) { +s16 Quake_CallbackType6(QuakeRequest* req, ShakeInfo* shake) { f32 perpendicularPertubation; req->countdown--; @@ -80,7 +119,7 @@ s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) { return 1; } -s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) { +s16 Quake_CallbackType3(QuakeRequest* req, ShakeInfo* shake) { if (req->countdown > 0) { f32 perpendicularPertubation = Math_SinS(req->speed * req->countdown) * ((f32)req->countdown / (f32)req->countdownMax); @@ -91,7 +130,7 @@ s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) { return req->countdown; } -s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) { +s16 Quake_CallbackType2(QuakeRequest* req, ShakeInfo* shake) { if (req->countdown > 0) { f32 perpendicularPertubation = Quake_Random(); @@ -101,7 +140,7 @@ s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) { return req->countdown; } -s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake) { +s16 Quake_CallbackType4(QuakeRequest* req, ShakeInfo* shake) { if (req->countdown > 0) { f32 perpendicularPertubation = Quake_Random() * ((f32)req->countdown / (f32)req->countdownMax); @@ -117,7 +156,7 @@ s16 Quake_GetFreeIndex(void) { s32 min = 0x10000; for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) { - if (sQuakeRequest[i].callbackIdx == 0) { + if (sQuakeRequest[i].type == 0) { ret = i; break; } @@ -131,43 +170,43 @@ s16 Quake_GetFreeIndex(void) { return ret; } -QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx) { - s16 idx = Quake_GetFreeIndex(); - QuakeRequest* req = &sQuakeRequest[idx]; +QuakeRequest* Quake_AddImpl(Camera* camera, u32 type) { + s16 index = Quake_GetFreeIndex(); + QuakeRequest* req = &sQuakeRequest[index]; __osMemset(req, 0, sizeof(QuakeRequest)); req->camera = camera; req->camId = camera->camId; - req->callbackIdx = callbackIdx; + req->type = type; req->isShakePerpendicular = true; - req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx; + req->randIndex = ((s16)(Rand_ZeroOne() * 0x10000) & ~3) + index; sQuakeRequestCount++; return req; } -void Quake_Remove(QuakeRequest* req) { - req->callbackIdx = 0; +void Quake_RemoveRequest(QuakeRequest* req) { + req->type = 0; req->countdown = -1; sQuakeRequestCount--; } -QuakeRequest* Quake_GetRequest(s16 idx) { - QuakeRequest* req = &sQuakeRequest[idx & 3]; +QuakeRequest* Quake_GetRequest(s16 quakeIndex) { + QuakeRequest* req = &sQuakeRequest[quakeIndex & 3]; - if (req->callbackIdx == 0) { + if (req->type == 0) { return NULL; } - if (idx != req->randIdx) { + if (quakeIndex != req->randIndex) { return NULL; } return req; } -u32 Quake_SetValue(s16 idx, s16 valueType, s16 value) { - QuakeRequest* req = Quake_GetRequest(idx); +u32 Quake_SetValue(s16 quakeIndex, s16 valueType, s16 value) { + QuakeRequest* req = Quake_GetRequest(quakeIndex); if (req == NULL) { return false; @@ -176,62 +215,75 @@ u32 Quake_SetValue(s16 idx, s16 valueType, s16 value) { case QUAKE_SPEED: req->speed = value; break; + case QUAKE_VERTICAL_MAG: req->verticalMag = value; break; + case QUAKE_HORIZONTAL_MAG: req->horizontalMag = value; break; + case QUAKE_ZOOM: req->zoom = value; break; + case QUAKE_ROLL_OFFSET: req->rollOffset = value; break; + case QUAKE_SHAKE_PLANE_OFFSET_X: req->shakePlaneOffset.x = value; break; + case QUAKE_SHAKE_PLANE_OFFSET_Y: req->shakePlaneOffset.y = value; break; + case QUAKE_SHAKE_PLANE_OFFSET_Z: req->shakePlaneOffset.z = value; break; + case QUAKE_COUNTDOWN: req->countdown = value; req->countdownMax = req->countdown; break; + case QUAKE_IS_SHAKE_PERPENDICULAR: req->isShakePerpendicular = value; break; + + default: + break; } + return true; } } -u32 Quake_SetSpeed(s16 idx, s16 value) { - QuakeRequest* req = Quake_GetRequest(idx); +u32 Quake_SetSpeed(s16 quakeIndex, s16 speed) { + QuakeRequest* req = Quake_GetRequest(quakeIndex); if (req != NULL) { - req->speed = value; + req->speed = speed; return true; } return false; } -u32 Quake_SetCountdown(s16 idx, s16 value) { - QuakeRequest* req = Quake_GetRequest(idx); +u32 Quake_SetCountdown(s16 quakeIndex, s16 countdown) { + QuakeRequest* req = Quake_GetRequest(quakeIndex); if (req != NULL) { - req->countdown = value; + req->countdown = countdown; req->countdownMax = req->countdown; return true; } return false; } -s16 Quake_GetCountdown(s16 idx) { - QuakeRequest* req = Quake_GetRequest(idx); +s16 Quake_GetCountdown(s16 quakeIndex) { + QuakeRequest* req = Quake_GetRequest(quakeIndex); if (req != NULL) { return req->countdown; @@ -239,8 +291,8 @@ s16 Quake_GetCountdown(s16 idx) { return 0; } -u32 Quake_SetQuakeValues(s16 idx, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset) { - QuakeRequest* req = Quake_GetRequest(idx); +u32 Quake_SetQuakeValues(s16 quakeIndex, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset) { + QuakeRequest* req = Quake_GetRequest(quakeIndex); if (req != NULL) { req->verticalMag = verticalMag; @@ -252,8 +304,8 @@ u32 Quake_SetQuakeValues(s16 idx, s16 verticalMag, s16 horizontalMag, s16 zoom, return false; } -u32 Quake_SetQuakeValues2(s16 idx, s16 isShakePerpendicular, Vec3s shakePlaneOffset) { - QuakeRequest* req = Quake_GetRequest(idx); +u32 Quake_SetQuakeValues2(s16 quakeIndex, s16 isShakePerpendicular, Vec3s shakePlaneOffset) { + QuakeRequest* req = Quake_GetRequest(quakeIndex); if (req != NULL) { req->isShakePerpendicular = isShakePerpendicular; @@ -267,29 +319,35 @@ void Quake_Init(void) { s16 i; for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) { - sQuakeRequest[i].callbackIdx = 0; + sQuakeRequest[i].type = 0; sQuakeRequest[i].countdown = 0; } sIsQuakeInitialized = true; sQuakeRequestCount = 0; } -s16 Quake_Add(Camera* camera, u32 callbackIdx) { - return Quake_AddImpl(camera, callbackIdx)->randIdx; +s16 Quake_Add(Camera* camera, u32 type) { + return Quake_AddImpl(camera, type)->randIndex; } -u32 Quake_RemoveFromIdx(s16 idx) { - QuakeRequest* req = Quake_GetRequest(idx); +u32 Quake_Remove(s16 index) { + QuakeRequest* req = Quake_GetRequest(index); if (req != NULL) { - Quake_Remove(req); + Quake_RemoveRequest(req); return true; } return false; } static QuakeCallbackFunc sQuakeCallbacks[] = { - NULL, Quake_Callback1, Quake_Callback2, Quake_Callback3, Quake_Callback4, Quake_Callback5, Quake_Callback6, + NULL, + Quake_CallbackType1, + Quake_CallbackType2, + Quake_CallbackType3, + Quake_CallbackType4, + Quake_CallbackType5, + Quake_CallbackType6, }; s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { @@ -299,7 +357,7 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { f32 absSpeedDiv; f32 maxCurr; f32 maxNext; - s32 idx; + s32 index; s32 ret; u32 eq; Vec3f originVec; @@ -323,16 +381,16 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { } ret = 0; - for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) { - req = &sQuakeRequest[idx]; - if (req->callbackIdx != 0) { + for (index = 0; index < ARRAY_COUNT(sQuakeRequest); index++) { + req = &sQuakeRequest[index]; + if (req->type != 0) { if (play->cameraPtrs[req->camId] == NULL) { - Quake_Remove(req); + Quake_RemoveRequest(req); } else { eq = (camera->camId != req->camera->camId); absSpeedDiv = ABS(req->speed) / (f32)0x8000; - if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) { - Quake_Remove(req); + if (sQuakeCallbacks[req->type](req, &shake) == 0) { + Quake_RemoveRequest(req); } else if (eq == 0) { if (fabsf(camData->atOffset.x) < fabsf(shake.atOffset.x)) { camData->atOffset.x = shake.atOffset.x; @@ -383,35 +441,35 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { } void Distortion_Init(PlayState* play) { - sDistortionContext.play = play; + sDistortionRequest.play = play; View_ClearDistortion(&play->view); - sDistortionContext.type = 0; - sDistortionContext.countdown = 0; - sDistortionContext.state = DISTORTION_INACTIVE; + sDistortionRequest.type = 0; + sDistortionRequest.countdown = 0; + sDistortionRequest.state = DISTORTION_INACTIVE; } void Distortion_SetCountdown(s16 countdown) { - sDistortionContext.countdown = countdown; - sDistortionContext.state = DISTORTION_SETUP; + sDistortionRequest.countdown = countdown; + sDistortionRequest.state = DISTORTION_SETUP; } s16 Distortion_GetCountdown(void) { - return sDistortionContext.countdown; + return sDistortionRequest.countdown; } s16 Distortion_GetType(void) { - return sDistortionContext.type; + return sDistortionRequest.type; } void Distortion_SetType(s32 type) { - if (sDistortionContext.type < type) { - sDistortionContext.type = type; + if (sDistortionRequest.type < type) { + sDistortionRequest.type = type; } } void Distortion_ClearType(s32 type) { - if (sDistortionContext.type == type) { - sDistortionContext.type = 0; + if (sDistortionRequest.type == type) { + sDistortionRequest.type = 0; } } @@ -419,9 +477,9 @@ void Distortion_ClearType(s32 type) { * Checks that the bg surface is an underwater conveyor type and if so, returns the conveyor speed */ s32 Distortion_GetUnderwaterCurrentSpeed(Player* player) { - if (SurfaceType_GetConveyorType(&sDistortionContext.play->colCtx, player->actor.floorPoly, - player->actor.floorBgId) == CONVEYOR_WATER) { - return SurfaceType_GetConveyorSpeed(&sDistortionContext.play->colCtx, player->actor.floorPoly, + if (!SurfaceType_IsFloorConveyor(&sDistortionRequest.play->colCtx, player->actor.floorPoly, + player->actor.floorBgId)) { + return SurfaceType_GetConveyorSpeed(&sDistortionRequest.play->colCtx, player->actor.floorPoly, player->actor.floorBgId); } return 0; @@ -446,14 +504,14 @@ void Distortion_Update(void) { f32 zScale; f32 speed; Player* player; - PlayState* play = sDistortionContext.play; + PlayState* play = sDistortionRequest.play; PosRot playerPosRot; Camera* camera = GET_ACTIVE_CAM(play); f32 speedRatio = CLAMP_MAX(camera->speedRatio, 1.0f); - if (sDistortionContext.type != 0) { - if (sDistortionContext.type & 0x800) { - sDistortionContext.countdown = 2; + if (sDistortionRequest.type != 0) { + if (sDistortionRequest.type & DISTORTION_TYPE_B) { + sDistortionRequest.countdown = 2; depthPhase = 0x3F0; screenPlanePhase = 0x156; @@ -469,11 +527,11 @@ void Distortion_Update(void) { zScale = 0.0f; speed = 0.6f; - xyScaleFactor = zScaleFactor = sDistortionContext.countdown / 60.0f; + xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / 60.0f; speedScaleFactor = 1.0f; - } else if (sDistortionContext.type & 0x400) { - if (sDistortionContext.state == DISTORTION_SETUP) { - countdownMax = sDistortionContext.countdown; + } else if (sDistortionRequest.type & DISTORTION_TYPE_A) { + if (sDistortionRequest.state == DISTORTION_SETUP) { + countdownMax = sDistortionRequest.countdown; depthPhase = 0x3F0; screenPlanePhase = 0x156; } @@ -490,11 +548,11 @@ void Distortion_Update(void) { zScale = 0.0f; speed = 0.4f; - xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionContext.countdown) / (f32)countdownMax; + xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax; speedScaleFactor = 0.5f; - } else if (sDistortionContext.type & 0x200) { - if (sDistortionContext.state == DISTORTION_SETUP) { - countdownMax = sDistortionContext.countdown; + } else if (sDistortionRequest.type & DISTORTION_TYPE_9) { + if (sDistortionRequest.state == DISTORTION_SETUP) { + countdownMax = sDistortionRequest.countdown; depthPhase = 0x1FC; screenPlanePhase = 0x156; } @@ -511,11 +569,11 @@ void Distortion_Update(void) { zScale = 0.0f; speed = 0.1f; - xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionContext.countdown) / (f32)countdownMax; + xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax; speedScaleFactor = 1.0f; - } else if (sDistortionContext.type & 0x100) { - if (sDistortionContext.state == DISTORTION_SETUP) { - countdownMax = sDistortionContext.countdown; + } else if (sDistortionRequest.type & DISTORTION_TYPE_8) { + if (sDistortionRequest.state == DISTORTION_SETUP) { + countdownMax = sDistortionRequest.countdown; depthPhase = 0x2710; screenPlanePhase = 0x3E8; } @@ -532,15 +590,15 @@ void Distortion_Update(void) { zScale = 0.01f; speed = 1.5f; - if (sDistortionContext.countdown < 5) { - xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionContext.countdown) / (f32)countdownMax; + if (sDistortionRequest.countdown < 5) { + xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax; } else { xyScaleFactor = zScaleFactor = 0.0f; } speedScaleFactor = 1.0f; - } else if (sDistortionContext.type & 0x80) { - if (sDistortionContext.state == DISTORTION_SETUP) { - countdownMax = sDistortionContext.countdown; + } else if (sDistortionRequest.type & DISTORTION_TYPE_7) { + if (sDistortionRequest.state == DISTORTION_SETUP) { + countdownMax = sDistortionRequest.countdown; depthPhase = 0x4B0; screenPlanePhase = 0x7D0; } @@ -557,11 +615,11 @@ void Distortion_Update(void) { zScale = 0.01f; speed = 1.5f; - xyScaleFactor = zScaleFactor = sDistortionContext.countdown / (f32)countdownMax; + xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / (f32)countdownMax; speedScaleFactor = 1.0f; - } else if (sDistortionContext.type & 0x40) { - if (sDistortionContext.state == DISTORTION_SETUP) { - countdownMax = sDistortionContext.countdown; + } else if (sDistortionRequest.type & DISTORTION_TYPE_6) { + if (sDistortionRequest.state == DISTORTION_SETUP) { + countdownMax = sDistortionRequest.countdown; depthPhase = 0x9C4; screenPlanePhase = 0xBB8; } @@ -578,15 +636,15 @@ void Distortion_Update(void) { zScale = 0.01f; speed = 1.3f; - if (sDistortionContext.countdown < 4) { - xyScaleFactor = zScaleFactor = sDistortionContext.countdown / (f32)countdownMax; + if (sDistortionRequest.countdown < 4) { + xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / (f32)countdownMax; } else { xyScaleFactor = zScaleFactor = 0.0f; } speedScaleFactor = 1.0f; - } else if (sDistortionContext.type & 0x20) { - sDistortionContext.countdown = 2; - if (sDistortionContext.state == DISTORTION_SETUP) { + } else if (sDistortionRequest.type & DISTORTION_TYPE_5) { + sDistortionRequest.countdown = 2; + if (sDistortionRequest.state == DISTORTION_SETUP) { depthPhase = 0x9C4; screenPlanePhase = 0xBB8; } @@ -609,9 +667,9 @@ void Distortion_Update(void) { zScaleFactor = 1.0f; xyScaleFactor = 1.0f; speedScaleFactor = 1.0f; - } else if (sDistortionContext.type & 0x10) { - if (sDistortionContext.state == DISTORTION_SETUP) { - countdownMax = sDistortionContext.countdown; + } else if (sDistortionRequest.type & DISTORTION_TYPE_4) { + if (sDistortionRequest.state == DISTORTION_SETUP) { + countdownMax = sDistortionRequest.countdown; depthPhase = 0x760; screenPlanePhase = 0x1BC; } @@ -628,14 +686,14 @@ void Distortion_Update(void) { zScale = 0.2f; speed = 0.25f; - countdownRatio = sDistortionContext.countdown / (f32)countdownMax; + countdownRatio = sDistortionRequest.countdown / (f32)countdownMax; zScaleFactor = xyScaleFactor = countdownRatio; speedScaleFactor = 1.0f; - } else if (sDistortionContext.type & 8) { + } else if (sDistortionRequest.type & DISTORTION_TYPE_3) { depthPhase = 0x3F0; screenPlanePhase = 0x156; - sDistortionContext.countdown = 2; + sDistortionRequest.countdown = 2; player = GET_PLAYER(play); if (player != NULL) { @@ -656,18 +714,21 @@ void Distortion_Update(void) { zScale = 0.03f; speed = 0.33f; break; + case 2: xScale = -0.06f; yScale = 0.1f; zScale = 0.03f; speed = 0.33f; break; + case 1: xScale = -0.06f; yScale = 0.1f; zScale = 0.03f; speed = 0.33f; break; + default: xScale = -0.06f; yScale = 0.1f; @@ -683,11 +744,11 @@ void Distortion_Update(void) { } zScaleFactor = -xyScaleFactor; speedScaleFactor = 1.0f; - } else if (sDistortionContext.type & 4) { + } else if (sDistortionRequest.type & DISTORTION_TYPE_2) { depthPhase = 0x3F0; screenPlanePhase = 0x156; - sDistortionContext.countdown = 2; + sDistortionRequest.countdown = 2; player = GET_PLAYER(play); depthPhaseStep = 359.2f; @@ -703,18 +764,21 @@ void Distortion_Update(void) { zScale = 0.08f; speed = 0.18f; break; + case 2: xScale = 0.12f; yScale = 0.12f; zScale = 0.08f; speed = 0.12f; break; + case 1: xScale = 0.12f; yScale = 0.12f; zScale = 0.08f; speed = 0.08f; break; + default: xScale = 0.12f; yScale = 0.12f; @@ -731,12 +795,12 @@ void Distortion_Update(void) { xyScaleFactor = speedScaleFactor = (waterYScaleFactor * 0.15f) + 0.35f + (speedRatio * 0.4f); zScaleFactor = 0.9f - xyScaleFactor; - } else if (sDistortionContext.type & 1) { + } else if (sDistortionRequest.type & DISTORTION_TYPE_0) { // Gives a small mirage-like appearance depthPhase = 0x3F0; screenPlanePhase = 0x156; - sDistortionContext.countdown = 2; + sDistortionRequest.countdown = 2; depthPhaseStep = 0.0f; screenPlanePhaseStep = 150.0f; @@ -759,29 +823,29 @@ void Distortion_Update(void) { depthPhase += CAM_DEG_TO_BINANG(depthPhaseStep); screenPlanePhase += CAM_DEG_TO_BINANG(screenPlanePhaseStep); - View_SetDistortionDirRot(&sDistortionContext.play->view, + View_SetDistortionDirRot(&sDistortionRequest.play->view, Math_CosS(depthPhase) * (DEGF_TO_RADF(rotX) * xyScaleFactor), Math_SinS(depthPhase) * (DEGF_TO_RADF(rotY) * xyScaleFactor), Math_SinS(screenPlanePhase) * (DEGF_TO_RADF(rotZ) * zScaleFactor)); - View_SetDistortionScale(&sDistortionContext.play->view, + View_SetDistortionScale(&sDistortionRequest.play->view, (Math_SinS(screenPlanePhase) * (xScale * xyScaleFactor)) + 1.0f, (Math_CosS(screenPlanePhase) * (yScale * xyScaleFactor)) + 1.0f, (Math_CosS(depthPhase) * (zScale * zScaleFactor)) + 1.0f); - View_SetDistortionSpeed(&sDistortionContext.play->view, speed * speedScaleFactor); + View_SetDistortionSpeed(&sDistortionRequest.play->view, speed * speedScaleFactor); - sDistortionContext.state = DISTORTION_ACTIVE; + sDistortionRequest.state = DISTORTION_ACTIVE; - } else if (sDistortionContext.state != DISTORTION_INACTIVE) { + } else if (sDistortionRequest.state != DISTORTION_INACTIVE) { View_ClearDistortion(&play->view); - sDistortionContext.state = DISTORTION_INACTIVE; - sDistortionContext.countdown = 0; + sDistortionRequest.state = DISTORTION_INACTIVE; + sDistortionRequest.countdown = 0; } - if (sDistortionContext.countdown != 0) { - sDistortionContext.countdown--; - if (sDistortionContext.countdown == 0) { - sDistortionContext.type = 0; + if (sDistortionRequest.countdown != 0) { + sDistortionRequest.countdown--; + if (sDistortionRequest.countdown == 0) { + sDistortionRequest.type = 0; } } } @@ -790,16 +854,16 @@ s32 Quake_NumActiveQuakes(void) { QuakeRequest* req = sQuakeRequest; s32 numActiveQuakes = 0; - if (req[0].callbackIdx != 0) { + if (req[0].type != 0) { numActiveQuakes++; } - if (req[1].callbackIdx != 0) { + if (req[1].type != 0) { numActiveQuakes++; } - if (req[2].callbackIdx != 0) { + if (req[2].type != 0) { numActiveQuakes++; } - if (req[3].callbackIdx != 0) { + if (req[3].type != 0) { numActiveQuakes++; } diff --git a/src/code/z_room.c b/src/code/z_room.c index e0c2a035d..e198e95ed 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -111,8 +111,7 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) { func_80123140(play, GET_PLAYER(play)); Actor_SpawnTransitionActors(play, &play->actorCtx); - if (((play->sceneNum != SCENE_IKANA) || (roomCtx->curRoom.num != 1)) && - (play->sceneNum != SCENE_IKNINSIDE)) { + if (((play->sceneId != SCENE_IKANA) || (roomCtx->curRoom.num != 1)) && (play->sceneId != SCENE_IKNINSIDE)) { play->envCtx.lightSettingOverride = 0xFF; play->envCtx.unk_E0 = 0; } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 75616e8a5..7b88d4520 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -28,12 +28,12 @@ void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) { u32 spaceSize; s32 i; - if (play->sceneNum == SCENE_CLOCKTOWER || play->sceneNum == SCENE_TOWN || play->sceneNum == SCENE_BACKTOWN || - play->sceneNum == SCENE_ICHIBA) { + if (play->sceneId == SCENE_CLOCKTOWER || play->sceneId == SCENE_TOWN || play->sceneId == SCENE_BACKTOWN || + play->sceneId == SCENE_ICHIBA) { spaceSize = OBJECT_SPACE_SIZE_CLOCK_TOWN; - } else if (play->sceneNum == SCENE_MILK_BAR) { + } else if (play->sceneId == SCENE_MILK_BAR) { spaceSize = OBJECT_SPACE_SIZE_MILK_BAR; - } else if (play->sceneNum == SCENE_00KEIKOKU) { + } else if (play->sceneId == SCENE_00KEIKOKU) { spaceSize = OBJECT_SPACE_SIZE_TERMINA_FIELD; } else { spaceSize = OBJECT_SPACE_SIZE_DEFAULT; @@ -436,11 +436,12 @@ void Scene_HeaderCmd09(PlayState* play, SceneCmd* cmd) { // SceneTableEntry Header Command 0x15: Sound Settings= void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) { - play->soundCtx.seqIndex = cmd->soundSettings.musicSeq; - play->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX; + play->sequenceCtx.seqId = cmd->soundSettings.seqId; + play->sequenceCtx.ambienceId = cmd->soundSettings.ambienceId; - if (gSaveContext.seqIndex == (u8)NA_BGM_DISABLED || func_801A8A50(0) == NA_BGM_FINAL_HOURS) { - audio_setBGM(cmd->soundSettings.bgmId); + if (gSaveContext.seqId == (u8)NA_BGM_DISABLED || + Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS) { + Audio_SetSpec(cmd->soundSettings.specId); } } @@ -454,9 +455,9 @@ void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) { SceneCmd** altHeaderList; SceneCmd* altHeader; - if (gSaveContext.sceneSetupIndex != 0) { + if (gSaveContext.sceneLayer != 0) { altHeaderList = Lib_SegmentedToVirtual(cmd->altHeaders.segment); - altHeader = altHeaderList[gSaveContext.sceneSetupIndex - 1]; + altHeader = altHeaderList[gSaveContext.sceneLayer - 1]; if (altHeader != NULL) { Scene_ProcessHeader(play, Lib_SegmentedToVirtual(altHeader)); @@ -497,23 +498,23 @@ void Scene_HeaderCmdSetAreaVisitedFlag(PlayState* play, SceneCmd* cmd) { s16 i = 0; while (true) { - if (gScenesPerRegion[i][j] == 0xFFFF) { + if (gSceneIdsPerRegion[i][j] == 0xFFFF) { i++; j = 0; - if (i == ARRAY_COUNT(gScenesPerRegion)) { + if (i == ARRAY_COUNT(gSceneIdsPerRegion)) { break; } } - if (play->sceneNum == gScenesPerRegion[i][j]) { + if (play->sceneId == gSceneIdsPerRegion[i][j]) { break; } j++; } - if (i < ARRAY_COUNT(gScenesPerRegion)) { + if (i < ARRAY_COUNT(gSceneIdsPerRegion)) { gSaveContext.save.mapsVisited = (gBitFlags[i] | gSaveContext.save.mapsVisited) | gSaveContext.save.mapsVisited; } } diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 108689978..ed4549966 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -123,15 +123,15 @@ SceneTableEntry gSceneTable[] = { }; static EntranceTableEntry sMayorsResidenceEntrance0[] = { - { 0x12, 0x00, 0x4102 }, + { SCENE_SONCHONOIE, 0, 0x4102 }, }; static EntranceTableEntry sMayorsResidenceEntrance1[] = { - { 0x12, 0x01, 0x4102 }, + { SCENE_SONCHONOIE, 1, 0x4102 }, }; static EntranceTableEntry sMayorsResidenceEntrance2[] = { - { 0x12, 0x02, 0x4102 }, + { SCENE_SONCHONOIE, 2, 0x4102 }, }; static EntranceTableEntry* sMayorsResidenceEntranceTable[] = { @@ -141,7 +141,7 @@ static EntranceTableEntry* sMayorsResidenceEntranceTable[] = { }; static EntranceTableEntry sMajorasLairEntrance0[] = { - { 0xF5, 0x00, 0x0387 }, + { -SCENE_LAST_BS, 0, 0x0387 }, }; static EntranceTableEntry* sMajorasLairEntranceTable[] = { @@ -149,7 +149,7 @@ static EntranceTableEntry* sMajorasLairEntranceTable[] = { }; static EntranceTableEntry sMagicHagsPotionShopEntrance0[] = { - { 0x0A, 0x00, 0x4102 }, + { SCENE_WITCH_SHOP, 0, 0x4102 }, }; static EntranceTableEntry* sMagicHagsPotionShopEntranceTable[] = { @@ -157,11 +157,11 @@ static EntranceTableEntry* sMagicHagsPotionShopEntranceTable[] = { }; static EntranceTableEntry sRanchHouseEntrance0[] = { - { 0x10, 0x00, 0x0102 }, + { SCENE_OMOYA, 0, 0x0102 }, }; static EntranceTableEntry sRanchHouseEntrance1[] = { - { 0x10, 0x01, 0x4102 }, + { SCENE_OMOYA, 1, 0x4102 }, }; static EntranceTableEntry* sRanchHouseEntranceTable[] = { @@ -170,7 +170,7 @@ static EntranceTableEntry* sRanchHouseEntranceTable[] = { }; static EntranceTableEntry sHoneyAndDarlingsShopEntrance0[] = { - { 0x11, 0x00, 0x4102 }, + { SCENE_BOWLING, 0, 0x4102 }, }; static EntranceTableEntry* sHoneyAndDarlingsShopEntranceTable[] = { @@ -178,11 +178,11 @@ static EntranceTableEntry* sHoneyAndDarlingsShopEntranceTable[] = { }; static EntranceTableEntry sBeneathTheGraveryardEntrance0[] = { - { 0xF4, 0x00, 0x4102 }, + { -SCENE_HAKASHITA, 0, 0x4102 }, }; static EntranceTableEntry sBeneathTheGraveryardEntrance1[] = { - { 0xF4, 0x01, 0x4102 }, + { -SCENE_HAKASHITA, 1, 0x4102 }, }; static EntranceTableEntry* sBeneathTheGraveryardEntranceTable[] = { @@ -191,47 +191,47 @@ static EntranceTableEntry* sBeneathTheGraveryardEntranceTable[] = { }; static EntranceTableEntry sSouthernSwampClearedEntrance0[] = { - { 0x00, 0x00, 0xCA14 }, + { SCENE_20SICHITAI2, 0, 0xCA14 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance1[] = { - { 0x00, 0x01, 0x4102 }, + { SCENE_20SICHITAI2, 1, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance2[] = { - { 0x00, 0x02, 0xC102 }, + { SCENE_20SICHITAI2, 2, 0xC102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance3[] = { - { 0x00, 0x03, 0x4102 }, + { SCENE_20SICHITAI2, 3, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance4[] = { - { 0x00, 0x04, 0x4102 }, + { SCENE_20SICHITAI2, 4, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance5[] = { - { 0x00, 0x05, 0x4102 }, + { SCENE_20SICHITAI2, 5, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance6[] = { - { 0x00, 0x06, 0x0102 }, + { SCENE_20SICHITAI2, 6, 0x0102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance7[] = { - { 0x00, 0x07, 0x4102 }, + { SCENE_20SICHITAI2, 7, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance8[] = { - { 0x00, 0x08, 0x4102 }, + { SCENE_20SICHITAI2, 8, 0x4102 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance9[] = { - { 0x00, 0x09, 0x4A14 }, + { SCENE_20SICHITAI2, 9, 0x4A14 }, }; static EntranceTableEntry sSouthernSwampClearedEntrance10[] = { - { 0x00, 0x0A, 0x4A14 }, + { SCENE_20SICHITAI2, 10, 0x4A14 }, }; static EntranceTableEntry* sSouthernSwampClearedEntranceTable[] = { @@ -242,19 +242,19 @@ static EntranceTableEntry* sSouthernSwampClearedEntranceTable[] = { }; static EntranceTableEntry sCuriosityShopEntrance0[] = { - { 0x0D, 0x00, 0x4102 }, + { SCENE_AYASHIISHOP, 0, 0x4102 }, }; static EntranceTableEntry sCuriosityShopEntrance1[] = { - { 0x0D, 0x01, 0x0102 }, + { SCENE_AYASHIISHOP, 1, 0x0102 }, }; static EntranceTableEntry sCuriosityShopEntrance2[] = { - { 0x0D, 0x02, 0x8A95 }, + { SCENE_AYASHIISHOP, 2, 0x8A95 }, }; static EntranceTableEntry sCuriosityShopEntrance3[] = { - { 0x0D, 0x03, 0x8102 }, + { SCENE_AYASHIISHOP, 3, 0x8102 }, }; static EntranceTableEntry* sCuriosityShopEntranceTable[] = { @@ -265,113 +265,113 @@ static EntranceTableEntry* sCuriosityShopEntranceTable[] = { }; static EntranceTableEntry sIkanaCanyonEntrance0[] = { - { 0x13, 0x00, 0xCA14 }, { 0x13, 0x00, 0x8A14 }, { 0x13, 0x00, 0x0A14 }, - { 0x13, 0x00, 0x4A14 }, { 0x13, 0x00, 0x8102 }, + { SCENE_IKANA, 0, 0xCA14 }, { SCENE_IKANA, 0, 0x8A14 }, { SCENE_IKANA, 0, 0x0A14 }, + { SCENE_IKANA, 0, 0x4A14 }, { SCENE_IKANA, 0, 0x8102 }, }; static EntranceTableEntry sIkanaCanyonEntrance1[] = { - { 0x13, 0x01, 0x4102 }, - { 0x13, 0x01, 0x4102 }, - { 0x13, 0x01, 0xCA14 }, - { 0x13, 0x01, 0x4102 }, + { SCENE_IKANA, 1, 0x4102 }, + { SCENE_IKANA, 1, 0x4102 }, + { SCENE_IKANA, 1, 0xCA14 }, + { SCENE_IKANA, 1, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance2[] = { - { 0x13, 0x02, 0x4102 }, - { 0x13, 0x02, 0x4102 }, - { 0x13, 0x02, 0x4102 }, - { 0x13, 0x02, 0x4102 }, + { SCENE_IKANA, 2, 0x4102 }, + { SCENE_IKANA, 2, 0x4102 }, + { SCENE_IKANA, 2, 0x4102 }, + { SCENE_IKANA, 2, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance3[] = { - { 0x13, 0x03, 0x4102 }, - { 0x13, 0x03, 0x4102 }, - { 0x13, 0x03, 0x4102 }, - { 0x13, 0x03, 0x4102 }, + { SCENE_IKANA, 3, 0x4102 }, + { SCENE_IKANA, 3, 0x4102 }, + { SCENE_IKANA, 3, 0x4102 }, + { SCENE_IKANA, 3, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance4[] = { - { 0x13, 0x04, 0x4A14 }, - { 0x13, 0x04, 0x4A14 }, - { 0x13, 0x04, 0x4A14 }, - { 0x13, 0x04, 0x4A14 }, + { SCENE_IKANA, 4, 0x4A14 }, + { SCENE_IKANA, 4, 0x4A14 }, + { SCENE_IKANA, 4, 0x4A14 }, + { SCENE_IKANA, 4, 0x4A14 }, }; static EntranceTableEntry sIkanaCanyonEntrance5[] = { - { 0x13, 0x05, 0x4102 }, - { 0x13, 0x05, 0x4102 }, - { 0x13, 0x05, 0x4102 }, - { 0x13, 0x05, 0x4102 }, + { SCENE_IKANA, 5, 0x4102 }, + { SCENE_IKANA, 5, 0x4102 }, + { SCENE_IKANA, 5, 0x4102 }, + { SCENE_IKANA, 5, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance6[] = { - { 0x13, 0x06, 0x4102 }, - { 0x13, 0x06, 0x4102 }, - { 0x13, 0x06, 0x4102 }, - { 0x13, 0x06, 0x4102 }, + { SCENE_IKANA, 6, 0x4102 }, + { SCENE_IKANA, 6, 0x4102 }, + { SCENE_IKANA, 6, 0x4102 }, + { SCENE_IKANA, 6, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance7[] = { - { 0x13, 0x07, 0x4A14 }, - { 0x13, 0x07, 0x4A14 }, - { 0x13, 0x07, 0x4A14 }, - { 0x13, 0x07, 0x4A14 }, + { SCENE_IKANA, 7, 0x4A14 }, + { SCENE_IKANA, 7, 0x4A14 }, + { SCENE_IKANA, 7, 0x4A14 }, + { SCENE_IKANA, 7, 0x4A14 }, }; static EntranceTableEntry sIkanaCanyonEntrance8[] = { - { 0x13, 0x08, 0x4102 }, - { 0x13, 0x08, 0x4102 }, - { 0x13, 0x08, 0x4102 }, - { 0x13, 0x08, 0x4102 }, + { SCENE_IKANA, 8, 0x4102 }, + { SCENE_IKANA, 8, 0x4102 }, + { SCENE_IKANA, 8, 0x4102 }, + { SCENE_IKANA, 8, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance9[] = { - { 0x13, 0x09, 0x4A14 }, - { 0x13, 0x09, 0x4A14 }, - { 0x13, 0x09, 0x4A14 }, - { 0x13, 0x09, 0x4A14 }, + { SCENE_IKANA, 9, 0x4A14 }, + { SCENE_IKANA, 9, 0x4A14 }, + { SCENE_IKANA, 9, 0x4A14 }, + { SCENE_IKANA, 9, 0x4A14 }, }; static EntranceTableEntry sIkanaCanyonEntrance10[] = { - { 0x13, 0x0A, 0x4A14 }, - { 0x13, 0x0A, 0x4A14 }, - { 0x13, 0x0A, 0x4A14 }, - { 0x13, 0x0A, 0x4A14 }, + { SCENE_IKANA, 10, 0x4A14 }, + { SCENE_IKANA, 10, 0x4A14 }, + { SCENE_IKANA, 10, 0x4A14 }, + { SCENE_IKANA, 10, 0x4A14 }, }; static EntranceTableEntry sIkanaCanyonEntrance11[] = { - { 0x13, 0x0B, 0x4102 }, - { 0x13, 0x0B, 0x4102 }, - { 0x13, 0x0B, 0x4102 }, - { 0x13, 0x0B, 0x4102 }, + { SCENE_IKANA, 11, 0x4102 }, + { SCENE_IKANA, 11, 0x4102 }, + { SCENE_IKANA, 11, 0x4102 }, + { SCENE_IKANA, 11, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance12[] = { - { 0x13, 0x0C, 0x4102 }, - { 0x13, 0x0C, 0x4102 }, - { 0x13, 0x0C, 0x4102 }, - { 0x13, 0x0C, 0x4102 }, + { SCENE_IKANA, 12, 0x4102 }, + { SCENE_IKANA, 12, 0x4102 }, + { SCENE_IKANA, 12, 0x4102 }, + { SCENE_IKANA, 12, 0x4102 }, }; static EntranceTableEntry sIkanaCanyonEntrance13[] = { - { 0x13, 0x0D, 0x8102 }, - { 0x13, 0x0D, 0x8102 }, - { 0x13, 0x0D, 0x8102 }, - { 0x13, 0x0D, 0x8102 }, + { SCENE_IKANA, 13, 0x8102 }, + { SCENE_IKANA, 13, 0x8102 }, + { SCENE_IKANA, 13, 0x8102 }, + { SCENE_IKANA, 13, 0x8102 }, }; static EntranceTableEntry sIkanaCanyonEntrance14[] = { - { 0x13, 0x0E, 0x8102 }, - { 0x13, 0x0E, 0x8102 }, - { 0x13, 0x0E, 0x8102 }, - { 0x13, 0x0E, 0x8102 }, + { SCENE_IKANA, 14, 0x8102 }, + { SCENE_IKANA, 14, 0x8102 }, + { SCENE_IKANA, 14, 0x8102 }, + { SCENE_IKANA, 14, 0x8102 }, }; static EntranceTableEntry sIkanaCanyonEntrance15[] = { - { 0x13, 0x0F, 0x8102 }, - { 0x13, 0x0F, 0x8102 }, - { 0x13, 0x0F, 0x8102 }, - { 0x13, 0x0F, 0x0183 }, + { SCENE_IKANA, 15, 0x8102 }, + { SCENE_IKANA, 15, 0x8102 }, + { SCENE_IKANA, 15, 0x8102 }, + { SCENE_IKANA, 15, 0x0183 }, }; static EntranceTableEntry* sIkanaCanyonEntranceTable[] = { @@ -382,66 +382,66 @@ static EntranceTableEntry* sIkanaCanyonEntranceTable[] = { }; static EntranceTableEntry sPiratesFortressEntrance0[] = { - { 0x14, 0x00, 0x8102 }, - { 0x14, 0x00, 0x8102 }, - { 0x14, 0x00, 0x8102 }, + { SCENE_KAIZOKU, 0, 0x8102 }, + { SCENE_KAIZOKU, 0, 0x8102 }, + { SCENE_KAIZOKU, 0, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance1[] = { - { 0x14, 0x01, 0x8102 }, - { 0x14, 0x01, 0x8102 }, + { SCENE_KAIZOKU, 1, 0x8102 }, + { SCENE_KAIZOKU, 1, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance2[] = { - { 0x14, 0x02, 0x8102 }, + { SCENE_KAIZOKU, 2, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance3[] = { - { 0x14, 0x03, 0x8102 }, + { SCENE_KAIZOKU, 3, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance4[] = { - { 0x14, 0x04, 0x8102 }, + { SCENE_KAIZOKU, 4, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance5[] = { - { 0x14, 0x05, 0x8102 }, + { SCENE_KAIZOKU, 5, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance6[] = { - { 0x14, 0x06, 0x8102 }, + { SCENE_KAIZOKU, 6, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance7[] = { - { 0x14, 0x07, 0x8102 }, + { SCENE_KAIZOKU, 7, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance8[] = { - { 0x14, 0x08, 0x8102 }, + { SCENE_KAIZOKU, 8, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance9[] = { - { 0x14, 0x09, 0x8102 }, + { SCENE_KAIZOKU, 9, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance10[] = { - { 0x14, 0x0A, 0x8A95 }, + { SCENE_KAIZOKU, 10, 0x8A95 }, }; static EntranceTableEntry sPiratesFortressEntrance11[] = { - { 0x14, 0x0B, 0x8102 }, + { SCENE_KAIZOKU, 11, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance12[] = { - { 0x14, 0x0C, 0x8102 }, + { SCENE_KAIZOKU, 12, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance13[] = { - { 0x14, 0x0D, 0x8102 }, + { SCENE_KAIZOKU, 13, 0x8102 }, }; static EntranceTableEntry sPiratesFortressEntrance14[] = { - { 0x14, 0x0E, 0x8102 }, + { SCENE_KAIZOKU, 14, 0x8102 }, }; static EntranceTableEntry* sPiratesFortressEntranceTable[] = { @@ -452,8 +452,8 @@ static EntranceTableEntry* sPiratesFortressEntranceTable[] = { }; static EntranceTableEntry sMilkBarEntrance0[] = { - { 0x15, 0x00, 0x4102 }, { 0x15, 0x00, 0x8102 }, { 0x15, 0x00, 0x8102 }, - { 0x15, 0x00, 0x8102 }, { 0x15, 0x00, 0x8102 }, + { SCENE_MILK_BAR, 0, 0x4102 }, { SCENE_MILK_BAR, 0, 0x8102 }, { SCENE_MILK_BAR, 0, 0x8102 }, + { SCENE_MILK_BAR, 0, 0x8102 }, { SCENE_MILK_BAR, 0, 0x8102 }, }; static EntranceTableEntry* sMilkBarEntranceTable[] = { @@ -461,11 +461,11 @@ static EntranceTableEntry* sMilkBarEntranceTable[] = { }; static EntranceTableEntry sStoneTowerTempleEntrance0[] = { - { 0xEA, 0x00, 0xC102 }, + { -SCENE_INISIE_N, 0, 0xC102 }, }; static EntranceTableEntry sStoneTowerTempleEntrance1[] = { - { 0xEA, 0x01, 0x4102 }, + { -SCENE_INISIE_N, 1, 0x4102 }, }; static EntranceTableEntry* sStoneTowerTempleEntranceTable[] = { @@ -474,11 +474,11 @@ static EntranceTableEntry* sStoneTowerTempleEntranceTable[] = { }; static EntranceTableEntry sTreasureChestShopEntrance0[] = { - { 0x17, 0x00, 0x4102 }, + { SCENE_TAKARAYA, 0, 0x4102 }, }; static EntranceTableEntry sTreasureChestShopEntrance1[] = { - { 0x17, 0x01, 0x0102 }, + { SCENE_TAKARAYA, 1, 0x0102 }, }; static EntranceTableEntry* sTreasureChestShopEntranceTable[] = { @@ -487,15 +487,15 @@ static EntranceTableEntry* sTreasureChestShopEntranceTable[] = { }; static EntranceTableEntry sStoneTowerTempleInvertedEntrance0[] = { - { 0xE8, 0x00, 0xC102 }, + { -SCENE_INISIE_R, 0, 0xC102 }, }; static EntranceTableEntry sStoneTowerTempleInvertedEntrance1[] = { - { 0xE8, 0x01, 0x8102 }, + { -SCENE_INISIE_R, 1, 0x8102 }, }; static EntranceTableEntry sStoneTowerTempleInvertedEntrance2[] = { - { 0xE8, 0x02, 0x8102 }, + { -SCENE_INISIE_R, 2, 0x8102 }, }; static EntranceTableEntry* sStoneTowerTempleInvertedEntranceTable[] = { @@ -505,22 +505,22 @@ static EntranceTableEntry* sStoneTowerTempleInvertedEntranceTable[] = { }; static EntranceTableEntry sClockTowerRooftopEntrance0[] = { - { 0xE7, 0x00, 0x0102 }, - { 0xE7, 0x00, 0x8102 }, - { 0xE7, 0x00, 0x0102 }, - { 0xE7, 0x00, 0x0102 }, + { -SCENE_OKUJOU, 0, 0x0102 }, + { -SCENE_OKUJOU, 0, 0x8102 }, + { -SCENE_OKUJOU, 0, 0x0102 }, + { -SCENE_OKUJOU, 0, 0x0102 }, }; static EntranceTableEntry sClockTowerRooftopEntrance1[] = { - { 0xE7, 0x01, 0x0102 }, - { 0xE7, 0x01, 0x0102 }, - { 0xE7, 0x01, 0x0102 }, + { -SCENE_OKUJOU, 1, 0x0102 }, + { -SCENE_OKUJOU, 1, 0x0102 }, + { -SCENE_OKUJOU, 1, 0x0102 }, }; static EntranceTableEntry sClockTowerRooftopEntrance2[] = { - { 0xE7, 0x02, 0x858B }, - { 0xE7, 0x02, 0x858B }, - { 0xE7, 0x02, 0x8102 }, + { -SCENE_OKUJOU, 2, 0x858B }, + { -SCENE_OKUJOU, 2, 0x858B }, + { -SCENE_OKUJOU, 2, 0x8102 }, }; static EntranceTableEntry* sClockTowerRooftopEntranceTable[] = { @@ -530,24 +530,24 @@ static EntranceTableEntry* sClockTowerRooftopEntranceTable[] = { }; static EntranceTableEntry sOpeningDungeonEntrance0[] = { - { 0xE6, 0x00, 0x0102 }, - { 0xE6, 0x00, 0x8102 }, + { -SCENE_OPENINGDAN, 0, 0x0102 }, + { -SCENE_OPENINGDAN, 0, 0x8102 }, }; static EntranceTableEntry sOpeningDungeonEntrance1[] = { - { 0xE6, 0x01, 0x0102 }, + { -SCENE_OPENINGDAN, 1, 0x0102 }, }; static EntranceTableEntry sOpeningDungeonEntrance2[] = { - { 0xE6, 0x02, 0x0102 }, + { -SCENE_OPENINGDAN, 2, 0x0102 }, }; static EntranceTableEntry sOpeningDungeonEntrance3[] = { - { 0xE6, 0x03, 0x0102 }, + { -SCENE_OPENINGDAN, 3, 0x0102 }, }; static EntranceTableEntry sOpeningDungeonEntrance4[] = { - { 0xE6, 0x04, 0x058B }, + { -SCENE_OPENINGDAN, 4, 0x058B }, }; static EntranceTableEntry* sOpeningDungeonEntranceTable[] = { @@ -556,15 +556,15 @@ static EntranceTableEntry* sOpeningDungeonEntranceTable[] = { }; static EntranceTableEntry sWoodfallTempleEntrance0[] = { - { 0xE5, 0x00, 0x4102 }, + { -SCENE_MITURIN, 0, 0x4102 }, }; static EntranceTableEntry sWoodfallTempleEntrance1[] = { - { 0xE5, 0x01, 0x0102 }, + { -SCENE_MITURIN, 1, 0x0102 }, }; static EntranceTableEntry sWoodfallTempleEntrance2[] = { - { 0xE5, 0x02, 0x0102 }, + { -SCENE_MITURIN, 2, 0x0102 }, }; static EntranceTableEntry* sWoodfallTempleEntranceTable[] = { @@ -574,13 +574,13 @@ static EntranceTableEntry* sWoodfallTempleEntranceTable[] = { }; static EntranceTableEntry sPathToMountainVillageEntrance0[] = { - { 0x1C, 0x00, 0x8A14 }, - { 0x1C, 0x00, 0x8A14 }, + { SCENE_13HUBUKINOMITI, 0, 0x8A14 }, + { SCENE_13HUBUKINOMITI, 0, 0x8A14 }, }; static EntranceTableEntry sPathToMountainVillageEntrance1[] = { - { 0x1C, 0x01, 0x8A14 }, - { 0x1C, 0x01, 0x8A14 }, + { SCENE_13HUBUKINOMITI, 1, 0x8A14 }, + { SCENE_13HUBUKINOMITI, 1, 0x8A14 }, }; static EntranceTableEntry* sPathToMountainVillageEntranceTable[] = { @@ -589,31 +589,31 @@ static EntranceTableEntry* sPathToMountainVillageEntranceTable[] = { }; static EntranceTableEntry sIkanaCastleEntrance0[] = { - { 0xE3, 0x00, 0x4102 }, + { -SCENE_CASTLE, 0, 0x4102 }, }; static EntranceTableEntry sIkanaCastleEntrance1[] = { - { 0xE3, 0x01, 0x4102 }, + { -SCENE_CASTLE, 1, 0x4102 }, }; static EntranceTableEntry sIkanaCastleEntrance2[] = { - { 0xE3, 0x02, 0x8102 }, + { -SCENE_CASTLE, 2, 0x8102 }, }; static EntranceTableEntry sIkanaCastleEntrance3[] = { - { 0xE3, 0x03, 0x8102 }, + { -SCENE_CASTLE, 3, 0x8102 }, }; static EntranceTableEntry sIkanaCastleEntrance4[] = { - { 0xE3, 0x04, 0x8102 }, + { -SCENE_CASTLE, 4, 0x8102 }, }; static EntranceTableEntry sIkanaCastleEntrance5[] = { - { 0xE3, 0x05, 0x8102 }, + { -SCENE_CASTLE, 5, 0x8102 }, }; static EntranceTableEntry sIkanaCastleEntrance6[] = { - { 0xE3, 0x06, 0x8102 }, + { -SCENE_CASTLE, 6, 0x8102 }, }; static EntranceTableEntry* sIkanaCastleEntranceTable[] = { @@ -622,11 +622,11 @@ static EntranceTableEntry* sIkanaCastleEntranceTable[] = { }; static EntranceTableEntry sDekuScrubPlaygroundEntrance0[] = { - { 0x1E, 0x00, 0x0102 }, + { SCENE_DEKUTES, 0, 0x0102 }, }; static EntranceTableEntry sDekuScrubPlaygroundEntrance1[] = { - { 0x1E, 0x01, 0x0102 }, + { SCENE_DEKUTES, 1, 0x0102 }, }; static EntranceTableEntry* sDekuScrubPlaygroundEntranceTable[] = { @@ -635,7 +635,7 @@ static EntranceTableEntry* sDekuScrubPlaygroundEntranceTable[] = { }; static EntranceTableEntry sOdolwasLairEntrance0[] = { - { 0xE1, 0x00, 0x8102 }, + { -SCENE_MITURIN_BS, 0, 0x8102 }, }; static EntranceTableEntry* sOdolwasLairEntranceTable[] = { @@ -643,11 +643,11 @@ static EntranceTableEntry* sOdolwasLairEntranceTable[] = { }; static EntranceTableEntry sTownShootingGalleryEntrance0[] = { - { 0x20, 0x00, 0x4102 }, + { SCENE_SYATEKI_MIZU, 0, 0x4102 }, }; static EntranceTableEntry sTownShootingGalleryEntrance1[] = { - { 0x20, 0x01, 0x0102 }, + { SCENE_SYATEKI_MIZU, 1, 0x0102 }, }; static EntranceTableEntry* sTownShootingGalleryEntranceTable[] = { @@ -656,11 +656,11 @@ static EntranceTableEntry* sTownShootingGalleryEntranceTable[] = { }; static EntranceTableEntry sSnowheadTempleEntrance0[] = { - { 0xDF, 0x00, 0x4102 }, + { -SCENE_HAKUGIN, 0, 0x4102 }, }; static EntranceTableEntry sSnowheadTempleEntrance1[] = { - { 0xDF, 0x01, 0x4102 }, + { -SCENE_HAKUGIN, 1, 0x4102 }, }; static EntranceTableEntry* sSnowheadTempleEntranceTable[] = { @@ -669,31 +669,31 @@ static EntranceTableEntry* sSnowheadTempleEntranceTable[] = { }; static EntranceTableEntry sMilkRoadEntrance0[] = { - { 0x22, 0x00, 0xCA14 }, + { SCENE_ROMANYMAE, 0, 0xCA14 }, }; static EntranceTableEntry sMilkRoadEntrance1[] = { - { 0x22, 0x01, 0x4A14 }, + { SCENE_ROMANYMAE, 1, 0x4A14 }, }; static EntranceTableEntry sMilkRoadEntrance2[] = { - { 0x22, 0x02, 0x4A14 }, + { SCENE_ROMANYMAE, 2, 0x4A14 }, }; static EntranceTableEntry sMilkRoadEntrance3[] = { - { 0x22, 0x03, 0x4A14 }, + { SCENE_ROMANYMAE, 3, 0x4A14 }, }; static EntranceTableEntry sMilkRoadEntrance4[] = { - { 0x22, 0x04, 0x4A14 }, + { SCENE_ROMANYMAE, 4, 0x4A14 }, }; static EntranceTableEntry sMilkRoadEntrance5[] = { - { 0x22, 0x05, 0x0102 }, + { SCENE_ROMANYMAE, 5, 0x0102 }, }; static EntranceTableEntry sMilkRoadEntrance6[] = { - { 0x22, 0x06, 0x0102 }, + { SCENE_ROMANYMAE, 6, 0x0102 }, }; static EntranceTableEntry* sMilkRoadEntranceTable[] = { @@ -702,67 +702,67 @@ static EntranceTableEntry* sMilkRoadEntranceTable[] = { }; static EntranceTableEntry sPiratesFortressInteriorEntrance0[] = { - { 0x23, 0x00, 0x8102 }, + { SCENE_PIRATE, 0, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance1[] = { - { 0x23, 0x01, 0x8102 }, + { SCENE_PIRATE, 1, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance2[] = { - { 0x23, 0x02, 0x8102 }, + { SCENE_PIRATE, 2, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance3[] = { - { 0x23, 0x03, 0x8102 }, + { SCENE_PIRATE, 3, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance4[] = { - { 0x23, 0x04, 0x8102 }, + { SCENE_PIRATE, 4, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance5[] = { - { 0x23, 0x05, 0x8102 }, + { SCENE_PIRATE, 5, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance6[] = { - { 0x23, 0x06, 0x8102 }, + { SCENE_PIRATE, 6, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance7[] = { - { 0x23, 0x07, 0x8102 }, + { SCENE_PIRATE, 7, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance8[] = { - { 0x23, 0x08, 0x8102 }, + { SCENE_PIRATE, 8, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance9[] = { - { 0x23, 0x09, 0x8993 }, + { SCENE_PIRATE, 9, 0x8993 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance10[] = { - { 0x23, 0x0A, 0x8102 }, + { SCENE_PIRATE, 10, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance11[] = { - { 0x23, 0x0B, 0x8102 }, + { SCENE_PIRATE, 11, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance12[] = { - { 0x23, 0x0C, 0x8102 }, + { SCENE_PIRATE, 12, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance13[] = { - { 0x23, 0x0D, 0x8102 }, + { SCENE_PIRATE, 13, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance14[] = { - { 0x23, 0x0E, 0x8102 }, + { SCENE_PIRATE, 14, 0x8102 }, }; static EntranceTableEntry sPiratesFortressInteriorEntrance15[] = { - { 0x23, 0x0F, 0x8102 }, + { SCENE_PIRATE, 15, 0x8102 }, }; static EntranceTableEntry* sPiratesFortressInteriorEntranceTable[] = { @@ -775,7 +775,7 @@ static EntranceTableEntry* sPiratesFortressInteriorEntranceTable[] = { }; static EntranceTableEntry sSwampShootingGalleryEntrance0[] = { - { 0x24, 0x00, 0x4102 }, + { SCENE_SYATEKI_MORI, 0, 0x4102 }, }; static EntranceTableEntry* sSwampShootingGalleryEntranceTable[] = { @@ -783,11 +783,11 @@ static EntranceTableEntry* sSwampShootingGalleryEntranceTable[] = { }; static EntranceTableEntry sPinnacleRockEntrance0[] = { - { 0x25, 0x00, 0x4A14 }, + { SCENE_SINKAI, 0, 0x4A14 }, }; static EntranceTableEntry sPinnacleRockEntrance1[] = { - { 0x25, 0x01, 0x0A14 }, + { SCENE_SINKAI, 1, 0x0A14 }, }; static EntranceTableEntry* sPinnacleRockEntranceTable[] = { @@ -796,44 +796,44 @@ static EntranceTableEntry* sPinnacleRockEntranceTable[] = { }; static EntranceTableEntry sFairyFountainEntrance0[] = { - { 0x26, 0x00, 0x4102 }, - { 0x26, 0x00, 0x8102 }, + { SCENE_YOUSEI_IZUMI, 0, 0x4102 }, + { SCENE_YOUSEI_IZUMI, 0, 0x8102 }, }; static EntranceTableEntry sFairyFountainEntrance1[] = { - { 0x26, 0x01, 0x4102 }, + { SCENE_YOUSEI_IZUMI, 1, 0x4102 }, }; static EntranceTableEntry sFairyFountainEntrance2[] = { - { 0x26, 0x02, 0x4102 }, + { SCENE_YOUSEI_IZUMI, 2, 0x4102 }, }; static EntranceTableEntry sFairyFountainEntrance3[] = { - { 0x26, 0x03, 0x4102 }, + { SCENE_YOUSEI_IZUMI, 3, 0x4102 }, }; static EntranceTableEntry sFairyFountainEntrance4[] = { - { 0x26, 0x04, 0x4102 }, + { SCENE_YOUSEI_IZUMI, 4, 0x4102 }, }; static EntranceTableEntry sFairyFountainEntrance5[] = { - { 0x26, 0x05, 0x8183 }, + { SCENE_YOUSEI_IZUMI, 5, 0x8183 }, }; static EntranceTableEntry sFairyFountainEntrance6[] = { - { 0x26, 0x06, 0x858B }, + { SCENE_YOUSEI_IZUMI, 6, 0x858B }, }; static EntranceTableEntry sFairyFountainEntrance7[] = { - { 0x26, 0x07, 0x858B }, + { SCENE_YOUSEI_IZUMI, 7, 0x858B }, }; static EntranceTableEntry sFairyFountainEntrance8[] = { - { 0x26, 0x08, 0x858B }, + { SCENE_YOUSEI_IZUMI, 8, 0x858B }, }; static EntranceTableEntry sFairyFountainEntrance9[] = { - { 0x26, 0x09, 0x858B }, + { SCENE_YOUSEI_IZUMI, 9, 0x858B }, }; static EntranceTableEntry* sFairyFountainEntranceTable[] = { @@ -843,7 +843,7 @@ static EntranceTableEntry* sFairyFountainEntranceTable[] = { }; static EntranceTableEntry sSwampSpiderHouseEntrance0[] = { - { 0xD9, 0x00, 0x4102 }, + { -SCENE_KINSTA1, 0, 0x4102 }, }; static EntranceTableEntry* sSwampSpiderHouseEntranceTable[] = { @@ -851,7 +851,7 @@ static EntranceTableEntry* sSwampSpiderHouseEntranceTable[] = { }; static EntranceTableEntry sOceansideSpiderHouseEntrance0[] = { - { 0xD8, 0x00, 0x4102 }, + { -SCENE_KINDAN2, 0, 0x4102 }, }; static EntranceTableEntry* sOceansideSpiderHouseEntranceTable[] = { @@ -859,15 +859,15 @@ static EntranceTableEntry* sOceansideSpiderHouseEntranceTable[] = { }; static EntranceTableEntry sAstralObservatoryEntrance0[] = { - { 0x29, 0x00, 0x0102 }, + { SCENE_TENMON_DAI, 0, 0x0102 }, }; static EntranceTableEntry sAstralObservatoryEntrance1[] = { - { 0x29, 0x01, 0x4102 }, + { SCENE_TENMON_DAI, 1, 0x4102 }, }; static EntranceTableEntry sAstralObservatoryEntrance2[] = { - { 0x29, 0x02, 0x8115 }, + { SCENE_TENMON_DAI, 2, 0x8115 }, }; static EntranceTableEntry* sAstralObservatoryEntranceTable[] = { @@ -877,7 +877,7 @@ static EntranceTableEntry* sAstralObservatoryEntranceTable[] = { }; static EntranceTableEntry sMoonDekuTrialEntrance0[] = { - { 0xD6, 0x00, 0x0387 }, + { -SCENE_LAST_DEKU, 0, 0x0387 }, }; static EntranceTableEntry* sMoonDekuTrialEntranceTable[] = { @@ -885,47 +885,47 @@ static EntranceTableEntry* sMoonDekuTrialEntranceTable[] = { }; static EntranceTableEntry sDekuPalaceEntrance0[] = { - { 0x2B, 0x00, 0x4102 }, + { SCENE_22DEKUCITY, 0, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance1[] = { - { 0x2B, 0x01, 0x8A14 }, + { SCENE_22DEKUCITY, 1, 0x8A14 }, }; static EntranceTableEntry sDekuPalaceEntrance2[] = { - { 0x2B, 0x02, 0xC102 }, + { SCENE_22DEKUCITY, 2, 0xC102 }, }; static EntranceTableEntry sDekuPalaceEntrance3[] = { - { 0x2B, 0x03, 0xC102 }, + { SCENE_22DEKUCITY, 3, 0xC102 }, }; static EntranceTableEntry sDekuPalaceEntrance4[] = { - { 0x2B, 0x04, 0x4102 }, + { SCENE_22DEKUCITY, 4, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance5[] = { - { 0x2B, 0x05, 0x4102 }, + { SCENE_22DEKUCITY, 5, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance6[] = { - { 0x2B, 0x06, 0x4102 }, + { SCENE_22DEKUCITY, 6, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance7[] = { - { 0x2B, 0x07, 0x4102 }, + { SCENE_22DEKUCITY, 7, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance8[] = { - { 0x2B, 0x08, 0x4102 }, + { SCENE_22DEKUCITY, 8, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance9[] = { - { 0x2B, 0x09, 0x4102 }, + { SCENE_22DEKUCITY, 9, 0x4102 }, }; static EntranceTableEntry sDekuPalaceEntrance10[] = { - { 0x2B, 0x0A, 0x4102 }, + { SCENE_22DEKUCITY, 10, 0x4102 }, }; static EntranceTableEntry* sDekuPalaceEntranceTable[] = { @@ -935,7 +935,7 @@ static EntranceTableEntry* sDekuPalaceEntranceTable[] = { }; static EntranceTableEntry sMountainSmithyEntrance0[] = { - { 0x2C, 0x00, 0x4102 }, + { SCENE_KAJIYA, 0, 0x4102 }, }; static EntranceTableEntry* sMountainSmithyEntranceTable[] = { @@ -943,79 +943,81 @@ static EntranceTableEntry* sMountainSmithyEntranceTable[] = { }; static EntranceTableEntry sTerminaFieldEntrance0[] = { - { 0x2D, 0x00, 0x4102 }, { 0xD3, 0x00, 0x0A14 }, { 0xD3, 0x00, 0x0A14 }, { 0xD3, 0x00, 0x058B }, - { 0x2D, 0x00, 0x0A14 }, { 0x2D, 0x00, 0x0A14 }, { 0x2D, 0x00, 0x058B }, { 0x2D, 0x00, 0x8102 }, - { 0x2D, 0x00, 0x0102 }, { 0x2D, 0x00, 0x8102 }, + { SCENE_00KEIKOKU, 0, 0x4102 }, { -SCENE_00KEIKOKU, 0, 0x0A14 }, { -SCENE_00KEIKOKU, 0, 0x0A14 }, + { -SCENE_00KEIKOKU, 0, 0x058B }, { SCENE_00KEIKOKU, 0, 0x0A14 }, { SCENE_00KEIKOKU, 0, 0x0A14 }, + { SCENE_00KEIKOKU, 0, 0x058B }, { SCENE_00KEIKOKU, 0, 0x8102 }, { SCENE_00KEIKOKU, 0, 0x0102 }, + { SCENE_00KEIKOKU, 0, 0x8102 }, }; static EntranceTableEntry sTerminaFieldEntrance1[] = { - { 0x2D, 0x01, 0xCA14 }, { 0x2D, 0x01, 0x0A14 }, { 0x2D, 0x01, 0x058B }, { 0xD3, 0x01, 0x858B }, - { 0x2D, 0x01, 0x0A14 }, { 0x2D, 0x01, 0x0A14 }, { 0x2D, 0x01, 0x058B }, { 0x2D, 0x01, 0x858B }, - { 0x2D, 0x01, 0x0102 }, { 0x2D, 0x01, 0x8102 }, + { SCENE_00KEIKOKU, 1, 0xCA14 }, { SCENE_00KEIKOKU, 1, 0x0A14 }, { SCENE_00KEIKOKU, 1, 0x058B }, + { -SCENE_00KEIKOKU, 1, 0x858B }, { SCENE_00KEIKOKU, 1, 0x0A14 }, { SCENE_00KEIKOKU, 1, 0x0A14 }, + { SCENE_00KEIKOKU, 1, 0x058B }, { SCENE_00KEIKOKU, 1, 0x858B }, { SCENE_00KEIKOKU, 1, 0x0102 }, + { SCENE_00KEIKOKU, 1, 0x8102 }, }; static EntranceTableEntry sTerminaFieldEntrance2[] = { - { 0x2D, 0x02, 0xCA14 }, { 0xD3, 0x02, 0x0A14 }, { 0xD3, 0x02, 0x0A14 }, - { 0xD3, 0x02, 0x058B }, { 0x2D, 0x02, 0x0A14 }, { 0x2D, 0x02, 0x0A14 }, + { SCENE_00KEIKOKU, 2, 0xCA14 }, { -SCENE_00KEIKOKU, 2, 0x0A14 }, { -SCENE_00KEIKOKU, 2, 0x0A14 }, + { -SCENE_00KEIKOKU, 2, 0x058B }, { SCENE_00KEIKOKU, 2, 0x0A14 }, { SCENE_00KEIKOKU, 2, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance3[] = { - { 0x2D, 0x03, 0xCA14 }, { 0xD3, 0x03, 0x0A14 }, { 0xD3, 0x03, 0x0A14 }, - { 0xD3, 0x03, 0x058B }, { 0x2D, 0x03, 0x0A14 }, { 0x2D, 0x03, 0x0A14 }, + { SCENE_00KEIKOKU, 3, 0xCA14 }, { -SCENE_00KEIKOKU, 3, 0x0A14 }, { -SCENE_00KEIKOKU, 3, 0x0A14 }, + { -SCENE_00KEIKOKU, 3, 0x058B }, { SCENE_00KEIKOKU, 3, 0x0A14 }, { SCENE_00KEIKOKU, 3, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance4[] = { - { 0x2D, 0x04, 0xCA14 }, { 0xD3, 0x04, 0x0A14 }, { 0xD3, 0x04, 0x0A14 }, - { 0xD3, 0x04, 0x058B }, { 0x2D, 0x04, 0x0A14 }, { 0x2D, 0x04, 0x0A14 }, + { SCENE_00KEIKOKU, 4, 0xCA14 }, { -SCENE_00KEIKOKU, 4, 0x0A14 }, { -SCENE_00KEIKOKU, 4, 0x0A14 }, + { -SCENE_00KEIKOKU, 4, 0x058B }, { SCENE_00KEIKOKU, 4, 0x0A14 }, { SCENE_00KEIKOKU, 4, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance5[] = { - { 0x2D, 0x05, 0xCA14 }, { 0xD3, 0x05, 0x0A14 }, { 0xD3, 0x05, 0x0A14 }, - { 0xD3, 0x05, 0x858B }, { 0x2D, 0x05, 0x0A14 }, { 0x2D, 0x05, 0x0A14 }, + { SCENE_00KEIKOKU, 5, 0xCA14 }, { -SCENE_00KEIKOKU, 5, 0x0A14 }, { -SCENE_00KEIKOKU, 5, 0x0A14 }, + { -SCENE_00KEIKOKU, 5, 0x858B }, { SCENE_00KEIKOKU, 5, 0x0A14 }, { SCENE_00KEIKOKU, 5, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance6[] = { - { 0x2D, 0x06, 0x4102 }, { 0xD3, 0x06, 0x0A14 }, { 0xD3, 0x06, 0x0A14 }, - { 0xD3, 0x06, 0x858B }, { 0x2D, 0x06, 0x0A14 }, { 0x2D, 0x06, 0x0A14 }, + { SCENE_00KEIKOKU, 6, 0x4102 }, { -SCENE_00KEIKOKU, 6, 0x0A14 }, { -SCENE_00KEIKOKU, 6, 0x0A14 }, + { -SCENE_00KEIKOKU, 6, 0x858B }, { SCENE_00KEIKOKU, 6, 0x0A14 }, { SCENE_00KEIKOKU, 6, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance7[] = { - { 0x2D, 0x07, 0x4102 }, { 0xD3, 0x07, 0x0A14 }, { 0xD3, 0x07, 0x0A14 }, - { 0xD3, 0x07, 0x858B }, { 0x2D, 0x07, 0x0A14 }, { 0x2D, 0x07, 0x0A14 }, + { SCENE_00KEIKOKU, 7, 0x4102 }, { -SCENE_00KEIKOKU, 7, 0x0A14 }, { -SCENE_00KEIKOKU, 7, 0x0A14 }, + { -SCENE_00KEIKOKU, 7, 0x858B }, { SCENE_00KEIKOKU, 7, 0x0A14 }, { SCENE_00KEIKOKU, 7, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance8[] = { - { 0x2D, 0x08, 0x4102 }, { 0xD3, 0x08, 0x0A14 }, { 0xD3, 0x08, 0x0A14 }, - { 0xD3, 0x08, 0x058B }, { 0x2D, 0x08, 0x0A14 }, { 0x2D, 0x08, 0x0A14 }, + { SCENE_00KEIKOKU, 8, 0x4102 }, { -SCENE_00KEIKOKU, 8, 0x0A14 }, { -SCENE_00KEIKOKU, 8, 0x0A14 }, + { -SCENE_00KEIKOKU, 8, 0x058B }, { SCENE_00KEIKOKU, 8, 0x0A14 }, { SCENE_00KEIKOKU, 8, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance9[] = { - { 0x2D, 0x09, 0x4102 }, { 0xD3, 0x09, 0x0A14 }, { 0xD3, 0x09, 0x0A14 }, - { 0xD3, 0x09, 0x058B }, { 0x2D, 0x09, 0x0A14 }, { 0x2D, 0x09, 0x0A14 }, + { SCENE_00KEIKOKU, 9, 0x4102 }, { -SCENE_00KEIKOKU, 9, 0x0A14 }, { -SCENE_00KEIKOKU, 9, 0x0A14 }, + { -SCENE_00KEIKOKU, 9, 0x058B }, { SCENE_00KEIKOKU, 9, 0x0A14 }, { SCENE_00KEIKOKU, 9, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance10[] = { - { 0x2D, 0x0A, 0x8A95 }, { 0xD3, 0x0A, 0x0A14 }, { 0xD3, 0x0A, 0x0A14 }, - { 0xD3, 0x0A, 0x058B }, { 0x2D, 0x0A, 0x0A14 }, { 0x2D, 0x0A, 0x0A95 }, + { SCENE_00KEIKOKU, 10, 0x8A95 }, { -SCENE_00KEIKOKU, 10, 0x0A14 }, { -SCENE_00KEIKOKU, 10, 0x0A14 }, + { -SCENE_00KEIKOKU, 10, 0x058B }, { SCENE_00KEIKOKU, 10, 0x0A14 }, { SCENE_00KEIKOKU, 10, 0x0A95 }, }; static EntranceTableEntry sTerminaFieldEntrance11[] = { - { 0x2D, 0x0B, 0x4A14 }, { 0xD3, 0x0B, 0x0A14 }, { 0xD3, 0x0B, 0x0A14 }, - { 0xD3, 0x0B, 0x058B }, { 0x2D, 0x0B, 0x0A14 }, { 0x2D, 0x0B, 0x0A14 }, + { SCENE_00KEIKOKU, 11, 0x4A14 }, { -SCENE_00KEIKOKU, 11, 0x0A14 }, { -SCENE_00KEIKOKU, 11, 0x0A14 }, + { -SCENE_00KEIKOKU, 11, 0x058B }, { SCENE_00KEIKOKU, 11, 0x0A14 }, { SCENE_00KEIKOKU, 11, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance12[] = { - { 0x2D, 0x0C, 0x0A14 }, { 0xD3, 0x0C, 0x0A14 }, { 0xD3, 0x0C, 0x0A14 }, - { 0xD3, 0x0C, 0x058B }, { 0x2D, 0x0C, 0x0A14 }, { 0x2D, 0x0C, 0x0A14 }, + { SCENE_00KEIKOKU, 12, 0x0A14 }, { -SCENE_00KEIKOKU, 12, 0x0A14 }, { -SCENE_00KEIKOKU, 12, 0x0A14 }, + { -SCENE_00KEIKOKU, 12, 0x058B }, { SCENE_00KEIKOKU, 12, 0x0A14 }, { SCENE_00KEIKOKU, 12, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance13[] = { - { 0x2D, 0x0D, 0x0A14 }, { 0xD3, 0x0D, 0x0A14 }, { 0xD3, 0x0D, 0x0A14 }, - { 0xD3, 0x0D, 0x058B }, { 0x2D, 0x0D, 0x0A14 }, { 0x2D, 0x0D, 0x0A14 }, + { SCENE_00KEIKOKU, 13, 0x0A14 }, { -SCENE_00KEIKOKU, 13, 0x0A14 }, { -SCENE_00KEIKOKU, 13, 0x0A14 }, + { -SCENE_00KEIKOKU, 13, 0x058B }, { SCENE_00KEIKOKU, 13, 0x0A14 }, { SCENE_00KEIKOKU, 13, 0x0A14 }, }; static EntranceTableEntry sTerminaFieldEntrance14[] = { - { 0x2D, 0x0E, 0x858B }, + { SCENE_00KEIKOKU, 14, 0x858B }, }; static EntranceTableEntry* sTerminaFieldEntranceTable[] = { @@ -1026,7 +1028,7 @@ static EntranceTableEntry* sTerminaFieldEntranceTable[] = { }; static EntranceTableEntry sPostOfficeEntrance0[] = { - { 0x2E, 0x00, 0x4102 }, + { SCENE_POSTHOUSE, 0, 0x4102 }, }; static EntranceTableEntry* sPostOfficeEntranceTable[] = { @@ -1034,7 +1036,7 @@ static EntranceTableEntry* sPostOfficeEntranceTable[] = { }; static EntranceTableEntry sMarineResearchLabEntrance0[] = { - { 0x2F, 0x00, 0x4102 }, + { SCENE_LABO, 0, 0x4102 }, }; static EntranceTableEntry* sMarineResearchLabEntranceTable[] = { @@ -1042,11 +1044,11 @@ static EntranceTableEntry* sMarineResearchLabEntranceTable[] = { }; static EntranceTableEntry sDampesHouseEntrance0[] = { - { 0x30, 0x00, 0x4102 }, + { SCENE_DANPEI2TEST, 0, 0x4102 }, }; static EntranceTableEntry sDampesHouseEntrance1[] = { - { 0x30, 0x01, 0x0102 }, + { SCENE_DANPEI2TEST, 1, 0x0102 }, }; static EntranceTableEntry* sDampesHouseEntranceTable[] = { @@ -1055,23 +1057,23 @@ static EntranceTableEntry* sDampesHouseEntranceTable[] = { }; static EntranceTableEntry sGoronShrineEntrance0[] = { - { 0x32, 0x00, 0x4102 }, - { 0x32, 0x00, 0x4102 }, + { SCENE_16GORON_HOUSE, 0, 0x4102 }, + { SCENE_16GORON_HOUSE, 0, 0x4102 }, }; static EntranceTableEntry sGoronShrineEntrance1[] = { - { 0x32, 0x01, 0x0102 }, - { 0x32, 0x01, 0x0102 }, + { SCENE_16GORON_HOUSE, 1, 0x0102 }, + { SCENE_16GORON_HOUSE, 1, 0x0102 }, }; static EntranceTableEntry sGoronShrineEntrance2[] = { - { 0x32, 0x02, 0x058B }, - { 0x32, 0x02, 0x058B }, + { SCENE_16GORON_HOUSE, 2, 0x058B }, + { SCENE_16GORON_HOUSE, 2, 0x058B }, }; static EntranceTableEntry sGoronShrineEntrance3[] = { - { 0x32, 0x03, 0x0102 }, - { 0x32, 0x03, 0x0102 }, + { SCENE_16GORON_HOUSE, 3, 0x0102 }, + { SCENE_16GORON_HOUSE, 3, 0x0102 }, }; static EntranceTableEntry* sGoronShrineEntranceTable[] = { @@ -1082,40 +1084,40 @@ static EntranceTableEntry* sGoronShrineEntranceTable[] = { }; static EntranceTableEntry sZoraHallEntrance0[] = { - { 0x33, 0x00, 0x4993 }, - { 0x33, 0x00, 0x8102 }, + { SCENE_33ZORACITY, 0, 0x4993 }, + { SCENE_33ZORACITY, 0, 0x8102 }, }; static EntranceTableEntry sZoraHallEntrance1[] = { - { 0x33, 0x01, 0x4102 }, + { SCENE_33ZORACITY, 1, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance2[] = { - { 0x33, 0x02, 0x4102 }, + { SCENE_33ZORACITY, 2, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance3[] = { - { 0x33, 0x03, 0x4102 }, + { SCENE_33ZORACITY, 3, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance4[] = { - { 0x33, 0x04, 0x4102 }, + { SCENE_33ZORACITY, 4, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance5[] = { - { 0x33, 0x05, 0x4102 }, + { SCENE_33ZORACITY, 5, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance6[] = { - { 0x33, 0x06, 0x4102 }, + { SCENE_33ZORACITY, 6, 0x4102 }, }; static EntranceTableEntry sZoraHallEntrance7[] = { - { 0x33, 0x07, 0x058B }, + { SCENE_33ZORACITY, 7, 0x058B }, }; static EntranceTableEntry sZoraHallEntrance8[] = { - { 0x33, 0x08, 0x8183 }, + { SCENE_33ZORACITY, 8, 0x8183 }, }; static EntranceTableEntry* sZoraHallEntranceTable[] = { @@ -1124,11 +1126,11 @@ static EntranceTableEntry* sZoraHallEntranceTable[] = { }; static EntranceTableEntry sTradingPostEntrance0[] = { - { 0x34, 0x00, 0x4102 }, + { SCENE_8ITEMSHOP, 0, 0x4102 }, }; static EntranceTableEntry sTradingPostEntrance1[] = { - { 0x34, 0x01, 0x0102 }, + { SCENE_8ITEMSHOP, 1, 0x0102 }, }; static EntranceTableEntry* sTradingPostEntranceTable[] = { @@ -1137,52 +1139,52 @@ static EntranceTableEntry* sTradingPostEntranceTable[] = { }; static EntranceTableEntry sRomaniRanchEntrance0[] = { - { 0x35, 0x00, 0x4A14 }, { 0x35, 0x00, 0x0A14 }, { 0x35, 0x00, 0x8102 }, { 0x35, 0x00, 0x858B }, - { 0x35, 0x00, 0x858B }, { 0x35, 0x00, 0x0102 }, { 0x35, 0x00, 0x8102 }, + { SCENE_F01, 0, 0x4A14 }, { SCENE_F01, 0, 0x0A14 }, { SCENE_F01, 0, 0x8102 }, { SCENE_F01, 0, 0x858B }, + { SCENE_F01, 0, 0x858B }, { SCENE_F01, 0, 0x0102 }, { SCENE_F01, 0, 0x8102 }, }; static EntranceTableEntry sRomaniRanchEntrance1[] = { - { 0x35, 0x01, 0x0A14 }, + { SCENE_F01, 1, 0x0A14 }, }; static EntranceTableEntry sRomaniRanchEntrance2[] = { - { 0x35, 0x02, 0x0102 }, + { SCENE_F01, 2, 0x0102 }, }; static EntranceTableEntry sRomaniRanchEntrance3[] = { - { 0x35, 0x03, 0x0102 }, + { SCENE_F01, 3, 0x0102 }, }; static EntranceTableEntry sRomaniRanchEntrance4[] = { - { 0x35, 0x04, 0x8102 }, + { SCENE_F01, 4, 0x8102 }, }; static EntranceTableEntry sRomaniRanchEntrance5[] = { - { 0x35, 0x05, 0x8102 }, + { SCENE_F01, 5, 0x8102 }, }; static EntranceTableEntry sRomaniRanchEntrance6[] = { - { 0x35, 0x06, 0x0A14 }, + { SCENE_F01, 6, 0x0A14 }, }; static EntranceTableEntry sRomaniRanchEntrance7[] = { - { 0x35, 0x07, 0x0A14 }, + { SCENE_F01, 7, 0x0A14 }, }; static EntranceTableEntry sRomaniRanchEntrance8[] = { - { 0x35, 0x08, 0x0A14 }, + { SCENE_F01, 8, 0x0A14 }, }; static EntranceTableEntry sRomaniRanchEntrance9[] = { - { 0x35, 0x09, 0x0102 }, + { SCENE_F01, 9, 0x0102 }, }; static EntranceTableEntry sRomaniRanchEntrance10[] = { - { 0x35, 0x0A, 0x0102 }, + { SCENE_F01, 10, 0x0102 }, }; static EntranceTableEntry sRomaniRanchEntrance11[] = { - { 0x35, 0x0B, 0x0102 }, + { SCENE_F01, 11, 0x0102 }, }; static EntranceTableEntry* sRomaniRanchEntranceTable[] = { @@ -1192,23 +1194,23 @@ static EntranceTableEntry* sRomaniRanchEntranceTable[] = { }; static EntranceTableEntry sTwinmoldsLairEntrance0[] = { - { 0xCA, 0x00, 0x0102 }, + { -SCENE_INISIE_BS, 0, 0x0102 }, }; static EntranceTableEntry sTwinmoldsLairEntrance1[] = { - { 0xCA, 0x01, 0x0102 }, + { -SCENE_INISIE_BS, 1, 0x0102 }, }; static EntranceTableEntry sTwinmoldsLairEntrance2[] = { - { 0xCA, 0x02, 0x0102 }, + { -SCENE_INISIE_BS, 2, 0x0102 }, }; static EntranceTableEntry sTwinmoldsLairEntrance3[] = { - { 0xCA, 0x03, 0x0102 }, + { -SCENE_INISIE_BS, 3, 0x0102 }, }; static EntranceTableEntry sTwinmoldsLairEntrance4[] = { - { 0xCA, 0x04, 0x0102 }, + { -SCENE_INISIE_BS, 4, 0x0102 }, }; static EntranceTableEntry* sTwinmoldsLairEntranceTable[] = { @@ -1217,74 +1219,74 @@ static EntranceTableEntry* sTwinmoldsLairEntranceTable[] = { }; static EntranceTableEntry sGreatBayCoastEntrance0[] = { - { 0x37, 0x00, 0xCA14 }, - { 0x37, 0x00, 0xCA14 }, - { 0x37, 0x00, 0x8102 }, + { SCENE_30GYOSON, 0, 0xCA14 }, + { SCENE_30GYOSON, 0, 0xCA14 }, + { SCENE_30GYOSON, 0, 0x8102 }, }; static EntranceTableEntry sGreatBayCoastEntrance1[] = { - { 0x37, 0x01, 0xCA14 }, - { 0x37, 0x01, 0xCA14 }, + { SCENE_30GYOSON, 1, 0xCA14 }, + { SCENE_30GYOSON, 1, 0xCA14 }, }; static EntranceTableEntry sGreatBayCoastEntrance2[] = { - { 0x37, 0x02, 0x4993 }, - { 0x37, 0x02, 0x4993 }, + { SCENE_30GYOSON, 2, 0x4993 }, + { SCENE_30GYOSON, 2, 0x4993 }, }; static EntranceTableEntry sGreatBayCoastEntrance3[] = { - { 0x37, 0x03, 0x4A14 }, - { 0x37, 0x03, 0x4A14 }, + { SCENE_30GYOSON, 3, 0x4A14 }, + { SCENE_30GYOSON, 3, 0x4A14 }, }; static EntranceTableEntry sGreatBayCoastEntrance4[] = { - { 0x37, 0x04, 0x4102 }, - { 0x37, 0x04, 0x4102 }, + { SCENE_30GYOSON, 4, 0x4102 }, + { SCENE_30GYOSON, 4, 0x4102 }, }; static EntranceTableEntry sGreatBayCoastEntrance5[] = { - { 0x37, 0x05, 0x4993 }, - { 0x37, 0x05, 0x4993 }, + { SCENE_30GYOSON, 5, 0x4993 }, + { SCENE_30GYOSON, 5, 0x4993 }, }; static EntranceTableEntry sGreatBayCoastEntrance6[] = { - { 0x37, 0x06, 0x4993 }, - { 0x37, 0x06, 0x4993 }, + { SCENE_30GYOSON, 6, 0x4993 }, + { SCENE_30GYOSON, 6, 0x4993 }, }; static EntranceTableEntry sGreatBayCoastEntrance7[] = { - { 0x37, 0x07, 0x4102 }, - { 0x37, 0x07, 0x4102 }, + { SCENE_30GYOSON, 7, 0x4102 }, + { SCENE_30GYOSON, 7, 0x4102 }, }; static EntranceTableEntry sGreatBayCoastEntrance8[] = { - { 0x37, 0x08, 0x4102 }, - { 0x37, 0x08, 0x4102 }, + { SCENE_30GYOSON, 8, 0x4102 }, + { SCENE_30GYOSON, 8, 0x4102 }, }; static EntranceTableEntry sGreatBayCoastEntrance9[] = { - { 0x37, 0x09, 0x058B }, - { 0x37, 0x09, 0x058B }, + { SCENE_30GYOSON, 9, 0x058B }, + { SCENE_30GYOSON, 9, 0x058B }, }; static EntranceTableEntry sGreatBayCoastEntrance10[] = { - { 0x37, 0x0A, 0x858B }, - { 0x37, 0x0A, 0x858B }, + { SCENE_30GYOSON, 10, 0x858B }, + { SCENE_30GYOSON, 10, 0x858B }, }; static EntranceTableEntry sGreatBayCoastEntrance11[] = { - { 0x37, 0x0B, 0x0A14 }, - { 0x37, 0x0B, 0x0A14 }, + { SCENE_30GYOSON, 11, 0x0A14 }, + { SCENE_30GYOSON, 11, 0x0A14 }, }; static EntranceTableEntry sGreatBayCoastEntrance12[] = { - { 0x37, 0x0C, 0x0A14 }, - { 0x37, 0x0C, 0x0A14 }, + { SCENE_30GYOSON, 12, 0x0A14 }, + { SCENE_30GYOSON, 12, 0x0A14 }, }; static EntranceTableEntry sGreatBayCoastEntrance13[] = { - { 0x37, 0x0D, 0x0A14 }, - { 0x37, 0x0D, 0x0A14 }, + { SCENE_30GYOSON, 13, 0x0A14 }, + { SCENE_30GYOSON, 13, 0x0A14 }, }; static EntranceTableEntry* sGreatBayCoastEntranceTable[] = { @@ -1295,53 +1297,53 @@ static EntranceTableEntry* sGreatBayCoastEntranceTable[] = { }; static EntranceTableEntry sZoraCapeEntrance0[] = { - { 0x38, 0x00, 0x8A14 }, - { 0x38, 0x00, 0x8A14 }, + { SCENE_31MISAKI, 0, 0x8A14 }, + { SCENE_31MISAKI, 0, 0x8A14 }, }; static EntranceTableEntry sZoraCapeEntrance1[] = { - { 0x38, 0x01, 0x4993 }, - { 0x38, 0x01, 0x4993 }, + { SCENE_31MISAKI, 1, 0x4993 }, + { SCENE_31MISAKI, 1, 0x4993 }, }; static EntranceTableEntry sZoraCapeEntrance2[] = { - { 0x38, 0x02, 0x4102 }, - { 0x38, 0x02, 0x4102 }, + { SCENE_31MISAKI, 2, 0x4102 }, + { SCENE_31MISAKI, 2, 0x4102 }, }; static EntranceTableEntry sZoraCapeEntrance3[] = { - { 0x38, 0x03, 0x0993 }, - { 0x38, 0x03, 0x0993 }, + { SCENE_31MISAKI, 3, 0x0993 }, + { SCENE_31MISAKI, 3, 0x0993 }, }; static EntranceTableEntry sZoraCapeEntrance4[] = { - { 0x38, 0x04, 0x4102 }, - { 0x38, 0x04, 0x4102 }, + { SCENE_31MISAKI, 4, 0x4102 }, + { SCENE_31MISAKI, 4, 0x4102 }, }; static EntranceTableEntry sZoraCapeEntrance5[] = { - { 0x38, 0x05, 0x0102 }, - { 0x38, 0x05, 0x0102 }, + { SCENE_31MISAKI, 5, 0x0102 }, + { SCENE_31MISAKI, 5, 0x0102 }, }; static EntranceTableEntry sZoraCapeEntrance6[] = { - { 0x38, 0x06, 0x0A14 }, - { 0x38, 0x06, 0x0A14 }, + { SCENE_31MISAKI, 6, 0x0A14 }, + { SCENE_31MISAKI, 6, 0x0A14 }, }; static EntranceTableEntry sZoraCapeEntrance7[] = { - { 0x38, 0x07, 0x0A14 }, - { 0x38, 0x07, 0x0A14 }, + { SCENE_31MISAKI, 7, 0x0A14 }, + { SCENE_31MISAKI, 7, 0x0A14 }, }; static EntranceTableEntry sZoraCapeEntrance8[] = { - { 0x38, 0x08, 0x0A14 }, - { 0x38, 0x08, 0x0A14 }, + { SCENE_31MISAKI, 8, 0x0A14 }, + { SCENE_31MISAKI, 8, 0x0A14 }, }; static EntranceTableEntry sZoraCapeEntrance9[] = { - { 0x38, 0x09, 0x0A14 }, - { 0x38, 0x09, 0x0A14 }, + { SCENE_31MISAKI, 9, 0x0A14 }, + { SCENE_31MISAKI, 9, 0x0A14 }, }; static EntranceTableEntry* sZoraCapeEntranceTable[] = { @@ -1350,7 +1352,7 @@ static EntranceTableEntry* sZoraCapeEntranceTable[] = { }; static EntranceTableEntry sLotteryShopEntrance0[] = { - { 0x39, 0x00, 0x4102 }, + { SCENE_TAKARAKUJI, 0, 0x4102 }, }; static EntranceTableEntry* sLotteryShopEntranceTable[] = { @@ -1358,31 +1360,31 @@ static EntranceTableEntry* sLotteryShopEntranceTable[] = { }; static EntranceTableEntry sPiratesFortressExteriorEntrance0[] = { - { 0x3B, 0x00, 0x4993 }, + { SCENE_TORIDE, 0, 0x4993 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance1[] = { - { 0x3B, 0x01, 0x8102 }, + { SCENE_TORIDE, 1, 0x8102 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance2[] = { - { 0x3B, 0x02, 0x8993 }, + { SCENE_TORIDE, 2, 0x8993 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance3[] = { - { 0x3B, 0x03, 0x8993 }, + { SCENE_TORIDE, 3, 0x8993 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance4[] = { - { 0x3B, 0x04, 0x8102 }, + { SCENE_TORIDE, 4, 0x8102 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance5[] = { - { 0x3B, 0x05, 0x8102 }, + { SCENE_TORIDE, 5, 0x8102 }, }; static EntranceTableEntry sPiratesFortressExteriorEntrance6[] = { - { 0x3B, 0x06, 0x8102 }, + { SCENE_TORIDE, 6, 0x8102 }, }; static EntranceTableEntry* sPiratesFortressExteriorEntranceTable[] = { @@ -1392,7 +1394,7 @@ static EntranceTableEntry* sPiratesFortressExteriorEntranceTable[] = { }; static EntranceTableEntry sFishermansHutEntrance0[] = { - { 0x3C, 0x00, 0x4102 }, + { SCENE_FISHERMAN, 0, 0x4102 }, }; static EntranceTableEntry* sFishermansHutEntranceTable[] = { @@ -1400,7 +1402,7 @@ static EntranceTableEntry* sFishermansHutEntranceTable[] = { }; static EntranceTableEntry sGoronShopEntrance0[] = { - { 0x3D, 0x00, 0x4102 }, + { SCENE_GORONSHOP, 0, 0x4102 }, }; static EntranceTableEntry* sGoronShopEntranceTable[] = { @@ -1408,20 +1410,20 @@ static EntranceTableEntry* sGoronShopEntranceTable[] = { }; static EntranceTableEntry sDekuKingsChamberEntrance0[] = { - { 0xC2, 0x00, 0xC102 }, - { 0xC2, 0x00, 0x8102 }, + { -SCENE_DEKU_KING, 0, 0xC102 }, + { -SCENE_DEKU_KING, 0, 0x8102 }, }; static EntranceTableEntry sDekuKingsChamberEntrance1[] = { - { 0xC2, 0x01, 0xC102 }, + { -SCENE_DEKU_KING, 1, 0xC102 }, }; static EntranceTableEntry sDekuKingsChamberEntrance2[] = { - { 0xC2, 0x02, 0x858B }, + { -SCENE_DEKU_KING, 2, 0x858B }, }; static EntranceTableEntry sDekuKingsChamberEntrance3[] = { - { 0xC2, 0x03, 0x0102 }, + { -SCENE_DEKU_KING, 3, 0x0102 }, }; static EntranceTableEntry* sDekuKingsChamberEntranceTable[] = { @@ -1432,7 +1434,7 @@ static EntranceTableEntry* sDekuKingsChamberEntranceTable[] = { }; static EntranceTableEntry sMoonGoronTrialEntrance0[] = { - { 0xC1, 0x00, 0x0387 }, + { -SCENE_LAST_GORON, 0, 0x0387 }, }; static EntranceTableEntry* sMoonGoronTrialEntranceTable[] = { @@ -1440,15 +1442,15 @@ static EntranceTableEntry* sMoonGoronTrialEntranceTable[] = { }; static EntranceTableEntry sRoadToSouthernSwampEntrance0[] = { - { 0x40, 0x00, 0x8A14 }, + { SCENE_24KEMONOMITI, 0, 0x8A14 }, }; static EntranceTableEntry sRoadToSouthernSwampEntrance1[] = { - { 0x40, 0x01, 0x8A14 }, + { SCENE_24KEMONOMITI, 1, 0x8A14 }, }; static EntranceTableEntry sRoadToSouthernSwampEntrance2[] = { - { 0x40, 0x02, 0x0102 }, + { SCENE_24KEMONOMITI, 2, 0x0102 }, }; static EntranceTableEntry* sRoadToSouthernSwampEntranceTable[] = { @@ -1458,11 +1460,11 @@ static EntranceTableEntry* sRoadToSouthernSwampEntranceTable[] = { }; static EntranceTableEntry sDoggyRacetrackEntrance0[] = { - { 0x41, 0x00, 0xC102 }, + { SCENE_F01_B, 0, 0xC102 }, }; static EntranceTableEntry sDoggyRacetrackEntrance1[] = { - { 0x41, 0x01, 0x0A14 }, + { SCENE_F01_B, 1, 0x0A14 }, }; static EntranceTableEntry* sDoggyRacetrackEntranceTable[] = { @@ -1471,12 +1473,12 @@ static EntranceTableEntry* sDoggyRacetrackEntranceTable[] = { }; static EntranceTableEntry sCuccoShackEntrance0[] = { - { 0x42, 0x00, 0xC102 }, - { 0x42, 0x00, 0x8102 }, + { SCENE_F01C, 0, 0xC102 }, + { SCENE_F01C, 0, 0x8102 }, }; static EntranceTableEntry sCuccoShackEntrance1[] = { - { 0x42, 0x01, 0x0A14 }, + { SCENE_F01C, 1, 0x0A14 }, }; static EntranceTableEntry* sCuccoShackEntranceTable[] = { @@ -1485,28 +1487,28 @@ static EntranceTableEntry* sCuccoShackEntranceTable[] = { }; static EntranceTableEntry sIkanaGraveyardEntrance0[] = { - { 0x43, 0x00, 0x4A14 }, - { 0x43, 0x00, 0x8102 }, + { SCENE_BOTI, 0, 0x4A14 }, + { SCENE_BOTI, 0, 0x8102 }, }; static EntranceTableEntry sIkanaGraveyardEntrance1[] = { - { 0x43, 0x01, 0x4102 }, + { SCENE_BOTI, 1, 0x4102 }, }; static EntranceTableEntry sIkanaGraveyardEntrance2[] = { - { 0x43, 0x02, 0x4102 }, + { SCENE_BOTI, 2, 0x4102 }, }; static EntranceTableEntry sIkanaGraveyardEntrance3[] = { - { 0x43, 0x03, 0x4102 }, + { SCENE_BOTI, 3, 0x4102 }, }; static EntranceTableEntry sIkanaGraveyardEntrance4[] = { - { 0x43, 0x04, 0x4102 }, + { SCENE_BOTI, 4, 0x4102 }, }; static EntranceTableEntry sIkanaGraveyardEntrance5[] = { - { 0x43, 0x05, 0x058B }, + { SCENE_BOTI, 5, 0x058B }, }; static EntranceTableEntry* sIkanaGraveyardEntranceTable[] = { @@ -1515,7 +1517,7 @@ static EntranceTableEntry* sIkanaGraveyardEntranceTable[] = { }; static EntranceTableEntry sGohtsLairEntrance0[] = { - { 0xBC, 0x00, 0x8102 }, + { -SCENE_HAKUGIN_BS, 0, 0x8102 }, }; static EntranceTableEntry* sGohtsLairEntranceTable[] = { @@ -1523,47 +1525,47 @@ static EntranceTableEntry* sGohtsLairEntranceTable[] = { }; static EntranceTableEntry sSouthernSwampPoisonedEntrance0[] = { - { 0x45, 0x00, 0xCA14 }, + { SCENE_20SICHITAI, 0, 0xCA14 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance1[] = { - { 0x45, 0x01, 0x4102 }, + { SCENE_20SICHITAI, 1, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance2[] = { - { 0x45, 0x02, 0xC102 }, + { SCENE_20SICHITAI, 2, 0xC102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance3[] = { - { 0x45, 0x03, 0x4102 }, + { SCENE_20SICHITAI, 3, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance4[] = { - { 0x45, 0x04, 0x4102 }, + { SCENE_20SICHITAI, 4, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance5[] = { - { 0x45, 0x05, 0x4102 }, + { SCENE_20SICHITAI, 5, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance6[] = { - { 0x45, 0x06, 0x0102 }, + { SCENE_20SICHITAI, 6, 0x0102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance7[] = { - { 0x45, 0x07, 0x4102 }, + { SCENE_20SICHITAI, 7, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance8[] = { - { 0x45, 0x08, 0x4102 }, + { SCENE_20SICHITAI, 8, 0x4102 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance9[] = { - { 0x45, 0x09, 0x4A14 }, + { SCENE_20SICHITAI, 9, 0x4A14 }, }; static EntranceTableEntry sSouthernSwampPoisonedEntrance10[] = { - { 0x45, 0x0A, 0x4A14 }, + { SCENE_20SICHITAI, 10, 0x4A14 }, }; static EntranceTableEntry* sSouthernSwampPoisonedEntranceTable[] = { @@ -1574,33 +1576,33 @@ static EntranceTableEntry* sSouthernSwampPoisonedEntranceTable[] = { }; static EntranceTableEntry sWoodfallEntrance0[] = { - { 0x46, 0x00, 0xC102 }, - { 0x46, 0x00, 0x0183 }, - { 0x46, 0x00, 0xC102 }, + { SCENE_21MITURINMAE, 0, 0xC102 }, + { SCENE_21MITURINMAE, 0, 0x0183 }, + { SCENE_21MITURINMAE, 0, 0xC102 }, }; static EntranceTableEntry sWoodfallEntrance1[] = { - { 0x46, 0x01, 0x4102 }, - { 0x46, 0x01, 0x0183 }, - { 0x46, 0x01, 0x4102 }, + { SCENE_21MITURINMAE, 1, 0x4102 }, + { SCENE_21MITURINMAE, 1, 0x0183 }, + { SCENE_21MITURINMAE, 1, 0x4102 }, }; static EntranceTableEntry sWoodfallEntrance2[] = { - { 0x46, 0x02, 0x4102 }, - { 0x46, 0x02, 0x0183 }, - { 0x46, 0x02, 0x4102 }, + { SCENE_21MITURINMAE, 2, 0x4102 }, + { SCENE_21MITURINMAE, 2, 0x0183 }, + { SCENE_21MITURINMAE, 2, 0x4102 }, }; static EntranceTableEntry sWoodfallEntrance3[] = { - { 0x46, 0x03, 0x4102 }, - { 0x46, 0x03, 0x0183 }, - { 0x46, 0x03, 0x4102 }, + { SCENE_21MITURINMAE, 3, 0x4102 }, + { SCENE_21MITURINMAE, 3, 0x0183 }, + { SCENE_21MITURINMAE, 3, 0x4102 }, }; static EntranceTableEntry sWoodfallEntrance4[] = { - { 0x46, 0x04, 0x4102 }, - { 0x46, 0x04, 0x0183 }, - { 0x46, 0x04, 0x4102 }, + { SCENE_21MITURINMAE, 4, 0x4102 }, + { SCENE_21MITURINMAE, 4, 0x0183 }, + { SCENE_21MITURINMAE, 4, 0x4102 }, }; static EntranceTableEntry* sWoodfallEntranceTable[] = { @@ -1608,11 +1610,11 @@ static EntranceTableEntry* sWoodfallEntranceTable[] = { }; static EntranceTableEntry sMoonZoraTrialEntrance0[] = { - { 0xB9, 0x00, 0x0387 }, + { -SCENE_LAST_ZORA, 0, 0x0387 }, }; static EntranceTableEntry sMoonZoraTrialEntrance1[] = { - { 0xB9, 0x01, 0x0102 }, + { -SCENE_LAST_ZORA, 1, 0x0102 }, }; static EntranceTableEntry* sMoonZoraTrialEntranceTable[] = { @@ -1621,24 +1623,24 @@ static EntranceTableEntry* sMoonZoraTrialEntranceTable[] = { }; static EntranceTableEntry sGoronVillageSpringEntrance0[] = { - { 0x48, 0x00, 0xC102 }, - { 0x48, 0x00, 0x8102 }, + { SCENE_11GORONNOSATO2, 0, 0xC102 }, + { SCENE_11GORONNOSATO2, 0, 0x8102 }, }; static EntranceTableEntry sGoronVillageSpringEntrance1[] = { - { 0x48, 0x01, 0x4102 }, + { SCENE_11GORONNOSATO2, 1, 0x4102 }, }; static EntranceTableEntry sGoronVillageSpringEntrance2[] = { - { 0x48, 0x02, 0x4102 }, + { SCENE_11GORONNOSATO2, 2, 0x4102 }, }; static EntranceTableEntry sGoronVillageSpringEntrance3[] = { - { 0x48, 0x03, 0x4102 }, + { SCENE_11GORONNOSATO2, 3, 0x4102 }, }; static EntranceTableEntry sGoronVillageSpringEntrance4[] = { - { 0x48, 0x04, 0x0A14 }, + { SCENE_11GORONNOSATO2, 4, 0x0A14 }, }; static EntranceTableEntry* sGoronVillageSpringEntranceTable[] = { @@ -1647,15 +1649,15 @@ static EntranceTableEntry* sGoronVillageSpringEntranceTable[] = { }; static EntranceTableEntry sGreatBayTempleEntrance0[] = { - { 0xB7, 0x00, 0x4102 }, + { -SCENE_SEA, 0, 0x4102 }, }; static EntranceTableEntry sGreatBayTempleEntrance1[] = { - { 0xB7, 0x01, 0x0102 }, + { -SCENE_SEA, 1, 0x0102 }, }; static EntranceTableEntry sGreatBayTempleEntrance2[] = { - { 0xB7, 0x02, 0x0102 }, + { -SCENE_SEA, 2, 0x0102 }, }; static EntranceTableEntry* sGreatBayTempleEntranceTable[] = { @@ -1665,19 +1667,19 @@ static EntranceTableEntry* sGreatBayTempleEntranceTable[] = { }; static EntranceTableEntry sWaterfallRapidsEntrance0[] = { - { 0x4A, 0x00, 0x4102 }, + { SCENE_35TAKI, 0, 0x4102 }, }; static EntranceTableEntry sWaterfallRapidsEntrance1[] = { - { 0x4A, 0x01, 0x0A14 }, + { SCENE_35TAKI, 1, 0x0A14 }, }; static EntranceTableEntry sWaterfallRapidsEntrance2[] = { - { 0x4A, 0x02, 0x0A14 }, + { SCENE_35TAKI, 2, 0x0A14 }, }; static EntranceTableEntry sWaterfallRapidsEntrance3[] = { - { 0x4A, 0x03, 0x0A14 }, + { SCENE_35TAKI, 3, 0x0A14 }, }; static EntranceTableEntry* sWaterfallRapidsEntranceTable[] = { @@ -1688,11 +1690,11 @@ static EntranceTableEntry* sWaterfallRapidsEntranceTable[] = { }; static EntranceTableEntry sBeneathTheWellEntrance0[] = { - { 0xB5, 0x00, 0x4102 }, + { -SCENE_REDEAD, 0, 0x4102 }, }; static EntranceTableEntry sBeneathTheWellEntrance1[] = { - { 0xB5, 0x01, 0x4102 }, + { -SCENE_REDEAD, 1, 0x4102 }, }; static EntranceTableEntry* sBeneathTheWellEntranceTable[] = { @@ -1701,31 +1703,31 @@ static EntranceTableEntry* sBeneathTheWellEntranceTable[] = { }; static EntranceTableEntry sZoraHallRoomsEntrance0[] = { - { 0x4C, 0x00, 0x0102 }, + { SCENE_BANDROOM, 0, 0x0102 }, }; static EntranceTableEntry sZoraHallRoomsEntrance1[] = { - { 0x4C, 0x01, 0x0102 }, + { SCENE_BANDROOM, 1, 0x0102 }, }; static EntranceTableEntry sZoraHallRoomsEntrance2[] = { - { 0x4C, 0x02, 0x0102 }, + { SCENE_BANDROOM, 2, 0x0102 }, }; static EntranceTableEntry sZoraHallRoomsEntrance3[] = { - { 0x4C, 0x03, 0x0102 }, + { SCENE_BANDROOM, 3, 0x0102 }, }; static EntranceTableEntry sZoraHallRoomsEntrance4[] = { - { 0x4C, 0x04, 0x858B }, + { SCENE_BANDROOM, 4, 0x858B }, }; static EntranceTableEntry sZoraHallRoomsEntrance5[] = { - { 0x4C, 0x05, 0x0102 }, + { SCENE_BANDROOM, 5, 0x0102 }, }; static EntranceTableEntry sZoraHallRoomsEntrance6[] = { - { 0x4C, 0x06, 0x0102 }, + { SCENE_BANDROOM, 6, 0x0102 }, }; static EntranceTableEntry* sZoraHallRoomsEntranceTable[] = { @@ -1734,23 +1736,23 @@ static EntranceTableEntry* sZoraHallRoomsEntranceTable[] = { }; static EntranceTableEntry sGoronVillageWinterEntrance0[] = { - { 0x4D, 0x00, 0xC102 }, + { SCENE_11GORONNOSATO, 0, 0xC102 }, }; static EntranceTableEntry sGoronVillageWinterEntrance1[] = { - { 0x4D, 0x01, 0x4102 }, + { SCENE_11GORONNOSATO, 1, 0x4102 }, }; static EntranceTableEntry sGoronVillageWinterEntrance2[] = { - { 0x4D, 0x02, 0x4102 }, + { SCENE_11GORONNOSATO, 2, 0x4102 }, }; static EntranceTableEntry sGoronVillageWinterEntrance3[] = { - { 0x4D, 0x03, 0x4102 }, + { SCENE_11GORONNOSATO, 3, 0x4102 }, }; static EntranceTableEntry sGoronVillageWinterEntrance4[] = { - { 0x4D, 0x04, 0x0A14 }, + { SCENE_11GORONNOSATO, 4, 0x0A14 }, }; static EntranceTableEntry* sGoronVillageWinterEntranceTable[] = { @@ -1759,11 +1761,11 @@ static EntranceTableEntry* sGoronVillageWinterEntranceTable[] = { }; static EntranceTableEntry sGoronGraveryardEntrance0[] = { - { 0x4E, 0x00, 0x4102 }, + { SCENE_GORON_HAKA, 0, 0x4102 }, }; static EntranceTableEntry sGoronGraveryardEntrance1[] = { - { 0x4E, 0x01, 0x058B }, + { SCENE_GORON_HAKA, 1, 0x058B }, }; static EntranceTableEntry* sGoronGraveryardEntranceTable[] = { @@ -1772,7 +1774,7 @@ static EntranceTableEntry* sGoronGraveryardEntranceTable[] = { }; static EntranceTableEntry sSakonsHideoutEntrance0[] = { - { 0x4F, 0x00, 0x4102 }, + { SCENE_SECOM, 0, 0x4102 }, }; static EntranceTableEntry* sSakonsHideoutEntranceTable[] = { @@ -1780,39 +1782,39 @@ static EntranceTableEntry* sSakonsHideoutEntranceTable[] = { }; static EntranceTableEntry sMountainVillageWinterEntrance0[] = { - { 0x50, 0x00, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA, 0, 0x4A14 }, }; static EntranceTableEntry sMountainVillageWinterEntrance1[] = { - { 0x50, 0x01, 0x4102 }, + { SCENE_10YUKIYAMANOMURA, 1, 0x4102 }, }; static EntranceTableEntry sMountainVillageWinterEntrance2[] = { - { 0x50, 0x02, 0xCA14 }, + { SCENE_10YUKIYAMANOMURA, 2, 0xCA14 }, }; static EntranceTableEntry sMountainVillageWinterEntrance3[] = { - { 0x50, 0x03, 0x4102 }, + { SCENE_10YUKIYAMANOMURA, 3, 0x4102 }, }; static EntranceTableEntry sMountainVillageWinterEntrance4[] = { - { 0x50, 0x04, 0xCA14 }, + { SCENE_10YUKIYAMANOMURA, 4, 0xCA14 }, }; static EntranceTableEntry sMountainVillageWinterEntrance5[] = { - { 0x50, 0x05, 0x4102 }, + { SCENE_10YUKIYAMANOMURA, 5, 0x4102 }, }; static EntranceTableEntry sMountainVillageWinterEntrance6[] = { - { 0x50, 0x06, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA, 6, 0x4A14 }, }; static EntranceTableEntry sMountainVillageWinterEntrance7[] = { - { 0x50, 0x07, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA, 7, 0x4A14 }, }; static EntranceTableEntry sMountainVillageWinterEntrance8[] = { - { 0x50, 0x08, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA, 8, 0x4A14 }, }; static EntranceTableEntry* sMountainVillageWinterEntranceTable[] = { @@ -1822,15 +1824,15 @@ static EntranceTableEntry* sMountainVillageWinterEntranceTable[] = { }; static EntranceTableEntry sGhostHutEntrance0[] = { - { 0x51, 0x00, 0x4102 }, + { SCENE_TOUGITES, 0, 0x4102 }, }; static EntranceTableEntry sGhostHutEntrance1[] = { - { 0x51, 0x01, 0x0102 }, + { SCENE_TOUGITES, 1, 0x0102 }, }; static EntranceTableEntry sGhostHutEntrance2[] = { - { 0x51, 0x02, 0x0102 }, + { SCENE_TOUGITES, 2, 0x0102 }, }; static EntranceTableEntry* sGhostHutEntranceTable[] = { @@ -1840,15 +1842,15 @@ static EntranceTableEntry* sGhostHutEntranceTable[] = { }; static EntranceTableEntry sDekuShrineEntrance0[] = { - { 0x52, 0x00, 0x4102 }, + { SCENE_DANPEI, 0, 0x4102 }, }; static EntranceTableEntry sDekuShrineEntrance1[] = { - { 0x52, 0x01, 0x0102 }, + { SCENE_DANPEI, 1, 0x0102 }, }; static EntranceTableEntry sDekuShrineEntrance2[] = { - { 0x52, 0x02, 0x0102 }, + { SCENE_DANPEI, 2, 0x0102 }, }; static EntranceTableEntry* sDekuShrineEntranceTable[] = { @@ -1858,15 +1860,15 @@ static EntranceTableEntry* sDekuShrineEntranceTable[] = { }; static EntranceTableEntry sRoadToIkanaEntrance0[] = { - { 0x53, 0x00, 0x8A14 }, + { SCENE_IKANAMAE, 0, 0x8A14 }, }; static EntranceTableEntry sRoadToIkanaEntrance1[] = { - { 0x53, 0x01, 0x8A14 }, + { SCENE_IKANAMAE, 1, 0x8A14 }, }; static EntranceTableEntry sRoadToIkanaEntrance2[] = { - { 0x53, 0x02, 0x0A14 }, + { SCENE_IKANAMAE, 2, 0x0A14 }, }; static EntranceTableEntry* sRoadToIkanaEntranceTable[] = { @@ -1876,7 +1878,7 @@ static EntranceTableEntry* sRoadToIkanaEntranceTable[] = { }; static EntranceTableEntry sMusicBoxHouseEntrance0[] = { - { 0x55, 0x00, 0x4102 }, + { SCENE_MUSICHOUSE, 0, 0x4102 }, }; static EntranceTableEntry* sMusicBoxHouseEntranceTable[] = { @@ -1884,8 +1886,8 @@ static EntranceTableEntry* sMusicBoxHouseEntranceTable[] = { }; static EntranceTableEntry sIgosDuIkanasLairEntrance0[] = { - { 0xAA, 0x00, 0x8102 }, - { 0xAA, 0x00, 0x8102 }, + { -SCENE_IKNINSIDE, 0, 0x8102 }, + { -SCENE_IKNINSIDE, 0, 0x8102 }, }; static EntranceTableEntry* sIgosDuIkanasLairEntranceTable[] = { @@ -1893,7 +1895,7 @@ static EntranceTableEntry* sIgosDuIkanasLairEntranceTable[] = { }; static EntranceTableEntry sSwordmansSchoolEntrance0[] = { - { 0x54, 0x00, 0x4102 }, + { SCENE_DOUJOU, 0, 0x4102 }, }; static EntranceTableEntry* sSwordmansSchoolEntranceTable[] = { @@ -1901,15 +1903,15 @@ static EntranceTableEntry* sSwordmansSchoolEntranceTable[] = { }; static EntranceTableEntry sTouristInformationEntrance0[] = { - { 0x57, 0x00, 0x4102 }, + { SCENE_MAP_SHOP, 0, 0x4102 }, }; static EntranceTableEntry sTouristInformationEntrance1[] = { - { 0x57, 0x01, 0x0102 }, + { SCENE_MAP_SHOP, 1, 0x0102 }, }; static EntranceTableEntry sTouristInformationEntrance2[] = { - { 0x57, 0x02, 0x0102 }, + { SCENE_MAP_SHOP, 2, 0x0102 }, }; static EntranceTableEntry* sTouristInformationEntranceTable[] = { @@ -1919,19 +1921,19 @@ static EntranceTableEntry* sTouristInformationEntranceTable[] = { }; static EntranceTableEntry sStoneTowerEntrance0[] = { - { 0x58, 0x00, 0x4102 }, + { SCENE_F40, 0, 0x4102 }, }; static EntranceTableEntry sStoneTowerEntrance1[] = { - { 0x58, 0x01, 0xCA14 }, + { SCENE_F40, 1, 0xCA14 }, }; static EntranceTableEntry sStoneTowerEntrance2[] = { - { 0x58, 0x02, 0xC102 }, + { SCENE_F40, 2, 0xC102 }, }; static EntranceTableEntry sStoneTowerEntrance3[] = { - { 0x58, 0x03, 0x4A14 }, + { SCENE_F40, 3, 0x4A14 }, }; static EntranceTableEntry* sStoneTowerEntranceTable[] = { @@ -1942,11 +1944,11 @@ static EntranceTableEntry* sStoneTowerEntranceTable[] = { }; static EntranceTableEntry sStoneTowerInvertedEntrance0[] = { - { 0x59, 0x00, 0x4A14 }, + { SCENE_F41, 0, 0x4A14 }, }; static EntranceTableEntry sStoneTowerInvertedEntrance1[] = { - { 0x59, 0x01, 0xC102 }, + { SCENE_F41, 1, 0xC102 }, }; static EntranceTableEntry* sStoneTowerInvertedEntranceTable[] = { @@ -1955,40 +1957,40 @@ static EntranceTableEntry* sStoneTowerInvertedEntranceTable[] = { }; static EntranceTableEntry sMountainVillageSpringEntrance0[] = { - { 0x5A, 0x00, 0x4A14 }, - { 0x5A, 0x00, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA2, 0, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA2, 0, 0x4A14 }, }; static EntranceTableEntry sMountainVillageSpringEntrance1[] = { - { 0x5A, 0x01, 0x4102 }, + { SCENE_10YUKIYAMANOMURA2, 1, 0x4102 }, }; static EntranceTableEntry sMountainVillageSpringEntrance2[] = { - { 0x5A, 0x02, 0xCA14 }, + { SCENE_10YUKIYAMANOMURA2, 2, 0xCA14 }, }; static EntranceTableEntry sMountainVillageSpringEntrance3[] = { - { 0x5A, 0x03, 0x4102 }, + { SCENE_10YUKIYAMANOMURA2, 3, 0x4102 }, }; static EntranceTableEntry sMountainVillageSpringEntrance4[] = { - { 0x5A, 0x04, 0xCA14 }, + { SCENE_10YUKIYAMANOMURA2, 4, 0xCA14 }, }; static EntranceTableEntry sMountainVillageSpringEntrance5[] = { - { 0x5A, 0x05, 0x4102 }, + { SCENE_10YUKIYAMANOMURA2, 5, 0x4102 }, }; static EntranceTableEntry sMountainVillageSpringEntrance6[] = { - { 0x5A, 0x06, 0xCA14 }, + { SCENE_10YUKIYAMANOMURA2, 6, 0xCA14 }, }; static EntranceTableEntry sMountainVillageSpringEntrance7[] = { - { 0x5A, 0x07, 0x458B }, + { SCENE_10YUKIYAMANOMURA2, 7, 0x458B }, }; static EntranceTableEntry sMountainVillageSpringEntrance8[] = { - { 0x5A, 0x08, 0x4A14 }, + { SCENE_10YUKIYAMANOMURA2, 8, 0x4A14 }, }; static EntranceTableEntry* sMountainVillageSpringEntranceTable[] = { @@ -1998,13 +2000,13 @@ static EntranceTableEntry* sMountainVillageSpringEntranceTable[] = { }; static EntranceTableEntry sPathToSnowheadEntrance0[] = { - { 0x5B, 0x00, 0xCA14 }, - { 0x5B, 0x00, 0xCA14 }, + { SCENE_14YUKIDAMANOMITI, 0, 0xCA14 }, + { SCENE_14YUKIDAMANOMITI, 0, 0xCA14 }, }; static EntranceTableEntry sPathToSnowheadEntrance1[] = { - { 0x5B, 0x01, 0xCA14 }, - { 0x5B, 0x01, 0xCA14 }, + { SCENE_14YUKIDAMANOMITI, 1, 0xCA14 }, + { SCENE_14YUKIDAMANOMITI, 1, 0xCA14 }, }; static EntranceTableEntry* sPathToSnowheadEntranceTable[] = { @@ -2013,23 +2015,23 @@ static EntranceTableEntry* sPathToSnowheadEntranceTable[] = { }; static EntranceTableEntry sSnowheadEntrance0[] = { - { 0x5C, 0x00, 0xCA14 }, - { 0x5C, 0x00, 0xCA14 }, + { SCENE_12HAKUGINMAE, 0, 0xCA14 }, + { SCENE_12HAKUGINMAE, 0, 0xCA14 }, }; static EntranceTableEntry sSnowheadEntrance1[] = { - { 0x5C, 0x01, 0x4102 }, - { 0x5C, 0x01, 0x4102 }, + { SCENE_12HAKUGINMAE, 1, 0x4102 }, + { SCENE_12HAKUGINMAE, 1, 0x4102 }, }; static EntranceTableEntry sSnowheadEntrance2[] = { - { 0x5C, 0x02, 0x4102 }, - { 0x5C, 0x02, 0x4102 }, + { SCENE_12HAKUGINMAE, 2, 0x4102 }, + { SCENE_12HAKUGINMAE, 2, 0x4102 }, }; static EntranceTableEntry sSnowheadEntrance3[] = { - { 0x5C, 0x03, 0x4102 }, - { 0x5C, 0x03, 0x4102 }, + { SCENE_12HAKUGINMAE, 3, 0x4102 }, + { SCENE_12HAKUGINMAE, 3, 0x4102 }, }; static EntranceTableEntry* sSnowheadEntranceTable[] = { @@ -2040,15 +2042,15 @@ static EntranceTableEntry* sSnowheadEntranceTable[] = { }; static EntranceTableEntry sPathToGoronVillageWinterEntrance0[] = { - { 0x5D, 0x00, 0x8A14 }, + { SCENE_17SETUGEN, 0, 0x8A14 }, }; static EntranceTableEntry sPathToGoronVillageWinterEntrance1[] = { - { 0x5D, 0x01, 0x8102 }, + { SCENE_17SETUGEN, 1, 0x8102 }, }; static EntranceTableEntry sPathToGoronVillageWinterEntrance2[] = { - { 0x5D, 0x02, 0x0102 }, + { SCENE_17SETUGEN, 2, 0x0102 }, }; static EntranceTableEntry* sPathToGoronVillageWinterEntranceTable[] = { @@ -2058,15 +2060,15 @@ static EntranceTableEntry* sPathToGoronVillageWinterEntranceTable[] = { }; static EntranceTableEntry sPathToGoronVillageSpringEntrance0[] = { - { 0x5E, 0x00, 0x8A14 }, + { SCENE_17SETUGEN2, 0, 0x8A14 }, }; static EntranceTableEntry sPathToGoronVillageSpringEntrance1[] = { - { 0x5E, 0x01, 0x8102 }, + { SCENE_17SETUGEN2, 1, 0x8102 }, }; static EntranceTableEntry sPathToGoronVillageSpringEntrance2[] = { - { 0x5E, 0x02, 0x0102 }, + { SCENE_17SETUGEN2, 2, 0x0102 }, }; static EntranceTableEntry* sPathToGoronVillageSpringEntranceTable[] = { @@ -2076,11 +2078,11 @@ static EntranceTableEntry* sPathToGoronVillageSpringEntranceTable[] = { }; static EntranceTableEntry sGyorgsLairEntrance0[] = { - { 0xA1, 0x00, 0x8102 }, + { -SCENE_SEA_BS, 0, 0x8102 }, }; static EntranceTableEntry sGyorgsLairEntrance1[] = { - { 0xA1, 0x01, 0x8102 }, + { -SCENE_SEA_BS, 1, 0x8102 }, }; static EntranceTableEntry* sGyorgsLairEntranceTable[] = { @@ -2089,7 +2091,7 @@ static EntranceTableEntry* sGyorgsLairEntranceTable[] = { }; static EntranceTableEntry sSecretShrineEntrance0[] = { - { 0xA0, 0x00, 0x4102 }, + { -SCENE_RANDOM, 0, 0x4102 }, }; static EntranceTableEntry* sSecretShrineEntranceTable[] = { @@ -2097,28 +2099,28 @@ static EntranceTableEntry* sSecretShrineEntranceTable[] = { }; static EntranceTableEntry sStockPotInnEntrance0[] = { - { 0x61, 0x00, 0x4102 }, - { 0x61, 0x00, 0x8102 }, + { SCENE_YADOYA, 0, 0x4102 }, + { SCENE_YADOYA, 0, 0x8102 }, }; static EntranceTableEntry sStockPotInnEntrance1[] = { - { 0x61, 0x01, 0x4102 }, + { SCENE_YADOYA, 1, 0x4102 }, }; static EntranceTableEntry sStockPotInnEntrance2[] = { - { 0x61, 0x02, 0x0102 }, + { SCENE_YADOYA, 2, 0x0102 }, }; static EntranceTableEntry sStockPotInnEntrance3[] = { - { 0x61, 0x03, 0x0102 }, + { SCENE_YADOYA, 3, 0x0102 }, }; static EntranceTableEntry sStockPotInnEntrance4[] = { - { 0x61, 0x04, 0x0102 }, + { SCENE_YADOYA, 4, 0x0102 }, }; static EntranceTableEntry sStockPotInnEntrance5[] = { - { 0x61, 0x05, 0x0102 }, + { SCENE_YADOYA, 5, 0x0102 }, }; static EntranceTableEntry* sStockPotInnEntranceTable[] = { @@ -2127,7 +2129,7 @@ static EntranceTableEntry* sStockPotInnEntranceTable[] = { }; static EntranceTableEntry sGreatBayCutsceneEntrance0[] = { - { 0x62, 0x00, 0x4102 }, + { SCENE_KONPEKI_ENT, 0, 0x4102 }, }; static EntranceTableEntry* sGreatBayCutsceneEntranceTable[] = { @@ -2135,31 +2137,31 @@ static EntranceTableEntry* sGreatBayCutsceneEntranceTable[] = { }; static EntranceTableEntry sClockTowerInteriorEntrance0[] = { - { 0x63, 0x00, 0x0102 }, + { SCENE_INSIDETOWER, 0, 0x0102 }, }; static EntranceTableEntry sClockTowerInteriorEntrance1[] = { - { 0x63, 0x01, 0x0102 }, + { SCENE_INSIDETOWER, 1, 0x0102 }, }; static EntranceTableEntry sClockTowerInteriorEntrance2[] = { - { 0x63, 0x02, 0x058B }, + { SCENE_INSIDETOWER, 2, 0x058B }, }; static EntranceTableEntry sClockTowerInteriorEntrance3[] = { - { 0x63, 0x03, 0x0102 }, + { SCENE_INSIDETOWER, 3, 0x0102 }, }; static EntranceTableEntry sClockTowerInteriorEntrance4[] = { - { 0x63, 0x04, 0x058B }, + { SCENE_INSIDETOWER, 4, 0x058B }, }; static EntranceTableEntry sClockTowerInteriorEntrance5[] = { - { 0x63, 0x05, 0x0102 }, + { SCENE_INSIDETOWER, 5, 0x0102 }, }; static EntranceTableEntry sClockTowerInteriorEntrance6[] = { - { 0x63, 0x06, 0x858B }, + { SCENE_INSIDETOWER, 6, 0x858B }, }; static EntranceTableEntry* sClockTowerInteriorEntranceTable[] = { @@ -2169,7 +2171,7 @@ static EntranceTableEntry* sClockTowerInteriorEntranceTable[] = { }; static EntranceTableEntry sWoodsOfMysteryEntrance0[] = { - { 0x64, 0x00, 0x4102 }, + { SCENE_26SARUNOMORI, 0, 0x4102 }, }; static EntranceTableEntry* sWoodsOfMysteryEntranceTable[] = { @@ -2177,24 +2179,24 @@ static EntranceTableEntry* sWoodsOfMysteryEntranceTable[] = { }; static EntranceTableEntry sLostWoodsEntrance0[] = { - { 0x9B, 0x00, 0x858B }, - { 0x9B, 0x00, 0x8183 }, - { 0x9B, 0x00, 0x858B }, - { 0x9B, 0x00, 0x8102 }, + { -SCENE_LOST_WOODS, 0, 0x858B }, + { -SCENE_LOST_WOODS, 0, 0x8183 }, + { -SCENE_LOST_WOODS, 0, 0x858B }, + { -SCENE_LOST_WOODS, 0, 0x8102 }, }; static EntranceTableEntry sLostWoodsEntrance1[] = { - { 0x9B, 0x01, 0x058B }, - { 0x9B, 0x01, 0x058B }, - { 0x9B, 0x01, 0x058B }, - { 0x9B, 0x01, 0x058B }, + { -SCENE_LOST_WOODS, 1, 0x058B }, + { -SCENE_LOST_WOODS, 1, 0x058B }, + { -SCENE_LOST_WOODS, 1, 0x058B }, + { -SCENE_LOST_WOODS, 1, 0x058B }, }; static EntranceTableEntry sLostWoodsEntrance2[] = { - { 0x9B, 0x02, 0x058B }, - { 0x9B, 0x02, 0x058B }, - { 0x9B, 0x02, 0x058B }, - { 0x9B, 0x02, 0x058B }, + { -SCENE_LOST_WOODS, 2, 0x058B }, + { -SCENE_LOST_WOODS, 2, 0x058B }, + { -SCENE_LOST_WOODS, 2, 0x058B }, + { -SCENE_LOST_WOODS, 2, 0x058B }, }; static EntranceTableEntry* sLostWoodsEntranceTable[] = { @@ -2204,7 +2206,7 @@ static EntranceTableEntry* sLostWoodsEntranceTable[] = { }; static EntranceTableEntry sMoonLinkTrialEntrance0[] = { - { 0x66, 0x00, 0x0387 }, + { SCENE_LAST_LINK, 0, 0x0387 }, }; static EntranceTableEntry* sMoonLinkTrialEntranceTable[] = { @@ -2212,7 +2214,7 @@ static EntranceTableEntry* sMoonLinkTrialEntranceTable[] = { }; static EntranceTableEntry sTheMoonEntrance0[] = { - { 0x67, 0x00, 0x0387 }, + { SCENE_SOUGEN, 0, 0x0387 }, }; static EntranceTableEntry* sTheMoonEntranceTable[] = { @@ -2220,11 +2222,11 @@ static EntranceTableEntry* sTheMoonEntranceTable[] = { }; static EntranceTableEntry sBombShopEntrance0[] = { - { 0x68, 0x00, 0x4102 }, + { SCENE_BOMYA, 0, 0x4102 }, }; static EntranceTableEntry sBombShopEntrance1[] = { - { 0x68, 0x01, 0x0102 }, + { SCENE_BOMYA, 1, 0x0102 }, }; static EntranceTableEntry* sBombShopEntranceTable[] = { @@ -2233,9 +2235,10 @@ static EntranceTableEntry* sBombShopEntranceTable[] = { }; static EntranceTableEntry sGiantsChamberEntrance0[] = { - { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, - { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, - { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, { 0x69, 0x00, 0x0102 }, + { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, + { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, + { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, + { SCENE_KYOJINNOMA, 0, 0x0102 }, { SCENE_KYOJINNOMA, 0, 0x0102 }, }; static EntranceTableEntry* sGiantsChamberEntranceTable[] = { @@ -2243,27 +2246,27 @@ static EntranceTableEntry* sGiantsChamberEntranceTable[] = { }; static EntranceTableEntry sGormanTrackEntrance0[] = { - { 0x6A, 0x00, 0x4A14 }, + { SCENE_KOEPONARACE, 0, 0x4A14 }, }; static EntranceTableEntry sGormanTrackEntrance1[] = { - { 0x6A, 0x01, 0x4A14 }, + { SCENE_KOEPONARACE, 1, 0x4A14 }, }; static EntranceTableEntry sGormanTrackEntrance2[] = { - { 0x6A, 0x02, 0x4A14 }, + { SCENE_KOEPONARACE, 2, 0x4A14 }, }; static EntranceTableEntry sGormanTrackEntrance3[] = { - { 0x6A, 0x03, 0x4A14 }, + { SCENE_KOEPONARACE, 3, 0x4A14 }, }; static EntranceTableEntry sGormanTrackEntrance4[] = { - { 0x6A, 0x04, 0x0102 }, + { SCENE_KOEPONARACE, 4, 0x0102 }, }; static EntranceTableEntry sGormanTrackEntrance5[] = { - { 0x6A, 0x05, 0x0A14 }, + { SCENE_KOEPONARACE, 5, 0x0A14 }, }; static EntranceTableEntry* sGormanTrackEntranceTable[] = { @@ -2272,18 +2275,18 @@ static EntranceTableEntry* sGormanTrackEntranceTable[] = { }; static EntranceTableEntry sGoronRacetrackEntrance0[] = { - { 0x6B, 0x00, 0x4102 }, - { 0x6B, 0x00, 0x4102 }, + { SCENE_GORONRACE, 0, 0x4102 }, + { SCENE_GORONRACE, 0, 0x4102 }, }; static EntranceTableEntry sGoronRacetrackEntrance1[] = { - { 0x6B, 0x01, 0x8A14 }, - { 0x6B, 0x01, 0x8A14 }, + { SCENE_GORONRACE, 1, 0x8A14 }, + { SCENE_GORONRACE, 1, 0x8A14 }, }; static EntranceTableEntry sGoronRacetrackEntrance2[] = { - { 0x6B, 0x02, 0x0A14 }, - { 0x6B, 0x02, 0x0A14 }, + { SCENE_GORONRACE, 2, 0x0A14 }, + { SCENE_GORONRACE, 2, 0x0A14 }, }; static EntranceTableEntry* sGoronRacetrackEntranceTable[] = { @@ -2293,57 +2296,57 @@ static EntranceTableEntry* sGoronRacetrackEntranceTable[] = { }; static EntranceTableEntry sEastClockTownEntrance0[] = { - { 0x6C, 0x00, 0x4102 }, - { 0x6C, 0x00, 0x8102 }, - { 0x6C, 0x00, 0x058B }, + { SCENE_TOWN, 0, 0x4102 }, + { SCENE_TOWN, 0, 0x8102 }, + { SCENE_TOWN, 0, 0x058B }, }; static EntranceTableEntry sEastClockTownEntrance1[] = { - { 0x6C, 0x01, 0xCA14 }, + { SCENE_TOWN, 1, 0xCA14 }, }; static EntranceTableEntry sEastClockTownEntrance2[] = { - { 0x6C, 0x02, 0x4102 }, + { SCENE_TOWN, 2, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance3[] = { - { 0x6C, 0x03, 0xC102 }, + { SCENE_TOWN, 3, 0xC102 }, }; static EntranceTableEntry sEastClockTownEntrance4[] = { - { 0x6C, 0x04, 0x4102 }, + { SCENE_TOWN, 4, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance5[] = { - { 0x6C, 0x05, 0xC102 }, + { SCENE_TOWN, 5, 0xC102 }, }; static EntranceTableEntry sEastClockTownEntrance6[] = { - { 0x6C, 0x06, 0x4102 }, + { SCENE_TOWN, 6, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance7[] = { - { 0x6C, 0x07, 0x4102 }, + { SCENE_TOWN, 7, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance8[] = { - { 0x6C, 0x08, 0x4102 }, + { SCENE_TOWN, 8, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance9[] = { - { 0x6C, 0x09, 0x4102 }, + { SCENE_TOWN, 9, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance10[] = { - { 0x6C, 0x0A, 0x4102 }, + { SCENE_TOWN, 10, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance11[] = { - { 0x6C, 0x0B, 0x4102 }, + { SCENE_TOWN, 11, 0x4102 }, }; static EntranceTableEntry sEastClockTownEntrance12[] = { - { 0x6C, 0x0C, 0x4102 }, + { SCENE_TOWN, 12, 0x4102 }, }; static EntranceTableEntry* sEastClockTownEntranceTable[] = { @@ -2354,44 +2357,44 @@ static EntranceTableEntry* sEastClockTownEntranceTable[] = { }; static EntranceTableEntry sWestClockTownEntrance0[] = { - { 0x6D, 0x00, 0x4102 }, - { 0x6D, 0x00, 0x8102 }, + { SCENE_ICHIBA, 0, 0x4102 }, + { SCENE_ICHIBA, 0, 0x8102 }, }; static EntranceTableEntry sWestClockTownEntrance1[] = { - { 0x6D, 0x01, 0xC102 }, + { SCENE_ICHIBA, 1, 0xC102 }, }; static EntranceTableEntry sWestClockTownEntrance2[] = { - { 0x6D, 0x02, 0xCA14 }, + { SCENE_ICHIBA, 2, 0xCA14 }, }; static EntranceTableEntry sWestClockTownEntrance3[] = { - { 0x6D, 0x03, 0x4102 }, + { SCENE_ICHIBA, 3, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance4[] = { - { 0x6D, 0x04, 0x4102 }, + { SCENE_ICHIBA, 4, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance5[] = { - { 0x6D, 0x05, 0x4102 }, + { SCENE_ICHIBA, 5, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance6[] = { - { 0x6D, 0x06, 0x4102 }, + { SCENE_ICHIBA, 6, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance7[] = { - { 0x6D, 0x07, 0x4102 }, + { SCENE_ICHIBA, 7, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance8[] = { - { 0x6D, 0x08, 0x4102 }, + { SCENE_ICHIBA, 8, 0x4102 }, }; static EntranceTableEntry sWestClockTownEntrance9[] = { - { 0x6D, 0x09, 0x4A14 }, + { SCENE_ICHIBA, 9, 0x4A14 }, }; static EntranceTableEntry* sWestClockTownEntranceTable[] = { @@ -2401,36 +2404,36 @@ static EntranceTableEntry* sWestClockTownEntranceTable[] = { }; static EntranceTableEntry sNorthClockTownEntrance0[] = { - { 0x6E, 0x00, 0x4102 }, - { 0x6E, 0x00, 0x458B }, + { SCENE_BACKTOWN, 0, 0x4102 }, + { SCENE_BACKTOWN, 0, 0x458B }, }; static EntranceTableEntry sNorthClockTownEntrance1[] = { - { 0x6E, 0x01, 0xC102 }, + { SCENE_BACKTOWN, 1, 0xC102 }, }; static EntranceTableEntry sNorthClockTownEntrance2[] = { - { 0x6E, 0x02, 0xC102 }, + { SCENE_BACKTOWN, 2, 0xC102 }, }; static EntranceTableEntry sNorthClockTownEntrance3[] = { - { 0x6E, 0x03, 0x4102 }, + { SCENE_BACKTOWN, 3, 0x4102 }, }; static EntranceTableEntry sNorthClockTownEntrance4[] = { - { 0x6E, 0x04, 0x4102 }, + { SCENE_BACKTOWN, 4, 0x4102 }, }; static EntranceTableEntry sNorthClockTownEntrance5[] = { - { 0x6E, 0x05, 0x8A14 }, + { SCENE_BACKTOWN, 5, 0x8A14 }, }; static EntranceTableEntry sNorthClockTownEntrance6[] = { - { 0x6E, 0x06, 0x8A14 }, + { SCENE_BACKTOWN, 6, 0x8A14 }, }; static EntranceTableEntry sNorthClockTownEntrance7[] = { - { 0x6E, 0x07, 0x8A14 }, + { SCENE_BACKTOWN, 7, 0x8A14 }, }; static EntranceTableEntry* sNorthClockTownEntranceTable[] = { @@ -2439,51 +2442,51 @@ static EntranceTableEntry* sNorthClockTownEntranceTable[] = { }; static EntranceTableEntry sSouthClockTownEntrance0[] = { - { 0x6F, 0x00, 0x4102 }, - { 0x6F, 0x00, 0x8102 }, - { 0x6F, 0x00, 0x0A14 }, - { 0x6F, 0x00, 0x0102 }, + { SCENE_CLOCKTOWER, 0, 0x4102 }, + { SCENE_CLOCKTOWER, 0, 0x8102 }, + { SCENE_CLOCKTOWER, 0, 0x0A14 }, + { SCENE_CLOCKTOWER, 0, 0x0102 }, }; static EntranceTableEntry sSouthClockTownEntrance1[] = { - { 0x6F, 0x01, 0x4102 }, - { 0x6F, 0x01, 0x8102 }, + { SCENE_CLOCKTOWER, 1, 0x4102 }, + { SCENE_CLOCKTOWER, 1, 0x8102 }, }; static EntranceTableEntry sSouthClockTownEntrance2[] = { - { 0x6F, 0x02, 0xC102 }, + { SCENE_CLOCKTOWER, 2, 0xC102 }, }; static EntranceTableEntry sSouthClockTownEntrance3[] = { - { 0x6F, 0x03, 0xCA14 }, + { SCENE_CLOCKTOWER, 3, 0xCA14 }, }; static EntranceTableEntry sSouthClockTownEntrance4[] = { - { 0x6F, 0x04, 0xC102 }, + { SCENE_CLOCKTOWER, 4, 0xC102 }, }; static EntranceTableEntry sSouthClockTownEntrance5[] = { - { 0x6F, 0x05, 0xC102 }, + { SCENE_CLOCKTOWER, 5, 0xC102 }, }; static EntranceTableEntry sSouthClockTownEntrance6[] = { - { 0x6F, 0x06, 0xCA14 }, + { SCENE_CLOCKTOWER, 6, 0xCA14 }, }; static EntranceTableEntry sSouthClockTownEntrance7[] = { - { 0x6F, 0x07, 0xCA14 }, + { SCENE_CLOCKTOWER, 7, 0xCA14 }, }; static EntranceTableEntry sSouthClockTownEntrance8[] = { - { 0x6F, 0x08, 0x4A14 }, + { SCENE_CLOCKTOWER, 8, 0x4A14 }, }; static EntranceTableEntry sSouthClockTownEntrance9[] = { - { 0x6F, 0x09, 0x4A14 }, + { SCENE_CLOCKTOWER, 9, 0x4A14 }, }; static EntranceTableEntry sSouthClockTownEntrance10[] = { - { 0x6F, 0x0A, 0x058B }, + { SCENE_CLOCKTOWER, 10, 0x058B }, }; static EntranceTableEntry* sSouthClockTownEntranceTable[] = { @@ -2493,15 +2496,15 @@ static EntranceTableEntry* sSouthClockTownEntranceTable[] = { }; static EntranceTableEntry sLaundryPoolEntrance0[] = { - { 0x70, 0x00, 0xCA14 }, + { SCENE_ALLEY, 0, 0xCA14 }, }; static EntranceTableEntry sLaundryPoolEntrance1[] = { - { 0x70, 0x01, 0x4A14 }, + { SCENE_ALLEY, 1, 0x4A14 }, }; static EntranceTableEntry sLaundryPoolEntrance2[] = { - { 0x70, 0x02, 0x4102 }, + { SCENE_ALLEY, 2, 0x4102 }, }; static EntranceTableEntry* sLaundryPoolEntranceTable[] = { @@ -2511,71 +2514,71 @@ static EntranceTableEntry* sLaundryPoolEntranceTable[] = { }; static EntranceTableEntry sGrottosEntrance0[] = { - { 0x07, 0x00, 0x0102 }, + { SCENE_KAKUSIANA, 0, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance1[] = { - { 0x07, 0x01, 0x0102 }, + { SCENE_KAKUSIANA, 1, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance2[] = { - { 0x07, 0x02, 0x0102 }, + { SCENE_KAKUSIANA, 2, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance3[] = { - { 0x07, 0x03, 0x0102 }, + { SCENE_KAKUSIANA, 3, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance4[] = { - { 0x07, 0x04, 0x0102 }, + { SCENE_KAKUSIANA, 4, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance5[] = { - { 0x07, 0x05, 0x0102 }, + { SCENE_KAKUSIANA, 5, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance6[] = { - { 0x07, 0x06, 0x0102 }, + { SCENE_KAKUSIANA, 6, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance7[] = { - { 0x07, 0x07, 0x0102 }, + { SCENE_KAKUSIANA, SCENE_KAKUSIANA, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance8[] = { - { 0x07, 0x08, 0x0102 }, + { SCENE_KAKUSIANA, 8, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance9[] = { - { 0x07, 0x09, 0x0102 }, + { SCENE_KAKUSIANA, 9, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance10[] = { - { 0x07, 0x0A, 0x0102 }, + { SCENE_KAKUSIANA, 10, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance11[] = { - { 0x07, 0x0B, 0x0102 }, + { SCENE_KAKUSIANA, 11, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance12[] = { - { 0x07, 0x0C, 0x0102 }, + { SCENE_KAKUSIANA, 12, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance13[] = { - { 0x07, 0x0D, 0x0102 }, + { SCENE_KAKUSIANA, 13, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance14[] = { - { 0x07, 0x0E, 0x0102 }, + { SCENE_KAKUSIANA, 14, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance15[] = { - { 0x07, 0x0F, 0x0102 }, + { SCENE_KAKUSIANA, 15, 0x0102 }, }; static EntranceTableEntry sGrottosEntrance16[] = { - { 0x07, 0x10, 0x0102 }, + { SCENE_KAKUSIANA, 16, 0x0102 }, }; static EntranceTableEntry* sGrottosEntranceTable[] = { @@ -2586,63 +2589,73 @@ static EntranceTableEntry* sGrottosEntranceTable[] = { }; static EntranceTableEntry sCutsceneEntrance0[] = { - { 0xF8, 0x00, 0x0102 }, { 0xF8, 0x00, 0x0102 }, { 0xF8, 0x00, 0x8102 }, { 0xF8, 0x00, 0x0102 }, - { 0xF8, 0x00, 0x058B }, { 0xF8, 0x00, 0x058B }, { 0xF8, 0x00, 0x058B }, { 0xF8, 0x00, 0x058B }, - { 0xF8, 0x00, 0x0183 }, { 0xF8, 0x00, 0x0183 }, { 0xF8, 0x00, 0x8102 }, { 0xF8, 0x00, 0x0102 }, + { -SCENE_SPOT00, 0, 0x0102 }, { -SCENE_SPOT00, 0, 0x0102 }, { -SCENE_SPOT00, 0, 0x8102 }, + { -SCENE_SPOT00, 0, 0x0102 }, { -SCENE_SPOT00, 0, 0x058B }, { -SCENE_SPOT00, 0, 0x058B }, + { -SCENE_SPOT00, 0, 0x058B }, { -SCENE_SPOT00, 0, 0x058B }, { -SCENE_SPOT00, 0, 0x0183 }, + { -SCENE_SPOT00, 0, 0x0183 }, { -SCENE_SPOT00, 0, 0x8102 }, { -SCENE_SPOT00, 0, 0x0102 }, }; static EntranceTableEntry sCutsceneEntrance1[] = { - { 0xF8, 0x01, 0x0183 }, { 0xF8, 0x01, 0x0102 }, { 0xF8, 0x01, 0x8102 }, { 0xF8, 0x01, 0x0102 }, - { 0xF8, 0x01, 0x8102 }, { 0xF8, 0x01, 0x058B }, { 0xF8, 0x01, 0x058B }, { 0xF8, 0x01, 0x058B }, - { 0xF8, 0x01, 0x058B }, { 0xF8, 0x01, 0x8102 }, { 0xF8, 0x01, 0x8102 }, { 0xF8, 0x01, 0x0102 }, + { -SCENE_SPOT00, 1, 0x0183 }, { -SCENE_SPOT00, 1, 0x0102 }, { -SCENE_SPOT00, 1, 0x8102 }, + { -SCENE_SPOT00, 1, 0x0102 }, { -SCENE_SPOT00, 1, 0x8102 }, { -SCENE_SPOT00, 1, 0x058B }, + { -SCENE_SPOT00, 1, 0x058B }, { -SCENE_SPOT00, 1, 0x058B }, { -SCENE_SPOT00, 1, 0x058B }, + { -SCENE_SPOT00, 1, 0x8102 }, { -SCENE_SPOT00, 1, 0x8102 }, { -SCENE_SPOT00, 1, 0x0102 }, }; static EntranceTableEntry sCutsceneEntrance2[] = { - { 0xF8, 0x02, 0x0183 }, { 0xF8, 0x02, 0x0102 }, { 0xF8, 0x02, 0x8102 }, { 0xF8, 0x02, 0x0102 }, - { 0xF8, 0x02, 0x8102 }, { 0xF8, 0x02, 0x058B }, { 0xF8, 0x02, 0x058B }, { 0xF8, 0x02, 0x058B }, - { 0xF8, 0x02, 0x058B }, { 0xF8, 0x02, 0x858B }, { 0xF8, 0x02, 0x8102 }, + { -SCENE_SPOT00, 2, 0x0183 }, { -SCENE_SPOT00, 2, 0x0102 }, { -SCENE_SPOT00, 2, 0x8102 }, + { -SCENE_SPOT00, 2, 0x0102 }, { -SCENE_SPOT00, 2, 0x8102 }, { -SCENE_SPOT00, 2, 0x058B }, + { -SCENE_SPOT00, 2, 0x058B }, { -SCENE_SPOT00, 2, 0x058B }, { -SCENE_SPOT00, 2, 0x058B }, + { -SCENE_SPOT00, 2, 0x858B }, { -SCENE_SPOT00, 2, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance3[] = { - { 0xF8, 0x03, 0x0183 }, { 0xF8, 0x03, 0x0102 }, { 0xF8, 0x03, 0x8102 }, { 0xF8, 0x03, 0x0102 }, - { 0xF8, 0x03, 0x058B }, { 0xF8, 0x03, 0x058B }, { 0xF8, 0x03, 0x058B }, { 0xF8, 0x03, 0x058B }, - { 0xF8, 0x03, 0x058B }, { 0xF8, 0x03, 0x058B }, { 0xF8, 0x03, 0x8102 }, + { -SCENE_SPOT00, 3, 0x0183 }, { -SCENE_SPOT00, 3, 0x0102 }, { -SCENE_SPOT00, 3, 0x8102 }, + { -SCENE_SPOT00, 3, 0x0102 }, { -SCENE_SPOT00, 3, 0x058B }, { -SCENE_SPOT00, 3, 0x058B }, + { -SCENE_SPOT00, 3, 0x058B }, { -SCENE_SPOT00, 3, 0x058B }, { -SCENE_SPOT00, 3, 0x058B }, + { -SCENE_SPOT00, 3, 0x058B }, { -SCENE_SPOT00, 3, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance4[] = { - { 0xF8, 0x04, 0x0183 }, { 0xF8, 0x04, 0x0102 }, { 0xF8, 0x04, 0x8102 }, { 0xF8, 0x04, 0x0102 }, - { 0xF8, 0x04, 0x058B }, { 0xF8, 0x04, 0x058B }, { 0xF8, 0x04, 0x058B }, { 0xF8, 0x04, 0x058B }, - { 0xF8, 0x04, 0x058B }, { 0xF8, 0x04, 0x058B }, { 0xF8, 0x04, 0x8102 }, + { -SCENE_SPOT00, 4, 0x0183 }, { -SCENE_SPOT00, 4, 0x0102 }, { -SCENE_SPOT00, 4, 0x8102 }, + { -SCENE_SPOT00, 4, 0x0102 }, { -SCENE_SPOT00, 4, 0x058B }, { -SCENE_SPOT00, 4, 0x058B }, + { -SCENE_SPOT00, 4, 0x058B }, { -SCENE_SPOT00, 4, 0x058B }, { -SCENE_SPOT00, 4, 0x058B }, + { -SCENE_SPOT00, 4, 0x058B }, { -SCENE_SPOT00, 4, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance5[] = { - { 0xF8, 0x05, 0x0183 }, { 0xF8, 0x05, 0x0102 }, { 0xF8, 0x05, 0x8102 }, { 0xF8, 0x05, 0x0102 }, - { 0xF8, 0x05, 0x058B }, { 0xF8, 0x05, 0x058B }, { 0xF8, 0x05, 0x058B }, { 0xF8, 0x05, 0x058B }, - { 0xF8, 0x05, 0x058B }, { 0xF8, 0x05, 0x858B }, { 0xF8, 0x05, 0x8102 }, + { -SCENE_SPOT00, 5, 0x0183 }, { -SCENE_SPOT00, 5, 0x0102 }, { -SCENE_SPOT00, 5, 0x8102 }, + { -SCENE_SPOT00, 5, 0x0102 }, { -SCENE_SPOT00, 5, 0x058B }, { -SCENE_SPOT00, 5, 0x058B }, + { -SCENE_SPOT00, 5, 0x058B }, { -SCENE_SPOT00, 5, 0x058B }, { -SCENE_SPOT00, 5, 0x058B }, + { -SCENE_SPOT00, 5, 0x858B }, { -SCENE_SPOT00, 5, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance6[] = { - { 0xF8, 0x06, 0x0183 }, { 0xF8, 0x06, 0x0102 }, { 0xF8, 0x06, 0x8102 }, { 0xF8, 0x06, 0x0102 }, - { 0xF8, 0x06, 0x058B }, { 0xF8, 0x06, 0x058B }, { 0xF8, 0x06, 0x058B }, { 0xF8, 0x06, 0x058B }, - { 0xF8, 0x06, 0x058B }, { 0xF8, 0x06, 0x858B }, { 0xF8, 0x06, 0x8102 }, + { -SCENE_SPOT00, 6, 0x0183 }, { -SCENE_SPOT00, 6, 0x0102 }, { -SCENE_SPOT00, 6, 0x8102 }, + { -SCENE_SPOT00, 6, 0x0102 }, { -SCENE_SPOT00, 6, 0x058B }, { -SCENE_SPOT00, 6, 0x058B }, + { -SCENE_SPOT00, 6, 0x058B }, { -SCENE_SPOT00, 6, 0x058B }, { -SCENE_SPOT00, 6, 0x058B }, + { -SCENE_SPOT00, 6, 0x858B }, { -SCENE_SPOT00, 6, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance7[] = { - { 0xF8, 0x07, 0x0183 }, { 0xF8, 0x07, 0x0102 }, { 0xF8, 0x07, 0x8102 }, { 0xF8, 0x07, 0x0102 }, - { 0xF8, 0x07, 0x058B }, { 0xF8, 0x07, 0x058B }, { 0xF8, 0x07, 0x058B }, { 0xF8, 0x07, 0x058B }, - { 0xF8, 0x07, 0x058B }, { 0xF8, 0x07, 0x858B }, { 0xF8, 0x07, 0x8102 }, + { -SCENE_SPOT00, 7, 0x0183 }, { -SCENE_SPOT00, 7, 0x0102 }, { -SCENE_SPOT00, 7, 0x8102 }, + { -SCENE_SPOT00, 7, 0x0102 }, { -SCENE_SPOT00, 7, 0x058B }, { -SCENE_SPOT00, 7, 0x058B }, + { -SCENE_SPOT00, 7, 0x058B }, { -SCENE_SPOT00, 7, 0x058B }, { -SCENE_SPOT00, 7, 0x058B }, + { -SCENE_SPOT00, 7, 0x858B }, { -SCENE_SPOT00, 7, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance8[] = { - { 0xF8, 0x08, 0x0183 }, { 0xF8, 0x08, 0x0102 }, { 0xF8, 0x08, 0x8102 }, { 0xF8, 0x08, 0x0102 }, - { 0xF8, 0x08, 0x058B }, { 0xF8, 0x08, 0x058B }, { 0xF8, 0x08, 0x058B }, { 0xF8, 0x08, 0x058B }, - { 0xF8, 0x08, 0x058B }, { 0xF8, 0x08, 0x858B }, { 0xF8, 0x08, 0x8102 }, + { -SCENE_SPOT00, 8, 0x0183 }, { -SCENE_SPOT00, 8, 0x0102 }, { -SCENE_SPOT00, 8, 0x8102 }, + { -SCENE_SPOT00, 8, 0x0102 }, { -SCENE_SPOT00, 8, 0x058B }, { -SCENE_SPOT00, 8, 0x058B }, + { -SCENE_SPOT00, 8, 0x058B }, { -SCENE_SPOT00, 8, 0x058B }, { -SCENE_SPOT00, 8, 0x058B }, + { -SCENE_SPOT00, 8, 0x858B }, { -SCENE_SPOT00, 8, 0x8102 }, }; static EntranceTableEntry sCutsceneEntrance9[] = { - { 0xF8, 0x09, 0x0183 }, { 0xF8, 0x09, 0x0102 }, { 0xF8, 0x09, 0x8102 }, { 0xF8, 0x09, 0x0102 }, - { 0xF8, 0x09, 0x058B }, { 0xF8, 0x09, 0x058B }, { 0xF8, 0x09, 0x058B }, { 0xF8, 0x09, 0x058B }, - { 0xF8, 0x09, 0x058B }, { 0xF8, 0x09, 0x858B }, { 0xF8, 0x09, 0x8102 }, + { -SCENE_SPOT00, 9, 0x0183 }, { -SCENE_SPOT00, 9, 0x0102 }, { -SCENE_SPOT00, 9, 0x8102 }, + { -SCENE_SPOT00, 9, 0x0102 }, { -SCENE_SPOT00, 9, 0x058B }, { -SCENE_SPOT00, 9, 0x058B }, + { -SCENE_SPOT00, 9, 0x058B }, { -SCENE_SPOT00, 9, 0x058B }, { -SCENE_SPOT00, 9, 0x058B }, + { -SCENE_SPOT00, 9, 0x858B }, { -SCENE_SPOT00, 9, 0x8102 }, }; static EntranceTableEntry* sCutsceneEntranceTable[] = { @@ -2783,19 +2796,19 @@ EntranceTableEntry* Entrance_GetTableEntry(u16 entrance) { /** * Returns the scene index from a given entrance index. */ -s32 Entrance_GetSceneNum(u16 entrance) { +s32 Entrance_GetSceneId(u16 entrance) { EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entrance); - return tableEntry->sceneNum; + return tableEntry->sceneId; } /** * Returns the absolute value scene index (since for some reason some of them are negative) from a given entrance index. */ -s32 Entrance_GetSceneNumAbsolute(u16 entrance) { +s32 Entrance_GetSceneIdAbsolute(u16 entrance) { EntranceTableEntry* tableEntry = Entrance_GetTableEntry(entrance); - return ABS_ALT(tableEntry->sceneNum); + return ABS_ALT(tableEntry->sceneId); } /** diff --git a/src/code/z_schedule.c b/src/code/z_schedule.c index cfc6293ba..6a2492631 100644 --- a/src/code/z_schedule.c +++ b/src/code/z_schedule.c @@ -130,9 +130,9 @@ s32 Schedule_ReturnValueS(PlayState* play, u8** script, ScheduleOutput* output) s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckNotInSceneS* cmd = (ScheduleCmdCheckNotInSceneS*)*script; - s16 scene = (cmd->sceneH << 8) | cmd->sceneL; + s16 sceneId = (cmd->sceneIdH << 8) | cmd->sceneIdL; - if (scene != play->sceneNum) { + if (sceneId != play->sceneId) { *script += cmd->offset; } @@ -141,9 +141,9 @@ s32 Schedule_CheckNotInSceneS(PlayState* play, u8** script, ScheduleOutput* outp s32 Schedule_CheckNotInSceneL(PlayState* play, u8** script, ScheduleOutput* output) { ScheduleCmdCheckNotInSceneL* cmd = (ScheduleCmdCheckNotInSceneL*)*script; - s16 scene = (cmd->sceneH << 8) | cmd->sceneL; + s16 sceneId = (cmd->sceneIdH << 8) | cmd->sceneIdL; - if (scene != play->sceneNum) { + if (sceneId != play->sceneId) { *script = *script + (s16)((cmd->offsetH << 8) | cmd->offsetL); } diff --git a/src/code/z_snap.c b/src/code/z_snap.c index 7a234ca22..5d37e3eac 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -21,7 +21,7 @@ s32 Snap_RecordPictographedActors(PlayState* play) { gSaveContext.save.pictoFlags0 = 0; gSaveContext.save.pictoFlags1 = 0; - if (play->sceneNum == SCENE_20SICHITAI) { + if (play->sceneId == SCENE_20SICHITAI) { Snap_SetFlag(PICTOGRAPH_IN_SWAMP); } @@ -30,7 +30,7 @@ s32 Snap_RecordPictographedActors(PlayState* play) { seen = 0; // Actors which must be pictographed in a specific scene - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_20SICHITAI: if ((actor->id == ACTOR_EN_MNK) || (actor->id == ACTOR_EN_BIGOKUTA)) { seen = PICTO_SEEN_IN_SCENE; diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 5d018a995..6f9006146 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -248,7 +248,7 @@ void Sram_ClearFlagsAtDawnOfTheFirstDay(void) { * Used by Song of Time (when clicking "Yes") and (indirectly) by the "Dawn of the New Day" cutscene */ void Sram_SaveEndOfCycle(PlayState* play) { - s16 sceneNum; + s16 sceneId; s32 j; s32 i; u8 slot; @@ -264,13 +264,13 @@ void Sram_SaveEndOfCycle(PlayState* play) { gSaveContext.save.playerData.deaths = 999; } - sceneNum = Play_GetOriginalSceneNumber(play->sceneNum); + sceneId = Play_GetOriginalSceneId(play->sceneId); Play_SaveCycleSceneFlags(&play->state); - play->actorCtx.sceneFlags.chest &= D_801C5FC0[sceneNum][2]; - play->actorCtx.sceneFlags.switches[0] &= D_801C5FC0[sceneNum][0]; - play->actorCtx.sceneFlags.switches[1] &= D_801C5FC0[sceneNum][1]; - play->actorCtx.sceneFlags.collectible[0] &= D_801C5FC0[sceneNum][3]; + play->actorCtx.sceneFlags.chest &= D_801C5FC0[sceneId][2]; + play->actorCtx.sceneFlags.switches[0] &= D_801C5FC0[sceneId][0]; + play->actorCtx.sceneFlags.switches[1] &= D_801C5FC0[sceneId][1]; + play->actorCtx.sceneFlags.collectible[0] &= D_801C5FC0[sceneId][3]; play->actorCtx.sceneFlags.clearedRoom = 0; for (i = 0; i < SCENE_MAX; i++) { @@ -292,8 +292,8 @@ void Sram_SaveEndOfCycle(PlayState* play) { gSaveContext.cycleSceneFlags[i].collectible = 0; } - for (i = 0; i < ARRAY_COUNT(gSaveContext.maskMaskBit); i++) { - gSaveContext.maskMaskBit[i] = 0; + for (i = 0; i < ARRAY_COUNT(gSaveContext.masksGivenOnMoon); i++) { + gSaveContext.masksGivenOnMoon[i] = 0; } if (gSaveContext.save.weekEventReg[84] & 0x20) { @@ -608,7 +608,7 @@ SavePlayerData sSaveDefaultPlayerData = { 0xFF, // unk_20 0x0000, // owlActivationFlags 0xFF, // unk_24 - SCENE_SPOT00, // savedSceneNum + SCENE_SPOT00, // savedSceneId }; ItemEquips sSaveDefaultItemEquips = { @@ -679,7 +679,7 @@ void Sram_InitNewSave(void) { Lib_MemCpy(&gSaveContext.save.inventory, &sSaveDefaultInventory, sizeof(Inventory)); Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDefaultChecksum, sizeof(gSaveContext.save.checksum)); - gSaveContext.save.horseData.scene = SCENE_F01; + gSaveContext.save.horseData.sceneId = SCENE_F01; gSaveContext.save.horseData.pos.x = -1420; gSaveContext.save.horseData.pos.y = 257; gSaveContext.save.horseData.pos.z = -1285; @@ -708,7 +708,7 @@ SavePlayerData sSaveDebugPlayerData = { 0xFF, // unk_20 0, // owlActivationFlags 0xFF, // unk_24 - SCENE_SPOT00, // savedSceneNum + SCENE_SPOT00, // savedSceneId }; ItemEquips sSaveDebugItemEquips = { @@ -839,7 +839,7 @@ void Sram_InitDebugSave(void) { gSaveContext.save.hasTatl = true; - gSaveContext.save.horseData.scene = SCENE_F01; + gSaveContext.save.horseData.sceneId = SCENE_F01; gSaveContext.save.horseData.pos.x = -1420; gSaveContext.save.horseData.pos.y = 257; gSaveContext.save.horseData.pos.z = -1285; diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index 7975b1c85..6dd46633c 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -75,7 +75,7 @@ void func_801431E8(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyType) skyboxCtx->envB = 40; // Inverted Stone Tower Temple and Inverted Stone Tower - if ((play->sceneNum == SCENE_F41) || (play->sceneNum == SCENE_INISIE_R)) { + if ((play->sceneId == SCENE_F41) || (play->sceneId == SCENE_INISIE_R)) { skyboxCtx->rotZ = 3.15000009537f; } } diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c index 45286fccb..60e807beb 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.c @@ -5,6 +5,7 @@ */ #include "z_bg_crace_movebg.h" +#include "overlays/actors/ovl_En_Dno/z_en_dno.h" #define FLAGS (ACTOR_FLAG_10) @@ -15,22 +16,30 @@ void BgCraceMovebg_Destroy(Actor* thisx, PlayState* play); void BgCraceMovebg_Update(Actor* thisx, PlayState* play); void BgCraceMovebg_Draw(Actor* thisx, PlayState* play); -s32 func_80A7090C(PlayState* play); -void func_80A70970(BgCraceMovebg* this, PlayState* play); -void func_80A7099C(BgCraceMovebg* this, PlayState* play); -void func_80A709E4(BgCraceMovebg* this, PlayState* play); -void func_80A70A08(BgCraceMovebg* this, PlayState* play); -void func_80A70A84(BgCraceMovebg* this, PlayState* play); -void func_80A70A9C(BgCraceMovebg* this, PlayState* play); -void func_80A70C04(BgCraceMovebg* this, PlayState* play); -void func_80A70D74(BgCraceMovebg* this, PlayState* play); -void func_80A70DA8(BgCraceMovebg* this, PlayState* play); -void func_80A70E2C(BgCraceMovebg* this, PlayState* play); -void func_80A70E70(BgCraceMovebg* this, PlayState* play); -void func_80A70F14(BgCraceMovebg* this, PlayState* play); -void func_80A70F2C(BgCraceMovebg* this, PlayState* play); -void func_80A70FF4(BgCraceMovebg* this, PlayState* play); -void func_80A71040(BgCraceMovebg* this, PlayState* play); +s32 BgCraceMovebg_GetRaceStatus(PlayState* play); +void BgCraceMovebg_OpeningDoor_SetupIdle(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_OpeningDoor_Idle(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_OpeningDoor_SetupOpen(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_OpeningDoor_Open(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_OpeningDoor_SetupDoNothing(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_OpeningDoor_DoNothing(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_ClosingDoor_SetupIdle(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_ClosingDoor_Idle(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_ClosingDoor_SetupWaitToClose(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_ClosingDoor_WaitToClose(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_ClosingDoor_SetupClose(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_ClosingDoor_Close(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_ClosingDoor_SetupDoNothing(BgCraceMovebg* this, PlayState* play); +void BgCraceMovebg_ClosingDoor_DoNothing(BgCraceMovebg* this, PlayState* play); + +typedef enum { + /* 0 */ BG_CRACE_MOVEBG_RACE_STATUS_BUTLER_NOT_PRESENT, + /* 1 */ BG_CRACE_MOVEBG_RACE_STATUS_FIRST_RACE, + /* 2 */ BG_CRACE_MOVEBG_RACE_STATUS_SUBSEQUENT_RACE +} BgCraceMovebgRaceStatus; + +u8 sIsLoaded[32]; const ActorInit Bg_Crace_Movebg_InitVars = { ACTOR_BG_CRACE_MOVEBG, @@ -44,13 +53,14 @@ const ActorInit Bg_Crace_Movebg_InitVars = { (ActorFunc)BgCraceMovebg_Draw, }; -static u8 D_80A710A0 = 0; -static u8 D_80A710A4 = 0; +static u8 sHasInitializedIsLoaded = 0; +static u8 sLoadedDoorCount = 0; + static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -static Vec3f D_80A710AC[] = { 0.0f, 0.0f, 1.0f }; -u8 D_80A711B0[32]; + +static Vec3f sUnitVecZ = { 0.0f, 0.0f, 1.0f }; void BgCraceMovebg_Init(Actor* thisx, PlayState* play) { BgCraceMovebg* this = THIS; @@ -58,122 +68,138 @@ void BgCraceMovebg_Init(Actor* thisx, PlayState* play) { s32 j; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (D_80A710A0 == 0) { - for (i = 0; i < ARRAY_COUNT(D_80A711B0); i++) { - D_80A711B0[i] = 0; + if (!sHasInitializedIsLoaded) { + for (i = 0; i < ARRAY_COUNT(sIsLoaded); i++) { + sIsLoaded[i] = 0; } - D_80A710A0 = 1; + sHasInitializedIsLoaded = true; } DynaPolyActor_Init(&this->dyna, 1); - DynaPolyActor_LoadMesh(play, &this->dyna, &object_crace_object_Colheader_000E00); + DynaPolyActor_LoadMesh(play, &this->dyna, &gDekuShrineSlidingDoorCol); - this->unk184 = this->dyna.actor.world.rot.x; - this->unk16C = this->dyna.actor.world.rot.z; + this->index = BG_CRACE_MOVEBG_GET_INDEX(&this->dyna.actor); + this->openSpeed = BG_CRACE_MOVEBG_GET_OPEN_SPEED(&this->dyna.actor); this->dyna.actor.world.rot.x = 0; this->dyna.actor.world.rot.z = 0; this->dyna.actor.home.rot.x = 0; this->dyna.actor.home.rot.z = 0; this->dyna.actor.flags |= ACTOR_FLAG_10000000; - switch (BGCRACEMOVEBG_GET_F(&this->dyna.actor)) { - case 0: - case 2: - for (j = 0; j < D_80A710A4; j++) { - if (D_80A711B0[j] == this->unk184) { - this->unk170 |= 8; + switch (BG_CRACE_MOVEBG_GET_TYPE(&this->dyna.actor)) { + case BG_CRACE_MOVEBG_TYPE_CLOSING: + case BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING: + for (j = 0; j < sLoadedDoorCount; j++) { + if (sIsLoaded[j] == this->index) { + this->stateFlags |= BG_CRACE_MOVEBG_FLAG_ALREADY_LOADED; Actor_MarkForDeath(&this->dyna.actor); return; } } - if (D_80A710A4 < ARRAY_COUNT(D_80A711B0)) { - D_80A711B0[(s32)D_80A710A4++] = this->unk184; + + if (sLoadedDoorCount < ARRAY_COUNT(sIsLoaded)) { + sIsLoaded[(s32)sLoadedDoorCount] = this->index; + sLoadedDoorCount++; } + this->dyna.actor.room = -1; - switch (func_80A7090C(play)) { - case 0: - func_80A70D74(this, play); + switch (BgCraceMovebg_GetRaceStatus(play)) { + case BG_CRACE_MOVEBG_RACE_STATUS_BUTLER_NOT_PRESENT: + BgCraceMovebg_ClosingDoor_SetupIdle(this, play); break; - case 1: - func_80A70D74(this, play); + + case BG_CRACE_MOVEBG_RACE_STATUS_FIRST_RACE: + BgCraceMovebg_ClosingDoor_SetupIdle(this, play); break; - case 2: - Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1); - func_80A70D74(this, play); + + case BG_CRACE_MOVEBG_RACE_STATUS_SUBSEQUENT_RACE: + // Makes sure no lingering switch flags are set from the last time the player did a race. + Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1); + BgCraceMovebg_ClosingDoor_SetupIdle(this, play); break; } break; - case 1: - func_80A70970(this, play); + + case BG_CRACE_MOVEBG_TYPE_OPENING: + BgCraceMovebg_OpeningDoor_SetupIdle(this, play); break; + default: Actor_MarkForDeath(&this->dyna.actor); break; } } -s32 func_80A7090C(PlayState* play) { +s32 BgCraceMovebg_GetRaceStatus(PlayState* play) { s32 pad; - s32 returnVal = 0; - Actor* tempActor = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_DNO); + s32 raceStatus = BG_CRACE_MOVEBG_RACE_STATUS_BUTLER_NOT_PRESENT; + Actor* butler = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_DNO); - if (tempActor != NULL) { - if (Flags_GetSwitch(play, BGCRACEMOVEBG_GET_3F80(tempActor))) { - returnVal = 2; + if (butler != NULL) { + if (Flags_GetSwitch(play, EN_DNO_GET_RACE_STARTED_SWITCH_FLAG(butler))) { + raceStatus = BG_CRACE_MOVEBG_RACE_STATUS_SUBSEQUENT_RACE; } else { - returnVal = 1; + raceStatus = BG_CRACE_MOVEBG_RACE_STATUS_FIRST_RACE; } } - return returnVal; + + return raceStatus; } -void func_80A70970(BgCraceMovebg* this, PlayState* play) { - this->unk164 = 0.0f; - this->unk160 = 0.0f; - this->actionFunc = func_80A7099C; +void BgCraceMovebg_OpeningDoor_SetupIdle(BgCraceMovebg* this, PlayState* play) { + this->targetDoorHeight = 0.0f; + this->doorHeight = 0.0f; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; + this->actionFunc = BgCraceMovebg_OpeningDoor_Idle; } -void func_80A7099C(BgCraceMovebg* this, PlayState* play) { - if (Flags_GetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor))) { - func_80A709E4(this, play); +/** + * Wait for this door's switch flag to be set, then start opening. + */ +void BgCraceMovebg_OpeningDoor_Idle(BgCraceMovebg* this, PlayState* play) { + if (Flags_GetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor))) { + BgCraceMovebg_OpeningDoor_SetupOpen(this, play); } } -void func_80A709E4(BgCraceMovebg* this, PlayState* play) { - this->actionFunc = func_80A70A08; - this->unk164 = 180.0f; +void BgCraceMovebg_OpeningDoor_SetupOpen(BgCraceMovebg* this, PlayState* play) { + this->targetDoorHeight = 180.0f; + this->actionFunc = BgCraceMovebg_OpeningDoor_Open; } -void func_80A70A08(BgCraceMovebg* this, PlayState* play) { +/** + * Silde open, then do nothing. + */ +void BgCraceMovebg_OpeningDoor_Open(BgCraceMovebg* this, PlayState* play) { func_800B9010(&this->dyna.actor, NA_SE_EV_STONEDOOR_OPEN_S - SFX_FLAG); - Math_SmoothStepToF(&this->unk160, this->unk164, 2.0f, this->unk16C, 0.01f); - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160; - if (this->unk160 == this->unk164) { - func_80A70A84(this, play); + Math_SmoothStepToF(&this->doorHeight, this->targetDoorHeight, 2.0f, this->openSpeed, 0.01f); + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->doorHeight; + if (this->doorHeight == this->targetDoorHeight) { + BgCraceMovebg_OpeningDoor_SetupDoNothing(this, play); } } -void func_80A70A84(BgCraceMovebg* this, PlayState* play) { - this->actionFunc = func_80A70A9C; +void BgCraceMovebg_OpeningDoor_SetupDoNothing(BgCraceMovebg* this, PlayState* play) { + this->actionFunc = BgCraceMovebg_OpeningDoor_DoNothing; } -void func_80A70A9C(BgCraceMovebg* this, PlayState* play) { +void BgCraceMovebg_OpeningDoor_DoNothing(BgCraceMovebg* this, PlayState* play) { } void BgCraceMovebg_Destroy(Actor* thisx, PlayState* play) { BgCraceMovebg* this = THIS; DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - if (!(this->unk170 & 0x8)) { - switch (BGCRACEMOVEBG_GET_F(&this->dyna.actor)) { - case 0: - case 2: - Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(thisx)); - Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(thisx) + 1); + if (!(this->stateFlags & BG_CRACE_MOVEBG_FLAG_ALREADY_LOADED)) { + switch (BG_CRACE_MOVEBG_GET_TYPE(&this->dyna.actor)) { + case BG_CRACE_MOVEBG_TYPE_CLOSING: + case BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING: + Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(thisx)); + Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(thisx) + 1); break; - case 1: - Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(thisx)); + + case BG_CRACE_MOVEBG_TYPE_OPENING: + Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(thisx)); break; } } @@ -183,117 +209,147 @@ void BgCraceMovebg_Update(Actor* thisx, PlayState* play) { BgCraceMovebg* this = THIS; s32 pad; Player* player = GET_PLAYER(play); - s16 tempRot; + s16 yawDiff; - switch (BGCRACEMOVEBG_GET_F(&this->dyna.actor)) { - case 0: - case 2: - tempRot = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.home.rot.y; - if ((tempRot >= -0x4000) && (tempRot <= 0x4000)) { + switch (BG_CRACE_MOVEBG_GET_TYPE(&this->dyna.actor)) { + case BG_CRACE_MOVEBG_TYPE_CLOSING: + case BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING: + yawDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.home.rot.y; + if ((yawDiff >= -0x4000) && (yawDiff <= 0x4000)) { this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y; } else { this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y + 0x8000; } + break; + default: - this->actionFunc(this, play); - Math_Vec3f_Copy(&this->unk188, &player->bodyPartsPos[0]); + break; } + + this->actionFunc(this, play); + Math_Vec3f_Copy(&this->prevPlayerPos, &player->bodyPartsPos[0]); } -void func_80A70C04(BgCraceMovebg* this, PlayState* play) { +/** + * Updates this door's flags if the player has moved beyond it. If the door is of type + * BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING, then nothing happens here, so the door never + * knows the player has moved beyond it. + */ +void BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(BgCraceMovebg* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); Vec3f intersect; - Vec3f diff; + Vec3f posDiff; - if ((BGCRACEMOVEBG_GET_F(&this->dyna.actor) != 2) && - SubS_LineSegVsPlane(&this->dyna.actor.home.pos, &this->dyna.actor.home.rot, D_80A710AC, &this->unk188, + if ((BG_CRACE_MOVEBG_GET_TYPE(&this->dyna.actor) != BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING) && + SubS_LineSegVsPlane(&this->dyna.actor.home.pos, &this->dyna.actor.home.rot, &sUnitVecZ, &this->prevPlayerPos, &player->bodyPartsPos[0], &intersect)) { Matrix_RotateYS(-this->dyna.actor.home.rot.y, MTXMODE_NEW); - Math_Vec3f_Diff(&player->bodyPartsPos[0], &this->dyna.actor.home.pos, &diff); - Matrix_MultVec3f(&diff, &this->unk178); - if (fabsf(this->unk178.x) < 100.0f && this->unk178.y >= -10.0f && this->unk178.y <= 180.0f) { - if (this->unk178.z < 0.0f) { - Flags_SetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1); - this->unk170 |= 2; + Math_Vec3f_Diff(&player->bodyPartsPos[0], &this->dyna.actor.home.pos, &posDiff); + Matrix_MultVec3f(&posDiff, &this->intersectionOffsetFromHome); + + if (fabsf(this->intersectionOffsetFromHome.x) < 100.0f && this->intersectionOffsetFromHome.y >= -10.0f && + this->intersectionOffsetFromHome.y <= 180.0f) { + if (this->intersectionOffsetFromHome.z < 0.0f) { + Flags_SetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1); + this->stateFlags |= BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR; } else { - Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1); - this->unk170 &= ~2; + Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1); + this->stateFlags &= ~BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR; } } } } -void func_80A70D74(BgCraceMovebg* this, PlayState* play) { - this->unk164 = 180.0f; - this->unk160 = 180.0f; - this->actionFunc = func_80A70DA8; +void BgCraceMovebg_ClosingDoor_SetupIdle(BgCraceMovebg* this, PlayState* play) { + this->targetDoorHeight = 180.0f; + this->doorHeight = 180.0f; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 180.0f; + this->actionFunc = BgCraceMovebg_ClosingDoor_Idle; } -void func_80A70DA8(BgCraceMovebg* this, PlayState* play) { - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160; - func_80A70C04(this, play); - if (this->unk170 & 1) { - func_80A70E2C(this, play); +/** + * Wait for the Deku Butler to move beyond the door, or wait for this door's switch flag + * to be set. In either case, start closing; how long to wait before closing depends on + * what triggered it to close. + */ +void BgCraceMovebg_ClosingDoor_Idle(BgCraceMovebg* this, PlayState* play) { + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->doorHeight; + BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(this, play); + + if (this->stateFlags & BG_CRACE_MOVEBG_FLAG_BUTLER_IS_BEYOND_DOOR) { + BgCraceMovebg_ClosingDoor_SetupWaitToClose(this, play); } - if (Flags_GetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor))) { - func_80A70F14(this, play); + + if (Flags_GetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor))) { + BgCraceMovebg_ClosingDoor_SetupClose(this, play); } } -void func_80A70E2C(BgCraceMovebg* this, PlayState* play) { - this->unk174 = BGCRACEMOVEBG_GET_F800(&this->dyna.actor) * 10; - this->unk164 = 180.0f; - this->unk160 = 180.0f; - this->actionFunc = func_80A70E70; +void BgCraceMovebg_ClosingDoor_SetupWaitToClose(BgCraceMovebg* this, PlayState* play) { + this->closeWaitTimer = BG_CRACE_MOVEBG_GET_CLOSE_WAIT_TIMER(&this->dyna.actor) * 10; + this->targetDoorHeight = 180.0f; + this->doorHeight = 180.0f; + this->actionFunc = BgCraceMovebg_ClosingDoor_WaitToClose; } -void func_80A70E70(BgCraceMovebg* this, PlayState* play) { - if (this->unk174 > 0) { - this->unk174--; +/** + * Wait until the closeWaitTimer reaches 0, then set the door's switch flag and start closing. + */ +void BgCraceMovebg_ClosingDoor_WaitToClose(BgCraceMovebg* this, PlayState* play) { + if (this->closeWaitTimer > 0) { + this->closeWaitTimer--; } - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160; - func_80A70C04(this, play); - if (this->unk174 <= 0) { - this->unk160 = 180.0f; - this->unk164 = 0.0f; + + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->doorHeight; + BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(this, play); + + if (this->closeWaitTimer <= 0) { + this->doorHeight = 180.0f; + this->targetDoorHeight = 0.0f; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 180.0f; - Flags_SetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor)); - func_80A70F14(this, play); + Flags_SetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor)); + BgCraceMovebg_ClosingDoor_SetupClose(this, play); } } -void func_80A70F14(BgCraceMovebg* this, PlayState* play) { - this->actionFunc = func_80A70F2C; +void BgCraceMovebg_ClosingDoor_SetupClose(BgCraceMovebg* this, PlayState* play) { + this->actionFunc = BgCraceMovebg_ClosingDoor_Close; } -void func_80A70F2C(BgCraceMovebg* this, PlayState* play) { - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160; - func_80A70C04(this, play); - if (Math_StepToF(&this->unk160, 0.0f, 1.0f)) { - if (!(this->unk170 & 2) && !Flags_GetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1)) { +/** + * Slowly slide closed, then check to see if the player is beyond the door. If the player has + * not moved beyond the door, trigger a voidout. Otherwise, do nothing. + */ +void BgCraceMovebg_ClosingDoor_Close(BgCraceMovebg* this, PlayState* play) { + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->doorHeight; + BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(this, play); + + if (Math_StepToF(&this->doorHeight, 0.0f, 1.0f)) { + if (!(this->stateFlags & BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR) && + !Flags_GetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1)) { play->haltAllActors = true; func_80169FDC(&play->state); play_sound(NA_SE_OC_ABYSS); } - func_80A70FF4(this, play); + + BgCraceMovebg_ClosingDoor_SetupDoNothing(this, play); } else { func_800B9010(&this->dyna.actor, NA_SE_EV_STONEDOOR_CLOSE_S - SFX_FLAG); } } -void func_80A70FF4(BgCraceMovebg* this, PlayState* play) { - this->unk164 = 0.0f; - this->unk160 = 0.0f; +void BgCraceMovebg_ClosingDoor_SetupDoNothing(BgCraceMovebg* this, PlayState* play) { + this->targetDoorHeight = 0.0f; + this->doorHeight = 0.0f; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); - this->actionFunc = func_80A71040; + this->actionFunc = BgCraceMovebg_ClosingDoor_DoNothing; } -void func_80A71040(BgCraceMovebg* this, PlayState* play) { +void BgCraceMovebg_ClosingDoor_DoNothing(BgCraceMovebg* this, PlayState* play) { } void BgCraceMovebg_Draw(Actor* thisx, PlayState* play) { - Gfx_DrawDListOpa(play, object_crace_object_DL_0003A0); + Gfx_DrawDListOpa(play, gDekuShrineSlidingDoorDL); } diff --git a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h index 4faca7ba2..fb24b10d3 100644 --- a/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h +++ b/src/overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h @@ -8,23 +8,34 @@ struct BgCraceMovebg; typedef void (*BgCraceMovebgActionFunc)(struct BgCraceMovebg*, PlayState*); -#define BGCRACEMOVEBG_GET_F(thisx) (((thisx)->params) & 0xF) -#define BGCRACEMOVEBG_GET_7F0(thisx) (((thisx)->params >> 4) & 0x7F) -#define BGCRACEMOVEBG_GET_3F80(thisx) (((thisx)->params >> 7) & 0x7F) -#define BGCRACEMOVEBG_GET_F800(thisx) (((thisx)->params >> 0xB) & 0x1F) +#define BG_CRACE_MOVEBG_GET_TYPE(thisx) (((thisx)->params) & 0xF) +#define BG_CRACE_MOVEBG_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 4) & 0x7F) +#define BG_CRACE_MOVEBG_GET_CLOSE_WAIT_TIMER(thisx) (((thisx)->params >> 0xB) & 0x1F) +#define BG_CRACE_MOVEBG_GET_INDEX(thisx) ((thisx)->world.rot.x) +#define BG_CRACE_MOVEBG_GET_OPEN_SPEED(thisx) ((thisx)->world.rot.z) + +#define BG_CRACE_MOVEBG_FLAG_BUTLER_IS_BEYOND_DOOR (1 << 0) +#define BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR (1 << 1) +#define BG_CRACE_MOVEBG_FLAG_ALREADY_LOADED (1 << 3) + +typedef enum { + /* 0 */ BG_CRACE_MOVEBG_TYPE_CLOSING, + /* 1 */ BG_CRACE_MOVEBG_TYPE_OPENING, + /* 2 */ BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING // Not triggered to close by the Deku Butler, and triggers a voidout no matter which side of the door they're on. +} BgCraceMovebgType; typedef struct BgCraceMovebg { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ BgCraceMovebgActionFunc actionFunc; - /* 0x160 */ f32 unk160; - /* 0x164 */ f32 unk164; + /* 0x160 */ f32 doorHeight; + /* 0x164 */ f32 targetDoorHeight; /* 0x168 */ UNK_TYPE1 pad168[0x4]; - /* 0x16C */ f32 unk16C; - /* 0x170 */ s32 unk170; - /* 0x174 */ s32 unk174; - /* 0x178 */ Vec3f unk178; - /* 0x184 */ u8 unk184; - /* 0x188 */ Vec3f unk188; + /* 0x16C */ f32 openSpeed; + /* 0x170 */ s32 stateFlags; + /* 0x174 */ s32 closeWaitTimer; + /* 0x178 */ Vec3f intersectionOffsetFromHome; + /* 0x184 */ u8 index; + /* 0x188 */ Vec3f prevPlayerPos; } BgCraceMovebg; // size = 0x194 extern const ActorInit Bg_Crace_Movebg_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c index 0c273c739..ec2fd9e9c 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c @@ -6,6 +6,7 @@ #include "prevent_bss_reordering.h" #include "z_bg_hakugin_post.h" +#include "z64quake.h" #include "z64rumble.h" #include "objects/object_hakugin_obj/object_hakugin_obj.h" @@ -509,7 +510,7 @@ void func_80A9C058(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* s32 pad; Vec3f sp44; s32 pad2[2]; - s16 quake; + s16 quakeIndex; if (this->unk_170 == 0) { for (i = 0; i < unkStruct->count; i++) { @@ -520,10 +521,12 @@ void func_80A9C058(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* sp44.y = this->unk_16C + unkStruct1->unk_14.y; sp44.z = this->dyna.actor.home.pos.z + unkStruct1->unk_14.z; Rumble_Request(Math3D_Vec3fDistSq(&sp44, &GET_PLAYER(play)->actor.world.pos), 255, 20, 150); - quake = Quake_Add(GET_ACTIVE_CAM(play), 3); - Quake_SetSpeed(quake, 20000); - Quake_SetQuakeValues(quake, 7, 0, 0, 0); - Quake_SetCountdown(quake, 12); + + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + Quake_SetSpeed(quakeIndex, 20000); + Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 12); + if (this->unk_179 <= 0) { func_8019F128(NA_SE_EV_STONEDOOR_STOP); this->unk_179 = 40; @@ -538,15 +541,16 @@ void func_80A9C18C(BgHakuginPost* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); Camera* activeCam = GET_ACTIVE_CAM(play); - s16 quake; + s16 quakeIndex; Rumble_Request(Math3D_XZDistanceSquared(player->actor.world.pos.x, player->actor.world.pos.z, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.z), 255, 20, 150); - quake = Quake_Add(activeCam, 3); - Quake_SetSpeed(quake, 17232); - Quake_SetQuakeValues(quake, 6, 0, 0, 0); - Quake_SetCountdown(quake, 20); + + quakeIndex = Quake_Add(activeCam, QUAKE_TYPE_3); + Quake_SetSpeed(quakeIndex, 17232); + Quake_SetQuakeValues(quakeIndex, 6, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 20); } void func_80A9C228(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct) { diff --git a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c index e619aa7e0..4f1434dc2 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c @@ -5,6 +5,7 @@ */ #include "z_bg_ikana_dharma.h" +#include "z64quake.h" #include "assets/objects/object_ikana_obj/object_ikana_obj.h" #define FLAGS (ACTOR_FLAG_10) @@ -226,11 +227,12 @@ void BgIkanaDharma_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->dyna.actor); Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); if (this->dyna.actor.bgCheckFlags & 2) { - s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + + Quake_SetSpeed(quakeIndex, 21536); + Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 12); - Quake_SetSpeed(quake, 21536); - Quake_SetQuakeValues(quake, 4, 0, 0, 0); - Quake_SetCountdown(quake, 12); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } } else { diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c index 902b52776..af0e33019 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c @@ -5,6 +5,7 @@ */ #include "z_bg_ikana_rotaryroom.h" +#include "z64quake.h" #include "overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.h" #include "overlays/actors/ovl_En_Torch2/z_en_torch2.h" #include "overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h" @@ -831,11 +832,11 @@ void func_80B81A80(Actor* thisx, PlayState* play) { func_80B81B84(this); } else if (this->unk_584 == 15) { - s16 sp26 = Quake_Add(GET_ACTIVE_CAM(play), 3); + s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); - Quake_SetSpeed(sp26, 0x7B30); - Quake_SetQuakeValues(sp26, 6, 0, 100, 0); - Quake_SetCountdown(sp26, 22); + Quake_SetSpeed(quakeIndex, 31536); + Quake_SetQuakeValues(quakeIndex, 6, 0, 100, 0); + Quake_SetCountdown(quakeIndex, 22); } } @@ -858,11 +859,11 @@ void func_80B81BA0(Actor* thisx, PlayState* play) { thisx->shape.rot.x += 0x1F4; if (!(this->unk_584 & 7)) { - s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); - Quake_SetSpeed(quake, 0x7B30); - Quake_SetQuakeValues(quake, (s32)(Rand_ZeroOne() * 2.5f) + 3, 0, 10, 0); - Quake_SetCountdown(quake, 15); + Quake_SetSpeed(quakeIndex, 31536); + Quake_SetQuakeValues(quakeIndex, (s32)(Rand_ZeroOne() * 2.5f) + 3, 0, 10, 0); + Quake_SetCountdown(quakeIndex, 15); } if (Flags_GetSwitch(play, BGIKANAROTARYROOM_GET_FE(&this->dyna.actor))) { @@ -928,11 +929,11 @@ void func_80B81DC8(Actor* thisx, PlayState* play) { ActorCutscene_Stop(this->dyna.actor.cutscene); func_80B818B4(this); } else if (this->unk_584 == 19) { - s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); - Quake_SetSpeed(quake, 0x4E20); - Quake_SetQuakeValues(quake, 5, 0, 40, 60); - Quake_SetCountdown(quake, 17); + Quake_SetSpeed(quakeIndex, 20000); + Quake_SetQuakeValues(quakeIndex, 5, 0, 40, 60); + Quake_SetCountdown(quakeIndex, 17); } } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c index ec17965c6..b3da7b2bf 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c @@ -5,6 +5,7 @@ */ #include "z_bg_ikana_shutter.h" +#include "z64quake.h" #include "objects/object_ikana_obj/object_ikana_obj.h" #define FLAGS (ACTOR_FLAG_10) @@ -144,16 +145,17 @@ void func_80BD59F8(BgIkanaShutter* this) { void func_80BD5A18(BgIkanaShutter* this, PlayState* play) { s32 pad[2]; - s16 quake; + s16 quakeIndex; this->dyna.actor.velocity.y += -5.0f; this->dyna.actor.velocity.y *= 0.978f; this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) { - quake = Quake_Add(GET_ACTIVE_CAM(play), 3); - Quake_SetSpeed(quake, 0x5420); - Quake_SetQuakeValues(quake, 4, 0, 0, 0); - Quake_SetCountdown(quake, 12); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + Quake_SetSpeed(quakeIndex, 21536); + Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 12); + func_80BD5828(this); } } diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c index 0bc385cb7..017f9ef04 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c @@ -5,6 +5,7 @@ */ #include "z_bg_iknin_susceil.h" +#include "z64quake.h" #include "z64rumble.h" #include "objects/object_ikninside_obj/object_ikninside_obj.h" @@ -70,11 +71,12 @@ void func_80C0A838(BgIkninSusceil* this, PlayState* play) { void func_80C0A86C(BgIkninSusceil* this, PlayState* play, s16 verticalMag, s16 countdown, s32 arg4) { s32 pad; - s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + + Quake_SetSpeed(quakeIndex, 31536); + Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0); + Quake_SetCountdown(quakeIndex, countdown); - Quake_SetSpeed(quake, 0x7B30); - Quake_SetQuakeValues(quake, verticalMag, 0, 0, 0); - Quake_SetCountdown(quake, countdown); if (arg4 == 1) { Rumble_Request(SQ(100.0f), 255, 20, 150); } else if (arg4 == 2) { diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index 81397039d..c0e9bdc42 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -131,7 +131,7 @@ void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, PlayState* play) { func_800B9010(&this->dyna.actor, NA_SE_EV_WOOD_WATER_WHEEL - SFX_FLAG); } - if ((play->csCtx.state != 0) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 4) && + if ((play->csCtx.state != 0) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 4) && (play->csCtx.frames == 1495)) { func_8019F128(NA_SE_EV_DOOR_UNLOCK); } diff --git a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c index b54e7a583..22cf4968f 100644 --- a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c +++ b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c @@ -6,6 +6,7 @@ #include "z_bg_open_shutter.h" #include "objects/object_open_obj/object_open_obj.h" +#include "z64quake.h" #include "z64rumble.h" #define FLAGS (ACTOR_FLAG_10) @@ -105,7 +106,7 @@ void BgOpenShutter_Destroy(Actor* thisx, PlayState* play) { } void func_80ACAD88(BgOpenShutter* this, PlayState* play) { - s32 quake; + s32 doorDirection; if (this->unk_15C != 0) { Player* player = GET_PLAYER(play); @@ -118,10 +119,10 @@ void func_80ACAD88(BgOpenShutter* this, PlayState* play) { } else { Player* player = GET_PLAYER(play); - quake = func_80ACABA8(this, play); - if (quake > 0) { + doorDirection = func_80ACABA8(this, play); + if (doorDirection > 0) { player->doorType = 2; - player->doorDirection = quake; + player->doorDirection = doorDirection; player->doorActor = &this->dyna.actor; func_80122F28(player); } @@ -142,18 +143,21 @@ void func_80ACAE5C(BgOpenShutter* this, PlayState* play) { void func_80ACAEF0(BgOpenShutter* this, PlayState* play) { s32 pad; - s16 quake; + s16 quakeIndex; Math_StepToF(&this->dyna.actor.velocity.y, 20.0f, 8.0f); if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) { this->dyna.actor.floorHeight = this->dyna.actor.home.pos.y; Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 60.0f, 10, 8.0f, 500, 10, true); Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND); - quake = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3); - Quake_SetSpeed(quake, -0x7F18); - Quake_SetQuakeValues(quake, 2, 0, 0, 0); - Quake_SetCountdown(quake, 10); + + quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); + Quake_SetSpeed(quakeIndex, -32536); + Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 10); + Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100); + this->unk_15C = 0; this->actionFunc = func_80ACAD88; } diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index ca8ad214f..f26bc505f 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -521,7 +521,7 @@ void func_809ED224(Boss04* this) { this->unk_2C8 = 200; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ME_DEAD); this->actor.flags &= ~ACTOR_FLAG_1; - func_801A2ED8(); + Audio_RestorePrevBgm(); this->unk_1F6 = 10; } @@ -759,7 +759,7 @@ void Boss04_Update(Actor* thisx, PlayState* play2) { if (D_809EE4D0 != 0) { D_809EE4D0--; if (D_809EE4D0 == 0) { - func_801A2E54(0x38); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); } } diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c index 75f530c48..efb46a892 100644 --- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c +++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c @@ -5,6 +5,7 @@ */ #include "z_boss_hakugin.h" +#include "z64quake.h" #include "z64rumble.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index 541a4d93d..58d27d448 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -162,7 +162,7 @@ void DmAh_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; Actor_SetScale(&this->actor, 0.01f); this->unk_27C |= 1; - if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) { + if ((play->sceneId == SCENE_YADOYA) && (play->curSpawn == 4)) { this->unk_280 = func_80C1D78C(play); func_80C1D410(this, 1); this->actionFunc = func_80C1D92C; diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index 4cd28f454..5e03eb74c 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -183,7 +183,7 @@ void func_80C1C958(DmAn* this, PlayState* play) { this->unk_2AE |= 1; this->actor.draw = func_80C1D0B0; - if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) { + if ((play->sceneId == SCENE_YADOYA) && (play->curSpawn == 4)) { this->unk_2B4 = func_80C1C8E8(play); func_80C1C4D8(this, play, 1); this->actionFunc = func_80C1CC80; diff --git a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c index 87b1e52b9..82e5157f6 100644 --- a/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c +++ b/src/overlays/actors/ovl_Dm_Char00/z_dm_char00.c @@ -449,15 +449,15 @@ void func_80AA5E2C(DmChar00* this, PlayState* play) { void func_80AA5EBC(DmChar00* this, PlayState* play) { if (play->csCtx.state != 0) { - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_LOST_WOODS: - if (gSaveContext.sceneSetupIndex == 1) { + if (gSaveContext.sceneLayer == 1) { func_80AA561C(this, play); } break; case SCENE_OPENINGDAN: - if (gSaveContext.sceneSetupIndex == 0) { + if (gSaveContext.sceneLayer == 0) { if (play->csCtx.currentCsIndex == 0) { func_80AA5720(this, play); } else if (play->csCtx.currentCsIndex == 1) { @@ -469,7 +469,7 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) { break; case SCENE_OKUJOU: - if (gSaveContext.sceneSetupIndex == 0) { + if (gSaveContext.sceneLayer == 0) { if (play->csCtx.currentCsIndex == 0) { func_80AA58CC(this, play); } else if (play->csCtx.currentCsIndex == 1) { @@ -477,7 +477,7 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) { } else if (play->csCtx.currentCsIndex == 2) { func_80AA5960(this, play); } - } else if (gSaveContext.sceneSetupIndex == 2) { + } else if (gSaveContext.sceneLayer == 2) { if (play->csCtx.currentCsIndex == 0) { func_80AA59E4(this, play); } else if (play->csCtx.currentCsIndex == 1) { @@ -487,13 +487,13 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) { break; case SCENE_00KEIKOKU: - if (gSaveContext.sceneSetupIndex == 3) { + if (gSaveContext.sceneLayer == 3) { if (play->csCtx.currentCsIndex == 0) { func_80AA5AF4(this, play); } else if (play->csCtx.currentCsIndex == 2) { func_80AA5E2C(this, play); } - } else if (gSaveContext.sceneSetupIndex == 7) { + } else if (gSaveContext.sceneLayer == 7) { if (play->csCtx.currentCsIndex == 0) { func_80AA5BF8(this, play); } else if (play->csCtx.currentCsIndex == 1) { @@ -503,19 +503,19 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) { break; case SCENE_MITURIN: - if ((gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 1)) { + if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 1)) { func_80AA5DC8(this, play); } break; case SCENE_INSIDETOWER: - if ((gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 0)) { + if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0)) { func_80AA5D10(this, play); } break; case SCENE_PIRATE: - if ((gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 0)) { + if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0)) { func_80AA5D6C(this, play); } break; @@ -527,7 +527,7 @@ void DmChar00_Init(Actor* thisx, PlayState* play) { s32 pad; DmChar00* this = THIS; - if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { + if ((play->sceneId == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { Actor_MarkForDeath(thisx); } @@ -853,7 +853,7 @@ void func_80AA62FC(DmChar00* this, PlayState* play) { void func_80AA67F8(DmChar00* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((play->csCtx.state == 0) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 1)) { + if ((play->csCtx.state == 0) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 1)) { if (this->unk_261 != 42) { this->unk_261 = 42; func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0); @@ -914,9 +914,9 @@ void DmChar00_Draw(Actor* thisx, PlayState* play2) { s32 pad; Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4); - if ((play->csCtx.state == 0) && ((play->sceneNum != SCENE_OPENINGDAN) || (gSaveContext.sceneSetupIndex != 0) || - (play->roomCtx.curRoom.num != 0) || (play->csCtx.currentCsIndex != 1) || - (DMCHAR00_GET(&this->actor) != DMCHAR00_0))) { + if ((play->csCtx.state == 0) && + ((play->sceneId != SCENE_OPENINGDAN) || (gSaveContext.sceneLayer != 0) || (play->roomCtx.curRoom.num != 0) || + (play->csCtx.currentCsIndex != 1) || (DMCHAR00_GET(&this->actor) != DMCHAR00_0))) { return; } diff --git a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c index 90517fbaf..2f715afed 100644 --- a/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c +++ b/src/overlays/actors/ovl_Dm_Char01/z_dm_char01.c @@ -4,7 +4,6 @@ * Description: Woodfall scene objects (temple, water, walls, etc) */ -#include "prevent_bss_reordering.h" #include "z_dm_char01.h" #include "objects/object_mtoride/object_mtoride.h" #include "overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.h" @@ -74,7 +73,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { break; } - if (gSaveContext.sceneSetupIndex == 0) { + if (gSaveContext.sceneLayer == 0) { play->envCtx.unk_1F = 5; play->envCtx.unk_20 = 5; } @@ -88,7 +87,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodfallSceneryPoisonWaterDamageCol); this->unk_34D = true; - if (gSaveContext.sceneSetupIndex == 1) { + if (gSaveContext.sceneLayer == 1) { this->unk_34C = 1; this->actionFunc = func_80AA8C28; } else { @@ -98,7 +97,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) { break; case DMCHAR01_1: - if ((gSaveContext.save.weekEventReg[20] & 2) || (gSaveContext.sceneSetupIndex == 1)) { + if ((gSaveContext.save.weekEventReg[20] & 2) || (gSaveContext.sceneLayer == 1)) { this->unk_34C = 1; this->actionFunc = func_80AA8F1C; } else { @@ -412,7 +411,7 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) { break; case 1: - if (gSaveContext.sceneSetupIndex == 1) { + if (gSaveContext.sceneLayer == 1) { AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPurifiedWaterTexAnim)); Gfx_DrawDListOpa(play, gWoodfallSceneryFloorDL); Gfx_DrawDListXlu(play, gWoodfallSceneryPurifiedWaterDL); diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c index 5a6695816..da67e6f1c 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c @@ -75,7 +75,7 @@ void DmChar02_PlaySfxForDroppingOcarinaCutscene(DmChar02* this, PlayState* play) } void DmChar02_PlaySfxForCutscenes(DmChar02* this, PlayState* play) { - if ((play->csCtx.state != 0) && (play->sceneNum == SCENE_OKUJOU) && (play->csCtx.currentCsIndex == 1)) { + if ((play->csCtx.state != 0) && (play->sceneId == SCENE_OKUJOU) && (play->csCtx.currentCsIndex == 1)) { DmChar02_PlaySfxForDroppingOcarinaCutscene(this, play); } } diff --git a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c index 44e5732ad..5b6613813 100644 --- a/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c +++ b/src/overlays/actors/ovl_Dm_Char05/z_dm_char05.c @@ -544,20 +544,20 @@ void func_80AAD4A8(DmChar05* this, PlayState* play) { } } } else if (DMCHAR05_GET(&this->actor) == DMCHAR05_3) { - if (play->sceneNum == SCENE_OKUJOU) { - if (gSaveContext.sceneSetupIndex == 2) { + if (play->sceneId == SCENE_OKUJOU) { + if (gSaveContext.sceneLayer == 2) { if (play->csCtx.currentCsIndex == 0) { func_80AAD3F8(this, play); } else if (play->csCtx.currentCsIndex == 1) { func_80AAD450(this, play); } } - } else if (play->sceneNum == SCENE_SPOT00) { - if (gSaveContext.sceneSetupIndex == 9) { + } else if (play->sceneId == SCENE_SPOT00) { + if (gSaveContext.sceneLayer == 9) { if ((play->csCtx.currentCsIndex == 0) && (play->csCtx.frames == 255)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER); } - } else if ((gSaveContext.sceneSetupIndex == 0xB) && (play->csCtx.frames == 115)) { + } else if ((gSaveContext.sceneLayer == 0xB) && (play->csCtx.frames == 115)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER_PREDEMO); } } diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c index b51f4df8d..1ed25ede2 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -183,7 +183,7 @@ void func_80C248A8(DmGm* this, PlayState* play) { this->unk_2AE |= 1; this->actor.draw = func_80C25000; - if ((play->sceneNum == SCENE_YADOYA) && (play->curSpawn == 4)) { + if ((play->sceneId == SCENE_YADOYA) && (play->curSpawn == 4)) { this->unk_2B4 = func_80C24838(play); func_80C24428(this, play, 1); this->actionFunc = func_80C24BD0; diff --git a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c index 4e3915af0..7a4142971 100644 --- a/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c +++ b/src/overlays/actors/ovl_Dm_Opstage/z_dm_opstage.c @@ -95,7 +95,7 @@ void DmOpstage_Update(Actor* thisx, PlayState* play) { DmOpstage* this = THIS; this->actionFunc(this, play); - if ((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.frames == 480)) { + if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 0) && (play->csCtx.frames == 480)) { // This actor is responsible for playing the fairy sound during the exposition in the intro, // during the transition to Lost Woods, before Ocarina gets stolen. func_8019F128(NA_SE_EV_NAVY_FLY_REBIRTH); diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index f149a97d6..2be56dda3 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -670,7 +670,7 @@ void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, PlayState* play) { void DmStk_PlaySfxForEndingCutsceneFirstPart(DmStk* this, PlayState* play) { switch (play->csCtx.frames) { case 5: - func_801A4A28(12); + Audio_PlayAmbience(AMBIENCE_ID_0C); break; case 660: @@ -688,7 +688,7 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) { switch (play->csCtx.frames) { case 5: - func_801A4A28(12); + Audio_PlayAmbience(AMBIENCE_ID_0C); break; case 45: @@ -917,25 +917,25 @@ void DmStk_PlaySfxForMoonWarpCutsceneVersion2(DmStk* this, PlayState* play) { */ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { if (play->csCtx.state != 0) { - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_LOST_WOODS: - if (gSaveContext.sceneSetupIndex == 1) { + if (gSaveContext.sceneLayer == 1) { DmStk_PlaySfxForIntroCutsceneFirstPart(this, play); - } else if (gSaveContext.sceneSetupIndex == 0) { + } else if (gSaveContext.sceneLayer == 0) { DmStk_PlaySfxForIntroCutsceneSecondPart(this, play); - } else if ((gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0)) { + } else if ((gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) { DmStk_PlaySfxForObtainingMajorasMaskCutscene(this, play); } break; case SCENE_CLOCKTOWER: - if (gSaveContext.sceneSetupIndex == 1) { + if (gSaveContext.sceneLayer == 1) { DmStk_PlaySfxForTitleCutscene(this, play); } break; case SCENE_OPENINGDAN: - if (gSaveContext.sceneSetupIndex == 0) { + if (gSaveContext.sceneLayer == 0) { if (play->csCtx.currentCsIndex == 0) { DmStk_PlaySfxForCurseCutsceneFirstPart(this, play); } else if (play->csCtx.currentCsIndex == 1) { @@ -945,7 +945,7 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { break; case SCENE_OKUJOU: - if (gSaveContext.sceneSetupIndex == 0) { + if (gSaveContext.sceneLayer == 0) { if (play->csCtx.currentCsIndex == 0) { DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(this, play); } else if (play->csCtx.currentCsIndex == 1) { @@ -955,7 +955,7 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { } else if (play->csCtx.currentCsIndex == 3) { DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(this, play); } - } else if (gSaveContext.sceneSetupIndex == 2) { + } else if (gSaveContext.sceneLayer == 2) { if (play->csCtx.currentCsIndex == 0) { DmStk_PlaySfxForMoonWarpCutsceneVersion1(this, play); } else if (play->csCtx.currentCsIndex == 1) { @@ -965,13 +965,13 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) { break; case SCENE_00KEIKOKU: - if (gSaveContext.sceneSetupIndex == 3) { + if (gSaveContext.sceneLayer == 3) { if (play->csCtx.currentCsIndex == 0) { DmStk_PlaySfxForShiveringInRainCutscene(this, play); } else if (play->csCtx.currentCsIndex == 2) { DmStk_PlaySfxForPlayingWithFairiesCutscene(this, play); } - } else if (gSaveContext.sceneSetupIndex == 7) { + } else if (gSaveContext.sceneLayer == 7) { if (play->csCtx.currentCsIndex == 0) { DmStk_PlaySfxForEndingCutsceneFirstPart(this, play); } else if (play->csCtx.currentCsIndex == 1) { @@ -1028,13 +1028,13 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->fogG = play->lightCtx.unk8; this->fogB = play->lightCtx.unk9; - if ((play->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) { + if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneLayer == 1)) { this->alpha = 0; this->fogN = 0; this->fogF = 1000; this->fogScale = 1.0f; this->actionFunc = DmStk_DoNothing; - } else if (play->sceneNum == SCENE_OKUJOU) { + } else if (play->sceneId == SCENE_OKUJOU) { this->alpha = 255; this->fogN = 996; this->fogF = 1000; @@ -1044,7 +1044,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); if (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_ROOFTOP, 0)) { - if (gSaveContext.sceneSetupIndex == 0) { + if (gSaveContext.sceneLayer == 0) { if (gSaveContext.timerStates[TIMER_ID_MOON_CRASH] == TIMER_STATE_OFF) { // Starts a 5 minute (300 second) timer until the moon falls. Interface_StartTimer(TIMER_ID_MOON_CRASH, 300); @@ -1060,7 +1060,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->actionFunc = DmStk_ClockTower_StartIntroCutsceneVersion2; } - } else if (gSaveContext.sceneSetupIndex == 3) { + } else if (gSaveContext.sceneLayer == 3) { this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED; if (gSaveContext.timerStates[TIMER_ID_MOON_CRASH] == TIMER_STATE_OFF) { // This code is called when the Giants fail to stop the moon. @@ -1088,7 +1088,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - } else if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 0)) { + } else if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 0)) { if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) { Actor_MarkForDeath(&this->actor); } @@ -1101,7 +1101,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->animIndex = SK_ANIM_BENT_OVER_HEAD_TWITCH; this->actionFunc = DmStk_WaitForTelescope; } else { - if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { + if ((play->sceneId == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { Actor_MarkForDeath(&this->actor); } @@ -1127,8 +1127,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); - if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && - (play->csCtx.currentCsIndex > 0)) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 3) && (play->csCtx.currentCsIndex > 0)) { play->envCtx.unk_17 = 15; play->envCtx.unk_18 = 15; } @@ -1316,7 +1315,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { if (play->csCtx.frames == play->csCtx.actorActions[actorActionIndex]->startFrame) { if (this->csAction != play->csCtx.actorActions[actorActionIndex]->action) { this->csAction = play->csCtx.actorActions[actorActionIndex]->action; - if (play->sceneNum == SCENE_CLOCKTOWER) { + if (play->sceneId == SCENE_CLOCKTOWER) { this->handType = SK_HAND_TYPE_HOLDING_FLUTE; } else { this->handType = SK_HAND_TYPE_DEFAULT; @@ -1685,7 +1684,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) { this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK; } else if (((this->animIndex >= SK_ANIM_HUDDLE_WITH_FAIRIES) && (this->animIndex <= SK_ANIM_DRAW)) || ((this->animIndex >= SK_ANIM_PLAY_FLUTE) && (this->animIndex <= SK_ANIM_CARTWHEEL)) || - ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7))) { + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 7))) { this->maskType = SK_MASK_TYPE_NO_MASK; if ((this->animIndex == SK_ANIM_HOLD_UP_MASK_START) || (this->animIndex == SK_ANIM_HOLD_UP_MASK_LOOP)) { this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK_AND_FLUTE; @@ -1777,7 +1776,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if (play->sceneNum == SCENE_OKUJOU) { + if (play->sceneId == SCENE_OKUJOU) { DmStk_UpdateCollision(this, play); } @@ -1824,8 +1823,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { } } - if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && - (play->csCtx.currentCsIndex > 0)) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 3) && (play->csCtx.currentCsIndex > 0)) { play->envCtx.unk_17 = 15; play->envCtx.unk_18 = 15; } @@ -1888,7 +1886,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot break; case SK_MASK_TYPE_NORMAL: - if ((play->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1) && + if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneLayer == 1) && (play->csCtx.frames < 1400)) { if (this->fogN == this->fogF) { this->fogF = this->fogN; @@ -1950,7 +1948,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot case SK_HAND_TYPE_HOLDING_OCARINA: gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaHoldingRightHand); - if ((play->sceneNum == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) { + if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneLayer == 1)) { gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaOfTimeDL); } break; @@ -1988,7 +1986,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot break; case SK_HAND_TYPE_HOLDING_OCARINA: - if ((play->sceneNum != SCENE_LOST_WOODS) || (gSaveContext.sceneSetupIndex != 1)) { + if ((play->sceneId != SCENE_LOST_WOODS) || (gSaveContext.sceneLayer != 1)) { gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaOfTimeDL); } gSPDisplayList(POLY_OPA_DISP++, gSkullKidTwoFingersExtendedLeftHand); diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 20378cc7b..992f52d79 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -5,6 +5,7 @@ */ #include "z_door_shutter.h" +#include "z64quake.h" #include "z64rumble.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_bdoor/object_bdoor.h" @@ -100,7 +101,7 @@ static InitChainEntry sInitChain[] = { }; typedef struct { - /* 0x00 */ s16 sceneNum; + /* 0x00 */ s16 sceneId; /* 0x02 */ u8 index; } ShutterSceneInfo; // size = 0x4 @@ -114,8 +115,8 @@ ShutterSceneInfo D_808A2258[] = { }; typedef struct { - /* 0x00 */ s16 dungeonScene; - /* 0x02 */ s16 bossScene; + /* 0x00 */ s16 dungeonSceneId; + /* 0x02 */ s16 bossSceneId; /* 0x04 */ u8 index; } BossDoorInfo; // size = 0x6 @@ -209,7 +210,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) { ShutterSceneInfo* shutterSceneInfo = &D_808A2258[0]; for (i = 0; i < ARRAY_COUNT(D_808A2258) - 1; i++, shutterSceneInfo++) { - if (play->sceneNum == shutterSceneInfo->sceneNum) { + if (play->sceneId == shutterSceneInfo->sceneId) { break; } } @@ -222,7 +223,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) { BossDoorInfo* bossDoorInfo = &D_808A22A0[0]; for (i = 0; i < ARRAY_COUNT(D_808A22A0) - 1; i++, bossDoorInfo++) { - if ((play->sceneNum == bossDoorInfo->dungeonScene) || (play->sceneNum == bossDoorInfo->bossScene)) { + if ((play->sceneId == bossDoorInfo->dungeonSceneId) || (play->sceneId == bossDoorInfo->bossSceneId)) { break; } } @@ -537,7 +538,7 @@ void func_808A1784(DoorShutter* this, PlayState* play) { } else { DoorShutter_SetupAction(this, func_808A1090); } - func_801A2ED8(); + Audio_RestorePrevBgm(); } } @@ -599,7 +600,7 @@ s32 func_808A1A70(DoorShutter* this) { } void func_808A1B48(DoorShutter* this, PlayState* play) { - s16 quake; + s16 quakeIndex; if (func_808A1A70(this)) { if (this->actor.velocity.y > 20.0f) { @@ -607,11 +608,14 @@ void func_808A1B48(DoorShutter* this, PlayState* play) { Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 45.0f, 10, 8.0f, 500, 10, 0); } Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BIGWALL_BOUND); - quake = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3); - Quake_SetSpeed(quake, -32536); - Quake_SetQuakeValues(quake, 2, 0, 0, 0); - Quake_SetCountdown(quake, 10); + + quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); + Quake_SetSpeed(quakeIndex, -32536); + Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 10); + Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); + func_808A1884(this, play); } } diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index 93cd492e6..be9b5c093 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -54,7 +54,7 @@ typedef struct { // Maps scenes to SpiralObjectType typedef struct { - /* 0x00 */ s16 sceneNum; + /* 0x00 */ s16 sceneId; /* 0x02 */ u8 objectType; } SpiralSceneInfo; @@ -147,7 +147,7 @@ s32 DoorSpiral_GetObjectType(PlayState* play) { s32 type; for (i = 0; i < ARRAY_COUNT(spiralSceneInfo); sceneInfo++, i++) { - if (play->sceneNum == sceneInfo->sceneNum) { + if (play->sceneId == sceneInfo->sceneId) { break; } } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index ba1c846b9..03531bb31 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -75,13 +75,13 @@ void DoorWarp1_SetupAction(DoorWarp1* this, DoorWarp1ActionFunc actionFunc) { s32 func_808B849C(DoorWarp1* this, PlayState* play) { s32 ret = 0; - if ((play->sceneNum == SCENE_MITURIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA)) { + if ((play->sceneId == SCENE_MITURIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA)) { ret = 1; - } else if ((play->sceneNum == SCENE_HAKUGIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT)) { + } else if ((play->sceneId == SCENE_HAKUGIN_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT)) { ret = 2; - } else if ((play->sceneNum == SCENE_SEA_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG)) { + } else if ((play->sceneId == SCENE_SEA_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG)) { ret = 3; - } else if ((play->sceneNum == SCENE_INISIE_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { + } else if ((play->sceneId == SCENE_INISIE_BS) && !CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { ret = 4; } return ret; @@ -161,8 +161,8 @@ void DoorWarp1_Init(Actor* thisx, PlayState* play) { break; } - if ((play->sceneNum == SCENE_MITURIN_BS) || (play->sceneNum == SCENE_HAKUGIN_BS) || - (play->sceneNum == SCENE_INISIE_BS) || (play->sceneNum == SCENE_SEA_BS)) { + if ((play->sceneId == SCENE_MITURIN_BS) || (play->sceneId == SCENE_HAKUGIN_BS) || + (play->sceneId == SCENE_INISIE_BS) || (play->sceneId == SCENE_SEA_BS)) { func_800FE484(); play->interfaceCtx.restrictions.unk_312 = 1; play->interfaceCtx.restrictions.songOfSoaring = 1; @@ -268,7 +268,7 @@ void func_808B8E78(DoorWarp1* this, PlayState* play) { this->unk_1A8 = 0.0f; this->unk_1AC = 0.0f; this->unk_1A4 = 700.0f; - if (play->sceneNum == SCENE_INISIE_N) { + if (play->sceneId == SCENE_INISIE_N) { DoorWarp1_SetupAction(this, func_808B96A0); } else if (gSaveContext.save.weekEventReg[86] & 0x80) { this->unk_1D4 = 0; @@ -307,12 +307,12 @@ void func_808B90CC(DoorWarp1* this, PlayState* play) { s16 sp2E = 0; f32 phi_f0 = 0.0f; - if (play->sceneNum == SCENE_MITURIN) { + if (play->sceneId == SCENE_MITURIN) { sp2E = -10; phi_f0 = -5.0f; - } else if (play->sceneNum == SCENE_HAKUGIN) { + } else if (play->sceneId == SCENE_HAKUGIN) { sp2E = -20; - } else if (play->sceneNum == SCENE_SEA) { + } else if (play->sceneId == SCENE_SEA) { sp2E = -20; } @@ -551,7 +551,7 @@ void func_808B9CE8(DoorWarp1* this, PlayState* play) { return; } - switch (play->sceneNum) { + switch (play->sceneId) { case SCENE_MITURIN_BS: gSaveContext.save.unk_ECC[0] = (((void)0, gSaveContext.save.unk_ECC[0]) & 0xFFFFFF00) | (((u8)gSaveContext.save.unk_ECC[1]) & 0xFF); @@ -635,16 +635,16 @@ void func_808BA10C(DoorWarp1* this, PlayState* play) { u8 phi_a0; s32 phi_v0_3; - if ((play->sceneNum == SCENE_MITURIN_BS) || (play->sceneNum == SCENE_HAKUGIN_BS) || - (play->sceneNum == SCENE_INISIE_BS) || (play->sceneNum == SCENE_SEA_BS)) { - D_801F4DE2 = play->sceneNum; - if (play->sceneNum == SCENE_MITURIN_BS) { + if ((play->sceneId == SCENE_MITURIN_BS) || (play->sceneId == SCENE_HAKUGIN_BS) || + (play->sceneId == SCENE_INISIE_BS) || (play->sceneId == SCENE_SEA_BS)) { + D_801F4DE2 = play->sceneId; + if (play->sceneId == SCENE_MITURIN_BS) { phi_v0_2 = 0; - } else if (play->sceneNum == SCENE_HAKUGIN_BS) { + } else if (play->sceneId == SCENE_HAKUGIN_BS) { phi_v0_2 = 1; - } else if (play->sceneNum == SCENE_INISIE_BS) { + } else if (play->sceneId == SCENE_INISIE_BS) { phi_v0_2 = 2; - } else if (play->sceneNum == SCENE_SEA_BS) { + } else if (play->sceneId == SCENE_SEA_BS) { phi_v0_2 = 3; } else { phi_v0_2 = 0; @@ -882,7 +882,7 @@ void func_808BAAF4(DoorWarp1* this, PlayState* play) { f32 phi_f2; phi_f2 = 200.0f; - if (play->sceneNum == SCENE_SEA) { + if (play->sceneId == SCENE_SEA) { phi_f2 = 85.0f; } @@ -1039,12 +1039,12 @@ void func_808BB4F4(DoorWarp1* this, PlayState* play2) { return; } - if (play->sceneNum != SCENE_MITURIN) { - if (play->sceneNum == SCENE_HAKUGIN) { + if (play->sceneId != SCENE_MITURIN) { + if (play->sceneId == SCENE_HAKUGIN) { sp60 = 1; - } else if (play->sceneNum == SCENE_SEA) { + } else if (play->sceneId == SCENE_SEA) { sp60 = 2; - } else if (play->sceneNum == SCENE_INISIE_R) { + } else if (play->sceneId == SCENE_INISIE_R) { sp60 = 3; } } diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 88ddcd0f8..ec464815e 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -6,6 +6,7 @@ */ #include "z_en_ani.h" +#include "z64quake.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -209,7 +210,7 @@ void EnAni_LandOnFoot(EnAni* this, PlayState* play) { void EnAni_FallToGround(EnAni* this, PlayState* play) { s32 pad; - s16 quakeValue; + s16 quakeIndex; if (this->actor.bgCheckFlags & 1) { // hit the ground this->actor.flags &= ~ACTOR_FLAG_10; @@ -219,10 +220,12 @@ void EnAni_FallToGround(EnAni* this, PlayState* play) { // the animation gets cut short, (first 16 frames only) only the landing part is seen Animation_Change(&this->skelAnime, &gAniLandingThenStandingUpAnim, 1.0f, 0.0f, 16.0f, ANIMMODE_ONCE, 0.0f); this->stateFlags |= ANI_STATE_WRITHING; - quakeValue = Quake_Add(play->cameraPtrs[CAM_ID_MAIN], 3); - Quake_SetSpeed(quakeValue, 0x6978); - Quake_SetQuakeValues(quakeValue, 7, 0, 0, 0); - Quake_SetCountdown(quakeValue, 0x14); + + quakeIndex = Quake_Add(play->cameraPtrs[CAM_ID_MAIN], QUAKE_TYPE_3); + Quake_SetSpeed(quakeIndex, 27000); + Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 20); + Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_HAMMER_HIT); } diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 33f8225d3..575cf2d35 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -671,7 +671,7 @@ void func_809C2730(EnAob01* this, PlayState* play) { void func_809C2788(EnAob01* this, PlayState* play) { this->unk_2D2 |= 0x20; if (func_809C25E4(this, play)) { - if (func_801A8A50(0) != 0x41) { + if (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_HORSE_GOAL) { play->nextEntrance = ENTRANCE(DOGGY_RACETRACK, 1); gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 3; play->transitionType = TRANS_TYPE_64; diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index 07692dc77..7f6e65cde 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -1426,7 +1426,7 @@ void func_80A97AB4(EnAz* this, PlayState* play) { if (play->msgCtx.choiceIndex == 0) { func_8019F208(); play->msgCtx.msgMode = 0x44; - func_800FD750(NA_BGM_MINI_GAME_2); + func_800FD750(NA_BGM_TIMED_MINI_GAME); func_80A94AB8(this, play, 1); func_80A979DC(this, play); } else { @@ -1466,7 +1466,7 @@ void func_80A97C4C(EnAz* this, PlayState* play) { func_80A97410(this, play); if ((this->unk_2FA == 1) || (this->unk_2FA == 3) || (this->unk_2FA == 6) || (this->unk_2FA == 8)) { gSaveContext.save.weekEventReg[24] &= (u8)~1; - func_800FD750(NA_BGM_MINI_GAME_2); + func_800FD750(NA_BGM_TIMED_MINI_GAME); play->nextEntrance = Entrance_CreateFromSpawn(1); gSaveContext.nextCutsceneIndex = 0; play->transitionTrigger = TRANS_TRIGGER_START; @@ -1484,7 +1484,7 @@ void func_80A97D5C(EnAz* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20; Interface_InitMinigame(play); gSaveContext.minigameScore = (this->unk_374 & 2) ? 25 : 20; - play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_START_3; + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; if ((this->unk_2FA == 1) || (this->unk_2FA == 3)) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 120); } else if (gSaveContext.save.weekEventReg[25] & 1) { diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index 4d783942d..dcbbee65d 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -503,12 +503,12 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { this->stateFlags |= BOMB_SHOP_LADY_STATE_DRAW_SHADOW; this->actor.flags |= ACTOR_FLAG_1; - if (play->sceneNum == SCENE_BOMYA) { + if (play->sceneId == SCENE_BOMYA) { this->stateFlags |= BOMB_SHOP_LADY_STATE_VISIBLE; this->animIndex = BOMB_SHOP_LADY_ANIM_IDLE; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnBaba_Idle; - } else if (play->sceneNum == SCENE_BACKTOWN) { + } else if (play->sceneId == SCENE_BACKTOWN) { if ((BOMB_SHOP_LADY_GET_TYPE(&this->actor) == BOMB_SHOP_LADY_TYPE_FOLLOW_SCHEDULE) && (gSaveContext.save.entrance != ENTRANCE(NORTH_CLOCK_TOWN, 7)) && (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != 0x3F)) { diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index fe1eb9fd8..5bec14e3e 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -178,7 +178,7 @@ void EnBat_Destroy(Actor* thisx, PlayState* play) { } s32 EnBat_IsGraveyardOnSecondDay(PlayState* play) { - if ((CURRENT_DAY == 2) && (play->sceneNum == SCENE_BOTI)) { + if ((CURRENT_DAY == 2) && (play->sceneId == SCENE_BOTI)) { return true; } else { return false; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 4f8f28f3c..ba7273f59 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -485,7 +485,7 @@ s32 EnBigokuta_IsNearSwampBoat(EnBigokuta* this, PlayState* play) { void EnBigokuta_CheckOneHitKill(EnBigokuta* this, PlayState* play) { if ((this->bodyCollider.base.acFlags & AC_ON) && ((this->bodyCollider.base.acFlags & AC_HIT) || - ((play->sceneNum == SCENE_20SICHITAI || play->sceneNum == SCENE_20SICHITAI2) && + ((play->sceneId == SCENE_20SICHITAI || play->sceneId == SCENE_20SICHITAI2) && EnBigokuta_IsNearSwampBoat(this, play)))) { Enemy_StartFinishingBlow(play, &this->picto.actor); diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c index d24b2df49..bf6e46e36 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c @@ -5,6 +5,7 @@ */ #include "z_en_bigpamet.h" +#include "z64quake.h" #include "z64rumble.h" #include "overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -518,7 +519,7 @@ void func_80A28760(EnBigpamet* this) { } void func_80A287E8(EnBigpamet* this, PlayState* play) { - s16 quake; + s16 quakeIndex; this->actor.shape.rot.y += 0x3B00; func_800B9010(&this->actor, NA_SE_EN_B_PAMET_ROLL - SFX_FLAG); @@ -538,12 +539,16 @@ void func_80A287E8(EnBigpamet* this, PlayState* play) { } if (this->actor.bgCheckFlags & 8) { - quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + this->actor.velocity.y = this->unk_29E * 0.375f; - Quake_SetSpeed(quake, 0x4E20); - Quake_SetQuakeValues(quake, 15, 0, 0, 0); - Quake_SetCountdown(quake, 10); + + Quake_SetSpeed(quakeIndex, 20000); + Quake_SetQuakeValues(quakeIndex, 15, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 10); + Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); + func_80A27B58(this); func_80A27DD8(this, play); func_80A28970(this); diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 20a868bc6..62e1df422 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -220,7 +220,7 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) { if (thisx->params == ENBIGPO_REGULAR) { // the well poe, starts immediately thisx->flags &= ~ACTOR_FLAG_10; // always update OFF - this->unkBool204 = true; + this->storePrevBgm = true; EnBigpo_InitWellBigpo(this); } else if (thisx->params == ENBIGPO_SUMMONED) { // dampe type EnBigpo_InitDampeMainPo(this); @@ -439,9 +439,9 @@ void EnBigpo_SpawnCutsceneStage6(EnBigpo* this, PlayState* play) { */ void EnBigpo_SpawnCutsceneStage7(EnBigpo* this) { this->idleTimer = 15; - if (this->unkBool204 == false) { - func_801A2E54(NA_BGM_MINI_BOSS); - this->unkBool204 = true; + if (this->storePrevBgm == false) { + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); + this->storePrevBgm = true; } this->actionFunc = EnBigpo_SpawnCutsceneStage8; } @@ -525,9 +525,9 @@ void EnBigpo_WarpingIn(EnBigpo* this, PlayState* play) { this->mainColor.a = this->idleTimer * (255.0f / 32.0f); if (this->idleTimer == 32) { this->mainColor.a = 255; // fully visible - if (this->unkBool204 == false) { - func_801A2E54(NA_BGM_MINI_BOSS); - this->unkBool204 = true; + if (this->storePrevBgm == false) { + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); + this->storePrevBgm = true; } EnBigpo_SetupIdleFlying(this); } @@ -1124,7 +1124,7 @@ s32 EnBigpo_ApplyDamage(EnBigpo* this, PlayState* play) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DEAD); Enemy_StartFinishingBlow(play, &this->actor); if (this->actor.params == ENBIGPO_SUMMONED) { // dampe type - func_801A2ED8(); + Audio_RestorePrevBgm(); } } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DAMAGE); diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h index 9117bd97c..9b84784f4 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h @@ -30,7 +30,7 @@ typedef struct EnBigpo { /* 0x188 */ Vec3s jointTable[ENBIGPO_LIMBCOUNT]; /* 0x1C4 */ Vec3s morphTable[ENBIGPO_LIMBCOUNT]; /* 0x200 */ EnBigPoActionFunc actionFunc; - /* 0x204 */ u8 unkBool204; // need to know what func_801A2E54 does to know what this is + /* 0x204 */ u8 storePrevBgm; /* 0x206 */ s16 idleTimer; // frame counter /* 0x208 */ s16 unk208; // facing rotY? /* 0x20A */ s16 rotVelocity; diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 6cc0b2e72..e56997051 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -5,6 +5,7 @@ */ #include "z_en_bigslime.h" +#include "z64quake.h" #include "z64rumble.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "objects/object_bigslime/object_bigslime.h" @@ -743,12 +744,14 @@ void EnBigslime_EndThrowMinislime(EnBigslime* this) { void EnBigslime_BreakIntoMinislime(EnBigslime* this, PlayState* play) { s32 i; - s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + + Quake_SetSpeed(quakeIndex, 20000); + Quake_SetQuakeValues(quakeIndex, 15, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 15); - Quake_SetSpeed(quake, 20000); - Quake_SetQuakeValues(quake, 15, 0, 0, 0); - Quake_SetCountdown(quake, 15); Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); + this->bigslimeCollider[0].base.atFlags &= ~AT_ON; this->gekkoCollider.base.acFlags &= ~(AC_ON | AC_HIT); @@ -1005,7 +1008,7 @@ void EnBigslime_CallMinislime(EnBigslime* this, PlayState* play) { } else if (this->isAnimUpdate) { Animation_PlayLoop(&this->skelAnime, &gGekkoNervousIdleAnim); EnBigslime_UpdateCameraIntroCs(this, play, 25); - func_801A2E54(0x38); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); EnBigslime_InitFallMinislime(this); play->envCtx.lightSettingOverride = 0xFF; this->callTimer = 35; @@ -2620,7 +2623,7 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, PlayState* play) { if (this->actor.colChkInfo.damageEffect != BIGSLIME_DMGEFF_HOOKSHOT) { if (Actor_ApplyDamage(&this->actor) == 0) { func_800BE504(&this->actor, &this->gekkoCollider); - func_801A2ED8(); + Audio_RestorePrevBgm(); Enemy_StartFinishingBlow(play, &this->actor); this->gekkoCollider.base.acFlags &= ~AC_ON; EnBigslime_GekkoThaw(this, play); diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index 87d6f186c..0408616bb 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -691,7 +691,7 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { gSaveContext.save.bombersCaughtNum++; if (gSaveContext.save.bombersCaughtNum > 4) { - func_801A3098(0x922); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } else { Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART); } diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 10c28b6eb..bc33adc0c 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -482,7 +482,7 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, -1); - func_801A3098(0x2B | 0x900); + Audio_PlayFanfare(NA_BGM_OPEN_CHEST | 0x900); } if (this->getItemId == GI_STRAY_FAIRY) { diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 31e326409..6abf4da13 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -176,7 +176,7 @@ s32 func_80B3E5DC(EnDai* this, s32 arg1) { s32 func_80B3E69C(EnDai* this, PlayState* play) { s32 ret = false; - if ((play->csCtx.state != 0) && (play->sceneNum == SCENE_12HAKUGINMAE) && (play->csCtx.currentCsIndex == 0) && + if ((play->csCtx.state != 0) && (play->sceneId == SCENE_12HAKUGINMAE) && (play->csCtx.currentCsIndex == 0) && !(gSaveContext.save.weekEventReg[30] & 1)) { if (!(this->unk_1CE & 0x10)) { Flags_SetSwitch(play, 20); diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index ef93a501a..de2c586e9 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -335,11 +335,11 @@ void EnDg_MoveAlongPath(EnDg* this, PlayState* play) { } if ((this->index == ENDG_INDEX_SWAMP_SPIDER_HOUSE) || - ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneNum == SCENE_OMOYA))) { + ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneId == SCENE_OMOYA))) { Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); } else if (this->index == ENDG_INDEX_ROMANI_RANCH) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); - } else if (play->sceneNum == SCENE_CLOCKTOWER) { + } else if (play->sceneId == SCENE_CLOCKTOWER) { Math_ApproachF(&this->actor.speedXZ, 3.5f, 0.2f, 1.0f); } else if (sRacetrackDogInfo[this->index].textId & 0x11) { Math_ApproachF(&this->actor.speedXZ, 1.0f, 0.2f, 1.0f); @@ -397,11 +397,11 @@ void EnDg_PlaySfxGrowl(EnDg* this, f32 frame) { void EnDg_SetupIdleMove(EnDg* this, PlayState* play) { if (!(this->actor.bgCheckFlags & 0x20)) { if ((this->index == ENDG_INDEX_SWAMP_SPIDER_HOUSE) || - ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneNum == SCENE_OMOYA))) { + ((this->index == ENDG_INDEX_ROMANI_RANCH) && (play->sceneId == SCENE_OMOYA))) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); } else if (this->index == ENDG_INDEX_ROMANI_RANCH) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); - } else if (play->sceneNum == SCENE_CLOCKTOWER) { + } else if (play->sceneId == SCENE_CLOCKTOWER) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_RUN); } else if (sRacetrackDogInfo[this->index].textId & 0x11) { EnDg_ChangeAnim(&this->skelAnime, sAnimationInfo, DOG_ANIM_WALK); @@ -1319,7 +1319,7 @@ void EnDg_Init(Actor* thisx, PlayState* play) { this->index = ENDG_GET_INDEX(&this->actor); this->behavior = DOG_BEHAVIOR_INITIAL; this->grabState = DOG_GRAB_STATE_NONE; - if (play->sceneNum == SCENE_F01_B) { + if (play->sceneId == SCENE_F01_B) { this->sitAfterThrowTimer = 100; EnDg_UpdateTextId(this); } @@ -1340,7 +1340,7 @@ void EnDg_Update(Actor* thisx, PlayState* play) { Vec3f floorRot = { 0.0f, 0.0f, 0.0f }; this->selectedDogIndex = sSelectedRacetrackDogInfo.index; - if (!(player->stateFlags1 & 0x20) || (play->sceneNum != SCENE_CLOCKTOWER)) { + if (!(player->stateFlags1 & 0x20) || (play->sceneId != SCENE_CLOCKTOWER)) { if (EnDg_ShouldReactToNonHumanPlayer(this, play)) { EnDg_ChooseActionForForm(this, play); } else if (this->behavior != DOG_BEHAVIOR_DEFAULT) { diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 65c11e035..bf2f5e7ce 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -511,7 +511,7 @@ void func_8089B3D4(EnDinofos* this, PlayState* play) { Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); this->unk_290++; if (this->unk_290 == 10) { - func_801A2E54(NA_BGM_MINI_BOSS); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); } subCamAt.x = this->actor.world.pos.x; @@ -530,7 +530,7 @@ void func_8089B3D4(EnDinofos* this, PlayState* play) { void func_8089B4A4(EnDinofos* this) { if (this->unk_290 < 10) { - func_801A2E54(NA_BGM_MINI_BOSS); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); } Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_00C974); this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.x; @@ -551,7 +551,7 @@ void func_8089B580(EnDinofos* this, PlayState* play) { } if (this->skelAnime.curFrame > 35.0f) { - if ((play->sceneNum == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 38.0f)) { + if ((play->sceneId == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 38.0f)) { play->envCtx.lightSettingOverride = 11; } @@ -562,7 +562,7 @@ void func_8089B580(EnDinofos* this, PlayState* play) { } } - if ((play->sceneNum == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 55.0f)) { + if ((play->sceneId == SCENE_MITURIN) && Animation_OnFrame(&this->skelAnime, 55.0f)) { play->envCtx.lightSettingOverride = 0xFF; } @@ -1053,7 +1053,7 @@ void func_8089CB10(EnDinofos* this, PlayState* play) { worldSphere->center.z = this->limbPos[10].z; } - if (play->sceneNum == SCENE_MITURIN) { + if (play->sceneId == SCENE_MITURIN) { play->envCtx.lightSettingOverride = 11; } @@ -1114,7 +1114,7 @@ void func_8089CBEC(EnDinofos* this, PlayState* play) { void func_8089CF00(EnDinofos* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &object_dinofos_Anim_0017B8); this->colliderJntSph.base.atFlags &= ~AT_ON; - if (play->sceneNum == SCENE_MITURIN) { + if (play->sceneId == SCENE_MITURIN) { play->envCtx.lightSettingOverride = 255; } this->actionFunc = func_8089CF70; @@ -1279,13 +1279,13 @@ s32 func_8089D60C(EnDinofos* this, PlayState* play) { } if (this->actor.cutscene != -1) { - func_801A2ED8(); + Audio_RestorePrevBgm(); } } func_8089ACEC(this, play); func_8089AD70(this); - if (play->sceneNum == SCENE_MITURIN) { + if (play->sceneId == SCENE_MITURIN) { play->envCtx.lightSettingOverride = 255; } diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c index 7afd4e224..50a027efa 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -447,8 +447,8 @@ void func_80A52074(EnDnk* this, PlayState* play) { } void func_80A52134(EnDnk* this, PlayState* play) { - if ((play->csCtx.state != 0) && (ENDNK_GET_3C(&this->actor) == 4) && (play->sceneNum == SCENE_SPOT00) && - (gSaveContext.sceneSetupIndex == 2)) { + if ((play->csCtx.state != 0) && (ENDNK_GET_3C(&this->actor) == 4) && (play->sceneId == SCENE_SPOT00) && + (gSaveContext.sceneLayer == 2)) { func_80A52074(this, play); } } diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index 9b421dfd4..685c3a511 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -11,7 +11,6 @@ #include "z_en_dno.h" #include "overlays/actors/ovl_Bg_Crace_Movebg/z_bg_crace_movebg.h" #include "objects/gameplay_keep/gameplay_keep.h" -#include "objects/object_dnj/object_dnj.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -44,17 +43,50 @@ void func_80A732C8(EnDno* this, PlayState* play); s32 EnDno_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); +typedef enum { + /* 0 */ EN_DNO_ANIM_START_RACE_START, + /* 1 */ EN_DNO_ANIM_START_RACE_END, + /* 2 */ EN_DNO_ANIM_FLY, + /* 3 */ EN_DNO_ANIM_FAREWELL, + /* 4 */ EN_DNO_ANIM_GREETING, + /* 5 */ EN_DNO_ANIM_GREETING_WITH_CANDLE, + /* 6 */ EN_DNO_ANIM_PRAYER_LOOP, + /* 7 */ EN_DNO_ANIM_CLOSE_PARASOL, + /* 8 */ EN_DNO_ANIM_OPEN_PARASOL, + /* 9 */ EN_DNO_ANIM_IMPLORE_LOOP, + /* 10 */ EN_DNO_ANIM_IMPLORE_END, + /* 11 */ EN_DNO_ANIM_TALK, + /* 12 */ EN_DNO_ANIM_TALK_WITH_PARSOL_AND_CANDLE, + /* 13 */ EN_DNO_ANIM_IDLE, + /* 14 */ EN_DNO_ANIM_IDLE_WITH_CANDLE, + /* 15 */ EN_DNO_ANIM_PRAYER_START, + /* 16 */ EN_DNO_ANIM_IMPLORE_START, + /* 17 */ EN_DNO_ANIM_SHOCK_START, + /* 18 */ EN_DNO_ANIM_SHOCK_LOOP, + /* 19 */ EN_DNO_ANIM_GRIEVE, +} EnDnoAnimation; + static AnimationSpeedInfo sAnimations[] = { - { &object_dnj_Anim_000470, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dnj_Anim_0008F0, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dnj_Anim_000F6C, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dnj_Anim_001A50, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dnj_Anim_002530, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dnj_Anim_003320, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dnj_Anim_0036D0, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dnj_Anim_0041CC, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dnj_Anim_004DD8, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dnj_Anim_005F98, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_dnj_Anim_006488, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dnj_Anim_0073E4, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_dnj_Anim_0077A8, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dnj_Anim_007CA4, 1.0f, ANIMMODE_LOOP, 0.0f }, - { &object_dnj_Anim_008324, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dnj_Anim_008AE4, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dnj_Anim_009100, 1.0f, ANIMMODE_ONCE, 0.0f }, { &object_dnj_Anim_0051E4, 1.0f, ANIMMODE_ONCE, 0.0f }, - { &object_dnj_Anim_005E20, 1.0f, ANIMMODE_LOOP, 0.0f }, { &object_dnj_Anim_006F84, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gDekuButlerStartRaceStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerStartRaceEndAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerFlyAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gDekuButlerFarewellAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerGreetingAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerGreetingWithCandleAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerPrayerLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gDekuButlerCloseParasolAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerOpenParasolAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerImploreLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gDekuButlerImploreEndAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerTalkAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gDekuButlerTalkWithParasolAndCandleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gDekuButlerIdleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gDekuButlerIdleWithCandleAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gDekuButlerPrayerStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerImploreStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerShockStartAnim, 1.0f, ANIMMODE_ONCE, 0.0f }, + { &gDekuButlerShockLoopAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gDekuButlerGrieveAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, }; const ActorInit En_Dno_InitVars = { @@ -122,8 +154,8 @@ void func_80A714B4(EnDno* this, PlayState* play) { do { actor = SubS_FindActor(play, actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); if (actor != NULL) { - if (ENDNO_GET_F(actor) == ENDNO_GET_F_1) { - Flags_SetSwitch(play, ENDNO_GET_7F0(actor)); + if (BG_CRACE_MOVEBG_GET_TYPE(actor) == BG_CRACE_MOVEBG_TYPE_OPENING) { + Flags_SetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(actor)); } actor = actor->next; } @@ -152,14 +184,15 @@ void func_80A715DC(EnDno* this, PlayState* play) { do { crace = (BgCraceMovebg*)SubS_FindActor(play, &crace->dyna.actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); if (crace != NULL) { - if (ENDNO_GET_F(&crace->dyna.actor) == ENDNO_GET_F_0 && !(crace->unk170 & 1)) { + if (BG_CRACE_MOVEBG_GET_TYPE(&crace->dyna.actor) == BG_CRACE_MOVEBG_TYPE_CLOSING && + !(crace->stateFlags & BG_CRACE_MOVEBG_FLAG_BUTLER_IS_BEYOND_DOOR)) { if (SubS_LineSegVsPlane(&crace->dyna.actor.home.pos, &crace->dyna.actor.home.rot, &D_80A73B2C, &this->actor.prevPos, &this->actor.world.pos, &sp88)) { Math_Vec3f_Diff(&this->actor.world.pos, &crace->dyna.actor.home.pos, &sp7C); Matrix_RotateYS(-crace->dyna.actor.home.rot.y, MTXMODE_NEW); Matrix_MultVec3f(&sp7C, &sp70); if ((fabsf(sp70.x) < 100.0f) && (sp70.y >= -10.0f) && (sp70.y <= 180.0f) && (sp70.z < 0.0f)) { - crace->unk170 |= 1; + crace->stateFlags |= BG_CRACE_MOVEBG_FLAG_BUTLER_IS_BEYOND_DOOR; } } } @@ -174,7 +207,7 @@ void func_80A71788(EnDno* this, PlayState* play) { do { actor = SubS_FindActor(play, actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG); if (actor != NULL) { - Flags_UnsetSwitch(play, ENDNO_GET_7F0(actor)); + Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(actor)); actor = actor->next; } } while (actor != NULL); @@ -198,27 +231,29 @@ void EnDno_Init(Actor* thisx, PlayState* play) { if (actor == NULL) { Actor_ProcessInitChain(thisx, sInitChain); ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 21.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_dnj_Skel_00E1F8, &object_dnj_Anim_007CA4, - this->jointTable, this->morphTable, 28); + SkelAnime_InitFlex(play, &this->skelAnime, &gDekuButlerSkel, &gDekuButlerIdleAnim, this->jointTable, + this->morphTable, DEKU_BUTLER_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); Actor_UpdateBgCheckInfo(play, thisx, 0.0f, 0.0f, 0.0f, 4); - Animation_Change(&this->skelAnime, sAnimations[14].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimations[14].animation), sAnimations[14].mode, - sAnimations[14].morphFrames); + Animation_Change(&this->skelAnime, sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].animation, 1.0f, 0.0f, + Animation_GetLastFrame(sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].animation), + sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].mode, + sAnimations[EN_DNO_ANIM_IDLE_WITH_CANDLE].morphFrames); this->unk_3BE = 0x3E93; this->unk_3C0 = 60.0f; this->unk_3B0 = 0; this->unk_468 = 99; this->skelAnime.playSpeed = 0.0f; - switch (ENDNO_GET_C000(thisx)) { - case ENDNO_GET_C000_0: + switch (EN_DNO_GET_C000(thisx)) { + case EN_DNO_GET_C000_0: func_80A71788(this, play); if (!(gSaveContext.save.weekEventReg[23] & 0x20) || (gSaveContext.save.weekEventReg[93] & 2)) { Actor_MarkForDeath(thisx); } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE_WITH_CANDLE, + &this->animIndex); thisx->room = -1; gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); @@ -228,11 +263,12 @@ void EnDno_Init(Actor* thisx, PlayState* play) { } break; - case ENDNO_GET_C000_1: + case EN_DNO_GET_C000_1: if (gSaveContext.save.weekEventReg[23] & 0x20) { Actor_MarkForDeath(thisx); } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, + &this->animIndex); this->unk_460 = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_DNQ); if (this->unk_460 == NULL) { Actor_MarkForDeath(thisx); @@ -260,7 +296,7 @@ void EnDno_Destroy(Actor* thisx, PlayState* play) { void func_80A71B04(EnDno* this, PlayState* play) { this->unk_452 = 0; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 19, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_GRIEVE, &this->animIndex); this->actionFunc = EnDno_DoNothing; } @@ -273,54 +309,57 @@ void func_80A71B68(EnDno* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_SONG_SONATA)) { if (gSaveContext.save.weekEventReg[27] & 1) { if (!(this->unk_3B0 & 0x20)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 6, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_LOOP, + &this->animIndex); this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, this->unk_460); } } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, &this->animIndex); } } else { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, &this->animIndex); } this->actionFunc = func_80A71C3C; } void func_80A71C3C(EnDno* this, PlayState* play) { - switch (this->unk_32C) { - case 9: - case 16: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 10, &this->unk_32C); + switch (this->animIndex) { + case EN_DNO_ANIM_IMPLORE_LOOP: + case EN_DNO_ANIM_IMPLORE_START: + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IMPLORE_END, &this->animIndex); break; - case 3: - case 10: + case EN_DNO_ANIM_FAREWELL: + case EN_DNO_ANIM_IMPLORE_END: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, &this->animIndex); } break; - case 11: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 15, &this->unk_32C); + case EN_DNO_ANIM_TALK: + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_START, &this->animIndex); break; - case 15: + case EN_DNO_ANIM_PRAYER_START: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 6, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_LOOP, + &this->animIndex); } - case 6: + case EN_DNO_ANIM_PRAYER_LOOP: Math_SmoothStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, this->unk_460), 2, 0xE38, 0x222); break; } - if ((this->unk_32C == 13) && (this->actor.xzDistToPlayer <= 120.0f)) { + if ((this->animIndex == EN_DNO_ANIM_IDLE) && (this->actor.xzDistToPlayer <= 120.0f)) { func_80A71424(&this->unk_466, 0, this->actor.yawTowardsPlayer, this->actor.shape.rot.y, 0x2000, 0x16C); } else { Math_ScaledStepToS(&this->unk_466, 0, 0x16C); } - if ((this->unk_32C != 3) && (this->unk_32C != 15) && (this->unk_32C != 6)) { + if ((this->animIndex != EN_DNO_ANIM_FAREWELL) && (this->animIndex != EN_DNO_ANIM_PRAYER_START) && + (this->animIndex != EN_DNO_ANIM_PRAYER_LOOP)) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x222); } @@ -365,7 +404,8 @@ void func_80A71F18(EnDno* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xE38)) { switch (this->textId) { case 0x80B: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 16, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IMPLORE_START, + &this->animIndex); case 0x811: Message_StartTextbox(play, this->textId, &this->actor); @@ -373,10 +413,13 @@ void func_80A71F18(EnDno* this, PlayState* play) { case 0x80C: case 0x80F: - if (this->unk_32C == 13) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 4, &this->unk_32C); - } else if ((this->unk_32C == 4) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 11, &this->unk_32C); + if (this->animIndex == EN_DNO_ANIM_IDLE) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_GREETING, + &this->animIndex); + } else if ((this->animIndex == EN_DNO_ANIM_GREETING) && + (this->skelAnime.curFrame == this->skelAnime.endFrame)) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_TALK, + &this->animIndex); Message_StartTextbox(play, this->textId, &this->actor); } break; @@ -386,19 +429,21 @@ void func_80A71F18(EnDno* this, PlayState* play) { case TEXT_STATE_3: if (play->msgCtx.currentTextId == 0x80B) { - switch (this->unk_32C) { - case 16: + switch (this->animIndex) { + case EN_DNO_ANIM_IMPLORE_START: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 9, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IMPLORE_LOOP, + &this->animIndex); } Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_YawBetweenActors(&this->actor, this->unk_460), 0x71C); break; - case 10: + case EN_DNO_ANIM_IMPLORE_END: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { func_801477B4(play); - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, + &this->animIndex); func_80A71B68(this, play); } break; @@ -411,24 +456,27 @@ void func_80A71F18(EnDno* this, PlayState* play) { case TEXT_STATE_DONE: switch (play->msgCtx.currentTextId) { case 0x80B: - switch (this->unk_32C) { - case 16: + switch (this->animIndex) { + case EN_DNO_ANIM_IMPLORE_START: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 9, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IMPLORE_LOOP, + &this->animIndex); } break; - case 9: + case EN_DNO_ANIM_IMPLORE_LOOP: if (Message_ShouldAdvance(play)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 10, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IMPLORE_END, + &this->animIndex); play->msgCtx.msgMode = 0x44; } break; - case 10: + case EN_DNO_ANIM_IMPLORE_END: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { func_801477B4(play); - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, + &this->animIndex); func_80A71B68(this, play); } break; @@ -448,13 +496,15 @@ void func_80A71F18(EnDno* this, PlayState* play) { break; case 0x80E: - if (this->unk_32C == 11) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 3, &this->unk_32C); - } else if (this->unk_32C == 3) { + if (this->animIndex == EN_DNO_ANIM_TALK) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_FAREWELL, + &this->animIndex); + } else if (this->animIndex == EN_DNO_ANIM_FAREWELL) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 13, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE, + &this->animIndex); } - } else if ((this->unk_32C == 13) && Message_ShouldAdvance(play)) { + } else if ((this->animIndex == EN_DNO_ANIM_IDLE) && Message_ShouldAdvance(play)) { func_801477B4(play); func_80A71B68(this, play); } @@ -474,14 +524,16 @@ void func_80A71F18(EnDno* this, PlayState* play) { break; } - switch (this->unk_32C) { - case 11: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 15, &this->unk_32C); + switch (this->animIndex) { + case EN_DNO_ANIM_TALK: + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_START, + &this->animIndex); break; - case 15: + case EN_DNO_ANIM_PRAYER_START: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 6, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_PRAYER_LOOP, + &this->animIndex); } break; } @@ -500,9 +552,9 @@ void func_80A71F18(EnDno* this, PlayState* play) { void func_80A72438(EnDno* this, PlayState* play) { this->unk_452 = 1; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE_WITH_CANDLE, &this->animIndex); this->actor.textId = 0; - if (Flags_GetSwitch(play, ENDNO_GET_3F80(&this->actor))) { + if (Flags_GetSwitch(play, EN_DNO_GET_RACE_STARTED_SWITCH_FLAG(&this->actor))) { this->unk_454 = 1.0f; } this->actionFunc = func_80A724B8; @@ -544,19 +596,22 @@ void func_80A725F8(EnDno* this, PlayState* play) { case TEXT_STATE_NONE: switch (this->unk_328) { case 0: - if (this->unk_32C == 14) { + if (this->animIndex == EN_DNO_ANIM_IDLE_WITH_CANDLE) { if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x2D8)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 5, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, + EN_DNO_ANIM_GREETING_WITH_CANDLE, &this->animIndex); } - } else if ((this->unk_32C == 5) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (Flags_GetSwitch(play, ENDNO_GET_3F80(&this->actor))) { + } else if ((this->animIndex == EN_DNO_ANIM_GREETING_WITH_CANDLE) && + Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + if (Flags_GetSwitch(play, EN_DNO_GET_RACE_STARTED_SWITCH_FLAG(&this->actor))) { Message_StartTextbox(play, 0x801, &this->actor); } else if (Player_GetMask(play) == PLAYER_MASK_SCENTS) { Message_StartTextbox(play, 0x806, &this->actor); } else { Message_StartTextbox(play, 0x800, &this->actor); } - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE_WITH_CANDLE, + &this->animIndex); } break; @@ -577,7 +632,7 @@ void func_80A725F8(EnDno* this, PlayState* play) { case TEXT_STATE_CLOSING: case TEXT_STATE_3: if (((play->msgCtx.currentTextId == 0x800) || (play->msgCtx.currentTextId == 0x801)) && - (this->unk_32C == 8)) { + (this->animIndex == EN_DNO_ANIM_OPEN_PARASOL)) { Math_SmoothStepToF(&this->unk_454, 1.0f, 1.0f, 0.1f, 0.01f); if (this->skelAnime.curFrame <= 23.0f) { this->unk_452 = 3; @@ -591,7 +646,8 @@ void func_80A725F8(EnDno* this, PlayState* play) { } if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 12, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, + EN_DNO_ANIM_TALK_WITH_PARSOL_AND_CANDLE, &this->animIndex); Message_StartTextbox(play, 0x803, &this->actor); } } @@ -607,7 +663,8 @@ void func_80A725F8(EnDno* this, PlayState* play) { play->msgCtx.msgMode = 0x44; this->unk_452 = 1; this->unk_454 = 0.0f; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 8, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_OPEN_PARASOL, + &this->animIndex); } break; @@ -631,15 +688,17 @@ void func_80A725F8(EnDno* this, PlayState* play) { break; case 0x804: - if (this->unk_32C == 14) { + if (this->animIndex == EN_DNO_ANIM_IDLE_WITH_CANDLE) { if (Message_ShouldAdvance(play)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 5, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, + EN_DNO_ANIM_GREETING_WITH_CANDLE, &this->animIndex); if (!(this->unk_3B0 & 0x40)) { func_80A72CF8(this, play); this->unk_3B0 |= 0x40; } } - } else if ((this->unk_32C == 5) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { + } else if ((this->animIndex == EN_DNO_ANIM_GREETING_WITH_CANDLE) && + (this->skelAnime.curFrame == this->skelAnime.endFrame)) { func_801477B4(play); func_80A72438(this, play); } @@ -660,7 +719,7 @@ void func_80A725F8(EnDno* this, PlayState* play) { } void func_80A72AE4(EnDno* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_START_RACE_START, &this->animIndex); func_80A714B4(this, play); this->actionFunc = func_80A72B3C; } @@ -687,18 +746,18 @@ void func_80A72BA4(EnDno* this, PlayState* play) { } void func_80A72C04(EnDno* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_START_RACE_START, &this->animIndex); this->actor.flags |= ACTOR_FLAG_8000000; this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8); Math_Vec3f_Copy(&this->unk_334, &this->actor.world.pos); SubS_ActorPathing_Init(play, &this->unk_334, &this->actor, &this->actorPath, play->setupPathList, - ENDNO_GET_7F(&this->actor), 1, 0, 1, 0); + EN_DNO_GET_7F(&this->actor), 1, 0, 1, 0); SubS_ActorPathing_ComputePointInfo(play, &this->actorPath); this->actor.world.rot.y = this->actorPath.rotToCurPoint.y; this->actor.world.rot.x = this->actorPath.rotToCurPoint.x; - Flags_SetSwitch(play, ENDNO_GET_3F80(&this->actor)); + Flags_SetSwitch(play, EN_DNO_GET_RACE_STARTED_SWITCH_FLAG(&this->actor)); this->actionFunc = func_80A730A0; } @@ -766,27 +825,26 @@ s32 EnDno_ActorPathing_Move(PlayState* play, ActorPathing* actorPath) { } void func_80A730A0(EnDno* this, PlayState* play) { - f32 temp_f10; s32 phi_a2; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { phi_a2 = -1; - switch (this->unk_32C) { - case 0: + switch (this->animIndex) { + case EN_DNO_ANIM_START_RACE_START: if (this->unk_44E >= 20) { - phi_a2 = 1; + phi_a2 = EN_DNO_ANIM_START_RACE_END; } else { this->unk_44E = 20; } break; - case 1: - phi_a2 = 2; + case EN_DNO_ANIM_START_RACE_END: + phi_a2 = EN_DNO_ANIM_FLY; break; } if (phi_a2 >= 0) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, phi_a2, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, phi_a2, &this->animIndex); } } @@ -798,8 +856,7 @@ void func_80A730A0(EnDno* this, PlayState* play) { this->actorPath.pointOffset.y = 0.0f; this->actorPath.pointOffset.z = 0.0f; Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_334); - temp_f10 = (4.0f + Math_SinS(this->unk_3AE)) * Math_SinS(this->unk_3AC); - this->actor.world.pos.y += temp_f10; + this->actor.world.pos.y += Math_SinS(this->unk_3AC) * (4.0f + Math_SinS(this->unk_3AE)); this->unk_3AC += 4500; this->unk_3AE += 1000; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -820,7 +877,7 @@ void func_80A73244(EnDno* this, PlayState* play) { this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8); this->unk_328 = 2; this->actor.speedXZ = 0.0f; - Flags_UnsetSwitch(play, ENDNO_GET_3F80(&this->actor)); + Flags_UnsetSwitch(play, EN_DNO_GET_RACE_STARTED_SWITCH_FLAG(&this->actor)); gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP; this->unk_44E = 0; this->actionFunc = func_80A732C8; @@ -833,11 +890,12 @@ void func_80A732C8(EnDno* this, PlayState* play) { if (Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x71C)) { this->unk_3B0 |= 4; this->unk_44E = 3; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 7, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_CLOSE_PARASOL, &this->animIndex); } } else if (this->unk_44E == 3) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_IDLE_WITH_CANDLE, + &this->animIndex); func_80A72438(this, play); } else { if (this->skelAnime.curFrame >= 20.0f) { @@ -879,15 +937,16 @@ void func_80A73408(EnDno* this, PlayState* play) { } if (sp33) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, phi_a2, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, phi_a2, &this->animIndex); } } Cutscene_ActorTranslateAndYaw(&this->actor, play, temp_v0); } - if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && (this->unk_32C == 17)) { + if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && + (this->animIndex == EN_DNO_ANIM_SHOCK_START)) { if (0) {}; - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 18, &this->unk_32C); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, EN_DNO_ANIM_SHOCK_LOOP, &this->animIndex); } } @@ -981,7 +1040,7 @@ void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, gSPMatrix(gfxOpa, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(&gfxOpa[1], *dList); - POLY_OPA_DISP = gfxOpa + 2; + POLY_OPA_DISP = &gfxOpa[2]; CLOSE_DISPS(play->state.gfxCtx); } @@ -1006,7 +1065,7 @@ void EnDno_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, gDPSetEnvColor(&gfxXlu[3], 255, 0, 0, 0); gSPDisplayList(&gfxXlu[4], gEffFire1DL); - POLY_XLU_DISP = gfxXlu + 5; + POLY_XLU_DISP = &gfxXlu[5]; Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.h b/src/overlays/actors/ovl_En_Dno/z_en_dno.h index bf357cad6..db07a969b 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.h +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.h @@ -2,36 +2,30 @@ #define Z_EN_DNO_H #include "global.h" +#include "objects/object_dnj/object_dnj.h" struct EnDno; typedef void (*EnDnoActionFunc)(struct EnDno*, PlayState*); -#define ENDNO_GET_F(thisx) ((thisx)->params & 0xF) -#define ENDNO_GET_7F(thisx) ((thisx)->params & 0x7F) -#define ENDNO_GET_7F0(thisx) (((thisx)->params >> 4) & 0x7F) -#define ENDNO_GET_3F80(thisx) (((thisx)->params >> 7) & 0x7F) -#define ENDNO_GET_C000(thisx) (((thisx)->params >> 0xE) & 0x3) +#define EN_DNO_GET_7F(thisx) ((thisx)->params & 0x7F) +#define EN_DNO_GET_RACE_STARTED_SWITCH_FLAG(thisx) (((thisx)->params >> 7) & 0x7F) +#define EN_DNO_GET_C000(thisx) (((thisx)->params >> 0xE) & 0x3) -enum { - /* 0x0 */ ENDNO_GET_F_0, - /* 0x1 */ ENDNO_GET_F_1, -}; - -enum { - /* 0x0 */ ENDNO_GET_C000_0, - /* 0x1 */ ENDNO_GET_C000_1, -}; +typedef enum { + /* 0x0 */ EN_DNO_GET_C000_0, + /* 0x1 */ EN_DNO_GET_C000_1, +} EnDnoUnkC000; typedef struct EnDno { /* 0x000 */ Actor actor; /* 0x144 */ EnDnoActionFunc actionFunc; /* 0x148 */ SkelAnime skelAnime; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ Vec3s jointTable[28]; - /* 0x280 */ Vec3s morphTable[28]; + /* 0x1D8 */ Vec3s jointTable[DEKU_BUTLER_LIMB_MAX]; + /* 0x280 */ Vec3s morphTable[DEKU_BUTLER_LIMB_MAX]; /* 0x328 */ s32 unk_328; - /* 0x32C */ s32 unk_32C; + /* 0x32C */ s32 animIndex; /* 0x330 */ UNK_TYPE1 unk_330[0x4]; /* 0x334 */ Vec3f unk_334; /* 0x340 */ ActorPathing actorPath; diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index 667a20b9b..63371ee2f 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -250,7 +250,7 @@ void func_80B3D11C(EnDnp* this, PlayState* play) { s32 temp_v0; s32 val; - if (!(gSaveContext.save.weekEventReg[29] & 0x40) && (play->sceneNum == SCENE_MITURIN) && + if (!(gSaveContext.save.weekEventReg[29] & 0x40) && (play->sceneId == SCENE_MITURIN) && (play->csCtx.currentCsIndex == 0)) { this->unk_322 |= 0x20; gSaveContext.save.weekEventReg[29] |= 0x40; @@ -373,7 +373,7 @@ void EnDnp_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.0085f); SubS_UpdateFlags(&this->unk_322, 3, 7); this->unk_322 |= 0x400; - if ((play->sceneNum == SCENE_MITURIN) && (gSaveContext.save.weekEventReg[29] & 0x40)) { + if ((play->sceneId == SCENE_MITURIN) && (gSaveContext.save.weekEventReg[29] & 0x40)) { this->unk_322 |= 0x20; func_80B3CC38(this, 1); } diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 133fdd6d5..3c62a59c8 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -290,7 +290,7 @@ const ActorInit En_Door_InitVars = { }; typedef struct { - /* 0x00 */ s16 sceneNum; + /* 0x00 */ s16 sceneId; /* 0x02 */ u8 dListIndex; /* 0x04 */ s16 objectId; } EnDoorInfo; @@ -405,7 +405,7 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) { objectInfo = &sObjInfo[17 + this->switchFlag]; } else { for (i = 0; i < ARRAY_COUNT(sObjInfo) - 34; i++, objectInfo++) { - if (play->sceneNum == objectInfo->sceneNum) { + if (play->sceneId == objectInfo->sceneId) { break; } } diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index c7ea4f5b0..c9b393980 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -903,14 +903,14 @@ void func_8088E850(EnElf* this, PlayState* play) { func_8088D660(this, &nextPos, 0.2f); } - if ((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 0) && + if ((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0) && ((play->csCtx.frames == 149) || (play->csCtx.frames == 381) || (play->csCtx.frames == 591))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } - if ((play->sceneNum == SCENE_SECOM) && (gSaveContext.sceneSetupIndex == 0) && - (play->csCtx.currentCsIndex == 4) && (play->csCtx.frames == 95)) { + if ((play->sceneId == SCENE_SECOM) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 4) && + (play->csCtx.frames == 95)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WHITE_FAIRY_DASH); } } else { diff --git a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c index 61457bf50..897641a9e 100644 --- a/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c +++ b/src/overlays/actors/ovl_En_Elfgrp/z_en_elfgrp.c @@ -205,13 +205,13 @@ s32 func_80A39C1C(PlayState* play, s32 arg1) { } if (arg1 == 0) { - if (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 1) { + if (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 1) { return 25; } return 24; } - temp_v1 = (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; + temp_v1 = (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 >> (((arg1 - 1) * 5) + 1)) & 0x1F; if (temp_v1 < 10) { temp_v1 = 10; } else if (temp_v1 > 25) { @@ -227,13 +227,13 @@ void func_80A39CD4(PlayState* play, s32 arg1, s32 arg2) { if (arg1 == 0) { if (arg2 == 25) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 1; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 1; } else { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~1; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~1; } } else { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= arg2 << ((arg1 * 5) - 4); + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~(0x1F << ((arg1 * 5) - 4)); + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= arg2 << ((arg1 * 5) - 4); } } diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index fa465afbe..12d804fba 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -493,7 +493,7 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { // You found a Stray Fairy! Message_StartTextbox(play, 0x11, NULL); if (gSaveContext.save.inventory.strayFairies[(void)0, gSaveContext.dungeonIndex] >= 15) { - func_801A3098(NA_BGM_GET_ITEM | 0x900); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } } } diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index fc1bdce22..d7d3e446e 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -315,7 +315,7 @@ void EnFall_Setup(EnFall* this, PlayState* play) { void EnFall_CrashingMoon_HandleGiantsCutscene(EnFall* this, PlayState* play) { static s32 sGiantsCutsceneState = 0; - if (play->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 1 && play->csCtx.currentCsIndex == 0) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 0)) { switch (sGiantsCutsceneState) { case 0: if (play->csCtx.state != 0) { @@ -408,7 +408,7 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat } } - if (play->sceneNum == SCENE_OKUJOU && gSaveContext.sceneSetupIndex == 2) { + if ((play->sceneId == SCENE_OKUJOU) && (gSaveContext.sceneLayer == 2)) { switch (play->csCtx.currentCsIndex) { case 0: switch (play->csCtx.frames) { @@ -452,7 +452,7 @@ void EnFall_StoppedClosedMouthMoon_PerformCutsceneActions(EnFall* this, PlayStat } void EnFall_ClockTowerOrTitleScreenMoon_PerformCutsceneActions(EnFall* this, PlayState* play) { - if (play->csCtx.state != 0 && play->sceneNum == SCENE_OKUJOU) { + if (play->csCtx.state != 0 && play->sceneId == SCENE_OKUJOU) { func_800B9010(&this->actor, NA_SE_EV_MOON_FALL - SFX_FLAG); } } @@ -574,7 +574,7 @@ void EnFall_Fireball_SetPerVertexAlpha(f32 fireballAlpha) { void EnFall_Fireball_Update(Actor* thisx, PlayState* play) { EnFall* this = THIS; - if (play->sceneNum == SCENE_00KEIKOKU && gSaveContext.sceneSetupIndex == 0 && play->csCtx.currentCsIndex == 2) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 2)) { play->skyboxCtx.rotY -= 0.05f; } diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 268768660..d5dc5469a 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -167,7 +167,7 @@ Actor* func_8091D944(EnFish* this, PlayState* play) { } s32 func_8091DA14(EnFish* this, PlayState* play) { - return play->sceneNum == SCENE_LABO && func_8091D944(this, play); + return (play->sceneId == SCENE_LABO) && func_8091D944(this, play); } void EnFish_Init(Actor* thisx, PlayState* play) { @@ -853,7 +853,8 @@ void func_8091F5A4(Actor* thisx, PlayState* play) { func_8091D7C4(this); Actor_MoveWithGravity(&this->actor); if (this->unk_248 != 0) { - u32 temp = (play->sceneNum ^ SCENE_LABO) != 0; + u32 temp = (play->sceneId != SCENE_LABO); + phi_f0 = BREG(1) + 10.0f; if (temp) { diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 17d15d4e6..814f1c0a8 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -74,13 +74,13 @@ static Vec3f D_80964B18 = { 0.0f, 55.0f, 12.0f }; static Vec3f D_80964B24 = { 0.0f, 60.0f, 0.0f }; static AnimationInfo sAnimationInfo[] = { - { &object_mu_Anim_0053E0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_mu_Anim_001F74, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_mu_Anim_002F64, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &object_mu_Anim_004904, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_mu_Anim_005304, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, - { &object_mu_Anim_005304, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &object_mu_Anim_00BAC4, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, + { &gHoneyAndDarlingIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gHoneyAndDarlingCupCheeksLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gHoneyAndDarlingHugLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, + { &gHoneyAndDarlingGameDanceLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + { &gHoneyAndDarlingHoldHandsLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, + { &gHoneyAndDarlingHoldHandsLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, + { &gHoneyAndDarlingSurpiseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, }; static ColliderCylinderInit sCylinderInit = { @@ -194,8 +194,8 @@ void EnFu_Init(Actor* thisx, PlayState* play) { if (fuKaiten != NULL) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_mu_Skel_00B2B0, &object_mu_Anim_001F74, this->jointTable, - this->morphTable, 21); + SkelAnime_InitFlex(play, &this->skelAnime, &gHoneyAndDarlingSkel, &gHoneyAndDarlingCupCheeksLoopAnim, + this->jointTable, this->morphTable, HONEY_AND_DARLING_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -538,7 +538,7 @@ void func_80962660(EnFu* this, PlayState* play) { player->stateFlags1 |= 0x20; this->unk_53C = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - func_801A2BB8(NA_BGM_MINI_GAME_2); + func_801A2BB8(NA_BGM_TIMED_MINI_GAME); if (this->unk_542 == 0) { if (this->unk_546 == 1) { func_80961EC8(play); @@ -799,7 +799,7 @@ void func_80962F4C(EnFu* this, PlayState* play) { func_801A2C20(); gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0); gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP; - func_801A3098(NA_BGM_GET_ITEM | 0x900); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); Interface_SetMinigamePerfect(play, MINIGAME_PERFECT_TYPE_1); this->unk_54A = 3; func_809632D0(this); @@ -1454,7 +1454,7 @@ void func_80964950(PlayState* play, EnFuUnkStruct* ptr, s32 len) { for (i = 0; i < len; i++, ptr++) { if (ptr->unk_36 == 1) { if (!flag) { - gSPDisplayList(POLY_OPA_DISP++, object_mu_DL_00B0A0); + gSPDisplayList(POLY_OPA_DISP++, gHoneyAndDarlingHeartMaterialDL); flag = true; } Matrix_Translate(ptr->unk_08.x, ptr->unk_08.y, ptr->unk_08.z, MTXMODE_NEW); @@ -1463,7 +1463,7 @@ void func_80964950(PlayState* play, EnFuUnkStruct* ptr, s32 len) { gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropRecoveryHeartTex)); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, object_mu_DL_00B0E0); + gSPDisplayList(POLY_OPA_DISP++, gHoneyAndDarlingHeartModelDL); } } diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index ebbaaca7f..a9aaedaa1 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -213,15 +213,15 @@ void func_80B3B294(EnGg2* this, PlayState* play) { Vec3s sp30; if (this->unk_2F1 == 0) { - if (play->sceneNum == SCENE_11GORONNOSATO) { + if (play->sceneId == SCENE_11GORONNOSATO) { gSaveContext.save.weekEventReg[20] |= 4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (play->sceneNum == SCENE_17SETUGEN) { + } else if (play->sceneId == SCENE_17SETUGEN) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] |= 8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (play->sceneNum == SCENE_10YUKIYAMANOMURA) { + } else if (play->sceneId == SCENE_10YUKIYAMANOMURA) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] |= 0x10; @@ -239,15 +239,15 @@ void func_80B3B294(EnGg2* this, PlayState* play) { this->unk_1DC++; } else { this->unk_2F1 = 1; - if (play->sceneNum == SCENE_11GORONNOSATO) { + if (play->sceneId == SCENE_11GORONNOSATO) { gSaveContext.save.weekEventReg[20] |= 4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (play->sceneNum == SCENE_17SETUGEN) { + } else if (play->sceneId == SCENE_17SETUGEN) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] |= 8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; - } else if (play->sceneNum == SCENE_10YUKIYAMANOMURA) { + } else if (play->sceneId == SCENE_10YUKIYAMANOMURA) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] |= 0x10; @@ -380,14 +380,14 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { this->unk_2EC = 20; this->unk_2EA = 0; - if (play->sceneNum == SCENE_11GORONNOSATO) { + if (play->sceneId == SCENE_11GORONNOSATO) { gSaveContext.save.weekEventReg[20] &= (u8)~4; gSaveContext.save.weekEventReg[20] &= (u8)~8; gSaveContext.save.weekEventReg[20] &= (u8)~0x10; this->unk_2EE = 0; Actor_ChangeAnimationByInfo(&this->skelAnime, D_80B3BF00, 0); this->actionFunc = func_80B3AFB0; - } else if (play->sceneNum == SCENE_17SETUGEN) { + } else if (play->sceneId == SCENE_17SETUGEN) { if ((gSaveContext.save.weekEventReg[20] & 4) && !(gSaveContext.save.weekEventReg[20] & 8) && !(gSaveContext.save.weekEventReg[20] & 0x10)) { gSaveContext.save.weekEventReg[20] &= (u8)~4; @@ -397,7 +397,7 @@ void EnGg2_Init(Actor* thisx, PlayState* play2) { } else { Actor_MarkForDeath(&this->actor); } - } else if (play->sceneNum == SCENE_10YUKIYAMANOMURA) { + } else if (play->sceneId == SCENE_10YUKIYAMANOMURA) { if (!(gSaveContext.save.weekEventReg[20] & 4) && (gSaveContext.save.weekEventReg[20] & 8) && !(gSaveContext.save.weekEventReg[20] & 0x10)) { gSaveContext.save.weekEventReg[20] &= (u8)~8; diff --git a/src/overlays/actors/ovl_En_Giant/z_en_giant.c b/src/overlays/actors/ovl_En_Giant/z_en_giant.c index 7021b0e0c..7d2819ff9 100644 --- a/src/overlays/actors/ovl_En_Giant/z_en_giant.c +++ b/src/overlays/actors/ovl_En_Giant/z_en_giant.c @@ -220,7 +220,7 @@ void EnGiant_Init(Actor* thisx, PlayState* play) { this->sfxId = 0xFFFF; if (GIANT_TYPE_IS_CHAMBER_OR_ENDING(type)) { - switch (gSaveContext.sceneSetupIndex) { + switch (gSaveContext.sceneLayer) { case 0: case 10: this->sfxId = NA_SE_EV_KYOJIN_GRATITUDE2 - SFX_FLAG; diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index 9f3f424d5..601faff4b 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -118,7 +118,7 @@ Color_RGBA8 D_80B533A4 = { 50, 150, 150, 0 }; u16 func_80B50410(EnGk* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (play->sceneNum == SCENE_17SETUGEN2) { + if (play->sceneId == SCENE_17SETUGEN2) { if (player->transformation == PLAYER_FORM_GORON) { if (!(gSaveContext.save.weekEventReg[40] & 0x80)) { switch (this->unk_31C) { @@ -164,7 +164,7 @@ u16 func_80B50410(EnGk* this, PlayState* play) { this->unk_1E4 |= 1; return 0xE81; } - } else if (play->sceneNum == SCENE_GORONRACE) { + } else if (play->sceneId == SCENE_GORONRACE) { if (player->transformation == PLAYER_FORM_GORON) { if (!(gSaveContext.save.weekEventReg[41] & 4)) { if (this->unk_31C == 0xE88) { @@ -1018,7 +1018,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { if (ENGK_GET_F(&this->actor) == ENGK_F_1) { this->unk_2E4 = 5; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); - if (play->sceneNum == SCENE_17SETUGEN2) { + if (play->sceneId == SCENE_17SETUGEN2) { if (Flags_GetSwitch(play, ENGK_GET_3F00(&this->actor))) { Actor_MarkForDeath(&this->actor); } else { @@ -1026,7 +1026,7 @@ void EnGk_Init(Actor* thisx, PlayState* play) { this->path = SubS_GetPathByIndex(play, ENGK_GET_F0(&this->actor), 0xF); this->actionFunc = func_80B51760; } - } else if (play->sceneNum == SCENE_GORONRACE) { + } else if (play->sceneId == SCENE_GORONRACE) { if (gSaveContext.save.weekEventReg[33] & 0x80) { if (gSaveContext.save.entrance == ENTRANCE(GORON_RACETRACK, 1)) { this->actionFunc = func_80B51760; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 6e36d1130..c85815ee7 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -762,7 +762,7 @@ s32 func_8094EFC4(EnGm* this, PlayState* play) { if (play->csCtx.state != 0) { if (this->unk_3F8 == 0) { - if ((play->sceneNum == SCENE_MILK_BAR) && (gSaveContext.sceneSetupIndex == 2)) { + if ((play->sceneId == SCENE_MILK_BAR) && (gSaveContext.sceneLayer == 2)) { func_8094E054(this, play, 0); this->unk_258 = 255; } @@ -771,7 +771,7 @@ s32 func_8094EFC4(EnGm* this, PlayState* play) { } ret = true; } else if (this->unk_3F8 != 0) { - if (play->sceneNum == SCENE_MILK_BAR) { + if (play->sceneId == SCENE_MILK_BAR) { this->unk_400 = 0; } this->unk_3F8 = 0; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index e5775d129..8692fbba1 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -5,6 +5,7 @@ */ #include "z_en_go.h" +#include "z64quake.h" #include "objects/object_oF1d_map/object_oF1d_map.h" #include "objects/object_hakugin_demo/object_hakugin_demo.h" #include "objects/object_taisou/object_taisou.h" @@ -537,8 +538,8 @@ s32 func_80A1222C(EnGo* this, PlayState* play) { if (((player->transformation == PLAYER_FORM_GORON) && (play->msgCtx.ocarinaMode == 3) && (play->msgCtx.lastPlayedSong == OCARINA_SONG_GORON_LULLABY) && (this->unk_3EC == 0) && (this->actor.xzDistToPlayer < 400.0f)) || - (!(gSaveContext.save.weekEventReg[22] & 4) && (play->sceneNum == SCENE_16GORON_HOUSE) && - (gSaveContext.sceneSetupIndex == 0) && (this->unk_3EC == 0) && (play->csCtx.currentCsIndex == 1))) { + (!(gSaveContext.save.weekEventReg[22] & 4) && (play->sceneId == SCENE_16GORON_HOUSE) && + (gSaveContext.sceneLayer == 0) && (this->unk_3EC == 0) && (play->csCtx.currentCsIndex == 1))) { ret = true; } return ret; @@ -710,7 +711,7 @@ s32 func_80A12868(EnGo* this, PlayState* play) { s32 func_80A12954(EnGo* this, PlayState* play) { if ((ENGO_GET_F(&this->actor) == ENGO_F_4) && (play->csCtx.state != 0) && (this->actor.draw != NULL) && - (play->sceneNum == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && + (play->sceneId == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 0)) { if (this->unk_3F0 == 0) { this->actor.flags &= ~ACTOR_FLAG_1; @@ -1045,16 +1046,16 @@ s32 func_80A13564(EnGo* this, f32 arg1, f32 arg2, s32 arg3) { return ret; } -void func_80A136B8(PlayState* play, s16 arg1, s16 arg2, s16 arg3) { - s16 sp26 = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3); +void func_80A136B8(PlayState* play, s16 speed, s16 verticalMag, s16 countdown) { + s16 quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); - Quake_SetCountdown(sp26, arg3); - Quake_SetSpeed(sp26, arg1); - Quake_SetQuakeValues(sp26, arg2, 0, 0, 0); + Quake_SetCountdown(quakeIndex, countdown); + Quake_SetSpeed(quakeIndex, speed); + Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0); } void func_80A13728(EnGo* this, PlayState* play) { - func_80A136B8(play, 0x6C77, 7, 20); + func_80A136B8(play, 27767, 7, 20); play->actorCtx.unk2 = 4; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TEST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); @@ -1411,7 +1412,7 @@ void func_80A144F4(EnGo* this, PlayState* play) { void func_80A145AC(EnGo* this, PlayState* play) { if ((ENGO_GET_70(&this->actor) == ENGO_70_1) && - (((play->sceneNum == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneSetupIndex == 1) && + (((play->sceneId == SCENE_10YUKIYAMANOMURA2) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 0)) || !(gSaveContext.save.weekEventReg[21] & 8))) { this->actor.child = func_80A13400(this, play); diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index df491dd22..1f173114d 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -5,6 +5,7 @@ */ #include "z_en_goroiwa.h" +#include "z64quake.h" #include "objects/object_goroiwa/object_goroiwa.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -450,10 +451,11 @@ s32 func_8093F6F8(EnGoroiwa* this, PlayState* play) { if ((this->actor.velocity.y < 0.0f) && (this->actor.world.pos.y <= sp7C)) { if (this->unk_1CA == 0) { if (this->actor.xzDistToPlayer < 400.0f) { - s16 sp72 = Quake_Add(GET_ACTIVE_CAM(play), 3); - Quake_SetSpeed(sp72, 0x4350); - Quake_SetQuakeValues(sp72, 3, 0, 0, 0); - Quake_SetCountdown(sp72, 7); + s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + + Quake_SetSpeed(quakeIndex, 17232); + Quake_SetQuakeValues(quakeIndex, 3, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 7); } this->unk_1C4 = 0.0f; diff --git a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c index de0880e96..f9085e825 100644 --- a/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c +++ b/src/overlays/actors/ovl_En_Hanabi/z_en_hanabi.c @@ -323,15 +323,15 @@ void func_80B23910(EnHanabi* this, PlayState* play) { } void func_80B23934(EnHanabi* this, PlayState* play) { - if ((gSaveContext.save.entrance == ENTRANCE(TERMINA_FIELD, 1)) && (gSaveContext.sceneSetupIndex == 7)) { + if ((gSaveContext.save.entrance == ENTRANCE(TERMINA_FIELD, 1)) && (gSaveContext.sceneLayer == 7)) { if (play->csCtx.frames > 1650) { func_80B236C8(this, play); func_800B8FE8(&this->actor, NA_SE_EV_FIREWORKS_LAUNCH - SFX_FLAG); } } - if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7) && - (play->csCtx.currentCsIndex == 0) && (play->csCtx.frames == 610)) { + if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 7) && (play->csCtx.currentCsIndex == 0) && + (play->csCtx.frames == 610)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_KYOJIN_GROAN); } } diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index 83e0935f5..07b256487 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -158,8 +158,8 @@ void func_80BCF398(EnHg* this, PlayState* play) { !Cutscene_CheckActorAction(play, 0x1E3)) { func_80BCF468(this); } - if ((gSaveContext.sceneSetupIndex == 0 && play->csCtx.currentCsIndex == 0) && - (play->csCtx.frames == 20 || play->csCtx.frames == 60)) { + if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0) && + ((play->csCtx.frames == 20) || (play->csCtx.frames == 60))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_HALF_REDEAD_SURPRISE); } } diff --git a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c index 83fbe5988..53e4e91c3 100644 --- a/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c +++ b/src/overlays/actors/ovl_En_Hgo/z_en_hgo.c @@ -287,7 +287,7 @@ s32 func_80BD0898(EnHgo* this, PlayState* play) { case 1: if ((Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) && (this->unk_312 == 0)) { this->unk_312 = 1; - if ((gSaveContext.sceneSetupIndex == 0) && + if ((gSaveContext.sceneLayer == 0) && ((play->csCtx.currentCsIndex == 2) || (play->csCtx.currentCsIndex == 4))) { Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_GBVO02); } diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 7aa060a96..0e58e2b85 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -170,7 +170,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { EnHoll_SetPlayerSide(play, this, &transformedPlayerPos); playerDistFromCentralPlane = fabsf(transformedPlayerPos.z); - if (play->sceneNum == SCENE_IKANA) { + if (play->sceneId == SCENE_IKANA) { enHollBottom = EN_HOLL_BOTTOM_IKANA; enHollHalfwidth = EN_HOLL_HALFWIDTH_IKANA; } @@ -209,7 +209,7 @@ void EnHoll_VisibleIdle(EnHoll* this, PlayState* play) { } } } - } else if ((this->type == EN_HOLL_TYPE_DEFAULT) && (play->sceneNum == SCENE_26SARUNOMORI) && + } else if ((this->type == EN_HOLL_TYPE_DEFAULT) && (play->sceneId == SCENE_26SARUNOMORI) && (sInstancePlayingSound == NULL)) { sInstancePlayingSound = this; } @@ -225,7 +225,7 @@ void EnHoll_TransparentIdle(EnHoll* this, PlayState* play) { Actor_OffsetOfPointInActorCoords(&this->actor, &transformedPlayerPos, useViewEye ? &play->view.eye : &player->actor.world.pos); - enHollTop = (play->sceneNum == SCENE_PIRATE) ? EN_HOLL_TOP_PIRATE : EN_HOLL_TOP_DEFAULT; + enHollTop = (play->sceneId == SCENE_PIRATE) ? EN_HOLL_TOP_PIRATE : EN_HOLL_TOP_DEFAULT; if ((transformedPlayerPos.y > EN_HOLL_BOTTOM_DEFAULT) && (transformedPlayerPos.y < enHollTop) && (fabsf(transformedPlayerPos.x) < EN_HOLL_HALFWIDTH_TRANSPARENT)) { diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index e89834c30..e58ea297e 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -792,8 +792,8 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->stateFlags = 0; } - if (((play->sceneNum == SCENE_KOEPONARACE) && (GET_RACE_FLAGS == 1)) || - ((gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && Cutscene_GetSceneSetupIndex(play))) { + if (((play->sceneId == SCENE_KOEPONARACE) && (GET_RACE_FLAGS == 1)) || + ((gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0)) && Cutscene_GetSceneLayer(play))) { this->stateFlags |= ENHORSE_FLAG_25; } @@ -878,7 +878,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { Interface_InitMinigame(play); } else if (thisx->params == ENHORSE_14) { func_808846F0(this, play); - if ((play->sceneNum == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { + if ((play->sceneId == SCENE_LOST_WOODS) && !Cutscene_IsPlaying(play)) { Actor_MarkForDeath(&this->actor); } } else if (thisx->params == ENHORSE_16) { @@ -1569,7 +1569,7 @@ void EnHorse_Stopping(EnHorse* this, PlayState* play) { if ((this->stateFlags & ENHORSE_STOPPING_NEIGH_SOUND) && (this->skin.skelAnime.curFrame > 29.0f)) { this->actor.speedXZ = 0.0f; if ((Rand_ZeroOne() > 0.5f) && - ((gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 0)) || !Cutscene_GetSceneSetupIndex(play))) { + ((gSaveContext.save.entrance != ENTRANCE(ROMANI_RANCH, 0)) || !Cutscene_GetSceneLayer(play))) { if (this->stateFlags & ENHORSE_DRAW) { if (this->type == HORSE_TYPE_2) { Audio_PlaySfxAtPos(&this->unk_218, NA_SE_EV_KID_HORSE_NEIGH); @@ -3499,7 +3499,7 @@ void EnHorse_ObstructMovement(EnHorse* this, PlayState* play, s32 obstacleType, this->unk_1EC |= 0x80; this->actor.world.pos = this->actor.prevPos; this->actor.speedXZ = 0.0f; - } else if ((play->sceneNum != SCENE_KOEPONARACE) || (this->unk_1EC & 2)) { + } else if ((play->sceneId != SCENE_KOEPONARACE) || (this->unk_1EC & 2)) { this->unk_1EC &= ~2; this->actor.world.pos = this->lastPos; this->stateFlags |= ENHORSE_OBSTACLE; @@ -3823,7 +3823,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { } if (((movingFast == false) && (intersectDist < 80.0f)) || ((movingFast == true) && (intersectDist < 150.0f))) { - if ((play->sceneNum != SCENE_KOEPONARACE) && (Math_CosS(sp7E) < 0.9f) && (this->playerControlled == true)) { + if ((play->sceneId != SCENE_KOEPONARACE) && (Math_CosS(sp7E) < 0.9f) && (this->playerControlled == true)) { if (movingFast == false) { this->stateFlags |= ENHORSE_FORCE_REVERSING; } else if (movingFast == true) { @@ -3877,7 +3877,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { COLPOLY_GET_NORMAL(obstacleFloor->normal.z), obstacleFloor->dist, &this->actor.world.pos) > 40.0f)) { if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && - (play->sceneNum != SCENE_KOEPONARACE)) { + (play->sceneId != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); } @@ -3889,7 +3889,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || (func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) { if ((Math_CosS(sp7E) < 0.9f) && (movingFast == true) && (this->playerControlled == true) && - (this->action != ENHORSE_ACTION_STOPPING) && (play->sceneNum != SCENE_KOEPONARACE)) { + (this->action != ENHORSE_ACTION_STOPPING) && (play->sceneId != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); } @@ -3952,13 +3952,13 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { if ((temp_f0 < 0.81915206f) || SurfaceType_IsHorseBlocked(&play->colCtx, obstacleFloor, bgId) || (func_800C99D4(&play->colCtx, obstacleFloor, bgId) == 7)) { if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && - (play->sceneNum != SCENE_KOEPONARACE)) { + (play->sceneId != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); } } else if (behindObstacleHeight < -70.0f) { if ((movingFast == true) && (this->playerControlled == true) && (this->action != ENHORSE_ACTION_STOPPING) && - (play->sceneNum != SCENE_KOEPONARACE)) { + (play->sceneId != SCENE_KOEPONARACE)) { this->stateFlags |= ENHORSE_FORCE_REVERSING; EnHorse_StartBraking(this, play); } diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 4c7eb48d6..e262555a1 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -122,7 +122,7 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) { } Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); - play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_START_3; + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; this->horse1 = (EnHorse*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -1149.0f, -106.0f, 470.0f, 0, 0x7FFF, 0, ENHORSE_PARAMS(ENHORSE_PARAM_BANDIT, ENHORSE_4)); diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 398bac6ca..d5b23bdae 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -158,7 +158,7 @@ void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) { this->unk_1E8 = 0; this->unk_1E4 = 0; - if (gSaveContext.sceneSetupIndex >= 4) { + if (gSaveContext.sceneLayer >= 4) { func_808DEFE8(this); } else { func_808DEFE8(this); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index d71e4c193..ffd45eaf9 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -387,7 +387,7 @@ void EnIk_Idle(EnIk* this, PlayState* play) { } } else if (this->colliderCylinder.base.acFlags & AC_HIT) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); - func_801A2E54(NA_BGM_MINI_BOSS); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); this->actor.hintId = TATL_HINT_ID_IRON_KNUCKLE; this->colliderCylinder.base.acFlags &= ~AC_HIT; this->invincibilityFrames = 12; @@ -786,7 +786,7 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { isArmorBroken = true; } else { Enemy_StartFinishingBlow(play, &this->actor); - func_801A2ED8(); + Audio_RestorePrevBgm(); } } if (isArmorBroken == true) { diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 2ac167235..2050c7316 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1989,7 +1989,7 @@ void func_80B470E0(EnInvadepoh* this) { void func_80B47108(EnInvadepoh* this, PlayState* play) { if (this->actionTimer == 100) { - func_801A3098(NA_BGM_CLEAR_EVENT); + Audio_PlayFanfare(NA_BGM_CLEAR_EVENT); } this->actionTimer--; if (this->actionTimer <= 0) { diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 26c5bbbbc..57c18ad7b 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -5,6 +5,7 @@ */ #include "z_en_ishi.h" +#include "z64quake.h" #include "z64rumble.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -594,11 +595,12 @@ void func_8095EBDC(EnIshi* this, PlayState* play) { } if (sp70 == 1) { - s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + + Quake_SetSpeed(quakeIndex, 17232); + Quake_SetQuakeValues(quakeIndex, 3, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 7); - Quake_SetSpeed(quake, 0x4350); - Quake_SetQuakeValues(quake, 3, 0, 0, 0); - Quake_SetCountdown(quake, 7); Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index bb5ec72ee..60ebb2474 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -948,8 +948,7 @@ void EnJg_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); if (!EN_JG_IS_IN_GORON_SHRINE(thisx)) { - if ((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7) && - (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 7) && (play->csCtx.currentCsIndex == 0)) { // This is the elder that appears in the cutscene for learning the full Goron Lullaby. this->animIndex = EN_JG_ANIM_IDLE; this->action = EN_JG_ACTION_LULLABY_INTRO_CS; diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 50b7afa2e..4fd70e9f5 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -284,7 +284,7 @@ void func_80C1410C(EnJgameTsn* this, PlayState* play) { player->stateFlags1 |= 0x20; func_801A2BB8(0x25); - play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_START_3; + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; Interface_InitMinigame(play); gSaveContext.save.weekEventReg[90] |= 0x20; Interface_StartTimer(TIMER_ID_MINIGAME_2, 120); diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index 4e35a5158..457f62d77 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -272,7 +272,7 @@ s32 func_80968E38(s32 arg0) { s32 i; s32 count; u8 mask; - u8* maskMaskBit = gSaveContext.maskMaskBit; + u8* masksGivenOnMoon = gSaveContext.masksGivenOnMoon; if (((arg0 < 0) || (arg0 >= 9))) { return 0; @@ -282,21 +282,21 @@ s32 func_80968E38(s32 arg0) { arg0 *= 3; for (mask = 1, i = 0; i < 8; i++, mask <<= 1) { - if (maskMaskBit[arg0] & mask) { + if (masksGivenOnMoon[arg0] & mask) { count++; } } arg0++; for (mask = 1, i = 0; i < 8; i++, mask <<= 1) { - if (maskMaskBit[arg0] & mask) { + if (masksGivenOnMoon[arg0] & mask) { count++; } } arg0++; for (mask = 1, i = 0; i < 5; i++, mask <<= 1) { - if (maskMaskBit[arg0] & mask) { + if (masksGivenOnMoon[arg0] & mask) { count++; } } @@ -373,15 +373,15 @@ s32 EnJs_GetRemainingMasks(void) { } void EnJs_TakeMask(s32 actionParams, s32 childType) { - u8* maskMaskBit = gSaveContext.maskMaskBit; + u8* masksGivenOnMoon = gSaveContext.masksGivenOnMoon; s32 temp = 0; if ((childType >= 0) && (childType < 9)) { actionParams -= PLAYER_AP_MASK_TRUTH; childType *= 3; if (actionParams < 8) { - maskMaskBit[childType] |= 1 << actionParams; - maskMaskBit[temp] |= 1 << actionParams; + masksGivenOnMoon[childType] |= 1 << actionParams; + masksGivenOnMoon[temp] |= 1 << actionParams; return; } @@ -389,8 +389,8 @@ void EnJs_TakeMask(s32 actionParams, s32 childType) { childType++; temp++; if (actionParams < 8) { - maskMaskBit[childType] |= 1 << actionParams; - maskMaskBit[temp] |= 1 << actionParams; + masksGivenOnMoon[childType] |= 1 << actionParams; + masksGivenOnMoon[temp] |= 1 << actionParams; return; } @@ -398,8 +398,8 @@ void EnJs_TakeMask(s32 actionParams, s32 childType) { childType++; temp++; if (actionParams < 6) { - maskMaskBit[childType] |= 1 << actionParams; - maskMaskBit[temp] |= 1 << actionParams; + masksGivenOnMoon[childType] |= 1 << actionParams; + masksGivenOnMoon[temp] |= 1 << actionParams; } } } @@ -457,15 +457,15 @@ s32 func_8096933C(s32 arg0) { } void func_80969400(s32 arg0) { - u8* maskMaskBit = gSaveContext.maskMaskBit; - u8* temp_v0 = &gSaveContext.maskMaskBit[arg0 * 3]; + u8* masksGivenOnMoon = gSaveContext.masksGivenOnMoon; + u8* temp_v0 = &gSaveContext.masksGivenOnMoon[arg0 * 3]; if ((arg0 >= 0) && (arg0 < 9)) { - maskMaskBit[0] &= ~temp_v0[0]; - maskMaskBit[1] &= ~temp_v0[1]; + masksGivenOnMoon[0] &= ~temp_v0[0]; + masksGivenOnMoon[1] &= ~temp_v0[1]; temp_v0[2] &= 0xF; - maskMaskBit[2] &= ~temp_v0[2]; + masksGivenOnMoon[2] &= ~temp_v0[2]; temp_v0[0] = 0; temp_v0[1] = 0; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index c000db32b..4c4921f37 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -238,10 +238,10 @@ void EnKakasi_CheckAnimationSfx(EnKakasi* this) { void EnKakasi_CheckPlayerPosition(EnKakasi* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (play->sceneNum == SCENE_8ITEMSHOP) { + if (play->sceneId == SCENE_8ITEMSHOP) { player->actor.world.pos.x = -50.0f; player->actor.world.pos.z = 155.0f; - } else if (play->sceneNum == SCENE_TENMON_DAI) { + } else if (play->sceneId == SCENE_TENMON_DAI) { player->actor.world.pos.x = 60.0f; player->actor.world.pos.z = -190.0f; } @@ -998,7 +998,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { tempWorldPos.x += randPlusMinusPoint5Scaled(2.0f); tempWorldPos.z += randPlusMinusPoint5Scaled(2.0f); - if (play->sceneNum == SCENE_8ITEMSHOP) { + if (play->sceneId == SCENE_8ITEMSHOP) { EffectSsGSplash_Spawn(play, &tempWorldPos, 0, 0, 0, randPlusMinusPoint5Scaled(100.0f) + 200.0f); SoundSource_PlaySfxAtFixedWorldPos(play, &tempWorldPos, 0x32, NA_SE_EV_BOMB_DROP_WATER); diff --git a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c index ad85d9edb..78d903207 100644 --- a/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c +++ b/src/overlays/actors/ovl_En_Kbt/z_en_kbt.c @@ -71,12 +71,12 @@ void EnKbt_Destroy(Actor* thisx, PlayState* play) { } s32 func_80B33E64(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 1; + return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 1; } s32 func_80B33E8C(PlayState* play) { if ((CURRENT_DAY == 3) || - ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 2))) { + ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 2))) { return true; } return false; diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index de2d1c207..c9349b2c5 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -151,33 +151,33 @@ ObjIcePoly* EnKgy_FindIceBlock(PlayState* play) { } void func_80B40C74(PlayState* play) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 1; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 1; if (CURRENT_DAY == 1) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 2; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 2; } else { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~2; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~2; } } void func_80B40D00(PlayState* play) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= 4; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= 4; } void func_80B40D30(PlayState* play) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~7; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~7; } s32 func_80B40D64(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 1; + return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 1; } s32 func_80B40D8C(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 4; + return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 4; } s32 func_80B40DB4(PlayState* play) { if ((CURRENT_DAY == 3) || - ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 2))) { + ((CURRENT_DAY == 2) && (gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 2))) { return true; } return false; diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 510c7242d..0e9135910 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -207,7 +207,7 @@ void EnMa4_Init(Actor* thisx, PlayState* play) { this->hasBow = false; } - if (Cutscene_GetSceneSetupIndex(play) != 0) { // if (sceneSetupIndex != 0) + if (Cutscene_GetSceneLayer(play) != 0) { EnMa4_ChangeAnim(this, 0); this->state = MA4_STATE_HORSEBACKGAME; EnMa4_InitHorsebackGame(this, play); @@ -688,7 +688,7 @@ void EnMa4_HorsebackGameTalking(EnMa4* this, PlayState* play) { void EnMa4_InitHorsebackGame(EnMa4* this, PlayState* play) { Player* player = GET_PLAYER(play); - play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_START_3; + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); gSaveContext.save.weekEventReg[8] |= 1; Interface_InitMinigame(play); diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index e90b2decc..49d7a06fb 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -881,7 +881,7 @@ void EnMaYto_SetupAfterMilkRunInit(EnMaYto* this) { if (gSaveContext.save.weekEventReg[52] & 1) { // if (ProtectedCremia) EnMaYto_SetFaceExpression(this, 3, 1); } else { - func_801A3098(NA_BGM_FAILURE_1); + Audio_PlayFanfare(NA_BGM_FAILURE_1); EnMaYto_SetFaceExpression(this, 5, 2); } this->actionFunc = EnMaYto_AfterMilkRunInit; diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index da72fc308..b7199cb1d 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -393,7 +393,7 @@ void EnMag_Update(Actor* thisx, PlayState* play) { play->transitionType = TRANS_TYPE_02; play->nextEntrance = ENTRANCE(CUTSCENE, 0); gSaveContext.save.cutscene = 0; - gSaveContext.sceneSetupIndex = 0; + gSaveContext.sceneLayer = 0; } this->unk11F54 = 15; this->unk11F56 = 25; diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index cb25445b9..dc5e75579 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -120,7 +120,7 @@ void EnMk_Destroy(Actor* thisx, PlayState* play) { } s32 func_80959524(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 7; + return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 7; } void func_8095954C(EnMk* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 6909183f3..ac3c8322e 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -303,7 +303,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) { this->unk_2AC--; if (this->unk_2AC == 0) { if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] == SECONDS_TO_TIMER(10)) { - func_801A3098(0x922); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } else { play_sound(NA_SE_SY_ERROR); } diff --git a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c index a556c689c..d7de95551 100644 --- a/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c +++ b/src/overlays/actors/ovl_En_Mt_tag/z_en_mt_tag.c @@ -315,7 +315,7 @@ void EnMttag_RaceStart(EnMttag* this, PlayState* play) { } else { if (DECR(this->timer) == 60) { Interface_StartTimer(TIMER_ID_MINIGAME_2, 0); - play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_START_3; + play->interfaceCtx.minigameState = MINIGAME_STATE_COUNTDOWN_SETUP_3; Audio_QueueSeqCmd(NA_BGM_GORON_RACE | 0x8000); play->envCtx.unk_E4 = 0xFE; player->stateFlags1 &= ~0x20; diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.c b/src/overlays/actors/ovl_En_Osn/z_en_osn.c index b2fee9d8d..1f9cb3da8 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -731,7 +731,7 @@ void func_80AD16A8(EnOsn* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->unk_1EC); } - if ((this->unk_1EC == 5) && (play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0xB) && + if ((this->unk_1EC == 5) && (play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 0xB) && (play->csCtx.frames == 400)) { Actor_PlaySfxAtPos(&this->actor, NA_SE_VO_OMVO00); } @@ -795,7 +795,7 @@ void EnOsn_Init(Actor* thisx, PlayState* play) { this->unk_1EA |= 1; } this->unk_1F0 = 1; - if (play->sceneNum == SCENE_INSIDETOWER) { + if (play->sceneId == SCENE_INSIDETOWER) { if ((gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 2)) || (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_INTERIOR, 6))) { this->actionFunc = func_80AD16A8; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index f1bfcd57f..8b636787d 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -356,7 +356,7 @@ void func_8095AE60(EnOwl* this, PlayState* play) { void func_8095AEC0(EnOwl* this, PlayState* play) { func_8095A920(this, play); if (func_8095A978(this, play, 0x7D0, 360.0f, 200.0f)) { - func_801A3098(NA_BGM_OWL); + Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_8095AE60; } } @@ -385,7 +385,7 @@ void func_8095AF2C(EnOwl* this, PlayState* play) { void func_8095AFEC(EnOwl* this, PlayState* play) { func_8095A920(this, play); if (func_8095A978(this, play, 0xBF6, 200.0f, 100.0f)) { - func_801A3098(NA_BGM_OWL); + Audio_PlayFanfare(NA_BGM_OWL); this->actionFunc = func_8095AF2C; this->unk_406 = 0; this->actionFlags |= 0x40; @@ -500,7 +500,7 @@ void func_8095B574(EnOwl* this, PlayState* play) { func_8095A920(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_8095BA84; - func_801A3098(NA_BGM_OWL); + Audio_PlayFanfare(NA_BGM_OWL); this->actionFlags |= 0x40; this->unk_406 = 2; } else if (this->actor.xzDistToPlayer < 200.0f) { @@ -713,7 +713,7 @@ void func_8095BE0C(EnOwl* this, PlayState* play) { func_8095A920(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->actionFunc = func_8095BA84; - func_801A3098(NA_BGM_OWL); + Audio_PlayFanfare(NA_BGM_OWL); this->unk_406 = 1; this->actionFlags |= 0x40; } else if (this->actor.textId == 0xBF0) { diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index b1b3d9cbc..0582b7ca8 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -5,6 +5,7 @@ */ #include "z_en_pametfrog.h" +#include "z64quake.h" #include "z64rumble.h" #include "overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h" #include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" @@ -1035,7 +1036,7 @@ void EnPametfrog_LookAround(EnPametfrog* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; if (SkelAnime_Update(&this->skelAnime) && !Play_InCsMode(play)) { if (!this->unk_2AE) { - func_801A2E54(NA_BGM_MINI_BOSS); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); this->unk_2AE = true; } EnPametfrog_SetupJumpToLink(this); @@ -1222,11 +1223,14 @@ void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, PlayState* play) { // Zooms in on Snapper spawn point Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); - this->quake = Quake_Add(GET_ACTIVE_CAM(play), 6); - Quake_SetSpeed(this->quake, 18000); - Quake_SetQuakeValues(this->quake, 2, 0, 0, 0); - Quake_SetCountdown(this->quake, 15); + + this->quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); + Quake_SetSpeed(this->quakeIndex, 18000); + Quake_SetQuakeValues(this->quakeIndex, 2, 0, 0, 0); + Quake_SetCountdown(this->quakeIndex, 15); + Rumble_Request(this->actor.xyzDistToPlayerSq, 120, 20, 10); + this->timer = 40; this->actionFunc = EnPametfrog_SnapperSpawn; } @@ -1244,18 +1248,22 @@ void EnPametfrog_SnapperSpawn(EnPametfrog* this, PlayState* play) { void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, PlayState* play) { this->actor.params = GEKKO_GET_SNAPPER; - Quake_RemoveFromIdx(this->quake); - this->quake = Quake_Add(GET_ACTIVE_CAM(play), 3); - Quake_SetSpeed(this->quake, 20000); - Quake_SetQuakeValues(this->quake, 17, 0, 0, 0); - Quake_SetCountdown(this->quake, 12); + + Quake_Remove(this->quakeIndex); + + this->quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + Quake_SetSpeed(this->quakeIndex, 20000); + Quake_SetQuakeValues(this->quakeIndex, 17, 0, 0, 0); + Quake_SetCountdown(this->quakeIndex, 12); + Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); + this->actionFunc = EnPametfrog_TransitionGekkoSnapper; } void EnPametfrog_TransitionGekkoSnapper(EnPametfrog* this, PlayState* play) { if (this->actor.params == GEKKO_INIT_SNAPPER) { - func_801A2E54(NA_BGM_MINI_BOSS); + Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); EnPametfrog_SetupRunToSnapper(this); } } @@ -1267,7 +1275,7 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, PlayState* play) { !(this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) { if (this->actor.params == GEKKO_PRE_SNAPPER) { if (Actor_ApplyDamage(&this->actor) == 0) { - func_801A2ED8(); + Audio_RestorePrevBgm(); } if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_ZORA_BARRIER) { @@ -1303,7 +1311,7 @@ void EnPametfrog_ApplyDamageEffect(EnPametfrog* this, PlayState* play) { EnPametfrog_ApplyMagicArrowEffects(this, play); Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_1; - func_801A2ED8(); + Audio_RestorePrevBgm(); EnPametfrog_SetupCutscene(this); } else if (this->actor.colChkInfo.damageEffect == GEKKO_DMGEFF_ZORA_BARRIER) { EnPametfrog_ApplyElectricStun(this); diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h index 3f3e82165..81af17129 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h @@ -32,7 +32,7 @@ typedef struct EnPametfrog { /* 0x2AE */ u8 unk_2AE; // True/False /* 0x2B0 */ s16 cutscene; /* 0x2B2 */ s16 params; - /* 0x2B4 */ s16 quake; + /* 0x2B4 */ s16 quakeIndex; /* 0x2B6 */ s16 timer; /* 0x2B8 */ s16 spinYaw; /* 0x2BA */ s16 subCamId; diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 3995207e9..1f5aebe64 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -1017,7 +1017,7 @@ s32 func_80AF86F0(EnPm* this, PlayState* play) { s32 func_80AF87C4(EnPm* this, PlayState* play) { s32 ret = false; - if ((play->csCtx.state != 0) && (play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 9) && + if ((play->csCtx.state != 0) && (play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 9) && (play->curSpawn == 1)) { if (!this->unk_380) { func_80AF7E98(this, 0); diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index 56201271b..bfb701484 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -296,7 +296,7 @@ void EnRailSkb_Init(Actor* thisx, PlayState* play) { this->unk_3F8 = 0; } - if ((play->sceneNum == SCENE_BOTI) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_BOTI) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 0)) { this->actor.flags |= ACTOR_FLAG_100000; } diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.c b/src/overlays/actors/ovl_En_Ru/z_en_ru.c index 0333cb011..1a57cba7b 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.c +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.c @@ -15,9 +15,8 @@ void EnRu_Destroy(Actor* thisx, PlayState* play); void EnRu_Update(Actor* thisx, PlayState* play); void EnRu_Draw(Actor* thisx, PlayState* play); -void func_80A38DF4(EnRu* this, PlayState* play); +void EnRu_DoNothing(EnRu* this, PlayState* play); -#if 0 const ActorInit En_Ru_InitVars = { ACTOR_EN_RU, ACTORCAT_NPC, @@ -30,18 +29,29 @@ const ActorInit En_Ru_InitVars = { (ActorFunc)EnRu_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A39450 = { - { COLTYPE_HIT0, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT0, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 18, 64, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80A3947C = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -// static DamageTable sDamageTable = { -static DamageTable D_80A39488 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(0, 0x0), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -76,34 +86,268 @@ static DamageTable D_80A39488 = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -#endif +static AnimationInfoS sAnimationInfo[] = { + { &gAdultRutoIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, + { &gAdultRutoIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoRaisingArmsUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoCrossingArmsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoLookingDownLeftAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoIdleHandsOnHipsAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoHeadTurnDownLeftAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, + { &gAdultRutoSwimmingUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, +}; -extern ColliderCylinderInit D_80A39450; -extern CollisionCheckInfoInit2 D_80A3947C; -extern DamageTable D_80A39488; +// in PostLimbdraw, converts limbIndex to bodyPartsPos index +static s8 sBodyPartPosIndices[] = { + -1, -1, 12, 13, 14, -1, 9, 10, 11, -1, 0, 6, -1, -1, 7, 8, 2, -1, -1, 3, 4, 2, 1, +}; -extern UNK_TYPE D_0600C700; +static s8 sRuBodyParts[RU_BODYPARTSPOS_COUNT] = { + 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A389A0.s") +static u8 sRuShadowSizes[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38A68.s") +static TrackOptionsSet sTrackOptions = { + { 0xFA0, 4, 1, 3 }, { 0x1770, 4, 1, 6 }, { 0xFA0, 4, 1, 3 }, { 0x1770, 4, 1, 6 } +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38B7C.s") +s32 EnRu_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) { + s16 lastFrame; + s32 ret = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38BF0.s") + if ((animIndex >= 0) && (animIndex < ARRAY_COUNT(sAnimationInfo))) { + lastFrame = sAnimationInfo[animIndex].frameCount; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38C70.s") + ret = true; + if (lastFrame < 0) { + lastFrame = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38DF4.s") + Animation_Change(skelAnime, sAnimationInfo[animIndex].animation, sAnimationInfo[animIndex].playSpeed, + sAnimationInfo[animIndex].startFrame, lastFrame, sAnimationInfo[animIndex].mode, + sAnimationInfo[animIndex].morphFrames); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/EnRu_Init.s") + return ret; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/EnRu_Destroy.s") +// En_Zo has a copy of this function +s32 EnRu_PlayWalkingSound(EnRu* this, PlayState* play) { + u8 leftWasGrounded; + u8 rightWasGrounded; + s32 waterSfxId; + s16 sfxId; + u8 isFootGrounded; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/EnRu_Update.s") + leftWasGrounded = this->isLeftFootGrounded; + rightWasGrounded = this->isRightFootGrounded; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A38FB4.s") + if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.depthInWater < 20.0f) { + waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; + } else { + waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/func_80A390F8.s") + sfxId = waterSfxId + SFX_FLAG; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Ru/EnRu_Draw.s") + } else { + sfxId = SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) + SFX_FLAG; + } + + this->isLeftFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->leftFootPos, -6.0f); + + if (this->isLeftFootGrounded && !leftWasGrounded && isFootGrounded) { + Actor_PlaySfxAtPos(&this->actor, sfxId); + } + + this->isRightFootGrounded = isFootGrounded = SubS_IsFloorAbove(play, &this->rightFootPos, -6.0f); + if (this->isRightFootGrounded && !rightWasGrounded && isFootGrounded) { + Actor_PlaySfxAtPos(&this->actor, sfxId); + } + + return false; +} + +// This function is only ever called with eyeStateMax == 3 +void EnRu_UpdateEyes(EnRu* this, s32 eyeStateMax) { + if (DECR(this->blinkTimer) == 0) { + this->eyeState++; + if (this->eyeState >= eyeStateMax) { + this->eyeState = 0; + this->blinkTimer = Rand_S16Offset(30, 30); + } + } +} + +void EnRu_UpdateCollider(EnRu* this, PlayState* play) { + this->collider.dim.pos.x = this->actor.world.pos.x; + this->collider.dim.pos.y = this->actor.world.pos.y; + this->collider.dim.pos.z = this->actor.world.pos.z; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); +} + +void EnRu_UpdateModel(EnRu* this, PlayState* play) { + Player* player = GET_PLAYER(play); + + SkelAnime_Update(&this->skelAnime); + + // Head and Torso tracking to Player if in front of Ru. + if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x2710, this->actor.yawTowardsPlayer)) { + Vec3f playerPos; + + playerPos.x = player->actor.world.pos.x; + playerPos.y = player->bodyPartsPos[7].y + 3.0f; + playerPos.z = player->actor.world.pos.z; + SubS_TrackPoint(&playerPos, &this->actor.focus.pos, &this->actor.shape.rot, &this->trackTarget, &this->headRot, + &this->torsoRot, &sTrackOptions); + + } else { // smooth her back to facing forward + Math_SmoothStepToS(&this->trackTarget.x, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->trackTarget.y, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->headRot.x, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->headRot.y, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->torsoRot.x, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->torsoRot.y, 0, 4, 0x3E8, 1); + } + + EnRu_UpdateEyes(this, 3); + EnRu_PlayWalkingSound(this, play); + SubS_FillLimbRotTables(play, this->limbRotTableY, this->limbRotTableZ, RU2_LIMB_MAX); +} + +void EnRu_DoNothing(EnRu* this, PlayState* play) { +} + +void EnRu_Init(Actor* thisx, PlayState* play) { + s32 pad; + EnRu* this = THIS; + + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gAdultRutoSkel, NULL, this->jointTable, this->morphTable, RU2_LIMB_MAX); + EnRu_ChangeAnim(&this->skelAnime, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + + this->path = SubS_GetPathByIndex(play, RU_GET_PATH(thisx), 0x3F); + Actor_SetScale(&this->actor, 0.01f); + this->actionFunc = EnRu_DoNothing; + this->actor.gravity = -4.0f; +} + +void EnRu_Destroy(Actor* thisx, PlayState* play) { + EnRu* this = THIS; + + Collider_DestroyCylinder(play, &this->collider); +} + +void EnRu_Update(Actor* thisx, PlayState* play) { + EnRu* this = THIS; + + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + EnRu_UpdateModel(this, play); + EnRu_UpdateCollider(this, play); +} + +s32 EnRu_OverrideLimbdraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + EnRu* this = THIS; + + if (limbIndex == RU2_LIMB_HEAD) { + Matrix_Translate(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_RotateXS(this->headRot.y, MTXMODE_APPLY); + Matrix_RotateZS(this->headRot.x, MTXMODE_APPLY); + Matrix_Translate(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } + + if (limbIndex == RU2_LIMB_TORSO) { + Matrix_RotateYS(this->torsoRot.y, MTXMODE_APPLY); + Matrix_RotateXS(this->torsoRot.x, MTXMODE_APPLY); + } + + if ((limbIndex == RU2_LIMB_TORSO) || (limbIndex == RU2_LIMB_LEFT_UPPER_ARM) || + (limbIndex == RU2_LIMB_RIGHT_UPPER_ARM)) { + rot->y += (s16)(Math_SinS(this->limbRotTableY[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->limbRotTableZ[limbIndex]) * 200.0f); + } + + return false; +} + +void EnRu_PostLimbdraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { + EnRu* this = THIS; + Vec3f headFocus = { 800.0f, 0, 0 }; + Vec3f bodyPartPos = { 0, 0, 0 }; + + if (sBodyPartPosIndices[limbIndex] >= 0) { + Matrix_MultVec3f(&bodyPartPos, &this->bodyPartsPos[sBodyPartPosIndices[limbIndex]]); + } + if (limbIndex == RU2_LIMB_HEAD) { + Matrix_MultVec3f(&headFocus, &thisx->focus.pos); + } + + if (limbIndex == RU2_LIMB_LEFT_FOOT) { + Matrix_MultVec3f(&bodyPartPos, &this->leftFootPos); + } + if (limbIndex == RU2_LIMB_RIGHT_FOOT) { + Matrix_MultVec3f(&bodyPartPos, &this->rightFootPos); + } +} + +// This is a copy of displaylist found in En_Zo +static Gfx sTransparencyDlist[] = { + gsDPSetRenderMode(AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + G_RM_FOG_SHADE_A, + AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)), + gsDPSetAlphaCompare(G_AC_THRESHOLD), + gsSPEndDisplayList(), +}; + +void EnRu_Draw(Actor* thisx, PlayState* play) { + EnRu* this = THIS; + u8* shadowTex = GRAPH_ALLOC(play->state.gfxCtx, SUBS_SHADOW_TEX_SIZE); + u8* shadowTexIter; + s32 i; + TexturePtr eyeTextures[] = { gAdultRutoEyeOpenTex, gAdultRutoEyeHalfTex, gAdultRutoEyeClosedTex }; + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C28C(play->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); + + gDPPipeSync(POLY_OPA_DISP++); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(eyeTextures[this->eyeState])); + + // only runs the last command of the display list, which is gsSPEndDisplayList + gSPSegment(POLY_OPA_DISP++, 0x0C, &sTransparencyDlist[2]); + + POLY_OPA_DISP = + SkelAnime_DrawFlex(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnRu_OverrideLimbdraw, EnRu_PostLimbdraw, &this->actor, POLY_OPA_DISP); + + Matrix_RotateXS(0, MTXMODE_NEW); + + for (i = 0, shadowTexIter = shadowTex; i < SUBS_SHADOW_TEX_SIZE; i++) { + *shadowTexIter++ = 0; + } + + for (i = 0; i < 5; i++) { + SubS_GenShadowTex(&this->bodyPartsPos[0], &this->actor.world.pos, shadowTex, (i / 5.0f), + (ARRAY_COUNT(sRuBodyParts)), sRuShadowSizes, sRuBodyParts); + } + + SubS_DrawShadowTex(&this->actor, &play->state, shadowTex); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Ru/z_en_ru.h b/src/overlays/actors/ovl_En_Ru/z_en_ru.h index 29c903aff..b1144f88d 100644 --- a/src/overlays/actors/ovl_En_Ru/z_en_ru.h +++ b/src/overlays/actors/ovl_En_Ru/z_en_ru.h @@ -2,15 +2,40 @@ #define Z_EN_RU_H #include "global.h" +#include "objects/object_ru2/object_ru2.h" + +#define RU_GET_PATH(thisx) ((thisx->params & 0x7E00) >> 9) struct EnRu; typedef void (*EnRuActionFunc)(struct EnRu*, PlayState*); +#define RU_BODYPARTSPOS_COUNT 15 + typedef struct EnRu { /* 0x000 */ Actor actor; /* 0x144 */ EnRuActionFunc actionFunc; - /* 0x148 */ char unk_148[0x30C]; + /* 0x148 */ SkelAnime skelAnime; + /* 0x18C */ ColliderCylinder collider; + /* 0x1D8 */ UNK_TYPE1 pad1D8[0x4]; + /* 0x1DC */ Path* path; // path is prepared in EnRu_Init, but unused after + /* 0x1E0 */ UNK_TYPE1 pad1E0[0x4]; + /* 0x1E4 */ Vec3f leftFootPos; + /* 0x1F0 */ Vec3f rightFootPos; + /* 0x1FC */ u8 isLeftFootGrounded; + /* 0x1FD */ u8 isRightFootGrounded; + /* 0x1FE */ Vec3s jointTable[RU2_LIMB_MAX]; + /* 0x288 */ Vec3s morphTable[RU2_LIMB_MAX]; + /* 0x312 */ Vec3s trackTarget; + /* 0x318 */ Vec3s headRot; + /* 0x31E */ Vec3s torsoRot; + /* 0x324 */ UNK_TYPE1 pad324[0x12]; + /* 0x336 */ s16 limbRotTableY[RU2_LIMB_MAX]; + /* 0x364 */ s16 limbRotTableZ[RU2_LIMB_MAX]; + /* 0x394 */ Vec3f bodyPartsPos[RU_BODYPARTSPOS_COUNT]; + /* 0x348 */ UNK_TYPE1 padUNK[6]; + /* 0x44E */ s16 eyeState; + /* 0x450 */ s16 blinkTimer; } EnRu; // size = 0x454 extern const ActorInit En_Ru_InitVars; diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 62cb638d9..d0c02e4fa 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -230,7 +230,7 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { this->unk_3D6 = ENSKB_GET_F0(&this->actor); this->actor.floorHeight = this->actor.world.pos.y; - if ((play->sceneNum == SCENE_BOTI) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_BOTI) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 0)) { this->actor.flags |= ACTOR_FLAG_100000; } diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index 6e7915539..408ca1b2f 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -654,7 +654,7 @@ void EnSsh_Init(Actor* thisx, PlayState* play) { this->actor.gravity = 0.0f; this->initialYaw = this->actor.world.rot.y; EnSsh_SetupAction(this, EnSsh_Start); - if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { + if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { Actor_MarkForDeath(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 4354e7f58..1d9ddf4e9 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -113,7 +113,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) { break; case ENSTH_F_2: - if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { + if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { this->actionFunc = func_80B67DA0; } else { Actor_MarkForDeath(&this->actor); @@ -148,7 +148,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) { break; case ENSTH_F_5: - if (!(gSaveContext.save.weekEventReg[13] & 0x20) || (Inventory_GetSkullTokenCount(play->sceneNum) < 30)) { + if (!(gSaveContext.save.weekEventReg[13] & 0x20) || (Inventory_GetSkullTokenCount(play->sceneId) < 30)) { Actor_MarkForDeath(&this->actor); return; } @@ -446,7 +446,7 @@ void func_80B67984(EnSth* this, PlayState* play) { sp1E = 0x918; } func_80B670A4(this, 2); - } else if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { + } else if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { if (INV_CONTENT(ITEM_MASK_TRUTH) == ITEM_MASK_TRUTH) { this->unk_29C |= 4; sp1E = 0x919; @@ -559,7 +559,7 @@ void func_80B67DA0(EnSth* this, PlayState* play) { void func_80B67E20(Actor* thisx, PlayState* play) { EnSth* this = THIS; - if (Inventory_GetSkullTokenCount(play->sceneNum) >= 30) { + if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) { this->actor.update = func_80B680A8; this->actor.draw = func_80B6849C; this->actor.flags |= ACTOR_FLAG_1; @@ -580,7 +580,7 @@ void EnSth_Update(Actor* thisx, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &ovl_En_Sth_Anim_0045B4); this->unk_29A = 1; if ((gSaveContext.save.weekEventReg[34] & 0x10) || (gSaveContext.save.weekEventReg[34] & 0x20) || - (gSaveContext.save.weekEventReg[34] & 0x40) || (Inventory_GetSkullTokenCount(play->sceneNum) >= 30)) { + (gSaveContext.save.weekEventReg[34] & 0x40) || (Inventory_GetSkullTokenCount(play->sceneId) >= 30)) { func_80B670A4(this, 3); } } else { @@ -610,7 +610,7 @@ void EnSth_Update(Actor* thisx, PlayState* play) { break; } - if ((ENSTH_GET_F(&this->actor) == ENSTH_F_4) && (Inventory_GetSkullTokenCount(play->sceneNum) < 30)) { + if ((ENSTH_GET_F(&this->actor) == ENSTH_F_4) && (Inventory_GetSkullTokenCount(play->sceneId) < 30)) { this->actor.update = func_80B67E20; this->actor.draw = NULL; this->actor.flags &= ~ACTOR_FLAG_1; diff --git a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c index ec412ce79..062422026 100644 --- a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c +++ b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c @@ -5,6 +5,7 @@ */ #include "z_en_stop_heishi.h" +#include "z64quake.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index fbacce266..bbce2ee6c 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -942,7 +942,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->morphTable, 16); this->actor.draw = EnSuttari_Draw; this->actor.flags |= ACTOR_FLAG_1; - if (play->sceneNum == SCENE_IKANA) { + if (play->sceneId == SCENE_IKANA) { this->flags1 |= 1; if (gSaveContext.save.day == 1 || gSaveContext.save.day == 2) { this->animIndex = 2; @@ -958,7 +958,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->actionFunc = func_80BACEE0; return; } - } else if (play->sceneNum == SCENE_BACKTOWN) { + } else if (play->sceneId == SCENE_BACKTOWN) { if (gSaveContext.save.time >= CLOCK_TIME(0, 20) && gSaveContext.save.time < CLOCK_TIME(6, 00)) { Actor_MarkForDeath(&this->actor); } @@ -974,7 +974,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = func_80BAD004; return; - } else if (play->sceneNum == SCENE_ICHIBA) { + } else if (play->sceneId == SCENE_ICHIBA) { if (gSaveContext.save.weekEventReg[33] & 8) { Actor_MarkForDeath(&this->actor); return; @@ -984,7 +984,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->flags1 |= 2; this->actionFunc = func_80BAD5F8; return; - } else if (play->sceneNum == SCENE_AYASHIISHOP) { + } else if (play->sceneId == SCENE_AYASHIISHOP) { if (gSaveContext.save.weekEventReg[33] & 8) { Actor_MarkForDeath(&this->actor); return; @@ -1461,7 +1461,7 @@ void EnSuttari_Init(Actor* thisx, PlayState* play) { void EnSuttari_Destroy(Actor* thisx, PlayState* play) { EnSuttari* this = THIS; - if ((play->sceneNum == SCENE_BACKTOWN) && !(this->flags2 & 4)) { + if ((play->sceneId == SCENE_BACKTOWN) && !(this->flags2 & 4)) { Audio_QueueSeqCmd(0x101400FF); } Collider_DestroyCylinder(play, &this->collider); diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c index 6b05f739d..f3bce9c4f 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.c @@ -83,7 +83,7 @@ void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { path = &play->setupPathList[path->unk1]; } - for (i = 0; i < EN_SYATEKI_CROW_GET_NUMBER(&this->actor); i++) { + for (i = 0; i < EN_SYATEKI_CROW_GET_INDEX(&this->actor); i++) { path = &play->setupPathList[path->unk1]; } @@ -95,7 +95,7 @@ void EnSyatekiCrow_Init(Actor* thisx, PlayState* play2) { this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); - if ((path == NULL) || (EN_SYATEKI_CROW_GET_NUMBER(&this->actor) >= 0x80)) { + if ((path == NULL) || (EN_SYATEKI_CROW_GET_INDEX(&this->actor) >= 0x80)) { Actor_MarkForDeath(&this->actor); return; } @@ -133,7 +133,7 @@ void EnSyatekiCrow_WaitForSpawn(EnSyatekiCrow* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->isActive == true) && - (syatekiMan->guayFlags & (1 << EN_SYATEKI_CROW_GET_NUMBER(&this->actor)))) { + (syatekiMan->guayFlags & (1 << EN_SYATEKI_CROW_GET_INDEX(&this->actor)))) { EnSyatekiCrow_SetupWaitToMove(this); } else if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { this->isActive = true; @@ -202,7 +202,7 @@ void EnSyatekiCrow_Fly(EnSyatekiCrow* this, PlayState* play) { this->currentPointIndex++; } else { this->isActive = false; - syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_NUMBER(&this->actor)); + syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_INDEX(&this->actor)); EnSyatekiCrow_SetupWaitForSpawn(this); } @@ -241,7 +241,7 @@ void EnSyatekiCrow_Dead(EnSyatekiCrow* this, PlayState* play) { if (this->deathTimer > 20) { func_800B3030(play, &this->actor.world.pos, &sZeroVec, &sZeroVec, this->actor.scale.x * 10000.0f, 0, 0); syatekiMan->guayHitCounter++; - syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_NUMBER(&this->actor)); + syatekiMan->guayFlags &= ~(1 << EN_SYATEKI_CROW_GET_INDEX(&this->actor)); EnSyatekiCrow_SetupWaitForSpawn(this); } diff --git a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h index e70a3dd21..f7a876285 100644 --- a/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h +++ b/src/overlays/actors/ovl_En_Syateki_Crow/z_en_syateki_crow.h @@ -6,8 +6,8 @@ #define EN_SYATEKI_CROW_GET_WAIT_MOD(thisx) ((thisx)->params & 0xF) #define EN_SYATEKI_CROW_GET_SPEED_MOD(thisx) (((thisx)->params & 0xF0) >> 4) -#define EN_SYATEKI_CROW_GET_NUMBER(thisx) (((thisx)->params & 0xFF00) >> 8) -#define EN_SYATEKI_CROW_PARAMS(number, speedMod, waitMod) (((number << 8) & 0xFF00) | ((speedMod << 4) & 0xF0) | (waitMod & 0xF)) +#define EN_SYATEKI_CROW_GET_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) +#define EN_SYATEKI_CROW_PARAMS(index, speedMod, waitMod) (((index << 8) & 0xFF00) | ((speedMod << 4) & 0xF0) | (waitMod & 0xF)) struct EnSyatekiCrow; diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c index 1d504dc62..5e6f5925a 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.c @@ -17,22 +17,27 @@ void EnSyatekiDekunuts_Destroy(Actor* thisx, PlayState* play); void EnSyatekiDekunuts_Update(Actor* thisx, PlayState* play); void EnSyatekiDekunuts_Draw(Actor* thisx, PlayState* play); -void func_80A2BE54(EnSyatekiDekunuts* this); -void func_80A2BF18(EnSyatekiDekunuts* this, PlayState* play); -void func_80A2BFC4(EnSyatekiDekunuts* this); -void func_80A2C0F8(EnSyatekiDekunuts* this, PlayState* play); -void func_80A2C150(EnSyatekiDekunuts* this); -void func_80A2C168(EnSyatekiDekunuts* this, PlayState* play); -void func_80A2C1AC(EnSyatekiDekunuts* this); -void func_80A2C208(EnSyatekiDekunuts* this, PlayState* play); -void func_80A2C27C(EnSyatekiDekunuts* this); -void func_80A2C2E0(EnSyatekiDekunuts* this, PlayState* play); -void func_80A2C33C(EnSyatekiDekunuts* this, PlayState* play); -void func_80A2C3AC(EnSyatekiDekunuts* this); -void func_80A2C3F0(EnSyatekiDekunuts* this, PlayState* play); -void func_80A2C478(EnSyatekiDekunuts* this); -void func_80A2C48C(EnSyatekiDekunuts* this, PlayState* play); -void func_80A2C5DC(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_SetupWaitForSpawn(EnSyatekiDekunuts* this); +void EnSyatekiDekunuts_WaitForSpawn(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_SetupSpawn(EnSyatekiDekunuts* this); +void EnSyatekiDekunuts_Spawn(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_SetupWaitToEmerge(EnSyatekiDekunuts* this); +void EnSyatekiDekunuts_WaitToEmerge(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_SetupEmerge(EnSyatekiDekunuts* this); +void EnSyatekiDekunuts_Emerge(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_SetupLookAround(EnSyatekiDekunuts* this); +void EnSyatekiDekunuts_LookAround(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_BonusLookAround(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_SetupBurrow(EnSyatekiDekunuts* this); +void EnSyatekiDekunuts_Burrow(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_SetupGameEnd(EnSyatekiDekunuts* this); +void EnSyatekiDekunuts_GameEnd(EnSyatekiDekunuts* this, PlayState* play); +void EnSyatekiDekunuts_Dead(EnSyatekiDekunuts* this, PlayState* play); + +typedef enum { + /* 0 */ EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_NORMAL, + /* 1 */ EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_FLIPPED_UP, +} EnSyatekiDekunutsHeaddressType; const ActorInit En_Syateki_Dekunuts_InitVars = { ACTOR_EN_SYATEKI_DEKUNUTS, @@ -66,7 +71,17 @@ static ColliderCylinderInit sCylinderInit = { { 48, 80, 0, { 0, 0, 0 } }, }; -static Cylinder16 D_80A2CADC[] = { { 24, 40, 0, { 0, 0, 0 } } }; +static Cylinder16 sBonusDekuScrubColliderDimensions[] = { { 24, 40, 0, { 0, 0, 0 } } }; + +typedef enum { + /* 0 */ EN_SYATEKI_DEKUNUTS_ANIM_UP, + /* 1 */ EN_SYATEKI_DEKUNUTS_ANIM_BURROW, + /* 2 */ EN_SYATEKI_DEKUNUTS_ANIM_IDLE, // unused + /* 3 */ EN_SYATEKI_DEKUNUTS_ANIM_LOOK_AROUND, + /* 4 */ EN_SYATEKI_DEKUNUTS_ANIM_DAMAGE, + /* 5 */ EN_SYATEKI_DEKUNUTS_ANIM_DIE, + /* 6 */ EN_SYATEKI_DEKUNUTS_ANIM_UNBURROW, // unused +} EnSyatekiDekunutsAnimation; static AnimationInfo sAnimationInfo[] = { { &gDekuScrubUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, @@ -85,10 +100,10 @@ static InitChainEntry sInitChain[] = { }; void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2) { - static s32 D_80A2CB9C = 1; + static s32 sDrawFlowers = true; // This makes it so only one EnSyatekiDekunuts draws all the flowers. EnSyatekiDekunuts* this = THIS; PlayState* play = play2; - s32 phi_v0; + s32 unkPathComparison; Path* path; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; s32 i; @@ -97,16 +112,16 @@ void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) == 1) { + if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) == EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { Actor_SetScale(&this->actor, 0.01f); - this->collider.dim = D_80A2CADC[0]; - phi_v0 = 3; + this->collider.dim = sBonusDekuScrubColliderDimensions[0]; + unkPathComparison = 3; } else { Actor_SetScale(&this->actor, 0.02f); - phi_v0 = 1; + unkPathComparison = 1; } - while (path->unk2 != phi_v0) { + while (path->unk2 != unkPathComparison) { path = &play->setupPathList[path->unk1]; } @@ -114,29 +129,30 @@ void EnSyatekiDekunuts_Init(Actor* thisx, PlayState* play2) { path = &play->setupPathList[path->unk1]; } - if (D_80A2CB9C == 1) { - this->unk_1EC = 1; - D_80A2CB9C = 0; + if (sDrawFlowers == true) { + this->shouldDrawFlowers = true; + sDrawFlowers = false; } else { - this->unk_1EC = 0; + this->shouldDrawFlowers = false; } Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); SkelAnime_Init(play, &this->skelAnime, &gDekuScrubSkel, &gDekuScrubBurrowAnim, this->jointTable, this->morphTable, DEKU_SCRUB_LIMB_MAX); + if (path == NULL) { Actor_MarkForDeath(&this->actor); return; } - this->unk_1E4 = Lib_SegmentedToVirtual(path->points); - this->unk_1E8 = EN_SYATEKI_DEKUNUTS_GET_NUMBER(&this->actor); - this->unk_1EA = path->count; - this->unk_1D8 = 0; + this->flowerPos = Lib_SegmentedToVirtual(path->points); + this->index = EN_SYATEKI_DEKUNUTS_GET_INDEX(&this->actor); + this->flowerCount = path->count; + this->timer = 0; this->unk_1DC = 0; - this->unk_1DA = 0; - func_80A2BE54(this); + this->waitTimer = 0; + EnSyatekiDekunuts_SetupWaitForSpawn(this); } void EnSyatekiDekunuts_Destroy(Actor* thisx, PlayState* play) { @@ -145,7 +161,7 @@ void EnSyatekiDekunuts_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80A2BE54(EnSyatekiDekunuts* this) { +void EnSyatekiDekunuts_SetupWaitForSpawn(EnSyatekiDekunuts* this) { Animation_PlayOnceSetSpeed(&this->skelAnime, &gDekuScrubUpAnim, 0.0f); this->actor.speedXZ = 0.0f; @@ -153,218 +169,252 @@ void func_80A2BE54(EnSyatekiDekunuts* this) { this->actor.prevPos = this->actor.home.pos; this->actor.shape.rot = this->actor.world.rot; - this->unk_1D8 = 0; + this->timer = 0; this->unk_1DC = 0; - if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) != 1) { - this->unk_1E2 = 1; + if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) != EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { + this->isAlive = true; } - this->actionFunc = func_80A2BF18; + this->actionFunc = EnSyatekiDekunuts_WaitForSpawn; } -void func_80A2BF18(EnSyatekiDekunuts* this, PlayState* play) { +/** + * Waits until the shooting gallery man sets the appropriate Deku Scrub flag to spawn. + */ +void EnSyatekiDekunuts_WaitForSpawn(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->unk_1E2 == 1) && - ((syatekiMan->dekuScrubFlags & (1 << this->unk_1E8)) != 0)) { - func_80A2BFC4(this); + if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->isAlive == true) && + (syatekiMan->dekuScrubFlags & (1 << this->index))) { + EnSyatekiDekunuts_SetupSpawn(this); } else if (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING) { - this->unk_1E2 = 1; + this->isAlive = true; } - if ((syatekiMan->dekuScrubFlags == 0) && (syatekiMan->guayFlags == 0) && - (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) != 1)) { - this->unk_1E2 = 1; + if (!syatekiMan->dekuScrubFlags && !syatekiMan->guayFlags && + (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) != EN_SYATEKI_DEKUNUTS_TYPE_BONUS)) { + this->isAlive = true; } } -void func_80A2BFC4(EnSyatekiDekunuts* this) { - Vec3f sp14; +/** + * Positions the Deku Scrub to match up with its flower, then sets it up to start waiting. + */ +void EnSyatekiDekunuts_SetupSpawn(EnSyatekiDekunuts* this) { + Vec3f pos; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - this->unk_1D8 = 0; - sp14.x = this->unk_1E4[this->unk_1E8].x; - sp14.y = this->unk_1E4[this->unk_1E8].y; - sp14.z = this->unk_1E4[this->unk_1E8].z; - this->actor.world.pos = this->actor.prevPos = sp14; + this->timer = 0; + pos.x = this->flowerPos[this->index].x; + pos.y = this->flowerPos[this->index].y; + pos.z = this->flowerPos[this->index].z; + this->actor.world.pos = this->actor.prevPos = pos; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->unk_1EE = 140 - (syatekiMan->currentWave * 20); + this->timeToBurrow = 140 - (syatekiMan->currentWave * 20); - if ((syatekiMan->currentWave & 1) != 0) { - this->unk_1F0 = 1; - this->unk_1F2 = 0; + if ((syatekiMan->currentWave % 2) != 0) { + this->headdressType = EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_FLIPPED_UP; + this->headdressRotZ = 0; } else { - this->unk_1F0 = 0; + this->headdressType = EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_NORMAL; } - this->actionFunc = func_80A2C0F8; + this->actionFunc = EnSyatekiDekunuts_Spawn; } -void func_80A2C0F8(EnSyatekiDekunuts* this, PlayState* play) { +/** + * Waits 20 frames, then plays a sound and starts the process of making the Deku Scrubs emerge. + */ +void EnSyatekiDekunuts_Spawn(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan; - if (this->unk_1DA > 20) { + if (this->waitTimer > 20) { syatekiMan = (EnSyatekiMan*)this->actor.parent; Actor_PlaySfxAtPos(&syatekiMan->actor, NA_SE_EN_NUTS_DAMAGE); - this->unk_1DA = 0; - func_80A2C150(this); + this->waitTimer = 0; + EnSyatekiDekunuts_SetupWaitToEmerge(this); } else { - this->unk_1DA++; + this->waitTimer++; } } -void func_80A2C150(EnSyatekiDekunuts* this) { - this->unk_1D8 = 0; - this->actionFunc = func_80A2C168; +void EnSyatekiDekunuts_SetupWaitToEmerge(EnSyatekiDekunuts* this) { + this->timer = 0; + this->actionFunc = EnSyatekiDekunuts_WaitToEmerge; } -void func_80A2C168(EnSyatekiDekunuts* this, PlayState* play) { - if (this->unk_1DA > 20) { - func_80A2C1AC(this); - this->unk_1DA = 0; +/** + * Waits 20 frames, then makes the Deku Scrubs emerge from underground. + */ +void EnSyatekiDekunuts_WaitToEmerge(EnSyatekiDekunuts* this, PlayState* play) { + if (this->waitTimer > 20) { + EnSyatekiDekunuts_SetupEmerge(this); + this->waitTimer = 0; } else { - this->unk_1DA++; + this->waitTimer++; } } -void func_80A2C1AC(EnSyatekiDekunuts* this) { +void EnSyatekiDekunuts_SetupEmerge(EnSyatekiDekunuts* this) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_UP); this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->actionFunc = func_80A2C208; + this->actionFunc = EnSyatekiDekunuts_Emerge; } -void func_80A2C208(EnSyatekiDekunuts* this, PlayState* play) { +/** + * Waits until the animation for coming out of the ground is done playing, then makes the + * Deku Scrubs look around. If the headdress should be flipped up, then this will also + * adjust the headdress's rotation. + */ +void EnSyatekiDekunuts_Emerge(EnSyatekiDekunuts* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_80A2C27C(this); + EnSyatekiDekunuts_SetupLookAround(this); } - if (this->unk_1F0 == 1) { - Math_SmoothStepToS(&this->unk_1F2, -0x8000, 5, 0x1000, 0x100); + if (this->headdressType == EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_FLIPPED_UP) { + Math_SmoothStepToS(&this->headdressRotZ, -0x8000, 5, 0x1000, 0x100); } - this->unk_1D8++; + this->timer++; } -void func_80A2C27C(EnSyatekiDekunuts* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); - if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) != 1) { - this->actionFunc = func_80A2C2E0; +void EnSyatekiDekunuts_SetupLookAround(EnSyatekiDekunuts* this) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_LOOK_AROUND); + if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) != EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { + this->actionFunc = EnSyatekiDekunuts_LookAround; } else { - this->actionFunc = func_80A2C33C; + this->actionFunc = EnSyatekiDekunuts_BonusLookAround; } } -void func_80A2C2E0(EnSyatekiDekunuts* this, PlayState* play) { +/** + * Looks around back and forth until the timer reaches the time to burrow or until the game ends. + * No matter which occurs, the Deku Scrubs burrow underground afterwards. + */ +void EnSyatekiDekunuts_LookAround(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if ((this->unk_1EE < this->unk_1D8) || (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING)) { - func_80A2C3AC(this); + if ((this->timeToBurrow < this->timer) || (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING)) { + EnSyatekiDekunuts_SetupBurrow(this); } - this->unk_1D8++; + this->timer++; } -void func_80A2C33C(EnSyatekiDekunuts* this, PlayState* play) { +/** + * Looks around back and forth until the game ends, then burrow underground afterwards. + */ +void EnSyatekiDekunuts_BonusLookAround(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; + // There are some cases where the minigame timer can reach 0, but the shooting game state is + // still SG_GAME_STATE_RUNNING. This check just makes absolutely sure that once the game is + // over, these Deku Scrubs will burrow. if ((gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] <= SECONDS_TO_TIMER(0)) || (syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING)) { - func_80A2C3AC(this); + EnSyatekiDekunuts_SetupBurrow(this); } - if (this->unk_1D8 < 11) { - this->unk_1D8++; + if (this->timer <= 10) { + this->timer++; } } -void func_80A2C3AC(EnSyatekiDekunuts* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); - this->actionFunc = func_80A2C3F0; +void EnSyatekiDekunuts_SetupBurrow(EnSyatekiDekunuts* this) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_BURROW); + this->actionFunc = EnSyatekiDekunuts_Burrow; } -void func_80A2C3F0(EnSyatekiDekunuts* this, PlayState* play) { +/** + * Burrow underground. After 160 frames have passed since the Deku Scrub first emerged *and* + * after the burrowing animation is complete, this sets up the Deku Scrub to emerge again. + */ +void EnSyatekiDekunuts_Burrow(EnSyatekiDekunuts* this, PlayState* play) { EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if (syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) { - if (this->unk_1D8 > 160 && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - this->unk_1D8 = 0; - func_80A2C150(this); + if ((this->timer > 160) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + this->timer = 0; + EnSyatekiDekunuts_SetupWaitToEmerge(this); } else { - this->unk_1D8++; + this->timer++; } } else { - func_80A2C478(this); + EnSyatekiDekunuts_SetupGameEnd(this); } } -void func_80A2C478(EnSyatekiDekunuts* this) { - this->actionFunc = func_80A2C48C; +void EnSyatekiDekunuts_SetupGameEnd(EnSyatekiDekunuts* this) { + this->actionFunc = EnSyatekiDekunuts_GameEnd; } -void func_80A2C48C(EnSyatekiDekunuts* this, PlayState* play) { - if (this->unk_1DA > 20) { - func_80A2BE54(this); - this->unk_1DA = 0; +/** + * Waits 20 frames, then resets the Deku Scrub back to its initial state. + */ +void EnSyatekiDekunuts_GameEnd(EnSyatekiDekunuts* this, PlayState* play) { + if (this->waitTimer > 20) { + EnSyatekiDekunuts_SetupWaitForSpawn(this); + this->waitTimer = 0; } else { - this->unk_1DA++; + this->waitTimer++; } } -void func_80A2C4D0(EnSyatekiDekunuts* this, PlayState* play) { - static Vec3f D_80A2CBA0 = { 0.0f, 20.0f, 0.0f }; - static Vec3f D_80A2CBAC = { 0.0f, 0.0f, 0.0f }; +void EnSyatekiDekunuts_SetupDead(EnSyatekiDekunuts* this, PlayState* play) { + static Vec3f sVelocity = { 0.0f, 20.0f, 0.0f }; + static Vec3f sAccel = { 0.0f, 0.0f, 0.0f }; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; - if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) == 1) { - EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A2CBA0, &D_80A2CBAC, 5, 2); + if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) == EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, 2); syatekiMan->score += 100; syatekiMan->perGameVar2.bonusDekuScrubHitCounter++; } else { - EffectSsExtra_Spawn(play, &this->actor.world.pos, &D_80A2CBA0, &D_80A2CBAC, 5, 0); + EffectSsExtra_Spawn(play, &this->actor.world.pos, &sVelocity, &sAccel, 5, 0); syatekiMan->score += 30; syatekiMan->dekuScrubHitCounter++; } Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DAMAGE); - this->unk_1E2 = 0; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 4); - this->unk_1D8 = 160; - this->actionFunc = func_80A2C5DC; + this->isAlive = false; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_DAMAGE); + this->timer = 160; + this->actionFunc = EnSyatekiDekunuts_Dead; } -void func_80A2C5DC(EnSyatekiDekunuts* this, PlayState* play) { - static Color_RGBA8 D_80A2CBB8 = { 255, 255, 255, 255 }; - static Color_RGBA8 D_80A2CBBC = { 150, 150, 150, 0 }; +void EnSyatekiDekunuts_Dead(EnSyatekiDekunuts* this, PlayState* play) { + static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 }; + static Color_RGBA8 sEnvColor = { 150, 150, 150, 0 }; EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent; if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - if (this->unk_1D8 == 160) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 5); + if (this->timer == 160) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_DEKUNUTS_ANIM_DIE); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DEAD); - this->unk_1D8--; - } else if (this->unk_1D8 < 160) { - Vec3f sp40; + this->timer--; + } else if (this->timer < 160) { + Vec3f pos; - sp40.x = this->actor.world.pos.x; - sp40.y = this->actor.world.pos.y + 18.0f; - sp40.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(play, &sp40, &gZeroVec3f, &gZeroVec3f, &D_80A2CBB8, &D_80A2CBBC, 200, 0, 13); + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + 18.0f; + pos.z = this->actor.world.pos.z; + EffectSsDeadDb_Spawn(play, &pos, &gZeroVec3f, &gZeroVec3f, &sPrimColor, &sEnvColor, 200, 0, 13); SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_EXTINCT); - sp40.y = this->actor.world.pos.y + 10.0f; - EffectSsHahen_SpawnBurst(play, &sp40, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + pos.y = this->actor.world.pos.y + 10.0f; + EffectSsHahen_SpawnBurst(play, &pos, 3.0f, 0, 12, 3, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); - if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) != 1) { - syatekiMan->dekuScrubFlags &= ~(1 << this->unk_1E8); + if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) != EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { + syatekiMan->dekuScrubFlags &= ~(1 << this->index); } - func_80A2BE54(this); + EnSyatekiDekunuts_SetupWaitForSpawn(this); } - } else if (this->unk_1D8 < 160) { - this->unk_1D8--; + } else if (this->timer < 160) { + this->timer--; } } @@ -374,16 +424,17 @@ void EnSyatekiDekunuts_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); - if ((this->actionFunc != func_80A2BF18) && (this->unk_1D8 < this->unk_1EE) && (this->unk_1D8 > 10)) { - if ((this->collider.base.acFlags & AC_HIT) && (this->unk_1E2 == 1)) { - if (EN_SYATEKI_DEKUNUTS_GET_PARAM_F(&this->actor) == 1) { - func_801A3098(NA_BGM_GET_ITEM | 0x900); + if ((this->actionFunc != EnSyatekiDekunuts_WaitForSpawn) && (this->timer < this->timeToBurrow) && + (this->timer > 10)) { + if ((this->collider.base.acFlags & AC_HIT) && (this->isAlive == true)) { + if (EN_SYATEKI_DEKUNUTS_GET_TYPE(&this->actor) == EN_SYATEKI_DEKUNUTS_TYPE_BONUS) { + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); } else { play_sound(NA_SE_SY_TRE_BOX_APPEAR); } this->collider.base.acFlags &= ~AC_HIT; - func_80A2C4D0(this, play); + EnSyatekiDekunuts_SetupDead(this, play); } Collider_UpdateCylinder(&this->actor, &this->collider); @@ -399,8 +450,9 @@ s32 EnSyatekiDekunuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dLi Actor* thisx) { EnSyatekiDekunuts* this = THIS; - if ((limbIndex == DEKU_SCRUB_LIMB_HEADDRESS) && (this->unk_1F0 == 1)) { - rot->z += this->unk_1F2; + if ((limbIndex == DEKU_SCRUB_LIMB_HEADDRESS) && + (this->headdressType == EN_SYATEKI_DEKUNUTS_HEADDRESS_TYPE_FLIPPED_UP)) { + rot->z += this->headdressRotZ; } return false; @@ -408,24 +460,24 @@ s32 EnSyatekiDekunuts_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dLi void EnSyatekiDekunuts_Draw(Actor* thisx, PlayState* play) { EnSyatekiDekunuts* this = THIS; - Vec3f temp_f20; + Vec3f flowerPos; s32 i; - if (this->actionFunc != func_80A2BF18) { + if (this->actionFunc != EnSyatekiDekunuts_WaitForSpawn) { SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSyatekiDekunuts_OverrideLimbDraw, NULL, &this->actor); } - if (this->unk_1EC == 1) { - for (i = 0; i < this->unk_1EA; i++) { - temp_f20.x = this->unk_1E4[i].x; - temp_f20.y = this->unk_1E4[i].y; - temp_f20.z = this->unk_1E4[i].z; + if (this->shouldDrawFlowers == true) { + for (i = 0; i < this->flowerCount; i++) { + flowerPos.x = this->flowerPos[i].x; + flowerPos.y = this->flowerPos[i].y; + flowerPos.z = this->flowerPos[i].z; OPEN_DISPS(play->state.gfxCtx); func_8012C28C(play->state.gfxCtx); - Matrix_Translate(temp_f20.x, temp_f20.y, temp_f20.z, MTXMODE_NEW); + Matrix_Translate(flowerPos.x, flowerPos.y, flowerPos.z, MTXMODE_NEW); Matrix_Scale(0.02f, 0.02f, 0.02f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuScrubFlowerDL); diff --git a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h index 447dcaee7..51baf398f 100644 --- a/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h +++ b/src/overlays/actors/ovl_En_Syateki_Dekunuts/z_en_syateki_dekunuts.h @@ -4,10 +4,15 @@ #include "global.h" #include "objects/object_dekunuts/object_dekunuts.h" -#define EN_SYATEKI_DEKUNUTS_GET_PARAM_F(thisx) ((thisx)->params & 0xF) -#define EN_SYATEKI_DEKUNUTS_GET_NUMBER(thisx) (((thisx)->params & 0xF0) >> 4) +#define EN_SYATEKI_DEKUNUTS_GET_TYPE(thisx) ((thisx)->params & 0xF) +#define EN_SYATEKI_DEKUNUTS_GET_INDEX(thisx) (((thisx)->params & 0xF0) >> 4) #define EN_SYATEKI_DEKUNUTS_GET_PARAM_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) -#define EN_SYATEKI_DEKUNUTS_PARAMS(unkFF00, number, unkF) (((unkFF00 << 8) & 0xFF00) | ((number << 4) & 0xF0) | (unkF & 0xF)) +#define EN_SYATEKI_DEKUNUTS_PARAMS(unkFF00, index, type) (((unkFF00 << 8) & 0xFF00) | ((index << 4) & 0xF0) | (type & 0xF)) + +typedef enum { + /* 0 */ EN_SYATEKI_DEKUNUTS_TYPE_NORMAL, // Worth 30 points + /* 1 */ EN_SYATEKI_DEKUNUTS_TYPE_BONUS, // Worth 100 points +} EnSyatekiDekunutsType; struct EnSyatekiDekunuts; @@ -18,18 +23,18 @@ typedef struct EnSyatekiDekunuts { /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ EnSyatekiDekunutsActionFunc actionFunc; /* 0x18C */ ColliderCylinder collider; - /* 0x1D8 */ s16 unk_1D8; - /* 0x1DA */ s16 unk_1DA; - /* 0x1CD */ s16 unk_1DC; + /* 0x1D8 */ s16 timer; + /* 0x1DA */ s16 waitTimer; + /* 0x1CD */ s16 unk_1DC; // Initialized, but never used /* 0x1DE */ UNK_TYPE1 unk_1DE[0x4]; - /* 0x1E2 */ s16 unk_1E2; - /* 0x1E4 */ Vec3s* unk_1E4; - /* 0x1E8 */ s16 unk_1E8; - /* 0x1EA */ s16 unk_1EA; - /* 0x1EC */ s16 unk_1EC; - /* 0x1EE */ s16 unk_1EE; - /* 0x1F0 */ s16 unk_1F0; - /* 0x1F2 */ s16 unk_1F2; + /* 0x1E2 */ s16 isAlive; + /* 0x1E4 */ Vec3s* flowerPos; + /* 0x1E8 */ s16 index; + /* 0x1EA */ s16 flowerCount; + /* 0x1EC */ s16 shouldDrawFlowers; + /* 0x1EE */ s16 timeToBurrow; + /* 0x1F0 */ s16 headdressType; + /* 0x1F2 */ s16 headdressRotZ; /* 0x1F4 */ Vec3s jointTable[DEKU_SCRUB_LIMB_MAX]; /* 0x230 */ Vec3s morphTable[DEKU_SCRUB_LIMB_MAX]; /* 0x26C */ UNK_TYPE1 unk_26C[0x4]; diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index b47067bed..ffd41671a 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -103,13 +103,20 @@ typedef struct { static SwampTargetActorEntry sNormalSwampTargetActorList[] = { { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_WF_PARAMS(1, 3, 0) }, { ACTOR_EN_SYATEKI_WF, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_WF_PARAMS(0, 2, 0) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, 0) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, 0) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 2, 0) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 3, 0) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 4, 0) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, 1) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, 1) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, + EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, EN_SYATEKI_DEKUNUTS_TYPE_NORMAL) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, + EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, EN_SYATEKI_DEKUNUTS_TYPE_NORMAL) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, + EN_SYATEKI_DEKUNUTS_PARAMS(0, 2, EN_SYATEKI_DEKUNUTS_TYPE_NORMAL) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, + EN_SYATEKI_DEKUNUTS_PARAMS(0, 3, EN_SYATEKI_DEKUNUTS_TYPE_NORMAL) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, + EN_SYATEKI_DEKUNUTS_PARAMS(0, 4, EN_SYATEKI_DEKUNUTS_TYPE_NORMAL) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, + EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, EN_SYATEKI_DEKUNUTS_TYPE_BONUS) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, + EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, EN_SYATEKI_DEKUNUTS_TYPE_BONUS) }, { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(0, 0, 0) }, { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(1, 0, 0) }, { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(2, 0, 0) }, @@ -129,8 +136,10 @@ static SwampTargetActorEntry sNormalSwampTargetActorList[] = { static SwampTargetActorEntry sUnusedSwampTargetActorList[] = { { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(0, 0, 0) }, { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(1, 0, 0) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, 1) }, - { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, 1) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, + EN_SYATEKI_DEKUNUTS_PARAMS(0, 0, EN_SYATEKI_DEKUNUTS_TYPE_BONUS) }, + { ACTOR_EN_SYATEKI_DEKUNUTS, -1000.0f, 200.0f, -700.0f, + EN_SYATEKI_DEKUNUTS_PARAMS(0, 1, EN_SYATEKI_DEKUNUTS_TYPE_BONUS) }, { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(2, 0, 2) }, { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(3, 0, 2) }, { ACTOR_EN_SYATEKI_CROW, -1000.0f, 200.0f, -700.0f, EN_SYATEKI_CROW_PARAMS(0, 0, 3) }, @@ -179,7 +188,7 @@ void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { this->actor.targetMode = 1; Actor_SetScale(&this->actor, 0.01f); - if (play->sceneNum == SCENE_SYATEKI_MORI) { + if (play->sceneId == SCENE_SYATEKI_MORI) { SkelAnime_InitFlex(play, &this->skelAnime, &gBurlyGuySkel, &gSwampShootingGalleryManHeadScratchLoopAnim, this->jointTable, this->morphTable, BURLY_GUY_LIMB_MAX); } else { @@ -205,7 +214,7 @@ void EnSyatekiMan_Init(Actor* thisx, PlayState* play) { this->eyeIndex = 0; this->blinkTimer = 0; - if (play->sceneNum == SCENE_SYATEKI_MORI) { + if (play->sceneId == SCENE_SYATEKI_MORI) { this->path = path; EnSyatekiMan_Swamp_SpawnTargetActors(this, play, sSwampTargetActorLists[this->swampTargetActorListIndex], actorListLength); @@ -247,9 +256,9 @@ s32 EnSyatekiMan_MovePlayerToPos(PlayState* play, Vec3f pos) { } void EnSyatekiMan_SetupIdle(EnSyatekiMan* this, PlayState* play) { - if (play->sceneNum == SCENE_SYATEKI_MORI) { + if (play->sceneId == SCENE_SYATEKI_MORI) { this->actionFunc = EnSyatekiMan_Swamp_Idle; - } else if (play->sceneNum == SCENE_SYATEKI_MIZU) { + } else if (play->sceneId == SCENE_SYATEKI_MIZU) { this->actionFunc = EnSyatekiMan_Town_Idle; } } @@ -395,7 +404,7 @@ void EnSyatekiMan_Swamp_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) func_80123F2C(play, 80); this->shootingGameState = SG_GAME_STATE_RUNNING; this->actionFunc = EnSyatekiMan_Swamp_StartGame; - func_801A2BB8(NA_BGM_MINI_GAME_2); + func_801A2BB8(NA_BGM_TIMED_MINI_GAME); break; case 0xA32: // You have to try harder! @@ -753,7 +762,7 @@ void EnSyatekiMan_Town_HandleNormalMessage(EnSyatekiMan* this, PlayState* play) Interface_InitMinigame(play); func_80123F2C(play, 0x63); this->shootingGameState = SG_GAME_STATE_RUNNING; - func_801A2BB8(NA_BGM_MINI_GAME_2); + func_801A2BB8(NA_BGM_TIMED_MINI_GAME); this->actionFunc = EnSyatekiMan_Town_StartGame; break; @@ -1349,7 +1358,7 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) { func_801A2C20(); this->actionFunc = EnSyatekiMan_Town_EndGame; if (this->score == 50) { - func_801A3098(NA_BGM_GET_ITEM | 0x900); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); Interface_SetMinigamePerfect(play, MINIGAME_PERFECT_TYPE_1); } } @@ -1447,7 +1456,7 @@ void EnSyatekiMan_Update(Actor* thisx, PlayState* play) { s32 EnSyatekiMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnSyatekiMan* this = THIS; - if ((play->sceneNum == SCENE_SYATEKI_MIZU) && (limbIndex == BURLY_GUY_LIMB_HEAD)) { + if ((play->sceneId == SCENE_SYATEKI_MIZU) && (limbIndex == BURLY_GUY_LIMB_HEAD)) { *dList = gTownShootingGalleryManHeadDL; } @@ -1481,7 +1490,7 @@ void EnSyatekiMan_Draw(Actor* thisx, PlayState* play) { EnSyatekiMan* this = THIS; s32 pad; - if (play->sceneNum == SCENE_SYATEKI_MIZU) { + if (play->sceneId == SCENE_SYATEKI_MIZU) { sEyeTextures[0] = gTownShootingGalleryManEyeOpenTex; sEyeTextures[1] = gTownShootingGalleryManEyeClosedTex; sEyeTextures[2] = gTownShootingGalleryManEyeClosedTex; diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index 647b21182..c9caedf01 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -151,7 +151,7 @@ void EnSyatekiWf_Init(Actor* thisx, PlayState* play) { path = &play->setupPathList[path->unk1]; } - for (i = 0; i < EN_SYATEKI_WF_GET_NUMBER(&this->actor); i++) { + for (i = 0; i < EN_SYATEKI_WF_GET_INDEX(&this->actor); i++) { path = &play->setupPathList[path->unk1]; } @@ -224,7 +224,7 @@ void func_80A201CC(EnSyatekiWf* this) { this->actor.draw = NULL; this->unk_2A4 = 1; this->unk_298 = 0; - syatekiMan->wolfosFlags &= ~(1 << EN_SYATEKI_WF_GET_NUMBER(&this->actor)); + syatekiMan->wolfosFlags &= ~(1 << EN_SYATEKI_WF_GET_INDEX(&this->actor)); this->actionFunc = func_80A20284; } @@ -236,7 +236,7 @@ void func_80A20284(EnSyatekiWf* this, PlayState* play) { if ((syatekiMan->shootingGameState == SG_GAME_STATE_RUNNING) && (this->unk_298 == 1)) { func_80A200E0(this); func_80A2030C(this); - } else if (syatekiMan->wolfosFlags & (1 << EN_SYATEKI_WF_GET_NUMBER(&this->actor))) { + } else if (syatekiMan->wolfosFlags & (1 << EN_SYATEKI_WF_GET_INDEX(&this->actor))) { this->unk_298 = 1; } } @@ -424,7 +424,7 @@ void EnSyatekiWf_Update(Actor* thisx, PlayState* play2) { this->unk_34C.base.acFlags &= ~AC_HIT; this->actor.colChkInfo.health -= 2; if (this->actor.colChkInfo.health == 0) { - func_801A3098(NA_BGM_GET_ITEM | 0x900); + Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900); func_80A20858(this, play); } else { play_sound(NA_SE_SY_TRE_BOX_APPEAR); diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h index 4de182a10..9e01dca3d 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.h @@ -5,8 +5,8 @@ #include "objects/object_wf/object_wf.h" #define EN_SYATEKI_WF_GET_PARAM_F0(thisx) (((thisx)->params & 0xF0) >> 4) -#define EN_SYATEKI_WF_GET_NUMBER(thisx) (((thisx)->params & 0xFF00) >> 8) -#define EN_SYATEKI_WF_PARAMS(number, unkF0, unused) (((number << 8) & 0xFF00) | ((unkF0 << 4) & 0xF0) | (unused & 0xF)) +#define EN_SYATEKI_WF_GET_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) +#define EN_SYATEKI_WF_PARAMS(index, unkF0, unused) (((index << 8) & 0xFF00) | ((unkF0 << 4) & 0xF0) | (unused & 0xF)) struct EnSyatekiWf; diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 40883d8dd..6753a63da 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -441,7 +441,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { if (CURRENT_DAY == 3) { if ((this->nextBellTime == CLOCK_TIME(0, 0)) && ((gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) || - (play->sceneNum == SCENE_CLOCKTOWER))) { + (play->sceneId == SCENE_CLOCKTOWER))) { s32 playerParams; u32 entrance = gSaveContext.save.entrance; @@ -453,7 +453,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) { Play_SetRespawnData(&play->state, RESPAWN_MODE_RETURN, entrance, player->unk_3CE, playerParams, &player->unk_3C0, player->unk_3CC); - if ((play->sceneNum == SCENE_TENMON_DAI) || (play->sceneNum == SCENE_00KEIKOKU)) { + if ((play->sceneId == SCENE_TENMON_DAI) || (play->sceneId == SCENE_00KEIKOKU)) { play->nextEntrance = ENTRANCE(TERMINA_FIELD, 0); } else { play->nextEntrance = ENTRANCE(SOUTH_CLOCK_TOWN, 0); diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index ba375f583..23dccca0f 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -5,6 +5,7 @@ */ #include "z_en_test6.h" +#include "z64quake.h" #include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_200000 | ACTOR_FLAG_2000000) @@ -396,7 +397,7 @@ void func_80A916F0(EnTest6* this, PlayState* play) { ActorCutscene_Stop(play->playerActorCsIds[8]); func_800B7298(play, NULL, 6); func_80A90C34(); - Distortion_ClearType(0x20); + Distortion_ClearType(DISTORTION_TYPE_5); Actor_MarkForDeath(&this->actor); } @@ -462,7 +463,7 @@ void func_80A91760(EnTest6* this, PlayState* play) { } } func_80A90C08(0x78); - Distortion_SetType(0x20); + Distortion_SetType(DISTORTION_TYPE_5); Distortion_SetCountdown(80); play->unk_18844 = 1; this->unk_274 = 95; @@ -517,7 +518,7 @@ void func_80A91760(EnTest6* this, PlayState* play) { if (this->unk_27A == 10) { this->unk_14C = 0.1f; func_80A90C34(); - Distortion_ClearType(0x20); + Distortion_ClearType(DISTORTION_TYPE_5); play->unk_18844 = 0; if (this->unk_254 != NULL) { ZeldaArena_Free(this->unk_254); @@ -617,7 +618,7 @@ void func_80A92118(EnTest6* this, PlayState* play) { ActorCutscene_Stop(play->playerActorCsIds[8]); func_800B7298(play, NULL, 6); func_80A90C34(); - Distortion_ClearType(0x20); + Distortion_ClearType(DISTORTION_TYPE_5); Actor_MarkForDeath(&this->actor); } @@ -684,13 +685,13 @@ void func_80A92188(EnTest6* this, PlayState* play) { case 115: func_80A90C08(0x14); - Distortion_SetType(0x20); + Distortion_SetType(DISTORTION_TYPE_5); Distortion_SetCountdown(90); this->unk_274 = 2; break; case 110: - func_801A3098(0x4A); + Audio_PlayFanfare(NA_BGM_SONG_OF_DOUBLE_TIME); break; case 38: @@ -715,7 +716,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { case 14: case 15: func_80A90C08(0x32); - Distortion_ClearType(0x20); + Distortion_ClearType(DISTORTION_TYPE_5); this->unk_274 = 0; break; diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index 03b10590c..e1223cddb 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -409,7 +409,7 @@ void EnTest7_Init(Actor* thisx, PlayState* play2) { } else { func_80AF082C(this, func_80AF19A8); EnTest7_SetupAction(this, func_80AF2854); - func_801A2E54(NA_BGM_SONG_OF_SOARING); + Audio_PlayBgm_StorePrevBgm(NA_BGM_SONG_OF_SOARING); } if (play->playerActorCsIds[8] == -1) { @@ -658,7 +658,7 @@ void func_80AF2350(EnTest7* this, PlayState* play) { this->unk_148.unk_10 -= 0x2EE0; - if (play->sceneNum == SCENE_SECOM) { + if (play->sceneId == SCENE_SECOM) { play->nextEntrance = ENTRANCE(IKANA_CANYON, 6); } else if (ENTEST7_GET(&this->actor) == ENTEST7_26) { func_80169F78(&play->state); @@ -677,8 +677,8 @@ void func_80AF2350(EnTest7* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_02; - gSaveContext.seqIndex = 0xFF; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } void func_80AF24D8(EnTest7* this, PlayState* play, f32 arg2) { diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.c b/src/overlays/actors/ovl_En_Tg/z_en_tg.c index c090a050d..f4c970ea8 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.c +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.c @@ -1,10 +1,11 @@ /* * File: z_en_tg.c * Overlay: ovl_En_Tg - * Description: Target Game (Honey & Darling) + * Description: Target Game (Honey & Darling) - End Credits Scene */ #include "z_en_tg.h" +#include "objects/gameplay_keep/gameplay_keep.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -15,9 +16,11 @@ void EnTg_Destroy(Actor* thisx, PlayState* play); void EnTg_Update(Actor* thisx, PlayState* play); void EnTg_Draw(Actor* thisx, PlayState* play); -void func_8098FA70(EnTg* this, PlayState* play); +void EnTg_Idle(EnTg* this, PlayState* play); +void EnTg_UpdateHearts(PlayState* play, EnTgHeartEffect* effect, s32 numEffects); +void EnTg_DrawHearts(PlayState* play, EnTgHeartEffect* effect, s32 numEffects); +void EnTg_SpawnHeart(EnTg* this, EnTgHeartEffect* effect, Vec3f* heartStartPos, s32 numEffects); -#if 0 const ActorInit En_Tg_InitVars = { ACTOR_EN_TG, ACTORCAT_NPC, @@ -30,18 +33,29 @@ const ActorInit En_Tg_InitVars = { (ActorFunc)EnTg_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_809901C0 = { - { COLTYPE_HIT0, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT0, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 18, 64, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_809901EC = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -// static DamageTable sDamageTable = { -static DamageTable D_809901F8 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, 0x0), /* Deku Stick */ DMG_ENTRY(0, 0x0), /* Horse trample */ DMG_ENTRY(0, 0x0), @@ -76,37 +90,193 @@ static DamageTable D_809901F8 = { /* Powder Keg */ DMG_ENTRY(0, 0x0), }; -#endif +static AnimationInfoS sAnimationInfo[] = { + { &gHoneyAndDarlingIdleAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, +}; -extern ColliderCylinderInit D_809901C0; -extern CollisionCheckInfoInit2 D_809901EC; -extern DamageTable D_809901F8; +void EnTg_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s16 animIndex) { + f32 endFrame; -extern UNK_TYPE D_0600B0E0; -extern UNK_TYPE D_0600B2B0; + animationInfo += animIndex; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098F800.s") + if (animationInfo->frameCount < 0) { + endFrame = Animation_GetLastFrame(animationInfo->animation); + } else { + endFrame = animationInfo->frameCount; + } + Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed, animationInfo->startFrame, endFrame, + animationInfo->mode, animationInfo->morphFrames); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098F8A8.s") +void EnTg_UpdateCollider(EnTg* this, PlayState* play) { + this->collider.dim.pos.x = this->actor.world.pos.x; + this->collider.dim.pos.y = this->actor.world.pos.y; + this->collider.dim.pos.z = this->actor.world.pos.z; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098F928.s") +void EnTg_UpdateSkelAnime(EnTg* this, PlayState* play) { + SkelAnime_Update(&this->skelAnime); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/EnTg_Init.s") +void EnTg_Init(Actor* thisx, PlayState* play) { + EnTg* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/EnTg_Destroy.s") + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_InitFlex(play, &this->skelAnime, &gHoneyAndDarlingSkel, NULL, this->jointTable, this->morphTable, + HONEY_AND_DARLING_LIMB_MAX); + EnTg_ChangeAnim(&this->skelAnime, sAnimationInfo, 0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + Actor_SetScale(&this->actor, 0.01f); + this->actionFunc = EnTg_Idle; + this->actor.gravity = -4.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098FA70.s") +void EnTg_Destroy(Actor* thisx, PlayState* play) { + EnTg* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/EnTg_Update.s") + Collider_DestroyCylinder(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098FBB4.s") +/** + * The actor spins, and a heart is spawned above the actor every 12 frames. + */ +void EnTg_Idle(EnTg* this, PlayState* play) { + Vec3f heartStartPos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098FBD0.s") + this->actor.shape.rot.y += sREG(0) + 0x258; + this->actor.world.rot = this->actor.shape.rot; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/EnTg_Draw.s") + if (DECR(this->spawnHeartTimer) == 0) { + this->spawnHeartTimer = 12; + heartStartPos = this->actor.world.pos; + heartStartPos.y += 62.0f; + EnTg_SpawnHeart(this, this->effects, &heartStartPos, ARRAY_COUNT(this->effects)); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098FD50.s") +void EnTg_Update(Actor* thisx, PlayState* play) { + EnTg* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8098FEA8.s") + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4); + EnTg_UpdateSkelAnime(this, play); + EnTg_UpdateHearts(play, this->effects, ARRAY_COUNT(this->effects)); + EnTg_UpdateCollider(this, play); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Tg/func_8099000C.s") +s32 EnTg_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + return false; +} + +void EnTg_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnTg* this = THIS; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; + + if (limbIndex == HONEY_AND_DARLING_LIMB_MAN_HEAD) { + Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos); + } +} + +void EnTg_Draw(Actor* thisx, PlayState* play) { + s32 pad; + EnTg* this = THIS; + + Matrix_Push(); + EnTg_DrawHearts(play, this->effects, ARRAY_COUNT(this->effects)); + Matrix_Pop(); + + OPEN_DISPS(play->state.gfxCtx); + func_8012C28C(play->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(play->state.gfxCtx, 0, 50, 160, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(play->state.gfxCtx, 255, 255, 255, 0)); + + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnTg_OverrideLimbDraw, EnTg_PostLimbDraw, &this->actor); + + CLOSE_DISPS(play->state.gfxCtx); +} + +/** + * Spawns a heart at the first effects array index that's not enabled. + * Because of the frame counts, only two hearts are ever spawned at a time. + */ +void EnTg_SpawnHeart(EnTg* this, EnTgHeartEffect* effect, Vec3f* heartStartPos, s32 numEffects) { + Vec3f heartVelocity = { 0.0f, 1.5f, 0.0f }; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; + s32 i; + + for (i = 0; i < numEffects && effect->isEnabled; i++, effect++) {} + + if (i < numEffects) { + effect->isEnabled = true; + effect->pos = *heartStartPos; + effect->velocity = heartVelocity; + effect->unusedZeroVec = zeroVec; + effect->scale = 0.01f; + effect->pos.x += 4.0f * Math_SinS(this->actor.shape.rot.y); + effect->pos.z += 4.0f * Math_CosS(this->actor.shape.rot.y); + effect->timer = 16; + } +} + +/** + * The heart path is curvy as it floats up because of the use of Math_SinS and Math_CosS. + */ +void EnTg_UpdateHearts(PlayState* play, EnTgHeartEffect* effect, s32 numEffects) { + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; + s16 yaw = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); + s32 i; + + for (i = 0; i < numEffects; i++, effect++) { + if (effect->isEnabled == true) { + if (DECR(effect->timer) == 0) { + effect->isEnabled = false; + } + effect->pos.y += effect->velocity.y; + effect->pos.x += 2.0f * Math_SinS(effect->angle); + effect->pos.z += 2.0f * Math_CosS(effect->angle); + + Matrix_Push(); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_RotateYS(yaw, MTXMODE_APPLY); + Matrix_MultVec3f(&zeroVec, &effect->pos); + Matrix_Pop(); + + effect->angle += 0x1770; + } + } +} + +void EnTg_DrawHearts(PlayState* play, EnTgHeartEffect* effect, s32 numEffects) { + s32 i; + s32 isMaterialApplied = false; + + OPEN_DISPS(play->state.gfxCtx); + + POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP); + POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP); + + for (i = 0; i < numEffects; i++, effect++) { + if (effect->isEnabled == true) { + if (!isMaterialApplied) { + gSPDisplayList(POLY_OPA_DISP++, gHoneyAndDarlingHeartMaterialDL); + isMaterialApplied = true; + } + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropRecoveryHeartTex)); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, gHoneyAndDarlingHeartModelDL); + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Tg/z_en_tg.h b/src/overlays/actors/ovl_En_Tg/z_en_tg.h index 2798b99b3..3cdcb57f1 100644 --- a/src/overlays/actors/ovl_En_Tg/z_en_tg.h +++ b/src/overlays/actors/ovl_En_Tg/z_en_tg.h @@ -2,15 +2,33 @@ #define Z_EN_TG_H #include "global.h" +#include "objects/object_mu/object_mu.h" struct EnTg; typedef void (*EnTgActionFunc)(struct EnTg*, PlayState*); +typedef struct EnTgHeartEffect { + /* 0x00 */ u8 isEnabled; + /* 0x01 */ u8 timer; + /* 0x04 */ f32 scale; + /* 0x08 */ UNK_TYPE1 unk8[0xC]; + /* 0x14 */ Vec3f pos; + /* 0x20 */ Vec3f unusedZeroVec; + /* 0x2C */ Vec3f velocity; + /* 0x38 */ s16 angle; +} EnTgHeartEffect; // size = 0x3C + typedef struct EnTg { /* 0x000 */ Actor actor; /* 0x144 */ EnTgActionFunc actionFunc; - /* 0x148 */ char unk_148[0x400]; + /* 0x148 */ SkelAnime skelAnime; + /* 0x18C */ ColliderCylinder collider; + /* 0x1D8 */ UNK_TYPE1 unk1D8[0x18]; + /* 0x1F0 */ Vec3s jointTable[HONEY_AND_DARLING_LIMB_MAX]; + /* 0x26E */ Vec3s morphTable[HONEY_AND_DARLING_LIMB_MAX]; + /* 0x2EC */ s16 spawnHeartTimer; + /* 0x2F0 */ EnTgHeartEffect effects[10]; } EnTg; // size = 0x548 extern const ActorInit En_Tg_InitVars; diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c index 0a013410b..04e44bb16 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c @@ -284,7 +284,7 @@ void func_80ACA840(EnTimeTag* this, PlayState* play) { s16 temp_ft4; s16 temp_hi; - if ((play->sceneNum != SCENE_YADOYA) || (INV_CONTENT(ITEM_ROOM_KEY) != ITEM_ROOM_KEY)) { + if ((play->sceneId != SCENE_YADOYA) || (INV_CONTENT(ITEM_ROOM_KEY) != ITEM_ROOM_KEY)) { temp_ft4 = gSaveContext.save.time * (24.0f / 0x10000); // TIME_TO_HOURS_F temp_hi = (s32)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60; if (gSaveContext.save.weekEventReg[63] & 1) { diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 6dda48fc7..a55c899ef 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -184,15 +184,15 @@ void EnToto_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if (play->sceneNum == SCENE_MILK_BAR && - (gSaveContext.save.time >= CLOCK_TIME(6, 0) && gSaveContext.save.time < CLOCK_TIME(21, 30))) { + if ((play->sceneId == SCENE_MILK_BAR) && (gSaveContext.save.time >= CLOCK_TIME(6, 0)) && + (gSaveContext.save.time < CLOCK_TIME(21, 30))) { Actor_MarkForDeath(&this->actor); return; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.bgCheckFlags |= 0x400; SkelAnime_InitFlex(play, &this->skelAnime, &object_zm_Skel_00A978, - ((play->sceneNum == SCENE_SONCHONOIE) ? &object_zm_Anim_003AA8 : &object_zm_Anim_00C880), + ((play->sceneId == SCENE_SONCHONOIE) ? &object_zm_Anim_003AA8 : &object_zm_Anim_00C880), this->jointTable, this->morphTable, 18); func_80BA36C0(this, play, 0); this->actor.shape.rot.x = 0; @@ -220,7 +220,7 @@ void func_80BA383C(EnToto* this, PlayState* play) { void func_80BA3930(EnToto* this, PlayState* play) { AnimationHeader* animationHeader = &object_zm_Anim_00C880; - if (play->sceneNum == SCENE_SONCHONOIE) { + if (play->sceneId == SCENE_SONCHONOIE) { animationHeader = &object_zm_Anim_003AA8; } Animation_MorphToLoop(&this->skelAnime, animationHeader, -4.0f); @@ -242,7 +242,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { func_80BA383C(this, play); if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { func_80BA36C0(this, play, 1); - if (play->sceneNum != SCENE_SONCHONOIE) { + if (play->sceneId != SCENE_SONCHONOIE) { Flags_SetSwitch(play, this->actor.params & 0x7F); } else if (player->transformation == PLAYER_FORM_DEKU) { Flags_SetSwitch(play, this->actor.home.rot.x); @@ -252,9 +252,9 @@ void func_80BA39C8(EnToto* this, PlayState* play) { } //! @TODO: 0xED02 nor 0xED01 match CLOCK_TIME macro - if ((play->sceneNum == SCENE_MILK_BAR && - !(gSaveContext.save.time >= CLOCK_TIME(6, 0) && gSaveContext.save.time < 0xED02)) || - (play->sceneNum != SCENE_MILK_BAR && func_80BA397C(this, 0x2000))) { + if (((play->sceneId == SCENE_MILK_BAR) && + !((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time < 0xED02))) || + ((play->sceneId != SCENE_MILK_BAR) && func_80BA397C(this, 0x2000))) { if (this->unk2B6 != 0) { this->text = D_80BA5044; this->actor.flags |= ACTOR_FLAG_10000; @@ -262,7 +262,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { } else { this->actor.flags &= ~ACTOR_FLAG_10000; func_800B8614(&this->actor, play, 50.0f); - if (play->sceneNum == SCENE_SONCHONOIE) { + if (play->sceneId == SCENE_SONCHONOIE) { if (player->transformation == PLAYER_FORM_DEKU) { if (!Flags_GetSwitch(play, this->actor.home.rot.x)) { this->text = D_80BA5068; @@ -286,7 +286,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { } void func_80BA3BFC(EnToto* this, PlayState* play) { - if (play->sceneNum == SCENE_SONCHONOIE) { + if (play->sceneId == SCENE_SONCHONOIE) { Animation_MorphToPlayOnce(&this->skelAnime, &object_zm_Anim_000C80, -4.0f); this->unk2B4 = 0; } else { diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index 1f521d250..ac6a4f476 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -752,7 +752,7 @@ void func_80AD4DB4(EnTrt2* this, PlayState* play) { return; } - if ((play->sceneNum == SCENE_20SICHITAI) || (play->sceneNum == SCENE_20SICHITAI2)) { + if ((play->sceneId == SCENE_20SICHITAI) || (play->sceneId == SCENE_20SICHITAI2)) { if (gSaveContext.save.day == 2) { if (!(gSaveContext.save.weekEventReg[15] & 0x80)) { gSaveContext.save.weekEventReg[15] |= 0x80; @@ -790,7 +790,7 @@ void func_80AD4FE4(EnTrt2* this, PlayState* play) { D_80AD5910[this->unk_3B2](this, play); Actor_MoveWithGravity(&this->actor); - if (play->sceneNum != SCENE_20SICHITAI) { + if (play->sceneId != SCENE_20SICHITAI) { Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 10.0f, 0.0f, 5); } diff --git a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c index 4f302e268..1ba5e6ebc 100644 --- a/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c +++ b/src/overlays/actors/ovl_En_Warp_tag/z_en_warp_tag.c @@ -247,8 +247,8 @@ void EnWarpTag_GrottoReturn(EnWarptag* this, PlayState* play) { func_8019F128(NA_SE_OC_SECRET_HOLE_OUT); func_801A4058(5); if (1) {} - gSaveContext.seqIndex = 0xFF; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; } } diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 092c693f2..ec6f12aeb 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -351,8 +351,7 @@ void func_80966FEC(EnWeatherTag* this, PlayState* play) { D_801F4E7A = distance; } - // unique pirates fortress behavior? - if ((play->sceneNum == SCENE_KAIZOKU) && (play->actorCtx.flags & ACTORCTX_FLAG_1)) { + if ((play->sceneId == SCENE_KAIZOKU) && (play->actorCtx.flags & ACTORCTX_FLAG_1)) { EnWeatherTag_SetupAction(this, func_80967060); } } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 508734a9b..0ea1d448f 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -206,8 +206,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; if ((ENZOG_GET_F(&this->actor) != ENZOG_F_2) && (INV_CONTENT(ITEM_MASK_ZORA) == ITEM_MASK_ZORA) && - ((play->csCtx.currentCsIndex != 2) || (gSaveContext.sceneSetupIndex != 0) || - (play->sceneNum != SCENE_30GYOSON))) { + ((play->csCtx.currentCsIndex != 2) || (gSaveContext.sceneLayer != 0) || (play->sceneId != SCENE_30GYOSON))) { Actor_MarkForDeath(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index f20b953ba..fba4baf7a 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -206,13 +206,13 @@ void EnZoraegg_Destroy(Actor* thisx, PlayState* play) { } s32 func_80B319A8(PlayState* play) { - return gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 & 7; + return gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 & 7; } void func_80B319D0(PlayState* play, s32 arg1) { if ((arg1 < 8) && (arg1 >= 0)) { - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 &= ~7; - gSaveContext.save.permanentSceneFlags[play->sceneNum].unk_14 |= arg1; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 &= ~7; + gSaveContext.save.permanentSceneFlags[play->sceneId].unk_14 |= arg1; } } diff --git a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c index 769266e97..5fc5d6b31 100644 --- a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c +++ b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c @@ -5,6 +5,7 @@ */ #include "z_obj_chikuwa.h" +#include "z64quake.h" #include "objects/object_d_lift/object_d_lift.h" #define FLAGS (ACTOR_FLAG_10) @@ -158,9 +159,9 @@ void ObjChikuwa_Update(Actor* thisx, PlayState* play) { ObjChikuwa* this = THIS; ObjChikuwaStruct* temp; f32 temp_fs0; - s16 var_s2; + s16 quakeVerticalMag; s32 i; - s32 quake; + s32 quakeIndex; this->unk_29E++; @@ -173,16 +174,16 @@ void ObjChikuwa_Update(Actor* thisx, PlayState* play) { func_809B17D0(play, this, &temp->unk_00); temp_fs0 = Math3D_Vec3fDistSq(&temp->unk_00, &GET_PLAYER(play)->actor.world.pos); if (temp_fs0 < SQ(240.0f)) { - quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); if (temp_fs0 < SQ(120.0f)) { - var_s2 = 4; + quakeVerticalMag = 4; } else { - var_s2 = 3; + quakeVerticalMag = 3; } - Quake_SetSpeed(quake, 0x4350); - Quake_SetQuakeValues(quake, var_s2, 0, 0, 0); - Quake_SetCountdown(quake, 7); + Quake_SetSpeed(quakeIndex, 17232); + Quake_SetQuakeValues(quakeIndex, quakeVerticalMag, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 7); } } } diff --git a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c index 5783118de..6cc8e2d04 100644 --- a/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c +++ b/src/overlays/actors/ovl_Obj_Demo/z_obj_demo.c @@ -60,7 +60,7 @@ void ObjDemo_Init(Actor* thisx, PlayState* play) { } void func_80983634(PlayState* play) { - if ((play->sceneNum == SCENE_CASTLE) && (func_801A8A50(0) == NA_BGM_IKANA_CASTLE)) { + if ((play->sceneId == SCENE_CASTLE) && (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_IKANA_CASTLE)) { Audio_QueueSeqCmd(0x100100FF); } } @@ -88,7 +88,7 @@ void func_80983704(ObjDemo* this, PlayState* play) { } else { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); } - if (play->sceneNum == SCENE_CASTLE) { + if (play->sceneId == SCENE_CASTLE) { Audio_QueueSeqCmd(NA_BGM_IKANA_CASTLE | 0x8000); } this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c index 050207492..77b704a6c 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c @@ -5,6 +5,7 @@ */ #include "z_obj_dhouse.h" +#include "z64quake.h" #include "objects/object_dhouse/object_dhouse.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_400000) @@ -454,23 +455,23 @@ void func_80B139D8(ObjDhouse* this) { void func_80B139F4(ObjDhouse* this, PlayState* play) { Camera* camera = GET_ACTIVE_CAM(play); - s16 quake; + s16 quakeIndex; if (this->unk_1370 == 117) { - quake = Quake_Add(camera, 3); - Quake_SetSpeed(quake, 20000); - Quake_SetQuakeValues(quake, 8, 0, 0, 0); - Quake_SetCountdown(quake, 17); + quakeIndex = Quake_Add(camera, QUAKE_TYPE_3); + Quake_SetSpeed(quakeIndex, 20000); + Quake_SetQuakeValues(quakeIndex, 8, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 17); } else if (this->unk_1370 == 105) { - quake = Quake_Add(camera, 3); - Quake_SetSpeed(quake, 20000); - Quake_SetQuakeValues(quake, 7, 0, 0, 0); - Quake_SetCountdown(quake, 20); + quakeIndex = Quake_Add(camera, QUAKE_TYPE_3); + Quake_SetSpeed(quakeIndex, 20000); + Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 20); } else if (this->unk_1370 == 90) { - quake = Quake_Add(camera, 3); - Quake_SetSpeed(quake, 20000); - Quake_SetQuakeValues(quake, 5, 0, 0, 0); - Quake_SetCountdown(quake, 62); + quakeIndex = Quake_Add(camera, QUAKE_TYPE_3); + Quake_SetSpeed(quakeIndex, 20000); + Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 62); } this->unk_1370--; diff --git a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c index c0537940c..467dfa8b8 100644 --- a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c +++ b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c @@ -5,6 +5,7 @@ */ #include "z_obj_hariko.h" +#include "z64quake.h" #include "assets/objects/object_hariko/object_hariko.h" #define FLAGS (ACTOR_FLAG_20 | ACTOR_FLAG_2000000) diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c index 249e7ffde..38f3164e3 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c @@ -5,6 +5,7 @@ */ #include "z_obj_hugebombiwa.h" +#include "z64quake.h" #include "z64rumble.h" #include "objects/object_bombiwa/object_bombiwa.h" @@ -292,13 +293,14 @@ void func_80A54600(PlayState* play, Vec3f* arg1, f32 arg2, f32 arg3) { } } -void func_80A54980(ObjHugebombiwa* this, PlayState* play, s32 arg2) { +void ObjHugebombiwa_AddQuake(ObjHugebombiwa* this, PlayState* play, s32 quakeVerticalMag) { s32 pad[2]; - s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + + Quake_SetSpeed(quakeIndex, 20000); + Quake_SetQuakeValues(quakeIndex, quakeVerticalMag, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 7); - Quake_SetSpeed(quake, 0x4E20); - Quake_SetQuakeValues(quake, arg2, 0, 0, 0); - Quake_SetCountdown(quake, 7); Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); } @@ -409,7 +411,7 @@ void func_80A54CEC(ObjHugebombiwa* this, PlayState* play) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); Flags_SetSwitch(play, ENHUGEBOMBIWA_GET_7F(&this->actor)); if (!(ENHUGEBOMBIWA_GET_100(&this->actor)) && - ((play->sceneNum == SCENE_17SETUGEN) || (play->sceneNum == SCENE_17SETUGEN2))) { + ((play->sceneId == SCENE_17SETUGEN) || (play->sceneId == SCENE_17SETUGEN2))) { gSaveContext.save.weekEventReg[19] |= 2; } @@ -514,7 +516,7 @@ void func_80A55064(ObjHugebombiwa* this, PlayState* play) { ptr->unk_24 = 1; func_80A53E60(play, &ptr->unk_0C, ptr->unk_18, ptr->unk_00.y * 9.8f); if ((play->gameplayFrames % 4) == 0) { - func_80A54980(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1); + ObjHugebombiwa_AddQuake(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1); } } } @@ -610,7 +612,7 @@ void func_80A55564(ObjHugebombiwa* this, PlayState* play) { ptr->unk_24 = 1; func_80A54600(play, &ptr->unk_0C, ptr->unk_18, ptr->unk_00.y * 10.1f); if ((play->gameplayFrames % 4) == 0) { - func_80A54980(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1); + ObjHugebombiwa_AddQuake(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1); } } } diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 0210b5ba7..2ba1e4352 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -116,7 +116,7 @@ void ObjIcePoly_Init(Actor* thisx, PlayState* play) { thisx->shape.rot.z = -0x500; if (((this->unk_149 != OBJICEPOLY_FF_FF) && Flags_GetSwitch(play, this->unk_149)) || - ((play->sceneNum == SCENE_KAJIYA) && (gSaveContext.save.weekEventReg[33] & 0x80))) { + ((play->sceneId == SCENE_KAJIYA) && (gSaveContext.save.weekEventReg[33] & 0x80))) { Actor_MarkForDeath(thisx); return; } @@ -205,7 +205,7 @@ void func_80931A38(ObjIcePoly* this, PlayState* play) { this->actionFunc = func_80931E58; this->actor.focus.rot.y = this->actor.yawTowardsPlayer; - if (play->sceneNum == SCENE_00KEIKOKU) { + if (play->sceneId == SCENE_00KEIKOKU) { Actor* actor = NULL; do { diff --git a/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c b/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c index 497d9a219..33de74100 100644 --- a/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c +++ b/src/overlays/actors/ovl_Obj_Jg_Gakki/z_obj_jg_gakki.c @@ -36,11 +36,10 @@ void ObjJgGakki_Init(Actor* thisx, PlayState* play2) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_Init(play, &this->skelAnime, &gGoronElderDrumSkel, NULL, NULL, NULL, 0); - if (((play->sceneNum == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 7)) && - (play->csCtx.currentCsIndex == 0)) { + if (((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 7)) && (play->csCtx.currentCsIndex == 0)) { Animation_Change(&this->skelAnime, &gGoronElderDrumTakeOutAnim, 1.0f, frameCount, frameCount, ANIMMODE_ONCE, 0.0f); - } else if ((play->sceneNum == SCENE_17SETUGEN) || (play->sceneNum == SCENE_10YUKIYAMANOMURA)) { + } else if ((play->sceneId == SCENE_17SETUGEN) || (play->sceneId == SCENE_10YUKIYAMANOMURA)) { Animation_Change(&this->skelAnime, &gGoronElderDrumTakeOutAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); } else { Actor_MarkForDeath(&this->actor); diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index f7056b147..4668bfffd 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -5,6 +5,7 @@ */ #include "z_obj_lift.h" +#include "z64quake.h" #include "objects/object_d_lift/object_d_lift.h" #define FLAGS (ACTOR_FLAG_10) @@ -125,17 +126,18 @@ void func_8093D760(ObjLift* this) { void func_8093D7A0(ObjLift* this, PlayState* play) { s32 pad; - s16 quake; + s16 quakeIndex; if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) { if (this->timer <= 0) { if (OBJLIFT_GET_7(&this->dyna.actor) == 7) { func_8093D9C0(this); } else { - quake = Quake_Add(GET_ACTIVE_CAM(play), 1); - Quake_SetSpeed(quake, 10000); - Quake_SetQuakeValues(quake, 2, 0, 0, 0); - Quake_SetCountdown(quake, 20); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_1); + Quake_SetSpeed(quakeIndex, 10000); + Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 20); + func_8093D88C(this); } } diff --git a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c index 4c56bb794..7cc7add22 100644 --- a/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c +++ b/src/overlays/actors/ovl_Obj_Nozoki/z_obj_nozoki.c @@ -71,7 +71,7 @@ void ObjNozoki_Init(Actor* thisx, PlayState* play) { this->dyna.actor.shape.rot.z = 0; this->unk_15F = this->dyna.actor.cutscene; - if (play->sceneNum == SCENE_AYASHIISHOP) { + if (play->sceneId == SCENE_AYASHIISHOP) { this->unk_15C = 4; ObjNozoki_SetupAction(this, func_80BA3230); this->dyna.actor.colChkInfo.cylRadius = -40; diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 02743db29..c31168f72 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -348,7 +348,7 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { DynaPolyActor_LoadMesh(play, &this->dyna, &gFloorSwitchCol); } if (type == OBJSWITCH_TYPE_FLOOR) { - if (play->sceneNum == SCENE_SECOM) { + if (play->sceneId == SCENE_SECOM) { this->floorSwitchUpScale = 33.0f / 200.0f / 3.0f; this->floorSwitchDownScale = 33.0f / 2000.0f / 3.0f; } else { @@ -357,7 +357,7 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { } } if (type == OBJSWITCH_TYPE_FLOOR || type == OBJSWITCH_TYPE_FLOOR_LARGE) { - if (play->sceneNum == SCENE_SECOM) { + if (play->sceneId == SCENE_SECOM) { Color_RGB8* color = &sSakonHideoutColor[OBJ_SWITCH_GET_COLOR_ID(&this->dyna.actor)]; this->color.r = color->r; @@ -584,7 +584,7 @@ void ObjSwitch_FloorSwitchDown(ObjSwitch* this, PlayState* play) { case OBJSWITCH_SUBTYPE_ONCE: case OBJSWITCH_SUBTYPE_SYNC: if (!Flags_GetSwitch(play, OBJ_SWITCH_GET_SWITCH_FLAG(&this->dyna.actor))) { - if (play->sceneNum == SCENE_SECOM && DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { + if ((play->sceneId == SCENE_SECOM) && DynaPolyActor_IsInSwitchPressedState(&this->dyna)) { ObjSwitch_SetSwitchFlagState(this, play, true); } else { ObjSwitch_FloorSwitchRiseUpInit(this); @@ -595,7 +595,7 @@ void ObjSwitch_FloorSwitchDown(ObjSwitch* this, PlayState* play) { case OBJSWITCH_SUBTYPE_RESET: case OBJSWITCH_SUBTYPE_RESET_INVERTED: if (!DynaPolyActor_IsInSwitchPressedState(&this->dyna) && - (!Player_InCsMode(play) || play->sceneNum == SCENE_SECOM)) { + (!Player_InCsMode(play) || (play->sceneId == SCENE_SECOM))) { if (this->floorSwitchReleaseTimer <= 0) { if (subType == OBJSWITCH_SUBTYPE_RESET) { ObjSwitch_SetSwitchFlagState(this, play, false); @@ -607,7 +607,7 @@ void ObjSwitch_FloorSwitchDown(ObjSwitch* this, PlayState* play) { } } } else { - if (play->sceneNum == SCENE_SECOM) { + if (play->sceneId == SCENE_SECOM) { this->floorSwitchReleaseTimer = 2; } else { this->floorSwitchReleaseTimer = 6; diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index 780c31c9a..6d4923043 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -5,6 +5,7 @@ */ #include "z_obj_tokei_step.h" +#include "z64quake.h" #include "z64rumble.h" #include "objects/object_tokei_step/object_tokei_step.h" @@ -62,11 +63,12 @@ void ObjTokeiStep_SetSysMatrix(ObjTokeiStepPanel* panel) { void ObjTokeiStep_AddQuake(ObjTokeiStep* this, PlayState* play) { s32 pad[2]; - s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3); + s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + + Quake_SetSpeed(quakeIndex, 20000); + Quake_SetQuakeValues(quakeIndex, 1, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 7); - Quake_SetSpeed(quake, 20000); - Quake_SetQuakeValues(quake, 1, 0, 0, 0); - Quake_SetCountdown(quake, 7); Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } @@ -193,8 +195,7 @@ void ObjTokeiStep_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - if ((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && - (play->csCtx.currentCsIndex == 0)) { + if ((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) { DynaPolyActor_LoadMesh(play, &this->dyna, &gClocktowerPanelCol); ObjTokeiStep_InitSteps(this); ObjTokeiStep_SetupBeginOpen(this); diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 74c121656..421f5dcf0 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -121,10 +121,8 @@ void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, PlayState* play) { this->opaDList = gClockTowerExteriorGearDL; ObjTokeidai_SetupClockOrExteriorGear(this); - if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && - (play->csCtx.currentCsIndex == 0)) || - ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && - (play->csCtx.currentCsIndex == 0))) { + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) || + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { this->actionFunc = ObjTokeidai_ExteriorGear_OpenedIdle; @@ -140,10 +138,8 @@ void ObjTokeidai_TowerClock_Init(ObjTokeidai* this, PlayState* play) { this->actor.draw = ObjTokeidai_Clock_Draw; ObjTokeidai_Clock_Init(this); - if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && - (play->csCtx.currentCsIndex == 0)) || - ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && - (play->csCtx.currentCsIndex == 0))) { + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) || + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); } else if ((CURRENT_DAY == 3 && gSaveContext.save.time < CLOCK_TIME(6, 0)) || CURRENT_DAY >= 4) { this->actor.world.pos.y += (this->actor.scale.y * 5191.0f) - 50.0f; @@ -175,10 +171,8 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, PlayState* play) { this->spotlightIntensity = 0; } - if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && - (play->csCtx.currentCsIndex == 0)) || - ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && - (play->csCtx.currentCsIndex == 0))) { + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) || + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0))) { this->spotlightIntensity = 0; ObjTokeidai_SetupTowerOpening(this); @@ -448,9 +442,9 @@ void ObjTokeidai_TowerOpening_EndCutscene(ObjTokeidai* this, PlayState* play) { if (Cutscene_CheckActorAction(play, 132) != 0 && play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, 132)]->action == 5) { gSaveContext.save.weekEventReg[8] |= 0x40; - if (((play->sceneNum == SCENE_CLOCKTOWER) && (gSaveContext.sceneSetupIndex == 2) && + if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) || - ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 2) && + ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0))) { Audio_SetCutsceneFlag(false); gSaveContext.save.cutscene = 0; diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index 20c172803..9d635d7eb 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -162,7 +162,7 @@ void func_80927818(ObjTsubo* this, PlayState* play, s32 arg2) { } s32 ObjTsubo_IsSceneNotGohtOrTwinmold(ObjTsubo* this, PlayState* play) { - return (play->sceneNum != SCENE_HAKUGIN_BS) && (play->sceneNum != SCENE_INISIE_BS); + return (play->sceneId != SCENE_HAKUGIN_BS) && (play->sceneId != SCENE_INISIE_BS); } void func_8092788C(ObjTsubo* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 9bae7169e..7cb4f310f 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -751,7 +751,7 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { ObjUm_SetupAction(this, ObjUm_PostMilkRunStartCs); this->unk_354 = 0; ObjUm_RotatePlayer(this, play, 0); - func_801A3098(NA_BGM_CLEAR_EVENT); + Audio_PlayFanfare(NA_BGM_CLEAR_EVENT); } else { this->type = OBJ_UM_TYPE_TERMINA_FIELD; ObjUm_SetupAction(this, ObjUm_TerminaFieldIdle); @@ -1295,9 +1295,9 @@ void ObjUm_RunMinigame(ObjUm* this, PlayState* play) { switch (ObjUm_UpdatePath(this, play)) { case OBJUM_PATH_STATE_1: case OBJUM_PATH_STATE_FINISH: - gSaveContext.seqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.save.weekEventReg[31] &= (u8)~0x80; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; if (!(gSaveContext.save.weekEventReg[52] & 1) && !(gSaveContext.save.weekEventReg[52] & 2)) { if (!this->areAllPotsBroken) { diff --git a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c index 83e06a1a3..aea3bc7f1 100644 --- a/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c +++ b/src/overlays/actors/ovl_Obj_Wturn/z_obj_wturn.c @@ -42,8 +42,8 @@ void func_808A7968(ObjWturn* this, PlayState* play) { if (play->msgCtx.ocarinaMode >= 28 && play->msgCtx.ocarinaMode < 39) { Flags_UnsetSwitch(play, this->actor.params); Actor_MarkForDeath(&this->actor); - } else if ((Flags_GetSwitch(play, this->actor.params) && (play->sceneNum == SCENE_F40)) || - (!Flags_GetSwitch(play, this->actor.params) && (play->sceneNum == SCENE_F41))) { + } else if ((Flags_GetSwitch(play, this->actor.params) && (play->sceneId == SCENE_F40)) || + (!Flags_GetSwitch(play, this->actor.params) && (play->sceneId == SCENE_F41))) { func_808A7A24(this); } } @@ -112,7 +112,7 @@ void func_808A7C78(ObjWturn* this, PlayState* play) { play->transitionType = TRANS_TYPE_64; gSaveContext.nextTransitionType = TRANS_TYPE_03; gSaveContext.nextCutsceneIndex = 0; - if (play->sceneNum == SCENE_F40) { + if (play->sceneId == SCENE_F40) { play->nextEntrance = ENTRANCE(STONE_TOWER_INVERTED, 0); } else { play->nextEntrance = ENTRANCE(STONE_TOWER, 1); diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 4057ff817..264167db5 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -588,7 +588,7 @@ void func_808DD970(Actor* thisx, PlayState* play2) { ObjectKankyo* this = THIS; f32 tempA; - if (play->sceneNum == SCENE_KYOJINNOMA) { + if (play->sceneId == SCENE_KYOJINNOMA) { phi_f26 = 1.0f; } else { tempA = Camera_GetWaterYPos(GET_ACTIVE_CAM(play)); diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index 661c13a1b..ef1fa1035 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -15,7 +15,6 @@ void OceffWipe_Destroy(Actor* thisx, PlayState* play); void OceffWipe_Update(Actor* thisx, PlayState* play); void OceffWipe_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit Oceff_Wipe_InitVars = { ACTOR_OCEFF_WIPE, ACTORCAT_ITEMACTION, @@ -28,12 +27,100 @@ const ActorInit Oceff_Wipe_InitVars = { (ActorFunc)OceffWipe_Draw, }; -#endif +UNK_TYPE4 D_80977200; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe/OceffWipe_Init.s") +void OceffWipe_Init(Actor* thisx, PlayState* play) { + OceffWipe* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe/OceffWipe_Destroy.s") + Actor_SetScale(&this->actor, 0.1f); + this->counter = 0; + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe/OceffWipe_Update.s") +void OceffWipe_Destroy(Actor* thisx, PlayState* play) { + OceffWipe* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe/OceffWipe_Draw.s") + Magic_Reset(play); + play->msgCtx.unk120B0 = 0; +} + +void OceffWipe_Update(Actor* thisx, PlayState* play) { + OceffWipe* this = THIS; + + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; + if (this->counter < 100) { + this->counter++; + } else { + Actor_MarkForDeath(&this->actor); + } +} + +#include "assets/overlays/ovl_Oceff_Wipe/ovl_Oceff_Wipe.c" + +static u8 sAlphaIndices[] = { + 0x01, 0x10, 0x22, 0x01, 0x20, 0x12, 0x01, 0x20, 0x12, 0x01, + 0x10, 0x22, 0x01, 0x20, 0x12, 0x01, 0x12, 0x21, 0x01, 0x02, +}; + +void OceffWipe_Draw(Actor* thisx, PlayState* play) { + u32 scroll = play->state.frames & 0xFF; + OceffWipe* this = THIS; + f32 z; + s32 pad; + u8 alphaTable[3]; + s32 i; + Vec3f eye = GET_ACTIVE_CAM(play)->eye; + Vtx* vtxPtr; + Vec3f quakeOffset; + + Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play)); + + OPEN_DISPS(play->state.gfxCtx); + + if (this->counter < 32) { + z = Math_SinS(this->counter << 9) * 1360.0f; + } else { + z = 1360.0f; + } + + if (this->counter >= 80) { + alphaTable[0] = 0; + alphaTable[1] = (100 - this->counter) * 8; + alphaTable[2] = (100 - this->counter) * 12; + } else { + alphaTable[0] = 0; + alphaTable[1] = 160; + alphaTable[2] = 255; + } + + for (i = 0; i < 20; i++) { + vtxPtr = sSongOfTimeFrustumVtx; + vtxPtr[i * 2 + 0].v.cn[3] = alphaTable[(sAlphaIndices[i] & 0xF0) >> 4]; + vtxPtr[i * 2 + 1].v.cn[3] = alphaTable[sAlphaIndices[i] & 0xF]; + } + + func_8012C2DC(play->state.gfxCtx); + + Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW); + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_RotateXS(0x708, MTXMODE_APPLY); + Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + if (this->actor.params != OCEFF_WIPE_ZL) { + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 255, 255, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 150, 255, 128); + } else { + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, 255); + gDPSetEnvColor(POLY_XLU_DISP++, 100, 0, 255, 128); + } + + gSPDisplayList(POLY_XLU_DISP++, sSongOfTimeFrustumMaterialDL); + gSPDisplayList(POLY_XLU_DISP++, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0 - scroll, scroll * -2, 32, + 32, 1, 0 - scroll, scroll * -2, 32, 32)); + gSPDisplayList(POLY_XLU_DISP++, sSongOfTimeFrustumModelDL); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h index 5b7e34837..6828c996d 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.h @@ -3,11 +3,16 @@ #include "global.h" +typedef enum { + /* 0x0 */ OCEFF_WIPE_ZL, + /* 0x1 */ OCEFF_WIPE_SOT +} OceffWipeType; + struct OceffWipe; typedef struct OceffWipe { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ s16 counter; } OceffWipe; // size = 0x148 extern const ActorInit Oceff_Wipe_InitVars; diff --git a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c index 1bef04db8..951ba1c39 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c +++ b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c @@ -15,7 +15,6 @@ void OceffWipe5_Destroy(Actor* thisx, PlayState* play); void OceffWipe5_Update(Actor* thisx, PlayState* play); void OceffWipe5_Draw(Actor* thisx, PlayState* play); -#if 0 const ActorInit Oceff_Wipe5_InitVars = { ACTOR_OCEFF_WIPE5, ACTORCAT_ITEMACTION, @@ -28,12 +27,104 @@ const ActorInit Oceff_Wipe5_InitVars = { (ActorFunc)OceffWipe5_Draw, }; -#endif +UNK_TYPE4 D_80BC9260; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe5/OceffWipe5_Init.s") +void OceffWipe5_Init(Actor* thisx, PlayState* play) { + OceffWipe5* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe5/OceffWipe5_Destroy.s") + Actor_SetScale(&this->actor, 1.0f); + this->counter = 0; + this->actor.world.pos = play->cameraPtrs[play->activeCamId]->eye; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe5/OceffWipe5_Update.s") +void OceffWipe5_Destroy(Actor* thisx, PlayState* play) { + OceffWipe5* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Oceff_Wipe5/OceffWipe5_Draw.s") + Magic_Reset(play); + play->msgCtx.unk120B0 = 0; +} + +void OceffWipe5_Update(Actor* thisx, PlayState* play) { + OceffWipe5* this = THIS; + + this->actor.world.pos = GET_ACTIVE_CAM(play)->eye; + if (this->counter < 100) { + this->counter++; + } else { + Actor_MarkForDeath(&this->actor); + } +} + +#include "assets/overlays/ovl_Oceff_Wipe5/ovl_Oceff_Wipe5.c" + +static u8 sPrimColors[] = { + 255, 255, 200, 255, 255, 200, 200, 255, 255, 255, 255, 200, 255, 200, 255, +}; + +static u8 sEnvColors[] = { + 50, 200, 0, 255, 50, 0, 0, 100, 255, 255, 150, 0, 255, 0, 200, +}; + +void OceffWipe5_Draw(Actor* thisx, PlayState* play) { + OceffWipe5* this = THIS; + f32 z; + s32 pad; + s32 i; + s32 pad2; + Vec3f activeCamEye = GET_ACTIVE_CAM(play)->eye; + Camera* cam = GET_ACTIVE_CAM(play); + Vec3f quakeOffset; + u8 alpha; + s32 colorIndex = OCEFF_WIPE5_GET_SONG_TYPE(thisx) * 3; + f32 phi_fv1 = 1220.0f; + + if ((((OCEFF_WIPE5_GET_SONG_TYPE(thisx) == 2) && (play->sceneId == SCENE_LABO)) && + ((play->csCtx.currentCsIndex == 0) || (play->csCtx.currentCsIndex == 1))) && + (play->csCtx.state != 0)) { + phi_fv1 = 1150.0f; + } + + if (colorIndex >= 13) { + colorIndex = 0; + } + + Camera_GetQuakeOffset(&quakeOffset, cam); + + if (this->counter < 32) { + z = Math_SinS(this->counter << 9) * phi_fv1; + } else { + z = phi_fv1; + } + + if (this->counter >= 80) { + alpha = 12 * (100 - this->counter); + } else { + alpha = 255; + } + for (i = 1; i < ARRAY_COUNT(gOceff5Vtx); i += 2) { + gOceff5Vtx[i].v.cn[3] = alpha; + } + + OPEN_DISPS(play->state.gfxCtx); + + func_8012C2DC(play->state.gfxCtx); + + Matrix_Translate(activeCamEye.x + quakeOffset.x, activeCamEye.y + quakeOffset.y, activeCamEye.z + quakeOffset.z, + MTXMODE_NEW); + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_RotateXS(0x708, MTXMODE_APPLY); + Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); + + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, sPrimColors[colorIndex], sPrimColors[colorIndex + 1], + sPrimColors[colorIndex + 2], 255); + gDPSetEnvColor(POLY_XLU_DISP++, sEnvColors[colorIndex], sEnvColors[colorIndex + 1], sEnvColors[colorIndex + 2], + 255); + + AnimatedMat_Draw(play, gOceff5TexAnim); + + gSPDisplayList(POLY_XLU_DISP++, &gOceff5DL); + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.h b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.h index 063d0386b..05424ea1e 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.h +++ b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.h @@ -3,11 +3,13 @@ #include "global.h" +#define OCEFF_WIPE5_GET_SONG_TYPE(thisx) ((thisx)->params & 0xF) + struct OceffWipe5; typedef struct OceffWipe5 { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ s16 counter; } OceffWipe5; // size = 0x148 extern const ActorInit Oceff_Wipe5_InitVars; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index e8a872802..681438463 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -5,6 +5,7 @@ */ #include "global.h" +#include "z64quake.h" #include "z64rumble.h" #define THIS ((Player*)thisx) diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c index 9dab9c61a..bd8a40ed8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c @@ -91,7 +91,7 @@ void EffectSsBubble_Update(PlayState* play2, u32 index, EffectSs* this) { BgCheck_EntityRaycastFloor2_1(play, &play->colCtx, &colPoly, &this->pos); speed = SurfaceType_GetConveyorSpeed(&play->colCtx, colPoly, BGCHECK_SCENE); - if ((speed != 0) && !SurfaceType_GetConveyorType(&play->colCtx, colPoly, BGCHECK_SCENE)) { + if ((speed != 0) && !SurfaceType_IsFloorConveyor(&play->colCtx, colPoly, BGCHECK_SCENE)) { direction = SurfaceType_GetConveyorDirection(&play->colCtx, colPoly, BGCHECK_SCENE) << 0xA; rVecAdjMax = sVecAdjMaximums[speed - 1]; this->rVecAdjX = Math_SinS(direction) * rVecAdjMax; diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index b7e5ec378..42336b9bc 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -17,7 +17,7 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { gSaveContext.save.entrance = sOpeningEntrances[D_801BB12C]; gSaveContext.nextCutsceneIndex = gSaveContext.save.cutscene = sOpeningCutscenes[D_801BB12C]; - gSaveContext.sceneSetupIndex = 0; + gSaveContext.sceneLayer = 0; gSaveContext.save.time = CLOCK_TIME(8, 0); gSaveContext.save.day = 1; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 69eb3dc98..5ec343e7f 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -41,8 +41,8 @@ void MapSelect_LoadGame(MapSelectState* this, u32 entrance, s32 spawn) { } gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance = 0xFFFF; - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; gSaveContext.showTitleCard = true; gSaveContext.respawnFlag = 0; gSaveContext.respawn[RESPAWN_MODE_GORON].entrance = 0xFF; diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 352997f94..62d2a36d0 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -128,8 +128,8 @@ void ConsoleLogo_Main(GameState* thisx) { ConsoleLogo_UpdateCounters(this); ConsoleLogo_Draw(&this->state); if (this->exit) { - gSaveContext.seqIndex = (u8)NA_BGM_DISABLED; - gSaveContext.nightSeqIndex = 0xFF; + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; gSaveContext.gameMode = 1; STOP_GAMESTATE(&this->state); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c index 9f6a58a86..c1f67b079 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_debug.c @@ -663,8 +663,8 @@ void KaleidoScope_UpdateInventoryEditor(PlayState* play) { s16 value; s32 dBtnInput = input->cur.button & (BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT); - pauseCtx->stickRelX = input->rel.stick_x; - pauseCtx->stickRelY = input->rel.stick_y; + pauseCtx->stickAdjX = input->rel.stick_x; + pauseCtx->stickAdjY = input->rel.stick_y; // Handles navigating the menu to different sections with the D-Pad // When the same direction is held, registers the input periodically based on a timer diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index 678001585..c8b714e09 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -7,13 +7,6 @@ #include "z_kaleido_scope.h" #include "interface/parameter_static/parameter_static.h" -typedef enum { - /* 0 */ EQUIP_STATE_MAGIC_ARROW_GROW_ORB, - /* 1 */ EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT, - /* 2 */ EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT, - /* 3 */ EQUIP_STATE_MOVE_TO_C_BTN -} EquipState; - s16 sEquipState = EQUIP_STATE_MAGIC_ARROW_GROW_ORB; // Timer to hold magic arrow icon over magic arrow slot before moving when equipping. @@ -357,8 +350,8 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { u16 cursorSlot; u8 magicArrowIndex; s16 cursorPoint; - s16 cursorX; - s16 cursorY; + s16 cursorXIndex; + s16 cursorYIndex; s16 oldCursorPoint; s16 moveCursorResult; s16 pad2; @@ -368,7 +361,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { if ((pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM) && !pauseCtx->itemDescriptionOn) { - moveCursorResult = 0; + moveCursorResult = PAUSE_CURSOR_RESULT_NONE; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; cursorItem = pauseCtx->cursorItem[PAUSE_ITEM]; @@ -378,87 +371,87 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { // cursor is currently on a slot pauseCtx->cursorColorSet = 2; - if (ABS_ALT(pauseCtx->stickRelX) > 30) { + if (ABS_ALT(pauseCtx->stickAdjX) > 30) { cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; - cursorX = pauseCtx->cursorX[PAUSE_ITEM]; - cursorY = pauseCtx->cursorY[PAUSE_ITEM]; + cursorXIndex = pauseCtx->cursorXIndex[PAUSE_ITEM]; + cursorYIndex = pauseCtx->cursorYIndex[PAUSE_ITEM]; // Search for slot to move to - while (moveCursorResult == 0) { - if (pauseCtx->stickRelX < -30) { + while (moveCursorResult == PAUSE_CURSOR_RESULT_NONE) { + if (pauseCtx->stickAdjX < -30) { // move cursor left pauseCtx->unk_298 = 4.0f; - if (pauseCtx->cursorX[PAUSE_ITEM] != 0) { - pauseCtx->cursorX[PAUSE_ITEM]--; + if (pauseCtx->cursorXIndex[PAUSE_ITEM] != 0) { + pauseCtx->cursorXIndex[PAUSE_ITEM]--; pauseCtx->cursorPoint[PAUSE_ITEM]--; - moveCursorResult = 1; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; } else { - pauseCtx->cursorX[PAUSE_ITEM] = cursorX; - pauseCtx->cursorY[PAUSE_ITEM]++; + pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex; + pauseCtx->cursorYIndex[PAUSE_ITEM]++; - if (pauseCtx->cursorY[PAUSE_ITEM] >= 4) { - pauseCtx->cursorY[PAUSE_ITEM] = 0; + if (pauseCtx->cursorYIndex[PAUSE_ITEM] >= 4) { + pauseCtx->cursorYIndex[PAUSE_ITEM] = 0; } pauseCtx->cursorPoint[PAUSE_ITEM] = - pauseCtx->cursorX[PAUSE_ITEM] + (pauseCtx->cursorY[PAUSE_ITEM] * 6); + pauseCtx->cursorXIndex[PAUSE_ITEM] + (pauseCtx->cursorYIndex[PAUSE_ITEM] * 6); if (pauseCtx->cursorPoint[PAUSE_ITEM] >= 24) { - pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorX[PAUSE_ITEM]; + pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorXIndex[PAUSE_ITEM]; } - if (cursorY == pauseCtx->cursorY[PAUSE_ITEM]) { - pauseCtx->cursorX[PAUSE_ITEM] = cursorX; + if (cursorYIndex == pauseCtx->cursorYIndex[PAUSE_ITEM]) { + pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); - moveCursorResult = 2; + moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; } } - } else if (pauseCtx->stickRelX > 30) { + } else if (pauseCtx->stickAdjX > 30) { // move cursor right pauseCtx->unk_298 = 4.0f; - if (pauseCtx->cursorX[PAUSE_ITEM] <= 4) { - pauseCtx->cursorX[PAUSE_ITEM]++; + if (pauseCtx->cursorXIndex[PAUSE_ITEM] <= 4) { + pauseCtx->cursorXIndex[PAUSE_ITEM]++; pauseCtx->cursorPoint[PAUSE_ITEM]++; - moveCursorResult = 1; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; } else { - pauseCtx->cursorX[PAUSE_ITEM] = cursorX; - pauseCtx->cursorY[PAUSE_ITEM]++; + pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex; + pauseCtx->cursorYIndex[PAUSE_ITEM]++; - if (pauseCtx->cursorY[PAUSE_ITEM] >= 4) { - pauseCtx->cursorY[PAUSE_ITEM] = 0; + if (pauseCtx->cursorYIndex[PAUSE_ITEM] >= 4) { + pauseCtx->cursorYIndex[PAUSE_ITEM] = 0; } pauseCtx->cursorPoint[PAUSE_ITEM] = - pauseCtx->cursorX[PAUSE_ITEM] + (pauseCtx->cursorY[PAUSE_ITEM] * 6); + pauseCtx->cursorXIndex[PAUSE_ITEM] + (pauseCtx->cursorYIndex[PAUSE_ITEM] * 6); if (pauseCtx->cursorPoint[PAUSE_ITEM] >= 24) { - pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorX[PAUSE_ITEM]; + pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorXIndex[PAUSE_ITEM]; } - if (cursorY == pauseCtx->cursorY[PAUSE_ITEM]) { - pauseCtx->cursorX[PAUSE_ITEM] = cursorX; + if (cursorYIndex == pauseCtx->cursorYIndex[PAUSE_ITEM]) { + pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); - moveCursorResult = 2; + moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; } } } } - if (moveCursorResult == 1) { + if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) { cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; } } } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { - if (pauseCtx->stickRelX > 30) { + if (pauseCtx->stickAdjX > 30) { func_80821A04(play); - cursorY = 0; - cursorX = 0; + cursorYIndex = 0; + cursorXIndex = 0; cursorPoint = 0; // top row, left column (SLOT_OCARINA) // Search for slot to move to @@ -466,24 +459,24 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { // Check if current cursor has an item in its slot if (gSaveContext.save.inventory.items[cursorPoint] != ITEM_NONE) { pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; - pauseCtx->cursorX[PAUSE_ITEM] = cursorX; - pauseCtx->cursorY[PAUSE_ITEM] = cursorY; - moveCursorResult = 1; + pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex; + pauseCtx->cursorYIndex[PAUSE_ITEM] = cursorYIndex; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; break; } // move 1 row down and retry - cursorY++; + cursorYIndex++; cursorPoint += 6; - if (cursorY < 4) { + if (cursorYIndex < 4) { continue; } // move 1 column right and retry - cursorY = 0; - cursorPoint = cursorX + 1; - cursorX = cursorPoint; - if (cursorX < 6) { + cursorYIndex = 0; + cursorPoint = cursorXIndex + 1; + cursorXIndex = cursorPoint; + if (cursorXIndex < 6) { continue; } @@ -493,35 +486,35 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { } } } else { // PAUSE_CURSOR_PAGE_RIGHT - if (pauseCtx->stickRelX < -30) { + if (pauseCtx->stickAdjX < -30) { func_80821A04(play); - cursorX = 5; + cursorXIndex = 5; cursorPoint = 5; // top row, right columne (SLOT_TRADE_DEED) - cursorY = 0; + cursorYIndex = 0; // Search for slot to move to while (true) { // Check if current cursor has an item in its slot if (gSaveContext.save.inventory.items[cursorPoint] != ITEM_NONE) { pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; - pauseCtx->cursorX[PAUSE_ITEM] = cursorX; - pauseCtx->cursorY[PAUSE_ITEM] = cursorY; - moveCursorResult = 1; + pauseCtx->cursorXIndex[PAUSE_ITEM] = cursorXIndex; + pauseCtx->cursorYIndex[PAUSE_ITEM] = cursorYIndex; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; break; } // move 1 row down and retry - cursorY++; + cursorYIndex++; cursorPoint += 6; - if (cursorY < 4) { + if (cursorYIndex < 4) { continue; } // move 1 column left and retry - cursorY = 0; - cursorPoint = cursorX - 1; - cursorX = cursorPoint; - if (cursorX >= 0) { + cursorYIndex = 0; + cursorPoint = cursorXIndex - 1; + cursorXIndex = cursorPoint; + if (cursorXIndex >= 0) { continue; } @@ -534,35 +527,35 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { if (pauseCtx->cursorSpecialPos == 0) { // move cursor up/down - if (ABS_ALT(pauseCtx->stickRelY) > 30) { - moveCursorResult = 0; + if (ABS_ALT(pauseCtx->stickAdjY) > 30) { + moveCursorResult = PAUSE_CURSOR_RESULT_NONE; cursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; - cursorY = pauseCtx->cursorY[PAUSE_ITEM]; + cursorYIndex = pauseCtx->cursorYIndex[PAUSE_ITEM]; - while (moveCursorResult == 0) { - if (pauseCtx->stickRelY > 30) { + while (moveCursorResult == PAUSE_CURSOR_RESULT_NONE) { + if (pauseCtx->stickAdjY > 30) { // move cursor up - moveCursorResult = 2; - if (pauseCtx->cursorY[PAUSE_ITEM] != 0) { - pauseCtx->cursorY[PAUSE_ITEM]--; + moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; + if (pauseCtx->cursorYIndex[PAUSE_ITEM] != 0) { + pauseCtx->cursorYIndex[PAUSE_ITEM]--; pauseCtx->unk_298 = 4.0f; pauseCtx->cursorPoint[PAUSE_ITEM] -= 6; - moveCursorResult = 1; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; } else { - pauseCtx->cursorY[PAUSE_ITEM] = cursorY; + pauseCtx->cursorYIndex[PAUSE_ITEM] = cursorYIndex; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; } - } else if (pauseCtx->stickRelY < -30) { + } else if (pauseCtx->stickAdjY < -30) { // move cursor down - moveCursorResult = 2; - if (pauseCtx->cursorY[PAUSE_ITEM] < 3) { - pauseCtx->cursorY[PAUSE_ITEM]++; + moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; + if (pauseCtx->cursorYIndex[PAUSE_ITEM] < 3) { + pauseCtx->cursorYIndex[PAUSE_ITEM]++; pauseCtx->unk_298 = 4.0f; pauseCtx->cursorPoint[PAUSE_ITEM] += 6; - moveCursorResult = 1; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; } else { - pauseCtx->cursorY[PAUSE_ITEM] = cursorY; + pauseCtx->cursorYIndex[PAUSE_ITEM] = cursorYIndex; pauseCtx->cursorPoint[PAUSE_ITEM] = cursorPoint; } } @@ -572,9 +565,9 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { cursorSlot = pauseCtx->cursorPoint[PAUSE_ITEM]; pauseCtx->cursorColorSet = 2; - if (moveCursorResult == 1) { + if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) { cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; - } else if (moveCursorResult != 2) { + } else if (moveCursorResult != PAUSE_CURSOR_RESULT_SPECIAL_POS) { cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]]; } @@ -685,7 +678,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { (msgCtx->msgLength == 0)) { // Give description on item through a message box pauseCtx->itemDescriptionOn = true; - if (pauseCtx->cursorY[PAUSE_ITEM] < 2) { + if (pauseCtx->cursorYIndex[PAUSE_ITEM] < 2) { func_801514B0(play, 0x1700 + pauseCtx->cursorItem[PAUSE_ITEM], 3); } else { func_801514B0(play, 0x1700 + pauseCtx->cursorItem[PAUSE_ITEM], 1); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c index f8f61c5dc..fd7efcdb0 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c @@ -1,59 +1,810 @@ /* * File: z_kaleido_mask.c * Overlay: ovl_kaleido_scope - * Description: + * Description: Pause Menu - Mask Page */ #include "z_kaleido_scope.h" +#include "interface/parameter_static/parameter_static.h" -extern UNK_TYPE D_02001360; -extern UNK_TYPE D_020044A0; -extern UNK_TYPE D_02004AA0; -extern UNK_TYPE D_0200B998; -extern UNK_TYPE D_08062000; -extern UNK_TYPE D_08064340; -extern UNK_TYPE D_0B000000; -extern UNK_TYPE D_0C000000; -extern UNK_TYPE D_0C006C00; +s16 sMaskEquipState = EQUIP_STATE_MAGIC_ARROW_GROW_ORB; -s32 D_8082B600 = 0; +// Timer to hold magic arrow icon over magic arrow slot before moving when equipping. +s16 sMaskEquipMagicArrowSlotHoldTimer = 0; -s32 D_8082B604 = 0; +// Number of frames to move icon from slot to target position when equipping. +s16 sMaskEquipAnimTimer = 10; -s16 D_8082B608 = 10; - -s32 D_8082B60C[] = { - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00010000, - 0x00000001, 0x00000000, 0x00010000, 0x00000001, 0x00000000, 0x00010000, 0x00000001, 0x00000000, - 0x00010000, 0x00000001, 0x00000000, 0x00010000, 0x00000001, 0x00000000, 0x00010000, 0x00000001, - 0x01010101, 0x01010101, 0x01010101, 0x01010101, 0x01010101, 0x01010101, +u8 gMaskPlayerFormSlotRestrictions[PLAYER_FORM_MAX][NUM_MASK_SLOTS] = { + // Fierce Deity + { + false, // SLOT_MASK_POSTMAN + false, // SLOT_MASK_ALL_NIGHT + false, // SLOT_MASK_BLAST + false, // SLOT_MASK_STONE + false, // SLOT_MASK_GREAT_FAIRY + false, // SLOT_MASK_DEKU + false, // SLOT_MASK_KEATON + false, // SLOT_MASK_BREMEN + false, // SLOT_MASK_BUNNY + false, // SLOT_MASK_DON_GERO + false, // SLOT_MASK_SCENTS + false, // SLOT_MASK_GORON + false, // SLOT_MASK_ROMANI + false, // SLOT_MASK_CIRCUS_LEADER + false, // SLOT_MASK_KAFEIS_MASK + false, // SLOT_MASK_COUPLE + false, // SLOT_MASK_TRUTH + false, // SLOT_MASK_ZORA + false, // SLOT_MASK_KAMARO + false, // SLOT_MASK_GIBDO + false, // SLOT_MASK_GARO + false, // SLOT_MASK_CAPTAIN + false, // SLOT_MASK_GIANT + true, // SLOT_MASK_FIERCE_DEITY + }, + // Goron + { + false, // SLOT_MASK_POSTMAN + false, // SLOT_MASK_ALL_NIGHT + false, // SLOT_MASK_BLAST + false, // SLOT_MASK_STONE + false, // SLOT_MASK_GREAT_FAIRY + true, // SLOT_MASK_DEKU + false, // SLOT_MASK_KEATON + false, // SLOT_MASK_BREMEN + false, // SLOT_MASK_BUNNY + false, // SLOT_MASK_DON_GERO + false, // SLOT_MASK_SCENTS + true, // SLOT_MASK_GORON + false, // SLOT_MASK_ROMANI + false, // SLOT_MASK_CIRCUS_LEADER + false, // SLOT_MASK_KAFEIS_MASK + false, // SLOT_MASK_COUPLE + false, // SLOT_MASK_TRUTH + true, // SLOT_MASK_ZORA + false, // SLOT_MASK_KAMARO + false, // SLOT_MASK_GIBDO + false, // SLOT_MASK_GARO + false, // SLOT_MASK_CAPTAIN + false, // SLOT_MASK_GIANT + true, // SLOT_MASK_FIERCE_DEITY + }, + // Zora + { + false, // SLOT_MASK_POSTMAN + false, // SLOT_MASK_ALL_NIGHT + false, // SLOT_MASK_BLAST + false, // SLOT_MASK_STONE + false, // SLOT_MASK_GREAT_FAIRY + true, // SLOT_MASK_DEKU + false, // SLOT_MASK_KEATON + false, // SLOT_MASK_BREMEN + false, // SLOT_MASK_BUNNY + false, // SLOT_MASK_DON_GERO + false, // SLOT_MASK_SCENTS + true, // SLOT_MASK_GORON + false, // SLOT_MASK_ROMANI + false, // SLOT_MASK_CIRCUS_LEADER + false, // SLOT_MASK_KAFEIS_MASK + false, // SLOT_MASK_COUPLE + false, // SLOT_MASK_TRUTH + true, // SLOT_MASK_ZORA + false, // SLOT_MASK_KAMARO + false, // SLOT_MASK_GIBDO + false, // SLOT_MASK_GARO + false, // SLOT_MASK_CAPTAIN + false, // SLOT_MASK_GIANT + true, // SLOT_MASK_FIERCE_DEITY + }, + // Deku + { + false, // SLOT_MASK_POSTMAN + false, // SLOT_MASK_ALL_NIGHT + false, // SLOT_MASK_BLAST + false, // SLOT_MASK_STONE + false, // SLOT_MASK_GREAT_FAIRY + true, // SLOT_MASK_DEKU + false, // SLOT_MASK_KEATON + false, // SLOT_MASK_BREMEN + false, // SLOT_MASK_BUNNY + false, // SLOT_MASK_DON_GERO + false, // SLOT_MASK_SCENTS + true, // SLOT_MASK_GORON + false, // SLOT_MASK_ROMANI + false, // SLOT_MASK_CIRCUS_LEADER + false, // SLOT_MASK_KAFEIS_MASK + false, // SLOT_MASK_COUPLE + false, // SLOT_MASK_TRUTH + true, // SLOT_MASK_ZORA + false, // SLOT_MASK_KAMARO + false, // SLOT_MASK_GIBDO + false, // SLOT_MASK_GARO + false, // SLOT_MASK_CAPTAIN + false, // SLOT_MASK_GIANT + true, // SLOT_MASK_FIERCE_DEITY + }, + // Human + { + true, // SLOT_MASK_POSTMAN + true, // SLOT_MASK_ALL_NIGHT + true, // SLOT_MASK_BLAST + true, // SLOT_MASK_STONE + true, // SLOT_MASK_GREAT_FAIRY + true, // SLOT_MASK_DEKU + true, // SLOT_MASK_KEATON + true, // SLOT_MASK_BREMEN + true, // SLOT_MASK_BUNNY + true, // SLOT_MASK_DON_GERO + true, // SLOT_MASK_SCENTS + true, // SLOT_MASK_GORON + true, // SLOT_MASK_ROMANI + true, // SLOT_MASK_CIRCUS_LEADER + true, // SLOT_MASK_KAFEIS_MASK + true, // SLOT_MASK_COUPLE + true, // SLOT_MASK_TRUTH + true, // SLOT_MASK_ZORA + true, // SLOT_MASK_KAMARO + true, // SLOT_MASK_GIBDO + true, // SLOT_MASK_GARO + true, // SLOT_MASK_CAPTAIN + true, // SLOT_MASK_GIANT + true, // SLOT_MASK_FIERCE_DEITY + }, }; -s32 D_8082B684[] = { - 0x01010004, 0x02020180, 0x01040210, 0x00100201, 0x00080110, 0x02040220, 0x00400080, 0x00020102, 0x00010240, - 0x01200108, 0x00200140, 0x02080280, 0x00FF0064, 0x00FF0000, 0x00000064, 0x00FF0000, 0x000000FF, 0x00640000, +#define SET_MOON_MASK_BIT(masksGivenOnMoonIndex, masksGivenOnMoonFlag) \ + ((masksGivenOnMoonIndex) << 8 | (masksGivenOnMoonFlag)) +#define CHECK_GIVEN_MASK_ON_MOON(maskIndex) \ + (gSaveContext.masksGivenOnMoon[sMasksGivenOnMoonBits[maskIndex] >> 8] & (u8)sMasksGivenOnMoonBits[maskIndex]) + +u16 sMasksGivenOnMoonBits[] = { + SET_MOON_MASK_BIT(1, 0x1), // SLOT_MASK_POSTMAN + SET_MOON_MASK_BIT(0, 0x4), // SLOT_MASK_ALL_NIGHT + SET_MOON_MASK_BIT(2, 0x2), // SLOT_MASK_BLAST + SET_MOON_MASK_BIT(1, 0x80), // SLOT_MASK_STONE + SET_MOON_MASK_BIT(1, 0x4), // SLOT_MASK_GREAT_FAIRY + SET_MOON_MASK_BIT(2, 0x10), // SLOT_MASK_DEKU + SET_MOON_MASK_BIT(0, 0x10), // SLOT_MASK_KEATON + SET_MOON_MASK_BIT(2, 0x1), // SLOT_MASK_BREMEN + SET_MOON_MASK_BIT(0, 0x8), // SLOT_MASK_BUNNY + SET_MOON_MASK_BIT(1, 0x10), // SLOT_MASK_DON_GERO + SET_MOON_MASK_BIT(2, 0x4), // SLOT_MASK_SCENTS + SET_MOON_MASK_BIT(2, 0x20), // SLOT_MASK_GORON + SET_MOON_MASK_BIT(0, 0x40), // SLOT_MASK_ROMANI + SET_MOON_MASK_BIT(0, 0x80), // SLOT_MASK_CIRCUS_LEADER + SET_MOON_MASK_BIT(0, 0x2), // SLOT_MASK_KAFEIS_MASK + SET_MOON_MASK_BIT(1, 0x2), // SLOT_MASK_COUPLE + SET_MOON_MASK_BIT(0, 0x1), // SLOT_MASK_TRUTH + SET_MOON_MASK_BIT(2, 0x40), // SLOT_MASK_ZORA + SET_MOON_MASK_BIT(1, 0x20), // SLOT_MASK_KAMARO + SET_MOON_MASK_BIT(1, 0x8), // SLOT_MASK_GIBDO + SET_MOON_MASK_BIT(0, 0x20), // SLOT_MASK_GARO + SET_MOON_MASK_BIT(1, 0x40), // SLOT_MASK_CAPTAIN + SET_MOON_MASK_BIT(2, 0x8), // SLOT_MASK_GIANT + SET_MOON_MASK_BIT(2, 0X80), // SLOT_MASK_FIERCE_DEITY }; -u8 D_8082B6CC[] = { 0x35, 0x33, 0x34, 0x32, 0xFF }; +s16 sMaskMagicArrowEffectsR[] = { 255, 100, 255 }; +s16 sMaskMagicArrowEffectsG[] = { 0, 100, 255 }; +s16 sMaskMagicArrowEffectsB[] = { 0, 255, 100 }; -s16 D_8082B6D4[] = { - 0x0294, - 0x0384, - 0x0474, - 0x0000, +void KaleidoScope_DrawMaskSelect(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + u16 i; + u16 j; + + OPEN_DISPS(play->state.gfxCtx); + + KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MASK] * 4, pauseCtx->maskVtx); + + func_8012C8AC(play->state.gfxCtx); + + // Draw a white box around the items that are equipped on the C buttons + // Loop over c-buttons (i) and vtx offset (j) + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + for (i = 0, j = NUM_MASK_SLOTS * 4; i < 3; i++, j += 4) { + if (GET_CUR_FORM_BTN_ITEM(i + 1) != ITEM_NONE) { + if (GET_CUR_FORM_BTN_SLOT(i + 1) >= NUM_ITEM_SLOTS) { + gSPVertex(POLY_OPA_DISP++, &pauseCtx->maskVtx[j], 4, 0); + POLY_OPA_DISP = Gfx_DrawQuadTextureIA8(POLY_OPA_DISP, gEquippedItemOutlineTex, 32, 32, 0); + } + } + } + + gDPPipeSync(POLY_OPA_DISP++); + + // Draw the item icons + // Loop over slots (i) and vtx offset (j) + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + for (j = 0, i = 0; i < NUM_MASK_SLOTS; i++, j += 4) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + if (((void)0, gSaveContext.save.inventory.items[i + NUM_ITEM_SLOTS]) != ITEM_NONE) { + if (!CHECK_GIVEN_MASK_ON_MOON(i)) { + if ((pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MASK) && + (pauseCtx->cursorSpecialPos == 0) && + gMaskPlayerFormSlotRestrictions[(void)0, gSaveContext.save.playerForm][i]) { + if ((sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT) && (i == SLOT_ARROW_ICE)) { + // Possible bug: + // Supposed to be `SLOT_BOW`, unchanged from OoT, instead increase size of ice arrow icon + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, + sMaskMagicArrowEffectsR[pauseCtx->equipTargetItem - 0xB5], + sMaskMagicArrowEffectsG[pauseCtx->equipTargetItem - 0xB5], + sMaskMagicArrowEffectsB[pauseCtx->equipTargetItem - 0xB5], pauseCtx->alpha); + + pauseCtx->maskVtx[j + 0].v.ob[0] = pauseCtx->maskVtx[j + 2].v.ob[0] = + pauseCtx->maskVtx[j + 0].v.ob[0] - 2; + pauseCtx->maskVtx[j + 1].v.ob[0] = pauseCtx->maskVtx[j + 3].v.ob[0] = + pauseCtx->maskVtx[j + 0].v.ob[0] + 32; + pauseCtx->maskVtx[j + 0].v.ob[1] = pauseCtx->maskVtx[j + 1].v.ob[1] = + pauseCtx->maskVtx[j + 0].v.ob[1] + 2; + pauseCtx->maskVtx[j + 2].v.ob[1] = pauseCtx->maskVtx[j + 3].v.ob[1] = + pauseCtx->maskVtx[j + 0].v.ob[1] - 32; + + } else if (i == pauseCtx->cursorSlot[PAUSE_MASK]) { + // Increase the size of the selected item + pauseCtx->maskVtx[j + 0].v.ob[0] = pauseCtx->maskVtx[j + 2].v.ob[0] = + pauseCtx->maskVtx[j + 0].v.ob[0] - 2; + pauseCtx->maskVtx[j + 1].v.ob[0] = pauseCtx->maskVtx[j + 3].v.ob[0] = + pauseCtx->maskVtx[j + 0].v.ob[0] + 32; + pauseCtx->maskVtx[j + 0].v.ob[1] = pauseCtx->maskVtx[j + 1].v.ob[1] = + pauseCtx->maskVtx[j + 0].v.ob[1] + 2; + pauseCtx->maskVtx[j + 2].v.ob[1] = pauseCtx->maskVtx[j + 3].v.ob[1] = + pauseCtx->maskVtx[j + 0].v.ob[1] - 32; + } + } + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->maskVtx[j + 0], 4, 0); + KaleidoScope_DrawQuadTextureRGBA32( + play->state.gfxCtx, gItemIcons[((void)0, gSaveContext.save.inventory.items[i + NUM_ITEM_SLOTS])], + 32, 32, 0); + } + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +u8 sMaskPlayerFormItems[] = { + ITEM_MASK_FIERCE_DEITY, ITEM_MASK_GORON, ITEM_MASK_ZORA, ITEM_MASK_DEKU, ITEM_NONE, }; -s16 D_8082B6DC[] = { - 0x044C, - 0x0398, - 0x044C, - 0x0000, -}; +void KaleidoScope_UpdateMaskCursor(PlayState* play) { + Input* input = CONTROLLER1(&play->state); + PauseContext* pauseCtx = &play->pauseCtx; + MessageContext* msgCtx = &play->msgCtx; + u16 vtxIndex; + u16 cursorItem; + u16 cursorSlot; + s16 cursorPoint; + s16 cursorXIndex; + s16 cursorYIndex; + s16 oldCursorPoint; + s16 moveCursorResult; + s16 pad2; -s16 D_8082B6E4 = 0; + pauseCtx->cursorColorSet = 0; + pauseCtx->nameColorSet = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081FF80.s") + if ((pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MASK) && + !pauseCtx->itemDescriptionOn) { + moveCursorResult = PAUSE_CURSOR_RESULT_NONE; + oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MASK]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808204AC.s") + cursorItem = pauseCtx->cursorItem[PAUSE_MASK]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80820FA4.s") + // Move cursor left/right + if (pauseCtx->cursorSpecialPos == 0) { + // cursor is currently on a slot + pauseCtx->cursorColorSet = 2; + + if (ABS_ALT(pauseCtx->stickAdjX) > 30) { + cursorPoint = pauseCtx->cursorPoint[PAUSE_MASK]; + cursorXIndex = pauseCtx->cursorXIndex[PAUSE_MASK]; + cursorYIndex = pauseCtx->cursorYIndex[PAUSE_MASK]; + + // Search for slot to move to + while (moveCursorResult == PAUSE_CURSOR_RESULT_NONE) { + if (pauseCtx->stickAdjX < -30) { + // move cursor left + pauseCtx->unk_298 = 4.0f; + if (pauseCtx->cursorXIndex[PAUSE_MASK] != 0) { + pauseCtx->cursorXIndex[PAUSE_MASK]--; + pauseCtx->cursorPoint[PAUSE_MASK]--; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; + } else { + pauseCtx->cursorYIndex[PAUSE_MASK]++; + + if (pauseCtx->cursorYIndex[PAUSE_MASK] >= 4) { + pauseCtx->cursorYIndex[PAUSE_MASK] = 0; + } + + pauseCtx->cursorPoint[PAUSE_MASK] = + pauseCtx->cursorXIndex[PAUSE_MASK] + (pauseCtx->cursorYIndex[PAUSE_MASK] * 6); + + if (pauseCtx->cursorPoint[PAUSE_MASK] >= NUM_MASK_SLOTS) { + pauseCtx->cursorPoint[PAUSE_MASK] = pauseCtx->cursorXIndex[PAUSE_MASK]; + } + + if (cursorYIndex == pauseCtx->cursorYIndex[PAUSE_MASK]) { + pauseCtx->cursorXIndex[PAUSE_MASK] = cursorXIndex; + pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint; + + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + + moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; + } + } + } else if (pauseCtx->stickAdjX > 30) { + // move cursor right + pauseCtx->unk_298 = 4.0f; + if (pauseCtx->cursorXIndex[PAUSE_MASK] <= 4) { + pauseCtx->cursorXIndex[PAUSE_MASK]++; + pauseCtx->cursorPoint[PAUSE_MASK]++; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; + } else { + pauseCtx->cursorYIndex[PAUSE_MASK]++; + + if (pauseCtx->cursorYIndex[PAUSE_MASK] >= 4) { + pauseCtx->cursorYIndex[PAUSE_MASK] = 0; + } + + pauseCtx->cursorPoint[PAUSE_MASK] = + pauseCtx->cursorXIndex[PAUSE_MASK] + (pauseCtx->cursorYIndex[PAUSE_MASK] * 6); + + if (pauseCtx->cursorPoint[PAUSE_MASK] >= NUM_MASK_SLOTS) { + pauseCtx->cursorPoint[PAUSE_MASK] = pauseCtx->cursorXIndex[PAUSE_MASK]; + } + + if (cursorYIndex == pauseCtx->cursorYIndex[PAUSE_MASK]) { + pauseCtx->cursorXIndex[PAUSE_MASK] = cursorXIndex; + pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint; + + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + + moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; + } + } + } + } + + if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) { + cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS]; + if (CHECK_GIVEN_MASK_ON_MOON(pauseCtx->cursorPoint[PAUSE_MASK])) { + cursorItem = ITEM_NONE; + } + } + } + } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { + if (pauseCtx->stickAdjX > 30) { + func_80821A04(play); + cursorYIndex = 0; + cursorXIndex = 0; + cursorPoint = 0; // top row, left column (SLOT_MASK_POSTMAN) + + // Search for slot to move to + while (true) { + // Check if current cursor has an item in its slot + if ((gSaveContext.save.inventory.items[cursorPoint + NUM_ITEM_SLOTS] != ITEM_NONE) && + !CHECK_GIVEN_MASK_ON_MOON(cursorPoint)) { + pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint; + pauseCtx->cursorXIndex[PAUSE_MASK] = cursorXIndex; + pauseCtx->cursorYIndex[PAUSE_MASK] = cursorYIndex; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; + break; + } + + // move 1 row down and retry + cursorYIndex++; + cursorPoint += 6; + if (cursorYIndex < 4) { + continue; + } + + // move 1 column right and retry + cursorYIndex = 0; + cursorPoint = cursorXIndex + 1; + cursorXIndex = cursorPoint; + if (cursorXIndex < 6) { + continue; + } + + // No item available + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); + break; + } + } + } else { // PAUSE_CURSOR_PAGE_RIGHT + //! FAKE: + if (1) {} + if (pauseCtx->stickAdjX < -30) { + func_80821A04(play); + cursorXIndex = 5; + cursorPoint = 5; // top row, right column (SLOT_MASK_DEKU) + cursorYIndex = 0; + + // Search for slot to move to + while (true) { + // Check if current cursor has an item in its slot + if ((gSaveContext.save.inventory.items[cursorPoint + NUM_ITEM_SLOTS] != ITEM_NONE) && + !CHECK_GIVEN_MASK_ON_MOON(cursorPoint)) { + pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint; + pauseCtx->cursorXIndex[PAUSE_MASK] = cursorXIndex; + pauseCtx->cursorYIndex[PAUSE_MASK] = cursorYIndex; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; + break; + } + + // move 1 row down and retry + cursorYIndex++; + cursorPoint += 6; + if (cursorYIndex < 4) { + continue; + } + + // move 1 column left and retry + cursorYIndex = 0; + cursorPoint = cursorXIndex - 1; + cursorXIndex = cursorPoint; + if (cursorXIndex >= 0) { + continue; + } + + // No item available + KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); + break; + } + } + } + + if (pauseCtx->cursorSpecialPos == 0) { + // move cursor up/down + if (ABS_ALT(pauseCtx->stickAdjY) > 30) { + moveCursorResult = PAUSE_CURSOR_RESULT_NONE; + + cursorPoint = pauseCtx->cursorPoint[PAUSE_MASK]; + cursorYIndex = pauseCtx->cursorYIndex[PAUSE_MASK]; + + while (moveCursorResult == PAUSE_CURSOR_RESULT_NONE) { + if (pauseCtx->stickAdjY > 30) { + // move cursor up + moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; + if (pauseCtx->cursorYIndex[PAUSE_MASK] != 0) { + pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorYIndex[PAUSE_MASK]--; + pauseCtx->cursorPoint[PAUSE_MASK] -= 6; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; + } else { + pauseCtx->cursorYIndex[PAUSE_MASK] = cursorYIndex; + pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint; + } + } else if (pauseCtx->stickAdjY < -30) { + // move cursor down + moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; + if (pauseCtx->cursorYIndex[PAUSE_MASK] < 3) { + pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorYIndex[PAUSE_MASK]++; + pauseCtx->cursorPoint[PAUSE_MASK] += 6; + moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; + } else { + pauseCtx->cursorYIndex[PAUSE_MASK] = cursorYIndex; + pauseCtx->cursorPoint[PAUSE_MASK] = cursorPoint; + } + } + } + } + + cursorSlot = pauseCtx->cursorPoint[PAUSE_MASK]; + pauseCtx->cursorColorSet = 2; + + if (moveCursorResult == PAUSE_CURSOR_RESULT_SLOT) { + cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS]; + if (CHECK_GIVEN_MASK_ON_MOON(pauseCtx->cursorPoint[PAUSE_MASK])) { + cursorItem = ITEM_NONE; + } + } else if (moveCursorResult != PAUSE_CURSOR_RESULT_SPECIAL_POS) { + cursorItem = gSaveContext.save.inventory.items[pauseCtx->cursorPoint[PAUSE_MASK] + NUM_ITEM_SLOTS]; + if (CHECK_GIVEN_MASK_ON_MOON(pauseCtx->cursorPoint[PAUSE_MASK])) { + cursorItem = ITEM_NONE; + } + } + + if (cursorItem == ITEM_NONE) { + cursorItem = PAUSE_ITEM_NONE; + pauseCtx->cursorColorSet = 0; + } + + if ((cursorItem != PAUSE_ITEM_NONE) && (msgCtx->msgLength == 0)) { + if (gSaveContext.buttonStatus[EQUIP_SLOT_A] == BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + } else if (gSaveContext.buttonStatus[EQUIP_SLOT_A] != BTN_DISABLED) { + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_DISABLED; + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + } + + pauseCtx->cursorItem[PAUSE_MASK] = cursorItem; + pauseCtx->cursorSlot[PAUSE_MASK] = cursorSlot; + if (cursorItem != PAUSE_ITEM_NONE) { + // Equip item to the C buttons + if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && !pauseCtx->itemDescriptionOn && + (pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && + CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) { + + // Ensure that a mask is not unequipped while being used + if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + if (((Player_GetCurMaskItemId(play) != ITEM_NONE) && + (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT))) || + ((sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] != ITEM_NONE) && + (sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT)))) { + play_sound(NA_SE_SY_ERROR); + return; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { + if (((Player_GetCurMaskItemId(play) != ITEM_NONE) && + (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN))) || + ((sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] != ITEM_NONE) && + (sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN)))) { + play_sound(NA_SE_SY_ERROR); + return; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + if (((Player_GetCurMaskItemId(play) != ITEM_NONE) && + (Player_GetCurMaskItemId(play) == BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT))) || + ((sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] != ITEM_NONE) && + (sMaskPlayerFormItems[((void)0, gSaveContext.save.playerForm)] == + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT)))) { + play_sound(NA_SE_SY_ERROR); + return; + } + } + + if ((Player_GetEnvTimerType(play) >= PLAYER_ENV_TIMER_UNDERWATER_FLOOR) && + (Player_GetEnvTimerType(play) <= PLAYER_ENV_TIMER_UNDERWATER_FREE) && + ((cursorSlot == (SLOT_MASK_DEKU - NUM_ITEM_SLOTS)) || + (cursorSlot == (SLOT_MASK_GORON - NUM_ITEM_SLOTS)))) { + play_sound(NA_SE_SY_ERROR); + return; + } + + if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) { + pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_LEFT; + } else if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) { + pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_DOWN; + } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { + pauseCtx->equipTargetCBtn = PAUSE_EQUIP_C_RIGHT; + } + + // Equip item to the C buttons + pauseCtx->equipTargetItem = cursorItem; + pauseCtx->equipTargetSlot = cursorSlot + NUM_ITEM_SLOTS; + pauseCtx->unk_200 = 0xF; + vtxIndex = cursorSlot * 4; + pauseCtx->equipAnimX = pauseCtx->maskVtx[vtxIndex].v.ob[0] * 10; + pauseCtx->equipAnimY = pauseCtx->maskVtx[vtxIndex].v.ob[1] * 10; + pauseCtx->equipAnimAlpha = 255; + sMaskEquipMagicArrowSlotHoldTimer = 0; + sMaskEquipState = EQUIP_STATE_MOVE_TO_C_BTN; + sMaskEquipAnimTimer = 10; + play_sound(NA_SE_SY_DECIDE); + } else if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == 6) && + (pauseCtx->unk_200 == 0) && CHECK_BTN_ALL(input->press.button, BTN_A) && + (msgCtx->msgLength == 0)) { + // Give description on item through a message box + pauseCtx->itemDescriptionOn = true; + if (pauseCtx->cursorYIndex[PAUSE_MASK] < 2) { + func_801514B0(play, 0x1700 + pauseCtx->cursorItem[PAUSE_MASK], 3); + } else { + func_801514B0(play, 0x1700 + pauseCtx->cursorItem[PAUSE_MASK], 1); + } + } + } + } else { + pauseCtx->cursorItem[PAUSE_MASK] = PAUSE_ITEM_NONE; + } + + if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_MASK]) { + play_sound(NA_SE_SY_CURSOR); + } + } else if ((pauseCtx->unk_200 == 0xF) && (pauseCtx->pageIndex == PAUSE_MASK)) { + pauseCtx->cursorColorSet = 2; + } +} + +s16 sMaskCButtonPosX[] = { 660, 900, 1140 }; +s16 sMaskCButtonPosY[] = { 1100, 920, 1100 }; + +void KaleidoScope_UpdateMaskEquip(PlayState* play) { + static s16 sMaskEquipMagicArrowBowSlotHoldTimer = 0; + PauseContext* pauseCtx = &play->pauseCtx; + Vtx* bowItemVtx; + u16 offsetX; + u16 offsetY; + + // Grow glowing orb when equipping magic arrows + if (sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_GROW_ORB) { + pauseCtx->equipAnimAlpha += 14; + if (pauseCtx->equipAnimAlpha > 255) { + pauseCtx->equipAnimAlpha = 254; + sMaskEquipState++; + } + // Hover over magic arrow slot when the next state is reached + sMaskEquipMagicArrowSlotHoldTimer = 5; + return; + } + + if (sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT) { + sMaskEquipMagicArrowBowSlotHoldTimer--; + + if (sMaskEquipMagicArrowBowSlotHoldTimer == 0) { + pauseCtx->equipTargetItem -= 0xB5 - ITEM_BOW_ARROW_FIRE; + pauseCtx->equipTargetSlot = SLOT_BOW; + sMaskEquipAnimTimer = 6; + pauseCtx->equipAnimScale = 320; + pauseCtx->equipAnimShrinkRate = 40; + sMaskEquipState++; + play_sound(NA_SE_SY_SYNTH_MAGIC_ARROW); + } + return; + } + + if (sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT) { + bowItemVtx = &pauseCtx->itemVtx[12]; + offsetX = ABS_ALT(pauseCtx->equipAnimX - bowItemVtx->v.ob[0] * 10) / sMaskEquipAnimTimer; + offsetY = ABS_ALT(pauseCtx->equipAnimY - bowItemVtx->v.ob[1] * 10) / sMaskEquipAnimTimer; + } else { + offsetX = ABS_ALT(pauseCtx->equipAnimX - sMaskCButtonPosX[pauseCtx->equipTargetCBtn]) / sMaskEquipAnimTimer; + offsetY = ABS_ALT(pauseCtx->equipAnimY - sMaskCButtonPosY[pauseCtx->equipTargetCBtn]) / sMaskEquipAnimTimer; + } + + if ((pauseCtx->equipTargetItem >= 0xB5) && (pauseCtx->equipAnimAlpha < 254)) { + pauseCtx->equipAnimAlpha += 14; + if (pauseCtx->equipAnimAlpha > 255) { + pauseCtx->equipAnimAlpha = 254; + } + sMaskEquipMagicArrowSlotHoldTimer = 5; + return; + } + + if (sMaskEquipMagicArrowSlotHoldTimer == 0) { + pauseCtx->equipAnimScale -= pauseCtx->equipAnimShrinkRate / sMaskEquipAnimTimer; + pauseCtx->equipAnimShrinkRate -= pauseCtx->equipAnimShrinkRate / sMaskEquipAnimTimer; + + // Update coordinates of item icon while being equipped + if (sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT) { + // target is the bow slot + if (pauseCtx->equipAnimX >= (pauseCtx->itemVtx[12].v.ob[0] * 10)) { + pauseCtx->equipAnimX -= offsetX; + } else { + pauseCtx->equipAnimX += offsetX; + } + + if (pauseCtx->equipAnimY >= (pauseCtx->itemVtx[12].v.ob[1] * 10)) { + pauseCtx->equipAnimY -= offsetY; + } else { + pauseCtx->equipAnimY += offsetY; + } + } else { + // target is the c button + if (pauseCtx->equipAnimX >= sMaskCButtonPosX[pauseCtx->equipTargetCBtn]) { + pauseCtx->equipAnimX -= offsetX; + } else { + pauseCtx->equipAnimX += offsetX; + } + + if (pauseCtx->equipAnimY >= sMaskCButtonPosY[pauseCtx->equipTargetCBtn]) { + pauseCtx->equipAnimY -= offsetY; + } else { + pauseCtx->equipAnimY += offsetY; + } + } + + sMaskEquipAnimTimer--; + if (sMaskEquipAnimTimer == 0) { + if (sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT) { + sMaskEquipState++; + sMaskEquipMagicArrowBowSlotHoldTimer = 4; + return; + } + + // Equip mask onto c buttons + if (pauseCtx->equipTargetCBtn == PAUSE_EQUIP_C_LEFT) { + // Swap if mask is already equipped on CDown or CRight. + if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) != ITEM_NONE) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_DOWN); + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = SLOT_NONE; + } + } else if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) & 0xFF) != ITEM_NONE) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_RIGHT); + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = SLOT_NONE; + } + } + + // Equip mask on CLeft + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = pauseCtx->equipTargetItem; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = pauseCtx->equipTargetSlot; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_LEFT); + } else if (pauseCtx->equipTargetCBtn == PAUSE_EQUIP_C_DOWN) { + // Swap if mask is already equipped on CLeft or CRight. + if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) != ITEM_NONE) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_LEFT); + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = SLOT_NONE; + } + } else if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) & 0xFF) != ITEM_NONE) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_RIGHT); + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = SLOT_NONE; + } + } + + // Equip mask on CDown + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = pauseCtx->equipTargetItem; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = pauseCtx->equipTargetSlot; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_DOWN); + } else { // (pauseCtx->equipTargetCBtn == PAUSE_EQUIP_C_RIGHT) + // Swap if mask is already equipped on CLeft or CDown. + if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) != ITEM_NONE) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_LEFT); + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT) = SLOT_NONE; + } + } else if (pauseCtx->equipTargetSlot == C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN)) { + if ((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) & 0xFF) != ITEM_NONE) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT); + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT); + Interface_LoadItemIcon(play, EQUIP_SLOT_C_DOWN); + } else { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = ITEM_NONE; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = SLOT_NONE; + } + } + + // Equip mask on CRight + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = pauseCtx->equipTargetItem; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT) = pauseCtx->equipTargetSlot; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_RIGHT); + } + + // Reset params + pauseCtx->unk_200 = 0; + sMaskEquipAnimTimer = 10; + pauseCtx->equipAnimScale = 320; + pauseCtx->equipAnimShrinkRate = 40; + } + } else { + sMaskEquipMagicArrowSlotHoldTimer--; + if (sMaskEquipMagicArrowSlotHoldTimer == 0) { + pauseCtx->equipAnimAlpha = 255; + } + } +} diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h index 19e3c8719..94724154f 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h @@ -22,6 +22,13 @@ typedef enum { /* 2 */ PAUSE_EQUIP_C_RIGHT } PauseEquipCButton; +typedef enum { + /* 0 */ EQUIP_STATE_MAGIC_ARROW_GROW_ORB, + /* 1 */ EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT, + /* 2 */ EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT, + /* 3 */ EQUIP_STATE_MOVE_TO_C_BTN +} EquipState; + typedef enum { /* 0 */ DEBUG_EDITOR_NONE, /* 1 */ DEBUG_EDITOR_INVENTORY_INIT, @@ -29,6 +36,16 @@ typedef enum { /* 3 */ DEBUG_EDITOR_EVENTS } DebugEditor; +// To be used for Item-Page cursor and Mask-Page cursor +typedef enum { + /* 0 */ PAUSE_CURSOR_RESULT_NONE, + /* 1 */ PAUSE_CURSOR_RESULT_SLOT, + /* 2 */ PAUSE_CURSOR_RESULT_SPECIAL_POS +} PauseMoveCursorResult; + +#define NUM_ITEM_SLOTS 24 +#define NUM_MASK_SLOTS 24 + #define PAUSE_PROMPT_YES 0 #define PAUSE_PROMPT_NO 4 @@ -43,6 +60,11 @@ void KaleidoScope_DrawItemSelect(PlayState* play); void KaleidoScope_UpdateItemCursor(PlayState* play); void KaleidoScope_UpdateItemEquip(PlayState* play); +// Mask +void KaleidoScope_DrawMaskSelect(PlayState* play); +void KaleidoScope_UpdateMaskCursor(PlayState* play); +void KaleidoScope_UpdateMaskEquip(PlayState* play); + // Debug void KaleidoScope_DrawInventoryEditor(PlayState* play); void KaleidoScope_UpdateInventoryEditor(PlayState* play); diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index c2e925a78..76441bc78 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -859,8 +859,8 @@ 0x800BC5B8:("Actor_IsTargeted",), 0x800BC5EC:("Actor_OtherIsTargeted",), 0x800BC620:("func_800BC620",), - 0x800BC770:("func_800BC770",), - 0x800BC7D8:("func_800BC7D8",), + 0x800BC770:("Actor_AddQuake",), + 0x800BC7D8:("Actor_AddQuakeWithSpeed",), 0x800BC848:("func_800BC848",), 0x800BC8B8:("Actor_DrawDoorLock",), 0x800BCB50:("Actor_SpawnShieldParticlesMetal",), @@ -1075,7 +1075,7 @@ 0x800C9CEC:("SurfaceType_IsHookshotSurface",), 0x800C9D14:("SurfaceType_IsIgnoredByEntities",), 0x800C9D50:("SurfaceType_IsIgnoredByProjectiles",), - 0x800C9D8C:("SurfaceType_GetConveyorType",), + 0x800C9D8C:("SurfaceType_IsFloorConveyor",), 0x800C9DDC:("func_800C9DDC",), 0x800C9E18:("SurfaceType_GetConveyorSpeed",), 0x800C9E40:("SurfaceType_GetConveyorDirection",), @@ -1578,7 +1578,7 @@ 0x800EDF24:("Cutscene_ActorTranslateAndYaw",), 0x800EDF78:("Cutscene_ActorTranslateAndYawSmooth",), 0x800EE0CC:("Cutscene_ActorTranslateXZAndYawSmooth",), - 0x800EE1D8:("Cutscene_GetSceneSetupIndex",), + 0x800EE1D8:("Cutscene_GetSceneLayer",), 0x800EE200:("Cutscene_GetActorActionIndex",), 0x800EE29C:("Cutscene_CheckActorAction",), 0x800EE2F4:("Cutscene_IsPlaying",), @@ -2282,15 +2282,15 @@ 0x8012A038:("PreNMI_Init",), 0x8012A080:("Quake_Random",), 0x8012A0AC:("Quake_UpdateShakeInfo",), - 0x8012A2B8:("Quake_Callback1",), - 0x8012A340:("Quake_Callback5",), - 0x8012A3B4:("Quake_Callback6",), - 0x8012A438:("Quake_Callback3",), - 0x8012A4D0:("Quake_Callback2",), - 0x8012A540:("Quake_Callback4",), + 0x8012A2B8:("Quake_CallbackType1",), + 0x8012A340:("Quake_CallbackType5",), + 0x8012A3B4:("Quake_CallbackType6",), + 0x8012A438:("Quake_CallbackType3",), + 0x8012A4D0:("Quake_CallbackType2",), + 0x8012A540:("Quake_CallbackType4",), 0x8012A5D8:("Quake_GetFreeIndex",), 0x8012A638:("Quake_AddImpl",), - 0x8012A6F0:("Quake_Remove",), + 0x8012A6F0:("Quake_RemoveRequest",), 0x8012A718:("Quake_GetRequest",), 0x8012A774:("Quake_SetValue",), 0x8012A8A8:("Quake_SetSpeed",), @@ -2300,7 +2300,7 @@ 0x8012A9E0:("Quake_SetQuakeValues2",), 0x8012AA48:("Quake_Init",), 0x8012AA9C:("Quake_Add",), - 0x8012AAC0:("Quake_RemoveFromIdx",), + 0x8012AAC0:("Quake_Remove",), 0x8012AB08:("Quake_Calc",), 0x8012AE68:("Distortion_Init",), 0x8012AEAC:("Distortion_SetCountdown",), @@ -2495,8 +2495,8 @@ 0x80131F90:("Scene_DrawConfigMatAnimManualStep",), 0x80131FC0:("Scene_DrawConfigGreatBayTemple",), 0x801322C0:("Entrance_GetTableEntry",), - 0x8013230C:("Entrance_GetSceneNum",), - 0x80132338:("Entrance_GetSceneNumAbsolute",), + 0x8013230C:("Entrance_GetSceneId",), + 0x80132338:("Entrance_GetSceneIdAbsolute",), 0x80132374:("Entrance_GetSpawnNum",), 0x801323A0:("Entrance_GetTransitionFlags",), 0x801323D0:("Schedule_CheckFlagS",), @@ -3024,7 +3024,7 @@ 0x80169BF8:("func_80169BF8",), 0x80169C64:("Play_GetActorCsCamSetting",), 0x80169C84:("Play_GetActorCsCamFuncData",), - 0x80169CBC:("Play_GetOriginalSceneNumber",), + 0x80169CBC:("Play_GetOriginalSceneId",), 0x80169D40:("Play_SaveCycleSceneFlags",), 0x80169DCC:("Play_SetRespawnData",), 0x80169E6C:("Play_SetupRespawnPoint",), @@ -3851,12 +3851,12 @@ 0x8019D8E4:("AudioOcarina_CreateCustomSequence",), 0x8019DF28:("AudioOcarina_ResetInstrument",), 0x8019DF64:("AudioOcarina_ResetStaffs",), - 0x8019DFF8:("func_8019DFF8",), - 0x8019E000:("func_8019E000",), - 0x8019E00C:("func_8019E00C",), - 0x8019E014:("func_8019E014",), - 0x8019E0FC:("func_8019E0FC",), - 0x8019E104:("func_8019E104",), + 0x8019DFF8:("Audio_Noop1",), + 0x8019E000:("Audio_Noop2",), + 0x8019E00C:("Audio_Noop3",), + 0x8019E014:("Audio_Update",), + 0x8019E0FC:("Audio_Noop4",), + 0x8019E104:("Audio_Noop5",), 0x8019E110:("func_8019E110",), 0x8019E14C:("AudioSfx_ComputeVolume",), 0x8019E324:("AudioSfx_ComputeReverb",), @@ -3938,32 +3938,32 @@ 0x801A21FC:("Audio_PlaySariaBgm",), 0x801A2460:("Audio_ClearSariaBgm2",), 0x801A246C:("func_801A246C",), - 0x801A2544:("func_801A2544",), - 0x801A257C:("func_801A257C",), - 0x801A25E4:("func_801A25E4",), - 0x801A2670:("func_801A2670",), - 0x801A2778:("func_801A2778",), + 0x801A2544:("Audio_PlayMorningSceneSequence",), + 0x801A257C:("Audio_StartMorningSceneSequence",), + 0x801A25E4:("Audio_PlaySceneSequence",), + 0x801A2670:("Audio_StartSceneSequence",), + 0x801A2778:("Audio_UpdateSceneSequenceResumePoint",), 0x801A27E8:("func_801A27E8",), 0x801A281C:("func_801A281C",), 0x801A29D4:("func_801A29D4",), 0x801A2BB8:("func_801A2BB8",), 0x801A2C20:("func_801A2C20",), 0x801A2C44:("func_801A2C44",), - 0x801A2C88:("func_801A2C88",), - 0x801A2D54:("func_801A2D54",), + 0x801A2C88:("Audio_PlaySequenceInCutscene",), + 0x801A2D54:("Audio_StopSequenceInCutscene",), 0x801A2DE0:("Audio_IsSequencePlaying",), - 0x801A2E54:("func_801A2E54",), - 0x801A2ED8:("func_801A2ED8",), - 0x801A2F88:("func_801A2F88",), - 0x801A2FC4:("func_801A2FC4",), + 0x801A2E54:("Audio_PlayBgm_StorePrevBgm",), + 0x801A2ED8:("Audio_RestorePrevBgm",), + 0x801A2F88:("Audio_PlayAmbience_StorePrevBgm",), + 0x801A2FC4:("Audio_ForceRestorePreviousBgm",), 0x801A3000:("func_801A3000",), 0x801A3038:("func_801A3038",), - 0x801A3098:("func_801A3098",), + 0x801A3098:("Audio_PlayFanfare",), 0x801A312C:("func_801A312C",), 0x801A31EC:("func_801A31EC",), - 0x801A3238:("func_801A3238",), - 0x801A32CC:("func_801A32CC",), - 0x801A3590:("func_801A3590",), + 0x801A3238:("Audio_PlaySequenceWithSeqPlayerIO",), + 0x801A32CC:("Audio_SetSequenceMode",), + 0x801A3590:("Audio_UpdateEnemyBgmVolume",), 0x801A36F0:("func_801A36F0",), 0x801A3950:("func_801A3950",), 0x801A39F8:("func_801A39F8",), @@ -3982,7 +3982,7 @@ 0x801A3F6C:("func_801A3F6C",), 0x801A3FB4:("func_801A3FB4",), 0x801A3FFC:("func_801A3FFC",), - 0x801A400C:("audio_setBGM",), + 0x801A400C:("Audio_SetSpec",), 0x801A4058:("func_801A4058",), 0x801A41C8:("func_801A41C8",), 0x801A41F8:("func_801A41F8",), @@ -3993,15 +3993,15 @@ 0x801A4380:("Audio_SetSfxVolumeExceptSystemAndOcarinaBanks",), 0x801A4428:("func_801A4428",), 0x801A44A4:("Audio_PreNMI",), - 0x801A44C4:("func_801A44C4",), + 0x801A44C4:("Audio_ResetRequestedSceneSeqId",), 0x801A44D4:("func_801A44D4",), 0x801A46F8:("func_801A46F8",), 0x801A4748:("func_801A4748",), 0x801A479C:("func_801A479C",), - 0x801A47DC:("func_801A47DC",), - 0x801A48E0:("func_801A48E0",), - 0x801A4A28:("func_801A4A28",), - 0x801A4B80:("Audio_SetNatureAmbienceRandomBend",), + 0x801A47DC:("Audio_SetAmbienceChannelIO",), + 0x801A48E0:("Audio_StartAmbience",), + 0x801A4A28:("Audio_PlayAmbience",), + 0x801A4B80:("Audio_SetAmbienceRandomBend",), 0x801A4C30:("Audio_Init",), 0x801A4C54:("AudioSfx_Init",), 0x801A4D00:("func_801A4D00",), @@ -4053,11 +4053,11 @@ 0x801A78E4:("AudioSfx_IsPlaying",), 0x801A794C:("AudioSfx_Reset",), 0x801A7B10:("Audio_StartSequence",), - 0x801A7D04:("func_801A7D04",), + 0x801A7D04:("Audio_StopSequence",), 0x801A7D84:("func_801A7D84",), 0x801A89A8:("Audio_QueueSeqCmd",), 0x801A89D0:("func_801A89D0",), - 0x801A8A50:("func_801A8A50",), + 0x801A8A50:("Audio_GetActiveSequence",), 0x801A8ABC:("func_801A8ABC",), 0x801A8B14:("func_801A8B14",), 0x801A8B2C:("func_801A8B2C",), @@ -4214,9 +4214,9 @@ 0x8081E118:("func_8081E118",), 0x8081E7D8:("func_8081E7D8",), 0x8081FB1C:("func_8081FB1C",), - 0x8081FF80:("func_8081FF80",), - 0x808204AC:("func_808204AC",), - 0x80820FA4:("func_80820FA4",), + 0x8081FF80:("KaleidoScope_DrawMaskSelect",), + 0x808204AC:("KaleidoScope_UpdateMaskCursor",), + 0x80820FA4:("KaleidoScope_UpdateMaskEquip",), 0x80821730:("KaleidoScope_UpdatePrompt",), 0x80821900:("func_80821900",), 0x8082192C:("func_8082192C",), @@ -8412,19 +8412,19 @@ 0x8098F66C:("func_8098F66C",), 0x8098F680:("func_8098F680",), 0x8098F6FC:("ObjMure3_Update",), - 0x8098F800:("func_8098F800",), - 0x8098F8A8:("func_8098F8A8",), - 0x8098F928:("func_8098F928",), + 0x8098F800:("EnTg_ChangeAnim",), + 0x8098F8A8:("EnTg_UpdateCollider",), + 0x8098F928:("EnTg_UpdateSkelAnime",), 0x8098F954:("EnTg_Init",), 0x8098FA44:("EnTg_Destroy",), - 0x8098FA70:("func_8098FA70",), + 0x8098FA70:("EnTg_Idle",), 0x8098FB28:("EnTg_Update",), - 0x8098FBB4:("func_8098FBB4",), - 0x8098FBD0:("func_8098FBD0",), + 0x8098FBB4:("EnTg_OverrideLimbDraw",), + 0x8098FBD0:("EnTg_PostLimbDraw",), 0x8098FC2C:("EnTg_Draw",), - 0x8098FD50:("func_8098FD50",), - 0x8098FEA8:("func_8098FEA8",), - 0x8099000C:("func_8099000C",), + 0x8098FD50:("EnTg_SpawnHeart",), + 0x8098FEA8:("EnTg_UpdateHearts",), + 0x8099000C:("EnTg_DrawHearts",), 0x80990310:("EnWf_Init",), 0x80990784:("EnWf_Destroy",), 0x809907D4:("func_809907D4",), @@ -10063,23 +10063,23 @@ 0x80A2B390:("BgDblueMovebg_Draw",), 0x80A2BC00:("EnSyatekiDekunuts_Init",), 0x80A2BE28:("EnSyatekiDekunuts_Destroy",), - 0x80A2BE54:("func_80A2BE54",), - 0x80A2BF18:("func_80A2BF18",), - 0x80A2BFC4:("func_80A2BFC4",), - 0x80A2C0F8:("func_80A2C0F8",), - 0x80A2C150:("func_80A2C150",), - 0x80A2C168:("func_80A2C168",), - 0x80A2C1AC:("func_80A2C1AC",), - 0x80A2C208:("func_80A2C208",), - 0x80A2C27C:("func_80A2C27C",), - 0x80A2C2E0:("func_80A2C2E0",), - 0x80A2C33C:("func_80A2C33C",), - 0x80A2C3AC:("func_80A2C3AC",), - 0x80A2C3F0:("func_80A2C3F0",), - 0x80A2C478:("func_80A2C478",), - 0x80A2C48C:("func_80A2C48C",), - 0x80A2C4D0:("func_80A2C4D0",), - 0x80A2C5DC:("func_80A2C5DC",), + 0x80A2BE54:("EnSyatekiDekunuts_SetupWaitForSpawn",), + 0x80A2BF18:("EnSyatekiDekunuts_WaitForSpawn",), + 0x80A2BFC4:("EnSyatekiDekunuts_SetupSpawn",), + 0x80A2C0F8:("EnSyatekiDekunuts_Spawn",), + 0x80A2C150:("EnSyatekiDekunuts_SetupWaitToEmerge",), + 0x80A2C168:("EnSyatekiDekunuts_WaitToEmerge",), + 0x80A2C1AC:("EnSyatekiDekunuts_SetupEmerge",), + 0x80A2C208:("EnSyatekiDekunuts_Emerge",), + 0x80A2C27C:("EnSyatekiDekunuts_SetupLookAround",), + 0x80A2C2E0:("EnSyatekiDekunuts_LookAround",), + 0x80A2C33C:("EnSyatekiDekunuts_BonusLookAround",), + 0x80A2C3AC:("EnSyatekiDekunuts_SetupBurrow",), + 0x80A2C3F0:("EnSyatekiDekunuts_Burrow",), + 0x80A2C478:("EnSyatekiDekunuts_SetupGameEnd",), + 0x80A2C48C:("EnSyatekiDekunuts_GameEnd",), + 0x80A2C4D0:("EnSyatekiDekunuts_SetupDead",), + 0x80A2C5DC:("EnSyatekiDekunuts_Dead",), 0x80A2C78C:("EnSyatekiDekunuts_Update",), 0x80A2C8A0:("EnSyatekiDekunuts_OverrideLimbDraw",), 0x80A2C8E8:("EnSyatekiDekunuts_Draw",), @@ -10254,17 +10254,17 @@ 0x80A3862C:("DmZl_OverrideLimbDraw",), 0x80A38648:("DmZl_PostLimbDraw",), 0x80A3869C:("DmZl_Draw",), - 0x80A389A0:("func_80A389A0",), - 0x80A38A68:("func_80A38A68",), - 0x80A38B7C:("func_80A38B7C",), - 0x80A38BF0:("func_80A38BF0",), - 0x80A38C70:("func_80A38C70",), - 0x80A38DF4:("func_80A38DF4",), + 0x80A389A0:("EnRu_ChangeAnim",), + 0x80A38A68:("EnRu_PlayWalkingSound",), + 0x80A38B7C:("EnRu_UpdateEyes",), + 0x80A38BF0:("EnRu_UpdateCollider",), + 0x80A38C70:("EnRu_UpdateModel",), + 0x80A38DF4:("EnRu_DoNothing",), 0x80A38E04:("EnRu_Init",), 0x80A38F10:("EnRu_Destroy",), 0x80A38F3C:("EnRu_Update",), - 0x80A38FB4:("func_80A38FB4",), - 0x80A390F8:("func_80A390F8",), + 0x80A38FB4:("EnRu_OverrideLimbdraw",), + 0x80A390F8:("EnRu_PostLimbdraw",), 0x80A39204:("EnRu_Draw",), 0x80A396B0:("func_80A396B0",), 0x80A3970C:("EnElfgrp_Init",), @@ -10620,7 +10620,7 @@ 0x80A53E60:("func_80A53E60",), 0x80A541F4:("func_80A541F4",), 0x80A54600:("func_80A54600",), - 0x80A54980:("func_80A54980",), + 0x80A54980:("ObjHugebombiwa_AddQuake",), 0x80A54A0C:("func_80A54A0C",), 0x80A54AC0:("ObjHugebombiwa_Init",), 0x80A54BC4:("ObjHugebombiwa_Destroy",), @@ -10960,24 +10960,24 @@ 0x80A702B0:("EnMm3_PostLimbDraw",), 0x80A702F0:("EnMm3_Draw",), 0x80A706F0:("BgCraceMovebg_Init",), - 0x80A7090C:("func_80A7090C",), - 0x80A70970:("func_80A70970",), - 0x80A7099C:("func_80A7099C",), - 0x80A709E4:("func_80A709E4",), - 0x80A70A08:("func_80A70A08",), - 0x80A70A84:("func_80A70A84",), - 0x80A70A9C:("func_80A70A9C",), + 0x80A7090C:("BgCraceMovebg_GetRaceStatus",), + 0x80A70970:("BgCraceMovebg_OpeningDoor_SetupIdle",), + 0x80A7099C:("BgCraceMovebg_OpeningDoor_WaitToOpen",), + 0x80A709E4:("BgCraceMovebg_OpeningDoor_SetupOpen",), + 0x80A70A08:("BgCraceMovebg_OpeningDoor_Open",), + 0x80A70A84:("BgCraceMovebg_OpeningDoor_SetupDoNothing",), + 0x80A70A9C:("BgCraceMovebg_OpeningDoor_DoNothing",), 0x80A70AAC:("BgCraceMovebg_Destroy",), 0x80A70B60:("BgCraceMovebg_Update",), - 0x80A70C04:("func_80A70C04",), - 0x80A70D74:("func_80A70D74",), - 0x80A70DA8:("func_80A70DA8",), - 0x80A70E2C:("func_80A70E2C",), - 0x80A70E70:("func_80A70E70",), - 0x80A70F14:("func_80A70F14",), - 0x80A70F2C:("func_80A70F2C",), - 0x80A70FF4:("func_80A70FF4",), - 0x80A71040:("func_80A71040",), + 0x80A70C04:("BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor",), + 0x80A70D74:("BgCraceMovebg_ClosingDoor_SetupIdle",), + 0x80A70DA8:("BgCraceMovebg_ClosingDoor_Idle",), + 0x80A70E2C:("BgCraceMovebg_ClosingDoor_SetupWaitToClose",), + 0x80A70E70:("BgCraceMovebg_ClosingDoor_WaitToClose",), + 0x80A70F14:("BgCraceMovebg_ClosingDoor_SetupClose",), + 0x80A70F2C:("BgCraceMovebg_ClosingDoor_Close",), + 0x80A70FF4:("BgCraceMovebg_ClosingDoor_SetupDoNothing",), + 0x80A71040:("BgCraceMovebg_ClosingDoor_DoNothing",), 0x80A71050:("BgCraceMovebg_Draw",), 0x80A711D0:("func_80A711D0",), 0x80A71424:("func_80A71424",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 2d78a2d17..0a50098ea 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1166,15 +1166,15 @@ 0x801BFCF8:("sTimerBeepSfxSeconds","UNK_TYPE4","",0x4), 0x801BFCFC:("sTimerDigitsOffsetX","UNK_TYPE4","",0x4), 0x801BFD0C:("sTimerDigitsWidth","UNK_TYPE4","",0x4), - 0x801BFD1C:("D_801BFD1C","UNK_TYPE1","",0x1), - 0x801BFD24:("D_801BFD24","UNK_TYPE1","",0x1), - 0x801BFD2C:("D_801BFD2C","UNK_TYPE1","",0x1), - 0x801BFD40:("D_801BFD40","UNK_TYPE1","",0x1), + 0x801BFD1C:("sRupeeDigitsFirst","UNK_TYPE1","",0x1), + 0x801BFD24:("sRupeeDigitsCount","UNK_TYPE1","",0x1), + 0x801BFD2C:("sRupeeCounterIconPrimColors","UNK_TYPE1","",0x1), + 0x801BFD40:("sRupeeCounterIconEnvColors","UNK_TYPE1","",0x1), 0x801BFD54:("sMinigameCountdownTextures","UNK_TYPE1","",0x1), 0x801BFD64:("sMinigameCountdownTexWidths","UNK_TYPE1","",0x1), 0x801BFD6C:("sMinigameCountdownPrimColors","UNK_TYPE2","",0x2), - 0x801BFD84:("D_801BFD84","UNK_TYPE1","",0x1), - 0x801BFD8C:("D_801BFD8C","UNK_TYPE1","",0x1), + 0x801BFD84:("gStoryTextures","UNK_TYPE1","",0x1), + 0x801BFD8C:("gStoryTLUTs","UNK_TYPE1","",0x1), 0x801BFD94:("D_801BFD94","UNK_TYPE4","",0x4), 0x801BFD98:("D_801BFD98","UNK_TYPE4","[2]",0x8), 0x801BFDA0:("sMaskObjectIds","s16","[24]",0x30), @@ -1342,8 +1342,8 @@ 0x801C1E6C:("gItemIcons","UNK_PTR","[131]",0x20C), 0x801C2078:("gItemSlots","u8","[80]",0x50), 0x801C20C8:("gItemPrices","UNK_TYPE1","",0x1), - 0x801C212C:("gScenesPerRegion","SceneIdList","[]",0x252), - 0x801C2380:("sScenesPerTingleMap","u16","[]",0x90), + 0x801C212C:("gSceneIdsPerRegion","SceneIdList","[]",0x252), + 0x801C2380:("sSceneIdsPerTingleMap","u16","[]",0x90), 0x801C2410:("D_801C2410","UNK_TYPE1","",0x1), 0x801C2650:("tatlMessageFiles","RomFile","[2]",0x10), 0x801C2660:("sceneTextureFiles","RomFile","[9]",0x48), @@ -2280,11 +2280,11 @@ 0x801D66B8:("sAudioEnvReverb","UNK_TYPE1","",0x1), 0x801D66BC:("sAudioCodeReverb","UNK_TYPE1","",0x1), 0x801D66C0:("sPrevSeqMode","UNK_TYPE1","",0x1), - 0x801D66C4:("sAudioEnemyDist","f32","",0x4), - 0x801D66C8:("sAudioEnemyVol","UNK_TYPE1","",0x1), + 0x801D66C4:("sBgmEnemyDist","f32","",0x4), + 0x801D66C8:("sBgmEnemyVolume","UNK_TYPE1","",0x1), 0x801D66CC:("sPrevMainBgmSeqId","UNK_TYPE2","",0x2), - 0x801D66D0:("sBgmPlayerIOPort7","UNK_TYPE1","",0x1), - 0x801D66D4:("sSceneSeqId2","UNK_TYPE1","",0x1), + 0x801D66D0:("sSeqResumePoint","UNK_TYPE1","",0x1), + 0x801D66D4:("sPrevSceneSeqId","UNK_TYPE1","",0x1), 0x801D66D8:("sNumFramesStill","UNK_TYPE4","",0x4), 0x801D66DC:("sNumFramesMoving","UNK_TYPE4","",0x4), 0x801D66E0:("sAudioBaseFilter","UNK_TYPE1","",0x1), @@ -2297,7 +2297,7 @@ 0x801D66FC:("sObjSoundMainBgmSeqId","UNK_TYPE1","",0x1), 0x801D6700:("sSeqFlags","UNK_TYPE1","",0x1), 0x801D6780:("sSpecReverbs","UNK_TYPE1","",0x1), - 0x801D6794:("sNatureAmbienceData","UNK_TYPE1","",0x1), + 0x801D6794:("sAmbienceData","UNK_TYPE1","",0x1), 0x801D6FB4:("sIsOcarinaInputEnabled","UNK_TYPE1","",0x1), 0x801D6FB8:("sOcarinaInstrumentId","UNK_TYPE1","",0x1), 0x801D6FBC:("sCurOcarinaPitch","UNK_TYPE1","",0x1), @@ -4015,7 +4015,7 @@ 0x801F59F4:("D_801F59F4","UNK_TYPE1","",0x1), 0x801F59F8:("D_801F59F8","UNK_TYPE1","",0x1), 0x801F5A00:("sQuakeRequest","QuakeRequest","[4]",0x90), - 0x801F5A90:("sDistortionContext","DistortionContext","",0xc), + 0x801F5A90:("sDistortionRequest","DistortionRequest","",0xc), 0x801F5AA0:("sMatAnimStep","s32","",0x4), 0x801F5AA4:("sMatAnimFlags","u32","",0x4), 0x801F5AA8:("sMatAnimAlphaRatio","f32","",0x4), @@ -4255,14 +4255,14 @@ 0x801FD294:("sSfxVolumeCur","UNK_TYPE1","",0x1), 0x801FD298:("sSfxVolumeTarget","UNK_TYPE1","",0x1), 0x801FD29C:("sSfxVolumeRate","UNK_TYPE1","",0x1), - 0x801FD2A0:("sSceneSeqId1","UNK_TYPE1","",0x1), + 0x801FD2A0:("sRequestedSceneSeqId","UNK_TYPE1","",0x1), 0x801FD2A8:("sSfxChannelState","UNK_TYPE1","",0x1), 0x801FD3A8:("D_801FD3A8","UNK_TYPE1","",0x1), 0x801FD3A9:("D_801FD3A9","UNK_TYPE1","",0x1), 0x801FD3AA:("sRiverSoundBgmTimer","UNK_TYPE1","",0x1), 0x801FD3AB:("sFanfareState","UNK_TYPE1","",0x1), 0x801FD3AC:("sFanfareSeqId","UNK_TYPE1","",0x1), - 0x801FD3AE:("sMuteOnlySfxAndNatureSeq","UNK_TYPE1","",0x1), + 0x801FD3AE:("sMuteOnlySfxAndAmbienceSeq","UNK_TYPE1","",0x1), 0x801FD3AF:("sAllPlayersMutedExceptOcaAndSys","UNK_TYPE1","",0x1), 0x801FD3B0:("sAudioPauseState","UNK_TYPE1","",0x1), 0x801FD3B4:("sSpatialSeqIsActive","u8","[4]",0x4), @@ -4288,7 +4288,7 @@ 0x801FD434:("D_801FD434","UNK_TYPE1","",0x1), 0x801FD435:("sSpatialSeqPlayerIndex","UNK_TYPE1","",0x1), 0x801FD436:("sSpatialSeqFadeTimer","UNK_TYPE1","",0x1), - 0x801FD438:("D_801FD438","UNK_TYPE1","",0x1), + 0x801FD438:("sPrevAmbienceSeqId","UNK_TYPE1","",0x1), 0x801FD43A:("sPlayingStaff","OcarinaStaff","",0x3), 0x801FD43E:("sPlaybackStaff","OcarinaStaff","",0x3), 0x801FD442:("sRecordingStaff","OcarinaStaff","",0x3), @@ -4346,7 +4346,7 @@ 0x8020001E:("D_8020001E","UNK_TYPE1","",0x1), 0x802000C9:("D_802000C9","UNK_TYPE1","",0x1), 0x802000D4:("D_802000D4","UNK_TYPE1","",0x1), - 0x80200140:("D_80200140","UNK_TYPE1","",0x1), + 0x80200140:("gActiveSeqs","UNK_TYPE1","",0x1), 0x8020034A:("D_8020034A","UNK_TYPE1","",0x1), 0x80200B88:("D_80200B88","UNK_TYPE1","",0x1), 0x80200BBA:("D_80200BBA","UNK_TYPE1","",0x1), @@ -4725,15 +4725,15 @@ 0x8082B5CC:("D_8082B5CC","UNK_TYPE1","",0x1), 0x8082B5E0:("D_8082B5E0","UNK_TYPE1","",0x1), 0x8082B5F4:("D_8082B5F4","UNK_TYPE2","",0x2), - 0x8082B600:("D_8082B600","UNK_TYPE2","",0x2), - 0x8082B604:("D_8082B604","UNK_TYPE2","",0x2), - 0x8082B608:("D_8082B608","UNK_TYPE2","",0x2), - 0x8082B60C:("D_8082B60C","UNK_TYPE1","",0x1), - 0x8082B684:("D_8082B684","UNK_TYPE2","",0x2), - 0x8082B6CC:("D_8082B6CC","UNK_TYPE1","",0x1), - 0x8082B6D4:("D_8082B6D4","UNK_TYPE1","",0x1), - 0x8082B6DC:("D_8082B6DC","UNK_TYPE1","",0x1), - 0x8082B6E4:("D_8082B6E4","UNK_TYPE2","",0x2), + 0x8082B600:("sMaskEquipState","UNK_TYPE2","",0x2), + 0x8082B604:("sMaskEquipMagicArrowSlotHoldTimer","UNK_TYPE2","",0x2), + 0x8082B608:("sMaskEquipAnimTimer","UNK_TYPE2","",0x2), + 0x8082B60C:("gMaskPlayerFormSlotRestrictions","UNK_TYPE1","",0x1), + 0x8082B684:("sMasksGivenOnMoonBits","UNK_TYPE2","",0x2), + 0x8082B6CC:("sMaskPlayerFormItems","UNK_TYPE1","",0x1), + 0x8082B6D4:("sMaskCButtonPosX","UNK_TYPE1","",0x1), + 0x8082B6DC:("sMaskCButtonPosY","UNK_TYPE1","",0x1), + 0x8082B6E4:("sMaskEquipMagicArrowBowSlotHoldTimer","UNK_TYPE2","",0x2), 0x8082B6F0:("sPromptAlphaTargets","UNK_TYPE1","",0x1), 0x8082B6F4:("sPromptAlphaTargetIndex","UNK_TYPE2","",0x2), 0x8082B6F8:("sPromptAlphaTimer","UNK_TYPE2","",0x2), @@ -11112,15 +11112,15 @@ 0x80A2BBF4:("D_80A2BBF4","UNK_TYPE1","",0x1), 0x80A2BBF5:("D_80A2BBF5","UNK_TYPE1","",0x1), 0x80A2CA90:("En_Syateki_Dekunuts_InitVars","UNK_TYPE1","",0x1), - 0x80A2CAB0:("D_80A2CAB0","UNK_TYPE1","",0x1), - 0x80A2CADC:("D_80A2CADC","UNK_TYPE4","",0x4), - 0x80A2CAE8:("D_80A2CAE8","UNK_PTR","",0x4), - 0x80A2CB90:("D_80A2CB90","UNK_TYPE1","",0x1), - 0x80A2CB9C:("D_80A2CB9C","UNK_TYPE4","",0x4), - 0x80A2CBA0:("D_80A2CBA0","UNK_TYPE1","",0x1), - 0x80A2CBAC:("D_80A2CBAC","UNK_TYPE1","",0x1), - 0x80A2CBB8:("D_80A2CBB8","UNK_TYPE1","",0x1), - 0x80A2CBBC:("D_80A2CBBC","UNK_TYPE1","",0x1), + 0x80A2CAB0:("sCylinderInit","UNK_TYPE1","",0x1), + 0x80A2CADC:("sBonusDekuScrubColliderDimensions","UNK_TYPE4","",0x4), + 0x80A2CAE8:("sAnimationInfo","UNK_PTR","",0x4), + 0x80A2CB90:("sInitChain","UNK_TYPE1","",0x1), + 0x80A2CB9C:("sDrawFlowers","UNK_TYPE4","",0x4), + 0x80A2CBA0:("sVelocity","UNK_TYPE1","",0x1), + 0x80A2CBAC:("sAccel","UNK_TYPE1","",0x1), + 0x80A2CBB8:("sPrimColor","UNK_TYPE1","",0x1), + 0x80A2CBBC:("sEnvColor","UNK_TYPE1","",0x1), 0x80A2CBC0:("D_80A2CBC0","f32","",0x4), 0x80A2D1C0:("Elf_Msg3_InitVars","UNK_TYPE1","",0x1), 0x80A2D1E0:("D_80A2D1E0","UNK_TYPE1","",0x1), @@ -12095,12 +12095,12 @@ 0x80A70510:("jtbl_80A70510","UNK_PTR","",0x4), 0x80A7056C:("jtbl_80A7056C","UNK_PTR","",0x4), 0x80A71080:("Bg_Crace_Movebg_InitVars","UNK_TYPE1","",0x1), - 0x80A710A0:("D_80A710A0","UNK_TYPE1","",0x1), - 0x80A710A4:("D_80A710A4","UNK_TYPE1","",0x1), - 0x80A710A8:("D_80A710A8","UNK_TYPE1","",0x1), - 0x80A710AC:("D_80A710AC","UNK_TYPE1","",0x1), + 0x80A710A0:("sHasInitializedIsLoaded","UNK_TYPE1","",0x1), + 0x80A710A4:("sLoadedDoorCount","UNK_TYPE1","",0x1), + 0x80A710A8:("sInitChain","UNK_TYPE1","",0x1), + 0x80A710AC:("sUnitVecZ","UNK_TYPE1","",0x1), 0x80A710C0:("D_80A710C0","f32","",0x4), - 0x80A711B0:("D_80A711B0","UNK_TYPE1","",0x1), + 0x80A711B0:("sIsLoaded","UNK_TYPE1","",0x1), 0x80A739A0:("D_80A739A0","UNK_PTR","",0x4), 0x80A73AE0:("En_Dno_InitVars","UNK_TYPE1","",0x1), 0x80A73B00:("D_80A73B00","UNK_TYPE1","",0x1), diff --git a/tools/namefixer.py b/tools/namefixer.py index 3d6d08783..6034bffbf 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -148,6 +148,17 @@ wordReplace = { "func_801A5BD0": "AudioSfx_MuteBanks", "func_801A72CC": "AudioSfx_StopByPos", "Audio_StopSfxByPos": "AudioSfx_StopByPos", + "func_801A3098": "Audio_PlayFanfare", + "func_801A8A50": "Audio_GetActiveSequence", + "func_801A2E54": "Audio_PlayBgm_StorePrevBgm", + "func_801A2ED8": "Audio_RestorePrevBgm", + "func_801A2544": "Audio_PlayMorningSceneSequence", + "func_801A25E4": "Audio_PlaySceneSequence", + "func_801A3238": "Audio_PlaySequenceWithSeqPlayerIO", + "func_801A32CC": "Audio_SetSequenceMode", + "func_801A3590": "Audio_UpdateEnemyBgmVolume", + "func_801A47DC": "Audio_SetAmbienceChannelIO", + "func_801A4A28": "Audio_PlayAmbience", "func_801A7328": "AudioSfx_StopByPosAndId", "func_801A75E8": "AudioSfx_StopById", "SkelAnime_LodDrawLimb": "SkelAnime_DrawLimbLod", @@ -284,6 +295,7 @@ wordReplace = { "func_800BC8B8": "Actor_DrawDoorLock", "func_800B86C8": "Actor_ChangeFocus", "func_800B90F4": "Actor_DeactivateLens", + "func_800BC770": "Actor_AddQuake", "zelda_malloc": "ZeldaArena_Malloc", "zelda_mallocR": "ZeldaArena_MallocR", "zelda_realloc": "ZeldaArena_Realloc", @@ -400,6 +412,7 @@ wordReplace = { "BgCheck_RelocateMeshHeader": "CollisionHeader_GetVirtual", "BgCheck_RelocateAllMeshHeaders": "BgCheck_InitCollisionHeaders", "BgCheck_GetPolygonAttributes": "SurfaceType_GetData", + "SurfaceType_GetConveyorType": "SurfaceType_IsFloorConveyor", "func_800C9704": "SurfaceType_GetBgCamIndex", "func_800C9924": "BgCheck_GetBgCamFuncData", "func_800C99AC": "SurfaceType_GetSceneExitIndex", @@ -411,7 +424,7 @@ wordReplace = { "func_800C9CEC": "SurfaceType_IsHookshotSurface", "func_800C9D14": "SurfaceType_IsIgnoredByEntities", "func_800C9D50": "SurfaceType_IsIgnoredByProjectiles", - "func_800C9D8C": "SurfaceType_GetConveyorType", + "func_800C9D8C": "SurfaceType_IsFloorConveyor", "func_800C9E18": "SurfaceType_GetConveyorSpeed", "func_800C9E40": "SurfaceType_GetConveyorDirection", "func_800C9E88": "SurfaceType_IsWallDamage", @@ -520,10 +533,11 @@ wordReplace = { "func_800EDF24": "Cutscene_ActorTranslateAndYaw", "func_800EDF78": "Cutscene_ActorTranslateAndYawSmooth", "func_800EE0CC": "Cutscene_ActorTranslateXZAndYawSmooth", - "func_800EE1D8": "Cutscene_GetSceneSetupIndex", + "func_800EE1D8": "Cutscene_GetSceneLayer", "func_800EE200": "Cutscene_GetActorActionIndex", "func_800EE29C": "Cutscene_CheckActorAction", "func_800EE2F4": "Cutscene_IsPlaying", + "Cutscene_GetSceneSetupIndex": "Cutscene_GetSceneLayer", "func_801343C0": "SkelAnime_DrawTransformFlexOpa", "func_80134148": "SkelAnime_DrawTransformFlexLimbOpa", "func_8013AB00": "SubS_DrawTransformFlex", @@ -539,6 +553,7 @@ wordReplace = { "Quake2_SetCountdown": "Distortion_SetCountdown", "func_800BE680": "Actor_DrawDamageEffects", "func_8012F22C": "Inventory_GetSkullTokenCount", + "Quake_RemoveFromIdx": "Quake_Remove", "func_8013AB00": "SubS_DrawTransformFlex", "func_8013A860": "SubS_DrawTransformFlexLimb", @@ -695,6 +710,9 @@ wordReplace = { "gSaveContext.unk_3F30": "gSaveContext.magicFillTarget", "gSaveContext.unk_3F2C": "gSaveContext.magicFlag", "gSaveContext.save.entranceIndex": "gSaveContext.save.entrance", + "gSaveContext.sceneSetupIndex": "gSaveContext.sceneLayer", + "gSaveContext.seqIndex": "gSaveContext.seqId", + "gSaveContext.nightSeqIndex": "gSaveContext.ambienceId", "player->unk_A87": "player->exchangeItemId", "player->leftHandActor": "player->heldActor", @@ -734,6 +752,7 @@ wordReplace = { "play->actorCtx.unk3": "play->actorCtx.lensActive", "play->actorCtx.unk4": "play->actorCtx.lensMaskSize", "play->nextEntranceIndex": "play->nextEntrance", + "play->sceneNum": "play->sceneId", "gSaveContext.unk_3DC8": "gSaveContext.timerOsTime", "gSaveContext.unk_3DD0": "gSaveContext.timerStates", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 883b80691..2f11d532e 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -373,8 +373,8 @@ asm/non_matchings/code/z_actor/Actor_TestFloorInDirection.s,Actor_TestFloorInDir asm/non_matchings/code/z_actor/Actor_IsTargeted.s,Actor_IsTargeted,0x800BC5B8,0xD asm/non_matchings/code/z_actor/Actor_OtherIsTargeted.s,Actor_OtherIsTargeted,0x800BC5EC,0xD asm/non_matchings/code/z_actor/func_800BC620.s,func_800BC620,0x800BC620,0x54 -asm/non_matchings/code/z_actor/func_800BC770.s,func_800BC770,0x800BC770,0x1A -asm/non_matchings/code/z_actor/func_800BC7D8.s,func_800BC7D8,0x800BC7D8,0x1C +asm/non_matchings/code/z_actor/Actor_AddQuake.s,Actor_AddQuake,0x800BC770,0x1A +asm/non_matchings/code/z_actor/Actor_AddQuakeWithSpeed.s,Actor_AddQuakeWithSpeed,0x800BC7D8,0x1C asm/non_matchings/code/z_actor/func_800BC848.s,func_800BC848,0x800BC848,0x1C asm/non_matchings/code/z_actor/Actor_DrawDoorLock.s,Actor_DrawDoorLock,0x800BC8B8,0xA6 asm/non_matchings/code/z_actor/Actor_SpawnShieldParticlesMetal.s,Actor_SpawnShieldParticlesMetal,0x800BCB50,0x8 @@ -589,7 +589,7 @@ asm/non_matchings/code/z_bgcheck/SurfaceType_GetEcho.s,SurfaceType_GetEcho,0x800 asm/non_matchings/code/z_bgcheck/SurfaceType_IsHookshotSurface.s,SurfaceType_IsHookshotSurface,0x800C9CEC,0xA asm/non_matchings/code/z_bgcheck/SurfaceType_IsIgnoredByEntities.s,SurfaceType_IsIgnoredByEntities,0x800C9D14,0xF asm/non_matchings/code/z_bgcheck/SurfaceType_IsIgnoredByProjectiles.s,SurfaceType_IsIgnoredByProjectiles,0x800C9D50,0xF -asm/non_matchings/code/z_bgcheck/SurfaceType_GetConveyorType.s,SurfaceType_GetConveyorType,0x800C9D8C,0x14 +asm/non_matchings/code/z_bgcheck/SurfaceType_IsFloorConveyor.s,SurfaceType_IsFloorConveyor,0x800C9D8C,0x14 asm/non_matchings/code/z_bgcheck/func_800C9DDC.s,func_800C9DDC,0x800C9DDC,0xF asm/non_matchings/code/z_bgcheck/SurfaceType_GetConveyorSpeed.s,SurfaceType_GetConveyorSpeed,0x800C9E18,0xA asm/non_matchings/code/z_bgcheck/SurfaceType_GetConveyorDirection.s,SurfaceType_GetConveyorDirection,0x800C9E40,0x12 @@ -1092,7 +1092,7 @@ asm/non_matchings/code/z_demo/Cutscene_ActorTranslate.s,Cutscene_ActorTranslate, asm/non_matchings/code/z_demo/Cutscene_ActorTranslateAndYaw.s,Cutscene_ActorTranslateAndYaw,0x800EDF24,0x15 asm/non_matchings/code/z_demo/Cutscene_ActorTranslateAndYawSmooth.s,Cutscene_ActorTranslateAndYawSmooth,0x800EDF78,0x55 asm/non_matchings/code/z_demo/Cutscene_ActorTranslateXZAndYawSmooth.s,Cutscene_ActorTranslateXZAndYawSmooth,0x800EE0CC,0x43 -asm/non_matchings/code/z_demo/Cutscene_GetSceneSetupIndex.s,Cutscene_GetSceneSetupIndex,0x800EE1D8,0xA +asm/non_matchings/code/z_demo/Cutscene_GetSceneLayer.s,Cutscene_GetSceneLayer,0x800EE1D8,0xA asm/non_matchings/code/z_demo/Cutscene_GetActorActionIndex.s,Cutscene_GetActorActionIndex,0x800EE200,0x27 asm/non_matchings/code/z_demo/Cutscene_CheckActorAction.s,Cutscene_CheckActorAction,0x800EE29C,0x16 asm/non_matchings/code/z_demo/Cutscene_IsPlaying.s,Cutscene_IsPlaying,0x800EE2F4,0xB @@ -1796,15 +1796,15 @@ asm/non_matchings/code/z_prenmi/PreNMI_Destroy.s,PreNMI_Destroy,0x8012A02C,0x3 asm/non_matchings/code/z_prenmi/PreNMI_Init.s,PreNMI_Init,0x8012A038,0x12 asm/non_matchings/code/z_quake/Quake_Random.s,Quake_Random,0x8012A080,0xB asm/non_matchings/code/z_quake/Quake_UpdateShakeInfo.s,Quake_UpdateShakeInfo,0x8012A0AC,0x83 -asm/non_matchings/code/z_quake/Quake_Callback1.s,Quake_Callback1,0x8012A2B8,0x22 -asm/non_matchings/code/z_quake/Quake_Callback5.s,Quake_Callback5,0x8012A340,0x1D -asm/non_matchings/code/z_quake/Quake_Callback6.s,Quake_Callback6,0x8012A3B4,0x21 -asm/non_matchings/code/z_quake/Quake_Callback3.s,Quake_Callback3,0x8012A438,0x26 -asm/non_matchings/code/z_quake/Quake_Callback2.s,Quake_Callback2,0x8012A4D0,0x1C -asm/non_matchings/code/z_quake/Quake_Callback4.s,Quake_Callback4,0x8012A540,0x26 +asm/non_matchings/code/z_quake/Quake_CallbackType1.s,Quake_CallbackType1,0x8012A2B8,0x22 +asm/non_matchings/code/z_quake/Quake_CallbackType5.s,Quake_CallbackType5,0x8012A340,0x1D +asm/non_matchings/code/z_quake/Quake_CallbackType6.s,Quake_CallbackType6,0x8012A3B4,0x21 +asm/non_matchings/code/z_quake/Quake_CallbackType3.s,Quake_CallbackType3,0x8012A438,0x26 +asm/non_matchings/code/z_quake/Quake_CallbackType2.s,Quake_CallbackType2,0x8012A4D0,0x1C +asm/non_matchings/code/z_quake/Quake_CallbackType4.s,Quake_CallbackType4,0x8012A540,0x26 asm/non_matchings/code/z_quake/Quake_GetFreeIndex.s,Quake_GetFreeIndex,0x8012A5D8,0x18 asm/non_matchings/code/z_quake/Quake_AddImpl.s,Quake_AddImpl,0x8012A638,0x2E -asm/non_matchings/code/z_quake/Quake_Remove.s,Quake_Remove,0x8012A6F0,0xA +asm/non_matchings/code/z_quake/Quake_RemoveRequest.s,Quake_RemoveRequest,0x8012A6F0,0xA asm/non_matchings/code/z_quake/Quake_GetRequest.s,Quake_GetRequest,0x8012A718,0x17 asm/non_matchings/code/z_quake/Quake_SetValue.s,Quake_SetValue,0x8012A774,0x4D asm/non_matchings/code/z_quake/Quake_SetSpeed.s,Quake_SetSpeed,0x8012A8A8,0x12 @@ -1814,7 +1814,7 @@ asm/non_matchings/code/z_quake/Quake_SetQuakeValues.s,Quake_SetQuakeValues,0x801 asm/non_matchings/code/z_quake/Quake_SetQuakeValues2.s,Quake_SetQuakeValues2,0x8012A9E0,0x1A asm/non_matchings/code/z_quake/Quake_Init.s,Quake_Init,0x8012AA48,0x15 asm/non_matchings/code/z_quake/Quake_Add.s,Quake_Add,0x8012AA9C,0x9 -asm/non_matchings/code/z_quake/Quake_RemoveFromIdx.s,Quake_RemoveFromIdx,0x8012AAC0,0x12 +asm/non_matchings/code/z_quake/Quake_Remove.s,Quake_Remove,0x8012AAC0,0x12 asm/non_matchings/code/z_quake/Quake_Calc.s,Quake_Calc,0x8012AB08,0xD8 asm/non_matchings/code/z_quake/Distortion_Init.s,Distortion_Init,0x8012AE68,0x11 asm/non_matchings/code/z_quake/Distortion_SetCountdown.s,Distortion_SetCountdown,0x8012AEAC,0xA @@ -2009,8 +2009,8 @@ asm/non_matchings/code/z_scene_proc/Scene_DrawConfig5.s,Scene_DrawConfig5,0x8013 asm/non_matchings/code/z_scene_proc/Scene_DrawConfigMatAnimManualStep.s,Scene_DrawConfigMatAnimManualStep,0x80131F90,0xC asm/non_matchings/code/z_scene_proc/Scene_DrawConfigGreatBayTemple.s,Scene_DrawConfigGreatBayTemple,0x80131FC0,0xC0 asm/non_matchings/code/z_scene_table/Entrance_GetTableEntry.s,Entrance_GetTableEntry,0x801322C0,0x13 -asm/non_matchings/code/z_scene_table/Entrance_GetSceneNum.s,Entrance_GetSceneNum,0x8013230C,0xB -asm/non_matchings/code/z_scene_table/Entrance_GetSceneNumAbsolute.s,Entrance_GetSceneNumAbsolute,0x80132338,0xF +asm/non_matchings/code/z_scene_table/Entrance_GetSceneId.s,Entrance_GetSceneId,0x8013230C,0xB +asm/non_matchings/code/z_scene_table/Entrance_GetSceneIdAbsolute.s,Entrance_GetSceneIdAbsolute,0x80132338,0xF asm/non_matchings/code/z_scene_table/Entrance_GetSpawnNum.s,Entrance_GetSpawnNum,0x80132374,0xB asm/non_matchings/code/z_scene_table/Entrance_GetTransitionFlags.s,Entrance_GetTransitionFlags,0x801323A0,0xC asm/non_matchings/code/code_801323D0/func_801323D0.s,func_801323D0,0x801323D0,0x16 @@ -2538,7 +2538,7 @@ asm/non_matchings/code/z_play/Play_GetCameraUID.s,Play_GetCameraUID,0x80169BC4,0 asm/non_matchings/code/z_play/func_80169BF8.s,func_80169BF8,0x80169BF8,0x1B asm/non_matchings/code/z_play/Play_GetActorCsCamSetting.s,Play_GetActorCsCamSetting,0x80169C64,0x8 asm/non_matchings/code/z_play/Play_GetActorCsCamFuncData.s,Play_GetActorCsCamFuncData,0x80169C84,0xE -asm/non_matchings/code/z_play/Play_GetOriginalSceneNumber.s,Play_GetOriginalSceneNumber,0x80169CBC,0x21 +asm/non_matchings/code/z_play/Play_GetOriginalSceneId.s,Play_GetOriginalSceneId,0x80169CBC,0x21 asm/non_matchings/code/z_play/Play_SaveCycleSceneFlags.s,Play_SaveCycleSceneFlags,0x80169D40,0x23 asm/non_matchings/code/z_play/Play_SetRespawnData.s,Play_SetRespawnData,0x80169DCC,0x28 asm/non_matchings/code/z_play/Play_SetupRespawnPoint.s,Play_SetupRespawnPoint,0x80169E6C,0x18 @@ -3367,12 +3367,12 @@ asm/non_matchings/code/code_8019AF00/AudioOcarina_PlayCustomSequence.s,AudioOcar asm/non_matchings/code/code_8019AF00/AudioOcarina_CreateCustomSequence.s,AudioOcarina_CreateCustomSequence,0x8019D8E4,0x191 asm/non_matchings/code/code_8019AF00/AudioOcarina_ResetInstrument.s,AudioOcarina_ResetInstrument,0x8019DF28,0xF asm/non_matchings/code/code_8019AF00/AudioOcarina_ResetStaffs.s,AudioOcarina_ResetStaffs,0x8019DF64,0x25 -asm/non_matchings/code/code_8019AF00/func_8019DFF8.s,func_8019DFF8,0x8019DFF8,0x2 -asm/non_matchings/code/code_8019AF00/func_8019E000.s,func_8019E000,0x8019E000,0x3 -asm/non_matchings/code/code_8019AF00/func_8019E00C.s,func_8019E00C,0x8019E00C,0x2 -asm/non_matchings/code/code_8019AF00/func_8019E014.s,func_8019E014,0x8019E014,0x3A -asm/non_matchings/code/code_8019AF00/func_8019E0FC.s,func_8019E0FC,0x8019E0FC,0x2 -asm/non_matchings/code/code_8019AF00/func_8019E104.s,func_8019E104,0x8019E104,0x3 +asm/non_matchings/code/code_8019AF00/Audio_Noop1.s,Audio_Noop1,0x8019DFF8,0x2 +asm/non_matchings/code/code_8019AF00/Audio_Noop2.s,Audio_Noop2,0x8019E000,0x3 +asm/non_matchings/code/code_8019AF00/Audio_Noop3.s,Audio_Noop3,0x8019E00C,0x2 +asm/non_matchings/code/code_8019AF00/Audio_Update.s,Audio_Update,0x8019E014,0x3A +asm/non_matchings/code/code_8019AF00/Audio_Noop4.s,Audio_Noop4,0x8019E0FC,0x2 +asm/non_matchings/code/code_8019AF00/Audio_Noop5.s,Audio_Noop5,0x8019E104,0x3 asm/non_matchings/code/code_8019AF00/func_8019E110.s,func_8019E110,0x8019E110,0xF asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeVolume.s,AudioSfx_ComputeVolume,0x8019E14C,0x76 asm/non_matchings/code/code_8019AF00/AudioSfx_ComputeReverb.s,AudioSfx_ComputeReverb,0x8019E324,0x63 @@ -3454,32 +3454,32 @@ asm/non_matchings/code/code_8019AF00/func_801A2090.s,func_801A2090,0x801A2090,0x asm/non_matchings/code/code_8019AF00/Audio_PlaySariaBgm.s,Audio_PlaySariaBgm,0x801A21FC,0x99 asm/non_matchings/code/code_8019AF00/Audio_ClearSariaBgm2.s,Audio_ClearSariaBgm2,0x801A2460,0x3 asm/non_matchings/code/code_8019AF00/func_801A246C.s,func_801A246C,0x801A246C,0x36 -asm/non_matchings/code/code_8019AF00/func_801A2544.s,func_801A2544,0x801A2544,0xE -asm/non_matchings/code/code_8019AF00/func_801A257C.s,func_801A257C,0x801A257C,0x1A -asm/non_matchings/code/code_8019AF00/func_801A25E4.s,func_801A25E4,0x801A25E4,0x23 -asm/non_matchings/code/code_8019AF00/func_801A2670.s,func_801A2670,0x801A2670,0x42 -asm/non_matchings/code/code_8019AF00/func_801A2778.s,func_801A2778,0x801A2778,0x1C +asm/non_matchings/code/code_8019AF00/Audio_PlayMorningSceneSequence.s,Audio_PlayMorningSceneSequence,0x801A2544,0xE +asm/non_matchings/code/code_8019AF00/Audio_StartMorningSceneSequence.s,Audio_StartMorningSceneSequence,0x801A257C,0x1A +asm/non_matchings/code/code_8019AF00/Audio_PlaySceneSequence.s,Audio_PlaySceneSequence,0x801A25E4,0x23 +asm/non_matchings/code/code_8019AF00/Audio_StartSceneSequence.s,Audio_StartSceneSequence,0x801A2670,0x42 +asm/non_matchings/code/code_8019AF00/Audio_UpdateSceneSequenceResumePoint.s,Audio_UpdateSceneSequenceResumePoint,0x801A2778,0x1C asm/non_matchings/code/code_8019AF00/func_801A27E8.s,func_801A27E8,0x801A27E8,0xD asm/non_matchings/code/code_8019AF00/func_801A281C.s,func_801A281C,0x801A281C,0x6E asm/non_matchings/code/code_8019AF00/func_801A29D4.s,func_801A29D4,0x801A29D4,0x79 asm/non_matchings/code/code_8019AF00/func_801A2BB8.s,func_801A2BB8,0x801A2BB8,0x1A asm/non_matchings/code/code_8019AF00/func_801A2C20.s,func_801A2C20,0x801A2C20,0x9 asm/non_matchings/code/code_8019AF00/func_801A2C44.s,func_801A2C44,0x801A2C44,0x11 -asm/non_matchings/code/code_8019AF00/func_801A2C88.s,func_801A2C88,0x801A2C88,0x33 -asm/non_matchings/code/code_8019AF00/func_801A2D54.s,func_801A2D54,0x801A2D54,0x23 +asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceInCutscene.s,Audio_PlaySequenceInCutscene,0x801A2C88,0x33 +asm/non_matchings/code/code_8019AF00/Audio_StopSequenceInCutscene.s,Audio_StopSequenceInCutscene,0x801A2D54,0x23 asm/non_matchings/code/code_8019AF00/Audio_IsSequencePlaying.s,Audio_IsSequencePlaying,0x801A2DE0,0x1D -asm/non_matchings/code/code_8019AF00/func_801A2E54.s,func_801A2E54,0x801A2E54,0x21 -asm/non_matchings/code/code_8019AF00/func_801A2ED8.s,func_801A2ED8,0x801A2ED8,0x2C -asm/non_matchings/code/code_8019AF00/func_801A2F88.s,func_801A2F88,0x801A2F88,0xF -asm/non_matchings/code/code_8019AF00/func_801A2FC4.s,func_801A2FC4,0x801A2FC4,0xF +asm/non_matchings/code/code_8019AF00/Audio_PlayBgm_StorePrevBgm.s,Audio_PlayBgm_StorePrevBgm,0x801A2E54,0x21 +asm/non_matchings/code/code_8019AF00/Audio_RestorePrevBgm.s,Audio_RestorePrevBgm,0x801A2ED8,0x2C +asm/non_matchings/code/code_8019AF00/Audio_PlayAmbience_StorePrevBgm.s,Audio_PlayAmbience_StorePrevBgm,0x801A2F88,0xF +asm/non_matchings/code/code_8019AF00/Audio_ForceRestorePreviousBgm.s,Audio_ForceRestorePreviousBgm,0x801A2FC4,0xF asm/non_matchings/code/code_8019AF00/func_801A3000.s,func_801A3000,0x801A3000,0xE asm/non_matchings/code/code_8019AF00/func_801A3038.s,func_801A3038,0x801A3038,0x18 -asm/non_matchings/code/code_8019AF00/func_801A3098.s,func_801A3098,0x801A3098,0x25 +asm/non_matchings/code/code_8019AF00/Audio_PlayFanfare.s,Audio_PlayFanfare,0x801A3098,0x25 asm/non_matchings/code/code_8019AF00/func_801A312C.s,func_801A312C,0x801A312C,0x30 asm/non_matchings/code/code_8019AF00/func_801A31EC.s,func_801A31EC,0x801A31EC,0x13 -asm/non_matchings/code/code_8019AF00/func_801A3238.s,func_801A3238,0x801A3238,0x25 -asm/non_matchings/code/code_8019AF00/func_801A32CC.s,func_801A32CC,0x801A32CC,0xB1 -asm/non_matchings/code/code_8019AF00/func_801A3590.s,func_801A3590,0x801A3590,0x58 +asm/non_matchings/code/code_8019AF00/Audio_PlaySequenceWithSeqPlayerIO.s,Audio_PlaySequenceWithSeqPlayerIO,0x801A3238,0x25 +asm/non_matchings/code/code_8019AF00/Audio_SetSequenceMode.s,Audio_SetSequenceMode,0x801A32CC,0xB1 +asm/non_matchings/code/code_8019AF00/Audio_UpdateEnemyBgmVolume.s,Audio_UpdateEnemyBgmVolume,0x801A3590,0x58 asm/non_matchings/code/code_8019AF00/func_801A36F0.s,func_801A36F0,0x801A36F0,0x98 asm/non_matchings/code/code_8019AF00/func_801A3950.s,func_801A3950,0x801A3950,0x2A asm/non_matchings/code/code_8019AF00/func_801A39F8.s,func_801A39F8,0x801A39F8,0x21 @@ -3498,7 +3498,7 @@ asm/non_matchings/code/code_8019AF00/Audio_SetCutsceneFlag.s,Audio_SetCutsceneFl asm/non_matchings/code/code_8019AF00/func_801A3F6C.s,func_801A3F6C,0x801A3F6C,0x12 asm/non_matchings/code/code_8019AF00/func_801A3FB4.s,func_801A3FB4,0x801A3FB4,0x12 asm/non_matchings/code/code_8019AF00/func_801A3FFC.s,func_801A3FFC,0x801A3FFC,0x4 -asm/non_matchings/code/code_8019AF00/audio_setBGM.s,audio_setBGM,0x801A400C,0x13 +asm/non_matchings/code/code_8019AF00/Audio_SetSpec.s,Audio_SetSpec,0x801A400C,0x13 asm/non_matchings/code/code_8019AF00/func_801A4058.s,func_801A4058,0x801A4058,0x5C asm/non_matchings/code/code_8019AF00/func_801A41C8.s,func_801A41C8,0x801A41C8,0xC asm/non_matchings/code/code_8019AF00/func_801A41F8.s,func_801A41F8,0x801A41F8,0x29 @@ -3509,15 +3509,15 @@ asm/non_matchings/code/code_8019AF00/func_801A4348.s,func_801A4348,0x801A4348,0x asm/non_matchings/code/code_8019AF00/Audio_SetSfxVolumeExceptSystemAndOcarinaBanks.s,Audio_SetSfxVolumeExceptSystemAndOcarinaBanks,0x801A4380,0x2A asm/non_matchings/code/code_8019AF00/func_801A4428.s,func_801A4428,0x801A4428,0x1F asm/non_matchings/code/code_8019AF00/Audio_PreNMI.s,Audio_PreNMI,0x801A44A4,0x8 -asm/non_matchings/code/code_8019AF00/func_801A44C4.s,func_801A44C4,0x801A44C4,0x4 +asm/non_matchings/code/code_8019AF00/Audio_ResetRequestedSceneSeqId.s,Audio_ResetRequestedSceneSeqId,0x801A44C4,0x4 asm/non_matchings/code/code_8019AF00/func_801A44D4.s,func_801A44D4,0x801A44D4,0x89 asm/non_matchings/code/code_8019AF00/func_801A46F8.s,func_801A46F8,0x801A46F8,0x14 asm/non_matchings/code/code_8019AF00/func_801A4748.s,func_801A4748,0x801A4748,0x15 asm/non_matchings/code/code_8019AF00/func_801A479C.s,func_801A479C,0x801A479C,0x10 -asm/non_matchings/code/code_8019AF00/func_801A47DC.s,func_801A47DC,0x801A47DC,0x41 -asm/non_matchings/code/code_8019AF00/func_801A48E0.s,func_801A48E0,0x801A48E0,0x52 -asm/non_matchings/code/code_8019AF00/func_801A4A28.s,func_801A4A28,0x801A4A28,0x56 -asm/non_matchings/code/code_8019AF00/Audio_SetNatureAmbienceRandomBend.s,Audio_SetNatureAmbienceRandomBend,0x801A4B80,0x2C +asm/non_matchings/code/code_8019AF00/Audio_SetAmbienceChannelIO.s,Audio_SetAmbienceChannelIO,0x801A47DC,0x41 +asm/non_matchings/code/code_8019AF00/Audio_StartAmbience.s,Audio_StartAmbience,0x801A48E0,0x52 +asm/non_matchings/code/code_8019AF00/Audio_PlayAmbience.s,Audio_PlayAmbience,0x801A4A28,0x56 +asm/non_matchings/code/code_8019AF00/Audio_SetAmbienceRandomBend.s,Audio_SetAmbienceRandomBend,0x801A4B80,0x2C asm/non_matchings/code/code_8019AF00/Audio_Init.s,Audio_Init,0x801A4C30,0x9 asm/non_matchings/code/code_8019AF00/AudioSfx_Init.s,AudioSfx_Init,0x801A4C54,0x2B asm/non_matchings/code/code_8019AF00/func_801A4D00.s,func_801A4D00,0x801A4D00,0x14 @@ -3569,11 +3569,11 @@ asm/non_matchings/code/code_801A5BD0/AudioSfx_ProcessActiveSfx.s,AudioSfx_Proces asm/non_matchings/code/code_801A5BD0/AudioSfx_IsPlaying.s,AudioSfx_IsPlaying,0x801A78E4,0x1A asm/non_matchings/code/code_801A5BD0/AudioSfx_Reset.s,AudioSfx_Reset,0x801A794C,0x71 asm/non_matchings/code/code_801A7B10/Audio_StartSequence.s,Audio_StartSequence,0x801A7B10,0x7D -asm/non_matchings/code/code_801A7B10/func_801A7D04.s,func_801A7D04,0x801A7D04,0x20 +asm/non_matchings/code/code_801A7B10/Audio_StopSequence.s,Audio_StopSequence,0x801A7D04,0x20 asm/non_matchings/code/code_801A7B10/func_801A7D84.s,func_801A7D84,0x801A7D84,0x309 asm/non_matchings/code/code_801A7B10/Audio_QueueSeqCmd.s,Audio_QueueSeqCmd,0x801A89A8,0xA asm/non_matchings/code/code_801A7B10/func_801A89D0.s,func_801A89D0,0x801A89D0,0x20 -asm/non_matchings/code/code_801A7B10/func_801A8A50.s,func_801A8A50,0x801A8A50,0x1B +asm/non_matchings/code/code_801A7B10/Audio_GetActiveSequence.s,Audio_GetActiveSequence,0x801A8A50,0x1B asm/non_matchings/code/code_801A7B10/func_801A8ABC.s,func_801A8ABC,0x801A8ABC,0x16 asm/non_matchings/code/code_801A7B10/func_801A8B14.s,func_801A8B14,0x801A8B14,0x6 asm/non_matchings/code/code_801A7B10/func_801A8B2C.s,func_801A8B2C,0x801A8B2C,0x29