Merge branch 'master' into fix_misc_17

This commit is contained in:
Dragorn421
2022-10-10 22:30:40 +02:00
83 changed files with 3320 additions and 2524 deletions
+36 -25
View File
@@ -1,29 +1,40 @@
<Root>
<File Name="object_bw" Segment="6">
<Animation Name="object_bw_Anim_000228" Offset="0x228"/>
<DList Name="object_bw_DL_0002C0" Offset="0x2C0"/>
<DList Name="object_bw_DL_0003E8" Offset="0x3E8"/>
<DList Name="object_bw_DL_000558" Offset="0x558"/>
<DList Name="object_bw_DL_000680" Offset="0x680"/>
<DList Name="object_bw_DL_001050" Offset="0x1050"/>
<Texture Name="object_bw_Tex_001240" OutName="tex_00001240" Format="rgba16" Width="16" Height="16" Offset="0x1240"/>
<Texture Name="object_bw_Tex_001440" OutName="tex_00001440" Format="rgba16" Width="16" Height="16" Offset="0x1440"/>
<Texture Name="object_bw_TLUT_001640" OutName="tlut_00001640" Format="rgba16" Width="16" Height="16" Offset="0x1640"/>
<Texture Name="object_bw_Tex_001840" OutName="tex_00001840" Format="ci8" Width="32" Height="32" Offset="0x1840" TlutOffset="0x1640"/>
<Texture Name="object_bw_Tex_001C40" OutName="tex_00001C40" Format="ci8" Width="32" Height="32" Offset="0x1C40" TlutOffset="0x1640"/>
<Limb Name="object_bw_Limb_002040" LimbType="Standard" Offset="0x2040"/>
<Limb Name="object_bw_Limb_00204C" LimbType="Standard" Offset="0x204C"/>
<Limb Name="object_bw_Limb_002058" LimbType="Standard" Offset="0x2058"/>
<Limb Name="object_bw_Limb_002064" LimbType="Standard" Offset="0x2064"/>
<Limb Name="object_bw_Limb_002070" LimbType="Standard" Offset="0x2070"/>
<Limb Name="object_bw_Limb_00207C" LimbType="Standard" Offset="0x207C"/>
<Limb Name="object_bw_Limb_002088" LimbType="Standard" Offset="0x2088"/>
<Limb Name="object_bw_Limb_002094" LimbType="Standard" Offset="0x2094"/>
<Limb Name="object_bw_Limb_0020A0" LimbType="Standard" Offset="0x20A0"/>
<Limb Name="object_bw_Limb_0020AC" LimbType="Standard" Offset="0x20AC"/>
<Limb Name="object_bw_Limb_0020B8" LimbType="Standard" Offset="0x20B8"/>
<Skeleton Name="object_bw_Skel_0020F0" Type="Normal" LimbType="Standard" Offset="0x20F0"/>
<Animation Name="object_bw_Anim_0021A0" Offset="0x21A0"/>
<Animation Name="object_bw_Anim_002250" Offset="0x2250"/>
<!-- Torch Slug Animation -->
<Animation Name="gTorchSlugEyestalkWaveAnim" Offset="0x228"/> <!-- Original name is "bw_aruku" ("to walk"). Used for when the Torch Slug moves around. -->
<!-- Torch Slug Limb DisplayLists -->
<DList Name="gTorchSlugLeftLowerEyestalkDL" Offset="0x2C0"/>
<DList Name="gTorchSlugLeftUpperEyestalkDL" Offset="0x3E8"/>
<DList Name="gTorchSlugRightLowerEyestalkDL" Offset="0x558"/>
<DList Name="gTorchSlugRightUpperEyestalkDL" Offset="0x680"/>
<DList Name="gTorchSlugBodyDL" Offset="0x1050"/>
<!-- Torch Slug Textures -->
<Texture Name="gTorchSlugEyestalkTex" OutName="torch_slug_eyestalk" Format="rgba16" Width="16" Height="16" Offset="0x1240"/>
<Texture Name="gTorchSlugEyeTex" OutName="torch_slug_eye" Format="rgba16" Width="16" Height="16" Offset="0x1440"/>
<Texture Name="gTorchSlugBodyTLUT" OutName="torch_slug_body_tlut" Format="rgba16" Width="16" Height="16" Offset="0x1640"/>
<Texture Name="gTorchSlugBody1Tex" OutName="torch_slug_body_1" Format="ci8" Width="32" Height="32" Offset="0x1840" TlutOffset="0x1640"/>
<Texture Name="gTorchSlugBody2Tex" OutName="torch_slug_body_2" Format="ci8" Width="32" Height="32" Offset="0x1C40" TlutOffset="0x1640"/>
<!-- Torch Slug Limbs -->
<Limb Name="gTorchSlugBodyLimb" LimbType="Standard" Offset="0x2040"/>
<Limb Name="gTorchSlugLeftEyestalkRootRootLimb" LimbType="Standard" Offset="0x204C"/>
<Limb Name="gTorchSlugLeftEyestalkRootLimb" LimbType="Standard" Offset="0x2058"/>
<Limb Name="gTorchSlugLeftUpperEyestalkRootLimb" LimbType="Standard" Offset="0x2064"/>
<Limb Name="gTorchSlugLeftUpperEyestalkLimb" LimbType="Standard" Offset="0x2070"/>
<Limb Name="gTorchSlugLeftLowerEyestalkLimb" LimbType="Standard" Offset="0x207C"/>
<Limb Name="gTorchSlugRightEyestalkRootRootLimb" LimbType="Standard" Offset="0x2088"/>
<Limb Name="gTorchSlugRightEyestalkRootLimb" LimbType="Standard" Offset="0x2094"/>
<Limb Name="gTorchSlugRightUpperEyestalkRootLimb" LimbType="Standard" Offset="0x20A0"/>
<Limb Name="gTorchSlugRightUpperEyestalkLimb" LimbType="Standard" Offset="0x20AC"/>
<Limb Name="gTorchSlugRightLowerEyestalkLimb" LimbType="Standard" Offset="0x20B8"/>
<!-- Torch Slug Skeleton -->
<Skeleton Name="gTorchSlugSkel" Type="Normal" LimbType="Standard" Offset="0x20F0"/>
<!-- Torch Slug Animations -->
<Animation Name="gTorchSlugEyestalkRaiseAnim" Offset="0x21A0"/> <!-- Original name is "bw_hakken" ("discovery; detection"). Used for when the Torch Slug spots the player. -->
<Animation Name="gTorchSlugEyestalkFlailAnim" Offset="0x2250"/> <!-- Original name is "bw_kogeki" ("attack; offensive"). Used for when the Torch Slug jumps at the player or is flipped over. -->
</File>
</Root>
+8 -8
View File
@@ -2,23 +2,23 @@
<File Name="object_ice_objects" Segment="6">
<DList Name="object_ice_objects_DL_000190" Offset="0x190"/>
<Collision Name="object_ice_objects_Col_0003F0" Offset="0x3F0"/>
<DList Name="object_ice_objects_DL_0006F0" Offset="0x6F0"/>
<DList Name="object_ice_objects_DL_0012A0" Offset="0x12A0"/>
<Collision Name="object_ice_objects_Col_001C1C" Offset="0x1C1C"/>
<DList Name="gRedIceBlockDL" Offset="0x6F0"/>
<DList Name="gRedIcePlatformDL" Offset="0x12A0"/>
<Collision Name="gRedIcePlatformCol" Offset="0x1C1C"/>
<DList Name="object_ice_objects_DL_001D10" Offset="0x1D10"/>
<DList Name="object_ice_objects_DL_0021F0" Offset="0x21F0"/>
<DList Name="object_ice_objects_DL_0023D0" Offset="0x23D0"/>
<Collision Name="object_ice_objects_Col_002594" Offset="0x2594"/>
<DList Name="object_ice_objects_DL_002640" Offset="0x2640"/>
<DList Name="gRedIceWallDL" Offset="0x2640"/>
<DList Name="object_ice_objects_DL_002740" Offset="0x2740"/>
<Collision Name="object_ice_objects_Col_002854" Offset="0x2854"/>
<Collision Name="object_ice_objects_Col_002920" Offset="0x2920"/>
<Collision Name="gRedIceWallCol" Offset="0x2920"/>
<Texture Name="object_ice_objects_Tex_002950" OutName="tex_00002950" Format="rgba16" Width="32" Height="32" Offset="0x2950"/>
<Texture Name="object_ice_objects_Tex_003150" OutName="tex_00003150" Format="i8" Width="32" Height="128" Offset="0x3150"/>
<Texture Name="gRedIceWallTex" OutName="red_ice_wall" Format="i8" Width="32" Height="128" Offset="0x3150"/>
<Texture Name="object_ice_objects_Tex_004150" OutName="tex_00004150" Format="rgba16" Width="32" Height="32" Offset="0x4150"/>
<Texture Name="object_ice_objects_Tex_004950" OutName="tex_00004950" Format="rgba16" Width="32" Height="32" Offset="0x4950"/>
<Texture Name="object_ice_objects_Tex_005150" OutName="tex_00005150" Format="i8" Width="32" Height="32" Offset="0x5150"/>
<Texture Name="object_ice_objects_Tex_005550" OutName="tex_00005550" Format="i4" Width="64" Height="64" Offset="0x5550"/>
<Texture Name="gRedIceBlockTex" OutName="red_ice_block" Format="i8" Width="32" Height="32" Offset="0x5150"/>
<Texture Name="gRedIcePlatformTex" OutName="red_ice_platform" Format="i4" Width="64" Height="64" Offset="0x5550"/>
<Texture Name="object_ice_objects_Tex_005D50" OutName="tex_00005D50" Format="i8" Width="64" Height="64" Offset="0x5D50"/>
<Texture Name="object_ice_objects_Tex_006D50" OutName="tex_00006D50" Format="rgba16" Width="32" Height="64" Offset="0x6D50"/>
<Texture Name="object_ice_objects_Tex_007D50" OutName="tex_00007D50" Format="ia8" Width="64" Height="64" Offset="0x7D50"/>
@@ -1,4 +1,5 @@
<Root>
<ExternalFile XmlPath="objects/object_mori_tex.xml" OutPath="assets/objects/object_mori_tex/"/>
<File Name="object_mori_hineri1" Segment="6">
<DList Name="object_mori_hineri1_DL_0024E0" Offset="0x24E0"/>
<Collision Name="object_mori_hineri1_Col_0054B8" Offset="0x54B8"/>
@@ -1,4 +1,5 @@
<Root>
<ExternalFile XmlPath="objects/object_mori_tex.xml" OutPath="assets/objects/object_mori_tex/"/>
<File Name="object_mori_hineri1a" Segment="6">
<DList Name="object_mori_hineri1a_DL_001980" Offset="0x1980"/>
<Collision Name="object_mori_hineri1a_Col_003490" Offset="0x3490"/>
@@ -1,4 +1,5 @@
<Root>
<ExternalFile XmlPath="objects/object_mori_tex.xml" OutPath="assets/objects/object_mori_tex/"/>
<File Name="object_mori_hineri2" Segment="6">
<DList Name="object_mori_hineri2_DL_0020F0" Offset="0x20F0"/>
<Collision Name="object_mori_hineri2_Col_0043D0" Offset="0x43D0"/>
@@ -1,4 +1,5 @@
<Root>
<ExternalFile XmlPath="objects/object_mori_tex.xml" OutPath="assets/objects/object_mori_tex/"/>
<File Name="object_mori_hineri2a" Segment="6">
<DList Name="object_mori_hineri2a_DL_002B70" Offset="0x2B70"/>
<Collision Name="object_mori_hineri2a_Col_006078" Offset="0x6078"/>
@@ -1,4 +1,5 @@
<Root>
<ExternalFile XmlPath="objects/object_mori_tex.xml" OutPath="assets/objects/object_mori_tex/"/>
<File Name="object_mori_objects" Segment="6">
<Texture Name="gMoriHashiraTLUT" OutName="hashira_tlut" Format="rgba16" Width="112" Height="1" Offset="0x0000"/>
<Texture Name="gMoriHashiraTex" OutName="hashira" Format="ci8" Width="32" Height="32" Offset="0x00E0" TlutOffset="0x0000"/>
+27 -2
View File
@@ -1,5 +1,30 @@
<Root>
<File Name="object_mori_tex" Segment="6">
<Blob Name="object_moriTex_Blob_000000" Size="0x9E00" Offset="0x0"/>
<File Name="object_mori_tex" Segment="8">
<Texture Name="gMoriElevatorBarTex" OutName="elevator_bar" Format="rgba16" Height="16" Width="64" Offset="0x0"/>
<Texture Name="gMoriElevatorTopTex" OutName="elevator_top" Format="rgba16" Height="32" Width="32" Offset="0x800"/>
<Texture Name="gMoriElevatorSideTex" OutName="elevator_side" Format="rgba16" Height="16" Width="16" Offset="0x1000"/>
<Texture Name="gMoriStoneWallTex" OutName="stone_wall" Format="rgba16" Height="32" Width="32" Offset="0x1200"/>
<Texture Name="gMoriKaitenkabeMetalWallTex" OutName="metal_wall" Format="rgba16" Height="32" Width="32" Offset="0x1A00"/>
<Texture Name="gMoriRakkatenjoCheckerboardTex" OutName="checkerboard" Format="rgba16" Height="32" Width="64" Offset="0x2200"/>
<Texture Name="gMoriStalfosPlatformSideTex" OutName="stalfos_platform_side" Format="rgba16" Height="32" Width="64" Offset="0x3200"/>
<Texture Name="gMoriStalfosPlatformTopTex" OutName="stalfos_platform_top" Format="rgba16" Height="32" Width="32" Offset="0x4200"/>
<Texture Name="gMoriHashiraPlatformsTex" OutName="hashira_platform" Format="rgba16" Height="32" Width="32" Offset="0x4A00"/>
<!-- This is just a guess since its unused -->
<Texture Name="gMoriWaterTex" OutName="water" Format="rgba16" Height="8" Width="32" Offset="0x5200"/>
<Texture Name="gMoriHashigoLadderTex" OutName="ladder" Format="rgba16" Height="32" Width="32" Offset="0x5400"/>
<Texture Name="gForestTwistedHallwayPillarTex" OutName="twisted_hall_pillar" Format="rgba16" Height="64" Width="16" Offset="0x5C00"/>
<Texture Name="gForestTwistedHallwayWallAndFloorTex" OutName="twisted_hall_wall_and_floor" Format="rgba16" Width="32" Height="32" Offset="0x6400"/>
<Texture Name="gForestTwistedHallwayWallDesignTex" OutName="twisted_hall_design" Format="rgba16" Width="64" Height="32" Offset="0x6C00"/>
<Texture Name="gForestTwistedHallCarpetTex" OutName="twisted_hall_carpet" Format="rgba16" Width="16" Height="16" Offset="0x7C00"/>
<Texture Name="gForestTwistedHallLadderTex" OutName="twisted_hall_ladder" Format="rgba16" Height="32" Width="32" Offset="0x7E00"/>
<Texture Name="gForestTwistedHallBrickTex" OutName="twisted_hall_brick" Format="rgba16" Width="32" Height="32" Offset="0x8600"/>
<Texture Name="gMoriHashiraGateTex" OutName="hashira_gate" Format="rgba16" Width="32" Height="64" Offset="0x8E00"/>
</File>
</Root>
+23 -27
View File
@@ -1013,13 +1013,13 @@ s32 Player_InBlockingCsMode(PlayState* play, Player* this);
s32 Player_InCsMode(PlayState* play);
s32 func_8008E9C4(Player* this);
s32 Player_IsChildWithHylianShield(Player* this);
s32 Player_ActionToModelGroup(Player* this, s32 actionParam);
s32 Player_ActionToModelGroup(Player* this, s32 itemAction);
void Player_SetModelsForHoldingShield(Player* this);
void Player_SetModels(Player* this, s32 modelGroup);
void Player_SetModelGroup(Player* this, s32 modelGroup);
void func_8008EC70(Player* this);
void Player_SetEquipmentData(PlayState* play, Player* this);
void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 actionParam);
void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 itemAction);
void func_8008EDF0(Player* this);
void func_8008EE08(Player* this);
void func_8008EEAC(PlayState* play, Actor* actor);
@@ -1030,18 +1030,18 @@ u8 Player_GetMask(PlayState* play);
Player* Player_UnsetMask(PlayState* play);
s32 Player_HasMirrorShieldEquipped(PlayState* play);
s32 Player_HasMirrorShieldSetToDraw(PlayState* play);
s32 Player_ActionToMagicSpell(Player* this, s32 actionParam);
s32 Player_ActionToMagicSpell(Player* this, s32 itemAction);
s32 Player_HoldsHookshot(Player* this);
s32 func_8008F128(Player* this);
s32 Player_ActionToMeleeWeapon(s32 actionParam);
s32 Player_ActionToMeleeWeapon(s32 itemAction);
s32 Player_GetMeleeWeaponHeld(Player* this);
s32 Player_HoldsTwoHandedWeapon(Player* this);
s32 Player_HoldsBrokenKnife(Player* this);
s32 Player_ActionToBottle(Player* this, s32 actionParam);
s32 Player_ActionToBottle(Player* this, s32 itemAction);
s32 Player_GetBottleHeld(Player* this);
s32 Player_ActionToExplosive(Player* this, s32 actionParam);
s32 Player_ActionToExplosive(Player* this, s32 itemAction);
s32 Player_GetExplosiveHeld(Player* this);
s32 func_8008F2BC(Player* this, s32 actionParam);
s32 func_8008F2BC(Player* this, s32 itemAction);
s32 func_8008F2F8(PlayState* play);
void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
@@ -1866,9 +1866,9 @@ void Audio_ClearSariaBgm(void);
void Audio_ClearSariaBgmAtPos(Vec3f* pos);
void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax);
void Audio_ClearSariaBgm2(void);
void func_800F5510(u16 seqId);
void func_800F5550(u16 seqId);
void func_800F574C(f32 arg0, u8 arg2);
void Audio_PlayMorningSceneSequence(u16 seqId);
void Audio_PlaySceneSequence(u16 seqId);
void func_800F574C(f32 scaleTempoAndFreq, u8 duration);
void func_800F5718(void);
void func_800F5918(void);
void func_800F595C(u16);
@@ -1879,12 +1879,12 @@ void func_800F5B58(void);
void func_800F5BF0(u8 natureAmbienceId);
void Audio_PlayFanfare(u16);
void func_800F5C2C(void);
void func_800F5E18(u8 playerIdx, u16 seqId, u8 fadeTimer, s8 arg3, s8 arg4);
void Audio_PlaySequenceWithSeqPlayerIO(u8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, s8 ioData);
void Audio_SetSequenceMode(u8 seqMode);
void Audio_SetBgmEnemyVolume(f32 dist);
void func_800F6268(f32 dist, u16);
void Audio_UpdateMalonSinging(f32 dist, u16 seqId);
void func_800F64E0(u8 arg0);
void func_800F6584(u8 arg0);
void Audio_ToggleMalonSinging(u8 malonSingingDisabled);
void Audio_SetEnvReverb(s8 reverb);
void Audio_SetCodeReverb(s8 reverb);
void func_800F6700(s8 audioSetting);
@@ -1898,7 +1898,7 @@ void func_800F6AB0(u16);
// ? func_800F6BB8(?);
void Audio_PreNMI(void);
// ? func_800F6C34(?);
void Audio_SetNatureAmbienceChannelIO(u8 channelIdxRange, u8 port, u8 val);
void Audio_SetNatureAmbienceChannelIO(u8 channelIdxRange, u8 ioPort, u8 ioData);
void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId);
void Audio_Init(void);
void Audio_InitSound(void);
@@ -1915,8 +1915,6 @@ void Audio_StopSfxByBank(u8 bankId);
void func_800F8884(u8 bankId, Vec3f* pos);
void Audio_StopSfxByPosAndBank(u8 bankId, Vec3f* pos);
void Audio_StopSfxByPos(Vec3f* pos);
void func_800F9280(u8 playerIdx, u8 seqId, u8 arg2, u16 fadeTimer);
void Audio_QueueSeqCmd(u32 cmd);
void Audio_StopSfxByPosAndId(Vec3f* pos, u16 sfxId);
void Audio_StopSfxByTokenAndId(u8 token, u16 sfxId);
void Audio_StopSfxById(u32 sfxId);
@@ -1924,19 +1922,17 @@ void Audio_ProcessSfxRequests(void);
void func_800F8F88(void);
u8 Audio_IsSfxPlaying(u32 sfxId);
void Audio_ResetSfx(void);
void func_800F9474(u8, u16);
void func_800F94FC(u32);
void Audio_ProcessSeqCmd(u32);
void Audio_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDuration);
void Audio_StopSequence(u8 seqPlayerIndex, u16 fadeOutDuration);
void Audio_QueueSeqCmd(u32 cmd);
void Audio_ProcessSeqCmds(void);
u16 func_800FA0B4(u8 playerIdx);
s32 func_800FA11C(u32 arg0, u32 arg1);
void func_800FA174(u8);
void func_800FA18C(u8, u8);
void Audio_SetVolScale(u8 playerIdx, u8 scaleIdx, u8 targetVol, u8 volFadeTimer);
void func_800FA3DC(void);
u16 Audio_GetActiveSeqId(u8 seqPlayerIndex);
s32 Audio_IsSeqCmdNotQueued(u32 cmdVal, u32 cmdMask);
void Audio_SetVolumeScale(u8 seqPlayerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer);
void Audio_UpdateActiveSequences(void);
u8 func_800FAD34(void);
void func_800FADF8(void);
void func_800FAEB4(void);
void Audio_ResetActiveSequences(void);
void Audio_ResetActiveSequencesAndVolume(void);
void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a);
void GfxPrint_SetPosPx(GfxPrint* this, s32 x, s32 y);
void GfxPrint_SetPos(GfxPrint* this, s32 x, s32 y);
+2
View File
@@ -106,6 +106,8 @@
#define R_TRANS_DBG_TYPE CREG(12)
#define R_ENV_WIND_DIR(i) CREG(16 + (i))
#define R_ENV_WIND_SPEED CREG(19)
#define R_PAUSE_STICK_REPEAT_DELAY XREG(6)
#define R_PAUSE_STICK_REPEAT_DELAY_FIRST XREG(8)
#define R_A_BTN_Y XREG(16)
#define R_A_BTN_X XREG(17)
#define R_A_ICON_Y XREG(19)
+506
View File
@@ -0,0 +1,506 @@
#ifndef SEQCMD_H
#define SEQCMD_H
// ==== Primary commands ====
#define SEQCMD_OP_MASK 0xF0000000
typedef enum {
/* 0x0 */ SEQCMD_OP_PLAY_SEQUENCE,
/* 0x1 */ SEQCMD_OP_STOP_SEQUENCE,
/* 0x2 */ SEQCMD_OP_QUEUE_SEQUENCE,
/* 0x3 */ SEQCMD_OP_UNQUEUE_SEQUENCE,
/* 0x4 */ SEQCMD_OP_SET_PLAYER_VOLUME,
/* 0x5 */ SEQCMD_OP_SET_PLAYER_FREQ,
/* 0x6 */ SEQCMD_OP_SET_CHANNEL_VOLUME,
/* 0x7 */ SEQCMD_OP_SET_PLAYER_IO,
/* 0x8 */ SEQCMD_OP_SET_CHANNEL_IO,
/* 0x9 */ SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK,
/* 0xA */ SEQCMD_OP_SET_CHANNEL_DISABLE_MASK,
/* 0xB */ SEQCMD_OP_TEMPO_CMD,
/* 0xC */ SEQCMD_OP_SETUP_CMD,
/* 0xD */ SEQCMD_OP_SET_CHANNEL_FREQ,
/* 0xE */ SEQCMD_OP_GLOBAL_CMD,
/* 0xF */ SEQCMD_OP_RESET_AUDIO_HEAP
} SeqCmdOp;
// ==== Secondary commands ====
// Subset of `SEQCMD_OP_TEMPO_CMD`
typedef enum {
/* 0x0 */ SEQCMD_SUB_OP_TEMPO_SET,
/* 0x1 */ SEQCMD_SUB_OP_TEMPO_SPEED_UP,
/* 0x2 */ SEQCMD_SUB_OP_TEMPO_SLOW_DOWN,
/* 0x3 */ SEQCMD_SUB_OP_TEMPO_SCALE,
/* 0x4 */ SEQCMD_SUB_OP_TEMPO_RESET
} SeqCmdTempoCmdOp;
// Subset of `SEQCMD_OP_SETUP_CMD`
typedef enum {
/* 0x0 */ SEQCMD_SUB_OP_SETUP_RESTORE_VOLUME,
/* 0x1 */ SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE,
/* 0x2 */ SEQCMD_SUB_OP_SETUP_RESTART_SEQ,
/* 0x3 */ SEQCMD_SUB_OP_SETUP_TEMPO_SCALE,
/* 0x4 */ SEQCMD_SUB_OP_SETUP_TEMPO_RESET,
/* 0x5 */ SEQCMD_SUB_OP_SETUP_PLAY_SEQ,
/* 0x6 */ SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER,
/* 0x7 */ SEQCMD_SUB_OP_SETUP_RESTORE_VOLUME_IF_QUEUED,
/* 0x8 */ SEQCMD_SUB_OP_SETUP_RESTORE_VOLUME_WITH_SCALE_INDEX,
/* 0x9 */ SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK,
/* 0xA */ SEQCMD_SUB_OP_SETUP_SET_PLAYER_FREQ,
/* 0xE */ SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE = 0xE,
/* 0xF */ SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS
} SeqCmdSetupCmdOp;
// Subset of `SEQCMD_OP_GLOBAL_CMD`
typedef enum {
/* 0x0 */ SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE,
/* 0x1 */ SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES
} SeqCmdSubCmdOp;
// ==== Audio Sequence Primary Commands ====
/**
* Play a sequence on a given seqPlayer
*
* @param seqPlayerIndex the index of the seqPlayer to play the sequence
* @param fadeInDuration duration the sequence will fade in over
* @param seqArg no effect: < 0x7F, skip ticks: = 0x7F, will not play: >= 0x80 (see note)
* @param seqId the id of the sequence to play, see `SeqId`
*
* @note seqArg will also be stored in gActiveSeqs.seqId, any check against that seqId must also include seqArg.
* seqArg = 0x7F will interpret the duration as the number of ticks to skip.
* seqArg >= 0x80 was intented to load a soundFont asynchronously but the code is unfinished (based on MM).
*/
#define SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, fadeInDuration, seqArg, seqId) \
Audio_QueueSeqCmd((SEQCMD_OP_PLAY_SEQUENCE << 28) | ((u8)(seqPlayerIndex) << 24) | ((u8)(fadeInDuration) << 16) | \
((u8)(seqArg) << 8) | (u16)(seqId))
/**
* Stop a sequence on a given seqPlayer
*
* @param seqPlayerIndex the index of the seqPlayer to play the sequence
* @param fadeOutDuration duration the sequence will fade out over
*
* @note the 0xFF in the command is not read from at all, but is common in all Stop SeqPlayer Commands
*/
#define SEQCMD_STOP_SEQUENCE(seqPlayerIndex, fadeOutDuration) \
Audio_QueueSeqCmd((SEQCMD_OP_STOP_SEQUENCE << 28) | 0xFF | ((u8)(seqPlayerIndex) << 24) | \
((u8)(fadeOutDuration) << 16))
/**
* Add a sequence to a queue of sequences associated with a given seqPlayer.
* If the sequence is first in queue, play the sequence
*
* @param seqPlayerIndex the index of the seqPlayer to queue the sequence
* @param fadeInDuration if the sequence is played, duration the sequence will fade in over
* @param priority priority in the queue. The highest valued priority will be queued to play first. Also used as `seqArg`.
* @param seqId the id of the sequence to play, see `SeqId`
*
* @note for the next sequence in the queue to play, the current sequence must be unqueued with the unqueue command
* @note for a priority >= 0x7F, similar effects happen as `seqArg` in the play sequence command
*/
#define SEQCMD_QUEUE_SEQUENCE(seqPlayerIndex, fadeInDuration, priority, seqId) \
Audio_QueueSeqCmd((SEQCMD_OP_QUEUE_SEQUENCE << 28) | ((u8)(seqPlayerIndex) << 24) | ((u8)(fadeInDuration) << 16) | \
((u8)(priority) << 8) | (u8)(seqId))
/**
* Remove a sequence from a queue of sequences associated with a given seqPlayer.
* If the sequence is first in queue, stop the sequence, and play the next one in queue if any
*
* @param seqPlayerIndex the index of the seqPlayer to queue the sequence
* @param fadeInDuration if the sequence is stopped, duration the sequence will fade out over, and duration the next seq will fade in over
* @param seqId the id of the sequence to remove, see `SeqId`
*
* @note for the next sequence in the queue to play, the current sequence must be unqueued with this command
*/
#define SEQCMD_UNQUEUE_SEQUENCE(seqPlayerIndex, fadeOutInDuration, seqId) \
Audio_QueueSeqCmd((SEQCMD_OP_UNQUEUE_SEQUENCE << 28) | ((u8)(seqPlayerIndex) << 24) | \
((u8)(fadeOutInDuration) << 16) | (seqId))
/**
* Set the volume of an entire sequence on a given seqPlayer. Fade to the volume over a specified duration
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the volume
* @param volume the target volume for the sequence. Ranged from 0-0xFF, with 0x7F mapping to 1.0f
*/
#define SEQCMD_SET_PLAYER_VOLUME(seqPlayerIndex, duration, volume) \
Audio_QueueSeqCmd((SEQCMD_OP_SET_PLAYER_VOLUME << 28) | ((u8)(seqPlayerIndex) << 24) | ((duration) << 16) | \
(volume))
/**
* Scale the frequency of every channel on a given seqPlayer over a specified duration.
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the frequency
* @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFFFF, with 1000 mapping to 1.0f
*
* @note 2000 will double the frequency (raise an octave), 500 will halve the frequency (lower an octave).
* Cannot be used with `SEQCMD_SET_CHANNEL_FREQ` as they will overwrite one another.
*/
#define SEQCMD_SET_PLAYER_FREQ(seqPlayerIndex, duration, freqScale) \
Audio_QueueSeqCmd((SEQCMD_OP_SET_PLAYER_FREQ << 28) | ((u8)(seqPlayerIndex) << 24) | ((duration) << 16) | \
(freqScale))
/**
* Scale the frequency of a specific channel on a given seqPlayer over a specified duration
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param channelIndex the index of the channel to modify
* @param duration duration to transition to the frequency
* @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFFF, with 1000 mapping to 1.0f
*
* @note a frequency of 2000 will double the frequency (raise an octave), 500 will halve the frequency (lower an octave).
* Cannot be used with `SEQCMD_SET_PLAYER_FREQ` as they will overwrite one another.
*/
#define SEQCMD_SET_CHANNEL_FREQ(seqPlayerIndex, channelIndex, duration, freqScale) \
Audio_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_FREQ << 28) | ((u8)(seqPlayerIndex) << 24) | ((duration) << 16) | \
((channelIndex) << 12) | (freqScale))
/**
* Set the volume of a specific channel on a given seqPlayer. Fade to the volume over a specified duration
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param channelIndex the index of the channel to modify
* @param duration duration to transition to the volume
* @param volume the target volume for the sequence. Ranged from 0-0xFF, with 0x7F mapping to 1.0f
*/
#define SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, channelIndex, duration, volume) \
Audio_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_VOLUME << 28) | ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | \
((u8)(channelIndex) << 8) | ((u8)volume))
/**
* Write a value that can be read as input directly by the sequence itself. This will be set to the global
* ioPort, which can affect the entire sequence.
*
* @param seqPlayerIndex the index of the seqPlayer to write the input to
* @param ioPort the index of the array to store the input-output value,
* @param ioData the value s8 that's written to the input-output array
*
* @note Each seqPlayer has 8 global ioPorts indexed 0-7.
* ioPort 0 and 1 are read-only-once, and will reset after being read by the sequence.
* ioPort 2-7 can be read multiple times.
*/
#define SEQCMD_SET_PLAYER_IO(seqPlayerIndex, ioPort, ioData) \
Audio_QueueSeqCmd((SEQCMD_OP_SET_PLAYER_IO << 28) | ((u8)(seqPlayerIndex) << 24) | ((u8)(ioPort) << 16) | \
(u8)(ioData))
/**
* Write a value that can be read as input directly by the sequence itself. This will be set to the channel
* ioPort, which will only affect a single channel.
*
* @param seqPlayerIndex the index of the seqPlayer to write the input to
* @param channelIndex the index of the channel to write the input to
* @param ioPort the index of the array to store the input-output value
* @param ioData the value s8 that's written to the input-output array
*
* @note Each channel has 8 channel ioPorts indexed 0-7.
* ioPort 0 and 1 are read-only-once, and will reset after being read by the sequence.
* ioPort 2-7 can be read multiple times.
*/
#define SEQCMD_SET_CHANNEL_IO(seqPlayerIndex, channelIndex, ioPort, ioData) \
Audio_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_IO << 28) | ((u8)(seqPlayerIndex) << 24) | ((u8)(ioPort) << 16) | \
((u8)(channelIndex) << 8) | (u8)(ioData))
/**
* Disable (or reenable) specific channels from receiving input set by `SEQCMD_SET_CHANNEL_IO`
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable
*
* @note using Audio_QueueCmdS8 0x06 will bypass this channelMask
*/
#define SEQCMD_SET_CHANNEL_IO_DISABLE_MASK(seqPlayerIndex, channelMask) \
Audio_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK << 28) | ((u8)(seqPlayerIndex) << 24) | (u16)(channelMask))
/**
* Disable (or reenable) specific channels
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable
*/
#define SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, channelMask) \
Audio_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_DISABLE_MASK << 28) | ((u8)(seqPlayerIndex) << 24) | (u16)(channelMask))
// ==== Audio Sequence Tempo Commands ====
/**
* Set the absolute tempo of a sequence on a given seqPlayer, fading over a specified duration
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the tempo
* @param tempoTarget the target tempo for the sequence
*
* @note the absolute tempo is constrained to a maximum of 300
*/
#define SEQCMD_SET_TEMPO(seqPlayerIndex, duration, tempoTarget) \
Audio_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SET << 12) | ((u8)(seqPlayerIndex) << 24) | \
((u8)(duration) << 16) | (u16)(tempoTarget))
/**
* Increase the tempo of a sequence by a relative value on a given seqPlayer over a specified duration
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the tempo
* @param tempoIncrease the change to add to the current tempo
*
* @note the absolute tempo is constrained to a maximum of 300
*/
#define SEQCMD_SPEED_UP_TEMPO(seqPlayerIndex, duration, tempoIncrease) \
Audio_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SPEED_UP << 12) | \
((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u16)(tempoIncrease))
/**
* Decrease the tempo of a sequence by a relative value on a given seqPlayer over a specified duration
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the tempo
* @param tempoDecrease the change to subtract to the current tempo
*
* @note the absolute tempo is constrained to a maximum of 300
*/
#define SEQCMD_SLOW_DOWN_TEMPO(seqPlayerIndex, duration, tempoDecrease) \
Audio_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SLOW_DOWN << 12) | \
((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u16)(tempoDecrease))
/**
* Scale the tempo of a sequence by a multiplicative value on a given seqPlayer over a specified duration
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the tempo
* @param tempoScale the scaling factor of the tempo, relative to 100
*
* @note a tempoScale of 200 will go double-time, 50 will go half-time.
* the absolute tempo is constrained to a maximum of 300
*/
#define SEQCMD_SCALE_TEMPO(seqPlayerIndex, duration, tempoScale) \
Audio_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SCALE << 12) | ((u8)(seqPlayerIndex) << 24) | \
((u8)(duration) << 16) | (u16)(tempoScale))
/**
* Reset the tempo of a sequence to the original tempo on a given seqPlayer over a specified duration
*
* @param seqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the tempo
*/
#define SEQCMD_RESET_TEMPO(seqPlayerIndex, duration) \
Audio_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_RESET << 12) | ((u8)(seqPlayerIndex) << 24) | \
((u8)(duration) << 16))
/**
* ==== Audio Sequence Setup Commands ====
*
* The setup commands are designed to wait to be executed.
* Up to 8 commands can be queued per `seqPlayerIndex`.
* These commands will only execute once that `seqPlayerIndex` is finished playing and is no longer enabled.
* They will often target a different player (`targetSeqPlayerIndex`) but not always.
*/
/**
* Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled
*
* @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled
* @param targetSeqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the volume
*/
#define SEQCMD_SETUP_RESTORE_PLAYER_VOLUME(setupSeqPlayerIndex, targetSeqPlayerIndex, duration) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTORE_VOLUME << 20) | \
((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u8)(duration))
/**
* Setup a request to unqueue a seqPlayer once that same setup seqPlayer is finished playing and disabled
*
* @param setupSeqPlayerIndex the index of the seqPlayer to unqueue once the same seqPlayer is disabled
*
* @bug this command was misimplemented and fails to unqueue. The command relies on `gActiveSeqs.seqId` for
* unqueueing, but seqId is reset before being used to unqueue. A simple fix is to unqueue based on
* `gActiveSeqs.prevSeqId` instead.
*/
#define SEQCMD_SETUP_UNQUEUE_SEQUENCE(setupSeqPlayerIndex) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE << 20) | \
((u8)(setupSeqPlayerIndex) << 24))
/**
* Setup a request to restart and play an active sequence currently playing on a target seqPlayer
* once a setup seqPlayer is finished playing and disabled
*
* @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled
* @param targetSeqPlayerIndex the index of the seqPlayer to restart its active sequence
*/
#define SEQCMD_SETUP_RESTART_SEQUENCE(setupSeqPlayerIndex, targetSeqPlayerIndex) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTART_SEQ << 20) | \
((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16))
/**
* Setup a request to scale the tempo of a sequence by a multiplicative value on a target seqPlayer
* once a setup seqPlayer is finished playing and disabled
*
* @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled
* @param targetSeqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the tempo
* @param tempoScale the scaling factor of the tempo, relative to 100
*
* @note a tempoScale of 200 will go double-time, 50 will go half-time.
* the absolute tempo is constrained to a maximum of 300
*/
#define SEQCMD_SETUP_SCALE_TEMPO(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, tempoScale) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_TEMPO_SCALE << 20) | \
((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | ((u8)(duration) << 8) | \
(u8)(tempoScale))
/**
* Setup a request to reset the tempo of a sequence to the original tempo on a target seqPlayer
* once a setup seqPlayer is finished playing and disabled
*
* @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled
* @param targetSeqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the tempo
*/
#define SEQCMD_SETUP_RESET_TEMPO(setupSeqPlayerIndex, targetSeqPlayerIndex, duration) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_TEMPO_RESET << 20) | \
((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u8)(duration))
/**
* Setup a request to play a sequence on a target seqPlayer once a setup seqPlayer is finished playing and disabled.
* This command is optionally paired with `SEQCMD_SETUP_SET_FADE_IN_TIMER` to set the fade in duration
*
* @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled
* @param targetSeqPlayerIndex the index of the seqPlayer to play the sequence
* @param seqId the id of the sequence to play, see `SeqId`
*/
#define SEQCMD_SETUP_PLAY_SEQUENCE(setupSeqPlayerIndex, targetSeqPlayerIndex, seqId) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_PLAY_SEQ << 20) | \
((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u16)(seqId))
/**
* This command is an optional command before `SEQCMD_SETUP_PLAY_SEQUENCE` to set the fade in duration
* (see cmd above)
*
* @param targetSeqPlayerIndex the index of the seqPlayer to play the sequence
* @param fadeInDuration duration the sequence will fade in over
*/
#define SEQCMD_SETUP_SET_FADE_IN_TIMER(targetSeqPlayerIndex, fadeInDuration) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER << 20) | \
((u8)(targetSeqPlayerIndex) << 24) | ((u8)(fadeInDuration) << 8))
/**
* Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled.
* Specifically, it will only restore volume if the number of queued requests on the setup seqPlayer matches
* the number of sequences queued
*
* @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled
* @param targetSeqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the volume
* @param numSeqRequests the number of sequence requests queued that must match the actual number of sequence requests
*/
#define SEQCMD_SETUP_RESTORE_PLAYER_VOLUME_IF_QUEUED(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, \
numSeqRequests) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTORE_VOLUME_IF_QUEUED << 20) | \
((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | ((u8)(duration) << 8) | \
(u8)(numSeqRequests))
/**
* Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled.
* Allows `scaleIndex` to be specified.
*
* @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled
* @param targetSeqPlayerIndex the index of the seqPlayer to modify
* @param scaleIndex the scale index of a seqPlayer
* @param duration duration to transition to the volume
*/
#define SEQCMD_SETUP_RESTORE_PLAYER_VOLUME_WITH_SCALE_INDEX(setupSeqPlayerIndex, targetSeqPlayerIndex, scaleIndex, duration) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTORE_VOLUME_WITH_SCALE_INDEX << 20) | \
((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \
((u8)(scaleIndex) << 8) | (u8)(duration))
/**
* Setup a request to disable (or reenable) specific channels on a target seqPlayer
* once a setup seqPlayer is finished playing and disabled.
*
* @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled
* @param targetSeqPlayerIndex the index of the seqPlayer to modify
* @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable
*/
#define SEQCMD_SETUP_SET_CHANNEL_DISABLE_MASK(setupSeqPlayerIndex, targetSeqPlayerIndex, channelMask) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK << 20) | \
((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u16)(channelMask))
/**
* Queue a request to scale the frequency of an entire sequence on a target seqPlayer
* once a setup seqPlayer is finished playing and disabled.
*
* @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled
* @param targetSeqPlayerIndex the index of the seqPlayer to modify
* @param duration duration to transition to the frequency
* @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFF, with 100 mapping to 1.0f
*
* @note The base value for frequency, 100, is 10 times smaller than other frequency commands.
* 200 will double the frequency (raise an octave), 50 will halve the frequency (lower an octave).
*/
#define SEQCMD_SETUP_SET_PLAYER_FREQ(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, freqScale) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_PLAYER_FREQ << 20) | \
((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | ((u8)(duration) << 8) | \
(u8)(freqScale))
/**
* Queue a request to discard audio data by popping an entry from the persistent caches on the audio heap,
* once a setup seqPlayer is finished playing and disabled.
*
* @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled
* @param tableTypeFlag All tables with the flag `(tableTypeFlag & (1 << tableType))` will be discarded. Specifically:
* `(tableTypeFlag & 1)` will discard the `SEQUENCE_TABLE`
* `(tableTypeFlag & 2)` will discard the `FONT_TABLE`
* `(tableTypeFlag & 4)` will discard the `SAMPLE_TABLE`
*/
#define SEQCMD_SETUP_POP_PERSISTENT_CACHE(setupSeqPlayerIndex, tableTypeFlag) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE << 20) | \
((u8)(setupSeqPlayerIndex) << 24) | ((u8)tableTypeFlag))
/**
* Discard all setup command requests on a seqPlayerIndex by resetting the setup command queue
*
* @param setupSeqPlayerIndex the index of the seqPlayer to disable all setup commands
*/
#define SEQCMD_RESET_SETUP_CMDS(setupSeqPlayerIndex) \
Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS << 20) | \
((u8)(setupSeqPlayerIndex) << 24))
/**
* ==== Audio Sequence Global Commands ====
*
* The global commands will apply to the entire audio system and all 4 sequence players
*/
/**
* Change the sound mode of audio
*
* @param soundMode see the `SoundMode` enum
*/
#define SEQCMD_SET_SOUND_MODE(soundMode) \
Audio_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE << 8) | (u8)(soundMode))
/**
* Disable (or reenable) new sequences from starting
*
* @param isDisabled true to disable, false to enable
*
* @note this does not disable the sfx player
*/
#define SEQCMD_DISABLE_PLAY_SEQUENCES(isDisabled) \
Audio_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES << 8) | \
(u16)(isDisabled))
/**
* Restart the audio heap with the specified settings
*
* @param sfxChannelLayout index for different mappings between the 7 banks and the 16 channels
* @param specId index for the audio specifications to set high-level audio parameters
*
* @note: For sfxChannelLayout, There are 4 possible layouts indexed by 0-3.
* However, only index 0 is properly implemented. Other indices lead to bugs and softlocks.
*/
#define SEQCMD_RESET_AUDIO_HEAP(sfxChannelLayout, specId) \
Audio_QueueSeqCmd((SEQCMD_OP_RESET_AUDIO_HEAP << 28) | ((u8)(sfxChannelLayout) << 8) | (u8)(specId))
#endif
+163 -116
View File
@@ -1,121 +1,121 @@
#ifndef SEQUENCE_H
#define SEQUENCE_H
#define NA_BGM_STOP 0x100000FF
#define NA_BGM_GENERAL_SFX 0x0 // General Sound Effects
#define NA_BGM_NATURE_AMBIENCE 0x1 // Environmental nature background sounds
#define NA_BGM_FIELD_LOGIC 0x2 // Hyrule Field
#define NA_BGM_FIELD_INIT 0x3 // Hyrule Field Initial Segment From Loading Area
#define NA_BGM_FIELD_DEFAULT_1 0x4 // Hyrule Field Moving Segment 1
#define NA_BGM_FIELD_DEFAULT_2 0x5 // Hyrule Field Moving Segment 2
#define NA_BGM_FIELD_DEFAULT_3 0x6 // Hyrule Field Moving Segment 3
#define NA_BGM_FIELD_DEFAULT_4 0x7 // Hyrule Field Moving Segment 4
#define NA_BGM_FIELD_DEFAULT_5 0x8 // Hyrule Field Moving Segment 5
#define NA_BGM_FIELD_DEFAULT_6 0x9 // Hyrule Field Moving Segment 6
#define NA_BGM_FIELD_DEFAULT_7 0x0A // Hyrule Field Moving Segment 7
#define NA_BGM_FIELD_DEFAULT_8 0x0B // Hyrule Field Moving Segment 8
#define NA_BGM_FIELD_DEFAULT_9 0x0C // Hyrule Field Moving Segment 9
#define NA_BGM_FIELD_DEFAULT_A 0x0D // Hyrule Field Moving Segment 10
#define NA_BGM_FIELD_DEFAULT_B 0x0E // Hyrule Field Moving Segment 11
#define NA_BGM_FIELD_ENEMY_INIT 0x0F // Hyrule Field Enemy Approaches
#define NA_BGM_FIELD_ENEMY_1 0x10 // Hyrule Field Enemy Near Segment 1
#define NA_BGM_FIELD_ENEMY_2 0x11 // Hyrule Field Enemy Near Segment 2
#define NA_BGM_FIELD_ENEMY_3 0x12 // Hyrule Field Enemy Near Segment 3
#define NA_BGM_FIELD_ENEMY_4 0x13 // Hyrule Field Enemy Near Segment 4
#define NA_BGM_FIELD_STILL_1 0x14 // Hyrule Field Standing Still Segment 1
#define NA_BGM_FIELD_STILL_2 0x15 // Hyrule Field Standing Still Segment 2
#define NA_BGM_FIELD_STILL_3 0x16 // Hyrule Field Standing Still Segment 3
#define NA_BGM_FIELD_STILL_4 0x17 // Hyrule Field Standing Still Segment 4
#define NA_BGM_DUNGEON 0x18 // Dodongo's Cavern
#define NA_BGM_KAKARIKO_ADULT 0x19 // Kakariko Village (Adult)
#define NA_BGM_ENEMY 0x1A // Battle
#define NA_BGM_BOSS 0x1B // Boss Battle "NA_BGM_BOSS00"
#define NA_BGM_INSIDE_DEKU_TREE 0x1C // Inside the Deku Tree "NA_BGM_FAIRY_DUNGEON"
#define NA_BGM_MARKET 0x1D // Market
#define NA_BGM_TITLE 0x1E // Title Theme
#define NA_BGM_LINK_HOUSE 0x1F // House
#define NA_BGM_GAME_OVER 0x20 // Game Over
#define NA_BGM_BOSS_CLEAR 0x21 // Boss Clear
#define NA_BGM_ITEM_GET 0x22 // Obtain Item
#define NA_BGM_OPENING_GANON 0x23 // Enter Ganondorf
#define NA_BGM_HEART_GET 0x24 // Obtain Heart Container
#define NA_BGM_OCA_LIGHT 0x25 // Prelude of Light
#define NA_BGM_JABU_JABU 0x26 // Inside Jabu-Jabu's Belly "NA_BGM_BUYO_DUNGEON"
#define NA_BGM_KAKARIKO_KID 0x27 // Kakariko Village (Child)
#define NA_BGM_GREAT_FAIRY 0x28 // Great Fairy's Fountain "NA_BGM_GODESS"
#define NA_BGM_ZELDA_THEME 0x29 // Zelda's Theme "NA_BGM_HIME"
#define NA_BGM_FIRE_TEMPLE 0x2A // Fire Temple "NA_BGM_FIRE_DUNGEON"
#define NA_BGM_OPEN_TRE_BOX 0x2B // Open Treasure Chest
#define NA_BGM_FOREST_TEMPLE 0x2C // Forest Temple "NA_BGM_FORST_DUNGEON"
#define NA_BGM_COURTYARD 0x2D // Hyrule Castle Courtyard "NA_BGM_HIRAL_GARDEN"
#define NA_BGM_GANON_TOWER 0x2E // Ganondorf's Theme
#define NA_BGM_LONLON 0x2F // Lon Lon Ranch "NA_BGM_RONRON"
#define NA_BGM_GORON_CITY 0x30 // Goron City "NA_BGM_GORON"
#define NA_BGM_FIELD_MORNING 0x31 // Hyrule Field Morning Theme
#define NA_BGM_SPIRITUAL_STONE 0x32 // Spiritual Stone Get "NA_BGM_SPIRIT_STONE"
#define NA_BGM_OCA_BOLERO 0x33 // Bolero of Fire "NA_BGM_OCA_FLAME"
#define NA_BGM_OCA_MINUET 0x34 // Minuet of Forest "NA_BGM_OCA_WIND"
#define NA_BGM_OCA_SERENADE 0x35 // Serenade of Water "NA_BGM_OCA_WATER"
#define NA_BGM_OCA_REQUIEM 0x36 // Requiem of Spirit "NA_BGM_OCA_SOUL"
#define NA_BGM_OCA_NOCTURNE 0x37 // Nocturne of Shadow "NA_BGM_OCA_DARKNESS"
#define NA_BGM_MINI_BOSS 0x38 // Mini-Boss Battle "NA_BGM_MIDDLE_BOSS"
#define NA_BGM_SMALL_ITEM_GET 0x39 // Obtain Small Item "NA_BGM_S_ITEM_GET"
#define NA_BGM_TEMPLE_OF_TIME 0x3A // Temple of Time "NA_BGM_SHRINE_OF_TIME"
#define NA_BGM_EVENT_CLEAR 0x3B // Escape from Lon Lon Ranch
#define NA_BGM_KOKIRI 0x3C // Kokiri Forest
#define NA_BGM_OCA_FAIRY_GET 0x3D // Obtain Fairy Ocarina "NA_BGM_OCA_YOUSEI"
#define NA_BGM_SARIA_THEME 0x3E // Lost Woods "NA_BGM_MAYOIMORI"
#define NA_BGM_SPIRIT_TEMPLE 0x3F // Spirit Temple "NA_BGM_SOUL_DUNGEON"
#define NA_BGM_HORSE 0x40 // Horse Race
#define NA_BGM_HORSE_GOAL 0x41 // Horse Race Goal
#define NA_BGM_INGO 0x42 // Ingo's Theme
#define NA_BGM_MEDALLION_GET 0x43 // Obtain Medallion "NA_BGM_MEDAL_GET"
#define NA_BGM_OCA_SARIA 0x44 // Ocarina Saria's Song
#define NA_BGM_OCA_EPONA 0x45 // Ocarina Epona's Song
#define NA_BGM_OCA_ZELDA 0x46 // Ocarina Zelda's Lullaby
#define NA_BGM_OCA_SUNS 0x47 // Ocarina Sun's Song "NA_BGM_OCA_SUNMOON"
#define NA_BGM_OCA_TIME 0x48 // Ocarina Song of Time
#define NA_BGM_OCA_STORM 0x49 // Ocarina Song of Storms
#define NA_BGM_NAVI_OPENING 0x4A // Fairy Flying "NA_BGM_NAVI"
#define NA_BGM_DEKU_TREE_CS 0x4B // Deku Tree "NA_BGM_DEKUNOKI"
#define NA_BGM_WINDMILL 0x4C // Windmill Hut "NA_BGM_FUSHA"
#define NA_BGM_HYRULE_CS 0x4D // Legend of Hyrule "NA_BGM_HIRAL_DEMO"
#define NA_BGM_MINI_GAME 0x4E // Shooting Gallery
#define NA_BGM_SHEIK 0x4F // Sheik's Theme "NA_BGM_SEAK"
#define NA_BGM_ZORA_DOMAIN 0x50 // Zora's Domain "NA_BGM_ZORA"
#define NA_BGM_APPEAR 0x51 // Enter Zelda
#define NA_BGM_ADULT_LINK 0x52 // Goodbye to Zelda
#define NA_BGM_MASTER_SWORD 0x53 // Master Sword
#define NA_BGM_INTRO_GANON 0x54
#define NA_BGM_SHOP 0x55 // Shop
#define NA_BGM_CHAMBER_OF_SAGES 0x56 // Chamber of the Sages "NA_BGM_KENJA"
#define NA_BGM_FILE_SELECT 0x57 // File Select
#define NA_BGM_ICE_CAVERN 0x58 // Ice Cavern "NA_BGM_ICE_DUNGEON"
#define NA_BGM_DOOR_OF_TIME 0x59 // Open Door of Temple of Time "NA_BGM_GATE_OPEN"
#define NA_BGM_OWL 0x5A // Kaepora Gaebora's Theme
#define NA_BGM_SHADOW_TEMPLE 0x5B // Shadow Temple "NA_BGM_DARKNESS_DUNGEON"
#define NA_BGM_WATER_TEMPLE 0x5C // Water Temple "NA_BGM_AQUA_DUNGEON"
#define NA_BGM_BRIDGE_TO_GANONS 0x5D // Ganon's Castle Bridge "NA_BGM_BRIDGE"
#define NA_BGM_OCARINA_OF_TIME 0x5E // Ocarina of Time "NA_BGM_SARIA"
#define NA_BGM_GERUDO_VALLEY 0x5F // Gerudo Valley "NA_BGM_GERUDO"
#define NA_BGM_POTION_SHOP 0x60 // Potion Shop "NA_BGM_DRUGSTORE"
#define NA_BGM_KOTAKE_KOUME 0x61 // Kotake & Koume's Theme
#define NA_BGM_ESCAPE 0x62 // Escape from Ganon's Castle
#define NA_BGM_UNDERGROUND 0x63 // Ganon's Castle Under Ground
#define NA_BGM_GANONDORF_BOSS 0x64 // Ganondorf Battle
#define NA_BGM_GANON_BOSS 0x65 // Ganon Battle
#define NA_BGM_END_DEMO 0x66 // Seal of Six Sages
#define NA_BGM_STAFF_1 0x67 // End Credits I
#define NA_BGM_STAFF_2 0x68 // End Credits II
#define NA_BGM_STAFF_3 0x69 // End Credits III
#define NA_BGM_STAFF_4 0x6A // End Credits IV
#define NA_BGM_FIRE_BOSS 0x6B // King Dodongo & Volvagia Boss Battle "NA_BGM_BOSS01"
#define NA_BGM_TIMED_MINI_GAME 0x6C // Mini-Game
#define NA_BGM_CUTSCENE_EFFECTS 0x6D // A small collection of various cutscene sounds
#define NA_BGM_NO_MUSIC 0x7F // No bgm music is played
#define NA_BGM_NATURE_SFX_RAIN 0x80 // Related to rain
#define NA_BGM_DISABLED 0xFFFF
typedef enum {
/* 0x00 */ NA_BGM_GENERAL_SFX, // General Sound Effects
/* 0x01 */ NA_BGM_NATURE_AMBIENCE, // Environmental nature background sounds
/* 0x02 */ NA_BGM_FIELD_LOGIC, // Hyrule Field
/* 0x03 */ NA_BGM_FIELD_INIT, // Hyrule Field Initial Segment From Loading Area
/* 0x04 */ NA_BGM_FIELD_DEFAULT_1, // Hyrule Field Moving Segment 1
/* 0x05 */ NA_BGM_FIELD_DEFAULT_2, // Hyrule Field Moving Segment 2
/* 0x06 */ NA_BGM_FIELD_DEFAULT_3, // Hyrule Field Moving Segment 3
/* 0x07 */ NA_BGM_FIELD_DEFAULT_4, // Hyrule Field Moving Segment 4
/* 0x08 */ NA_BGM_FIELD_DEFAULT_5, // Hyrule Field Moving Segment 5
/* 0x09 */ NA_BGM_FIELD_DEFAULT_6, // Hyrule Field Moving Segment 6
/* 0x0A */ NA_BGM_FIELD_DEFAULT_7, // Hyrule Field Moving Segment 7
/* 0x0B */ NA_BGM_FIELD_DEFAULT_8, // Hyrule Field Moving Segment 8
/* 0x0C */ NA_BGM_FIELD_DEFAULT_9, // Hyrule Field Moving Segment 9
/* 0x0D */ NA_BGM_FIELD_DEFAULT_A, // Hyrule Field Moving Segment 10
/* 0x0E */ NA_BGM_FIELD_DEFAULT_B, // Hyrule Field Moving Segment 11
/* 0x0F */ NA_BGM_FIELD_ENEMY_INIT, // Hyrule Field Enemy Approaches
/* 0x10 */ NA_BGM_FIELD_ENEMY_1, // Hyrule Field Enemy Near Segment 1
/* 0x11 */ NA_BGM_FIELD_ENEMY_2, // Hyrule Field Enemy Near Segment 2
/* 0x12 */ NA_BGM_FIELD_ENEMY_3, // Hyrule Field Enemy Near Segment 3
/* 0x13 */ NA_BGM_FIELD_ENEMY_4, // Hyrule Field Enemy Near Segment 4
/* 0x14 */ NA_BGM_FIELD_STILL_1, // Hyrule Field Standing Still Segment 1
/* 0x15 */ NA_BGM_FIELD_STILL_2, // Hyrule Field Standing Still Segment 2
/* 0x16 */ NA_BGM_FIELD_STILL_3, // Hyrule Field Standing Still Segment 3
/* 0x17 */ NA_BGM_FIELD_STILL_4, // Hyrule Field Standing Still Segment 4
/* 0x18 */ NA_BGM_DUNGEON, // Dodongo's Cavern
/* 0x19 */ NA_BGM_KAKARIKO_ADULT, // Kakariko Village (Adult)
/* 0x1A */ NA_BGM_ENEMY, // Battle
/* 0x1B */ NA_BGM_BOSS, // Boss Battle "NA_BGM_BOSS00"
/* 0x1C */ NA_BGM_INSIDE_DEKU_TREE, // Inside the Deku Tree "NA_BGM_FAIRY_DUNGEON"
/* 0x1D */ NA_BGM_MARKET, // Market
/* 0x1E */ NA_BGM_TITLE, // Title Theme
/* 0x1F */ NA_BGM_LINK_HOUSE, // House
/* 0x20 */ NA_BGM_GAME_OVER, // Game Over
/* 0x21 */ NA_BGM_BOSS_CLEAR, // Boss Clear
/* 0x22 */ NA_BGM_ITEM_GET, // Obtain Item
/* 0x23 */ NA_BGM_OPENING_GANON, // Enter Ganondorf
/* 0x24 */ NA_BGM_HEART_GET, // Obtain Heart Container
/* 0x25 */ NA_BGM_OCA_LIGHT, // Prelude of Light
/* 0x26 */ NA_BGM_JABU_JABU, // Inside Jabu-Jabu's Belly "NA_BGM_BUYO_DUNGEON"
/* 0x27 */ NA_BGM_KAKARIKO_KID, // Kakariko Village (Child)
/* 0x28 */ NA_BGM_GREAT_FAIRY, // Great Fairy's Fountain "NA_BGM_GODESS"
/* 0x29 */ NA_BGM_ZELDA_THEME, // Zelda's Theme "NA_BGM_HIME"
/* 0x2A */ NA_BGM_FIRE_TEMPLE, // Fire Temple "NA_BGM_FIRE_DUNGEON"
/* 0x2B */ NA_BGM_OPEN_TRE_BOX, // Open Treasure Chest
/* 0x2C */ NA_BGM_FOREST_TEMPLE, // Forest Temple "NA_BGM_FORST_DUNGEON"
/* 0x2D */ NA_BGM_COURTYARD, // Hyrule Castle Courtyard "NA_BGM_HIRAL_GARDEN"
/* 0x2E */ NA_BGM_GANON_TOWER, // Ganondorf's Theme
/* 0x2F */ NA_BGM_LONLON, // Lon Lon Ranch "NA_BGM_RONRON"
/* 0x30 */ NA_BGM_GORON_CITY, // Goron City "NA_BGM_GORON"
/* 0x31 */ NA_BGM_FIELD_MORNING, // Hyrule Field Morning Theme
/* 0x32 */ NA_BGM_SPIRITUAL_STONE, // Spiritual Stone Get "NA_BGM_SPIRIT_STONE"
/* 0x33 */ NA_BGM_OCA_BOLERO, // Bolero of Fire "NA_BGM_OCA_FLAME"
/* 0x34 */ NA_BGM_OCA_MINUET, // Minuet of Forest "NA_BGM_OCA_WIND"
/* 0x35 */ NA_BGM_OCA_SERENADE, // Serenade of Water "NA_BGM_OCA_WATER"
/* 0x36 */ NA_BGM_OCA_REQUIEM, // Requiem of Spirit "NA_BGM_OCA_SOUL"
/* 0x37 */ NA_BGM_OCA_NOCTURNE, // Nocturne of Shadow "NA_BGM_OCA_DARKNESS"
/* 0x38 */ NA_BGM_MINI_BOSS, // Mini-Boss Battle "NA_BGM_MIDDLE_BOSS"
/* 0x39 */ NA_BGM_SMALL_ITEM_GET, // Obtain Small Item "NA_BGM_S_ITEM_GET"
/* 0x3A */ NA_BGM_TEMPLE_OF_TIME, // Temple of Time "NA_BGM_SHRINE_OF_TIME"
/* 0x3B */ NA_BGM_EVENT_CLEAR, // Escape from Lon Lon Ranch
/* 0x3C */ NA_BGM_KOKIRI, // Kokiri Forest
/* 0x3D */ NA_BGM_OCA_FAIRY_GET, // Obtain Fairy Ocarina "NA_BGM_OCA_YOUSEI"
/* 0x3E */ NA_BGM_SARIA_THEME, // Lost Woods "NA_BGM_MAYOIMORI"
/* 0x3F */ NA_BGM_SPIRIT_TEMPLE, // Spirit Temple "NA_BGM_SOUL_DUNGEON"
/* 0x40 */ NA_BGM_HORSE, // Horse Race
/* 0x41 */ NA_BGM_HORSE_GOAL, // Horse Race Goal
/* 0x42 */ NA_BGM_INGO, // Ingo's Theme
/* 0x43 */ NA_BGM_MEDALLION_GET, // Obtain Medallion "NA_BGM_MEDAL_GET"
/* 0x44 */ NA_BGM_OCA_SARIA, // Ocarina Saria's Song
/* 0x45 */ NA_BGM_OCA_EPONA, // Ocarina Epona's Song
/* 0x46 */ NA_BGM_OCA_ZELDA, // Ocarina Zelda's Lullaby
/* 0x47 */ NA_BGM_OCA_SUNS, // Ocarina Sun's Song "NA_BGM_OCA_SUNMOON"
/* 0x48 */ NA_BGM_OCA_TIME, // Ocarina Song of Time
/* 0x49 */ NA_BGM_OCA_STORM, // Ocarina Song of Storms
/* 0x4A */ NA_BGM_NAVI_OPENING, // Fairy Flying "NA_BGM_NAVI"
/* 0x4B */ NA_BGM_DEKU_TREE_CS, // Deku Tree "NA_BGM_DEKUNOKI"
/* 0x4C */ NA_BGM_WINDMILL, // Windmill Hut "NA_BGM_FUSHA"
/* 0x4D */ NA_BGM_HYRULE_CS, // Legend of Hyrule "NA_BGM_HIRAL_DEMO"
/* 0x4E */ NA_BGM_MINI_GAME, // Shooting Gallery
/* 0x4F */ NA_BGM_SHEIK, // Sheik's Theme "NA_BGM_SEAK"
/* 0x50 */ NA_BGM_ZORA_DOMAIN, // Zora's Domain "NA_BGM_ZORA"
/* 0x51 */ NA_BGM_APPEAR, // Enter Zelda
/* 0x52 */ NA_BGM_ADULT_LINK, // Goodbye to Zelda
/* 0x53 */ NA_BGM_MASTER_SWORD, // Master Sword
/* 0x54 */ NA_BGM_INTRO_GANON,
/* 0x55 */ NA_BGM_SHOP, // Shop
/* 0x56 */ NA_BGM_CHAMBER_OF_SAGES, // Chamber of the Sages "NA_BGM_KENJA"
/* 0x57 */ NA_BGM_FILE_SELECT, // File Select
/* 0x58 */ NA_BGM_ICE_CAVERN, // Ice Cavern "NA_BGM_ICE_DUNGEON"
/* 0x59 */ NA_BGM_DOOR_OF_TIME, // Open Door of Temple of Time "NA_BGM_GATE_OPEN"
/* 0x5A */ NA_BGM_OWL, // Kaepora Gaebora's Theme
/* 0x5B */ NA_BGM_SHADOW_TEMPLE, // Shadow Temple "NA_BGM_DARKNESS_DUNGEON"
/* 0x5C */ NA_BGM_WATER_TEMPLE, // Water Temple "NA_BGM_AQUA_DUNGEON"
/* 0x5D */ NA_BGM_BRIDGE_TO_GANONS, // Ganon's Castle Bridge "NA_BGM_BRIDGE"
/* 0x5E */ NA_BGM_OCARINA_OF_TIME, // Ocarina of Time "NA_BGM_SARIA"
/* 0x5F */ NA_BGM_GERUDO_VALLEY, // Gerudo Valley "NA_BGM_GERUDO"
/* 0x60 */ NA_BGM_POTION_SHOP, // Potion Shop "NA_BGM_DRUGSTORE"
/* 0x61 */ NA_BGM_KOTAKE_KOUME, // Kotake & Koume's Theme
/* 0x62 */ NA_BGM_ESCAPE, // Escape from Ganon's Castle
/* 0x63 */ NA_BGM_UNDERGROUND, // Ganon's Castle Under Ground
/* 0x64 */ NA_BGM_GANONDORF_BOSS, // Ganondorf Battle
/* 0x65 */ NA_BGM_GANON_BOSS, // Ganon Battle
/* 0x66 */ NA_BGM_END_DEMO, // Seal of Six Sages
/* 0x67 */ NA_BGM_STAFF_1, // End Credits I
/* 0x68 */ NA_BGM_STAFF_2, // End Credits II
/* 0x69 */ NA_BGM_STAFF_3, // End Credits III
/* 0x6A */ NA_BGM_STAFF_4, // End Credits IV
/* 0x6B */ NA_BGM_FIRE_BOSS, // King Dodongo & Volvagia Boss Battle "NA_BGM_BOSS01"
/* 0x6C */ NA_BGM_TIMED_MINI_GAME, // Mini-Game
/* 0x6D */ NA_BGM_CUTSCENE_EFFECTS, // A small collection of various cutscene sounds
/* 0x7F */ NA_BGM_NO_MUSIC = 0x7F, // No bgm music is played
/* 0x80 */ NA_BGM_NATURE_SFX_RAIN = 0x80, // Related to rain
/* 0xFFFF */ NA_BGM_DISABLED = 0xFFFF
} SeqId;
typedef enum {
/* 0 */ SEQ_PLAYER_BGM_MAIN,
@@ -161,6 +161,53 @@ typedef enum {
/* 0x7 */ CHANNEL_IO_PORT_7
} ChannelIOPort;
typedef enum {
/* 0 */ VOL_SCALE_INDEX_BGM_MAIN,
/* 1 */ VOL_SCALE_INDEX_FANFARE,
/* 2 */ VOL_SCALE_INDEX_SFX,
/* 3 */ VOL_SCALE_INDEX_BGM_SUB,
/* 4 */ VOL_SCALE_INDEX_MAX
} VolumeScaleIndex; // May be worth using SequencePlayerId instead
typedef struct {
/* 0x00 */ f32 volCur;
/* 0x04 */ f32 volTarget;
/* 0x08 */ f32 volStep;
/* 0x0C */ u16 volTimer;
/* 0x10 */ f32 freqScaleCur;
/* 0x14 */ f32 freqScaleTarget;
/* 0x18 */ f32 freqScaleStep;
/* 0x1C */ u16 freqScaleTimer;
} ActiveSequenceChannelData; // size = 0x20
typedef struct {
/* 0x000 */ f32 volCur;
/* 0x004 */ f32 volTarget;
/* 0x008 */ f32 volStep;
/* 0x00C */ u16 volTimer;
/* 0x00E */ u8 volScales[VOL_SCALE_INDEX_MAX];
/* 0x012 */ u8 volFadeTimer;
/* 0x013 */ u8 fadeVolUpdate;
/* 0x014 */ u32 tempoCmd;
/* 0x018 */ u16 tempoOriginal; // stores the original tempo before modifying it (to reset back to)
/* 0x01C */ f32 tempoCur;
/* 0x020 */ f32 tempoTarget;
/* 0x024 */ f32 tempoStep;
/* 0x028 */ u16 tempoTimer;
/* 0x02C */ u32 setupCmd[8]; // a queue of cmds to execute once the player is disabled
/* 0x04C */ u8 setupCmdTimer; // only execute setup commands when the timer is at 0.
/* 0x04D */ u8 setupCmdNum; // number of setup commands requested once the player is disabled
/* 0x04E */ u8 setupFadeTimer;
/* 0x050 */ ActiveSequenceChannelData channelData[16];
/* 0x250 */ u16 freqScaleChannelFlags;
/* 0x252 */ u16 volChannelFlags;
/* 0x254 */ u16 seqId; // active seqId currently playing. Resets when sequence stops
/* 0x256 */ u16 prevSeqId; // last seqId played on a player. Does not reset when sequence stops
/* 0x258 */ u16 channelPortMask;
/* 0x25C */ u32 startSeqCmd; // This name comes from MM
/* 0x260 */ u8 isWaitingForFonts; // This name comes from MM
} ActiveSequence; // size = 0x264
typedef enum {
/* 0x0 */ NATURE_CHANNEL_STREAM_0,
/* 0x1 */ NATURE_CHANNEL_CRITTER_0,
@@ -175,7 +222,7 @@ typedef enum {
/* 0xD */ NATURE_CHANNEL_UNK,
/* 0xE */ NATURE_CHANNEL_RAIN,
/* 0xF */ NATURE_CHANNEL_LIGHTNING
} NatureChannelIdx; // playerIdx = 0 (Overlaps with main bgm)
} NatureChannelIndex; // seqPlayerIndex = 0 (Overlaps with main bgm)
typedef enum {
/* 0x00 */ NATURE_ID_GENERAL_NIGHT,
+6 -6
View File
@@ -150,10 +150,10 @@ extern s8 gSfxDefaultReverb;
extern u8 D_801333F0;
extern u8 gAudioSfxSwapOff;
extern u8 D_801333F8;
extern u8 gSeqCmdWrPos;
extern u8 gSeqCmdRdPos;
extern u8 D_80133408;
extern u8 D_8013340C;
extern u8 gSeqCmdWritePos;
extern u8 gSeqCmdReadPos;
extern u8 gStartSeqDisabled;
extern u8 gAudioDebugPrintSeqCmd;
extern u8 gSoundModeList[];
extern u8 gAudioSpecId;
extern u8 D_80133418;
@@ -217,8 +217,8 @@ extern u8 gSfxBankMuted[];
extern u16 gAudioSfxSwapSource[10];
extern u16 gAudioSfxSwapTarget[10];
extern u8 gAudioSfxSwapMode[10];
extern unk_D_8016E750 D_8016E750[4];
extern AudioContext gAudioContext;
extern ActiveSequence gActiveSeqs[4];
extern AudioContext gAudioCtx;
extern void(*D_801755D0)(void);
extern u32 __osMalloc_FreeBlockTest_Enable;
+2 -1
View File
@@ -27,6 +27,7 @@
#include "z64transition.h"
#include "z64interface.h"
#include "alignment.h"
#include "seqcmd.h"
#include "sequence.h"
#include "sfx.h"
#include "color.h"
@@ -786,7 +787,7 @@ typedef struct {
/* 0x022C */ s16 cursorY[5]; // "cur_ypt"
/* 0x0236 */ s16 dungeonMapSlot;
/* 0x0238 */ s16 cursorSpecialPos; // "key_angle"
/* 0x023A */ s16 pageSwitchTimer;
/* 0x023A */ s16 pageSwitchInputTimer; // Used to introduce a delay before switching page when arriving on the "scroll left/right" positions while holding stick left/right.
/* 0x023C */ u16 namedItem; // "zoom_name"
/* 0x023E */ u16 cursorItem[4]; // "select_name"
/* 0x0246 */ u16 cursorSlot[4];
+2 -40
View File
@@ -7,8 +7,9 @@
#define TATUMS_PER_BEAT 48
#define IS_SEQUENCE_CHANNEL_VALID(ptr) ((u32)(ptr) != (u32)&gAudioContext.sequenceChannelNone)
#define IS_SEQUENCE_CHANNEL_VALID(ptr) ((u32)(ptr) != (u32)&gAudioCtx.sequenceChannelNone)
#define SEQ_NUM_CHANNELS 16
#define SEQ_IO_VAL_NONE -1
#define MAX_CHANNELS_PER_BANK 3
@@ -975,43 +976,4 @@ typedef struct {
/* 0x08 */ u32 permanentPoolSize;
} AudioHeapInitSizes; // size = 0xC
typedef struct {
/* 0x00 */ f32 unk_00;
/* 0x04 */ f32 unk_04;
/* 0x08 */ f32 unk_08;
/* 0x0C */ u16 unk_0C;
/* 0x10 */ f32 unk_10;
/* 0x14 */ f32 unk_14;
/* 0x18 */ f32 unk_18;
/* 0x1C */ u16 unk_1C;
} unk_50_s; // size = 0x20
typedef struct {
/* 0x000 */ f32 volCur;
/* 0x004 */ f32 volTarget;
/* 0x008 */ f32 unk_08;
/* 0x00C */ u16 unk_0C;
/* 0x00E */ u8 volScales[0x4];
/* 0x012 */ u8 volFadeTimer;
/* 0x013 */ u8 fadeVolUpdate;
/* 0x014 */ u32 unk_14;
/* 0x018 */ u16 unk_18;
/* 0x01C */ f32 unk_1C;
/* 0x020 */ f32 unk_20;
/* 0x024 */ f32 unk_24;
/* 0x028 */ u16 unk_28;
/* 0x02C */ u32 unk_2C[8];
/* 0x04C */ u8 unk_4C;
/* 0x04D */ u8 unk_4D;
/* 0x04E */ u8 unk_4E;
/* 0x050 */ unk_50_s unk_50[0x10];
/* 0x250 */ u16 unk_250;
/* 0x252 */ u16 unk_252;
/* 0x254 */ u16 unk_254;
/* 0x256 */ u16 unk_256;
/* 0x258 */ u16 unk_258;
/* 0x25C */ u32 unk_25C;
/* 0x260 */ u8 unk_260;
} unk_D_8016E750; // size = 0x264
#endif
+71 -71
View File
@@ -62,75 +62,75 @@ typedef enum {
} PlayerMask;
typedef enum {
/* 0x00 */ PLAYER_AP_NONE,
/* 0x01 */ PLAYER_AP_LAST_USED,
/* 0x02 */ PLAYER_AP_FISHING_POLE,
/* 0x03 */ PLAYER_AP_SWORD_MASTER,
/* 0x04 */ PLAYER_AP_SWORD_KOKIRI,
/* 0x05 */ PLAYER_AP_SWORD_BGS,
/* 0x06 */ PLAYER_AP_STICK,
/* 0x07 */ PLAYER_AP_HAMMER,
/* 0x08 */ PLAYER_AP_BOW,
/* 0x09 */ PLAYER_AP_BOW_FIRE,
/* 0x0A */ PLAYER_AP_BOW_ICE,
/* 0x0B */ PLAYER_AP_BOW_LIGHT,
/* 0x0C */ PLAYER_AP_BOW_0C,
/* 0x0D */ PLAYER_AP_BOW_0D,
/* 0x0E */ PLAYER_AP_BOW_0E,
/* 0x0F */ PLAYER_AP_SLINGSHOT,
/* 0x10 */ PLAYER_AP_HOOKSHOT,
/* 0x11 */ PLAYER_AP_LONGSHOT,
/* 0x12 */ PLAYER_AP_BOMB,
/* 0x13 */ PLAYER_AP_BOMBCHU,
/* 0x14 */ PLAYER_AP_BOOMERANG,
/* 0x15 */ PLAYER_AP_MAGIC_SPELL_15,
/* 0x16 */ PLAYER_AP_MAGIC_SPELL_16,
/* 0x17 */ PLAYER_AP_MAGIC_SPELL_17,
/* 0x18 */ PLAYER_AP_FARORES_WIND,
/* 0x19 */ PLAYER_AP_NAYRUS_LOVE,
/* 0x1A */ PLAYER_AP_DINS_FIRE,
/* 0x1B */ PLAYER_AP_NUT,
/* 0x1C */ PLAYER_AP_OCARINA_FAIRY,
/* 0x1D */ PLAYER_AP_OCARINA_TIME,
/* 0x1E */ PLAYER_AP_BOTTLE,
/* 0x1F */ PLAYER_AP_BOTTLE_FISH,
/* 0x20 */ PLAYER_AP_BOTTLE_FIRE,
/* 0x21 */ PLAYER_AP_BOTTLE_BUG,
/* 0x22 */ PLAYER_AP_BOTTLE_POE,
/* 0x23 */ PLAYER_AP_BOTTLE_BIG_POE,
/* 0x24 */ PLAYER_AP_BOTTLE_LETTER,
/* 0x25 */ PLAYER_AP_BOTTLE_POTION_RED,
/* 0x26 */ PLAYER_AP_BOTTLE_POTION_BLUE,
/* 0x27 */ PLAYER_AP_BOTTLE_POTION_GREEN,
/* 0x28 */ PLAYER_AP_BOTTLE_MILK,
/* 0x29 */ PLAYER_AP_BOTTLE_MILK_HALF,
/* 0x2A */ PLAYER_AP_BOTTLE_FAIRY,
/* 0x2B */ PLAYER_AP_LETTER_ZELDA,
/* 0x2C */ PLAYER_AP_WEIRD_EGG,
/* 0x2D */ PLAYER_AP_CHICKEN,
/* 0x2E */ PLAYER_AP_BEAN,
/* 0x2F */ PLAYER_AP_POCKET_EGG,
/* 0x30 */ PLAYER_AP_POCKET_CUCCO,
/* 0x31 */ PLAYER_AP_COJIRO,
/* 0x32 */ PLAYER_AP_ODD_MUSHROOM,
/* 0x33 */ PLAYER_AP_ODD_POTION,
/* 0x34 */ PLAYER_AP_SAW,
/* 0x35 */ PLAYER_AP_SWORD_BROKEN,
/* 0x36 */ PLAYER_AP_PRESCRIPTION,
/* 0x37 */ PLAYER_AP_FROG,
/* 0x38 */ PLAYER_AP_EYEDROPS,
/* 0x39 */ PLAYER_AP_CLAIM_CHECK,
/* 0x3A */ PLAYER_AP_MASK_KEATON,
/* 0x3B */ PLAYER_AP_MASK_SKULL,
/* 0x3C */ PLAYER_AP_MASK_SPOOKY,
/* 0x3D */ PLAYER_AP_MASK_BUNNY,
/* 0x3E */ PLAYER_AP_MASK_GORON,
/* 0x3F */ PLAYER_AP_MASK_ZORA,
/* 0x40 */ PLAYER_AP_MASK_GERUDO,
/* 0x41 */ PLAYER_AP_MASK_TRUTH,
/* 0x42 */ PLAYER_AP_LENS,
/* 0x43 */ PLAYER_AP_MAX
} PlayerActionParam;
/* 0x00 */ PLAYER_IA_NONE,
/* 0x01 */ PLAYER_IA_LAST_USED,
/* 0x02 */ PLAYER_IA_FISHING_POLE,
/* 0x03 */ PLAYER_IA_SWORD_MASTER,
/* 0x04 */ PLAYER_IA_SWORD_KOKIRI,
/* 0x05 */ PLAYER_IA_SWORD_BGS,
/* 0x06 */ PLAYER_IA_STICK,
/* 0x07 */ PLAYER_IA_HAMMER,
/* 0x08 */ PLAYER_IA_BOW,
/* 0x09 */ PLAYER_IA_BOW_FIRE,
/* 0x0A */ PLAYER_IA_BOW_ICE,
/* 0x0B */ PLAYER_IA_BOW_LIGHT,
/* 0x0C */ PLAYER_IA_BOW_0C,
/* 0x0D */ PLAYER_IA_BOW_0D,
/* 0x0E */ PLAYER_IA_BOW_0E,
/* 0x0F */ PLAYER_IA_SLINGSHOT,
/* 0x10 */ PLAYER_IA_HOOKSHOT,
/* 0x11 */ PLAYER_IA_LONGSHOT,
/* 0x12 */ PLAYER_IA_BOMB,
/* 0x13 */ PLAYER_IA_BOMBCHU,
/* 0x14 */ PLAYER_IA_BOOMERANG,
/* 0x15 */ PLAYER_IA_MAGIC_SPELL_15,
/* 0x16 */ PLAYER_IA_MAGIC_SPELL_16,
/* 0x17 */ PLAYER_IA_MAGIC_SPELL_17,
/* 0x18 */ PLAYER_IA_FARORES_WIND,
/* 0x19 */ PLAYER_IA_NAYRUS_LOVE,
/* 0x1A */ PLAYER_IA_DINS_FIRE,
/* 0x1B */ PLAYER_IA_NUT,
/* 0x1C */ PLAYER_IA_OCARINA_FAIRY,
/* 0x1D */ PLAYER_IA_OCARINA_TIME,
/* 0x1E */ PLAYER_IA_BOTTLE,
/* 0x1F */ PLAYER_IA_BOTTLE_FISH,
/* 0x20 */ PLAYER_IA_BOTTLE_FIRE,
/* 0x21 */ PLAYER_IA_BOTTLE_BUG,
/* 0x22 */ PLAYER_IA_BOTTLE_POE,
/* 0x23 */ PLAYER_IA_BOTTLE_BIG_POE,
/* 0x24 */ PLAYER_IA_BOTTLE_LETTER,
/* 0x25 */ PLAYER_IA_BOTTLE_POTION_RED,
/* 0x26 */ PLAYER_IA_BOTTLE_POTION_BLUE,
/* 0x27 */ PLAYER_IA_BOTTLE_POTION_GREEN,
/* 0x28 */ PLAYER_IA_BOTTLE_MILK,
/* 0x29 */ PLAYER_IA_BOTTLE_MILK_HALF,
/* 0x2A */ PLAYER_IA_BOTTLE_FAIRY,
/* 0x2B */ PLAYER_IA_LETTER_ZELDA,
/* 0x2C */ PLAYER_IA_WEIRD_EGG,
/* 0x2D */ PLAYER_IA_CHICKEN,
/* 0x2E */ PLAYER_IA_BEAN,
/* 0x2F */ PLAYER_IA_POCKET_EGG,
/* 0x30 */ PLAYER_IA_POCKET_CUCCO,
/* 0x31 */ PLAYER_IA_COJIRO,
/* 0x32 */ PLAYER_IA_ODD_MUSHROOM,
/* 0x33 */ PLAYER_IA_ODD_POTION,
/* 0x34 */ PLAYER_IA_SAW,
/* 0x35 */ PLAYER_IA_SWORD_BROKEN,
/* 0x36 */ PLAYER_IA_PRESCRIPTION,
/* 0x37 */ PLAYER_IA_FROG,
/* 0x38 */ PLAYER_IA_EYEDROPS,
/* 0x39 */ PLAYER_IA_CLAIM_CHECK,
/* 0x3A */ PLAYER_IA_MASK_KEATON,
/* 0x3B */ PLAYER_IA_MASK_SKULL,
/* 0x3C */ PLAYER_IA_MASK_SPOOKY,
/* 0x3D */ PLAYER_IA_MASK_BUNNY,
/* 0x3E */ PLAYER_IA_MASK_GORON,
/* 0x3F */ PLAYER_IA_MASK_ZORA,
/* 0x40 */ PLAYER_IA_MASK_GERUDO,
/* 0x41 */ PLAYER_IA_MASK_TRUTH,
/* 0x42 */ PLAYER_IA_LENS,
/* 0x43 */ PLAYER_IA_MAX
} PlayerItemAction;
typedef enum {
/* 0x00 */ PLAYER_LIMB_NONE,
@@ -469,10 +469,10 @@ typedef struct Player {
/* 0x014E */ s8 currentShield; // current shield from `PlayerShield`
/* 0x014F */ s8 currentBoots; // current boots from `PlayerBoots`
/* 0x0150 */ s8 heldItemButton; // Button index for the item currently used
/* 0x0151 */ s8 heldItemActionParam; // Action param for the item currently used
/* 0x0151 */ s8 heldItemAction; // Item action for the item currently used
/* 0x0152 */ u8 heldItemId; // Item id for the item currently used
/* 0x0153 */ s8 prevBoots; // previous boots from `PlayerBoots`
/* 0x0154 */ s8 itemActionParam; // the difference between this and heldItemActionParam is unclear
/* 0x0154 */ s8 itemAction; // the difference between this and heldItemAction is unclear
/* 0x0155 */ char unk_155[0x003];
/* 0x0158 */ u8 modelGroup;
/* 0x0159 */ u8 nextModelGroup;
+1 -1
View File
@@ -4124,7 +4124,7 @@ beginseg
name "object_mori_tex"
romalign 0x1000
include "build/assets/objects/object_mori_tex/object_mori_tex.o"
number 6
number 8
endseg
beginseg
+2 -2
View File
@@ -124,7 +124,7 @@ f32 Audio_GetVibratoFreqScale(VibratoState* vib) {
return 1.0f;
}
//! @bug this probably meant to compare with gAudioContext.sequenceChannelNone.
//! @bug this probably meant to compare with gAudioCtx.sequenceChannelNone.
//! -1 isn't used as a channel pointer anywhere else.
if (channel != ((SequenceChannel*)(-1))) {
if (vib->extentChangeTimer) {
@@ -264,7 +264,7 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) {
break;
default:
adsr->delay *= gAudioContext.audioBufferParameters.updatesPerFrameScaled;
adsr->delay *= gAudioCtx.audioBufferParameters.updatesPerFrameScaled;
if (adsr->delay == 0) {
adsr->delay = 1;
}
+4 -4
View File
@@ -52,10 +52,10 @@ u8 D_801333F8 = 0;
s32 D_801333FC = 0; // unused
u8 gSeqCmdWrPos = 0;
u8 gSeqCmdRdPos = 0;
u8 D_80133408 = 0;
u8 D_8013340C = 1;
u8 gSeqCmdWritePos = 0;
u8 gSeqCmdReadPos = 0;
u8 gStartSeqDisabled = false;
u8 gAudioDebugPrintSeqCmd = true;
u8 gSoundModeList[] = {
SOUNDMODE_STEREO,
+262 -269
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -1,7 +1,7 @@
#include "global.h"
u8 D_8016F0E0[0xA0]; // unused
AudioContext gAudioContext;
AudioContext gAudioCtx;
void (*D_801755D0)(void);
s32 D_801755D8[3]; // unused
@@ -17,7 +17,7 @@ const s16 D_8014A6C0[] = {
#define SFX_SOUNDFONT_2_SIZE 0x17B0
// Sizes of everything on the init pool
#define AI_BUFFERS_SIZE (AIBUF_SIZE * ARRAY_COUNT(gAudioContext.aiBuffers))
#define AI_BUFFERS_SIZE (AIBUF_SIZE * ARRAY_COUNT(gAudioCtx.aiBuffers))
#define SOUNDFONT_LIST_SIZE (NUM_SOUNDFONTS * sizeof(SoundFont))
#define PERMANENT_POOL_SIZE (SFX_SEQ_SIZE + SFX_SOUNDFONT_1_SIZE + SFX_SOUNDFONT_2_SIZE)
+265 -272
View File
File diff suppressed because it is too large Load Diff
+58 -58
View File
@@ -31,7 +31,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
sub->bitField0.stereoStrongLeft = false;
sub->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects;
sub->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects;
if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_HEADSET)) {
if (stereoHeadsetEffects && (gAudioCtx.soundMode == SOUNDMODE_HEADSET)) {
halfPanIndex = pan >> 1;
if (halfPanIndex > 0x3F) {
halfPanIndex = 0x3F;
@@ -43,7 +43,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
volLeft = gHeadsetPanVolume[pan];
volRight = gHeadsetPanVolume[0x7F - pan];
} else if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_STEREO)) {
} else if (stereoHeadsetEffects && (gAudioCtx.soundMode == SOUNDMODE_STEREO)) {
strongLeft = strongRight = 0;
sub->haasEffectLeftDelaySize = 0;
sub->haasEffectRightDelaySize = 0;
@@ -80,7 +80,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
break;
}
} else if (gAudioContext.soundMode == SOUNDMODE_MONO) {
} else if (gAudioCtx.soundMode == SOUNDMODE_MONO) {
sub->bitField0.stereoHeadsetEffects = false;
sub->bitField0.usesHeadsetPanEffects = false;
volLeft = 0.707f; // approx 1/sqrt(2)
@@ -163,9 +163,9 @@ void Audio_ProcessNotes(void) {
f32 scale;
s32 i;
for (i = 0; i < gAudioContext.numNotes; i++) {
note = &gAudioContext.notes[i];
noteSubEu2 = &gAudioContext.noteSubsEu[gAudioContext.noteSubEuOffset + i];
for (i = 0; i < gAudioCtx.numNotes; i++) {
note = &gAudioCtx.notes[i];
noteSubEu2 = &gAudioCtx.noteSubsEu[gAudioCtx.noteSubEuOffset + i];
playbackState = &note->playbackState;
if (playbackState->parentLayer != NO_LAYER) {
if ((u32)playbackState->parentLayer < 0x7FFFFFFF) {
@@ -174,7 +174,7 @@ void Audio_ProcessNotes(void) {
if (note != playbackState->parentLayer->note && playbackState->unk_04 == 0) {
playbackState->adsr.action.s.release = true;
playbackState->adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
playbackState->adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
playbackState->priority = 1;
playbackState->unk_04 = 2;
goto out;
@@ -285,7 +285,7 @@ void Audio_ProcessNotes(void) {
}
subAttrs.frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale;
subAttrs.frequency *= gAudioContext.audioBufferParameters.resampleRate;
subAttrs.frequency *= gAudioCtx.audioBufferParameters.resampleRate;
subAttrs.velocity *= scale;
Audio_InitNoteSub(note, noteSubEu2, &subAttrs);
noteSubEu->bitField1.bookOffset = bookOffset;
@@ -315,18 +315,18 @@ Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
}
if (!AudioLoad_IsFontLoadComplete(fontId)) {
gAudioContext.audioErrorFlags = fontId + 0x10000000;
gAudioCtx.audioErrorFlags = fontId + 0x10000000;
return NULL;
}
if (instId >= gAudioContext.soundFontList[fontId].numInstruments) {
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x3000000;
if (instId >= gAudioCtx.soundFontList[fontId].numInstruments) {
gAudioCtx.audioErrorFlags = ((fontId << 8) + instId) + 0x3000000;
return NULL;
}
inst = gAudioContext.soundFontList[fontId].instruments[instId];
inst = gAudioCtx.soundFontList[fontId].instruments[instId];
if (inst == NULL) {
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
gAudioCtx.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
return inst;
}
@@ -341,21 +341,21 @@ Drum* Audio_GetDrum(s32 fontId, s32 drumId) {
}
if (!AudioLoad_IsFontLoadComplete(fontId)) {
gAudioContext.audioErrorFlags = fontId + 0x10000000;
gAudioCtx.audioErrorFlags = fontId + 0x10000000;
return NULL;
}
if (drumId >= gAudioContext.soundFontList[fontId].numDrums) {
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000;
if (drumId >= gAudioCtx.soundFontList[fontId].numDrums) {
gAudioCtx.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000;
return NULL;
}
if ((u32)gAudioContext.soundFontList[fontId].drums < AUDIO_RELOCATED_ADDRESS_START) {
if ((u32)gAudioCtx.soundFontList[fontId].drums < AUDIO_RELOCATED_ADDRESS_START) {
return NULL;
}
drum = gAudioContext.soundFontList[fontId].drums[drumId];
drum = gAudioCtx.soundFontList[fontId].drums[drumId];
if (drum == NULL) {
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x5000000;
gAudioCtx.audioErrorFlags = ((fontId << 8) + drumId) + 0x5000000;
}
return drum;
@@ -369,23 +369,23 @@ SoundEffect* Audio_GetSoundEffect(s32 fontId, s32 sfxId) {
}
if (!AudioLoad_IsFontLoadComplete(fontId)) {
gAudioContext.audioErrorFlags = fontId + 0x10000000;
gAudioCtx.audioErrorFlags = fontId + 0x10000000;
return NULL;
}
if (sfxId >= gAudioContext.soundFontList[fontId].numSfx) {
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x4000000;
if (sfxId >= gAudioCtx.soundFontList[fontId].numSfx) {
gAudioCtx.audioErrorFlags = ((fontId << 8) + sfxId) + 0x4000000;
return NULL;
}
if ((u32)gAudioContext.soundFontList[fontId].soundEffects < AUDIO_RELOCATED_ADDRESS_START) {
if ((u32)gAudioCtx.soundFontList[fontId].soundEffects < AUDIO_RELOCATED_ADDRESS_START) {
return NULL;
}
soundEffect = &gAudioContext.soundFontList[fontId].soundEffects[sfxId];
soundEffect = &gAudioCtx.soundFontList[fontId].soundEffects[sfxId];
if (soundEffect == NULL) {
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x5000000;
gAudioCtx.audioErrorFlags = ((fontId << 8) + sfxId) + 0x5000000;
}
if (soundEffect->tunedSample.sample == NULL) {
@@ -406,24 +406,24 @@ s32 Audio_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, void* val
switch (instrumentType) {
case 0:
if (index >= gAudioContext.soundFontList[fontId].numDrums) {
if (index >= gAudioCtx.soundFontList[fontId].numDrums) {
return -3;
}
gAudioContext.soundFontList[fontId].drums[index] = value;
gAudioCtx.soundFontList[fontId].drums[index] = value;
break;
case 1:
if (index >= gAudioContext.soundFontList[fontId].numSfx) {
if (index >= gAudioCtx.soundFontList[fontId].numSfx) {
return -3;
}
gAudioContext.soundFontList[fontId].soundEffects[index] = *(SoundEffect*)value;
gAudioCtx.soundFontList[fontId].soundEffects[index] = *(SoundEffect*)value;
break;
default:
if (index >= gAudioContext.soundFontList[fontId].numInstruments) {
if (index >= gAudioCtx.soundFontList[fontId].numInstruments) {
return -3;
}
gAudioContext.soundFontList[fontId].instruments[index] = value;
gAudioCtx.soundFontList[fontId].instruments[index] = value;
break;
}
@@ -456,7 +456,7 @@ void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
if (note->playbackState.parentLayer != layer) {
if (note->playbackState.parentLayer == NO_LAYER && note->playbackState.wantedParentLayer == NO_LAYER &&
note->playbackState.prevParentLayer == layer && target != ADSR_STATE_DECAY) {
note->playbackState.adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.action.s.release = true;
}
return;
@@ -500,16 +500,16 @@ void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
note->playbackState.prevParentLayer = note->playbackState.parentLayer;
note->playbackState.parentLayer = NO_LAYER;
if (target == ADSR_STATE_RELEASE) {
note->playbackState.adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.action.s.release = true;
note->playbackState.unk_04 = 2;
} else {
note->playbackState.unk_04 = 1;
note->playbackState.adsr.action.s.decay = true;
if (layer->adsr.decayIndex == 0) {
note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->channel->adsr.decayIndex];
note->playbackState.adsr.fadeOutVel = gAudioCtx.adsrDecayTable[layer->channel->adsr.decayIndex];
} else {
note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->adsr.decayIndex];
note->playbackState.adsr.fadeOutVel = gAudioCtx.adsrDecayTable[layer->adsr.decayIndex];
}
note->playbackState.adsr.sustain =
((f32)(s32)(layer->channel->adsr.sustain) * note->playbackState.adsr.current) / 256.0f;
@@ -616,11 +616,11 @@ void Audio_InitNoteLists(NotePool* pool) {
void Audio_InitNoteFreeList(void) {
s32 i;
Audio_InitNoteLists(&gAudioContext.noteFreeLists);
for (i = 0; i < gAudioContext.numNotes; i++) {
gAudioContext.notes[i].listItem.u.value = &gAudioContext.notes[i];
gAudioContext.notes[i].listItem.prev = NULL;
AudioSeq_AudioListPushBack(&gAudioContext.noteFreeLists.disabled, &gAudioContext.notes[i].listItem);
Audio_InitNoteLists(&gAudioCtx.noteFreeLists);
for (i = 0; i < gAudioCtx.numNotes; i++) {
gAudioCtx.notes[i].listItem.u.value = &gAudioCtx.notes[i];
gAudioCtx.notes[i].listItem.prev = NULL;
AudioSeq_AudioListPushBack(&gAudioCtx.noteFreeLists.disabled, &gAudioCtx.notes[i].listItem);
}
}
@@ -634,22 +634,22 @@ void Audio_NotePoolClear(NotePool* pool) {
switch (i) {
case 0:
source = &pool->disabled;
dest = &gAudioContext.noteFreeLists.disabled;
dest = &gAudioCtx.noteFreeLists.disabled;
break;
case 1:
source = &pool->decaying;
dest = &gAudioContext.noteFreeLists.decaying;
dest = &gAudioCtx.noteFreeLists.decaying;
break;
case 2:
source = &pool->releasing;
dest = &gAudioContext.noteFreeLists.releasing;
dest = &gAudioCtx.noteFreeLists.releasing;
break;
case 3:
source = &pool->active;
dest = &gAudioContext.noteFreeLists.active;
dest = &gAudioCtx.noteFreeLists.active;
break;
}
@@ -680,22 +680,22 @@ void Audio_NotePoolFill(NotePool* pool, s32 count) {
switch (i) {
case 0:
source = &gAudioContext.noteFreeLists.disabled;
source = &gAudioCtx.noteFreeLists.disabled;
dest = &pool->disabled;
break;
case 1:
source = &gAudioContext.noteFreeLists.decaying;
source = &gAudioCtx.noteFreeLists.decaying;
dest = &pool->decaying;
break;
case 2:
source = &gAudioContext.noteFreeLists.releasing;
source = &gAudioCtx.noteFreeLists.releasing;
dest = &pool->releasing;
break;
case 3:
source = &gAudioContext.noteFreeLists.active;
source = &gAudioCtx.noteFreeLists.active;
dest = &pool->active;
break;
}
@@ -805,7 +805,7 @@ void Audio_NoteReleaseAndTakeOwnership(Note* note, SequenceLayer* layer) {
note->playbackState.wantedParentLayer = layer;
note->playbackState.priority = layer->channel->notePriority;
note->playbackState.adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.action.s.release = true;
}
@@ -899,9 +899,9 @@ Note* Audio_AllocNote(SequenceLayer* layer) {
}
if (policy & 8) {
if (!(note = Audio_AllocNoteFromDisabled(&gAudioContext.noteFreeLists, layer)) &&
!(note = Audio_AllocNoteFromDecaying(&gAudioContext.noteFreeLists, layer)) &&
!(note = Audio_AllocNoteFromActive(&gAudioContext.noteFreeLists, layer))) {
if (!(note = Audio_AllocNoteFromDisabled(&gAudioCtx.noteFreeLists, layer)) &&
!(note = Audio_AllocNoteFromDecaying(&gAudioCtx.noteFreeLists, layer)) &&
!(note = Audio_AllocNoteFromActive(&gAudioCtx.noteFreeLists, layer))) {
goto null_return;
}
return note;
@@ -909,13 +909,13 @@ Note* Audio_AllocNote(SequenceLayer* layer) {
if (!(note = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) &&
!(note = Audio_AllocNoteFromDisabled(&layer->channel->seqPlayer->notePool, layer)) &&
!(note = Audio_AllocNoteFromDisabled(&gAudioContext.noteFreeLists, layer)) &&
!(note = Audio_AllocNoteFromDisabled(&gAudioCtx.noteFreeLists, layer)) &&
!(note = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) &&
!(note = Audio_AllocNoteFromDecaying(&layer->channel->seqPlayer->notePool, layer)) &&
!(note = Audio_AllocNoteFromDecaying(&gAudioContext.noteFreeLists, layer)) &&
!(note = Audio_AllocNoteFromDecaying(&gAudioCtx.noteFreeLists, layer)) &&
!(note = Audio_AllocNoteFromActive(&layer->channel->notePool, layer)) &&
!(note = Audio_AllocNoteFromActive(&layer->channel->seqPlayer->notePool, layer)) &&
!(note = Audio_AllocNoteFromActive(&gAudioContext.noteFreeLists, layer))) {
!(note = Audio_AllocNoteFromActive(&gAudioCtx.noteFreeLists, layer))) {
goto null_return;
}
return note;
@@ -929,8 +929,8 @@ void Audio_NoteInitAll(void) {
Note* note;
s32 i;
for (i = 0; i < gAudioContext.numNotes; i++) {
note = &gAudioContext.notes[i];
for (i = 0; i < gAudioCtx.numNotes; i++) {
note = &gAudioCtx.notes[i];
note->noteSubEu = gZeroNoteSub;
note->playbackState.priority = 0;
note->playbackState.unk_04 = 0;
@@ -947,6 +947,6 @@ void Audio_NoteInitAll(void) {
note->playbackState.stereoHeadsetEffects = false;
note->startSamplePos = 0;
note->synthesisState.synthesisBuffers =
AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, sizeof(NoteSynthesisBuffers));
AudioHeap_AllocDmaMemory(&gAudioCtx.miscPool, sizeof(NoteSynthesisBuffers));
}
}
+58 -59
View File
@@ -252,7 +252,7 @@ s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState*
void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
s32 i;
if (channel == &gAudioContext.sequenceChannelNone) {
if (channel == &gAudioCtx.sequenceChannelNone) {
return;
}
@@ -297,7 +297,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;
@@ -309,7 +309,7 @@ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) {
s32 pad;
if (channel->layers[layerIndex] == NULL) {
layer = AudioSeq_AudioListPopBack(&gAudioContext.layerFreeList);
layer = AudioSeq_AudioListPopBack(&gAudioCtx.layerFreeList);
channel->layers[layerIndex] = layer;
if (layer == NULL) {
channel->layers[layerIndex] = NULL;
@@ -353,7 +353,7 @@ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) {
void AudioSeq_SeqLayerDisable(SequenceLayer* layer) {
if (layer != NULL) {
if (layer->channel != &gAudioContext.sequenceChannelNone && layer->channel->seqPlayer->finished == 1) {
if (layer->channel != &gAudioCtx.sequenceChannelNone && layer->channel->seqPlayer->finished == 1) {
Audio_SeqLayerNoteRelease(layer);
} else {
Audio_SeqLayerNoteDecay(layer);
@@ -367,7 +367,7 @@ void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) {
SequenceLayer* layer = channel->layers[layerIndex];
if (layer != NULL) {
AudioSeq_AudioListPushBack(&gAudioContext.layerFreeList, &layer->listItem);
AudioSeq_AudioListPushBack(&gAudioCtx.layerFreeList, &layer->listItem);
AudioSeq_SeqLayerDisable(layer);
channel->layers[layerIndex] = NULL;
}
@@ -452,10 +452,10 @@ void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) {
AudioLoad_SetFontLoadStatus(seqPlayer->defaultFont, LOAD_STATUS_MAYBE_DISCARDABLE);
}
if (seqPlayer->defaultFont == gAudioContext.fontCache.temporary.entries[0].id) {
gAudioContext.fontCache.temporary.nextSide = 0;
} else if (seqPlayer->defaultFont == gAudioContext.fontCache.temporary.entries[1].id) {
gAudioContext.fontCache.temporary.nextSide = 1;
if (seqPlayer->defaultFont == gAudioCtx.fontCache.temporary.entries[0].id) {
gAudioCtx.fontCache.temporary.nextSide = 0;
} else if (seqPlayer->defaultFont == gAudioCtx.fontCache.temporary.entries[1].id) {
gAudioCtx.fontCache.temporary.nextSide = 1;
}
}
@@ -488,15 +488,15 @@ void* AudioSeq_AudioListPopBack(AudioListItem* list) {
void AudioSeq_InitLayerFreelist(void) {
s32 i;
gAudioContext.layerFreeList.prev = &gAudioContext.layerFreeList;
gAudioContext.layerFreeList.next = &gAudioContext.layerFreeList;
gAudioContext.layerFreeList.u.count = 0;
gAudioContext.layerFreeList.pool = NULL;
gAudioCtx.layerFreeList.prev = &gAudioCtx.layerFreeList;
gAudioCtx.layerFreeList.next = &gAudioCtx.layerFreeList;
gAudioCtx.layerFreeList.u.count = 0;
gAudioCtx.layerFreeList.pool = NULL;
for (i = 0; i < ARRAY_COUNT(gAudioContext.sequenceLayers); i++) {
gAudioContext.sequenceLayers[i].listItem.u.value = &gAudioContext.sequenceLayers[i];
gAudioContext.sequenceLayers[i].listItem.prev = NULL;
AudioSeq_AudioListPushBack(&gAudioContext.layerFreeList, &gAudioContext.sequenceLayers[i].listItem);
for (i = 0; i < ARRAY_COUNT(gAudioCtx.sequenceLayers); i++) {
gAudioCtx.sequenceLayers[i].listItem.u.value = &gAudioCtx.sequenceLayers[i];
gAudioCtx.sequenceLayers[i].listItem.prev = NULL;
AudioSeq_AudioListPushBack(&gAudioCtx.layerFreeList, &gAudioCtx.sequenceLayers[i].listItem);
}
}
@@ -873,7 +873,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
layer->tunedSample = NULL;
tuning = 1.0f;
if (instOrWave >= 0xC0) {
layer->tunedSample = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].tunedSample;
layer->tunedSample = &gAudioCtx.synthesisReverbs[instOrWave - 0xC0].tunedSample;
}
}
@@ -903,12 +903,12 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
portamento->extent = (freqScale2 / freqScale) - 1.0f;
if (PORTAMENTO_IS_SPECIAL(*portamento)) {
speed = seqPlayer->tempo * 0x8000 / gAudioContext.tempoInternalToExternal;
speed = seqPlayer->tempo * 0x8000 / gAudioCtx.tempoInternalToExternal;
if (layer->delay != 0) {
speed = speed * 0x100 / (layer->delay * layer->portamentoTime);
}
} else {
speed = 0x20000 / (layer->portamentoTime * gAudioContext.audioBufferParameters.updatesPerFrame);
speed = 0x20000 / (layer->portamentoTime * gAudioCtx.audioBufferParameters.updatesPerFrame);
}
if (speed >= 0x7FFF) {
@@ -935,7 +935,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
layer->tunedSample = NULL;
layer->freqScale = gPitchFrequencies[semitone2];
if (instOrWave >= 0xC0) {
layer->tunedSample = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].tunedSample;
layer->tunedSample = &gAudioCtx.synthesisReverbs[instOrWave - 0xC0].tunedSample;
}
}
break;
@@ -951,7 +951,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
time = 0.0f;
}
time *= seqPlayer->tempo;
time *= gAudioContext.unk_2870;
time *= gAudioCtx.unk_2870;
time /= layer->freqScale;
if (time > 0x7FFE) {
time = 0x7FFE;
@@ -964,7 +964,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
// (It's a bit unclear if 'portamento' has actually always been
// set when this is reached...)
if (PORTAMENTO_IS_SPECIAL(*portamento)) {
speed2 = seqPlayer->tempo * 0x8000 / gAudioContext.tempoInternalToExternal;
speed2 = seqPlayer->tempo * 0x8000 / gAudioCtx.tempoInternalToExternal;
speed2 = speed2 * 0x100 / (layer->delay * layer->portamentoTime);
if (speed2 >= 0x7FFF) {
speed2 = 0x7FFF;
@@ -1043,8 +1043,8 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
}
if (channel->velocityRandomVariance != 0) {
floatDelta = layer->velocitySquare * (gAudioContext.audioRandom % channel->velocityRandomVariance) / 100.0f;
if ((gAudioContext.audioRandom & 0x8000) != 0) {
floatDelta = layer->velocitySquare * (gAudioCtx.audioRandom % channel->velocityRandomVariance) / 100.0f;
if ((gAudioCtx.audioRandom & 0x8000) != 0) {
floatDelta = -floatDelta;
}
@@ -1064,8 +1064,8 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
if (channel->gateTimeRandomVariance != 0) {
//! @bug should probably be gateTimeRandomVariance
intDelta = (layer->gateDelay * (gAudioContext.audioRandom % channel->velocityRandomVariance)) / 100;
if ((gAudioContext.audioRandom & 0x4000) != 0) {
intDelta = (layer->gateDelay * (gAudioCtx.audioRandom % channel->velocityRandomVariance)) / 100;
if ((gAudioCtx.audioRandom & 0x4000) != 0) {
intDelta = -intDelta;
}
@@ -1244,9 +1244,9 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
cmd = (u8)cmdArgs[0];
if (seqPlayer->defaultFont != 0xFF) {
cmdArgU16 = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
lowBits = gAudioContext.sequenceFontTable[cmdArgU16];
cmd = gAudioContext.sequenceFontTable[cmdArgU16 + lowBits - cmd];
cmdArgU16 = ((u16*)gAudioCtx.sequenceFontTable)[seqPlayer->seqId];
lowBits = gAudioCtx.sequenceFontTable[cmdArgU16];
cmd = gAudioCtx.sequenceFontTable[cmdArgU16 + lowBits - cmd];
}
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, cmd)) {
@@ -1373,9 +1373,9 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
cmd = (u8)cmdArgs[0];
if (seqPlayer->defaultFont != 0xFF) {
cmdArgU16 = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
lowBits = gAudioContext.sequenceFontTable[cmdArgU16];
cmd = gAudioContext.sequenceFontTable[cmdArgU16 + lowBits - cmd];
cmdArgU16 = ((u16*)gAudioCtx.sequenceFontTable)[seqPlayer->seqId];
lowBits = gAudioCtx.sequenceFontTable[cmdArgU16];
cmd = gAudioCtx.sequenceFontTable[cmdArgU16 + lowBits - cmd];
}
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, cmd)) {
@@ -1569,12 +1569,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0xB7:
channel->unk_22 =
(cmdArgs[0] == 0) ? gAudioContext.audioRandom & 0xFFFF : gAudioContext.audioRandom % cmdArgs[0];
(cmdArgs[0] == 0) ? gAudioCtx.audioRandom & 0xFFFF : gAudioCtx.audioRandom % cmdArgs[0];
break;
case 0xB8:
scriptState->value =
(cmdArgs[0] == 0) ? gAudioContext.audioRandom & 0xFFFF : gAudioContext.audioRandom % cmdArgs[0];
(cmdArgs[0] == 0) ? gAudioCtx.audioRandom & 0xFFFF : gAudioCtx.audioRandom % cmdArgs[0];
break;
case 0xBD:
@@ -1664,12 +1664,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0x10:
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) {}
}
@@ -1678,7 +1678,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0x60:
scriptState->value = channel->soundScriptIO[lowBits];
if (lowBits < 2) {
channel->soundScriptIO[lowBits] = -1;
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
}
break;
@@ -1746,11 +1746,11 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
seqPlayer->tempoAcc += seqPlayer->tempo;
seqPlayer->tempoAcc += (s16)seqPlayer->unk_0C;
if (seqPlayer->tempoAcc < gAudioContext.tempoInternalToExternal) {
if (seqPlayer->tempoAcc < gAudioCtx.tempoInternalToExternal) {
return;
}
seqPlayer->tempoAcc -= (u16)gAudioContext.tempoInternalToExternal;
seqPlayer->tempoAcc -= (u16)gAudioCtx.tempoInternalToExternal;
if (seqPlayer->stopScript == true) {
return;
@@ -1811,8 +1811,8 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
case 0xDD:
seqPlayer->tempo = AudioSeq_ScriptReadU8(seqScript) * TATUMS_PER_BEAT;
if (seqPlayer->tempo > gAudioContext.tempoInternalToExternal) {
seqPlayer->tempo = (u16)gAudioContext.tempoInternalToExternal;
if (seqPlayer->tempo > gAudioCtx.tempoInternalToExternal) {
seqPlayer->tempo = (u16)gAudioCtx.tempoInternalToExternal;
}
if ((s16)seqPlayer->tempo <= 0) {
@@ -1909,9 +1909,9 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
case 0xCE:
cmd = AudioSeq_ScriptReadU8(seqScript);
if (cmd == 0) {
seqScript->value = (gAudioContext.audioRandom >> 2) & 0xFF;
seqScript->value = (gAudioCtx.audioRandom >> 2) & 0xFF;
} else {
seqScript->value = (gAudioContext.audioRandom >> 2) % cmd;
seqScript->value = (gAudioCtx.audioRandom >> 2) % cmd;
}
break;
@@ -1992,7 +1992,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
case 0x80:
seqScript->value = seqPlayer->soundScriptIO[cmdLowBits];
if (cmdLowBits < 2) {
seqPlayer->soundScriptIO[cmdLowBits] = -1;
seqPlayer->soundScriptIO[cmdLowBits] = SEQ_IO_VAL_NONE;
}
break;
@@ -2038,11 +2038,10 @@ void AudioSeq_ProcessSequences(s32 arg0) {
SequencePlayer* seqPlayer;
u32 i;
gAudioContext.noteSubEuOffset =
(gAudioContext.audioBufferParameters.updatesPerFrame - arg0 - 1) * gAudioContext.numNotes;
gAudioCtx.noteSubEuOffset = (gAudioCtx.audioBufferParameters.updatesPerFrame - arg0 - 1) * gAudioCtx.numNotes;
for (i = 0; i < (u32)gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
seqPlayer = &gAudioContext.seqPlayers[i];
for (i = 0; i < (u32)gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
seqPlayer = &gAudioCtx.seqPlayers[i];
if (seqPlayer->enabled == true) {
AudioSeq_SequencePlayerProcessSequence(seqPlayer);
Audio_SequencePlayerProcessSound(seqPlayer);
@@ -2089,14 +2088,14 @@ void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) {
void AudioSeq_InitSequencePlayerChannels(s32 playerIdx) {
SequenceChannel* channel;
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx];
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
s32 i;
s32 j;
for (i = 0; i < SEQ_NUM_CHANNELS; i++) {
seqPlayer->channels[i] = AudioHeap_AllocZeroed(&gAudioContext.miscPool, sizeof(SequenceChannel));
seqPlayer->channels[i] = AudioHeap_AllocZeroed(&gAudioCtx.miscPool, sizeof(SequenceChannel));
if (seqPlayer->channels[i] == NULL) {
seqPlayer->channels[i] = &gAudioContext.sequenceChannelNone;
seqPlayer->channels[i] = &gAudioCtx.sequenceChannelNone;
} else {
channel = seqPlayer->channels[i];
channel->seqPlayer = seqPlayer;
@@ -2114,7 +2113,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) {
s32 j;
for (i = 0; i < SEQ_NUM_CHANNELS; i++) {
seqPlayer->channels[i] = &gAudioContext.sequenceChannelNone;
seqPlayer->channels[i] = &gAudioCtx.sequenceChannelNone;
}
seqPlayer->enabled = false;
@@ -2124,7 +2123,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->muteBehavior = MUTE_BEHAVIOR_SOFTEN | MUTE_BEHAVIOR_STOP_NOTES;
@@ -2139,12 +2138,12 @@ void AudioSeq_InitSequencePlayers(void) {
AudioSeq_InitLayerFreelist();
for (i = 0; i < ARRAY_COUNT(gAudioContext.sequenceLayers); i++) {
gAudioContext.sequenceLayers[i].channel = NULL;
gAudioContext.sequenceLayers[i].enabled = false;
for (i = 0; i < ARRAY_COUNT(gAudioCtx.sequenceLayers); i++) {
gAudioCtx.sequenceLayers[i].channel = NULL;
gAudioCtx.sequenceLayers[i].enabled = false;
}
for (i = 0; i < ARRAY_COUNT(gAudioContext.seqPlayers); i++) {
AudioSeq_InitSequencePlayer(&gAudioContext.seqPlayers[i]);
for (i = 0; i < ARRAY_COUNT(gAudioCtx.seqPlayers); i++) {
AudioSeq_InitSequencePlayer(&gAudioCtx.seqPlayers[i]);
}
}
+49 -50
View File
@@ -61,7 +61,7 @@ u8 sNumSamplesPerWavePeriod[] = {
void AudioSynth_InitNextRingBuf(s32 chunkLen, s32 updateIndex, s32 reverbIndex) {
ReverbRingBufferItem* bufItem;
s32 pad[3];
SynthesisReverb* reverb = &gAudioContext.synthesisReverbs[reverbIndex];
SynthesisReverb* reverb = &gAudioCtx.synthesisReverbs[reverbIndex];
s32 temp_a0_2;
s32 temp_a0_4;
s32 numSamples;
@@ -135,10 +135,10 @@ void func_800DB03C(s32 updateIndex) {
s32 baseIndex;
s32 i;
baseIndex = gAudioContext.numNotes * updateIndex;
for (i = 0; i < gAudioContext.numNotes; i++) {
subEu = &gAudioContext.notes[i].noteSubEu;
subEu2 = &gAudioContext.noteSubsEu[baseIndex + i];
baseIndex = gAudioCtx.numNotes * updateIndex;
for (i = 0; i < gAudioCtx.numNotes; i++) {
subEu = &gAudioCtx.notes[i].noteSubEu;
subEu2 = &gAudioCtx.noteSubsEu[baseIndex + i];
if (subEu->bitField0.enabled) {
subEu->bitField0.needsInit = false;
} else {
@@ -158,42 +158,41 @@ Acmd* AudioSynth_Update(Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen)
SynthesisReverb* reverb;
cmdP = cmdStart;
for (i = gAudioContext.audioBufferParameters.updatesPerFrame; i > 0; i--) {
for (i = gAudioCtx.audioBufferParameters.updatesPerFrame; i > 0; i--) {
AudioSeq_ProcessSequences(i - 1);
func_800DB03C(gAudioContext.audioBufferParameters.updatesPerFrame - i);
func_800DB03C(gAudioCtx.audioBufferParameters.updatesPerFrame - i);
}
aiBufP = aiStart;
gAudioContext.curLoadedBook = NULL;
gAudioCtx.curLoadedBook = NULL;
for (i = gAudioContext.audioBufferParameters.updatesPerFrame; i > 0; i--) {
for (i = gAudioCtx.audioBufferParameters.updatesPerFrame; i > 0; i--) {
if (i == 1) {
chunkLen = aiBufLen;
} else if ((aiBufLen / i) >= gAudioContext.audioBufferParameters.samplesPerUpdateMax) {
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdateMax;
} else if (gAudioContext.audioBufferParameters.samplesPerUpdateMin >= (aiBufLen / i)) {
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdateMin;
} else if ((aiBufLen / i) >= gAudioCtx.audioBufferParameters.samplesPerUpdateMax) {
chunkLen = gAudioCtx.audioBufferParameters.samplesPerUpdateMax;
} else if (gAudioCtx.audioBufferParameters.samplesPerUpdateMin >= (aiBufLen / i)) {
chunkLen = gAudioCtx.audioBufferParameters.samplesPerUpdateMin;
} else {
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdate;
chunkLen = gAudioCtx.audioBufferParameters.samplesPerUpdate;
}
for (j = 0; j < gAudioContext.numSynthesisReverbs; j++) {
if (gAudioContext.synthesisReverbs[j].useReverb) {
AudioSynth_InitNextRingBuf(chunkLen, gAudioContext.audioBufferParameters.updatesPerFrame - i, j);
for (j = 0; j < gAudioCtx.numSynthesisReverbs; j++) {
if (gAudioCtx.synthesisReverbs[j].useReverb) {
AudioSynth_InitNextRingBuf(chunkLen, gAudioCtx.audioBufferParameters.updatesPerFrame - i, j);
}
}
cmdP = AudioSynth_DoOneAudioUpdate(aiBufP, chunkLen, cmdP,
gAudioContext.audioBufferParameters.updatesPerFrame - i);
cmdP = AudioSynth_DoOneAudioUpdate(aiBufP, chunkLen, cmdP, gAudioCtx.audioBufferParameters.updatesPerFrame - i);
aiBufLen -= chunkLen;
aiBufP += 2 * chunkLen;
}
for (j = 0; j < gAudioContext.numSynthesisReverbs; j++) {
if (gAudioContext.synthesisReverbs[j].framesToIgnore != 0) {
gAudioContext.synthesisReverbs[j].framesToIgnore--;
for (j = 0; j < gAudioCtx.numSynthesisReverbs; j++) {
if (gAudioCtx.synthesisReverbs[j].framesToIgnore != 0) {
gAudioCtx.synthesisReverbs[j].framesToIgnore--;
}
gAudioContext.synthesisReverbs[j].curFrame ^= 1;
gAudioCtx.synthesisReverbs[j].curFrame ^= 1;
}
*cmdCnt = cmdP - cmdStart;
@@ -204,8 +203,8 @@ void func_800DB2C0(s32 updateIndex, s32 noteIndex) {
NoteSubEu* noteSubEu;
s32 i;
for (i = updateIndex + 1; i < gAudioContext.audioBufferParameters.updatesPerFrame; i++) {
noteSubEu = &gAudioContext.noteSubsEu[(gAudioContext.numNotes * i) + noteIndex];
for (i = updateIndex + 1; i < gAudioCtx.audioBufferParameters.updatesPerFrame; i++) {
noteSubEu = &gAudioCtx.noteSubsEu[(gAudioCtx.numNotes * i) + noteIndex];
if (!noteSubEu->bitField0.needsInit) {
noteSubEu->bitField0.enabled = false;
} else {
@@ -332,7 +331,7 @@ Acmd* AudioSynth_FilterReverb(Acmd* cmd, s32 size, SynthesisReverb* reverb) {
Acmd* AudioSynth_MaybeMixRingBuffer1(Acmd* cmd, SynthesisReverb* reverb, s32 updateIndex) {
SynthesisReverb* temp_a3;
temp_a3 = &gAudioContext.synthesisReverbs[reverb->unk_05];
temp_a3 = &gAudioCtx.synthesisReverbs[reverb->unk_05];
if (temp_a3->downsampleRate == 1) {
cmd = AudioSynth_LoadRingBuffer1AtTemp(cmd, temp_a3, updateIndex);
aMix(cmd++, DMEM_2CH_SIZE >> 4, reverb->unk_08, DMEM_WET_LEFT_CH, DMEM_WET_TEMP);
@@ -593,27 +592,27 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
NoteSubEu* noteSubEu2;
s32 unk14;
t = gAudioContext.numNotes * updateIndex;
t = gAudioCtx.numNotes * updateIndex;
count = 0;
if (gAudioContext.numSynthesisReverbs == 0) {
for (i = 0; i < gAudioContext.numNotes; i++) {
if (gAudioContext.noteSubsEu[t + i].bitField0.enabled) {
if (gAudioCtx.numSynthesisReverbs == 0) {
for (i = 0; i < gAudioCtx.numNotes; i++) {
if (gAudioCtx.noteSubsEu[t + i].bitField0.enabled) {
noteIndices[count++] = i;
}
}
} else {
for (reverbIndex = 0; reverbIndex < gAudioContext.numSynthesisReverbs; reverbIndex++) {
for (i = 0; i < gAudioContext.numNotes; i++) {
noteSubEu = &gAudioContext.noteSubsEu[t + i];
for (reverbIndex = 0; reverbIndex < gAudioCtx.numSynthesisReverbs; reverbIndex++) {
for (i = 0; i < gAudioCtx.numNotes; i++) {
noteSubEu = &gAudioCtx.noteSubsEu[t + i];
if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex == reverbIndex) {
noteIndices[count++] = i;
}
}
}
for (i = 0; i < gAudioContext.numNotes; i++) {
noteSubEu = &gAudioContext.noteSubsEu[t + i];
if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex >= gAudioContext.numSynthesisReverbs) {
for (i = 0; i < gAudioCtx.numNotes; i++) {
noteSubEu = &gAudioCtx.noteSubsEu[t + i];
if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex >= gAudioCtx.numSynthesisReverbs) {
noteIndices[count++] = i;
}
}
@@ -622,8 +621,8 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
aClearBuffer(cmd++, DMEM_LEFT_CH, DMEM_2CH_SIZE);
i = 0;
for (reverbIndex = 0; reverbIndex < gAudioContext.numSynthesisReverbs; reverbIndex++) {
reverb = &gAudioContext.synthesisReverbs[reverbIndex];
for (reverbIndex = 0; reverbIndex < gAudioCtx.numSynthesisReverbs; reverbIndex++) {
reverb = &gAudioCtx.synthesisReverbs[reverbIndex];
useReverb = reverb->useReverb;
if (useReverb) {
@@ -660,11 +659,11 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
}
while (i < count) {
noteSubEu2 = &gAudioContext.noteSubsEu[noteIndices[i] + t];
noteSubEu2 = &gAudioCtx.noteSubsEu[noteIndices[i] + t];
if (noteSubEu2->bitField1.reverbIndex == reverbIndex) {
cmd = AudioSynth_ProcessNote(noteIndices[i], noteSubEu2,
&gAudioContext.notes[noteIndices[i]].synthesisState, aiBuf, aiBufLen, cmd,
updateIndex);
cmd =
AudioSynth_ProcessNote(noteIndices[i], noteSubEu2, &gAudioCtx.notes[noteIndices[i]].synthesisState,
aiBuf, aiBufLen, cmd, updateIndex);
} else {
break;
}
@@ -689,9 +688,9 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
}
while (i < count) {
cmd = AudioSynth_ProcessNote(noteIndices[i], &gAudioContext.noteSubsEu[t + noteIndices[i]],
&gAudioContext.notes[noteIndices[i]].synthesisState, aiBuf, aiBufLen, cmd,
updateIndex);
cmd =
AudioSynth_ProcessNote(noteIndices[i], &gAudioCtx.noteSubsEu[t + noteIndices[i]],
&gAudioCtx.notes[noteIndices[i]].synthesisState, aiBuf, aiBufLen, cmd, updateIndex);
i++;
}
@@ -756,7 +755,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
bookOffset = noteSubEu->bitField1.bookOffset;
finished = noteSubEu->bitField0.finished;
note = &gAudioContext.notes[noteIndex];
note = &gAudioCtx.notes[noteIndex];
flags = A_CONTINUE;
if (noteSubEu->bitField0.needsInit == true) {
@@ -814,24 +813,24 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
}
if (sample->codec == CODEC_ADPCM || sample->codec == CODEC_SMALL_ADPCM) {
if (gAudioContext.curLoadedBook != sample->book->book) {
if (gAudioCtx.curLoadedBook != sample->book->book) {
u32 nEntries;
switch (bookOffset) {
case 1:
gAudioContext.curLoadedBook = &D_8012FBA8[1];
gAudioCtx.curLoadedBook = &D_8012FBA8[1];
break;
case 2:
case 3:
default:
gAudioContext.curLoadedBook = sample->book->book;
gAudioCtx.curLoadedBook = sample->book->book;
break;
}
if (1) {}
if (1) {}
if (1) {}
nEntries = SAMPLES_PER_FRAME * sample->book->order * sample->book->numPredictors;
aLoadADPCM(cmd++, nEntries, gAudioContext.curLoadedBook);
aLoadADPCM(cmd++, nEntries, gAudioCtx.curLoadedBook);
}
}
+124 -130
View File
@@ -53,32 +53,32 @@ AudioTask* func_800E5000(void) {
s32 sp48;
s32 i;
gAudioContext.totalTaskCount++;
if (gAudioContext.totalTaskCount % (gAudioContext.audioBufferParameters.specUnk4) != 0) {
gAudioCtx.totalTaskCount++;
if (gAudioCtx.totalTaskCount % (gAudioCtx.audioBufferParameters.specUnk4) != 0) {
if (D_801755D0 != NULL) {
D_801755D0();
}
if ((gAudioContext.totalTaskCount % gAudioContext.audioBufferParameters.specUnk4) + 1 ==
gAudioContext.audioBufferParameters.specUnk4) {
if ((gAudioCtx.totalTaskCount % gAudioCtx.audioBufferParameters.specUnk4) + 1 ==
gAudioCtx.audioBufferParameters.specUnk4) {
return sWaitingAudioTask;
} else {
return NULL;
}
}
osSendMesg(gAudioContext.taskStartQueueP, (OSMesg)gAudioContext.totalTaskCount, OS_MESG_NOBLOCK);
gAudioContext.rspTaskIndex ^= 1;
gAudioContext.curAiBufIndex++;
gAudioContext.curAiBufIndex %= 3;
index = (gAudioContext.curAiBufIndex - 2 + 3) % 3;
osSendMesg(gAudioCtx.taskStartQueueP, (OSMesg)gAudioCtx.totalTaskCount, OS_MESG_NOBLOCK);
gAudioCtx.rspTaskIndex ^= 1;
gAudioCtx.curAiBufIndex++;
gAudioCtx.curAiBufIndex %= 3;
index = (gAudioCtx.curAiBufIndex - 2 + 3) % 3;
samplesRemainingInAi = osAiGetLength() / 4;
if (gAudioContext.resetTimer < 16) {
if (gAudioContext.aiBufLengths[index] != 0) {
osAiSetNextBuffer(gAudioContext.aiBuffers[index], gAudioContext.aiBufLengths[index] * 4);
if (gAudioContext.aiBuffers[index]) {}
if (gAudioContext.aiBufLengths[index]) {}
if (gAudioCtx.resetTimer < 16) {
if (gAudioCtx.aiBufLengths[index] != 0) {
osAiSetNextBuffer(gAudioCtx.aiBuffers[index], gAudioCtx.aiBufLengths[index] * 4);
if (gAudioCtx.aiBuffers[index]) {}
if (gAudioCtx.aiBufLengths[index]) {}
}
}
@@ -86,36 +86,35 @@ AudioTask* func_800E5000(void) {
D_801755D0();
}
sp5C = gAudioContext.curAudioFrameDmaCount;
for (i = 0; i < gAudioContext.curAudioFrameDmaCount; i++) {
if (osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) {
sp5C = gAudioCtx.curAudioFrameDmaCount;
for (i = 0; i < gAudioCtx.curAudioFrameDmaCount; i++) {
if (osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) {
sp5C--;
}
}
if (sp5C != 0) {
for (i = 0; i < sp5C; i++) {
osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_BLOCK);
osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_BLOCK);
}
}
sp48 = MQ_GET_COUNT(&gAudioContext.currAudioFrameDmaQueue);
sp48 = MQ_GET_COUNT(&gAudioCtx.currAudioFrameDmaQueue);
if (sp48 != 0) {
for (i = 0; i < sp48; i++) {
osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK);
osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK);
}
}
gAudioContext.curAudioFrameDmaCount = 0;
gAudioCtx.curAudioFrameDmaCount = 0;
AudioLoad_DecreaseSampleDmaTtls();
AudioLoad_ProcessLoads(gAudioContext.resetStatus);
AudioLoad_ProcessLoads(gAudioCtx.resetStatus);
AudioLoad_ProcessScriptLoads();
if (gAudioContext.resetStatus != 0) {
if (gAudioCtx.resetStatus != 0) {
if (AudioHeap_ResetStep() == 0) {
if (gAudioContext.resetStatus == 0) {
osSendMesg(gAudioContext.audioResetQueueP, (OSMesg)(u32)gAudioContext.audioResetSpecIdToLoad,
OS_MESG_NOBLOCK);
if (gAudioCtx.resetStatus == 0) {
osSendMesg(gAudioCtx.audioResetQueueP, (OSMesg)(u32)gAudioCtx.audioResetSpecIdToLoad, OS_MESG_NOBLOCK);
}
sWaitingAudioTask = NULL;
@@ -123,63 +122,62 @@ AudioTask* func_800E5000(void) {
}
}
if (gAudioContext.resetTimer > 16) {
if (gAudioCtx.resetTimer > 16) {
return NULL;
}
if (gAudioContext.resetTimer != 0) {
gAudioContext.resetTimer++;
if (gAudioCtx.resetTimer != 0) {
gAudioCtx.resetTimer++;
}
gAudioContext.curTask = &gAudioContext.rspTask[gAudioContext.rspTaskIndex];
gAudioContext.curAbiCmdBuf = gAudioContext.abiCmdBufs[gAudioContext.rspTaskIndex];
gAudioCtx.curTask = &gAudioCtx.rspTask[gAudioCtx.rspTaskIndex];
gAudioCtx.curAbiCmdBuf = gAudioCtx.abiCmdBufs[gAudioCtx.rspTaskIndex];
index = gAudioContext.curAiBufIndex;
currAiBuffer = gAudioContext.aiBuffers[index];
index = gAudioCtx.curAiBufIndex;
currAiBuffer = gAudioCtx.aiBuffers[index];
gAudioContext.aiBufLengths[index] =
(s16)((((gAudioContext.audioBufferParameters.samplesPerFrameTarget - samplesRemainingInAi) +
gAudioCtx.aiBufLengths[index] =
(s16)((((gAudioCtx.audioBufferParameters.samplesPerFrameTarget - samplesRemainingInAi) +
EXTRA_BUFFERED_AI_SAMPLES_TARGET) &
~0xF) +
SAMPLES_TO_OVERPRODUCE);
if (gAudioContext.aiBufLengths[index] < gAudioContext.audioBufferParameters.minAiBufferLength) {
gAudioContext.aiBufLengths[index] = gAudioContext.audioBufferParameters.minAiBufferLength;
if (gAudioCtx.aiBufLengths[index] < gAudioCtx.audioBufferParameters.minAiBufferLength) {
gAudioCtx.aiBufLengths[index] = gAudioCtx.audioBufferParameters.minAiBufferLength;
}
if (gAudioContext.aiBufLengths[index] > gAudioContext.audioBufferParameters.maxAiBufferLength) {
gAudioContext.aiBufLengths[index] = gAudioContext.audioBufferParameters.maxAiBufferLength;
if (gAudioCtx.aiBufLengths[index] > gAudioCtx.audioBufferParameters.maxAiBufferLength) {
gAudioCtx.aiBufLengths[index] = gAudioCtx.audioBufferParameters.maxAiBufferLength;
}
j = 0;
if (gAudioContext.resetStatus == 0) {
if (gAudioCtx.resetStatus == 0) {
// msg = 0000RREE R = read pos, E = End Pos
while (osRecvMesg(gAudioContext.cmdProcQueueP, (OSMesg*)&sp4C, OS_MESG_NOBLOCK) != -1) {
while (osRecvMesg(gAudioCtx.cmdProcQueueP, (OSMesg*)&sp4C, OS_MESG_NOBLOCK) != -1) {
if (1) {}
Audio_ProcessCmds(sp4C);
j++;
}
if ((j == 0) && (gAudioContext.cmdQueueFinished)) {
if ((j == 0) && (gAudioCtx.cmdQueueFinished)) {
Audio_ScheduleProcessCmds();
}
}
gAudioContext.curAbiCmdBuf =
AudioSynth_Update(gAudioContext.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioContext.aiBufLengths[index]);
gAudioCtx.curAbiCmdBuf =
AudioSynth_Update(gAudioCtx.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioCtx.aiBufLengths[index]);
// Update audioRandom to the next random number
gAudioContext.audioRandom = (gAudioContext.audioRandom + gAudioContext.totalTaskCount) * osGetCount();
gAudioContext.audioRandom =
gAudioContext.audioRandom + gAudioContext.aiBuffers[index][gAudioContext.totalTaskCount & 0xFF];
gAudioCtx.audioRandom = (gAudioCtx.audioRandom + gAudioCtx.totalTaskCount) * osGetCount();
gAudioCtx.audioRandom = gAudioCtx.audioRandom + gAudioCtx.aiBuffers[index][gAudioCtx.totalTaskCount & 0xFF];
// gWaveSamples[8] interprets compiled assembly code as s16 samples as a way to generate sound with noise.
// Start with the address of func_800E4FE0, and offset it by a random number between 0 - 0xFFF0
// Use the resulting address as the starting address to interpret an array of samples i.e. `s16 samples[]`
gWaveSamples[8] = (s16*)(((u8*)func_800E4FE0) + (gAudioContext.audioRandom & 0xFFF0));
gWaveSamples[8] = (s16*)(((u8*)func_800E4FE0) + (gAudioCtx.audioRandom & 0xFFF0));
index = gAudioContext.rspTaskIndex;
gAudioContext.curTask->msgQueue = NULL;
gAudioContext.curTask->unk_44 = NULL;
index = gAudioCtx.rspTaskIndex;
gAudioCtx.curTask->msgQueue = NULL;
gAudioCtx.curTask->unk_44 = NULL;
task = &gAudioContext.curTask->task.t;
task = &gAudioCtx.curTask->task.t;
task->type = M_AUDTASK;
task->flags = 0;
task->ucode_boot = aspMainTextStart;
@@ -193,7 +191,7 @@ AudioTask* func_800E5000(void) {
task->output_buff = NULL;
task->output_buff_size = NULL;
if (1) {}
task->data_ptr = (u64*)gAudioContext.abiCmdBufs[index];
task->data_ptr = (u64*)gAudioCtx.abiCmdBufs[index];
task->data_size = abiCmdCnt * sizeof(Acmd);
task->yield_data_ptr = NULL;
task->yield_data_size = 0;
@@ -202,10 +200,10 @@ AudioTask* func_800E5000(void) {
sMaxAbiCmdCnt = abiCmdCnt;
}
if (gAudioContext.audioBufferParameters.specUnk4 == 1) {
return gAudioContext.curTask;
if (gAudioCtx.audioBufferParameters.specUnk4 == 1) {
return gAudioCtx.curTask;
} else {
sWaitingAudioTask = gAudioContext.curTask;
sWaitingAudioTask = gAudioCtx.curTask;
return NULL;
}
}
@@ -235,9 +233,9 @@ void func_800E5584(AudioCmd* cmd) {
break;
case 0x83:
if (gAudioContext.seqPlayers[cmd->arg0].enabled) {
if (gAudioCtx.seqPlayers[cmd->arg0].enabled) {
if (cmd->asInt == 0) {
AudioSeq_SequencePlayerDisableAsFinished(&gAudioContext.seqPlayers[cmd->arg0]);
AudioSeq_SequencePlayerDisableAsFinished(&gAudioCtx.seqPlayers[cmd->arg0]);
} else {
func_800E5958(cmd->arg0, cmd->asInt);
}
@@ -245,12 +243,12 @@ void func_800E5584(AudioCmd* cmd) {
break;
case 0xF0:
gAudioContext.soundMode = cmd->asUInt;
gAudioCtx.soundMode = cmd->asUInt;
break;
case 0xF1:
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i];
for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[i];
seqPlayer->muted = 1;
seqPlayer->recalculateVolume = 1;
@@ -259,8 +257,8 @@ void func_800E5584(AudioCmd* cmd) {
case 0xF2:
if (cmd->asUInt == 1) {
for (i = 0; i < gAudioContext.numNotes; i++) {
Note* note = &gAudioContext.notes[i];
for (i = 0; i < gAudioCtx.numNotes; i++) {
Note* note = &gAudioCtx.notes[i];
NoteSubEu* subEu = &note->noteSubEu;
if (subEu->bitField0.enabled && note->playbackState.unk_04 == 0) {
@@ -271,8 +269,8 @@ void func_800E5584(AudioCmd* cmd) {
}
}
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i];
for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[i];
seqPlayer->muted = 0;
seqPlayer->recalculateVolume = 1;
@@ -284,15 +282,15 @@ void func_800E5584(AudioCmd* cmd) {
break;
case 0xF4:
AudioLoad_AsyncLoadSampleBank(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
AudioLoad_AsyncLoadSampleBank(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioCtx.externalLoadQueue);
break;
case 0xF5:
AudioLoad_AsyncLoadFont(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
AudioLoad_AsyncLoadFont(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioCtx.externalLoadQueue);
break;
case 0xFC:
AudioLoad_AsyncLoadSeq(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
AudioLoad_AsyncLoadSeq(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioCtx.externalLoadQueue);
break;
case 0xF6:
@@ -300,12 +298,12 @@ void func_800E5584(AudioCmd* cmd) {
break;
case 0x90:
gAudioContext.unk_5BDC[cmd->arg0] = cmd->asUShort;
gAudioCtx.unk_5BDC[cmd->arg0] = cmd->asUShort;
break;
case 0xF9:
gAudioContext.resetStatus = 5;
gAudioContext.audioResetSpecIdToLoad = cmd->asUInt;
gAudioCtx.resetStatus = 5;
gAudioCtx.audioResetSpecIdToLoad = cmd->asUInt;
break;
case 0xFB:
@@ -321,8 +319,8 @@ void func_800E5584(AudioCmd* cmd) {
case 0xFE:
temp_t7 = cmd->asUInt;
if (temp_t7 == 1) {
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i];
for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[i];
if (seqPlayer->enabled) {
AudioSeq_SequencePlayerDisableAsFinished(seqPlayer);
@@ -343,7 +341,7 @@ void func_800E5584(AudioCmd* cmd) {
// SetFadeOutTimer
void func_800E5958(s32 playerIdx, s32 fadeTimer) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx];
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
if (fadeTimer == 0) {
fadeTimer = 1;
@@ -359,7 +357,7 @@ void func_800E59AC(s32 playerIdx, s32 fadeTimer) {
SequencePlayer* seqPlayer;
if (fadeTimer != 0) {
seqPlayer = &gAudioContext.seqPlayers[playerIdx];
seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
seqPlayer->state = 1;
seqPlayer->fadeTimerUnkEu = fadeTimer;
seqPlayer->fadeTimer = fadeTimer;
@@ -369,30 +367,27 @@ void func_800E59AC(s32 playerIdx, s32 fadeTimer) {
}
void Audio_InitMesgQueuesInternal(void) {
gAudioContext.cmdWrPos = 0;
gAudioContext.cmdRdPos = 0;
gAudioContext.cmdQueueFinished = 0;
gAudioContext.taskStartQueueP = &gAudioContext.taskStartQueue;
gAudioContext.cmdProcQueueP = &gAudioContext.cmdProcQueue;
gAudioContext.audioResetQueueP = &gAudioContext.audioResetQueue;
osCreateMesgQueue(gAudioContext.taskStartQueueP, gAudioContext.taskStartMsgBuf,
ARRAY_COUNT(gAudioContext.taskStartMsgBuf));
osCreateMesgQueue(gAudioContext.cmdProcQueueP, gAudioContext.cmdProcMsgBuf,
ARRAY_COUNT(gAudioContext.cmdProcMsgBuf));
osCreateMesgQueue(gAudioContext.audioResetQueueP, gAudioContext.audioResetMsgBuf,
ARRAY_COUNT(gAudioContext.audioResetMsgBuf));
gAudioCtx.cmdWrPos = 0;
gAudioCtx.cmdRdPos = 0;
gAudioCtx.cmdQueueFinished = 0;
gAudioCtx.taskStartQueueP = &gAudioCtx.taskStartQueue;
gAudioCtx.cmdProcQueueP = &gAudioCtx.cmdProcQueue;
gAudioCtx.audioResetQueueP = &gAudioCtx.audioResetQueue;
osCreateMesgQueue(gAudioCtx.taskStartQueueP, gAudioCtx.taskStartMsgBuf, ARRAY_COUNT(gAudioCtx.taskStartMsgBuf));
osCreateMesgQueue(gAudioCtx.cmdProcQueueP, gAudioCtx.cmdProcMsgBuf, ARRAY_COUNT(gAudioCtx.cmdProcMsgBuf));
osCreateMesgQueue(gAudioCtx.audioResetQueueP, gAudioCtx.audioResetMsgBuf, ARRAY_COUNT(gAudioCtx.audioResetMsgBuf));
}
void Audio_QueueCmd(u32 opArgs, void** data) {
AudioCmd* cmd = &gAudioContext.cmdBuf[gAudioContext.cmdWrPos & 0xFF];
AudioCmd* cmd = &gAudioCtx.cmdBuf[gAudioCtx.cmdWrPos & 0xFF];
cmd->opArgs = opArgs;
cmd->data = *data;
gAudioContext.cmdWrPos++;
gAudioCtx.cmdWrPos++;
if (gAudioContext.cmdWrPos == gAudioContext.cmdRdPos) {
gAudioContext.cmdWrPos--;
if (gAudioCtx.cmdWrPos == gAudioCtx.cmdRdPos) {
gAudioCtx.cmdWrPos--;
}
}
@@ -420,15 +415,14 @@ s32 Audio_ScheduleProcessCmds(void) {
static s32 D_801304E8 = 0;
s32 ret;
if (D_801304E8 < (u8)((gAudioContext.cmdWrPos - gAudioContext.cmdRdPos) + 0x100)) {
D_801304E8 = (u8)((gAudioContext.cmdWrPos - gAudioContext.cmdRdPos) + 0x100);
if (D_801304E8 < (u8)((gAudioCtx.cmdWrPos - gAudioCtx.cmdRdPos) + 0x100)) {
D_801304E8 = (u8)((gAudioCtx.cmdWrPos - gAudioCtx.cmdRdPos) + 0x100);
}
ret =
osSendMesg(gAudioContext.cmdProcQueueP,
(OSMesg)(((gAudioContext.cmdRdPos & 0xFF) << 8) | (gAudioContext.cmdWrPos & 0xFF)), OS_MESG_NOBLOCK);
ret = osSendMesg(gAudioCtx.cmdProcQueueP,
(OSMesg)(((gAudioCtx.cmdRdPos & 0xFF) << 8) | (gAudioCtx.cmdWrPos & 0xFF)), OS_MESG_NOBLOCK);
if (ret != -1) {
gAudioContext.cmdRdPos = gAudioContext.cmdWrPos;
gAudioCtx.cmdRdPos = gAudioCtx.cmdWrPos;
ret = 0;
} else {
return -1;
@@ -438,8 +432,8 @@ s32 Audio_ScheduleProcessCmds(void) {
}
void Audio_ResetCmdQueue(void) {
gAudioContext.cmdQueueFinished = 0;
gAudioContext.cmdRdPos = gAudioContext.cmdWrPos;
gAudioCtx.cmdQueueFinished = 0;
gAudioCtx.cmdRdPos = gAudioCtx.cmdWrPos;
}
void Audio_ProcessCmd(AudioCmd* cmd) {
@@ -452,8 +446,8 @@ void Audio_ProcessCmd(AudioCmd* cmd) {
return;
}
if (cmd->arg0 < gAudioContext.audioBufferParameters.numSequencePlayers) {
seqPlayer = &gAudioContext.seqPlayers[cmd->arg0];
if (cmd->arg0 < gAudioCtx.audioBufferParameters.numSequencePlayers) {
seqPlayer = &gAudioCtx.seqPlayers[cmd->arg0];
if (cmd->op & 0x80) {
func_800E5584(cmd);
return;
@@ -468,7 +462,7 @@ void Audio_ProcessCmd(AudioCmd* cmd) {
return;
}
if (cmd->arg1 == 0xFF) {
phi_v0 = gAudioContext.unk_5BDC[cmd->arg0];
phi_v0 = gAudioCtx.unk_5BDC[cmd->arg0];
for (i = 0; i < 16; i++) {
if (phi_v0 & 1) {
func_800E6300(seqPlayer->channels[i], cmd);
@@ -484,20 +478,20 @@ void Audio_ProcessCmds(u32 msg) {
AudioCmd* cmd;
u8 endPos;
if (!gAudioContext.cmdQueueFinished) {
if (!gAudioCtx.cmdQueueFinished) {
curCmdRdPos = msg >> 8;
}
while (true) {
endPos = msg & 0xFF;
if (curCmdRdPos == endPos) {
gAudioContext.cmdQueueFinished = 0;
gAudioCtx.cmdQueueFinished = 0;
return;
}
cmd = &gAudioContext.cmdBuf[curCmdRdPos++ & 0xFF];
cmd = &gAudioCtx.cmdBuf[curCmdRdPos++ & 0xFF];
if (cmd->op == 0xF8) {
gAudioContext.cmdQueueFinished = 1;
gAudioCtx.cmdQueueFinished = 1;
return;
}
@@ -509,7 +503,7 @@ void Audio_ProcessCmds(u32 msg) {
u32 func_800E5E20(u32* out) {
u32 sp1C;
if (osRecvMesg(&gAudioContext.externalLoadQueue, (OSMesg*)&sp1C, OS_MESG_NOBLOCK) == -1) {
if (osRecvMesg(&gAudioCtx.externalLoadQueue, (OSMesg*)&sp1C, OS_MESG_NOBLOCK) == -1) {
*out = 0;
return 0;
}
@@ -522,17 +516,17 @@ u8* func_800E5E84(s32 arg0, u32* arg1) {
}
void Audio_GetSampleBankIdsOfFont(s32 fontId, u32* sampleBankId1, u32* sampleBankId2) {
*sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
*sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
*sampleBankId1 = gAudioCtx.soundFontList[fontId].sampleBankId1;
*sampleBankId2 = gAudioCtx.soundFontList[fontId].sampleBankId2;
}
s32 func_800E5EDC(void) {
s32 pad;
s32 sp18;
if (osRecvMesg(gAudioContext.audioResetQueueP, (OSMesg*)&sp18, OS_MESG_NOBLOCK) == -1) {
if (osRecvMesg(gAudioCtx.audioResetQueueP, (OSMesg*)&sp18, OS_MESG_NOBLOCK) == -1) {
return 0;
} else if (gAudioContext.audioResetSpecIdToLoad != sp18) {
} else if (gAudioCtx.audioResetSpecIdToLoad != sp18) {
return -1;
} else {
return 1;
@@ -542,7 +536,7 @@ s32 func_800E5EDC(void) {
void func_800E5F34(void) {
// macro?
// clang-format off
s32 chk = -1; OSMesg msg; do {} while (osRecvMesg(gAudioContext.audioResetQueueP, &msg, OS_MESG_NOBLOCK) != chk);
s32 chk = -1; OSMesg msg; do {} while (osRecvMesg(gAudioCtx.audioResetQueueP, &msg, OS_MESG_NOBLOCK) != chk);
// clang-format on
}
@@ -552,16 +546,16 @@ s32 func_800E5F88(s32 resetPreloadID) {
s32 pad;
func_800E5F34();
resetStatus = gAudioContext.resetStatus;
resetStatus = gAudioCtx.resetStatus;
if (resetStatus != 0) {
Audio_ResetCmdQueue();
if (gAudioContext.audioResetSpecIdToLoad == resetPreloadID) {
if (gAudioCtx.audioResetSpecIdToLoad == resetPreloadID) {
return -2;
} else if (resetStatus > 2) {
gAudioContext.audioResetSpecIdToLoad = resetPreloadID;
gAudioCtx.audioResetSpecIdToLoad = resetPreloadID;
return -3;
} else {
osRecvMesg(gAudioContext.audioResetQueueP, &msg, OS_MESG_BLOCK);
osRecvMesg(gAudioCtx.audioResetQueueP, &msg, OS_MESG_BLOCK);
}
}
@@ -572,15 +566,15 @@ s32 func_800E5F88(s32 resetPreloadID) {
}
void Audio_PreNMIInternal(void) {
gAudioContext.resetTimer = 1;
gAudioCtx.resetTimer = 1;
if (gAudioContextInitialized) {
func_800E5F88(0);
gAudioContext.resetStatus = 0;
gAudioCtx.resetStatus = 0;
}
}
s8 func_800E6070(s32 playerIdx, s32 channelIdx, s32 scriptIdx) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx];
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
SequenceChannel* channel;
if (seqPlayer->enabled) {
@@ -592,15 +586,15 @@ s8 func_800E6070(s32 playerIdx, s32 channelIdx, s32 scriptIdx) {
}
s8 func_800E60C4(s32 playerIdx, s32 port) {
return gAudioContext.seqPlayers[playerIdx].soundScriptIO[port];
return gAudioCtx.seqPlayers[playerIdx].soundScriptIO[port];
}
void Audio_InitExternalPool(void* ramAddr, u32 size) {
AudioHeap_InitPool(&gAudioContext.externalPool, ramAddr, size);
AudioHeap_InitPool(&gAudioCtx.externalPool, ramAddr, size);
}
void Audio_DestroyExternalPool(void) {
gAudioContext.externalPool.startRamAddr = NULL;
gAudioCtx.externalPool.startRamAddr = NULL;
}
void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* cmd) {
@@ -780,8 +774,8 @@ void func_800E651C(u32 arg0, s32 arg1) {
}
void Audio_WaitForAudioTask(void) {
osRecvMesg(gAudioContext.taskStartQueueP, NULL, OS_MESG_NOBLOCK);
osRecvMesg(gAudioContext.taskStartQueueP, NULL, OS_MESG_BLOCK);
osRecvMesg(gAudioCtx.taskStartQueueP, NULL, OS_MESG_NOBLOCK);
osRecvMesg(gAudioCtx.taskStartQueueP, NULL, OS_MESG_BLOCK);
}
s32 func_800E6590(s32 playerIdx, s32 arg1, s32 arg2) {
@@ -792,7 +786,7 @@ s32 func_800E6590(s32 playerIdx, s32 arg1, s32 arg2) {
s32 loopEnd;
s32 samplePos;
seqPlayer = &gAudioContext.seqPlayers[playerIdx];
seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
if (seqPlayer->enabled && seqPlayer->channels[arg1]->enabled) {
layer = seqPlayer->channels[arg1]->layers[arg2];
if (layer == NULL) {
@@ -841,8 +835,8 @@ s32 func_800E66C0(s32 arg0) {
TunedSample* tunedSample;
phi_v1 = 0;
for (i = 0; i < gAudioContext.numNotes; i++) {
note = &gAudioContext.notes[i];
for (i = 0; i < gAudioCtx.numNotes; i++) {
note = &gAudioCtx.notes[i];
playbackState = &note->playbackState;
if (note->noteSubEu.bitField0.enabled) {
noteSubEu = &note->noteSubEu;
@@ -859,7 +853,7 @@ s32 func_800E66C0(s32 arg0) {
phi_v1++;
if ((arg0 & 1) == 1) {
playbackState->adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
playbackState->adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
playbackState->adsr.action.s.release = 1;
}
}
@@ -871,8 +865,8 @@ s32 func_800E66C0(s32 arg0) {
u32 Audio_NextRandom(void) {
static u32 audRand = 0x12345678;
audRand = ((osGetCount() + 0x1234567) * (audRand + gAudioContext.totalTaskCount));
audRand += gAudioContext.audioRandom;
audRand = ((osGetCount() + 0x1234567) * (audRand + gAudioCtx.totalTaskCount));
audRand += gAudioCtx.audioRandom;
return audRand;
}
+405 -356
View File
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -52,15 +52,15 @@ void Audio_SetSfxBanksMute(u16 muteMask) {
void Audio_QueueSeqCmdMute(u8 channelIdx) {
D_801333D0 |= (1 << channelIdx);
Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 2, 0x40, 0xF);
Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 2, 0x40, 0xF);
Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_SFX, 0x40, 0xF);
Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_SFX, 0x40, 0xF);
}
void Audio_ClearBGMMute(u8 channelIdx) {
D_801333D0 &= ((1 << channelIdx) ^ 0xFFFF);
if (D_801333D0 == 0) {
Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 2, 0x7F, 0xF);
Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 2, 0x7F, 0xF);
Audio_SetVolumeScale(SEQ_PLAYER_BGM_MAIN, VOL_SCALE_INDEX_SFX, 0x7F, 0xF);
Audio_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_SFX, 0x7F, 0xF);
}
}
@@ -441,7 +441,7 @@ void Audio_PlayActiveSfx(u8 bankId) {
entryIndex = gActiveSfx[bankId][i].entryIndex;
if (entryIndex != 0xFF) {
entry = &gSfxBanks[bankId][entryIndex];
channel = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[sCurSfxPlayerChannelIdx];
channel = gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[sCurSfxPlayerChannelIdx];
if (entry->state == SFX_STATE_READY) {
entry->channelIdx = sCurSfxPlayerChannelIdx;
if (entry->sfxParams & SFX_FLAG_3) {
@@ -476,7 +476,7 @@ void Audio_PlayActiveSfx(u8 bankId) {
} else {
entry->state = SFX_STATE_PLAYING_2;
}
} else if ((u8)channel->soundScriptIO[1] == 0xFF) {
} else if ((u8)channel->soundScriptIO[1] == (u8)SEQ_IO_VAL_NONE) {
Audio_RemoveSfxBankEntry(bankId, entryIndex);
} else if (entry->state == SFX_STATE_PLAYING_REFRESH) {
Audio_SetSfxProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx);
@@ -661,7 +661,7 @@ void Audio_StepUnusedBankLerp(u8 bankId) {
void func_800F8F88(void) {
u8 bankId;
if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[0])) {
if (IS_SEQUENCE_CHANNEL_VALID(gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[0])) {
sCurSfxPlayerChannelIdx = 0;
for (bankId = 0; bankId < ARRAY_COUNT(gSfxBanks); bankId++) {
Audio_ChooseActiveSfx(bankId);
+512 -388
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -345,9 +345,9 @@ void func_80111070(void) {
XREG(3) = -4;
XREG(4) = 3;
XREG(5) = 0;
XREG(6) = 2;
R_PAUSE_STICK_REPEAT_DELAY = 2;
XREG(7) = 30;
XREG(8) = 10;
R_PAUSE_STICK_REPEAT_DELAY_FIRST = 10;
XREG(9) = 0;
XREG(10) = -9550;
XREG(11) = 9950;
+4 -4
View File
@@ -449,15 +449,15 @@ void Cutscene_Command_StopBGM(PlayState* play, CutsceneContext* csCtx, CsCmdMusi
// Command 0x7C: Fade Background Music over duration
void Cutscene_Command_FadeBGM(PlayState* play, CutsceneContext* csCtx, CsCmdMusicFade* cmd) {
u8 var1;
u8 fadeTimer;
if ((csCtx->frames == cmd->startFrame) && (csCtx->frames < cmd->endFrame)) {
var1 = cmd->endFrame - cmd->startFrame;
fadeTimer = cmd->endFrame - cmd->startFrame;
if (cmd->type == 3) {
Audio_QueueSeqCmd(var1 << 0x10 | (0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF));
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, fadeTimer);
} else {
Audio_QueueSeqCmd(var1 << 0x10 | (0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xFF));
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, fadeTimer);
}
}
}
+6 -6
View File
@@ -2035,7 +2035,7 @@ void Environment_PlaySceneSequence(PlayState* play) {
Audio_PlayNatureAmbienceSequence(NATURE_ID_KOKIRI_REGION);
} else if (((void)0, gSaveContext.forcedSeqId) != NA_BGM_GENERAL_SFX) {
if (!Environment_IsForcedSequenceDisabled()) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | (s32)((void)0, gSaveContext.forcedSeqId));
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, ((void)0, gSaveContext.forcedSeqId));
}
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
} else if (play->sequenceCtx.seqId == NA_BGM_NO_MUSIC) {
@@ -2050,12 +2050,12 @@ void Environment_PlaySceneSequence(PlayState* play) {
osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", play->sequenceCtx.seqId,
((void)0, gSaveContext.seqId));
if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) {
func_800F5550(play->sequenceCtx.seqId);
Audio_PlaySceneSequence(play->sequenceCtx.seqId);
}
} else if (((void)0, gSaveContext.dayTime) >= CLOCK_TIME(7, 0) &&
((void)0, gSaveContext.dayTime) <= CLOCK_TIME(17, 10)) {
if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) {
func_800F5550(play->sequenceCtx.seqId);
Audio_PlaySceneSequence(play->sequenceCtx.seqId);
}
play->envCtx.timeSeqState = TIMESEQ_FADE_DAY_BGM;
@@ -2092,7 +2092,7 @@ void Environment_PlayTimeBasedSequence(PlayState* play) {
if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) {
osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n");
func_800F5510(play->sequenceCtx.seqId);
Audio_PlayMorningSceneSequence(play->sequenceCtx.seqId);
}
play->envCtx.timeSeqState++;
@@ -2102,7 +2102,7 @@ void Environment_PlayTimeBasedSequence(PlayState* play) {
if (gSaveContext.dayTime > CLOCK_TIME(17, 10)) {
if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 &&
play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xF000FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 240);
}
play->envCtx.timeSeqState++;
@@ -2570,7 +2570,7 @@ void Environment_StopStormNatureAmbience(PlayState* play) {
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0);
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0);
if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) {
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) {
gSaveContext.seqId = NA_BGM_NATURE_SFX_RAIN;
Environment_PlaySceneSequence(play);
}
+104 -106
View File
@@ -24,75 +24,75 @@ s16 sBootData[PLAYER_BOOTS_MAX][17] = {
{ 200, 1000, 300, 800, 500, 400, 800, 400, 800, 550, -100, 600, 540, 750, 125, 400, 200 },
};
// Used to map action params to model groups
u8 sActionModelGroups[PLAYER_AP_MAX] = {
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_NONE
PLAYER_MODELGROUP_15, // PLAYER_AP_LAST_USED
PLAYER_MODELGROUP_10, // PLAYER_AP_FISHING_POLE
PLAYER_MODELGROUP_SWORD, // PLAYER_AP_SWORD_MASTER
PLAYER_MODELGROUP_SWORD, // PLAYER_AP_SWORD_KOKIRI
PLAYER_MODELGROUP_BGS, // PLAYER_AP_SWORD_BGS
PLAYER_MODELGROUP_10, // PLAYER_AP_STICK
PLAYER_MODELGROUP_HAMMER, // PLAYER_AP_HAMMER
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_FIRE
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_ICE
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_LIGHT
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_0C
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_0D
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_0E
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_SLINGSHOT
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_AP_HOOKSHOT
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_AP_LONGSHOT
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_AP_BOMB
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_AP_BOMBCHU
PLAYER_MODELGROUP_BOOMERANG, // PLAYER_AP_BOOMERANG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MAGIC_SPELL_15
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MAGIC_SPELL_16
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_MAGIC_SPELL_17
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_FARORES_WIND
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_NAYRUS_LOVE
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_DINS_FIRE
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_NUT
PLAYER_MODELGROUP_OCARINA, // PLAYER_AP_OCARINA_FAIRY
PLAYER_MODELGROUP_OOT, // PLAYER_AP_OCARINA_TIME
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_FISH
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_FIRE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_BUG
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_BIG_POE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_LETTER
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POTION_RED
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POTION_BLUE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POTION_GREEN
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_MILK
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_MILK_HALF
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_FAIRY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_LETTER_ZELDA
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_WEIRD_EGG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_CHICKEN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_BEAN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_POCKET_EGG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_POCKET_CUCCO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_COJIRO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_ODD_MUSHROOM
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_ODD_POTION
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_SAW
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_SWORD_BROKEN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_PRESCRIPTION
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_FROG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_EYEDROPS
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_CLAIM_CHECK
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_KEATON
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_SKULL
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_SPOOKY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_BUNNY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_GORON
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_ZORA
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_GERUDO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_TRUTH
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_LENS
// Used to map item actions to model groups
u8 sActionModelGroups[PLAYER_IA_MAX] = {
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NONE
PLAYER_MODELGROUP_15, // PLAYER_IA_LAST_USED
PLAYER_MODELGROUP_10, // PLAYER_IA_FISHING_POLE
PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_MASTER
PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_KOKIRI
PLAYER_MODELGROUP_BGS, // PLAYER_IA_SWORD_BGS
PLAYER_MODELGROUP_10, // PLAYER_IA_STICK
PLAYER_MODELGROUP_HAMMER, // PLAYER_IA_HAMMER
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_FIRE
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_ICE
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_LIGHT
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0C
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0D
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0E
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_SLINGSHOT
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_HOOKSHOT
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_LONGSHOT
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMB
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMBCHU
PLAYER_MODELGROUP_BOOMERANG, // PLAYER_IA_BOOMERANG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_15
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_16
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_MAGIC_SPELL_17
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FARORES_WIND
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NAYRUS_LOVE
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DINS_FIRE
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NUT
PLAYER_MODELGROUP_OCARINA, // PLAYER_IA_OCARINA_FAIRY
PLAYER_MODELGROUP_OOT, // PLAYER_IA_OCARINA_TIME
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FISH
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FIRE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BUG
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BIG_POE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_LETTER
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_RED
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_BLUE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_GREEN
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_HALF
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FAIRY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LETTER_ZELDA
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_WEIRD_EGG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CHICKEN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_BEAN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_EGG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_CUCCO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_COJIRO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_MUSHROOM
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_POTION
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_SAW
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_SWORD_BROKEN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_PRESCRIPTION
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FROG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_EYEDROPS
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CLAIM_CHECK
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_KEATON
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SKULL
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SPOOKY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_BUNNY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GORON
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_ZORA
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GERUDO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_TRUTH
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LENS
};
TextTriggerEntry sTextTriggers[] = {
@@ -491,8 +491,7 @@ s32 Player_InBlockingCsMode(PlayState* play, Player* this) {
return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csMode != 0) ||
(play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) ||
(this->stateFlags3 & PLAYER_STATE3_7) ||
((gSaveContext.magicState != MAGIC_STATE_IDLE) &&
(Player_ActionToMagicSpell(this, this->itemActionParam) >= 0));
((gSaveContext.magicState != MAGIC_STATE_IDLE) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0));
}
s32 Player_InCsMode(PlayState* play) {
@@ -509,8 +508,8 @@ s32 Player_IsChildWithHylianShield(Player* this) {
return gSaveContext.linkAge != LINK_AGE_ADULT && (this->currentShield == PLAYER_SHIELD_HYLIAN);
}
s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
s32 modelGroup = sActionModelGroups[actionParam];
s32 Player_ActionToModelGroup(Player* this, s32 itemAction) {
s32 modelGroup = sActionModelGroups[itemAction];
if ((modelGroup == PLAYER_MODELGROUP_SWORD) && Player_IsChildWithHylianShield(this)) {
// child, using kokiri sword with hylian shield equipped
@@ -522,7 +521,7 @@ s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
void Player_SetModelsForHoldingShield(Player* this) {
if ((this->stateFlags1 & PLAYER_STATE1_22) &&
((this->itemActionParam < 0) || (this->itemActionParam == this->heldItemActionParam))) {
((this->itemAction < 0) || (this->itemAction == this->heldItemAction))) {
if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) {
this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD;
this->rightHandDLists = sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD] + ((void)0, gSaveContext.linkAge);
@@ -533,7 +532,7 @@ void Player_SetModelsForHoldingShield(Player* this) {
}
this->sheathDLists = sPlayerDListGroups[this->sheathType] + ((void)0, gSaveContext.linkAge);
this->modelAnimType = PLAYER_ANIMTYPE_2;
this->itemActionParam = -1;
this->itemAction = -1;
}
}
}
@@ -572,8 +571,8 @@ void Player_SetModelGroup(Player* this, s32 modelGroup) {
}
void func_8008EC70(Player* this) {
this->itemActionParam = this->heldItemActionParam;
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam));
this->itemAction = this->heldItemAction;
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemAction));
this->unk_6AD = 0;
}
@@ -583,20 +582,20 @@ void Player_SetEquipmentData(PlayState* play, Player* this) {
this->currentTunic = TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC));
this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS));
this->currentSwordItemId = B_BTN_ITEM;
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam));
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemAction));
Player_SetBootData(play, this);
}
}
void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 actionParam) {
void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 itemAction) {
Inventory_UpdateBottleItem(play, item, this->heldItemButton);
if (item != ITEM_BOTTLE) {
this->heldItemId = item;
this->heldItemActionParam = actionParam;
this->heldItemAction = itemAction;
}
this->itemActionParam = actionParam;
this->itemAction = itemAction;
}
void func_8008EDF0(Player* this) {
@@ -645,7 +644,7 @@ s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 y
Vec3f diff;
s32 pad;
if ((this->heldItemActionParam == PLAYER_AP_STICK) && (this->unk_860 != 0)) {
if ((this->heldItemAction == PLAYER_IA_STICK) && (this->unk_860 != 0)) {
Math_Vec3f_Diff(&this->meleeWeaponInfo[0].tip, pos, &diff);
return ((SQ(diff.x) + SQ(diff.z)) <= SQ(xzRange)) && (0.0f <= diff.y) && (diff.y <= yRange);
} else {
@@ -691,8 +690,8 @@ s32 Player_HasMirrorShieldSetToDraw(PlayState* play) {
return (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && (this->currentShield == PLAYER_SHIELD_MIRROR);
}
s32 Player_ActionToMagicSpell(Player* this, s32 actionParam) {
s32 magicSpell = actionParam - PLAYER_AP_MAGIC_SPELL_15;
s32 Player_ActionToMagicSpell(Player* this, s32 itemAction) {
s32 magicSpell = itemAction - PLAYER_IA_MAGIC_SPELL_15;
if ((magicSpell >= 0) && (magicSpell < 6)) {
return magicSpell;
@@ -702,15 +701,15 @@ s32 Player_ActionToMagicSpell(Player* this, s32 actionParam) {
}
s32 Player_HoldsHookshot(Player* this) {
return (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) || (this->heldItemActionParam == PLAYER_AP_LONGSHOT);
return (this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT);
}
s32 func_8008F128(Player* this) {
return Player_HoldsHookshot(this) && (this->heldActor == NULL);
}
s32 Player_ActionToMeleeWeapon(s32 actionParam) {
s32 meleeWeapon = actionParam - PLAYER_AP_FISHING_POLE;
s32 Player_ActionToMeleeWeapon(s32 itemAction) {
s32 meleeWeapon = itemAction - PLAYER_IA_FISHING_POLE;
if ((meleeWeapon > 0) && (meleeWeapon < 6)) {
return meleeWeapon;
@@ -720,11 +719,11 @@ s32 Player_ActionToMeleeWeapon(s32 actionParam) {
}
s32 Player_GetMeleeWeaponHeld(Player* this) {
return Player_ActionToMeleeWeapon(this->heldItemActionParam);
return Player_ActionToMeleeWeapon(this->heldItemAction);
}
s32 Player_HoldsTwoHandedWeapon(Player* this) {
if ((this->heldItemActionParam >= PLAYER_AP_SWORD_BGS) && (this->heldItemActionParam <= PLAYER_AP_HAMMER)) {
if ((this->heldItemAction >= PLAYER_IA_SWORD_BGS) && (this->heldItemAction <= PLAYER_IA_HAMMER)) {
return 1;
} else {
return 0;
@@ -732,11 +731,11 @@ s32 Player_HoldsTwoHandedWeapon(Player* this) {
}
s32 Player_HoldsBrokenKnife(Player* this) {
return (this->heldItemActionParam == PLAYER_AP_SWORD_BGS) && (gSaveContext.swordHealth <= 0.0f);
return (this->heldItemAction == PLAYER_IA_SWORD_BGS) && (gSaveContext.swordHealth <= 0.0f);
}
s32 Player_ActionToBottle(Player* this, s32 actionParam) {
s32 bottle = actionParam - PLAYER_AP_BOTTLE;
s32 Player_ActionToBottle(Player* this, s32 itemAction) {
s32 bottle = itemAction - PLAYER_IA_BOTTLE;
if ((bottle >= 0) && (bottle < 13)) {
return bottle;
@@ -746,11 +745,11 @@ s32 Player_ActionToBottle(Player* this, s32 actionParam) {
}
s32 Player_GetBottleHeld(Player* this) {
return Player_ActionToBottle(this, this->heldItemActionParam);
return Player_ActionToBottle(this, this->heldItemAction);
}
s32 Player_ActionToExplosive(Player* this, s32 actionParam) {
s32 explosive = actionParam - PLAYER_AP_BOMB;
s32 Player_ActionToExplosive(Player* this, s32 itemAction) {
s32 explosive = itemAction - PLAYER_IA_BOMB;
if ((explosive >= 0) && (explosive < 2)) {
return explosive;
@@ -760,14 +759,14 @@ s32 Player_ActionToExplosive(Player* this, s32 actionParam) {
}
s32 Player_GetExplosiveHeld(Player* this) {
return Player_ActionToExplosive(this, this->heldItemActionParam);
return Player_ActionToExplosive(this, this->heldItemAction);
}
s32 func_8008F2BC(Player* this, s32 actionParam) {
s32 func_8008F2BC(Player* this, s32 itemAction) {
s32 sword = 0;
if (actionParam != PLAYER_AP_LAST_USED) {
sword = actionParam - PLAYER_AP_SWORD_MASTER;
if (itemAction != PLAYER_IA_LAST_USED) {
sword = itemAction - PLAYER_IA_SWORD_MASTER;
if ((sword < 0) || (sword >= 3)) {
goto return_neg;
}
@@ -979,7 +978,7 @@ void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* p
s32 temp3;
if ((this->actor.scale.y >= 0.0f) && !(this->stateFlags1 & PLAYER_STATE1_7) &&
(Player_ActionToMagicSpell(this, this->itemActionParam) < 0)) {
(Player_ActionToMagicSpell(this, this->itemAction) < 0)) {
s32 pad;
sp7C = D_80126058[(void)0, gSaveContext.linkAge];
@@ -1454,7 +1453,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
Math_Vec3f_Copy(&this->leftHandPos, sCurBodyPartPos);
if (this->itemActionParam == PLAYER_AP_STICK) {
if (this->itemAction == PLAYER_IA_STICK) {
Vec3f sp124[3];
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2633);
@@ -1490,7 +1489,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
func_80090A28(this, spE4);
func_800906D4(play, this, spE4);
} else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) {
Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemActionParam)];
Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemAction)];
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2710);
@@ -1580,8 +1579,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
}
if (this->actor.scale.y >= 0.0f) {
if ((this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ||
(this->heldItemActionParam == PLAYER_AP_LONGSHOT)) {
if ((this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT)) {
Matrix_MultVec3f(&D_80126184, &this->unk_3C8);
if (heldActor != NULL) {
@@ -1596,8 +1594,8 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
if (func_8002DD78(this) != 0) {
Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY);
Player_DrawHookshotReticle(
play, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f);
Player_DrawHookshotReticle(play, this,
(this->heldItemAction == PLAYER_IA_HOOKSHOT) ? 38600.0f : 77600.0f);
}
}
}
+1 -1
View File
@@ -397,7 +397,7 @@ void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) {
play->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId;
if (gSaveContext.seqId == (u8)NA_BGM_DISABLED) {
Audio_QueueSeqCmd(cmd->soundSettings.specId | 0xF0000000);
SEQCMD_RESET_AUDIO_HEAP(0, cmd->soundSettings.specId);
}
}
@@ -84,7 +84,7 @@ void ArmsHook_Wait(ArmsHook* this, PlayState* play) {
if (this->actor.parent == NULL) {
Player* player = GET_PLAYER(play);
// get correct timer length for hookshot or longshot
s32 length = (player->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 13 : 26;
s32 length = (player->heldItemAction == PLAYER_IA_HOOKSHOT) ? 13 : 26;
ArmsHook_SetupAction(this, ArmsHook_Shoot);
func_8002D9A4(&this->actor, 20.0f);
@@ -120,7 +120,7 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) {
Player* player = (Player*)this->actor.parent;
if (Player_HoldsHookshot(player)) {
if ((player->itemActionParam != player->heldItemActionParam) || (player->actor.flags & ACTOR_FLAG_8) ||
if ((player->itemAction != player->heldItemAction) || (player->actor.flags & ACTOR_FLAG_8) ||
((player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_26)))) {
this->timer = 0;
ArmsHook_DetachHookFromActor(this);
@@ -1,18 +1,27 @@
/*
* File: z_bg_ice_shelter.c
* Overlay: Bg_Ice_Shelter
* Description: Red Ice
*/
#include "z_bg_ice_shelter.h"
#include "assets/objects/object_ice_objects/object_ice_objects.h"
#define FLAGS 0
#define BGICESHELTER_GET_TYPE(thisx) (((thisx)->params >> 8) & 7)
#define BGICESHELTER_NO_SWITCH_FLAG(thisx) (((thisx)->params >> 6) & 1)
void BgIceShelter_Init(Actor* thisx, PlayState* play);
void BgIceShelter_Destroy(Actor* thisx, PlayState* play);
void BgIceShelter_Update(Actor* thisx, PlayState* play);
void BgIceShelter_Draw(Actor* thisx, PlayState* play2);
void func_80891064(BgIceShelter* this);
void func_808911BC(BgIceShelter* this);
void BgIceShelter_SetupIdle(BgIceShelter* this);
void BgIceShelter_SetupMelt(BgIceShelter* this);
void func_8089107C(BgIceShelter* this, PlayState* play);
void func_808911D4(BgIceShelter* this, PlayState* play);
void BgIceShelter_Idle(BgIceShelter* this, PlayState* play);
void BgIceShelter_Melt(BgIceShelter* this, PlayState* play);
const ActorInit Bg_Ice_Shelter_InitVars = {
ACTOR_BG_ICE_SHELTER,
@@ -26,12 +35,12 @@ const ActorInit Bg_Ice_Shelter_InitVars = {
(ActorFunc)BgIceShelter_Draw,
};
static f32 sScales[] = { 0.1f, 0.06f, 0.1f, 0.1f, 0.25f };
static f32 sRedIceScales[] = { 0.1f, 0.06f, 0.1f, 0.1f, 0.25f };
static Color_RGBA8 sDustPrimColor = { 250, 250, 250, 255 };
static Color_RGBA8 sDustEnvColor = { 180, 180, 180, 255 };
static Color_RGBA8 sSteamPrimColor = { 250, 250, 250, 255 };
static Color_RGBA8 sSteamEnvColor = { 180, 180, 180, 255 };
static ColliderCylinderInit D_8089170C = {
static ColliderCylinderInit sCylinderInit1 = {
{
COLTYPE_NONE,
AT_NONE,
@@ -51,7 +60,7 @@ static ColliderCylinderInit D_8089170C = {
{ 0, 0, 0, { 0, 0, 0 } },
};
static ColliderCylinderInit D_80891738 = {
static ColliderCylinderInit sCylinderInit2 = {
{
COLTYPE_HARD,
AT_NONE,
@@ -71,34 +80,39 @@ static ColliderCylinderInit D_80891738 = {
{ 0, 0, 0, { 0, 0, 0 } },
};
void func_80890740(BgIceShelter* this, PlayState* play) {
/**
* Initializes either one or both cylinder colliders, depending on the actor's type.
*/
void BgIceShelter_InitColliders(BgIceShelter* this, PlayState* play) {
static s16 cylinderRadii[] = { 47, 33, 44, 41, 100 };
static s16 cylinderHeights[] = { 80, 54, 90, 60, 200 };
s32 pad;
s32 type = (this->dyna.actor.params >> 8) & 7;
s32 type = BGICESHELTER_GET_TYPE(&this->dyna.actor);
// All types use at least one collider in order to detect blue fire
Collider_InitCylinder(play, &this->cylinder1);
Collider_SetCylinder(play, &this->cylinder1, &this->dyna.actor, &D_8089170C);
Collider_SetCylinder(play, &this->cylinder1, &this->dyna.actor, &sCylinderInit1);
Collider_UpdateCylinder(&this->dyna.actor, &this->cylinder1);
this->cylinder1.dim.radius = cylinderRadii[type];
this->cylinder1.dim.height = cylinderHeights[type];
if (type == 0 || type == 1 || type == 4) {
// The wall and platform types use DynaPoly for collision, so they don't need the second collider
if (type == RED_ICE_LARGE || type == RED_ICE_SMALL || type == RED_ICE_KING_ZORA) {
Collider_InitCylinder(play, &this->cylinder2);
Collider_SetCylinder(play, &this->cylinder2, &this->dyna.actor, &D_80891738);
Collider_SetCylinder(play, &this->cylinder2, &this->dyna.actor, &sCylinderInit2);
Collider_UpdateCylinder(&this->dyna.actor, &this->cylinder2);
this->cylinder2.dim.radius = cylinderRadii[type];
this->cylinder2.dim.height = cylinderHeights[type];
}
if (type == 4) {
if (type == RED_ICE_KING_ZORA) {
this->cylinder1.dim.pos.z += 30;
this->cylinder2.dim.pos.z += 30;
}
}
void func_80890874(BgIceShelter* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
void BgIceShelter_InitDynaPoly(BgIceShelter* this, PlayState* play, CollisionHeader* collision, s32 moveFlag) {
s32 pad;
CollisionHeader* colHeader = NULL;
s32 pad2;
@@ -114,7 +128,7 @@ void func_80890874(BgIceShelter* this, PlayState* play, CollisionHeader* collisi
}
}
void func_808908FC(Vec3f* dest, Vec3f* src, s16 angle) {
void BgIceShelter_RotateY(Vec3f* dest, Vec3f* src, s16 angle) {
f32 sin = Math_SinS(angle);
f32 cos = Math_CosS(angle);
@@ -132,42 +146,45 @@ static InitChainEntry sInitChain[] = {
void BgIceShelter_Init(Actor* thisx, PlayState* play) {
static Vec3f kzIceScale = { 0.18f, 0.27f, 0.24f };
BgIceShelter* this = (BgIceShelter*)thisx;
s16 type = (this->dyna.actor.params >> 8) & 7;
s16 type = BGICESHELTER_GET_TYPE(&this->dyna.actor);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (type == 4) {
if (type == RED_ICE_KING_ZORA) {
this->dyna.actor.world.rot.x += 0xBB8;
this->dyna.actor.world.pos.y -= 45.0f;
this->dyna.actor.shape.rot.x = this->dyna.actor.world.rot.x;
this->dyna.actor.world.pos.z -= 38.0f;
}
if (type == 4) {
if (type == RED_ICE_KING_ZORA) {
Math_Vec3f_Copy(&this->dyna.actor.scale, &kzIceScale);
} else {
Actor_SetScale(&this->dyna.actor, sScales[type]);
Actor_SetScale(&this->dyna.actor, sRedIceScales[type]);
}
// Only 2 types use DynaPoly
switch (type) {
case 2:
func_80890874(this, play, &object_ice_objects_Col_001C1C, 0);
case RED_ICE_PLATFORM:
BgIceShelter_InitDynaPoly(this, play, &gRedIcePlatformCol, 0);
break;
case 3:
func_80890874(this, play, &object_ice_objects_Col_002920, 0);
case RED_ICE_WALL:
BgIceShelter_InitDynaPoly(this, play, &gRedIceWallCol, 0);
break;
}
func_80890740(this, play);
// All types use at least one collider
BgIceShelter_InitColliders(this, play);
this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE;
if (!((this->dyna.actor.params >> 6) & 1) && (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F))) {
// The only red ice actor in the game that doesn't use a switch flag is the one for King Zora
if (!BGICESHELTER_NO_SWITCH_FLAG(&this->dyna.actor) && (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F))) {
Actor_Kill(&this->dyna.actor);
return;
}
func_80891064(this);
BgIceShelter_SetupIdle(this);
osSyncPrintf("(ice shelter)(arg_data 0x%04x)\n", this->dyna.actor.params);
}
@@ -175,15 +192,15 @@ void BgIceShelter_Init(Actor* thisx, PlayState* play) {
void BgIceShelter_Destroy(Actor* thisx, PlayState* play) {
BgIceShelter* this = (BgIceShelter*)thisx;
switch ((this->dyna.actor.params >> 8) & 7) {
case 2:
case 3:
switch (BGICESHELTER_GET_TYPE(&this->dyna.actor)) {
case RED_ICE_PLATFORM:
case RED_ICE_WALL:
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
break;
case 0:
case 1:
case 4:
case RED_ICE_LARGE:
case RED_ICE_SMALL:
case RED_ICE_KING_ZORA:
Collider_DestroyCylinder(play, &this->cylinder2);
break;
}
@@ -191,126 +208,155 @@ void BgIceShelter_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->cylinder1);
}
static s16 D_80891794[] = { 0x0000, 0x4000, 0x2000, 0x6000, 0x1000, 0x5000, 0x3000, 0x7000 };
static s16 D_808917A4[] = { 0x0000, 0x003C, 0x0018, 0x0054, 0x0030, 0x000C, 0x0048, 0x0024 };
/**
* Angles used to spawn steam particles in a circle.
*/
static s16 sSteamCircleAngles[] = { 0x0000, 0x4000, 0x2000, 0x6000, 0x1000, 0x5000, 0x3000, 0x7000 };
void func_80890B8C(BgIceShelter* this, PlayState* play, f32 chance, f32 scale) {
/**
* Positions used to spawn steam particles in a straight line.
*/
static s16 sSteamLinePositions[] = { 0x0000, 0x003C, 0x0018, 0x0054, 0x0030, 0x000C, 0x0048, 0x0024 };
/**
* Spawns steam particle effects in a circle around the ice block.
*
* On each frame the function is called, two particles have a chance to appear, at the same distance and opposite
* sides from the center.
*/
void BgIceShelter_SpawnSteamAround(BgIceShelter* this, PlayState* play, f32 particleSpawningChance,
f32 steamEffectScale) {
f32 cos;
f32 sin;
f32 xzOffset;
f32 distance;
Vec3f* icePos;
s16 angle;
s16 frames;
s16 frameCounter;
s32 i;
s32 pad[2];
Vec3f dustPos;
Vec3f dustVel;
Vec3f dustAccel;
Vec3f steamPos;
Vec3f steamVel;
Vec3f steamAccel;
frames = (s16)play->state.frames & 7;
frameCounter = (s16)play->state.frames & 7;
for (i = 0; i < 2; i++) {
if (chance < Rand_ZeroOne()) {
if (particleSpawningChance < Rand_ZeroOne()) {
continue;
}
xzOffset = 42.0f * scale;
// The steamEffectScale is used here to make the particles appear at the edges of the red ice.
distance = 42.0f * steamEffectScale;
icePos = &this->dyna.actor.world.pos;
angle = D_80891794[frames] + (i * 0x8000);
angle = sSteamCircleAngles[frameCounter] + (i * 0x8000);
sin = Math_SinS(angle);
cos = Math_CosS(angle);
dustPos.x = (xzOffset * sin) + icePos->x;
dustPos.y = (16.0f * scale) + icePos->y;
dustPos.z = (xzOffset * cos) + icePos->z;
steamPos.x = (distance * sin) + icePos->x;
steamPos.y = (16.0f * steamEffectScale) + icePos->y;
steamPos.z = (distance * cos) + icePos->z;
dustVel.x = ((Rand_ZeroOne() * 3.0f) - 1.0f) * sin;
dustVel.y = 0.0f;
dustVel.z = ((Rand_ZeroOne() * 3.0f) - 1.0f) * cos;
steamVel.x = ((Rand_ZeroOne() * 3.0f) - 1.0f) * sin;
steamVel.y = 0.0f;
steamVel.z = ((Rand_ZeroOne() * 3.0f) - 1.0f) * cos;
dustAccel.x = 0.07f * sin;
dustAccel.y = 0.8f;
dustAccel.z = 0.07f * cos;
steamAccel.x = 0.07f * sin;
steamAccel.y = 0.8f;
steamAccel.z = 0.07f * cos;
func_8002829C(play, &dustPos, &dustVel, &dustAccel, &sDustPrimColor, &sDustEnvColor, 450.0f * scale,
(s16)((Rand_ZeroOne() * 40.0f) + 40.0f) * scale);
func_8002829C(play, &steamPos, &steamVel, &steamAccel, &sSteamPrimColor, &sSteamEnvColor,
450.0f * steamEffectScale, (s16)((Rand_ZeroOne() * 40.0f) + 40.0f) * steamEffectScale);
}
}
void func_80890E00(BgIceShelter* this, PlayState* play, f32 chance, f32 arg3) {
static f32 D_808917B4[] = { -1.0f, 1.0f };
/**
* Spawns steam particle effects in a straight line. Only used for the ice wall type.
*
* On each frame the function is called, two particles have a chance to appear, at the same distance and opposite
* sides from the midpoint.
*
* The last argument is unused because only one red ice type can call this function, so the scale isn't needed.
*/
void BgIceShelter_SpawnSteamAlong(BgIceShelter* this, PlayState* play, f32 particleSpawningChance, f32 unusedArg) {
static f32 signs[] = { -1.0f, 1.0f };
Vec3f* icePos;
s16 frames;
s16 frameCounter;
s32 pad[2];
Vec3f dustPos;
Vec3f dustVel;
Vec3f dustAccel;
Vec3f steamPos;
Vec3f steamVel;
Vec3f steamAccel;
Vec3f posOffset;
s32 i;
frames = (s16)play->state.frames & 7;
frameCounter = (s16)play->state.frames & 7;
for (i = 0; i < 2; i++) {
icePos = &this->dyna.actor.world.pos;
if (chance < Rand_ZeroOne()) {
if (particleSpawningChance < Rand_ZeroOne()) {
continue;
}
posOffset.x = (D_808917A4[frames] + ((Rand_ZeroOne() * 12.0f) - 6.0f)) * D_808917B4[i];
posOffset.x = (sSteamLinePositions[frameCounter] + ((Rand_ZeroOne() * 12.0f) - 6.0f)) * signs[i];
posOffset.y = 15.0f;
posOffset.z = ((84.0f - posOffset.x) * 0.2f) + (Rand_ZeroOne() * 20.0f);
func_808908FC(&dustPos, &posOffset, this->dyna.actor.world.rot.y);
Math_Vec3f_Sum(&dustPos, icePos, &dustPos);
// Convert the position offset from relative to the ice wall to absolute.
BgIceShelter_RotateY(&steamPos, &posOffset, this->dyna.actor.world.rot.y);
Math_Vec3f_Sum(&steamPos, icePos, &steamPos);
dustVel.x = (Rand_ZeroOne() * 3.0f) - 1.5f;
dustVel.y = 0.0f;
dustVel.z = (Rand_ZeroOne() * 3.0f) - 1.5f;
steamVel.x = (Rand_ZeroOne() * 3.0f) - 1.5f;
steamVel.y = 0.0f;
steamVel.z = (Rand_ZeroOne() * 3.0f) - 1.5f;
dustAccel.x = (Rand_ZeroOne() * 0.14f) - 0.07f;
dustAccel.y = 0.8f;
dustAccel.z = (Rand_ZeroOne() * 0.14f) - 0.07f;
steamAccel.x = (Rand_ZeroOne() * 0.14f) - 0.07f;
steamAccel.y = 0.8f;
steamAccel.z = (Rand_ZeroOne() * 0.14f) - 0.07f;
func_8002829C(play, &dustPos, &dustVel, &dustAccel, &sDustPrimColor, &sDustEnvColor, 450,
func_8002829C(play, &steamPos, &steamVel, &steamAccel, &sSteamPrimColor, &sSteamEnvColor, 450,
(Rand_ZeroOne() * 40.0f) + 40.0f);
}
}
void func_80891064(BgIceShelter* this) {
this->actionFunc = func_8089107C;
void BgIceShelter_SetupIdle(BgIceShelter* this) {
this->actionFunc = BgIceShelter_Idle;
this->alpha = 255;
}
void func_8089107C(BgIceShelter* this, PlayState* play) {
/**
* Checks for collision with blue fire. Also used to freeze King Zora's actor.
*/
void BgIceShelter_Idle(BgIceShelter* this, PlayState* play) {
s32 pad;
s16 type = (this->dyna.actor.params >> 8) & 7;
s16 type = BGICESHELTER_GET_TYPE(&this->dyna.actor);
if (type == 4) {
// Freeze King Zora
if (type == RED_ICE_KING_ZORA) {
if (this->dyna.actor.parent != NULL) {
this->dyna.actor.parent->freezeTimer = 10000;
}
}
// Detect blue fire
if (this->cylinder1.base.acFlags & AC_HIT) {
this->cylinder1.base.acFlags &= ~AC_HIT;
if ((this->cylinder1.base.ac != NULL) && (this->cylinder1.base.ac->id == ACTOR_EN_ICE_HONO)) {
if (type == 4) {
if (type == RED_ICE_KING_ZORA) {
if (this->dyna.actor.parent != NULL) {
this->dyna.actor.parent->freezeTimer = 50;
}
}
func_808911BC(this);
BgIceShelter_SetupMelt(this);
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_ICE_MELT);
}
}
switch (type) {
case 0:
case 1:
case 4:
case RED_ICE_LARGE:
case RED_ICE_SMALL:
case RED_ICE_KING_ZORA:
CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder1.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder2.base);
break;
@@ -319,57 +365,73 @@ void func_8089107C(BgIceShelter* this, PlayState* play) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder1.base);
}
void func_808911BC(BgIceShelter* this) {
this->actionFunc = func_808911D4;
void BgIceShelter_SetupMelt(BgIceShelter* this) {
this->actionFunc = BgIceShelter_Melt;
this->alpha = 255;
}
static f32 D_808917BC[] = { -0.0015f, -0.0009f, -0.0016f, -0.0016f, -0.00375f };
static f32 D_808917D0[] = { 1.0f, 0.6f, 1.2f, 1.0f, 1.8f };
/**
* Values added to the ice block's height every frame while it's melting.
*/
static f32 sMeltingRates[] = { -0.0015f, -0.0009f, -0.0016f, -0.0016f, -0.00375f };
static void (*sEffSpawnFuncs[])(BgIceShelter* this, PlayState* play, f32 chance, f32 scale) = {
func_80890B8C, func_80890B8C, func_80890B8C, func_80890E00, func_80890B8C,
/**
* Values used to scale and position the steam effects so they match the ice block's size.
*/
static f32 sSteamEffectScales[] = { 1.0f, 0.6f, 1.2f, 1.0f, 1.8f };
/**
* Functions used to spawn steam effects at the base of the red ice.
*/
static void (*sSteamSpawnFuncs[])(BgIceShelter* this, PlayState* play, f32 particleSpawningChance,
f32 steamEffectScale) = {
BgIceShelter_SpawnSteamAround, BgIceShelter_SpawnSteamAround, BgIceShelter_SpawnSteamAround,
BgIceShelter_SpawnSteamAlong, BgIceShelter_SpawnSteamAround,
};
void func_808911D4(BgIceShelter* this, PlayState* play) {
/**
* Progressively reduces the height and opacity of the red ice, while spawning steam effects at its base.
*/
void BgIceShelter_Melt(BgIceShelter* this, PlayState* play) {
s32 pad;
s32 type = (this->dyna.actor.params >> 8) & 7;
f32 phi_f0;
s32 type = BGICESHELTER_GET_TYPE(&this->dyna.actor);
f32 particleSpawningChance;
this->alpha -= 5;
this->alpha = CLAMP(this->alpha, 0, 255);
this->dyna.actor.scale.y += D_808917BC[type];
this->dyna.actor.scale.y += sMeltingRates[type];
this->dyna.actor.scale.y = CLAMP_MIN(this->dyna.actor.scale.y, 0.0001f);
if (this->alpha > 80) {
switch (type) {
case 0:
case 1:
case 4:
case RED_ICE_LARGE:
case RED_ICE_SMALL:
case RED_ICE_KING_ZORA:
CollisionCheck_SetOC(play, &play->colChkCtx, &this->cylinder1.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->cylinder2.base);
break;
}
}
// As the ice melts, the steam intensity is reduced by lowering the chance of each steam particle to appear
if (this->alpha > 180) {
phi_f0 = 1.0f;
particleSpawningChance = 1.0f;
} else if (this->alpha > 60) {
phi_f0 = 0.5f;
particleSpawningChance = 0.5f;
} else {
phi_f0 = 0.0f;
particleSpawningChance = 0.0f;
}
sEffSpawnFuncs[type](this, play, phi_f0, D_808917D0[type]);
sSteamSpawnFuncs[type](this, play, particleSpawningChance, sSteamEffectScales[type]);
if (this->alpha <= 0) {
if (!((this->dyna.actor.params >> 6) & 1)) {
if (!BGICESHELTER_NO_SWITCH_FLAG(&this->dyna.actor)) {
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
}
if (type == 4) {
if (type == RED_ICE_KING_ZORA) {
func_80078884(NA_SE_SY_CORRECT_CHIME);
}
@@ -394,29 +456,29 @@ void BgIceShelter_Draw(Actor* thisx, PlayState* play2) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_ice_shelter.c", 751),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
switch ((this->dyna.actor.params >> 8) & 7) {
case 0:
case 1:
case 2:
case 4:
switch (BGICESHELTER_GET_TYPE(&this->dyna.actor)) {
case RED_ICE_LARGE:
case RED_ICE_SMALL:
case RED_ICE_PLATFORM:
case RED_ICE_KING_ZORA:
func_8002ED80(&this->dyna.actor, play, 0);
break;
}
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, this->alpha);
switch ((this->dyna.actor.params >> 8) & 7) {
case 0:
case 1:
case 4:
switch (BGICESHELTER_GET_TYPE(&this->dyna.actor)) {
case RED_ICE_LARGE:
case RED_ICE_SMALL:
case RED_ICE_KING_ZORA:
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, -play->gameplayFrames & 0x7F,
-play->gameplayFrames & 0x7F, 0x20, 0x20, 1, -play->gameplayFrames & 0x7F,
play->gameplayFrames & 0x7F, 0x20, 0x20));
gSPDisplayList(POLY_XLU_DISP++, object_ice_objects_DL_0006F0);
gSPDisplayList(POLY_XLU_DISP++, gRedIceBlockDL);
break;
case 2:
case RED_ICE_PLATFORM:
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, play->gameplayFrames & 0xFF, 0x40, 0x40,
1, 0, -play->gameplayFrames & 0xFF, 0x40, 0x40));
@@ -424,11 +486,11 @@ void BgIceShelter_Draw(Actor* thisx, PlayState* play2) {
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, -play->gameplayFrames & 0xFF,
play->gameplayFrames & 0xFF, 0x40, 0x40, 1, play->gameplayFrames & 0xFF,
play->gameplayFrames & 0xFF, 0x40, 0x40));
gSPDisplayList(POLY_XLU_DISP++, object_ice_objects_DL_0012A0);
gSPDisplayList(POLY_XLU_DISP++, gRedIcePlatformDL);
break;
case 3:
gSPDisplayList(POLY_XLU_DISP++, object_ice_objects_DL_002640);
case RED_ICE_WALL:
gSPDisplayList(POLY_XLU_DISP++, gRedIceWallDL);
break;
}
@@ -8,11 +8,19 @@ struct BgIceShelter;
typedef void (*BgIceShelterActionFunc)(struct BgIceShelter*, PlayState*);
typedef enum {
/* 0 */ RED_ICE_LARGE, // Large red ice block
/* 1 */ RED_ICE_SMALL, // Small red ice block
/* 2 */ RED_ICE_PLATFORM, // Complex structure that can be climbed and walked on. Unused in vanilla OoT, used in MQ to cover the Ice Cavern Map chest
/* 3 */ RED_ICE_WALL, // Vertical ice sheets blocking corridors
/* 4 */ RED_ICE_KING_ZORA // Giant red ice block covering King Zora
} RedIceType;
typedef struct BgIceShelter {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgIceShelterActionFunc actionFunc;
/* 0x0168 */ ColliderCylinder cylinder1;
/* 0x01B4 */ ColliderCylinder cylinder2;
/* 0x0168 */ ColliderCylinder cylinder1; // Used to detect blue fire and also as OC for no-dynapoly types
/* 0x01B4 */ ColliderCylinder cylinder2; // Only used by no-dynapoly types to make weapons bounce off
/* 0x0200 */ s16 alpha;
} BgIceShelter; // size = 0x0204
@@ -107,8 +107,8 @@ void func_808BAF40(BgTokiSwd* this, PlayState* play) {
} else {
play->csCtx.segment = D_808BB7A0;
}
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_MASTER_SWORD);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_MASTER_SWORD);
gSaveContext.cutsceneTrigger = 1;
this->actor.parent = NULL;
BgTokiSwd_SetupAction(this, func_808BB0AC);
@@ -399,7 +399,7 @@ void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play) {
if (Flags_GetSwitch(play, this->burnSwitchFlag) || (this->trisCollider.base.acFlags & AC_HIT)) {
this->dyna.actor.home.pos.y = this->dyna.actor.world.pos.y + 80.0f;
BgYdanSp_BurnWeb(this, play);
} else if (player->heldItemActionParam == PLAYER_AP_STICK && player->unk_860 != 0) {
} else if (player->heldItemAction == PLAYER_IA_STICK && player->unk_860 != 0) {
func_8002DBD0(&this->dyna.actor, &sp30, &player->meleeWeaponInfo[0].tip);
if (fabsf(sp30.x) < 100.0f && sp30.z < 1.0f && sp30.y < 200.0f) {
OnePointCutscene_Init(play, 3020, 40, &this->dyna.actor, CAM_ID_MAIN);
@@ -319,7 +319,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, PlayState* play) {
BossDodongo_Walk(this, play);
if (this->unk_196 == 1) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
}
if (this->unk_196 == 0) {
@@ -407,7 +407,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, PlayState* play) {
SEGMENTED_TO_VIRTUAL(&object_kingdodongo_Blob_017410), 0xA0, 0xB4, 0x80,
0x28);
}
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_FIRE_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_FIRE_BOSS);
}
if (this->unk_198 == 0) {
@@ -1284,7 +1284,7 @@ void BossDodongo_SetupDeathCutscene(BossDodongo* this) {
this->csState = 0;
this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2);
this->unk_1BC = 1;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
}
void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play) {
@@ -1598,7 +1598,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play) {
}
if (this->unk_1DA == 820) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS_CLEAR);
Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART,
Math_SinS(this->actor.shape.rot.y) * -50.0f + this->actor.world.pos.x,
this->actor.world.pos.y,
+3 -3
View File
@@ -185,7 +185,7 @@ void BossFd_Init(Actor* thisx, PlayState* play) {
SkelAnime_Init(play, &this->skelAnimeLeftArm, &gVolvagiaLeftArmSkel, &gVolvagiaLeftArmEmergeAnim, NULL, NULL, 0);
this->introState = BFD_CS_WAIT;
if (this->introState == BFD_CS_NONE) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_FIRE_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_FIRE_BOSS);
}
this->actor.world.pos.x = this->actor.world.pos.z = 0.0f;
@@ -486,7 +486,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
this->subCamAtYOffset = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->subCamShake;
}
if (this->timers[3] == 160) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_FIRE_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_FIRE_BOSS);
}
if ((this->timers[3] == 130) && !GET_EVENTCHKINF(EVENTCHKINF_73)) {
TitleCard_InitBossName(play, &play->actorCtx.titleCtx,
@@ -743,7 +743,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
if (this->skinSegments != 0) {
this->skinSegments--;
if (this->skinSegments == 0) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS_CLEAR);
}
} else {
this->work[BFD_ACTION_STATE] = BOSSFD_BONES_FALL;
@@ -884,7 +884,7 @@ void BossFd2_CollisionCheck(BossFd2* this, PlayState* play) {
BossFd2_SetupDeath(this, play);
this->work[FD2_DAMAGE_FLASH_TIMER] = 10;
this->work[FD2_INVINC_TIMER] = 30000;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_VALVAISA_DEAD);
Enemy_StartFinishingBlow(play, &this->actor);
} else if (damage) {
@@ -575,7 +575,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
this->unk_198 = 2;
this->timers[2] = 110;
gSaveContext.healthAccumulator = 0x140;
Audio_QueueSeqCmd(NA_BGM_STOP);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
} else {
this->useOpenHand = true;
BossGanon_SetIntroCsCamera(this, 0);
@@ -807,7 +807,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
BossGanon_SetIntroCsCamera(this, 9);
if (this->csTimer == 30) {
Audio_QueueSeqCmd(0x100100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfStopPlayingOrganAnim);
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfStopPlayingOrganAnim, -5.0f);
}
@@ -1074,7 +1074,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
sCape->attachShouldersTimer = 18.0f;
Audio_PlayActorSfx2(&this->actor, NA_SE_EV_GANON_MANTLE);
this->unk_198 = 0;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_GANONDORF_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_GANONDORF_BOSS);
}
if (this->csTimer == 50) {
@@ -2738,7 +2738,7 @@ void BossGanon_UpdateDamage(BossGanon* this, PlayState* play) {
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GANON_DEAD);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GANON_DD_THUNDER);
func_80078914(&sZeroVec, NA_SE_EN_LAST_DAMAGE);
Audio_QueueSeqCmd(0x100100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
this->screenFlashTimer = 4;
} else {
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GANON_DAMAGE2);
@@ -296,7 +296,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
this->unk_339 = 4;
if (this->unk_398 == 10) {
func_80078914(&D_80906D6C, NA_SE_EV_STONE_BOUND);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
}
if (this->unk_398 == 20) {
sZelda->unk_3C8 = 3;
@@ -447,7 +447,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
this->actor.world.pos.x = -200.0f;
this->actor.world.pos.y = this->actor.world.pos.y - 30.0f;
this->actor.world.pos.z = -200.0f;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_OPENING_GANON);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_OPENING_GANON);
} else {
break;
}
@@ -592,7 +592,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
case 18:
this->unk_339 = 6;
if (this->unk_398 == 30) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_GANON_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_GANON_BOSS);
}
Math_ApproachF(&this->unk_30C, 7.0f, 1.0f, 0.1f);
Math_ApproachF(&this->subCamEye.x, (this->actor.world.pos.x + 500.0f) - 350.0f, 0.1f, 1.0f);
@@ -1636,7 +1636,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
temp_f12 = this->unk_1B8.z - player->actor.world.pos.z;
temp_a0_2 = Math_Atan2S(temp_f12, temp_f14) - player->actor.shape.rot.y;
if ((ABS(temp_a0_2) < 0x2000) && (sqrtf(SQ(temp_f14) + SQ(temp_f12)) < 70.0f) &&
(player->meleeWeaponState != 0) && (player->heldItemActionParam == PLAYER_AP_SWORD_MASTER)) {
(player->meleeWeaponState != 0) && (player->heldItemAction == PLAYER_IA_SWORD_MASTER)) {
func_80064520(play, &play->csCtx);
this->subCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
@@ -1694,7 +1694,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
this->subCamAt.z = D_80907050[phi_a1].z + player->actor.world.pos.z;
}
if (this->unk_398 > 80) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
this->unk_39C = 75;
this->unk_398 = 0;
this->subCamEye.x = 112.0f;
@@ -928,7 +928,7 @@ void BossGanondrof_SetupDeath(BossGanondrof* this, PlayState* play) {
Animation_PlayOnce(&this->skelAnime, &gPhantomGanonDeathBlowAnim);
this->fwork[GND_END_FRAME] = Animation_GetLastFrame(&gPhantomGanonDeathBlowAnim);
this->actionFunc = BossGanondrof_Death;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FANTOM_DEAD);
this->deathState = DEATH_START;
this->actor.flags &= ~ACTOR_FLAG_0;
@@ -1101,7 +1101,7 @@ void BossGanondrof_Death(BossGanondrof* this, PlayState* play) {
holdCamera = true;
bodyDecayLevel = 10;
if (this->timers[0] == 150) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS_CLEAR);
Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, GND_BOSSROOM_CENTER_X, GND_BOSSROOM_CENTER_Y,
GND_BOSSROOM_CENTER_Z, 0, 0, 0, WARP_DUNGEON_ADULT);
}
@@ -407,7 +407,7 @@ void BossGoma_SetupDefeated(BossGoma* this, PlayState* play) {
this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2);
this->actor.speedXZ = 0.0f;
this->actor.shape.shadowScale = 0.0f;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GOMA_DEAD);
}
@@ -659,7 +659,7 @@ void BossGoma_SetupEncounterState4(BossGoma* this, PlayState* play) {
this->subCamAt.y = this->actor.world.pos.y;
this->subCamAt.z = this->actor.world.pos.z;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
}
/**
@@ -924,7 +924,7 @@ void BossGoma_Encounter(BossGoma* this, PlayState* play) {
0xA0, 0xB4, 0x80, 0x28);
}
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
SET_EVENTCHKINF(EVENTCHKINF_70);
}
@@ -1108,7 +1108,7 @@ void BossGoma_Defeated(BossGoma* this, PlayState* play) {
Math_SmoothStepToF(&this->subCamAt.z, this->firstTailLimbWorldPos.z, 0.2f, 50.0f, 0.1f);
if (this->timer == 80) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS_CLEAR);
}
if (this->timer == 0) {
+7 -7
View File
@@ -360,7 +360,7 @@ void BossMo_Init(Actor* thisx, PlayState* play2) {
return;
}
if (GET_EVENTCHKINF(EVENTCHKINF_74)) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
this->tentMaxAngle = 5.0f;
this->timers[0] = 50;
} else {
@@ -1101,7 +1101,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
-280.0f, this->actor.world.pos.z, 0, 0, 0, WARP_DUNGEON_ADULT);
Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, this->actor.world.pos.x + 200.0f, -280.0f,
this->actor.world.pos.z, 0, 0, 0, 0);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS_CLEAR);
Flags_SetClear(play, play->roomCtx.curRoom.num);
}
}
@@ -1236,7 +1236,7 @@ void BossMo_IntroCs(BossMo* this, PlayState* play) {
this->actor.world.rot.y = 0x721A;
sMorphaTent1->work[MO_TENT_ACTION_STATE] = MO_TENT_READY;
sMorphaTent1->timers[0] = 30000;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x3200FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 50);
Message_CloseTextbox(play);
} else {
break;
@@ -1417,7 +1417,7 @@ void BossMo_IntroCs(BossMo* this, PlayState* play) {
this->subCamAccel = 0.01f;
}
if (this->timers[2] == 150) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
}
if (this->timers[2] == 130) {
TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gMorphaTitleCardTex), 0xA0,
@@ -1775,7 +1775,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) {
((sMorphaTent1->subCamId == SUB_CAM_ID_DONE) && (sMorphaTent2 != NULL) &&
(sMorphaTent2->subCamId == SUB_CAM_ID_DONE))) {
Enemy_StartFinishingBlow(play, &this->actor);
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
this->csState = MO_DEATH_START;
sMorphaTent1->drawActor = false;
sMorphaTent1->work[MO_TENT_ACTION_STATE] = MO_TENT_DEATH_START;
@@ -3576,11 +3576,11 @@ void BossMo_Unknown(void) {
if (BREG(32) != 0) {
BREG(32)--;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
func_80078914(&zeroVec, unkSfx[BREG(33)]);
}
if (BREG(34) != 0) {
BREG(34) = 0;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | (u16)BREG(35));
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, BREG(35));
}
}
@@ -381,7 +381,7 @@ void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) {
}
Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye);
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
this->actionFunc = BossSst_HeadIntro;
}
@@ -601,7 +601,7 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) {
TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gBongoTitleCardTex),
160, 180, 128, 40);
}
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
Animation_MorphToPlayOnce(&this->skelAnime, &gBongoHeadEyeCloseAnim, -5.0f);
BossSst_HeadSfx(this, NA_SE_EN_SHADEST_DISAPPEAR);
}
@@ -1015,7 +1015,7 @@ void BossSst_HeadSetupDeath(BossSst* this, PlayState* play) {
this->colliderJntSph.base.ocFlags1 &= ~OC1_ON;
sHands[LEFT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON;
sHands[RIGHT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
sSubCamId = Play_CreateSubCamera(play);
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT);
Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE);
@@ -1160,7 +1160,7 @@ void BossSst_HeadMelt(BossSst* this, PlayState* play) {
void BossSst_HeadSetupFinish(BossSst* this) {
this->actor.draw = BossSst_DrawEffects;
this->timer = 40;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS_CLEAR);
BossSst_SetCameraTargets(1.0 / 40, 6);
this->actionFunc = BossSst_HeadFinish;
}
+10 -10
View File
@@ -519,7 +519,7 @@ void BossTw_Init(Actor* thisx, PlayState* play2) {
this->actor.world.pos.x = -600.0f;
this->actor.world.pos.y = 400.0f;
this->actor.world.pos.z = 0.0f;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
} else {
BossTw_SetupCSWait(this, play);
}
@@ -1512,7 +1512,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play) {
this->workf[UNK_F9] = 0.0f;
this->workf[UNK_F10] = 0.0f;
this->workf[UNK_F11] = 600.0f;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xC800FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 200);
this->work[CS_TIMER_2] = 0;
FALLTHROUGH;
case 1:
@@ -1641,7 +1641,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play) {
this->timers[0] = 50;
func_8002DF54(play, &this->actor, 2);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_TWINROBA_TRANSFORM);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
}
}
@@ -1782,7 +1782,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play) {
if (this->csSfxTimer == 180) {
func_80078914(&D_8094A7D0, NA_SE_EN_TWINROBA_LAUGH);
func_80078914(&D_8094A7D0, NA_SE_EN_TWINROBA_LAUGH2);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_KOTAKE_KOUME);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_KOTAKE_KOUME);
}
this->csSfxTimer++;
@@ -2206,7 +2206,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play) {
}
if (this->work[CS_TIMER_1] == 90) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x5A00FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 90);
}
if (this->work[CS_TIMER_1] == 120) {
@@ -2217,7 +2217,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play) {
TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(object_tw_Blob_02E170),
0xA0, 0xB4, 0x80, 0x28);
SET_EVENTCHKINF(EVENTCHKINF_75);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
}
if (this->work[CS_TIMER_1] >= 160) {
@@ -2512,7 +2512,7 @@ void BossTw_DeathCSMsgSfx(BossTw* this, PlayState* play) {
if (this->work[CS_TIMER_2] == 820) {
msgId1 = 0x6057;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x5000FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 80);
}
if (this->work[CS_TIMER_2] == 860) {
@@ -2688,7 +2688,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play) {
Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE);
this->subCamEye = mainCam->eye;
this->subCamAt = mainCam->at;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
break;
case 1:
spD0.x = Math_SinS(this->actor.world.rot.y) * 200.0f;
@@ -2763,7 +2763,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play) {
sKoumePtr->visible = 1;
sKotakePtr->visible = 1;
func_80078884(NA_SE_EN_TWINROBA_TRANSFORM);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_KOTAKE_KOUME);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_KOTAKE_KOUME);
this->csState2 = 3;
this->work[CS_TIMER_2] = 0;
this->subCamYaw = this->subCamYawStep = this->actor.speedXZ = this->subCamDistStep = 0.0f;
@@ -2811,7 +2811,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play) {
this->subCamId = SUB_CAM_ID_DONE;
func_80064534(play, &play->csCtx);
func_8002DF54(play, &this->actor, 7);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS_CLEAR);
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DOOR_WARP1, 600.0f, 230.0f, 0.0f, 0, 0, 0,
WARP_DUNGEON_ADULT);
Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_B_HEART, -600.0f, 230.f, 0.0f, 0, 0, 0, 0);
+3 -3
View File
@@ -957,7 +957,7 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) {
play->envCtx.lightSettingOverride = 1;
func_8002DF54(play, &this->actor, 8);
} else if (this->timer >= 35000) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
}
this->timer += this->unk_1F2;
@@ -1512,7 +1512,7 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) {
void BossVa_SetupBodyDeath(BossVa* this, PlayState* play) {
func_800F436C(&this->actor.projectedPos, NA_SE_EN_BALINADE_LEVEL - SFX_FLAG, 1.0f);
this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2);
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
this->vaCamRotMod = 0xC31;
sCsState = DEATH_START;
this->actor.speedXZ = 0.0f;
@@ -1597,7 +1597,7 @@ void BossVa_BodyDeath(BossVa* this, PlayState* play) {
break;
case DEATH_CORE_BURST:
if (this->timer == 13) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS_CLEAR);
}
this->timer--;
@@ -376,7 +376,7 @@ void DoorWarp1_ChooseInitialAction(DoorWarp1* this, PlayState* play) {
void DoorWarp1_AwaitClearFlag(DoorWarp1* this, PlayState* play) {
if (Flags_GetTempClear(play, this->actor.room)) {
this->warpTimer = 200;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS_CLEAR);
DoorWarp1_SetupAction(this, func_809995D4);
}
}
@@ -268,8 +268,7 @@ void EnButte_FlyAround(EnButte* this, PlayState* play) {
EnButte_SelectFlightParams(this, &sFlyAroundParams[this->flightParamsIdx]);
}
if (((this->actor.params & 1) == 1) && (player->heldItemActionParam == PLAYER_AP_STICK) &&
(this->swordDownTimer <= 0) &&
if (((this->actor.params & 1) == 1) && (player->heldItemAction == PLAYER_IA_STICK) && (this->swordDownTimer <= 0) &&
((Math3D_Dist2DSq(player->actor.world.pos.x, player->actor.world.pos.z, this->actor.home.pos.x,
this->actor.home.pos.z) < SQ(120.0f)) ||
(this->actor.xzDistToPlayer < 60.0f))) {
@@ -334,7 +333,7 @@ void EnButte_FollowLink(EnButte* this, PlayState* play) {
distSqFromHome = Math3D_Dist2DSq(this->actor.world.pos.x, this->actor.world.pos.z, this->actor.home.pos.x,
this->actor.home.pos.z);
if (!((player->heldItemActionParam == PLAYER_AP_STICK) && (fabsf(player->actor.speedXZ) < 1.8f) &&
if (!((player->heldItemAction == PLAYER_IA_STICK) && (fabsf(player->actor.speedXZ) < 1.8f) &&
(this->swordDownTimer <= 0) && (distSqFromHome < SQ(320.0f)))) {
EnButte_SetupFlyAround(this);
} else if (distSqFromHome > SQ(240.0f)) {
+8 -8
View File
@@ -132,8 +132,8 @@ void EnBw_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.012999999f);
this->actor.naviEnemyId = NAVI_ENEMY_TORCH_SLUG;
this->actor.gravity = -2.0f;
SkelAnime_Init(play, &this->skelAnime, &object_bw_Skel_0020F0, &object_bw_Anim_000228, this->jointTable,
this->morphTable, 12);
SkelAnime_Init(play, &this->skelAnime, &gTorchSlugSkel, &gTorchSlugEyestalkWaveAnim, this->jointTable,
this->morphTable, TORCH_SLUG_LIMB_MAX);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 40.0f);
this->actor.colChkInfo.damageTable = &sDamageTable;
this->actor.colChkInfo.health = 6;
@@ -174,7 +174,7 @@ void func_809CE884(EnBw* this, PlayState* play) {
}
void func_809CE9A8(EnBw* this) {
Animation_MorphToLoop(&this->skelAnime, &object_bw_Anim_000228, -2.0f);
Animation_MorphToLoop(&this->skelAnime, &gTorchSlugEyestalkWaveAnim, -2.0f);
this->unk_220 = 2;
this->unk_222 = Rand_ZeroOne() * 200.0f + 200.0f;
this->unk_232 = 0;
@@ -393,7 +393,7 @@ void func_809CEA24(EnBw* this, PlayState* play) {
}
void func_809CF72C(EnBw* this) {
Animation_MorphToPlayOnce(&this->skelAnime, &object_bw_Anim_0021A0, -2.0f);
Animation_MorphToPlayOnce(&this->skelAnime, &gTorchSlugEyestalkRaiseAnim, -2.0f);
this->unk_220 = 3;
this->unk_221 = 0;
this->unk_250 = 0.6f;
@@ -425,7 +425,7 @@ void func_809CF7AC(EnBw* this, PlayState* play) {
}
void func_809CF8F0(EnBw* this) {
Animation_MorphToPlayOnce(&this->skelAnime, &object_bw_Anim_002250, -1.0f);
Animation_MorphToPlayOnce(&this->skelAnime, &gTorchSlugEyestalkFlailAnim, -1.0f);
this->actor.speedXZ = 7.0f;
this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
this->unk_220 = 4;
@@ -470,7 +470,7 @@ void func_809CF984(EnBw* this, PlayState* play) {
}
void func_809CFBA8(EnBw* this) {
Animation_MorphToLoop(&this->skelAnime, &object_bw_Anim_002250, -1.0f);
Animation_MorphToLoop(&this->skelAnime, &gTorchSlugEyestalkFlailAnim, -1.0f);
this->unk_220 = 5;
this->unk_222 = 1000;
this->unk_260 = 0.0f;
@@ -528,7 +528,7 @@ void func_809CFC4C(EnBw* this, PlayState* play) {
}
void func_809CFF10(EnBw* this) {
Animation_MorphToLoop(&this->skelAnime, &object_bw_Anim_002250, -1.0f);
Animation_MorphToLoop(&this->skelAnime, &gTorchSlugEyestalkFlailAnim, -1.0f);
this->unk_220 = 6;
this->unk_222 = 1000;
this->unk_221 = 3;
@@ -814,7 +814,7 @@ void EnBw_Update(Actor* thisx, PlayState* play2) {
s32 EnBw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) {
EnBw* this = (EnBw*)thisx;
if (limbIndex == 1) {
if (limbIndex == TORCH_SLUG_LIMB_BODY) {
gSPSegment(
(*gfx)++, 0x09,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, 0, this->unk_23A, 0x20, 0x20));
+18 -2
View File
@@ -7,11 +7,27 @@
struct EnBw;
typedef void (*EnBwActionFunc)(struct EnBw*, PlayState*);
typedef enum {
/* 0 */ TORCH_SLUG_LIMB_NONE,
/* 1 */ TORCH_SLUG_LIMB_BODY,
/* 2 */ TORCH_SLUG_LIMB_LEFT_EYESTALK_ROOT_ROOT,
/* 3 */ TORCH_SLUG_LIMB_LEFT_EYESTALK_ROOT,
/* 4 */ TORCH_SLUG_LIMB_LEFT_UPPER_EYESTALK_ROOT,
/* 5 */ TORCH_SLUG_LIMB_LEFT_UPPER_EYESTALK,
/* 6 */ TORCH_SLUG_LIMB_LEFT_LOWER_EYESTALK,
/* 7 */ TORCH_SLUG_LIMB_RIGHT_EYESTALK_ROOT_ROOT,
/* 8 */ TORCH_SLUG_LIMB_RIGHT_EYESTALK_ROOT,
/* 9 */ TORCH_SLUG_LIMB_RIGHT_UPPER_EYESTALK_ROOT,
/* 10 */ TORCH_SLUG_LIMB_RIGHT_UPPER_EYESTALK,
/* 11 */ TORCH_SLUG_LIMB_RIGHT_LOWER_EYESTALK,
/* 12 */ TORCH_SLUG_LIMB_MAX
} TorchSlugLimb;
typedef struct EnBw {
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ Vec3s jointTable[12];
/* 0x01D8 */ Vec3s morphTable[12];
/* 0x0190 */ Vec3s jointTable[TORCH_SLUG_LIMB_MAX];
/* 0x01D8 */ Vec3s morphTable[TORCH_SLUG_LIMB_MAX];
/* 0x0220 */ u8 unk_220;
/* 0x0221 */ u8 unk_221;
/* 0x0222 */ s16 unk_222;
@@ -159,7 +159,7 @@ void EnDntDemo_Judge(EnDntDemo* this, PlayState* play) {
if (!GET_ITEMGETINF(ITEMGETINF_1E)) {
reaction = DNT_SIGNAL_CELEBRATE;
this->prize = DNT_PRIZE_STICK;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_SARIA_THEME);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_SARIA_THEME);
break;
}
FALLTHROUGH;
@@ -208,17 +208,17 @@ void EnDntDemo_Judge(EnDntDemo* this, PlayState* play) {
this->action = sResultValues[resultIdx][1];
switch (this->action) {
case DNT_ACTION_LOW_RUPEES:
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_COURTYARD);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_COURTYARD);
break;
case DNT_ACTION_ATTACK:
if (this->subCamId != SUB_CAM_ID_DONE) {
this->subCamId = SUB_CAM_ID_DONE;
OnePointCutscene_Init(play, 2350, -99, &this->scrubs[3]->actor, CAM_ID_MAIN);
}
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ENEMY | 0x800);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 8, NA_BGM_ENEMY);
break;
case DNT_ACTION_DANCE:
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_SHOP);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_SHOP);
break;
}
osSyncPrintf("\n\n");
@@ -358,7 +358,7 @@ void EnDntJiji_Return(EnDntJiji* this, PlayState* play) {
if ((this->stage->actor.update != NULL) && (this->stage->leaderSignal == DNT_SIGNAL_NONE)) {
this->stage->leaderSignal = DNT_SIGNAL_HIDE;
this->stage->action = DNT_ACTION_ATTACK;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ENEMY | 0x800);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 8, NA_BGM_ENEMY);
}
}
this->actor.speedXZ = 0.0f;
+1 -1
View File
@@ -52,7 +52,7 @@ void func_809FFDC8(EnEg* this, PlayState* play) {
// Void the player out
Play_TriggerRespawn(play);
gSaveContext.respawnFlag = -2;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
play->transitionType = TRANS_TYPE_FADE_BLACK;
EnEg_PlayVoidOutSFX();
voided = true;
+2 -2
View File
@@ -317,7 +317,7 @@ void func_80A2F9C0(EnGb* this, PlayState* play) {
SET_INFTABLE(INFTABLE_B6);
}
func_80A2F180(this);
Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE);
Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE);
Rupees_ChangeBy(10);
this->actionFunc = func_80A2F83C;
}
@@ -329,7 +329,7 @@ void func_80A2FA50(EnGb* this, PlayState* play) {
SET_INFTABLE(INFTABLE_B6);
}
func_80A2F180(this);
Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE);
Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE);
Rupees_ChangeBy(50);
HIGH_SCORE(HS_POE_POINTS) += 100;
if (HIGH_SCORE(HS_POE_POINTS) != 1000) {
@@ -2548,7 +2548,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) {
if ((play->interfaceCtx.hbaAmmo == 0) || (this->hbaFlags & 2)) {
if (this->hbaFlags & 4) {
this->hbaFlags &= ~4;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_HORSE_GOAL);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_HORSE_GOAL);
}
}
@@ -182,7 +182,7 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play)
if (this->playerFinish > 0) {
this->result = INGORACE_PLAYER_WIN;
this->finishTimer = 55;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_HORSE_GOAL);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_HORSE_GOAL);
Audio_PlaySfxGeneral(NA_SE_SY_START_SHOT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
@@ -198,7 +198,7 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play)
this->result = INGORACE_INGO_WIN;
this->finishTimer = 70;
ingoHorse->stateFlags |= ENHORSE_INGO_WON;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_HORSE_GOAL);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_HORSE_GOAL);
Audio_PlaySfxGeneral(NA_SE_SY_START_SHOT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
@@ -207,12 +207,12 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play)
}
}
if (((player2->rideActor != NULL) && AT_RANCH_EXIT(player2->rideActor)) || AT_RANCH_EXIT(&player2->actor)) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_HORSE_GOAL);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_HORSE_GOAL);
this->result = INGORACE_INGO_WIN;
this->finishTimer = 20;
}
if ((gSaveContext.timer1Value >= 180) && (this->startFlags & 2)) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_HORSE_GOAL);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_HORSE_GOAL);
this->result = INGORACE_TIME_UP;
this->finishTimer = 20;
}
@@ -378,7 +378,7 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play
this->finishTimer = 30;
} else if (this->fenceCheck[15] == 1) {
this->lapCount = 2;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_HORSE_GOAL);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_HORSE_GOAL);
Audio_PlaySfxGeneral(NA_SE_SY_START_SHOT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
this->result = MALONRACE_SUCCESS;
+1 -1
View File
@@ -592,7 +592,7 @@ s16 func_80A70058(PlayState* play, Actor* thisx) {
case 0x70F3:
Rupees_ChangeBy(beggarRewards[this->actor.textId - 0x70F0]);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENHY_ANIM_17);
Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_AP_BOTTLE);
Player_UpdateBottleHeld(play, GET_PLAYER(play), ITEM_BOTTLE, PLAYER_IA_BOTTLE);
break;
case 0x7016:
SET_INFTABLE(INFTABLE_C0);
+11 -9
View File
@@ -247,14 +247,16 @@ void func_80AA0AF4(EnMa1* this, PlayState* play) {
void func_80AA0B74(EnMa1* this) {
if (this->skelAnime.animation == &gMalonChildSingAnim) {
if (this->unk_1E8.unk_00 == 0) {
if (this->unk_1E0 != 0) {
this->unk_1E0 = 0;
func_800F6584(0);
if (this->isNotSinging) {
// Turn on singing
this->isNotSinging = false;
Audio_ToggleMalonSinging(false);
}
} else {
if (this->unk_1E0 == 0) {
this->unk_1E0 = 1;
func_800F6584(1);
if (!this->isNotSinging) {
// Turn off singing
this->isNotSinging = true;
Audio_ToggleMalonSinging(true);
}
}
}
@@ -447,14 +449,14 @@ void EnMa1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
void EnMa1_Draw(Actor* thisx, PlayState* play) {
EnMa1* this = (EnMa1*)thisx;
Camera* activeCam;
f32 distFromCamera;
f32 distFromCamEye;
s32 pad;
OPEN_DISPS(play->state.gfxCtx, "../z_en_ma1.c", 1226);
activeCam = GET_ACTIVE_CAM(play);
distFromCamera = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye);
func_800F6268(distFromCamera, NA_BGM_LONLON);
distFromCamEye = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye);
Audio_UpdateMalonSinging(distFromCamEye, NA_BGM_LONLON);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex]));
+1 -1
View File
@@ -13,7 +13,7 @@ typedef struct EnMa1 {
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnMa1ActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
/* 0x01E0 */ s16 unk_1E0;
/* 0x01E0 */ s16 isNotSinging;
/* 0x01E2 */ s16 blinkTimer;
/* 0x01E4 */ s16 eyeIndex;
/* 0x01E6 */ s16 mouthIndex;
+11 -9
View File
@@ -196,14 +196,16 @@ void EnMa2_ChangeAnim(EnMa2* this, s32 index) {
void func_80AA1DB4(EnMa2* this, PlayState* play) {
if (this->skelAnime.animation == &gMalonAdultSingAnim) {
if (this->unk_1E0.unk_00 == 0) {
if (this->unk_20A != 0) {
func_800F6584(0);
this->unk_20A = 0;
if (this->isNotSinging) {
// Turn on singing
Audio_ToggleMalonSinging(false);
this->isNotSinging = false;
}
} else {
if (this->unk_20A == 0) {
func_800F6584(1);
this->unk_20A = 1;
if (!this->isNotSinging) {
// Turn off singing
Audio_ToggleMalonSinging(true);
this->isNotSinging = true;
}
}
}
@@ -374,14 +376,14 @@ void EnMa2_Draw(Actor* thisx, PlayState* play) {
EnMa2* this = (EnMa2*)thisx;
Camera* activeCam;
f32 someFloat;
f32 distFromCamEye;
s32 pad;
OPEN_DISPS(play->state.gfxCtx, "../z_en_ma2.c", 955);
activeCam = GET_ACTIVE_CAM(play);
someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye);
func_800F6268(someFloat, NA_BGM_LONLON);
distFromCamEye = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye);
Audio_UpdateMalonSinging(distFromCamEye, NA_BGM_LONLON);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex]));
+1 -1
View File
@@ -38,7 +38,7 @@ typedef struct EnMa2 {
/* 0x0194 */ ColliderCylinder collider;
/* 0x01E0 */ struct_80034A14_arg1 unk_1E0;
/* 0x0208 */ s16 unk_208;
/* 0x020A */ s16 unk_20A;
/* 0x020A */ s16 isNotSinging;
/* 0x020C */ s16 blinkTimer;
/* 0x020E */ s16 eyeIndex;
/* 0x0210 */ s16 mouthIndex;
+11 -9
View File
@@ -298,13 +298,15 @@ void EnMa3_Update(Actor* thisx, PlayState* play) {
func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 150.0f, func_80AA2AA0,
func_80AA2BD4);
if (this->unk_1E0.unk_00 == 0) {
if (this->unk_20A != 0) {
func_800F6584(0);
this->unk_20A = 0;
if (this->isNotSinging) {
// Turn on singing
Audio_ToggleMalonSinging(false);
this->isNotSinging = false;
}
} else if (this->unk_20A == 0) {
func_800F6584(1);
this->unk_20A = 1;
} else if (!this->isNotSinging) {
// Turn off singing
Audio_ToggleMalonSinging(true);
this->isNotSinging = true;
}
}
@@ -357,14 +359,14 @@ void EnMa3_Draw(Actor* thisx, PlayState* play) {
static void* sEyeTextures[] = { gMalonAdultEyeOpenTex, gMalonAdultEyeHalfTex, gMalonAdultEyeClosedTex };
EnMa3* this = (EnMa3*)thisx;
Camera* activeCam;
f32 someFloat;
f32 distFromCamEye;
s32 pad;
OPEN_DISPS(play->state.gfxCtx, "../z_en_ma3.c", 978);
activeCam = GET_ACTIVE_CAM(play);
someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye);
func_800F6268(someFloat, NA_BGM_LONLON);
distFromCamEye = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye);
Audio_UpdateMalonSinging(distFromCamEye, NA_BGM_LONLON);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex]));
+1 -1
View File
@@ -38,7 +38,7 @@ typedef struct EnMa3 {
/* 0x0194 */ ColliderCylinder collider;
/* 0x01E0 */ struct_80034A14_arg1 unk_1E0;
/* 0x0208 */ s16 unk_208;
/* 0x020A */ s16 unk_20A;
/* 0x020A */ s16 isNotSinging;
/* 0x020C */ s16 blinkTimer;
/* 0x020E */ s16 eyeIndex;
/* 0x0210 */ s16 mouthIndex;
@@ -93,7 +93,7 @@ void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, PlayState* play) {
play->envCtx.precipitation[PRECIP_SOS_MAX] = 0;
if (play->csCtx.state == CS_STATE_IDLE) {
Environment_StopStormNatureAmbience(play);
} else if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) {
} else if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_AMBIENCE) {
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_1, 0);
Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_RAIN, CHANNEL_IO_PORT_1, 0);
}
@@ -243,7 +243,7 @@ void func_80ABF4C8(EnOkarinaTag* this, PlayState* play) {
case 2:
play->csCtx.segment = D_80ABF9D0;
gSaveContext.cutsceneTrigger = 1;
func_800F574C(1.18921f, 0x5A);
func_800F574C(1.18921f, 90);
break;
case 4:
play->csCtx.segment = D_80ABFB40;
+6 -6
View File
@@ -340,7 +340,7 @@ void func_80ACA76C(EnOwl* this, PlayState* play) {
func_8002DF54(play, &this->actor, 8);
if (Actor_TextboxIsClosing(&this->actor, play)) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0);
func_80ACA62C(this, play);
this->actor.flags &= ~ACTOR_FLAG_16;
}
@@ -350,7 +350,7 @@ void func_80ACA7E0(EnOwl* this, PlayState* play) {
func_8002DF54(play, &this->actor, 8);
if (Actor_TextboxIsClosing(&this->actor, play)) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0);
if ((this->unk_3EE & 0x3F) == 0) {
func_80ACA62C(this, play);
} else {
@@ -550,7 +550,7 @@ void func_80ACB03C(EnOwl* this, PlayState* play) {
func_8002DF54(play, &this->actor, 8);
if (Actor_TextboxIsClosing(&this->actor, play)) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0);
func_80ACA62C(this, play);
this->actor.flags &= ~ACTOR_FLAG_16;
}
@@ -579,7 +579,7 @@ void EnOwl_WaitZoraRiver(EnOwl* this, PlayState* play) {
void func_80ACB148(EnOwl* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0);
func_80ACA5C8(this);
this->actionFunc = func_80ACC30C;
Flags_SetSwitch(play, 0x23);
@@ -600,7 +600,7 @@ void EnOwl_WaitHyliaShortcut(EnOwl* this, PlayState* play) {
void func_80ACB22C(EnOwl* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0);
func_80ACA5C8(this);
this->actionFunc = func_80ACC30C;
}
@@ -608,7 +608,7 @@ void func_80ACB22C(EnOwl* this, PlayState* play) {
void func_80ACB274(EnOwl* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0);
this->actionFunc = EnOwl_WaitDeathMountainShortcut;
}
}
@@ -505,6 +505,6 @@ void EnSyatekiMan_Draw(Actor* thisx, PlayState* play) {
void EnSyatekiMan_SetBgm(void) {
if (BREG(80)) {
BREG(80) = false;
Audio_QueueSeqCmd(sBgmList[BREG(81)]);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, sBgmList[BREG(81)]);
}
}
+2 -2
View File
@@ -708,7 +708,7 @@ void func_80B154FC(EnTa* this, PlayState* play) {
this->unk_2E0 &= ~0x10;
this->unk_2E0 &= ~0x100;
SET_EVENTINF(EVENTINF_HORSES_08);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
this->unk_2E0 &= ~0x200;
Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET);
return;
@@ -737,7 +737,7 @@ void func_80B154FC(EnTa* this, PlayState* play) {
}
if (gSaveContext.timer1Value == 0 && !Play_InCsMode(play)) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
this->unk_2E0 &= ~0x200;
func_80078884(NA_SE_SY_FOUND);
gSaveContext.timer1State = 0;
+2 -2
View File
@@ -663,7 +663,7 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) {
EnTest_SetupJumpslash(this);
return;
}
} else if (player->heldItemActionParam != PLAYER_AP_NONE) {
} else if (player->heldItemAction != PLAYER_IA_NONE) {
if (this->actor.isTargeted) {
if ((play->gameplayFrames % 2) != 0) {
func_808627C4(this, play);
@@ -1462,7 +1462,7 @@ void func_808628C8(EnTest* this, PlayState* play) {
if (!EnTest_ReactToProjectile(play, this)) {
EnTest_ChooseAction(this, play);
}
} else if (player->heldItemActionParam != PLAYER_AP_NONE) {
} else if (player->heldItemAction != PLAYER_IA_NONE) {
if ((play->gameplayFrames % 2) != 0) {
EnTest_SetupIdle(this);
} else {
@@ -96,7 +96,7 @@ void EnTorch2_Init(Actor* thisx, PlayState* play2) {
sInput.cur.button = sInput.press.button = sInput.rel.button = 0;
sInput.cur.stick_x = sInput.cur.stick_y = 0;
this->currentShield = PLAYER_SHIELD_HYLIAN;
this->heldItemActionParam = this->heldItemId = PLAYER_AP_SWORD_MASTER;
this->heldItemAction = this->heldItemId = PLAYER_IA_SWORD_MASTER;
Player_SetModelGroup(this, PLAYER_MODELGROUP_SWORD);
play->playerInit(this, play, &gDarkLinkSkel);
this->actor.naviEnemyId = NAVI_ENEMY_DARK_LINK;
@@ -241,7 +241,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) {
}
}
if (play->csCtx.frames == 1020) {
Audio_QueueSeqCmd(SEQ_PLAYER_FANFARE << 24 | NA_BGM_OPENING_GANON);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, 0, NA_BGM_OPENING_GANON);
}
if (play->csCtx.frames == 960) {
Audio_PlaySfxGeneral(NA_SE_EV_HORSE_GROAN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
+1 -1
View File
@@ -86,7 +86,7 @@ void EnZl3_Destroy(Actor* thisx, PlayState* play) {
}
void func_80B53468(void) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ESCAPE);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_ESCAPE);
}
BossGanon2* func_80B53488(EnZl3* this, PlayState* play) {
+5 -5
View File
@@ -142,7 +142,7 @@ void EnfHG_Intro(EnfHG* this, PlayState* play) {
}
if (this->timers[0] == 51) {
Audio_PlayActorSfx2(this->actor.child, NA_SE_EV_SPEAR_FENCE);
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
}
if (this->timers[0] == 0) {
EnfHG_SetupApproach(this, play, Rand_ZeroOne() * 5.99f);
@@ -158,7 +158,7 @@ void EnfHG_Intro(EnfHG* this, PlayState* play) {
this->cutsceneState = INTRO_FENCE;
this->timers[0] = 60;
this->actor.world.pos.y = GND_BOSSROOM_CENTER_Y - 7.0f;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
SET_EVENTCHKINF(EVENTCHKINF_72);
Flags_SetSwitch(play, 0x23);
FALLTHROUGH;
@@ -195,7 +195,7 @@ void EnfHG_Intro(EnfHG* this, PlayState* play) {
func_8002DF54(play, &this->actor, 9);
}
if (this->timers[0] == 1) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_OPENING_GANON);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_OPENING_GANON);
}
Math_ApproachF(&this->subCamEye.x, GND_BOSSROOM_CENTER_X + 40.0f, 0.05f, this->subCamVelFactor * 20.0f);
Math_ApproachF(&this->subCamEye.y, GND_BOSSROOM_CENTER_Y + 37.0f, 0.05f, this->subCamVelFactor * 20.0f);
@@ -284,7 +284,7 @@ void EnfHG_Intro(EnfHG* this, PlayState* play) {
this->bossGndSignal = FHG_RIDE;
}
if (this->timers[0] == 130) {
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x5000FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 80);
}
if (this->timers[0] == 30) {
bossGnd->work[GND_EYE_STATE] = GND_EYESTATE_BRIGHTEN;
@@ -297,7 +297,7 @@ void EnfHG_Intro(EnfHG* this, PlayState* play) {
func_80078914(&audioVec, NA_SE_EN_FANTOM_ST_LAUGH);
}
if (this->timers[0] == 20) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
}
if (this->timers[0] == 2) {
this->subCamVelFactor = 0.0f;
+12 -12
View File
@@ -867,7 +867,7 @@ void Fishing_Init(Actor* thisx, PlayState* play2) {
D_80B7E0AC = 0;
D_80B7E0A6 = 10;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x0100FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 1);
if (sLinkAge == LINK_AGE_CHILD) {
if ((HIGH_SCORE(HS_FISHING) & 0x7F) != 0) {
@@ -3586,7 +3586,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
this->unk_198 = 1.7f;
this->unk_19C = 7000.0f;
D_80B7E124 = 1;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ENEMY | 0x800);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 8, NA_BGM_ENEMY);
D_80B7E0A6 = 0;
if (this->unk_150 == 1) {
@@ -3791,7 +3791,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
} else {
D_80B7E086 = 0x4082;
Rumble_Override(0.0f, 1, 3, 1);
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x0A00FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 10);
}
this->unk_158 = this->unk_15A = 0;
@@ -3859,7 +3859,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
}
if (this->unk_17A[0] == 90) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_HEART_GET | 0x900);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 9, NA_BGM_HEART_GET);
D_80B7A67C = 40;
if (this->unk_150 == 0) {
@@ -3974,7 +3974,7 @@ void Fishing_UpdateFish(Actor* thisx, PlayState* play2) {
D_80B7E148 = 520.0f;
D_80B7E144 = 195.0f;
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xA00FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 10);
D_80B7E0A6 = 20;
D_80B7A6CC = 3;
}
@@ -5207,7 +5207,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
D_80B7A6CC = 20;
Rumble_Override(0.0f, 150, 10, 10);
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x1400FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20);
}
if (KREG(0) != 0) {
@@ -5216,7 +5216,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
D_80B7A6CC = 20;
Rumble_Override(0.0f, 150, 10, 10);
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x1400FF);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 20);
}
if (D_80B7A6D0 != 0) {
@@ -5432,7 +5432,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
case 22:
if (D_80B7A6D0 == 30) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ITEM_GET | 0x900);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 9, NA_BGM_ITEM_GET);
}
D_80B7A6D4 = 1;
@@ -5741,15 +5741,15 @@ void Fishing_DrawOwner(Actor* thisx, PlayState* play) {
if (D_80B7E0A6 == 0) {
if (sLinkAge != LINK_AGE_CHILD) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_KAKARIKO_ADULT);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_KAKARIKO_ADULT);
} else {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_KAKARIKO_KID);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_KAKARIKO_KID);
}
if (sLinkAge != LINK_AGE_CHILD) {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_KAKARIKO_ADULT);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_KAKARIKO_ADULT);
} else {
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_KAKARIKO_KID);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_KAKARIKO_KID);
}
}
}
@@ -175,7 +175,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) {
if (dmgFlags & (DMG_FIRE | DMG_ARROW_NORMAL)) {
interactionType = 1;
}
} else if (player->heldItemActionParam == PLAYER_AP_STICK) {
} else if (player->heldItemAction == PLAYER_IA_STICK) {
Math_Vec3f_Diff(&player->meleeWeaponInfo[0].tip, &this->actor.world.pos, &tipToFlame);
tipToFlame.y -= 67.0f;
if ((SQ(tipToFlame.x) + SQ(tipToFlame.y) + SQ(tipToFlame.z)) < SQ(20.0f)) {
+205 -209
View File
@@ -47,7 +47,7 @@ typedef struct {
typedef struct {
/* 0x00 */ s16 actorId;
/* 0x02 */ u8 itemId;
/* 0x03 */ u8 actionParam;
/* 0x03 */ u8 itemAction;
/* 0x04 */ u8 textId;
} BottleCatchInfo; // size = 0x06
@@ -128,7 +128,7 @@ void func_8083377C(PlayState* play, Player* this);
void func_808337D4(PlayState* play, Player* this);
void func_80833910(PlayState* play, Player* this);
void func_80833984(PlayState* play, Player* this);
void func_8083399C(PlayState* play, Player* this, s8 actionParam);
void func_8083399C(PlayState* play, Player* this, s8 itemAction);
s32 func_8083485C(Player* this, PlayState* play);
s32 func_808349DC(Player* this, PlayState* play);
s32 func_80834A2C(Player* this, PlayState* play);
@@ -1023,70 +1023,70 @@ static u8 D_80853E7C[] = {
0, 0, 1, 1, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 3, 3, 4, 4, 8, 8, 5, 5, 6, 6, 7, 7, 9, 9, 0,
};
// Used to map item IDs to action params
static s8 sItemActionParams[] = {
PLAYER_AP_STICK,
PLAYER_AP_NUT,
PLAYER_AP_BOMB,
PLAYER_AP_BOW,
PLAYER_AP_BOW_FIRE,
PLAYER_AP_DINS_FIRE,
PLAYER_AP_SLINGSHOT,
PLAYER_AP_OCARINA_FAIRY,
PLAYER_AP_OCARINA_TIME,
PLAYER_AP_BOMBCHU,
PLAYER_AP_HOOKSHOT,
PLAYER_AP_LONGSHOT,
PLAYER_AP_BOW_ICE,
PLAYER_AP_FARORES_WIND,
PLAYER_AP_BOOMERANG,
PLAYER_AP_LENS,
PLAYER_AP_BEAN,
PLAYER_AP_HAMMER,
PLAYER_AP_BOW_LIGHT,
PLAYER_AP_NAYRUS_LOVE,
PLAYER_AP_BOTTLE,
PLAYER_AP_BOTTLE_POTION_RED,
PLAYER_AP_BOTTLE_POTION_GREEN,
PLAYER_AP_BOTTLE_POTION_BLUE,
PLAYER_AP_BOTTLE_FAIRY,
PLAYER_AP_BOTTLE_FISH,
PLAYER_AP_BOTTLE_MILK,
PLAYER_AP_BOTTLE_LETTER,
PLAYER_AP_BOTTLE_FIRE,
PLAYER_AP_BOTTLE_BUG,
PLAYER_AP_BOTTLE_BIG_POE,
PLAYER_AP_BOTTLE_MILK_HALF,
PLAYER_AP_BOTTLE_POE,
PLAYER_AP_WEIRD_EGG,
PLAYER_AP_CHICKEN,
PLAYER_AP_LETTER_ZELDA,
PLAYER_AP_MASK_KEATON,
PLAYER_AP_MASK_SKULL,
PLAYER_AP_MASK_SPOOKY,
PLAYER_AP_MASK_BUNNY,
PLAYER_AP_MASK_GORON,
PLAYER_AP_MASK_ZORA,
PLAYER_AP_MASK_GERUDO,
PLAYER_AP_MASK_TRUTH,
PLAYER_AP_SWORD_MASTER,
PLAYER_AP_POCKET_EGG,
PLAYER_AP_POCKET_CUCCO,
PLAYER_AP_COJIRO,
PLAYER_AP_ODD_MUSHROOM,
PLAYER_AP_ODD_POTION,
PLAYER_AP_SAW,
PLAYER_AP_SWORD_BROKEN,
PLAYER_AP_PRESCRIPTION,
PLAYER_AP_FROG,
PLAYER_AP_EYEDROPS,
PLAYER_AP_CLAIM_CHECK,
PLAYER_AP_BOW_FIRE,
PLAYER_AP_BOW_ICE,
PLAYER_AP_BOW_LIGHT,
PLAYER_AP_SWORD_KOKIRI,
PLAYER_AP_SWORD_MASTER,
PLAYER_AP_SWORD_BGS,
// Used to map item IDs to item actions
static s8 sItemActions[] = {
PLAYER_IA_STICK,
PLAYER_IA_NUT,
PLAYER_IA_BOMB,
PLAYER_IA_BOW,
PLAYER_IA_BOW_FIRE,
PLAYER_IA_DINS_FIRE,
PLAYER_IA_SLINGSHOT,
PLAYER_IA_OCARINA_FAIRY,
PLAYER_IA_OCARINA_TIME,
PLAYER_IA_BOMBCHU,
PLAYER_IA_HOOKSHOT,
PLAYER_IA_LONGSHOT,
PLAYER_IA_BOW_ICE,
PLAYER_IA_FARORES_WIND,
PLAYER_IA_BOOMERANG,
PLAYER_IA_LENS,
PLAYER_IA_BEAN,
PLAYER_IA_HAMMER,
PLAYER_IA_BOW_LIGHT,
PLAYER_IA_NAYRUS_LOVE,
PLAYER_IA_BOTTLE,
PLAYER_IA_BOTTLE_POTION_RED,
PLAYER_IA_BOTTLE_POTION_GREEN,
PLAYER_IA_BOTTLE_POTION_BLUE,
PLAYER_IA_BOTTLE_FAIRY,
PLAYER_IA_BOTTLE_FISH,
PLAYER_IA_BOTTLE_MILK,
PLAYER_IA_BOTTLE_LETTER,
PLAYER_IA_BOTTLE_FIRE,
PLAYER_IA_BOTTLE_BUG,
PLAYER_IA_BOTTLE_BIG_POE,
PLAYER_IA_BOTTLE_MILK_HALF,
PLAYER_IA_BOTTLE_POE,
PLAYER_IA_WEIRD_EGG,
PLAYER_IA_CHICKEN,
PLAYER_IA_LETTER_ZELDA,
PLAYER_IA_MASK_KEATON,
PLAYER_IA_MASK_SKULL,
PLAYER_IA_MASK_SPOOKY,
PLAYER_IA_MASK_BUNNY,
PLAYER_IA_MASK_GORON,
PLAYER_IA_MASK_ZORA,
PLAYER_IA_MASK_GERUDO,
PLAYER_IA_MASK_TRUTH,
PLAYER_IA_SWORD_MASTER,
PLAYER_IA_POCKET_EGG,
PLAYER_IA_POCKET_CUCCO,
PLAYER_IA_COJIRO,
PLAYER_IA_ODD_MUSHROOM,
PLAYER_IA_ODD_POTION,
PLAYER_IA_SAW,
PLAYER_IA_SWORD_BROKEN,
PLAYER_IA_PRESCRIPTION,
PLAYER_IA_FROG,
PLAYER_IA_EYEDROPS,
PLAYER_IA_CLAIM_CHECK,
PLAYER_IA_BOW_FIRE,
PLAYER_IA_BOW_ICE,
PLAYER_IA_BOW_LIGHT,
PLAYER_IA_SWORD_KOKIRI,
PLAYER_IA_SWORD_MASTER,
PLAYER_IA_SWORD_BGS,
};
static s32 (*D_80853EDC[])(Player* this, PlayState* play) = {
@@ -1403,7 +1403,7 @@ void func_808323B4(PlayState* play, Player* this) {
}
if (Player_GetExplosiveHeld(this) >= 0) {
func_8083399C(play, this, PLAYER_AP_NONE);
func_8083399C(play, this, PLAYER_IA_NONE);
this->heldItemId = ITEM_NONE_FE;
}
}
@@ -1436,7 +1436,7 @@ void func_80832440(PlayState* play, Player* this) {
}
s32 func_80832528(PlayState* play, Player* this) {
if (this->heldItemActionParam >= PLAYER_AP_FISHING_POLE) {
if (this->heldItemAction >= PLAYER_IA_FISHING_POLE) {
func_80835F44(play, this, ITEM_NONE);
return 1;
} else {
@@ -1852,7 +1852,7 @@ void func_80833638(Player* this, PlayerFunc82C arg1) {
func_808326F0(this);
}
void func_80833664(PlayState* play, Player* this, s8 actionParam) {
void func_80833664(PlayState* play, Player* this, s8 itemAction) {
LinkAnimationHeader* current = this->skelAnime.animation;
LinkAnimationHeader** iter = D_80853914 + this->modelAnimType;
u32 i;
@@ -1866,22 +1866,22 @@ void func_80833664(PlayState* play, Player* this, s8 actionParam) {
iter += PLAYER_ANIMTYPE_MAX;
}
func_8083399C(play, this, actionParam);
func_8083399C(play, this, itemAction);
if (i < PLAYER_ANIMGROUP_MAX) {
this->skelAnime.animation = GET_PLAYER_ANIM(i, this->modelAnimType);
}
}
s8 Player_ItemToActionParam(s32 item) {
s8 Player_ItemToItemAction(s32 item) {
if (item >= ITEM_NONE_FE) {
return PLAYER_AP_NONE;
return PLAYER_IA_NONE;
} else if (item == ITEM_LAST_USED) {
return PLAYER_AP_LAST_USED;
return PLAYER_IA_LAST_USED;
} else if (item == ITEM_FISHING_POLE) {
return PLAYER_AP_FISHING_POLE;
return PLAYER_IA_FISHING_POLE;
} else {
return sItemActionParams[item];
return sItemActions[item];
}
}
@@ -1898,7 +1898,7 @@ void func_80833790(PlayState* play, Player* this) {
void func_8083379C(PlayState* play, Player* this) {
this->stateFlags1 |= PLAYER_STATE1_3;
if (this->heldItemActionParam != PLAYER_AP_SLINGSHOT) {
if (this->heldItemAction != PLAYER_IA_SLINGSHOT) {
this->unk_860 = -1;
} else {
this->unk_860 = -2;
@@ -1952,17 +1952,17 @@ void func_80833984(PlayState* play, Player* this) {
this->stateFlags1 |= PLAYER_STATE1_24;
}
void func_8083399C(PlayState* play, Player* this, s8 actionParam) {
void func_8083399C(PlayState* play, Player* this, s8 itemAction) {
this->unk_860 = 0;
this->unk_85C = 0.0f;
this->unk_858 = 0.0f;
this->heldItemActionParam = this->itemActionParam = actionParam;
this->heldItemAction = this->itemAction = itemAction;
this->modelGroup = this->nextModelGroup;
this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_24);
D_80853FE8[actionParam](play, this);
D_80853FE8[itemAction](play, this);
Player_SetModelGroup(this, this->modelGroup);
}
@@ -1972,14 +1972,14 @@ void func_80833A20(Player* this, s32 newMeleeWeaponState) {
u16 voiceSfx;
if (this->meleeWeaponState == 0) {
if ((this->heldItemActionParam == PLAYER_AP_SWORD_BGS) && (gSaveContext.swordHealth > 0.0f)) {
if ((this->heldItemAction == PLAYER_IA_SWORD_BGS) && (gSaveContext.swordHealth > 0.0f)) {
itemSfx = NA_SE_IT_HAMMER_SWING;
} else {
itemSfx = NA_SE_IT_SWORD_SWING;
}
voiceSfx = NA_SE_VO_LI_SWORD_N;
if (this->heldItemActionParam == PLAYER_AP_HAMMER) {
if (this->heldItemAction == PLAYER_IA_HAMMER) {
itemSfx = NA_SE_IT_HAMMER_SWING;
} else if (this->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) {
itemSfx = 0;
@@ -2039,15 +2039,15 @@ void func_80833C3C(Player* this) {
}
s32 func_80833C50(Player* this, s32 item) {
if ((item < ITEM_NONE_FE) && (Player_ItemToActionParam(item) == this->itemActionParam)) {
if ((item < ITEM_NONE_FE) && (Player_ItemToItemAction(item) == this->itemAction)) {
return 1;
} else {
return 0;
}
}
s32 func_80833C98(s32 item1, s32 actionParam) {
if ((item1 < ITEM_NONE_FE) && (Player_ItemToActionParam(item1) == actionParam)) {
s32 func_80833C98(s32 item1, s32 itemAction) {
if ((item1 < ITEM_NONE_FE) && (Player_ItemToItemAction(item1) == itemAction)) {
return 1;
} else {
return 0;
@@ -2071,20 +2071,20 @@ s32 func_80833CDC(PlayState* play, s32 index) {
}
void func_80833DF8(Player* this, PlayState* play) {
s32 maskActionParam;
s32 maskItemAction;
s32 item;
s32 i;
if (this->currentMask != PLAYER_MASK_NONE) {
maskActionParam = this->currentMask - 1 + PLAYER_AP_MASK_KEATON;
if (!func_80833C98(C_BTN_ITEM(0), maskActionParam) && !func_80833C98(C_BTN_ITEM(1), maskActionParam) &&
!func_80833C98(C_BTN_ITEM(2), maskActionParam)) {
maskItemAction = this->currentMask - 1 + PLAYER_IA_MASK_KEATON;
if (!func_80833C98(C_BTN_ITEM(0), maskItemAction) && !func_80833C98(C_BTN_ITEM(1), maskItemAction) &&
!func_80833C98(C_BTN_ITEM(2), maskItemAction)) {
this->currentMask = PLAYER_MASK_NONE;
}
}
if (!(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_29)) && !func_8008F128(this)) {
if (this->itemActionParam >= PLAYER_AP_FISHING_POLE) {
if (this->itemAction >= PLAYER_IA_FISHING_POLE) {
if (!func_80833C50(this, B_BTN_ITEM) && !func_80833C50(this, C_BTN_ITEM(0)) &&
!func_80833C50(this, C_BTN_ITEM(1)) && !func_80833C50(this, C_BTN_ITEM(2))) {
func_80835F44(play, this, ITEM_NONE);
@@ -2107,7 +2107,7 @@ void func_80833DF8(Player* this, PlayState* play) {
}
item = func_80833CDC(play, i);
if ((item < ITEM_NONE_FE) && (Player_ItemToActionParam(item) == this->heldItemActionParam)) {
if ((item < ITEM_NONE_FE) && (Player_ItemToItemAction(item) == this->heldItemAction)) {
D_80853618 = true;
}
} else {
@@ -2127,15 +2127,15 @@ void func_808340DC(Player* this, PlayState* play) {
s8 sp37;
s32 nextAnimType;
sp37 = Player_ItemToActionParam(this->heldItemId);
sp37 = Player_ItemToItemAction(this->heldItemId);
func_80833638(this, func_80834A2C);
nextAnimType = gPlayerModelTypes[this->nextModelGroup][PLAYER_MODELGROUPENTRY_ANIM];
sp38 = D_80854164[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType];
if ((sp37 == PLAYER_AP_BOTTLE) || (sp37 == PLAYER_AP_BOOMERANG) ||
((sp37 == PLAYER_AP_NONE) &&
((this->heldItemActionParam == PLAYER_AP_BOTTLE) || (this->heldItemActionParam == PLAYER_AP_BOOMERANG)))) {
sp38 = (sp37 == PLAYER_AP_NONE) ? -PLAYER_D_808540F4_13 : PLAYER_D_808540F4_13;
if ((sp37 == PLAYER_IA_BOTTLE) || (sp37 == PLAYER_IA_BOOMERANG) ||
((sp37 == PLAYER_IA_NONE) &&
((this->heldItemAction == PLAYER_IA_BOTTLE) || (this->heldItemAction == PLAYER_IA_BOOMERANG)))) {
sp38 = (sp37 == PLAYER_IA_NONE) ? -PLAYER_D_808540F4_13 : PLAYER_D_808540F4_13;
}
this->unk_15A = ABS(sp38);
@@ -2157,7 +2157,7 @@ void func_808340DC(Player* this, PlayState* play) {
phi_f12 = phi_f2;
}
if (sp37 != PLAYER_AP_NONE) {
if (sp37 != PLAYER_IA_NONE) {
phi_f0 *= 2.0f;
}
@@ -2168,7 +2168,7 @@ void func_808340DC(Player* this, PlayState* play) {
void func_80834298(Player* this, PlayState* play) {
if ((this->actor.category == ACTORCAT_PLAYER) && !(this->stateFlags1 & PLAYER_STATE1_8) &&
((this->heldItemActionParam == this->itemActionParam) || (this->stateFlags1 & PLAYER_STATE1_22)) &&
((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_22)) &&
(gSaveContext.health != 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->csMode == 0) &&
(play->shootingGalleryStatus == 0) && (play->activeCamId == CAM_ID_MAIN) &&
(play->transitionTrigger != TRANS_TRIGGER_START) && (gSaveContext.timer1State != 10)) {
@@ -2186,7 +2186,7 @@ s32 func_80834380(PlayState* play, Player* this, s32* itemPtr, s32* typePtr) {
if (this->stateFlags1 & PLAYER_STATE1_23) {
*typePtr = ARROW_NORMAL_HORSE;
} else {
*typePtr = ARROW_NORMAL + (this->heldItemActionParam - PLAYER_AP_BOW);
*typePtr = ARROW_NORMAL + (this->heldItemAction - PLAYER_IA_BOW);
}
} else {
*itemPtr = ITEM_SLINGSHOT;
@@ -2207,7 +2207,7 @@ s32 func_8083442C(Player* this, PlayState* play) {
s32 arrowType;
s32 magicArrowType;
if ((this->heldItemActionParam >= PLAYER_AP_BOW_FIRE) && (this->heldItemActionParam <= PLAYER_AP_BOW_0E) &&
if ((this->heldItemAction >= PLAYER_IA_BOW_FIRE) && (this->heldItemAction <= PLAYER_IA_BOW_0E) &&
(gSaveContext.magicState != MAGIC_STATE_IDLE)) {
func_80078884(NA_SE_SY_ERROR);
} else {
@@ -2242,8 +2242,8 @@ s32 func_8083442C(Player* this, PlayState* play) {
}
void func_80834594(PlayState* play, Player* this) {
if (this->heldItemActionParam != PLAYER_AP_NONE) {
if (func_8008F2BC(this, this->heldItemActionParam) >= 0) {
if (this->heldItemAction != PLAYER_IA_NONE) {
if (func_8008F2BC(this, this->heldItemAction) >= 0) {
func_808328EC(this, NA_SE_IT_SWORD_PUTAWAY);
} else {
func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
@@ -2252,9 +2252,9 @@ void func_80834594(PlayState* play, Player* this) {
func_80835F44(play, this, this->heldItemId);
if (func_8008F2BC(this, this->heldItemActionParam) >= 0) {
if (func_8008F2BC(this, this->heldItemAction) >= 0) {
func_808328EC(this, NA_SE_IT_SWORD_PICKOUT);
} else if (this->heldItemActionParam != PLAYER_AP_NONE) {
} else if (this->heldItemAction != PLAYER_IA_NONE) {
func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
}
}
@@ -2264,7 +2264,7 @@ void func_80834644(PlayState* play, Player* this) {
func_80834594(play, this);
}
func_80833638(this, D_80853EDC[this->heldItemActionParam]);
func_80833638(this, D_80853EDC[this->heldItemAction]);
this->unk_834 = 0;
this->unk_6AC = 0;
func_808323B4(play, this);
@@ -2287,7 +2287,7 @@ s32 func_80834758(PlayState* play, Player* this) {
f32 frame;
if (!(this->stateFlags1 & (PLAYER_STATE1_22 | PLAYER_STATE1_23 | PLAYER_STATE1_29)) &&
(play->shootingGalleryStatus == 0) && (this->heldItemActionParam == this->itemActionParam) &&
(play->shootingGalleryStatus == 0) && (this->heldItemAction == this->itemAction) &&
(this->currentShield != PLAYER_SHIELD_NONE) && !Player_IsChildWithHylianShield(this) && func_80833BCC(this) &&
CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) {
@@ -2313,7 +2313,7 @@ s32 func_8083485C(Player* this, PlayState* play) {
void func_80834894(Player* this) {
func_80833638(this, func_80834C74);
if (this->itemActionParam < 0) {
if (this->itemAction < 0) {
func_8008EC70(this);
}
@@ -2355,10 +2355,10 @@ s32 func_808349DC(Player* this, PlayState* play) {
s32 func_80834A2C(Player* this, PlayState* play) {
if (LinkAnimation_Update(play, &this->skelAnime2) ||
((Player_ItemToActionParam(this->heldItemId) == this->heldItemActionParam) &&
((Player_ItemToItemAction(this->heldItemId) == this->heldItemAction) &&
(D_80853614 =
(D_80853614 || ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)))))) {
func_80833638(this, D_80853EDC[this->heldItemActionParam]);
func_80833638(this, D_80853EDC[this->heldItemAction]);
this->unk_834 = 0;
this->unk_6AC = 0;
D_80853618 = D_80853614;
@@ -2409,7 +2409,7 @@ s32 func_80834C74(Player* this, PlayState* play) {
D_80853614 = D_80853618;
if (D_80853614 || LinkAnimation_Update(play, &this->skelAnime2)) {
func_80833638(this, D_80853EDC[this->heldItemActionParam]);
func_80833638(this, D_80853EDC[this->heldItemAction]);
LinkAnimation_PlayLoop(play, &this->skelAnime2, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_0, this->modelAnimType));
this->unk_6AC = 0;
this->func_82C(this, play);
@@ -2422,7 +2422,7 @@ s32 func_80834C74(Player* this, PlayState* play) {
s32 func_80834D2C(Player* this, PlayState* play) {
LinkAnimationHeader* anim;
if (this->heldItemActionParam != PLAYER_AP_BOOMERANG) {
if (this->heldItemAction != PLAYER_IA_BOOMERANG) {
if (!func_8083442C(this, play)) {
return 0;
}
@@ -2820,8 +2820,7 @@ s32 func_80835C58(PlayState* play, Player* this, PlayerFunc674 func, s32 flags)
this->func_674 = func;
if ((this->itemActionParam != this->heldItemActionParam) &&
(!(flags & 1) || !(this->stateFlags1 & PLAYER_STATE1_22))) {
if ((this->itemAction != this->heldItemAction) && (!(flags & 1) || !(this->stateFlags1 & PLAYER_STATE1_22))) {
func_8008EC70(this);
}
@@ -2855,12 +2854,12 @@ void func_80835DAC(PlayState* play, Player* this, PlayerFunc674 func, s32 flags)
void func_80835DE4(PlayState* play, Player* this, PlayerFunc674 func, s32 flags) {
s32 temp;
if (this->itemActionParam >= 0) {
temp = this->itemActionParam;
this->itemActionParam = this->heldItemActionParam;
if (this->itemAction >= 0) {
temp = this->itemAction;
this->itemAction = this->heldItemAction;
func_80835C58(play, this, func, flags);
this->itemActionParam = temp;
Player_SetModels(this, Player_ActionToModelGroup(this, this->itemActionParam));
this->itemAction = temp;
Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction));
}
}
@@ -2892,30 +2891,29 @@ void func_80835EFC(Player* this) {
}
void func_80835F44(PlayState* play, Player* this, s32 item) {
s8 actionParam;
s8 itemAction;
s32 temp;
s32 nextAnimType;
actionParam = Player_ItemToActionParam(item);
itemAction = Player_ItemToItemAction(item);
if (((this->heldItemActionParam == this->itemActionParam) &&
(!(this->stateFlags1 & PLAYER_STATE1_22) || (Player_ActionToMeleeWeapon(actionParam) != 0) ||
(actionParam == PLAYER_AP_NONE))) ||
((this->itemActionParam < 0) &&
((Player_ActionToMeleeWeapon(actionParam) != 0) || (actionParam == PLAYER_AP_NONE)))) {
if (((this->heldItemAction == this->itemAction) &&
(!(this->stateFlags1 & PLAYER_STATE1_22) || (Player_ActionToMeleeWeapon(itemAction) != 0) ||
(itemAction == PLAYER_IA_NONE))) ||
((this->itemAction < 0) && ((Player_ActionToMeleeWeapon(itemAction) != 0) || (itemAction == PLAYER_IA_NONE)))) {
if ((actionParam == PLAYER_AP_NONE) || !(this->stateFlags1 & PLAYER_STATE1_27) ||
if ((itemAction == PLAYER_IA_NONE) || !(this->stateFlags1 & PLAYER_STATE1_27) ||
((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
((actionParam == PLAYER_AP_HOOKSHOT) || (actionParam == PLAYER_AP_LONGSHOT)))) {
((itemAction == PLAYER_IA_HOOKSHOT) || (itemAction == PLAYER_IA_LONGSHOT)))) {
if ((play->bombchuBowlingStatus == 0) &&
(((actionParam == PLAYER_AP_STICK) && (AMMO(ITEM_STICK) == 0)) ||
((actionParam == PLAYER_AP_BEAN) && (AMMO(ITEM_BEAN) == 0)) ||
(temp = Player_ActionToExplosive(this, actionParam),
(((itemAction == PLAYER_IA_STICK) && (AMMO(ITEM_STICK) == 0)) ||
((itemAction == PLAYER_IA_BEAN) && (AMMO(ITEM_BEAN) == 0)) ||
(temp = Player_ActionToExplosive(this, itemAction),
((temp >= 0) && ((AMMO(sExplosiveInfos[temp].itemId) == 0) ||
(play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length >= 3)))))) {
func_80078884(NA_SE_SY_ERROR);
} else if (actionParam == PLAYER_AP_LENS) {
} else if (itemAction == PLAYER_IA_LENS) {
if (Magic_RequestChange(play, 0, MAGIC_CONSUME_LENS)) {
if (play->actorCtx.lensActive) {
Actor_DisableLens(play);
@@ -2927,43 +2925,43 @@ void func_80835F44(PlayState* play, Player* this, s32 item) {
} else {
func_80078884(NA_SE_SY_ERROR);
}
} else if (actionParam == PLAYER_AP_NUT) {
} else if (itemAction == PLAYER_IA_NUT) {
if (AMMO(ITEM_NUT) != 0) {
func_8083C61C(play, this);
} else {
func_80078884(NA_SE_SY_ERROR);
}
} else if ((temp = Player_ActionToMagicSpell(this, actionParam)) >= 0) {
if (((actionParam == PLAYER_AP_FARORES_WIND) && (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 0)) ||
} else if ((temp = Player_ActionToMagicSpell(this, itemAction)) >= 0) {
if (((itemAction == PLAYER_IA_FARORES_WIND) && (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 0)) ||
((gSaveContext.magicCapacity != 0) && (gSaveContext.magicState == MAGIC_STATE_IDLE) &&
(gSaveContext.magic >= sMagicSpellCosts[temp]))) {
this->itemActionParam = actionParam;
this->itemAction = itemAction;
this->unk_6AD = 4;
} else {
func_80078884(NA_SE_SY_ERROR);
}
} else if (actionParam >= PLAYER_AP_MASK_KEATON) {
} else if (itemAction >= PLAYER_IA_MASK_KEATON) {
if (this->currentMask != PLAYER_MASK_NONE) {
this->currentMask = PLAYER_MASK_NONE;
} else {
this->currentMask = actionParam - PLAYER_AP_MASK_KEATON + 1;
this->currentMask = itemAction - PLAYER_IA_MASK_KEATON + 1;
}
func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
} else if (((actionParam >= PLAYER_AP_OCARINA_FAIRY) && (actionParam <= PLAYER_AP_OCARINA_TIME)) ||
(actionParam >= PLAYER_AP_BOTTLE_FISH)) {
} else if (((itemAction >= PLAYER_IA_OCARINA_FAIRY) && (itemAction <= PLAYER_IA_OCARINA_TIME)) ||
(itemAction >= PLAYER_IA_BOTTLE_FISH)) {
if (!func_8008E9C4(this) ||
((actionParam >= PLAYER_AP_BOTTLE_POTION_RED) && (actionParam <= PLAYER_AP_BOTTLE_FAIRY))) {
((itemAction >= PLAYER_IA_BOTTLE_POTION_RED) && (itemAction <= PLAYER_IA_BOTTLE_FAIRY))) {
TitleCard_Clear(play, &play->actorCtx.titleCtx);
this->unk_6AD = 4;
this->itemActionParam = actionParam;
this->itemAction = itemAction;
}
} else if ((actionParam != this->heldItemActionParam) ||
((this->heldActor == NULL) && (Player_ActionToExplosive(this, actionParam) >= 0))) {
this->nextModelGroup = Player_ActionToModelGroup(this, actionParam);
} else if ((itemAction != this->heldItemAction) ||
((this->heldActor == NULL) && (Player_ActionToExplosive(this, itemAction) >= 0))) {
this->nextModelGroup = Player_ActionToModelGroup(this, itemAction);
nextAnimType = gPlayerModelTypes[this->nextModelGroup][PLAYER_MODELGROUPENTRY_ANIM];
if ((this->heldItemActionParam >= 0) && (Player_ActionToMagicSpell(this, actionParam) < 0) &&
if ((this->heldItemAction >= 0) && (Player_ActionToMagicSpell(this, itemAction) < 0) &&
(item != this->heldItemId) &&
(D_80854164[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType] !=
PLAYER_D_808540F4_0)) {
@@ -2972,7 +2970,7 @@ void func_80835F44(PlayState* play, Player* this, s32 item) {
} else {
func_80835EFC(this);
func_808323B4(play, this);
func_80833664(play, this, actionParam);
func_80833664(play, this, itemAction);
}
} else {
D_80853614 = D_80853618 = true;
@@ -3021,8 +3019,7 @@ s32 func_808365C8(Player* this) {
return (!(func_808458D0 == this->func_674) ||
((this->stateFlags1 & PLAYER_STATE1_8) &&
((this->heldItemId == ITEM_LAST_USED) || (this->heldItemId == ITEM_NONE)))) &&
(!(func_80834A2C == this->func_82C) ||
(Player_ItemToActionParam(this->heldItemId) == this->heldItemActionParam));
(!(func_80834A2C == this->func_82C) || (Player_ItemToItemAction(this->heldItemId) == this->heldItemAction));
}
s32 func_80836670(Player* this, PlayState* play) {
@@ -3175,7 +3172,7 @@ void func_80836BEC(Player* this, PlayState* play) {
if (cond || (this->unk_66C != 0) || (this->stateFlags1 & (PLAYER_STATE1_12 | PLAYER_STATE1_25))) {
if (!cond) {
if (!(this->stateFlags1 & PLAYER_STATE1_25) &&
((this->heldItemActionParam != PLAYER_AP_FISHING_POLE) || (this->unk_860 == 0)) &&
((this->heldItemAction != PLAYER_IA_FISHING_POLE) || (this->unk_860 == 0)) &&
CHECK_BTN_ALL(sControlInput->press.button, BTN_Z)) {
if (this->actor.category == ACTORCAT_PLAYER) {
@@ -3407,7 +3404,7 @@ s32 func_808375D8(Player* this) {
s8 temp2;
s32 i;
if ((this->heldItemActionParam == PLAYER_AP_STICK) || Player_HoldsBrokenKnife(this)) {
if ((this->heldItemAction == PLAYER_IA_STICK) || Player_HoldsBrokenKnife(this)) {
return 0;
}
@@ -3473,7 +3470,7 @@ s32 func_80837818(Player* this) {
s32 sp1C = this->unk_84B[this->unk_846];
s32 sp18;
if (this->heldItemActionParam == PLAYER_AP_HAMMER) {
if (this->heldItemAction == PLAYER_IA_HAMMER) {
if (sp1C < 0) {
sp1C = 0;
}
@@ -3498,7 +3495,7 @@ s32 func_80837818(Player* this) {
}
}
}
if (this->heldItemActionParam == PLAYER_AP_STICK) {
if (this->heldItemAction == PLAYER_IA_STICK) {
sp18 = PLAYER_MWA_FORWARD_SLASH_1H;
}
}
@@ -4954,7 +4951,7 @@ s32 func_8083B040(Player* this, PlayState* play) {
if (!func_8083ADD4(play, this)) {
if (this->unk_6AD == 4) {
sp2C = Player_ActionToMagicSpell(this, this->itemActionParam);
sp2C = Player_ActionToMagicSpell(this, this->itemAction);
if (sp2C >= 0) {
if ((sp2C != 3) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) {
func_8083AF44(play, this, sp2C);
@@ -4969,13 +4966,13 @@ s32 func_8083B040(Player* this, PlayState* play) {
return 1;
}
sp2C = this->itemActionParam - PLAYER_AP_LETTER_ZELDA;
sp2C = this->itemAction - PLAYER_IA_LETTER_ZELDA;
if ((sp2C >= 0) ||
(sp28 = Player_ActionToBottle(this, this->itemActionParam) - 1,
(sp28 = Player_ActionToBottle(this, this->itemAction) - 1,
((sp28 >= 0) && (sp28 < 6) &&
((this->itemActionParam > PLAYER_AP_BOTTLE_POE) ||
((this->itemAction > PLAYER_IA_BOTTLE_POE) ||
((this->targetActor != NULL) &&
(((this->itemActionParam == PLAYER_AP_BOTTLE_POE) && (this->exchangeItemId == EXCH_ITEM_POE)) ||
(((this->itemAction == PLAYER_IA_BOTTLE_POE) && (this->exchangeItemId == EXCH_ITEM_POE)) ||
(this->exchangeItemId == EXCH_ITEM_BLUE_FIRE))))))) {
if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) {
@@ -4999,10 +4996,10 @@ s32 func_8083B040(Player* this, PlayState* play) {
if ((targetActor != NULL) &&
((this->exchangeItemId == sp2C) || (this->exchangeItemId == EXCH_ITEM_BLUE_FIRE) ||
((this->exchangeItemId == EXCH_ITEM_POE) &&
(this->itemActionParam == PLAYER_AP_BOTTLE_BIG_POE)) ||
(this->itemAction == PLAYER_IA_BOTTLE_BIG_POE)) ||
((this->exchangeItemId == EXCH_ITEM_BEAN) &&
(this->itemActionParam == PLAYER_AP_BOTTLE_BUG))) &&
((this->exchangeItemId != EXCH_ITEM_BEAN) || (this->itemActionParam == PLAYER_AP_BEAN))) {
(this->itemAction == PLAYER_IA_BOTTLE_BUG))) &&
((this->exchangeItemId != EXCH_ITEM_BEAN) || (this->itemAction == PLAYER_IA_BEAN))) {
if (this->exchangeItemId == EXCH_ITEM_BEAN) {
Inventory_ChangeAmmo(ITEM_BEAN, -1);
func_80835DE4(play, this, func_8084279C, 0);
@@ -5036,7 +5033,7 @@ s32 func_8083B040(Player* this, PlayState* play) {
return 1;
}
sp2C = Player_ActionToBottle(this, this->itemActionParam);
sp2C = Player_ActionToBottle(this, this->itemAction);
if (sp2C >= 0) {
if (sp2C == 0xC) {
func_80835DE4(play, this, func_8084EED8, 0);
@@ -5359,7 +5356,7 @@ s32 func_8083C1DC(Player* this, PlayState* play) {
if (func_8083BC7C(this, play)) {
return 1;
}
if ((this->unk_837 == 0) && (this->heldItemActionParam >= PLAYER_AP_SWORD_MASTER)) {
if ((this->unk_837 == 0) && (this->heldItemAction >= PLAYER_IA_SWORD_MASTER)) {
func_80835F44(play, this, ITEM_NONE);
} else {
this->stateFlags2 ^= PLAYER_STATE2_20;
@@ -5440,8 +5437,8 @@ void func_8083C50C(Player* this) {
s32 func_8083C544(Player* this, PlayState* play) {
if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) {
if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld(this) != 0) && (this->unk_844 == 1) &&
(this->heldItemActionParam != PLAYER_AP_STICK)) {
if ((this->heldItemActionParam != PLAYER_AP_SWORD_BGS) || (gSaveContext.swordHealth > 0.0f)) {
(this->heldItemAction != PLAYER_IA_STICK)) {
if ((this->heldItemAction != PLAYER_IA_SWORD_BGS) || (gSaveContext.swordHealth > 0.0f)) {
func_808377DC(play, this);
return 1;
}
@@ -5488,7 +5485,7 @@ s32 func_8083C6B8(PlayState* play, Player* this) {
return 1;
}
if (this->heldItemActionParam == PLAYER_AP_FISHING_POLE) {
if (this->heldItemAction == PLAYER_IA_FISHING_POLE) {
sp24 = this->actor.world.pos;
sp24.y += 50.0f;
@@ -6221,16 +6218,16 @@ s32 func_8083E5A8(Player* this, PlayState* play) {
if ((this->heldActor == NULL) || Player_HoldsHookshot(this)) {
if ((interactedActor->id == ACTOR_BG_TOKI_SWD) && LINK_IS_ADULT) {
s32 sp24 = this->itemActionParam;
s32 sp24 = this->itemAction;
this->itemActionParam = PLAYER_AP_NONE;
this->itemAction = PLAYER_IA_NONE;
this->modelAnimType = PLAYER_ANIMTYPE_0;
this->heldItemActionParam = this->itemActionParam;
this->heldItemAction = this->itemAction;
func_80836898(play, this, func_8083A0F4);
if (sp24 == PLAYER_AP_SWORD_MASTER) {
this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_AP_LAST_USED);
func_8083399C(play, this, PLAYER_AP_LAST_USED);
if (sp24 == PLAYER_IA_SWORD_MASTER) {
this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_IA_LAST_USED);
func_8083399C(play, this, PLAYER_IA_LAST_USED);
} else {
func_80835F44(play, this, ITEM_LAST_USED);
}
@@ -7714,7 +7711,7 @@ void func_80842A88(PlayState* play, Player* this) {
}
s32 func_80842AC4(PlayState* play, Player* this) {
if ((this->heldItemActionParam == PLAYER_AP_STICK) && (this->unk_85C > 0.5f)) {
if ((this->heldItemAction == PLAYER_IA_STICK) && (this->unk_85C > 0.5f)) {
if (AMMO(ITEM_STICK) != 0) {
EffectSsStick_Spawn(play, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], this->actor.shape.rot.y + 0x8000);
this->unk_85C = 0.5f;
@@ -7729,7 +7726,7 @@ s32 func_80842AC4(PlayState* play, Player* this) {
}
s32 func_80842B7C(PlayState* play, Player* this) {
if (this->heldItemActionParam == PLAYER_AP_SWORD_BGS) {
if (this->heldItemAction == PLAYER_IA_SWORD_BGS) {
if (!gSaveContext.bgsFlag && (gSaveContext.swordHealth > 0.0f)) {
if ((gSaveContext.swordHealth -= 1.0f) <= 0.0f) {
EffectSsStick_Spawn(play, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND],
@@ -7811,7 +7808,7 @@ s32 func_80842DF4(PlayState* play, Player* this) {
(SurfaceType_GetFloorType(&play->colCtx, sp78, sp74) != FLOOR_TYPE_6) &&
(func_8002F9EC(play, &this->actor, sp78, sp74, &sp5C) == 0)) {
if (this->heldItemActionParam == PLAYER_AP_HAMMER) {
if (this->heldItemAction == PLAYER_IA_HAMMER) {
func_80832630(play);
func_80842A28(play, this);
func_80842D20(play, this);
@@ -7856,7 +7853,7 @@ s32 func_80842DF4(PlayState* play, Player* this) {
}
}
if ((func_80842AC4(play, this) == 0) && (this->heldItemActionParam != PLAYER_AP_HAMMER)) {
if ((func_80842AC4(play, this) == 0) && (this->heldItemAction != PLAYER_IA_HAMMER)) {
func_80842B7C(play, this);
if (this->actor.colChkInfo.atHitEffect == 1) {
@@ -7948,7 +7945,7 @@ void func_80843188(Player* this, PlayState* play) {
ANIMMODE_ONCE, 0.0f);
func_80832F54(play, this, 4);
} else {
if (this->itemActionParam < 0) {
if (this->itemAction < 0) {
func_8008EC70(this);
}
func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_22, this->modelAnimType), play);
@@ -9220,15 +9217,15 @@ static u8 D_808546F0[] = { ITEM_SWORD_MASTER, ITEM_SWORD_KOKIRI };
void func_80846720(PlayState* play, Player* this, s32 arg2) {
s32 item = D_808546F0[(void)0, gSaveContext.linkAge];
s32 actionParam = sItemActionParams[item];
s32 itemAction = sItemActions[item];
func_80835EFC(this);
func_808323B4(play, this);
this->heldItemId = item;
this->nextModelGroup = Player_ActionToModelGroup(this, actionParam);
this->nextModelGroup = Player_ActionToModelGroup(this, itemAction);
func_8083399C(play, this, actionParam);
func_8083399C(play, this, itemAction);
func_80834644(play, this);
if (arg2 != 0) {
@@ -9358,7 +9355,7 @@ void Player_Init(Actor* thisx, PlayState* play2) {
thisx->room = -1;
this->ageProperties = &sAgeProperties[gSaveContext.linkAge];
this->itemActionParam = this->heldItemActionParam = -1;
this->itemAction = this->heldItemAction = -1;
this->heldItemId = ITEM_NONE;
func_80835F44(play, this, ITEM_NONE);
@@ -9525,7 +9522,7 @@ void func_808473D4(PlayState* play, Player* this) {
if (!Player_InBlockingCsMode(play, this)) {
if (this->stateFlags1 & PLAYER_STATE1_20) {
doAction = DO_ACTION_RETURN;
} else if ((this->heldItemActionParam == PLAYER_AP_FISHING_POLE) && (this->unk_860 != 0)) {
} else if ((this->heldItemAction == PLAYER_IA_FISHING_POLE) && (this->unk_860 != 0)) {
if (this->unk_860 == 2) {
doAction = DO_ACTION_REEL;
}
@@ -9601,7 +9598,7 @@ void func_808473D4(PlayState* play, Player* this) {
} else if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && func_80833BCC(this) &&
(sp20 > 0)) {
doAction = DO_ACTION_JUMP;
} else if ((this->heldItemActionParam >= PLAYER_AP_SWORD_MASTER) ||
} else if ((this->heldItemAction >= PLAYER_IA_SWORD_MASTER) ||
((this->stateFlags2 & PLAYER_STATE2_20) &&
(play->actorCtx.targetCtx.arrowPointedActor == NULL))) {
doAction = DO_ACTION_PUTAWAY;
@@ -10220,9 +10217,9 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
func_808473D4(play, this);
func_80836BEC(this, play);
if ((this->heldItemActionParam == PLAYER_AP_STICK) && (this->unk_860 != 0)) {
if ((this->heldItemAction == PLAYER_IA_STICK) && (this->unk_860 != 0)) {
func_80848A04(play, this);
} else if ((this->heldItemActionParam == PLAYER_AP_FISHING_POLE) && (this->unk_860 < 0)) {
} else if ((this->heldItemAction == PLAYER_IA_FISHING_POLE) && (this->unk_860 < 0)) {
this->unk_860++;
}
@@ -11002,8 +10999,8 @@ s32 func_8084B3CC(PlayState* play, Player* this) {
}
void func_8084B498(Player* this) {
this->itemActionParam =
(INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY) ? PLAYER_AP_OCARINA_FAIRY : PLAYER_AP_OCARINA_TIME;
this->itemAction =
(INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY) ? PLAYER_IA_OCARINA_FAIRY : PLAYER_IA_OCARINA_TIME;
}
s32 func_8084B4D4(PlayState* play, Player* this) {
@@ -11056,8 +11053,7 @@ void func_8084B530(Player* this, PlayState* play) {
} else if (!func_8008E9C4(this) && LinkAnimation_Update(play, &this->skelAnime)) {
if (this->skelAnime.moveFlags != 0) {
func_80832DBC(this);
if ((this->targetActor->category == ACTORCAT_NPC) &&
(this->heldItemActionParam != PLAYER_AP_FISHING_POLE)) {
if ((this->targetActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) {
func_808322D0(play, this, &gPlayerAnim_link_normal_talk_free);
} else {
func_80832284(play, this, func_80833338(this));
@@ -12395,7 +12391,7 @@ static u8 D_808549FC[] = {
void func_8084EAC0(Player* this, PlayState* play) {
if (LinkAnimation_Update(play, &this->skelAnime)) {
if (this->unk_850 == 0) {
if (this->itemActionParam == PLAYER_AP_BOTTLE_POE) {
if (this->itemAction == PLAYER_IA_BOTTLE_POE) {
s32 rand = Rand_S16Offset(-1, 3);
if (rand == 0) {
@@ -12412,7 +12408,7 @@ void func_8084EAC0(Player* this, PlayState* play) {
gSaveContext.healthAccumulator = rand * 0x10;
}
} else {
s32 sp28 = D_808549FC[this->itemActionParam - PLAYER_AP_BOTTLE_POTION_RED];
s32 sp28 = D_808549FC[this->itemAction - PLAYER_IA_BOTTLE_POTION_RED];
if (sp28 & 1) {
gSaveContext.healthAccumulator = 0x140;
@@ -12438,7 +12434,7 @@ void func_8084EAC0(Player* this, PlayState* play) {
if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.magicState != MAGIC_STATE_FILL)) {
func_80832B78(play, this, &gPlayerAnim_link_bottle_drink_demo_end);
this->unk_850 = 2;
Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE);
Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_IA_BOTTLE);
}
func_80832698(this, NA_SE_VO_LI_DRINK - SFX_FLAG);
} else if ((this->unk_850 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 29.0f)) {
@@ -12447,10 +12443,10 @@ void func_8084EAC0(Player* this, PlayState* play) {
}
static BottleCatchInfo sBottleCatchInfos[] = {
{ ACTOR_EN_ELF, ITEM_FAIRY, PLAYER_AP_BOTTLE_FAIRY, 0x46 },
{ ACTOR_EN_FISH, ITEM_FISH, PLAYER_AP_BOTTLE_FISH, 0x47 },
{ ACTOR_EN_ICE_HONO, ITEM_BLUE_FIRE, PLAYER_AP_BOTTLE_FIRE, 0x5D },
{ ACTOR_EN_INSECT, ITEM_BUG, PLAYER_AP_BOTTLE_BUG, 0x7A },
{ ACTOR_EN_ELF, ITEM_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x46 },
{ ACTOR_EN_FISH, ITEM_FISH, PLAYER_IA_BOTTLE_FISH, 0x47 },
{ ACTOR_EN_ICE_HONO, ITEM_BLUE_FIRE, PLAYER_IA_BOTTLE_FIRE, 0x5D },
{ ACTOR_EN_INSECT, ITEM_BUG, PLAYER_IA_BOTTLE_BUG, 0x7A },
};
void func_8084ECA4(Player* this, PlayState* play) {
@@ -12500,7 +12496,7 @@ void func_8084ECA4(Player* this, PlayState* play) {
this->unk_850 = 0;
this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29;
this->interactRangeActor->parent = &this->actor;
Player_UpdateBottleHeld(play, this, catchInfo->itemId, ABS(catchInfo->actionParam));
Player_UpdateBottleHeld(play, this, catchInfo->itemId, ABS(catchInfo->itemAction));
func_808322D0(play, this, sp24->unk_04);
func_80835EA4(play, 4);
}
@@ -12529,7 +12525,7 @@ void func_8084EED8(Player* this, PlayState* play) {
if (LinkAnimation_OnFrame(&this->skelAnime, 37.0f)) {
Player_SpawnFairy(play, this, &this->leftHandPos, &D_80854A1C, FAIRY_REVIVE_BOTTLE);
Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE);
Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_IA_BOTTLE);
func_8002F7DC(&this->actor, NA_SE_EV_BOTTLE_CAP_OPEN);
func_8002F7DC(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG);
} else if (LinkAnimation_OnFrame(&this->skelAnime, 47.0f)) {
@@ -12558,14 +12554,14 @@ void func_8084EFC0(Player* this, PlayState* play) {
}
if (LinkAnimation_OnFrame(&this->skelAnime, 76.0f)) {
BottleDropInfo* dropInfo = &D_80854A28[this->itemActionParam - PLAYER_AP_BOTTLE_FISH];
BottleDropInfo* dropInfo = &D_80854A28[this->itemAction - PLAYER_IA_BOTTLE_FISH];
Actor_Spawn(&play->actorCtx, play, dropInfo->actorId,
(Math_SinS(this->actor.shape.rot.y) * 5.0f) + this->leftHandPos.x, this->leftHandPos.y,
(Math_CosS(this->actor.shape.rot.y) * 5.0f) + this->leftHandPos.z, 0x4000, this->actor.shape.rot.y,
0, dropInfo->actorParams);
Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_AP_BOTTLE);
Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_IA_BOTTLE);
return;
}
@@ -12594,7 +12590,7 @@ void func_8084F104(Player* this, PlayState* play) {
} else {
GetItemEntry* giEntry = &sGetItemTable[D_80854528[this->exchangeItemId - 1] - 1];
if (this->itemActionParam >= PLAYER_AP_LETTER_ZELDA) {
if (this->itemAction >= PLAYER_IA_LETTER_ZELDA) {
if (giEntry->gi >= 0) {
this->unk_862 = giEntry->gi;
} else {
@@ -12605,7 +12601,7 @@ void func_8084F104(Player* this, PlayState* play) {
if (this->unk_850 == 0) {
Message_StartTextbox(play, this->actor.textId, &this->actor);
if ((this->itemActionParam == PLAYER_AP_CHICKEN) || (this->itemActionParam == PLAYER_AP_POCKET_CUCCO)) {
if ((this->itemAction == PLAYER_IA_CHICKEN) || (this->itemAction == PLAYER_IA_POCKET_CUCCO)) {
func_8002F7DC(&this->actor, NA_SE_EV_CHICKEN_CRY_M);
}
@@ -13013,7 +13009,7 @@ void func_808502D0(Player* this, PlayState* play) {
if (!func_80842DF4(play, this)) {
func_8084285C(this, 0.0f, sp44->unk_0C, sp44->unk_0D);
if ((this->stateFlags2 & PLAYER_STATE2_30) && (this->heldItemActionParam != PLAYER_AP_HAMMER) &&
if ((this->stateFlags2 & PLAYER_STATE2_30) && (this->heldItemAction != PLAYER_IA_HAMMER) &&
LinkAnimation_OnFrame(&this->skelAnime, 0.0f)) {
this->linearVelocity = 15.0f;
this->stateFlags2 &= ~PLAYER_STATE2_30;
@@ -13050,7 +13046,7 @@ void func_808502D0(Player* this, PlayState* play) {
this->skelAnime.moveFlags = sp43;
this->stateFlags3 |= PLAYER_STATE3_3;
}
} else if (this->heldItemActionParam == PLAYER_AP_HAMMER) {
} else if (this->heldItemAction == PLAYER_IA_HAMMER) {
if ((this->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD) ||
(this->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_FINISH)) {
static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
@@ -13180,7 +13176,7 @@ static struct_80832924 D_80854A8C[][2] = {
void func_808507F4(Player* this, PlayState* play) {
if (LinkAnimation_Update(play, &this->skelAnime)) {
if (this->unk_84F < 0) {
if ((this->itemActionParam == PLAYER_AP_NAYRUS_LOVE) || (gSaveContext.magicState == MAGIC_STATE_IDLE)) {
if ((this->itemAction == PLAYER_IA_NAYRUS_LOVE) || (gSaveContext.magicState == MAGIC_STATE_IDLE)) {
func_80839FFC(this, play);
func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN));
}
@@ -13936,7 +13932,7 @@ void func_80851CA4(PlayState* play, Player* this, CsCmdActorAction* arg2) {
void func_80851D2C(PlayState* play, Player* this, CsCmdActorAction* arg2) {
func_80850F1C(play, this, &gPlayerAnim_link_normal_okarina_start);
func_8084B498(this);
Player_SetModels(this, Player_ActionToModelGroup(this, this->itemActionParam));
Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction));
}
static struct_80832924 D_808551B8[] = {
@@ -14190,9 +14186,9 @@ void func_80852648(PlayState* play, Player* this, CsCmdActorAction* arg2) {
LinkAnimation_Update(play, &this->skelAnime);
if (LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) {
this->heldItemActionParam = this->itemActionParam = PLAYER_AP_NONE;
this->heldItemAction = this->itemAction = PLAYER_IA_NONE;
this->heldItemId = ITEM_NONE;
this->modelGroup = this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_AP_NONE);
this->modelGroup = this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_IA_NONE);
this->leftHandDLists = gPlayerLeftHandOpenDLs;
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER);
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
@@ -14253,7 +14249,7 @@ void func_808528C8(PlayState* play, Player* this, CsCmdActorAction* arg2) {
func_8084285C(this, 0.0f, 99.0f, this->skelAnime.endFrame - 8.0f);
}
if (this->heldItemActionParam != PLAYER_AP_SWORD_MASTER) {
if (this->heldItemAction != PLAYER_IA_SWORD_MASTER) {
func_80846720(play, this, 1);
}
}
@@ -14377,7 +14373,7 @@ void func_80852E14(Player* this, PlayState* play) {
s32 Player_IsDroppingFish(PlayState* play) {
Player* this = GET_PLAYER(play);
return (func_8084EFC0 == this->func_674) && (this->itemActionParam == PLAYER_AP_BOTTLE_FISH);
return (func_8084EFC0 == this->func_674) && (this->itemAction == PLAYER_IA_BOTTLE_FISH);
}
s32 Player_StartFishing(PlayState* play) {
@@ -14472,7 +14468,7 @@ void func_80853148(PlayState* play, Actor* actor) {
if (func_808332B8(this)) {
func_80836898(play, this, func_8083A2F8);
func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim_wait);
} else if ((actor->category != ACTORCAT_NPC) || (this->heldItemActionParam == PLAYER_AP_FISHING_POLE)) {
} else if ((actor->category != ACTORCAT_NPC) || (this->heldItemAction == PLAYER_IA_FISHING_POLE)) {
func_8083A2F8(play, this);
if (!func_8008E9C4(this)) {
@@ -1894,6 +1894,7 @@ void FileSelect_Init(GameState* thisx) {
this->state.destroy = FileSelect_Destroy;
FileSelect_InitContext(&this->state);
Font_LoadOrderedFont(&this->font);
Audio_QueueSeqCmd(0xF << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xA);
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
SEQCMD_RESET_AUDIO_HEAP(0, 10);
// Setting ioData to 1 and writing it to ioPort 7 will skip the harp intro
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
}
@@ -30,7 +30,7 @@ void MapSelect_LoadGame(MapSelectState* this, s32 entranceIndex) {
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED;
gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0;
Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_STOP);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
gSaveContext.entranceIndex = entranceIndex;
gSaveContext.respawnFlag = 0;
gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = ENTR_LOAD_OPENING;
@@ -313,7 +313,7 @@ void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, u16 specialPos) {
PauseContext* pauseCtx = &play->pauseCtx;
pauseCtx->cursorSpecialPos = specialPos;
pauseCtx->pageSwitchTimer = 0;
pauseCtx->pageSwitchInputTimer = 0;
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
@@ -409,21 +409,21 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
if (pauseCtx->stickAdjX < -30) {
pauseCtx->pageSwitchTimer++;
if ((pauseCtx->pageSwitchTimer >= 10) || (pauseCtx->pageSwitchTimer == 0)) {
pauseCtx->pageSwitchInputTimer++;
if ((pauseCtx->pageSwitchInputTimer >= 10) || (pauseCtx->pageSwitchInputTimer == 0)) {
KaleidoScope_SwitchPage(pauseCtx, 0);
}
} else {
pauseCtx->pageSwitchTimer = -1;
pauseCtx->pageSwitchInputTimer = -1;
}
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) {
if (pauseCtx->stickAdjX > 30) {
pauseCtx->pageSwitchTimer++;
if ((pauseCtx->pageSwitchTimer >= 10) || (pauseCtx->pageSwitchTimer == 0)) {
pauseCtx->pageSwitchInputTimer++;
if ((pauseCtx->pageSwitchInputTimer >= 10) || (pauseCtx->pageSwitchInputTimer == 0)) {
KaleidoScope_SwitchPage(pauseCtx, 2);
}
} else {
pauseCtx->pageSwitchTimer = -1;
pauseCtx->pageSwitchInputTimer = -1;
}
}
}
@@ -508,10 +508,10 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
};
static s16 D_8082AD3C = 20;
static s16 D_8082AD40 = 0;
static s16 D_8082AD44 = 0;
static s16 D_8082AD48 = 0;
static s16 D_8082AD4C = 0;
static s16 D_8082AD50 = 0;
static s16 sStickXRepeatTimer = 0;
static s16 sStickYRepeatTimer = 0;
static s16 sStickXRepeatState = 0;
static s16 sStickYRepeatState = 0;
PauseContext* pauseCtx = &play->pauseCtx;
s16 stepR;
s16 stepG;
@@ -553,55 +553,59 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
}
if (pauseCtx->stickAdjX < -30) {
if (D_8082AD4C == -1) {
if (--D_8082AD44 < 0) {
D_8082AD44 = XREG(6);
if (sStickXRepeatState == -1) {
sStickXRepeatTimer--;
if (sStickXRepeatTimer < 0) {
sStickXRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY;
} else {
pauseCtx->stickAdjX = 0;
}
} else {
D_8082AD44 = XREG(8);
D_8082AD4C = -1;
sStickXRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY_FIRST;
sStickXRepeatState = -1;
}
} else if (pauseCtx->stickAdjX > 30) {
if (D_8082AD4C == 1) {
if (--D_8082AD44 < 0) {
D_8082AD44 = XREG(6);
if (sStickXRepeatState == 1) {
sStickXRepeatTimer--;
if (sStickXRepeatTimer < 0) {
sStickXRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY;
} else {
pauseCtx->stickAdjX = 0;
}
} else {
D_8082AD44 = XREG(8);
D_8082AD4C = 1;
sStickXRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY_FIRST;
sStickXRepeatState = 1;
}
} else {
D_8082AD4C = 0;
sStickXRepeatState = 0;
}
if (pauseCtx->stickAdjY < -30) {
if (D_8082AD50 == -1) {
if (--D_8082AD48 < 0) {
D_8082AD48 = XREG(6);
if (sStickYRepeatState == -1) {
sStickYRepeatTimer--;
if (sStickYRepeatTimer < 0) {
sStickYRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY;
} else {
pauseCtx->stickAdjY = 0;
}
} else {
D_8082AD48 = XREG(8);
D_8082AD50 = -1;
sStickYRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY_FIRST;
sStickYRepeatState = -1;
}
} else if (pauseCtx->stickAdjY > 30) {
if (D_8082AD50 == 1) {
if (--D_8082AD48 < 0) {
D_8082AD48 = XREG(6);
if (sStickYRepeatState == 1) {
sStickYRepeatTimer--;
if (sStickYRepeatTimer < 0) {
sStickYRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY;
} else {
pauseCtx->stickAdjY = 0;
}
} else {
D_8082AD48 = XREG(8);
D_8082AD50 = 1;
sStickYRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY_FIRST;
sStickYRepeatState = 1;
}
} else {
D_8082AD50 = 0;
sStickYRepeatState = 0;
}
}
@@ -3406,7 +3410,7 @@ void KaleidoScope_Update(PlayState* play) {
gSaveContext.respawnFlag = -2;
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
gSaveContext.health = 0x30;
Audio_QueueSeqCmd(0xF << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xA);
SEQCMD_RESET_AUDIO_HEAP(0, 10);
gSaveContext.healthAccumulator = 0;
gSaveContext.magicState = MAGIC_STATE_IDLE;
gSaveContext.prevMagicState = MAGIC_STATE_IDLE;