1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-15 12:24:39 +00:00

Merge branch 'master' into doc_pause_menu

This commit is contained in:
Dragorn421 2022-10-12 08:44:59 +02:00
commit 4eae3ca126
No known key found for this signature in database
GPG key ID: 32B53D2D16FC4118
157 changed files with 1717 additions and 1640 deletions

View file

@ -1,4 +1,5 @@
<Root> <Root>
<ExternalFile XmlPath="objects/object_mori_tex.xml" OutPath="assets/objects/object_mori_tex/"/>
<File Name="object_mori_hineri1" Segment="6"> <File Name="object_mori_hineri1" Segment="6">
<DList Name="object_mori_hineri1_DL_0024E0" Offset="0x24E0"/> <DList Name="object_mori_hineri1_DL_0024E0" Offset="0x24E0"/>
<Collision Name="object_mori_hineri1_Col_0054B8" Offset="0x54B8"/> <Collision Name="object_mori_hineri1_Col_0054B8" Offset="0x54B8"/>

View file

@ -1,4 +1,5 @@
<Root> <Root>
<ExternalFile XmlPath="objects/object_mori_tex.xml" OutPath="assets/objects/object_mori_tex/"/>
<File Name="object_mori_hineri1a" Segment="6"> <File Name="object_mori_hineri1a" Segment="6">
<DList Name="object_mori_hineri1a_DL_001980" Offset="0x1980"/> <DList Name="object_mori_hineri1a_DL_001980" Offset="0x1980"/>
<Collision Name="object_mori_hineri1a_Col_003490" Offset="0x3490"/> <Collision Name="object_mori_hineri1a_Col_003490" Offset="0x3490"/>

View file

@ -1,4 +1,5 @@
<Root> <Root>
<ExternalFile XmlPath="objects/object_mori_tex.xml" OutPath="assets/objects/object_mori_tex/"/>
<File Name="object_mori_hineri2" Segment="6"> <File Name="object_mori_hineri2" Segment="6">
<DList Name="object_mori_hineri2_DL_0020F0" Offset="0x20F0"/> <DList Name="object_mori_hineri2_DL_0020F0" Offset="0x20F0"/>
<Collision Name="object_mori_hineri2_Col_0043D0" Offset="0x43D0"/> <Collision Name="object_mori_hineri2_Col_0043D0" Offset="0x43D0"/>

View file

@ -1,4 +1,5 @@
<Root> <Root>
<ExternalFile XmlPath="objects/object_mori_tex.xml" OutPath="assets/objects/object_mori_tex/"/>
<File Name="object_mori_hineri2a" Segment="6"> <File Name="object_mori_hineri2a" Segment="6">
<DList Name="object_mori_hineri2a_DL_002B70" Offset="0x2B70"/> <DList Name="object_mori_hineri2a_DL_002B70" Offset="0x2B70"/>
<Collision Name="object_mori_hineri2a_Col_006078" Offset="0x6078"/> <Collision Name="object_mori_hineri2a_Col_006078" Offset="0x6078"/>

View file

@ -1,4 +1,5 @@
<Root> <Root>
<ExternalFile XmlPath="objects/object_mori_tex.xml" OutPath="assets/objects/object_mori_tex/"/>
<File Name="object_mori_objects" Segment="6"> <File Name="object_mori_objects" Segment="6">
<Texture Name="gMoriHashiraTLUT" OutName="hashira_tlut" Format="rgba16" Width="112" Height="1" Offset="0x0000"/> <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"/> <Texture Name="gMoriHashiraTex" OutName="hashira" Format="ci8" Width="32" Height="32" Offset="0x00E0" TlutOffset="0x0000"/>

View file

@ -1,5 +1,30 @@
<Root> <Root>
<File Name="object_mori_tex" Segment="6"> <File Name="object_mori_tex" Segment="8">
<Blob Name="object_moriTex_Blob_000000" Size="0x9E00" Offset="0x0"/> <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> </File>
</Root> </Root>

View file

@ -641,8 +641,8 @@ s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec
void BgCheck_DrawDynaCollision(PlayState*, CollisionContext*); void BgCheck_DrawDynaCollision(PlayState*, CollisionContext*);
void BgCheck_DrawStaticCollision(PlayState*, CollisionContext*); void BgCheck_DrawStaticCollision(PlayState*, CollisionContext*);
void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId); void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId);
s32 func_800433A4(CollisionContext* colCtx, s32 bgId, Actor* actor); s32 DynaPolyActor_TransformCarriedActor(CollisionContext* colCtx, s32 bgId, Actor* carriedActor);
void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags); void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 transformFlags);
void DynaPolyActor_UnsetAllInteractFlags(DynaPolyActor* dynaActor); void DynaPolyActor_UnsetAllInteractFlags(DynaPolyActor* dynaActor);
void DynaPolyActor_SetActorOnTop(DynaPolyActor* dynaActor); void DynaPolyActor_SetActorOnTop(DynaPolyActor* dynaActor);
void DynaPoly_SetPlayerOnTop(CollisionContext* colCtx, s32 floorBgId); void DynaPoly_SetPlayerOnTop(CollisionContext* colCtx, s32 floorBgId);
@ -1013,13 +1013,13 @@ s32 Player_InBlockingCsMode(PlayState* play, Player* this);
s32 Player_InCsMode(PlayState* play); s32 Player_InCsMode(PlayState* play);
s32 func_8008E9C4(Player* this); s32 func_8008E9C4(Player* this);
s32 Player_IsChildWithHylianShield(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_SetModelsForHoldingShield(Player* this);
void Player_SetModels(Player* this, s32 modelGroup); void Player_SetModels(Player* this, s32 modelGroup);
void Player_SetModelGroup(Player* this, s32 modelGroup); void Player_SetModelGroup(Player* this, s32 modelGroup);
void func_8008EC70(Player* this); void func_8008EC70(Player* this);
void Player_SetEquipmentData(PlayState* play, 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_8008EDF0(Player* this);
void func_8008EE08(Player* this); void func_8008EE08(Player* this);
void func_8008EEAC(PlayState* play, Actor* actor); void func_8008EEAC(PlayState* play, Actor* actor);
@ -1030,18 +1030,18 @@ u8 Player_GetMask(PlayState* play);
Player* Player_UnsetMask(PlayState* play); Player* Player_UnsetMask(PlayState* play);
s32 Player_HasMirrorShieldEquipped(PlayState* play); s32 Player_HasMirrorShieldEquipped(PlayState* play);
s32 Player_HasMirrorShieldSetToDraw(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 Player_HoldsHookshot(Player* this);
s32 func_8008F128(Player* this); s32 func_8008F128(Player* this);
s32 Player_ActionToMeleeWeapon(s32 actionParam); s32 Player_ActionToMeleeWeapon(s32 itemAction);
s32 Player_GetMeleeWeaponHeld(Player* this); s32 Player_GetMeleeWeaponHeld(Player* this);
s32 Player_HoldsTwoHandedWeapon(Player* this); s32 Player_HoldsTwoHandedWeapon(Player* this);
s32 Player_HoldsBrokenKnife(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_GetBottleHeld(Player* this);
s32 Player_ActionToExplosive(Player* this, s32 actionParam); s32 Player_ActionToExplosive(Player* this, s32 itemAction);
s32 Player_GetExplosiveHeld(Player* this); s32 Player_GetExplosiveHeld(Player* this);
s32 func_8008F2BC(Player* this, s32 actionParam); s32 func_8008F2BC(Player* this, s32 itemAction);
s32 func_8008F2F8(PlayState* play); s32 func_8008F2F8(PlayState* play);
void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic, void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw, s32 boots, s32 face, OverrideLimbDrawOpa overrideLimbDraw, PostLimbDrawOpa postLimbDraw,
@ -1866,8 +1866,8 @@ void Audio_ClearSariaBgm(void);
void Audio_ClearSariaBgmAtPos(Vec3f* pos); void Audio_ClearSariaBgmAtPos(Vec3f* pos);
void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax); void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax);
void Audio_ClearSariaBgm2(void); void Audio_ClearSariaBgm2(void);
void func_800F5510(u16 seqId); void Audio_PlayMorningSceneSequence(u16 seqId);
void func_800F5550(u16 seqId); void Audio_PlaySceneSequence(u16 seqId);
void func_800F574C(f32 scaleTempoAndFreq, u8 duration); void func_800F574C(f32 scaleTempoAndFreq, u8 duration);
void func_800F5718(void); void func_800F5718(void);
void func_800F5918(void); void func_800F5918(void);
@ -1879,12 +1879,12 @@ void func_800F5B58(void);
void func_800F5BF0(u8 natureAmbienceId); void func_800F5BF0(u8 natureAmbienceId);
void Audio_PlayFanfare(u16); void Audio_PlayFanfare(u16);
void func_800F5C2C(void); void func_800F5C2C(void);
void func_800F5E18(u8 seqPlayerIndex, u16 seqId, u8 fadeTimer, s8 ioPort, s8 ioData); void Audio_PlaySequenceWithSeqPlayerIO(u8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, s8 ioData);
void Audio_SetSequenceMode(u8 seqMode); void Audio_SetSequenceMode(u8 seqMode);
void Audio_SetBgmEnemyVolume(f32 dist); 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_800F64E0(u8 arg0);
void func_800F6584(u8 arg0); void Audio_ToggleMalonSinging(u8 malonSingingDisabled);
void Audio_SetEnvReverb(s8 reverb); void Audio_SetEnvReverb(s8 reverb);
void Audio_SetCodeReverb(s8 reverb); void Audio_SetCodeReverb(s8 reverb);
void func_800F6700(s8 audioSetting); void func_800F6700(s8 audioSetting);

View file

@ -218,7 +218,7 @@ extern u16 gAudioSfxSwapSource[10];
extern u16 gAudioSfxSwapTarget[10]; extern u16 gAudioSfxSwapTarget[10];
extern u8 gAudioSfxSwapMode[10]; extern u8 gAudioSfxSwapMode[10];
extern ActiveSequence gActiveSeqs[4]; extern ActiveSequence gActiveSeqs[4];
extern AudioContext gAudioContext; extern AudioContext gAudioCtx;
extern void(*D_801755D0)(void); extern void(*D_801755D0)(void);
extern u32 __osMalloc_FreeBlockTest_Enable; extern u32 __osMalloc_FreeBlockTest_Enable;

View file

@ -1363,13 +1363,6 @@ typedef struct {
/* 0x1CAD6 */ s16 unk_1CAD6[5]; /* 0x1CAD6 */ s16 unk_1CAD6[5];
} FileSelectState; // size = 0x1CAE0 } FileSelectState; // size = 0x1CAE0
typedef enum {
DPM_UNK = 0,
DPM_PLAYER = 1,
DPM_ENEMY = 2,
DPM_UNK3 = 3
} DynaPolyMoveFlag;
typedef struct { typedef struct {
/* 0x00 */ AnimationHeader* animation; /* 0x00 */ AnimationHeader* animation;
/* 0x04 */ f32 playSpeed; /* 0x04 */ f32 playSpeed;

View file

@ -254,6 +254,9 @@ if neither of the above are set : blue
0x2000 : translucent, else opaque 0x2000 : translucent, else opaque
*/ */
#define DYNA_TRANSFORM_POS (1 << 0) // Position of the actors on top follows the dynapoly actor's movement.
#define DYNA_TRANSFORM_ROT_Y (1 << 1) // The Y rotation of the actors on top follows the dynapoly actor's Y rotation.
#define DYNA_INTERACT_ACTOR_ON_TOP (1 << 0) // There is an actor standing on the collision of the dynapoly actor #define DYNA_INTERACT_ACTOR_ON_TOP (1 << 0) // There is an actor standing on the collision of the dynapoly actor
#define DYNA_INTERACT_PLAYER_ON_TOP (1 << 1) // The player actor is standing on the collision of the dynapoly actor #define DYNA_INTERACT_PLAYER_ON_TOP (1 << 1) // The player actor is standing on the collision of the dynapoly actor
#define DYNA_INTERACT_PLAYER_ABOVE (1 << 2) // The player is directly above the collision of the dynapoly actor (any distance above) #define DYNA_INTERACT_PLAYER_ABOVE (1 << 2) // The player is directly above the collision of the dynapoly actor (any distance above)
@ -265,8 +268,7 @@ typedef struct DynaPolyActor {
/* 0x150 */ f32 unk_150; /* 0x150 */ f32 unk_150;
/* 0x154 */ f32 unk_154; /* 0x154 */ f32 unk_154;
/* 0x158 */ s16 unk_158; // y rotation? /* 0x158 */ s16 unk_158; // y rotation?
/* 0x15A */ u16 unk_15A; /* 0x15C */ u32 transformFlags;
/* 0x15C */ u32 unk_15C;
/* 0x160 */ u8 interactFlags; /* 0x160 */ u8 interactFlags;
/* 0x162 */ s16 unk_162; /* 0x162 */ s16 unk_162;
} DynaPolyActor; // size = 0x164 } DynaPolyActor; // size = 0x164

View file

@ -7,8 +7,9 @@
#define TATUMS_PER_BEAT 48 #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_NUM_CHANNELS 16
#define SEQ_IO_VAL_NONE -1
#define MAX_CHANNELS_PER_BANK 3 #define MAX_CHANNELS_PER_BANK 3

View file

@ -62,75 +62,75 @@ typedef enum {
} PlayerMask; } PlayerMask;
typedef enum { typedef enum {
/* 0x00 */ PLAYER_AP_NONE, /* 0x00 */ PLAYER_IA_NONE,
/* 0x01 */ PLAYER_AP_LAST_USED, /* 0x01 */ PLAYER_IA_LAST_USED,
/* 0x02 */ PLAYER_AP_FISHING_POLE, /* 0x02 */ PLAYER_IA_FISHING_POLE,
/* 0x03 */ PLAYER_AP_SWORD_MASTER, /* 0x03 */ PLAYER_IA_SWORD_MASTER,
/* 0x04 */ PLAYER_AP_SWORD_KOKIRI, /* 0x04 */ PLAYER_IA_SWORD_KOKIRI,
/* 0x05 */ PLAYER_AP_SWORD_BGS, /* 0x05 */ PLAYER_IA_SWORD_BGS,
/* 0x06 */ PLAYER_AP_STICK, /* 0x06 */ PLAYER_IA_STICK,
/* 0x07 */ PLAYER_AP_HAMMER, /* 0x07 */ PLAYER_IA_HAMMER,
/* 0x08 */ PLAYER_AP_BOW, /* 0x08 */ PLAYER_IA_BOW,
/* 0x09 */ PLAYER_AP_BOW_FIRE, /* 0x09 */ PLAYER_IA_BOW_FIRE,
/* 0x0A */ PLAYER_AP_BOW_ICE, /* 0x0A */ PLAYER_IA_BOW_ICE,
/* 0x0B */ PLAYER_AP_BOW_LIGHT, /* 0x0B */ PLAYER_IA_BOW_LIGHT,
/* 0x0C */ PLAYER_AP_BOW_0C, /* 0x0C */ PLAYER_IA_BOW_0C,
/* 0x0D */ PLAYER_AP_BOW_0D, /* 0x0D */ PLAYER_IA_BOW_0D,
/* 0x0E */ PLAYER_AP_BOW_0E, /* 0x0E */ PLAYER_IA_BOW_0E,
/* 0x0F */ PLAYER_AP_SLINGSHOT, /* 0x0F */ PLAYER_IA_SLINGSHOT,
/* 0x10 */ PLAYER_AP_HOOKSHOT, /* 0x10 */ PLAYER_IA_HOOKSHOT,
/* 0x11 */ PLAYER_AP_LONGSHOT, /* 0x11 */ PLAYER_IA_LONGSHOT,
/* 0x12 */ PLAYER_AP_BOMB, /* 0x12 */ PLAYER_IA_BOMB,
/* 0x13 */ PLAYER_AP_BOMBCHU, /* 0x13 */ PLAYER_IA_BOMBCHU,
/* 0x14 */ PLAYER_AP_BOOMERANG, /* 0x14 */ PLAYER_IA_BOOMERANG,
/* 0x15 */ PLAYER_AP_MAGIC_SPELL_15, /* 0x15 */ PLAYER_IA_MAGIC_SPELL_15,
/* 0x16 */ PLAYER_AP_MAGIC_SPELL_16, /* 0x16 */ PLAYER_IA_MAGIC_SPELL_16,
/* 0x17 */ PLAYER_AP_MAGIC_SPELL_17, /* 0x17 */ PLAYER_IA_MAGIC_SPELL_17,
/* 0x18 */ PLAYER_AP_FARORES_WIND, /* 0x18 */ PLAYER_IA_FARORES_WIND,
/* 0x19 */ PLAYER_AP_NAYRUS_LOVE, /* 0x19 */ PLAYER_IA_NAYRUS_LOVE,
/* 0x1A */ PLAYER_AP_DINS_FIRE, /* 0x1A */ PLAYER_IA_DINS_FIRE,
/* 0x1B */ PLAYER_AP_NUT, /* 0x1B */ PLAYER_IA_NUT,
/* 0x1C */ PLAYER_AP_OCARINA_FAIRY, /* 0x1C */ PLAYER_IA_OCARINA_FAIRY,
/* 0x1D */ PLAYER_AP_OCARINA_TIME, /* 0x1D */ PLAYER_IA_OCARINA_TIME,
/* 0x1E */ PLAYER_AP_BOTTLE, /* 0x1E */ PLAYER_IA_BOTTLE,
/* 0x1F */ PLAYER_AP_BOTTLE_FISH, /* 0x1F */ PLAYER_IA_BOTTLE_FISH,
/* 0x20 */ PLAYER_AP_BOTTLE_FIRE, /* 0x20 */ PLAYER_IA_BOTTLE_FIRE,
/* 0x21 */ PLAYER_AP_BOTTLE_BUG, /* 0x21 */ PLAYER_IA_BOTTLE_BUG,
/* 0x22 */ PLAYER_AP_BOTTLE_POE, /* 0x22 */ PLAYER_IA_BOTTLE_POE,
/* 0x23 */ PLAYER_AP_BOTTLE_BIG_POE, /* 0x23 */ PLAYER_IA_BOTTLE_BIG_POE,
/* 0x24 */ PLAYER_AP_BOTTLE_LETTER, /* 0x24 */ PLAYER_IA_BOTTLE_LETTER,
/* 0x25 */ PLAYER_AP_BOTTLE_POTION_RED, /* 0x25 */ PLAYER_IA_BOTTLE_POTION_RED,
/* 0x26 */ PLAYER_AP_BOTTLE_POTION_BLUE, /* 0x26 */ PLAYER_IA_BOTTLE_POTION_BLUE,
/* 0x27 */ PLAYER_AP_BOTTLE_POTION_GREEN, /* 0x27 */ PLAYER_IA_BOTTLE_POTION_GREEN,
/* 0x28 */ PLAYER_AP_BOTTLE_MILK, /* 0x28 */ PLAYER_IA_BOTTLE_MILK,
/* 0x29 */ PLAYER_AP_BOTTLE_MILK_HALF, /* 0x29 */ PLAYER_IA_BOTTLE_MILK_HALF,
/* 0x2A */ PLAYER_AP_BOTTLE_FAIRY, /* 0x2A */ PLAYER_IA_BOTTLE_FAIRY,
/* 0x2B */ PLAYER_AP_LETTER_ZELDA, /* 0x2B */ PLAYER_IA_LETTER_ZELDA,
/* 0x2C */ PLAYER_AP_WEIRD_EGG, /* 0x2C */ PLAYER_IA_WEIRD_EGG,
/* 0x2D */ PLAYER_AP_CHICKEN, /* 0x2D */ PLAYER_IA_CHICKEN,
/* 0x2E */ PLAYER_AP_BEAN, /* 0x2E */ PLAYER_IA_BEAN,
/* 0x2F */ PLAYER_AP_POCKET_EGG, /* 0x2F */ PLAYER_IA_POCKET_EGG,
/* 0x30 */ PLAYER_AP_POCKET_CUCCO, /* 0x30 */ PLAYER_IA_POCKET_CUCCO,
/* 0x31 */ PLAYER_AP_COJIRO, /* 0x31 */ PLAYER_IA_COJIRO,
/* 0x32 */ PLAYER_AP_ODD_MUSHROOM, /* 0x32 */ PLAYER_IA_ODD_MUSHROOM,
/* 0x33 */ PLAYER_AP_ODD_POTION, /* 0x33 */ PLAYER_IA_ODD_POTION,
/* 0x34 */ PLAYER_AP_SAW, /* 0x34 */ PLAYER_IA_SAW,
/* 0x35 */ PLAYER_AP_SWORD_BROKEN, /* 0x35 */ PLAYER_IA_SWORD_BROKEN,
/* 0x36 */ PLAYER_AP_PRESCRIPTION, /* 0x36 */ PLAYER_IA_PRESCRIPTION,
/* 0x37 */ PLAYER_AP_FROG, /* 0x37 */ PLAYER_IA_FROG,
/* 0x38 */ PLAYER_AP_EYEDROPS, /* 0x38 */ PLAYER_IA_EYEDROPS,
/* 0x39 */ PLAYER_AP_CLAIM_CHECK, /* 0x39 */ PLAYER_IA_CLAIM_CHECK,
/* 0x3A */ PLAYER_AP_MASK_KEATON, /* 0x3A */ PLAYER_IA_MASK_KEATON,
/* 0x3B */ PLAYER_AP_MASK_SKULL, /* 0x3B */ PLAYER_IA_MASK_SKULL,
/* 0x3C */ PLAYER_AP_MASK_SPOOKY, /* 0x3C */ PLAYER_IA_MASK_SPOOKY,
/* 0x3D */ PLAYER_AP_MASK_BUNNY, /* 0x3D */ PLAYER_IA_MASK_BUNNY,
/* 0x3E */ PLAYER_AP_MASK_GORON, /* 0x3E */ PLAYER_IA_MASK_GORON,
/* 0x3F */ PLAYER_AP_MASK_ZORA, /* 0x3F */ PLAYER_IA_MASK_ZORA,
/* 0x40 */ PLAYER_AP_MASK_GERUDO, /* 0x40 */ PLAYER_IA_MASK_GERUDO,
/* 0x41 */ PLAYER_AP_MASK_TRUTH, /* 0x41 */ PLAYER_IA_MASK_TRUTH,
/* 0x42 */ PLAYER_AP_LENS, /* 0x42 */ PLAYER_IA_LENS,
/* 0x43 */ PLAYER_AP_MAX /* 0x43 */ PLAYER_IA_MAX
} PlayerActionParam; } PlayerItemAction;
typedef enum { typedef enum {
/* 0x00 */ PLAYER_LIMB_NONE, /* 0x00 */ PLAYER_LIMB_NONE,
@ -469,10 +469,10 @@ typedef struct Player {
/* 0x014E */ s8 currentShield; // current shield from `PlayerShield` /* 0x014E */ s8 currentShield; // current shield from `PlayerShield`
/* 0x014F */ s8 currentBoots; // current boots from `PlayerBoots` /* 0x014F */ s8 currentBoots; // current boots from `PlayerBoots`
/* 0x0150 */ s8 heldItemButton; // Button index for the item currently used /* 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 /* 0x0152 */ u8 heldItemId; // Item id for the item currently used
/* 0x0153 */ s8 prevBoots; // previous boots from `PlayerBoots` /* 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]; /* 0x0155 */ char unk_155[0x003];
/* 0x0158 */ u8 modelGroup; /* 0x0158 */ u8 modelGroup;
/* 0x0159 */ u8 nextModelGroup; /* 0x0159 */ u8 nextModelGroup;

2
spec
View file

@ -4124,7 +4124,7 @@ beginseg
name "object_mori_tex" name "object_mori_tex"
romalign 0x1000 romalign 0x1000
include "build/assets/objects/object_mori_tex/object_mori_tex.o" include "build/assets/objects/object_mori_tex/object_mori_tex.o"
number 6 number 8
endseg endseg
beginseg beginseg

View file

@ -124,7 +124,7 @@ f32 Audio_GetVibratoFreqScale(VibratoState* vib) {
return 1.0f; 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. //! -1 isn't used as a channel pointer anywhere else.
if (channel != ((SequenceChannel*)(-1))) { if (channel != ((SequenceChannel*)(-1))) {
if (vib->extentChangeTimer) { if (vib->extentChangeTimer) {
@ -264,7 +264,7 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) {
break; break;
default: default:
adsr->delay *= gAudioContext.audioBufferParameters.updatesPerFrameScaled; adsr->delay *= gAudioCtx.audioBufferParameters.updatesPerFrameScaled;
if (adsr->delay == 0) { if (adsr->delay == 0) {
adsr->delay = 1; adsr->delay = 1;
} }

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
#include "global.h" #include "global.h"
u8 D_8016F0E0[0xA0]; // unused u8 D_8016F0E0[0xA0]; // unused
AudioContext gAudioContext; AudioContext gAudioCtx;
void (*D_801755D0)(void); void (*D_801755D0)(void);
s32 D_801755D8[3]; // unused s32 D_801755D8[3]; // unused
@ -17,7 +17,7 @@ const s16 D_8014A6C0[] = {
#define SFX_SOUNDFONT_2_SIZE 0x17B0 #define SFX_SOUNDFONT_2_SIZE 0x17B0
// Sizes of everything on the init pool // 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 SOUNDFONT_LIST_SIZE (NUM_SOUNDFONTS * sizeof(SoundFont))
#define PERMANENT_POOL_SIZE (SFX_SEQ_SIZE + SFX_SOUNDFONT_1_SIZE + SFX_SOUNDFONT_2_SIZE) #define PERMANENT_POOL_SIZE (SFX_SEQ_SIZE + SFX_SOUNDFONT_1_SIZE + SFX_SOUNDFONT_2_SIZE)

File diff suppressed because it is too large Load diff

View file

@ -31,7 +31,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
sub->bitField0.stereoStrongLeft = false; sub->bitField0.stereoStrongLeft = false;
sub->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects; sub->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects;
sub->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects; sub->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects;
if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_HEADSET)) { if (stereoHeadsetEffects && (gAudioCtx.soundMode == SOUNDMODE_HEADSET)) {
halfPanIndex = pan >> 1; halfPanIndex = pan >> 1;
if (halfPanIndex > 0x3F) { if (halfPanIndex > 0x3F) {
halfPanIndex = 0x3F; halfPanIndex = 0x3F;
@ -43,7 +43,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
volLeft = gHeadsetPanVolume[pan]; volLeft = gHeadsetPanVolume[pan];
volRight = gHeadsetPanVolume[0x7F - pan]; volRight = gHeadsetPanVolume[0x7F - pan];
} else if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_STEREO)) { } else if (stereoHeadsetEffects && (gAudioCtx.soundMode == SOUNDMODE_STEREO)) {
strongLeft = strongRight = 0; strongLeft = strongRight = 0;
sub->haasEffectLeftDelaySize = 0; sub->haasEffectLeftDelaySize = 0;
sub->haasEffectRightDelaySize = 0; sub->haasEffectRightDelaySize = 0;
@ -80,7 +80,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
break; break;
} }
} else if (gAudioContext.soundMode == SOUNDMODE_MONO) { } else if (gAudioCtx.soundMode == SOUNDMODE_MONO) {
sub->bitField0.stereoHeadsetEffects = false; sub->bitField0.stereoHeadsetEffects = false;
sub->bitField0.usesHeadsetPanEffects = false; sub->bitField0.usesHeadsetPanEffects = false;
volLeft = 0.707f; // approx 1/sqrt(2) volLeft = 0.707f; // approx 1/sqrt(2)
@ -163,9 +163,9 @@ void Audio_ProcessNotes(void) {
f32 scale; f32 scale;
s32 i; s32 i;
for (i = 0; i < gAudioContext.numNotes; i++) { for (i = 0; i < gAudioCtx.numNotes; i++) {
note = &gAudioContext.notes[i]; note = &gAudioCtx.notes[i];
noteSubEu2 = &gAudioContext.noteSubsEu[gAudioContext.noteSubEuOffset + i]; noteSubEu2 = &gAudioCtx.noteSubsEu[gAudioCtx.noteSubEuOffset + i];
playbackState = &note->playbackState; playbackState = &note->playbackState;
if (playbackState->parentLayer != NO_LAYER) { if (playbackState->parentLayer != NO_LAYER) {
if ((u32)playbackState->parentLayer < 0x7FFFFFFF) { if ((u32)playbackState->parentLayer < 0x7FFFFFFF) {
@ -174,7 +174,7 @@ void Audio_ProcessNotes(void) {
if (note != playbackState->parentLayer->note && playbackState->unk_04 == 0) { if (note != playbackState->parentLayer->note && playbackState->unk_04 == 0) {
playbackState->adsr.action.s.release = true; playbackState->adsr.action.s.release = true;
playbackState->adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv; playbackState->adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
playbackState->priority = 1; playbackState->priority = 1;
playbackState->unk_04 = 2; playbackState->unk_04 = 2;
goto out; goto out;
@ -285,7 +285,7 @@ void Audio_ProcessNotes(void) {
} }
subAttrs.frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale; subAttrs.frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale;
subAttrs.frequency *= gAudioContext.audioBufferParameters.resampleRate; subAttrs.frequency *= gAudioCtx.audioBufferParameters.resampleRate;
subAttrs.velocity *= scale; subAttrs.velocity *= scale;
Audio_InitNoteSub(note, noteSubEu2, &subAttrs); Audio_InitNoteSub(note, noteSubEu2, &subAttrs);
noteSubEu->bitField1.bookOffset = bookOffset; noteSubEu->bitField1.bookOffset = bookOffset;
@ -315,18 +315,18 @@ Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
} }
if (!AudioLoad_IsFontLoadComplete(fontId)) { if (!AudioLoad_IsFontLoadComplete(fontId)) {
gAudioContext.audioErrorFlags = fontId + 0x10000000; gAudioCtx.audioErrorFlags = fontId + 0x10000000;
return NULL; return NULL;
} }
if (instId >= gAudioContext.soundFontList[fontId].numInstruments) { if (instId >= gAudioCtx.soundFontList[fontId].numInstruments) {
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x3000000; gAudioCtx.audioErrorFlags = ((fontId << 8) + instId) + 0x3000000;
return NULL; return NULL;
} }
inst = gAudioContext.soundFontList[fontId].instruments[instId]; inst = gAudioCtx.soundFontList[fontId].instruments[instId];
if (inst == NULL) { if (inst == NULL) {
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000; gAudioCtx.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
return inst; return inst;
} }
@ -341,21 +341,21 @@ Drum* Audio_GetDrum(s32 fontId, s32 drumId) {
} }
if (!AudioLoad_IsFontLoadComplete(fontId)) { if (!AudioLoad_IsFontLoadComplete(fontId)) {
gAudioContext.audioErrorFlags = fontId + 0x10000000; gAudioCtx.audioErrorFlags = fontId + 0x10000000;
return NULL; return NULL;
} }
if (drumId >= gAudioContext.soundFontList[fontId].numDrums) { if (drumId >= gAudioCtx.soundFontList[fontId].numDrums) {
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000; gAudioCtx.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000;
return NULL; return NULL;
} }
if ((u32)gAudioContext.soundFontList[fontId].drums < AUDIO_RELOCATED_ADDRESS_START) { if ((u32)gAudioCtx.soundFontList[fontId].drums < AUDIO_RELOCATED_ADDRESS_START) {
return NULL; return NULL;
} }
drum = gAudioContext.soundFontList[fontId].drums[drumId]; drum = gAudioCtx.soundFontList[fontId].drums[drumId];
if (drum == NULL) { if (drum == NULL) {
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x5000000; gAudioCtx.audioErrorFlags = ((fontId << 8) + drumId) + 0x5000000;
} }
return drum; return drum;
@ -369,23 +369,23 @@ SoundEffect* Audio_GetSoundEffect(s32 fontId, s32 sfxId) {
} }
if (!AudioLoad_IsFontLoadComplete(fontId)) { if (!AudioLoad_IsFontLoadComplete(fontId)) {
gAudioContext.audioErrorFlags = fontId + 0x10000000; gAudioCtx.audioErrorFlags = fontId + 0x10000000;
return NULL; return NULL;
} }
if (sfxId >= gAudioContext.soundFontList[fontId].numSfx) { if (sfxId >= gAudioCtx.soundFontList[fontId].numSfx) {
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x4000000; gAudioCtx.audioErrorFlags = ((fontId << 8) + sfxId) + 0x4000000;
return NULL; return NULL;
} }
if ((u32)gAudioContext.soundFontList[fontId].soundEffects < AUDIO_RELOCATED_ADDRESS_START) { if ((u32)gAudioCtx.soundFontList[fontId].soundEffects < AUDIO_RELOCATED_ADDRESS_START) {
return NULL; return NULL;
} }
soundEffect = &gAudioContext.soundFontList[fontId].soundEffects[sfxId]; soundEffect = &gAudioCtx.soundFontList[fontId].soundEffects[sfxId];
if (soundEffect == NULL) { if (soundEffect == NULL) {
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x5000000; gAudioCtx.audioErrorFlags = ((fontId << 8) + sfxId) + 0x5000000;
} }
if (soundEffect->tunedSample.sample == NULL) { if (soundEffect->tunedSample.sample == NULL) {
@ -406,24 +406,24 @@ s32 Audio_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, void* val
switch (instrumentType) { switch (instrumentType) {
case 0: case 0:
if (index >= gAudioContext.soundFontList[fontId].numDrums) { if (index >= gAudioCtx.soundFontList[fontId].numDrums) {
return -3; return -3;
} }
gAudioContext.soundFontList[fontId].drums[index] = value; gAudioCtx.soundFontList[fontId].drums[index] = value;
break; break;
case 1: case 1:
if (index >= gAudioContext.soundFontList[fontId].numSfx) { if (index >= gAudioCtx.soundFontList[fontId].numSfx) {
return -3; return -3;
} }
gAudioContext.soundFontList[fontId].soundEffects[index] = *(SoundEffect*)value; gAudioCtx.soundFontList[fontId].soundEffects[index] = *(SoundEffect*)value;
break; break;
default: default:
if (index >= gAudioContext.soundFontList[fontId].numInstruments) { if (index >= gAudioCtx.soundFontList[fontId].numInstruments) {
return -3; return -3;
} }
gAudioContext.soundFontList[fontId].instruments[index] = value; gAudioCtx.soundFontList[fontId].instruments[index] = value;
break; break;
} }
@ -456,7 +456,7 @@ void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
if (note->playbackState.parentLayer != layer) { if (note->playbackState.parentLayer != layer) {
if (note->playbackState.parentLayer == NO_LAYER && note->playbackState.wantedParentLayer == NO_LAYER && if (note->playbackState.parentLayer == NO_LAYER && note->playbackState.wantedParentLayer == NO_LAYER &&
note->playbackState.prevParentLayer == layer && target != ADSR_STATE_DECAY) { 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; note->playbackState.adsr.action.s.release = true;
} }
return; return;
@ -500,16 +500,16 @@ void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
note->playbackState.prevParentLayer = note->playbackState.parentLayer; note->playbackState.prevParentLayer = note->playbackState.parentLayer;
note->playbackState.parentLayer = NO_LAYER; note->playbackState.parentLayer = NO_LAYER;
if (target == ADSR_STATE_RELEASE) { 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.adsr.action.s.release = true;
note->playbackState.unk_04 = 2; note->playbackState.unk_04 = 2;
} else { } else {
note->playbackState.unk_04 = 1; note->playbackState.unk_04 = 1;
note->playbackState.adsr.action.s.decay = true; note->playbackState.adsr.action.s.decay = true;
if (layer->adsr.decayIndex == 0) { 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 { } else {
note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->adsr.decayIndex]; note->playbackState.adsr.fadeOutVel = gAudioCtx.adsrDecayTable[layer->adsr.decayIndex];
} }
note->playbackState.adsr.sustain = note->playbackState.adsr.sustain =
((f32)(s32)(layer->channel->adsr.sustain) * note->playbackState.adsr.current) / 256.0f; ((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) { void Audio_InitNoteFreeList(void) {
s32 i; s32 i;
Audio_InitNoteLists(&gAudioContext.noteFreeLists); Audio_InitNoteLists(&gAudioCtx.noteFreeLists);
for (i = 0; i < gAudioContext.numNotes; i++) { for (i = 0; i < gAudioCtx.numNotes; i++) {
gAudioContext.notes[i].listItem.u.value = &gAudioContext.notes[i]; gAudioCtx.notes[i].listItem.u.value = &gAudioCtx.notes[i];
gAudioContext.notes[i].listItem.prev = NULL; gAudioCtx.notes[i].listItem.prev = NULL;
AudioSeq_AudioListPushBack(&gAudioContext.noteFreeLists.disabled, &gAudioContext.notes[i].listItem); AudioSeq_AudioListPushBack(&gAudioCtx.noteFreeLists.disabled, &gAudioCtx.notes[i].listItem);
} }
} }
@ -634,22 +634,22 @@ void Audio_NotePoolClear(NotePool* pool) {
switch (i) { switch (i) {
case 0: case 0:
source = &pool->disabled; source = &pool->disabled;
dest = &gAudioContext.noteFreeLists.disabled; dest = &gAudioCtx.noteFreeLists.disabled;
break; break;
case 1: case 1:
source = &pool->decaying; source = &pool->decaying;
dest = &gAudioContext.noteFreeLists.decaying; dest = &gAudioCtx.noteFreeLists.decaying;
break; break;
case 2: case 2:
source = &pool->releasing; source = &pool->releasing;
dest = &gAudioContext.noteFreeLists.releasing; dest = &gAudioCtx.noteFreeLists.releasing;
break; break;
case 3: case 3:
source = &pool->active; source = &pool->active;
dest = &gAudioContext.noteFreeLists.active; dest = &gAudioCtx.noteFreeLists.active;
break; break;
} }
@ -680,22 +680,22 @@ void Audio_NotePoolFill(NotePool* pool, s32 count) {
switch (i) { switch (i) {
case 0: case 0:
source = &gAudioContext.noteFreeLists.disabled; source = &gAudioCtx.noteFreeLists.disabled;
dest = &pool->disabled; dest = &pool->disabled;
break; break;
case 1: case 1:
source = &gAudioContext.noteFreeLists.decaying; source = &gAudioCtx.noteFreeLists.decaying;
dest = &pool->decaying; dest = &pool->decaying;
break; break;
case 2: case 2:
source = &gAudioContext.noteFreeLists.releasing; source = &gAudioCtx.noteFreeLists.releasing;
dest = &pool->releasing; dest = &pool->releasing;
break; break;
case 3: case 3:
source = &gAudioContext.noteFreeLists.active; source = &gAudioCtx.noteFreeLists.active;
dest = &pool->active; dest = &pool->active;
break; break;
} }
@ -805,7 +805,7 @@ void Audio_NoteReleaseAndTakeOwnership(Note* note, SequenceLayer* layer) {
note->playbackState.wantedParentLayer = layer; note->playbackState.wantedParentLayer = layer;
note->playbackState.priority = layer->channel->notePriority; 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; note->playbackState.adsr.action.s.release = true;
} }
@ -899,9 +899,9 @@ Note* Audio_AllocNote(SequenceLayer* layer) {
} }
if (policy & 8) { if (policy & 8) {
if (!(note = Audio_AllocNoteFromDisabled(&gAudioContext.noteFreeLists, layer)) && if (!(note = Audio_AllocNoteFromDisabled(&gAudioCtx.noteFreeLists, layer)) &&
!(note = Audio_AllocNoteFromDecaying(&gAudioContext.noteFreeLists, layer)) && !(note = Audio_AllocNoteFromDecaying(&gAudioCtx.noteFreeLists, layer)) &&
!(note = Audio_AllocNoteFromActive(&gAudioContext.noteFreeLists, layer))) { !(note = Audio_AllocNoteFromActive(&gAudioCtx.noteFreeLists, layer))) {
goto null_return; goto null_return;
} }
return note; return note;
@ -909,13 +909,13 @@ Note* Audio_AllocNote(SequenceLayer* layer) {
if (!(note = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) && if (!(note = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) &&
!(note = Audio_AllocNoteFromDisabled(&layer->channel->seqPlayer->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->notePool, layer)) &&
!(note = Audio_AllocNoteFromDecaying(&layer->channel->seqPlayer->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->notePool, layer)) &&
!(note = Audio_AllocNoteFromActive(&layer->channel->seqPlayer->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; goto null_return;
} }
return note; return note;
@ -929,8 +929,8 @@ void Audio_NoteInitAll(void) {
Note* note; Note* note;
s32 i; s32 i;
for (i = 0; i < gAudioContext.numNotes; i++) { for (i = 0; i < gAudioCtx.numNotes; i++) {
note = &gAudioContext.notes[i]; note = &gAudioCtx.notes[i];
note->noteSubEu = gZeroNoteSub; note->noteSubEu = gZeroNoteSub;
note->playbackState.priority = 0; note->playbackState.priority = 0;
note->playbackState.unk_04 = 0; note->playbackState.unk_04 = 0;
@ -947,6 +947,6 @@ void Audio_NoteInitAll(void) {
note->playbackState.stereoHeadsetEffects = false; note->playbackState.stereoHeadsetEffects = false;
note->startSamplePos = 0; note->startSamplePos = 0;
note->synthesisState.synthesisBuffers = note->synthesisState.synthesisBuffers =
AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, sizeof(NoteSynthesisBuffers)); AudioHeap_AllocDmaMemory(&gAudioCtx.miscPool, sizeof(NoteSynthesisBuffers));
} }
} }

View file

@ -252,7 +252,7 @@ s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState*
void AudioSeq_InitSequenceChannel(SequenceChannel* channel) { void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
s32 i; s32 i;
if (channel == &gAudioContext.sequenceChannelNone) { if (channel == &gAudioCtx.sequenceChannelNone) {
return; return;
} }
@ -297,7 +297,7 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
channel->freqScale = 1.0f; channel->freqScale = 1.0f;
for (i = 0; i < ARRAY_COUNT(channel->soundScriptIO); i++) { for (i = 0; i < ARRAY_COUNT(channel->soundScriptIO); i++) {
channel->soundScriptIO[i] = -1; channel->soundScriptIO[i] = SEQ_IO_VAL_NONE;
} }
channel->unused = false; channel->unused = false;
@ -309,7 +309,7 @@ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) {
s32 pad; s32 pad;
if (channel->layers[layerIndex] == NULL) { if (channel->layers[layerIndex] == NULL) {
layer = AudioSeq_AudioListPopBack(&gAudioContext.layerFreeList); layer = AudioSeq_AudioListPopBack(&gAudioCtx.layerFreeList);
channel->layers[layerIndex] = layer; channel->layers[layerIndex] = layer;
if (layer == NULL) { if (layer == NULL) {
channel->layers[layerIndex] = NULL; channel->layers[layerIndex] = NULL;
@ -353,7 +353,7 @@ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) {
void AudioSeq_SeqLayerDisable(SequenceLayer* layer) { void AudioSeq_SeqLayerDisable(SequenceLayer* layer) {
if (layer != NULL) { 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); Audio_SeqLayerNoteRelease(layer);
} else { } else {
Audio_SeqLayerNoteDecay(layer); Audio_SeqLayerNoteDecay(layer);
@ -367,7 +367,7 @@ void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) {
SequenceLayer* layer = channel->layers[layerIndex]; SequenceLayer* layer = channel->layers[layerIndex];
if (layer != NULL) { if (layer != NULL) {
AudioSeq_AudioListPushBack(&gAudioContext.layerFreeList, &layer->listItem); AudioSeq_AudioListPushBack(&gAudioCtx.layerFreeList, &layer->listItem);
AudioSeq_SeqLayerDisable(layer); AudioSeq_SeqLayerDisable(layer);
channel->layers[layerIndex] = NULL; channel->layers[layerIndex] = NULL;
} }
@ -452,10 +452,10 @@ void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) {
AudioLoad_SetFontLoadStatus(seqPlayer->defaultFont, LOAD_STATUS_MAYBE_DISCARDABLE); AudioLoad_SetFontLoadStatus(seqPlayer->defaultFont, LOAD_STATUS_MAYBE_DISCARDABLE);
} }
if (seqPlayer->defaultFont == gAudioContext.fontCache.temporary.entries[0].id) { if (seqPlayer->defaultFont == gAudioCtx.fontCache.temporary.entries[0].id) {
gAudioContext.fontCache.temporary.nextSide = 0; gAudioCtx.fontCache.temporary.nextSide = 0;
} else if (seqPlayer->defaultFont == gAudioContext.fontCache.temporary.entries[1].id) { } else if (seqPlayer->defaultFont == gAudioCtx.fontCache.temporary.entries[1].id) {
gAudioContext.fontCache.temporary.nextSide = 1; gAudioCtx.fontCache.temporary.nextSide = 1;
} }
} }
@ -488,15 +488,15 @@ void* AudioSeq_AudioListPopBack(AudioListItem* list) {
void AudioSeq_InitLayerFreelist(void) { void AudioSeq_InitLayerFreelist(void) {
s32 i; s32 i;
gAudioContext.layerFreeList.prev = &gAudioContext.layerFreeList; gAudioCtx.layerFreeList.prev = &gAudioCtx.layerFreeList;
gAudioContext.layerFreeList.next = &gAudioContext.layerFreeList; gAudioCtx.layerFreeList.next = &gAudioCtx.layerFreeList;
gAudioContext.layerFreeList.u.count = 0; gAudioCtx.layerFreeList.u.count = 0;
gAudioContext.layerFreeList.pool = NULL; gAudioCtx.layerFreeList.pool = NULL;
for (i = 0; i < ARRAY_COUNT(gAudioContext.sequenceLayers); i++) { for (i = 0; i < ARRAY_COUNT(gAudioCtx.sequenceLayers); i++) {
gAudioContext.sequenceLayers[i].listItem.u.value = &gAudioContext.sequenceLayers[i]; gAudioCtx.sequenceLayers[i].listItem.u.value = &gAudioCtx.sequenceLayers[i];
gAudioContext.sequenceLayers[i].listItem.prev = NULL; gAudioCtx.sequenceLayers[i].listItem.prev = NULL;
AudioSeq_AudioListPushBack(&gAudioContext.layerFreeList, &gAudioContext.sequenceLayers[i].listItem); AudioSeq_AudioListPushBack(&gAudioCtx.layerFreeList, &gAudioCtx.sequenceLayers[i].listItem);
} }
} }
@ -873,7 +873,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
layer->tunedSample = NULL; layer->tunedSample = NULL;
tuning = 1.0f; tuning = 1.0f;
if (instOrWave >= 0xC0) { 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; portamento->extent = (freqScale2 / freqScale) - 1.0f;
if (PORTAMENTO_IS_SPECIAL(*portamento)) { if (PORTAMENTO_IS_SPECIAL(*portamento)) {
speed = seqPlayer->tempo * 0x8000 / gAudioContext.tempoInternalToExternal; speed = seqPlayer->tempo * 0x8000 / gAudioCtx.tempoInternalToExternal;
if (layer->delay != 0) { if (layer->delay != 0) {
speed = speed * 0x100 / (layer->delay * layer->portamentoTime); speed = speed * 0x100 / (layer->delay * layer->portamentoTime);
} }
} else { } else {
speed = 0x20000 / (layer->portamentoTime * gAudioContext.audioBufferParameters.updatesPerFrame); speed = 0x20000 / (layer->portamentoTime * gAudioCtx.audioBufferParameters.updatesPerFrame);
} }
if (speed >= 0x7FFF) { if (speed >= 0x7FFF) {
@ -935,7 +935,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
layer->tunedSample = NULL; layer->tunedSample = NULL;
layer->freqScale = gPitchFrequencies[semitone2]; layer->freqScale = gPitchFrequencies[semitone2];
if (instOrWave >= 0xC0) { if (instOrWave >= 0xC0) {
layer->tunedSample = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].tunedSample; layer->tunedSample = &gAudioCtx.synthesisReverbs[instOrWave - 0xC0].tunedSample;
} }
} }
break; break;
@ -951,7 +951,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
time = 0.0f; time = 0.0f;
} }
time *= seqPlayer->tempo; time *= seqPlayer->tempo;
time *= gAudioContext.unk_2870; time *= gAudioCtx.unk_2870;
time /= layer->freqScale; time /= layer->freqScale;
if (time > 0x7FFE) { if (time > 0x7FFE) {
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 // (It's a bit unclear if 'portamento' has actually always been
// set when this is reached...) // set when this is reached...)
if (PORTAMENTO_IS_SPECIAL(*portamento)) { if (PORTAMENTO_IS_SPECIAL(*portamento)) {
speed2 = seqPlayer->tempo * 0x8000 / gAudioContext.tempoInternalToExternal; speed2 = seqPlayer->tempo * 0x8000 / gAudioCtx.tempoInternalToExternal;
speed2 = speed2 * 0x100 / (layer->delay * layer->portamentoTime); speed2 = speed2 * 0x100 / (layer->delay * layer->portamentoTime);
if (speed2 >= 0x7FFF) { if (speed2 >= 0x7FFF) {
speed2 = 0x7FFF; speed2 = 0x7FFF;
@ -1043,8 +1043,8 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
} }
if (channel->velocityRandomVariance != 0) { if (channel->velocityRandomVariance != 0) {
floatDelta = layer->velocitySquare * (gAudioContext.audioRandom % channel->velocityRandomVariance) / 100.0f; floatDelta = layer->velocitySquare * (gAudioCtx.audioRandom % channel->velocityRandomVariance) / 100.0f;
if ((gAudioContext.audioRandom & 0x8000) != 0) { if ((gAudioCtx.audioRandom & 0x8000) != 0) {
floatDelta = -floatDelta; floatDelta = -floatDelta;
} }
@ -1064,8 +1064,8 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
if (channel->gateTimeRandomVariance != 0) { if (channel->gateTimeRandomVariance != 0) {
//! @bug should probably be gateTimeRandomVariance //! @bug should probably be gateTimeRandomVariance
intDelta = (layer->gateDelay * (gAudioContext.audioRandom % channel->velocityRandomVariance)) / 100; intDelta = (layer->gateDelay * (gAudioCtx.audioRandom % channel->velocityRandomVariance)) / 100;
if ((gAudioContext.audioRandom & 0x4000) != 0) { if ((gAudioCtx.audioRandom & 0x4000) != 0) {
intDelta = -intDelta; intDelta = -intDelta;
} }
@ -1244,9 +1244,9 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
cmd = (u8)cmdArgs[0]; cmd = (u8)cmdArgs[0];
if (seqPlayer->defaultFont != 0xFF) { if (seqPlayer->defaultFont != 0xFF) {
cmdArgU16 = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId]; cmdArgU16 = ((u16*)gAudioCtx.sequenceFontTable)[seqPlayer->seqId];
lowBits = gAudioContext.sequenceFontTable[cmdArgU16]; lowBits = gAudioCtx.sequenceFontTable[cmdArgU16];
cmd = gAudioContext.sequenceFontTable[cmdArgU16 + lowBits - cmd]; cmd = gAudioCtx.sequenceFontTable[cmdArgU16 + lowBits - cmd];
} }
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, cmd)) { if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, cmd)) {
@ -1373,9 +1373,9 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
cmd = (u8)cmdArgs[0]; cmd = (u8)cmdArgs[0];
if (seqPlayer->defaultFont != 0xFF) { if (seqPlayer->defaultFont != 0xFF) {
cmdArgU16 = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId]; cmdArgU16 = ((u16*)gAudioCtx.sequenceFontTable)[seqPlayer->seqId];
lowBits = gAudioContext.sequenceFontTable[cmdArgU16]; lowBits = gAudioCtx.sequenceFontTable[cmdArgU16];
cmd = gAudioContext.sequenceFontTable[cmdArgU16 + lowBits - cmd]; cmd = gAudioCtx.sequenceFontTable[cmdArgU16 + lowBits - cmd];
} }
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, cmd)) { if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, cmd)) {
@ -1569,12 +1569,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0xB7: case 0xB7:
channel->unk_22 = channel->unk_22 =
(cmdArgs[0] == 0) ? gAudioContext.audioRandom & 0xFFFF : gAudioContext.audioRandom % cmdArgs[0]; (cmdArgs[0] == 0) ? gAudioCtx.audioRandom & 0xFFFF : gAudioCtx.audioRandom % cmdArgs[0];
break; break;
case 0xB8: case 0xB8:
scriptState->value = scriptState->value =
(cmdArgs[0] == 0) ? gAudioContext.audioRandom & 0xFFFF : gAudioContext.audioRandom % cmdArgs[0]; (cmdArgs[0] == 0) ? gAudioCtx.audioRandom & 0xFFFF : gAudioCtx.audioRandom % cmdArgs[0];
break; break;
case 0xBD: case 0xBD:
@ -1664,12 +1664,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0x10: case 0x10:
if (lowBits < 8) { if (lowBits < 8) {
channel->soundScriptIO[lowBits] = -1; channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value, if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value,
&channel->soundScriptIO[lowBits]) == -1) {} &channel->soundScriptIO[lowBits]) == -1) {}
} else { } else {
lowBits -= 8; lowBits -= 8;
channel->soundScriptIO[lowBits] = -1; channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
if (AudioLoad_SlowLoadSample(channel->fontId, channel->unk_22 + 0x100, if (AudioLoad_SlowLoadSample(channel->fontId, channel->unk_22 + 0x100,
&channel->soundScriptIO[lowBits]) == -1) {} &channel->soundScriptIO[lowBits]) == -1) {}
} }
@ -1678,7 +1678,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0x60: case 0x60:
scriptState->value = channel->soundScriptIO[lowBits]; scriptState->value = channel->soundScriptIO[lowBits];
if (lowBits < 2) { if (lowBits < 2) {
channel->soundScriptIO[lowBits] = -1; channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
} }
break; break;
@ -1746,11 +1746,11 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
seqPlayer->tempoAcc += seqPlayer->tempo; seqPlayer->tempoAcc += seqPlayer->tempo;
seqPlayer->tempoAcc += (s16)seqPlayer->unk_0C; seqPlayer->tempoAcc += (s16)seqPlayer->unk_0C;
if (seqPlayer->tempoAcc < gAudioContext.tempoInternalToExternal) { if (seqPlayer->tempoAcc < gAudioCtx.tempoInternalToExternal) {
return; return;
} }
seqPlayer->tempoAcc -= (u16)gAudioContext.tempoInternalToExternal; seqPlayer->tempoAcc -= (u16)gAudioCtx.tempoInternalToExternal;
if (seqPlayer->stopScript == true) { if (seqPlayer->stopScript == true) {
return; return;
@ -1811,8 +1811,8 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
case 0xDD: case 0xDD:
seqPlayer->tempo = AudioSeq_ScriptReadU8(seqScript) * TATUMS_PER_BEAT; seqPlayer->tempo = AudioSeq_ScriptReadU8(seqScript) * TATUMS_PER_BEAT;
if (seqPlayer->tempo > gAudioContext.tempoInternalToExternal) { if (seqPlayer->tempo > gAudioCtx.tempoInternalToExternal) {
seqPlayer->tempo = (u16)gAudioContext.tempoInternalToExternal; seqPlayer->tempo = (u16)gAudioCtx.tempoInternalToExternal;
} }
if ((s16)seqPlayer->tempo <= 0) { if ((s16)seqPlayer->tempo <= 0) {
@ -1909,9 +1909,9 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
case 0xCE: case 0xCE:
cmd = AudioSeq_ScriptReadU8(seqScript); cmd = AudioSeq_ScriptReadU8(seqScript);
if (cmd == 0) { if (cmd == 0) {
seqScript->value = (gAudioContext.audioRandom >> 2) & 0xFF; seqScript->value = (gAudioCtx.audioRandom >> 2) & 0xFF;
} else { } else {
seqScript->value = (gAudioContext.audioRandom >> 2) % cmd; seqScript->value = (gAudioCtx.audioRandom >> 2) % cmd;
} }
break; break;
@ -1992,7 +1992,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
case 0x80: case 0x80:
seqScript->value = seqPlayer->soundScriptIO[cmdLowBits]; seqScript->value = seqPlayer->soundScriptIO[cmdLowBits];
if (cmdLowBits < 2) { if (cmdLowBits < 2) {
seqPlayer->soundScriptIO[cmdLowBits] = -1; seqPlayer->soundScriptIO[cmdLowBits] = SEQ_IO_VAL_NONE;
} }
break; break;
@ -2038,11 +2038,10 @@ void AudioSeq_ProcessSequences(s32 arg0) {
SequencePlayer* seqPlayer; SequencePlayer* seqPlayer;
u32 i; u32 i;
gAudioContext.noteSubEuOffset = gAudioCtx.noteSubEuOffset = (gAudioCtx.audioBufferParameters.updatesPerFrame - arg0 - 1) * gAudioCtx.numNotes;
(gAudioContext.audioBufferParameters.updatesPerFrame - arg0 - 1) * gAudioContext.numNotes;
for (i = 0; i < (u32)gAudioContext.audioBufferParameters.numSequencePlayers; i++) { for (i = 0; i < (u32)gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
seqPlayer = &gAudioContext.seqPlayers[i]; seqPlayer = &gAudioCtx.seqPlayers[i];
if (seqPlayer->enabled == true) { if (seqPlayer->enabled == true) {
AudioSeq_SequencePlayerProcessSequence(seqPlayer); AudioSeq_SequencePlayerProcessSequence(seqPlayer);
Audio_SequencePlayerProcessSound(seqPlayer); Audio_SequencePlayerProcessSound(seqPlayer);
@ -2089,14 +2088,14 @@ void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) {
void AudioSeq_InitSequencePlayerChannels(s32 playerIdx) { void AudioSeq_InitSequencePlayerChannels(s32 playerIdx) {
SequenceChannel* channel; SequenceChannel* channel;
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx]; SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
s32 i; s32 i;
s32 j; s32 j;
for (i = 0; i < SEQ_NUM_CHANNELS; i++) { 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) { if (seqPlayer->channels[i] == NULL) {
seqPlayer->channels[i] = &gAudioContext.sequenceChannelNone; seqPlayer->channels[i] = &gAudioCtx.sequenceChannelNone;
} else { } else {
channel = seqPlayer->channels[i]; channel = seqPlayer->channels[i];
channel->seqPlayer = seqPlayer; channel->seqPlayer = seqPlayer;
@ -2114,7 +2113,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) {
s32 j; s32 j;
for (i = 0; i < SEQ_NUM_CHANNELS; i++) { for (i = 0; i < SEQ_NUM_CHANNELS; i++) {
seqPlayer->channels[i] = &gAudioContext.sequenceChannelNone; seqPlayer->channels[i] = &gAudioCtx.sequenceChannelNone;
} }
seqPlayer->enabled = false; seqPlayer->enabled = false;
@ -2124,7 +2123,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) {
seqPlayer->applyBend = false; seqPlayer->applyBend = false;
for (j = 0; j < ARRAY_COUNT(seqPlayer->soundScriptIO); j++) { 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; seqPlayer->muteBehavior = MUTE_BEHAVIOR_SOFTEN | MUTE_BEHAVIOR_STOP_NOTES;
@ -2139,12 +2138,12 @@ void AudioSeq_InitSequencePlayers(void) {
AudioSeq_InitLayerFreelist(); AudioSeq_InitLayerFreelist();
for (i = 0; i < ARRAY_COUNT(gAudioContext.sequenceLayers); i++) { for (i = 0; i < ARRAY_COUNT(gAudioCtx.sequenceLayers); i++) {
gAudioContext.sequenceLayers[i].channel = NULL; gAudioCtx.sequenceLayers[i].channel = NULL;
gAudioContext.sequenceLayers[i].enabled = false; gAudioCtx.sequenceLayers[i].enabled = false;
} }
for (i = 0; i < ARRAY_COUNT(gAudioContext.seqPlayers); i++) { for (i = 0; i < ARRAY_COUNT(gAudioCtx.seqPlayers); i++) {
AudioSeq_InitSequencePlayer(&gAudioContext.seqPlayers[i]); AudioSeq_InitSequencePlayer(&gAudioCtx.seqPlayers[i]);
} }
} }

View file

@ -61,7 +61,7 @@ u8 sNumSamplesPerWavePeriod[] = {
void AudioSynth_InitNextRingBuf(s32 chunkLen, s32 updateIndex, s32 reverbIndex) { void AudioSynth_InitNextRingBuf(s32 chunkLen, s32 updateIndex, s32 reverbIndex) {
ReverbRingBufferItem* bufItem; ReverbRingBufferItem* bufItem;
s32 pad[3]; s32 pad[3];
SynthesisReverb* reverb = &gAudioContext.synthesisReverbs[reverbIndex]; SynthesisReverb* reverb = &gAudioCtx.synthesisReverbs[reverbIndex];
s32 temp_a0_2; s32 temp_a0_2;
s32 temp_a0_4; s32 temp_a0_4;
s32 numSamples; s32 numSamples;
@ -135,10 +135,10 @@ void func_800DB03C(s32 updateIndex) {
s32 baseIndex; s32 baseIndex;
s32 i; s32 i;
baseIndex = gAudioContext.numNotes * updateIndex; baseIndex = gAudioCtx.numNotes * updateIndex;
for (i = 0; i < gAudioContext.numNotes; i++) { for (i = 0; i < gAudioCtx.numNotes; i++) {
subEu = &gAudioContext.notes[i].noteSubEu; subEu = &gAudioCtx.notes[i].noteSubEu;
subEu2 = &gAudioContext.noteSubsEu[baseIndex + i]; subEu2 = &gAudioCtx.noteSubsEu[baseIndex + i];
if (subEu->bitField0.enabled) { if (subEu->bitField0.enabled) {
subEu->bitField0.needsInit = false; subEu->bitField0.needsInit = false;
} else { } else {
@ -158,42 +158,41 @@ Acmd* AudioSynth_Update(Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen)
SynthesisReverb* reverb; SynthesisReverb* reverb;
cmdP = cmdStart; cmdP = cmdStart;
for (i = gAudioContext.audioBufferParameters.updatesPerFrame; i > 0; i--) { for (i = gAudioCtx.audioBufferParameters.updatesPerFrame; i > 0; i--) {
AudioSeq_ProcessSequences(i - 1); AudioSeq_ProcessSequences(i - 1);
func_800DB03C(gAudioContext.audioBufferParameters.updatesPerFrame - i); func_800DB03C(gAudioCtx.audioBufferParameters.updatesPerFrame - i);
} }
aiBufP = aiStart; 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) { if (i == 1) {
chunkLen = aiBufLen; chunkLen = aiBufLen;
} else if ((aiBufLen / i) >= gAudioContext.audioBufferParameters.samplesPerUpdateMax) { } else if ((aiBufLen / i) >= gAudioCtx.audioBufferParameters.samplesPerUpdateMax) {
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdateMax; chunkLen = gAudioCtx.audioBufferParameters.samplesPerUpdateMax;
} else if (gAudioContext.audioBufferParameters.samplesPerUpdateMin >= (aiBufLen / i)) { } else if (gAudioCtx.audioBufferParameters.samplesPerUpdateMin >= (aiBufLen / i)) {
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdateMin; chunkLen = gAudioCtx.audioBufferParameters.samplesPerUpdateMin;
} else { } else {
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdate; chunkLen = gAudioCtx.audioBufferParameters.samplesPerUpdate;
} }
for (j = 0; j < gAudioContext.numSynthesisReverbs; j++) { for (j = 0; j < gAudioCtx.numSynthesisReverbs; j++) {
if (gAudioContext.synthesisReverbs[j].useReverb) { if (gAudioCtx.synthesisReverbs[j].useReverb) {
AudioSynth_InitNextRingBuf(chunkLen, gAudioContext.audioBufferParameters.updatesPerFrame - i, j); AudioSynth_InitNextRingBuf(chunkLen, gAudioCtx.audioBufferParameters.updatesPerFrame - i, j);
} }
} }
cmdP = AudioSynth_DoOneAudioUpdate(aiBufP, chunkLen, cmdP, cmdP = AudioSynth_DoOneAudioUpdate(aiBufP, chunkLen, cmdP, gAudioCtx.audioBufferParameters.updatesPerFrame - i);
gAudioContext.audioBufferParameters.updatesPerFrame - i);
aiBufLen -= chunkLen; aiBufLen -= chunkLen;
aiBufP += 2 * chunkLen; aiBufP += 2 * chunkLen;
} }
for (j = 0; j < gAudioContext.numSynthesisReverbs; j++) { for (j = 0; j < gAudioCtx.numSynthesisReverbs; j++) {
if (gAudioContext.synthesisReverbs[j].framesToIgnore != 0) { if (gAudioCtx.synthesisReverbs[j].framesToIgnore != 0) {
gAudioContext.synthesisReverbs[j].framesToIgnore--; gAudioCtx.synthesisReverbs[j].framesToIgnore--;
} }
gAudioContext.synthesisReverbs[j].curFrame ^= 1; gAudioCtx.synthesisReverbs[j].curFrame ^= 1;
} }
*cmdCnt = cmdP - cmdStart; *cmdCnt = cmdP - cmdStart;
@ -204,8 +203,8 @@ void func_800DB2C0(s32 updateIndex, s32 noteIndex) {
NoteSubEu* noteSubEu; NoteSubEu* noteSubEu;
s32 i; s32 i;
for (i = updateIndex + 1; i < gAudioContext.audioBufferParameters.updatesPerFrame; i++) { for (i = updateIndex + 1; i < gAudioCtx.audioBufferParameters.updatesPerFrame; i++) {
noteSubEu = &gAudioContext.noteSubsEu[(gAudioContext.numNotes * i) + noteIndex]; noteSubEu = &gAudioCtx.noteSubsEu[(gAudioCtx.numNotes * i) + noteIndex];
if (!noteSubEu->bitField0.needsInit) { if (!noteSubEu->bitField0.needsInit) {
noteSubEu->bitField0.enabled = false; noteSubEu->bitField0.enabled = false;
} else { } else {
@ -332,7 +331,7 @@ Acmd* AudioSynth_FilterReverb(Acmd* cmd, s32 size, SynthesisReverb* reverb) {
Acmd* AudioSynth_MaybeMixRingBuffer1(Acmd* cmd, SynthesisReverb* reverb, s32 updateIndex) { Acmd* AudioSynth_MaybeMixRingBuffer1(Acmd* cmd, SynthesisReverb* reverb, s32 updateIndex) {
SynthesisReverb* temp_a3; SynthesisReverb* temp_a3;
temp_a3 = &gAudioContext.synthesisReverbs[reverb->unk_05]; temp_a3 = &gAudioCtx.synthesisReverbs[reverb->unk_05];
if (temp_a3->downsampleRate == 1) { if (temp_a3->downsampleRate == 1) {
cmd = AudioSynth_LoadRingBuffer1AtTemp(cmd, temp_a3, updateIndex); cmd = AudioSynth_LoadRingBuffer1AtTemp(cmd, temp_a3, updateIndex);
aMix(cmd++, DMEM_2CH_SIZE >> 4, reverb->unk_08, DMEM_WET_LEFT_CH, DMEM_WET_TEMP); 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; NoteSubEu* noteSubEu2;
s32 unk14; s32 unk14;
t = gAudioContext.numNotes * updateIndex; t = gAudioCtx.numNotes * updateIndex;
count = 0; count = 0;
if (gAudioContext.numSynthesisReverbs == 0) { if (gAudioCtx.numSynthesisReverbs == 0) {
for (i = 0; i < gAudioContext.numNotes; i++) { for (i = 0; i < gAudioCtx.numNotes; i++) {
if (gAudioContext.noteSubsEu[t + i].bitField0.enabled) { if (gAudioCtx.noteSubsEu[t + i].bitField0.enabled) {
noteIndices[count++] = i; noteIndices[count++] = i;
} }
} }
} else { } else {
for (reverbIndex = 0; reverbIndex < gAudioContext.numSynthesisReverbs; reverbIndex++) { for (reverbIndex = 0; reverbIndex < gAudioCtx.numSynthesisReverbs; reverbIndex++) {
for (i = 0; i < gAudioContext.numNotes; i++) { for (i = 0; i < gAudioCtx.numNotes; i++) {
noteSubEu = &gAudioContext.noteSubsEu[t + i]; noteSubEu = &gAudioCtx.noteSubsEu[t + i];
if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex == reverbIndex) { if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex == reverbIndex) {
noteIndices[count++] = i; noteIndices[count++] = i;
} }
} }
} }
for (i = 0; i < gAudioContext.numNotes; i++) { for (i = 0; i < gAudioCtx.numNotes; i++) {
noteSubEu = &gAudioContext.noteSubsEu[t + i]; noteSubEu = &gAudioCtx.noteSubsEu[t + i];
if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex >= gAudioContext.numSynthesisReverbs) { if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex >= gAudioCtx.numSynthesisReverbs) {
noteIndices[count++] = i; 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); aClearBuffer(cmd++, DMEM_LEFT_CH, DMEM_2CH_SIZE);
i = 0; i = 0;
for (reverbIndex = 0; reverbIndex < gAudioContext.numSynthesisReverbs; reverbIndex++) { for (reverbIndex = 0; reverbIndex < gAudioCtx.numSynthesisReverbs; reverbIndex++) {
reverb = &gAudioContext.synthesisReverbs[reverbIndex]; reverb = &gAudioCtx.synthesisReverbs[reverbIndex];
useReverb = reverb->useReverb; useReverb = reverb->useReverb;
if (useReverb) { if (useReverb) {
@ -660,11 +659,11 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
} }
while (i < count) { while (i < count) {
noteSubEu2 = &gAudioContext.noteSubsEu[noteIndices[i] + t]; noteSubEu2 = &gAudioCtx.noteSubsEu[noteIndices[i] + t];
if (noteSubEu2->bitField1.reverbIndex == reverbIndex) { if (noteSubEu2->bitField1.reverbIndex == reverbIndex) {
cmd = AudioSynth_ProcessNote(noteIndices[i], noteSubEu2, cmd =
&gAudioContext.notes[noteIndices[i]].synthesisState, aiBuf, aiBufLen, cmd, AudioSynth_ProcessNote(noteIndices[i], noteSubEu2, &gAudioCtx.notes[noteIndices[i]].synthesisState,
updateIndex); aiBuf, aiBufLen, cmd, updateIndex);
} else { } else {
break; break;
} }
@ -689,9 +688,9 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
} }
while (i < count) { while (i < count) {
cmd = AudioSynth_ProcessNote(noteIndices[i], &gAudioContext.noteSubsEu[t + noteIndices[i]], cmd =
&gAudioContext.notes[noteIndices[i]].synthesisState, aiBuf, aiBufLen, cmd, AudioSynth_ProcessNote(noteIndices[i], &gAudioCtx.noteSubsEu[t + noteIndices[i]],
updateIndex); &gAudioCtx.notes[noteIndices[i]].synthesisState, aiBuf, aiBufLen, cmd, updateIndex);
i++; i++;
} }
@ -756,7 +755,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
bookOffset = noteSubEu->bitField1.bookOffset; bookOffset = noteSubEu->bitField1.bookOffset;
finished = noteSubEu->bitField0.finished; finished = noteSubEu->bitField0.finished;
note = &gAudioContext.notes[noteIndex]; note = &gAudioCtx.notes[noteIndex];
flags = A_CONTINUE; flags = A_CONTINUE;
if (noteSubEu->bitField0.needsInit == true) { 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 (sample->codec == CODEC_ADPCM || sample->codec == CODEC_SMALL_ADPCM) {
if (gAudioContext.curLoadedBook != sample->book->book) { if (gAudioCtx.curLoadedBook != sample->book->book) {
u32 nEntries; u32 nEntries;
switch (bookOffset) { switch (bookOffset) {
case 1: case 1:
gAudioContext.curLoadedBook = &D_8012FBA8[1]; gAudioCtx.curLoadedBook = &D_8012FBA8[1];
break; break;
case 2: case 2:
case 3: case 3:
default: default:
gAudioContext.curLoadedBook = sample->book->book; gAudioCtx.curLoadedBook = sample->book->book;
break; break;
} }
if (1) {} if (1) {}
if (1) {} if (1) {}
if (1) {} if (1) {}
nEntries = SAMPLES_PER_FRAME * sample->book->order * sample->book->numPredictors; nEntries = SAMPLES_PER_FRAME * sample->book->order * sample->book->numPredictors;
aLoadADPCM(cmd++, nEntries, gAudioContext.curLoadedBook); aLoadADPCM(cmd++, nEntries, gAudioCtx.curLoadedBook);
} }
} }

View file

@ -1,7 +1,10 @@
#include "global.h" #include "global.h"
#include "vt.h" #include "vt.h"
void func_800430A0(CollisionContext* colCtx, s32 bgId, Actor* actor) { /**
* Update the `carriedActor`'s position based on the dynapoly actor identified by `bgId`.
*/
void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Actor* carriedActor) {
MtxF prevTransform; MtxF prevTransform;
MtxF prevTransformInv; MtxF prevTransformInv;
MtxF curTransform; MtxF curTransform;
@ -9,22 +12,30 @@ void func_800430A0(CollisionContext* colCtx, s32 bgId, Actor* actor) {
Vec3f tempPos; Vec3f tempPos;
if (DynaPoly_IsBgIdBgActor(bgId)) { if (DynaPoly_IsBgIdBgActor(bgId)) {
SkinMatrix_SetTranslateRotateYXZScale( SkinMatrix_SetTranslateRotateYXZScale(
&prevTransform, colCtx->dyna.bgActors[bgId].prevTransform.scale.x, &prevTransform, colCtx->dyna.bgActors[bgId].prevTransform.scale.x,
colCtx->dyna.bgActors[bgId].prevTransform.scale.y, colCtx->dyna.bgActors[bgId].prevTransform.scale.z, colCtx->dyna.bgActors[bgId].prevTransform.scale.y, colCtx->dyna.bgActors[bgId].prevTransform.scale.z,
colCtx->dyna.bgActors[bgId].prevTransform.rot.x, colCtx->dyna.bgActors[bgId].prevTransform.rot.y, colCtx->dyna.bgActors[bgId].prevTransform.rot.x, colCtx->dyna.bgActors[bgId].prevTransform.rot.y,
colCtx->dyna.bgActors[bgId].prevTransform.rot.z, colCtx->dyna.bgActors[bgId].prevTransform.pos.x, colCtx->dyna.bgActors[bgId].prevTransform.rot.z, colCtx->dyna.bgActors[bgId].prevTransform.pos.x,
colCtx->dyna.bgActors[bgId].prevTransform.pos.y, colCtx->dyna.bgActors[bgId].prevTransform.pos.z); colCtx->dyna.bgActors[bgId].prevTransform.pos.y, colCtx->dyna.bgActors[bgId].prevTransform.pos.z);
if (SkinMatrix_Invert(&prevTransform, &prevTransformInv) != 2) { if (SkinMatrix_Invert(&prevTransform, &prevTransformInv) != 2) {
SkinMatrix_SetTranslateRotateYXZScale( SkinMatrix_SetTranslateRotateYXZScale(
&curTransform, colCtx->dyna.bgActors[bgId].curTransform.scale.x, &curTransform, colCtx->dyna.bgActors[bgId].curTransform.scale.x,
colCtx->dyna.bgActors[bgId].curTransform.scale.y, colCtx->dyna.bgActors[bgId].curTransform.scale.z, colCtx->dyna.bgActors[bgId].curTransform.scale.y, colCtx->dyna.bgActors[bgId].curTransform.scale.z,
colCtx->dyna.bgActors[bgId].curTransform.rot.x, colCtx->dyna.bgActors[bgId].curTransform.rot.y, colCtx->dyna.bgActors[bgId].curTransform.rot.x, colCtx->dyna.bgActors[bgId].curTransform.rot.y,
colCtx->dyna.bgActors[bgId].curTransform.rot.z, colCtx->dyna.bgActors[bgId].curTransform.pos.x, colCtx->dyna.bgActors[bgId].curTransform.rot.z, colCtx->dyna.bgActors[bgId].curTransform.pos.x,
colCtx->dyna.bgActors[bgId].curTransform.pos.y, colCtx->dyna.bgActors[bgId].curTransform.pos.z); colCtx->dyna.bgActors[bgId].curTransform.pos.y, colCtx->dyna.bgActors[bgId].curTransform.pos.z);
SkinMatrix_Vec3fMtxFMultXYZ(&prevTransformInv, &actor->world.pos, &tempPos);
// Apply the movement of the dynapoly actor `bgId` over the last frame to the `carriedActor` position
// pos = curTransform * prevTransformInv * pos
// Note (curTransform * prevTransformInv) represents the transform relative to the previous frame
SkinMatrix_Vec3fMtxFMultXYZ(&prevTransformInv, &carriedActor->world.pos, &tempPos);
SkinMatrix_Vec3fMtxFMultXYZ(&curTransform, &tempPos, &pos); SkinMatrix_Vec3fMtxFMultXYZ(&curTransform, &tempPos, &pos);
actor->world.pos = pos; carriedActor->world.pos = pos;
if (BGCHECK_XYZ_ABSMAX <= pos.x || pos.x <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.y || if (BGCHECK_XYZ_ABSMAX <= pos.x || pos.x <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.y ||
pos.y <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.z || pos.z <= -BGCHECK_XYZ_ABSMAX) { pos.y <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.z || pos.z <= -BGCHECK_XYZ_ABSMAX) {
@ -41,18 +52,18 @@ void func_800430A0(CollisionContext* colCtx, s32 bgId, Actor* actor) {
} }
/** /**
* Rotate actor * Update the `carriedActor`'s Y rotation based on the dynapoly actor identified by `bgId`.
*/ */
void func_800432A0(CollisionContext* colCtx, s32 bgId, Actor* actor) { void DynaPolyActor_UpdateCarriedActorRotY(CollisionContext* colCtx, s32 bgId, Actor* carriedActor) {
if (DynaPoly_IsBgIdBgActor(bgId)) { if (DynaPoly_IsBgIdBgActor(bgId)) {
s16 rot = colCtx->dyna.bgActors[bgId].curTransform.rot.y - colCtx->dyna.bgActors[bgId].prevTransform.rot.y; s16 rotY = colCtx->dyna.bgActors[bgId].curTransform.rot.y - colCtx->dyna.bgActors[bgId].prevTransform.rot.y;
if (actor->id == ACTOR_PLAYER) { if (carriedActor->id == ACTOR_PLAYER) {
((Player*)actor)->currentYaw += rot; ((Player*)carriedActor)->currentYaw += rotY;
} }
actor->shape.rot.y += rot; carriedActor->shape.rot.y += rotY;
actor->world.rot.y += rot; carriedActor->world.rot.y += rotY;
} }
} }
@ -70,14 +81,14 @@ void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId) {
} }
/** /**
* Transform actor's position * Update the `carriedActor`'s position and Y rotation based on the dynapoly actor identified by `bgId`, according to
* `actor` is the actor to update * the dynapoly actor's move flags (see `DYNA_TRANSFORM_POS` and `DYNA_TRANSFORM_ROT_Y`).
*/ */
s32 func_800433A4(CollisionContext* colCtx, s32 bgId, Actor* actor) { s32 DynaPolyActor_TransformCarriedActor(CollisionContext* colCtx, s32 bgId, Actor* carriedActor) {
s32 result = false; s32 result = false;
DynaPolyActor* dynaActor; DynaPolyActor* dynaActor;
if (DynaPoly_IsBgIdBgActor(bgId) == false) { if (!DynaPoly_IsBgIdBgActor(bgId)) {
return false; return false;
} }
@ -91,13 +102,13 @@ s32 func_800433A4(CollisionContext* colCtx, s32 bgId, Actor* actor) {
return false; return false;
} }
if (dynaActor->unk_15C & 1) { if (dynaActor->transformFlags & DYNA_TRANSFORM_POS) {
func_800430A0(colCtx, bgId, actor); DynaPolyActor_UpdateCarriedActorPos(colCtx, bgId, carriedActor);
result = true; result = true;
} }
if (dynaActor->unk_15C & 2) { if (dynaActor->transformFlags & DYNA_TRANSFORM_ROT_Y) {
func_800432A0(colCtx, bgId, actor); DynaPolyActor_UpdateCarriedActorRotY(colCtx, bgId, carriedActor);
result = true; result = true;
} }

View file

@ -1,8 +1,12 @@
#include "global.h" #include "global.h"
void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 flags) { /**
* @param transformFlags How other actors standing on the dynapoly actor's collision move when the dynapoly actor moves.
* See `DYNA_TRANSFORM_POS`, `DYNA_TRANSFORM_ROT_Y`.
*/
void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 transformFlags) {
dynaActor->bgId = -1; dynaActor->bgId = -1;
dynaActor->unk_15C = flags; dynaActor->transformFlags = transformFlags;
dynaActor->interactFlags = 0; dynaActor->interactFlags = 0;
dynaActor->unk_150 = 0.0f; dynaActor->unk_150 = 0.0f;
dynaActor->unk_154 = 0.0f; dynaActor->unk_154 = 0.0f;

View file

@ -53,32 +53,32 @@ AudioTask* func_800E5000(void) {
s32 sp48; s32 sp48;
s32 i; s32 i;
gAudioContext.totalTaskCount++; gAudioCtx.totalTaskCount++;
if (gAudioContext.totalTaskCount % (gAudioContext.audioBufferParameters.specUnk4) != 0) { if (gAudioCtx.totalTaskCount % (gAudioCtx.audioBufferParameters.specUnk4) != 0) {
if (D_801755D0 != NULL) { if (D_801755D0 != NULL) {
D_801755D0(); D_801755D0();
} }
if ((gAudioContext.totalTaskCount % gAudioContext.audioBufferParameters.specUnk4) + 1 == if ((gAudioCtx.totalTaskCount % gAudioCtx.audioBufferParameters.specUnk4) + 1 ==
gAudioContext.audioBufferParameters.specUnk4) { gAudioCtx.audioBufferParameters.specUnk4) {
return sWaitingAudioTask; return sWaitingAudioTask;
} else { } else {
return NULL; return NULL;
} }
} }
osSendMesg(gAudioContext.taskStartQueueP, (OSMesg)gAudioContext.totalTaskCount, OS_MESG_NOBLOCK); osSendMesg(gAudioCtx.taskStartQueueP, (OSMesg)gAudioCtx.totalTaskCount, OS_MESG_NOBLOCK);
gAudioContext.rspTaskIndex ^= 1; gAudioCtx.rspTaskIndex ^= 1;
gAudioContext.curAiBufIndex++; gAudioCtx.curAiBufIndex++;
gAudioContext.curAiBufIndex %= 3; gAudioCtx.curAiBufIndex %= 3;
index = (gAudioContext.curAiBufIndex - 2 + 3) % 3; index = (gAudioCtx.curAiBufIndex - 2 + 3) % 3;
samplesRemainingInAi = osAiGetLength() / 4; samplesRemainingInAi = osAiGetLength() / 4;
if (gAudioContext.resetTimer < 16) { if (gAudioCtx.resetTimer < 16) {
if (gAudioContext.aiBufLengths[index] != 0) { if (gAudioCtx.aiBufLengths[index] != 0) {
osAiSetNextBuffer(gAudioContext.aiBuffers[index], gAudioContext.aiBufLengths[index] * 4); osAiSetNextBuffer(gAudioCtx.aiBuffers[index], gAudioCtx.aiBufLengths[index] * 4);
if (gAudioContext.aiBuffers[index]) {} if (gAudioCtx.aiBuffers[index]) {}
if (gAudioContext.aiBufLengths[index]) {} if (gAudioCtx.aiBufLengths[index]) {}
} }
} }
@ -86,36 +86,35 @@ AudioTask* func_800E5000(void) {
D_801755D0(); D_801755D0();
} }
sp5C = gAudioContext.curAudioFrameDmaCount; sp5C = gAudioCtx.curAudioFrameDmaCount;
for (i = 0; i < gAudioContext.curAudioFrameDmaCount; i++) { for (i = 0; i < gAudioCtx.curAudioFrameDmaCount; i++) {
if (osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) { if (osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) {
sp5C--; sp5C--;
} }
} }
if (sp5C != 0) { if (sp5C != 0) {
for (i = 0; i < sp5C; i++) { 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) { if (sp48 != 0) {
for (i = 0; i < sp48; i++) { 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_DecreaseSampleDmaTtls();
AudioLoad_ProcessLoads(gAudioContext.resetStatus); AudioLoad_ProcessLoads(gAudioCtx.resetStatus);
AudioLoad_ProcessScriptLoads(); AudioLoad_ProcessScriptLoads();
if (gAudioContext.resetStatus != 0) { if (gAudioCtx.resetStatus != 0) {
if (AudioHeap_ResetStep() == 0) { if (AudioHeap_ResetStep() == 0) {
if (gAudioContext.resetStatus == 0) { if (gAudioCtx.resetStatus == 0) {
osSendMesg(gAudioContext.audioResetQueueP, (OSMesg)(u32)gAudioContext.audioResetSpecIdToLoad, osSendMesg(gAudioCtx.audioResetQueueP, (OSMesg)(u32)gAudioCtx.audioResetSpecIdToLoad, OS_MESG_NOBLOCK);
OS_MESG_NOBLOCK);
} }
sWaitingAudioTask = NULL; sWaitingAudioTask = NULL;
@ -123,63 +122,62 @@ AudioTask* func_800E5000(void) {
} }
} }
if (gAudioContext.resetTimer > 16) { if (gAudioCtx.resetTimer > 16) {
return NULL; return NULL;
} }
if (gAudioContext.resetTimer != 0) { if (gAudioCtx.resetTimer != 0) {
gAudioContext.resetTimer++; gAudioCtx.resetTimer++;
} }
gAudioContext.curTask = &gAudioContext.rspTask[gAudioContext.rspTaskIndex]; gAudioCtx.curTask = &gAudioCtx.rspTask[gAudioCtx.rspTaskIndex];
gAudioContext.curAbiCmdBuf = gAudioContext.abiCmdBufs[gAudioContext.rspTaskIndex]; gAudioCtx.curAbiCmdBuf = gAudioCtx.abiCmdBufs[gAudioCtx.rspTaskIndex];
index = gAudioContext.curAiBufIndex; index = gAudioCtx.curAiBufIndex;
currAiBuffer = gAudioContext.aiBuffers[index]; currAiBuffer = gAudioCtx.aiBuffers[index];
gAudioContext.aiBufLengths[index] = gAudioCtx.aiBufLengths[index] =
(s16)((((gAudioContext.audioBufferParameters.samplesPerFrameTarget - samplesRemainingInAi) + (s16)((((gAudioCtx.audioBufferParameters.samplesPerFrameTarget - samplesRemainingInAi) +
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & EXTRA_BUFFERED_AI_SAMPLES_TARGET) &
~0xF) + ~0xF) +
SAMPLES_TO_OVERPRODUCE); SAMPLES_TO_OVERPRODUCE);
if (gAudioContext.aiBufLengths[index] < gAudioContext.audioBufferParameters.minAiBufferLength) { if (gAudioCtx.aiBufLengths[index] < gAudioCtx.audioBufferParameters.minAiBufferLength) {
gAudioContext.aiBufLengths[index] = gAudioContext.audioBufferParameters.minAiBufferLength; gAudioCtx.aiBufLengths[index] = gAudioCtx.audioBufferParameters.minAiBufferLength;
} }
if (gAudioContext.aiBufLengths[index] > gAudioContext.audioBufferParameters.maxAiBufferLength) { if (gAudioCtx.aiBufLengths[index] > gAudioCtx.audioBufferParameters.maxAiBufferLength) {
gAudioContext.aiBufLengths[index] = gAudioContext.audioBufferParameters.maxAiBufferLength; gAudioCtx.aiBufLengths[index] = gAudioCtx.audioBufferParameters.maxAiBufferLength;
} }
j = 0; j = 0;
if (gAudioContext.resetStatus == 0) { if (gAudioCtx.resetStatus == 0) {
// msg = 0000RREE R = read pos, E = End Pos // 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) {} if (1) {}
Audio_ProcessCmds(sp4C); Audio_ProcessCmds(sp4C);
j++; j++;
} }
if ((j == 0) && (gAudioContext.cmdQueueFinished)) { if ((j == 0) && (gAudioCtx.cmdQueueFinished)) {
Audio_ScheduleProcessCmds(); Audio_ScheduleProcessCmds();
} }
} }
gAudioContext.curAbiCmdBuf = gAudioCtx.curAbiCmdBuf =
AudioSynth_Update(gAudioContext.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioContext.aiBufLengths[index]); AudioSynth_Update(gAudioCtx.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioCtx.aiBufLengths[index]);
// Update audioRandom to the next random number // Update audioRandom to the next random number
gAudioContext.audioRandom = (gAudioContext.audioRandom + gAudioContext.totalTaskCount) * osGetCount(); gAudioCtx.audioRandom = (gAudioCtx.audioRandom + gAudioCtx.totalTaskCount) * osGetCount();
gAudioContext.audioRandom = gAudioCtx.audioRandom = gAudioCtx.audioRandom + gAudioCtx.aiBuffers[index][gAudioCtx.totalTaskCount & 0xFF];
gAudioContext.audioRandom + gAudioContext.aiBuffers[index][gAudioContext.totalTaskCount & 0xFF];
// gWaveSamples[8] interprets compiled assembly code as s16 samples as a way to generate sound with noise. // 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 // 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[]` // 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; index = gAudioCtx.rspTaskIndex;
gAudioContext.curTask->msgQueue = NULL; gAudioCtx.curTask->msgQueue = NULL;
gAudioContext.curTask->unk_44 = NULL; gAudioCtx.curTask->unk_44 = NULL;
task = &gAudioContext.curTask->task.t; task = &gAudioCtx.curTask->task.t;
task->type = M_AUDTASK; task->type = M_AUDTASK;
task->flags = 0; task->flags = 0;
task->ucode_boot = aspMainTextStart; task->ucode_boot = aspMainTextStart;
@ -193,7 +191,7 @@ AudioTask* func_800E5000(void) {
task->output_buff = NULL; task->output_buff = NULL;
task->output_buff_size = NULL; task->output_buff_size = NULL;
if (1) {} if (1) {}
task->data_ptr = (u64*)gAudioContext.abiCmdBufs[index]; task->data_ptr = (u64*)gAudioCtx.abiCmdBufs[index];
task->data_size = abiCmdCnt * sizeof(Acmd); task->data_size = abiCmdCnt * sizeof(Acmd);
task->yield_data_ptr = NULL; task->yield_data_ptr = NULL;
task->yield_data_size = 0; task->yield_data_size = 0;
@ -202,10 +200,10 @@ AudioTask* func_800E5000(void) {
sMaxAbiCmdCnt = abiCmdCnt; sMaxAbiCmdCnt = abiCmdCnt;
} }
if (gAudioContext.audioBufferParameters.specUnk4 == 1) { if (gAudioCtx.audioBufferParameters.specUnk4 == 1) {
return gAudioContext.curTask; return gAudioCtx.curTask;
} else { } else {
sWaitingAudioTask = gAudioContext.curTask; sWaitingAudioTask = gAudioCtx.curTask;
return NULL; return NULL;
} }
} }
@ -235,9 +233,9 @@ void func_800E5584(AudioCmd* cmd) {
break; break;
case 0x83: case 0x83:
if (gAudioContext.seqPlayers[cmd->arg0].enabled) { if (gAudioCtx.seqPlayers[cmd->arg0].enabled) {
if (cmd->asInt == 0) { if (cmd->asInt == 0) {
AudioSeq_SequencePlayerDisableAsFinished(&gAudioContext.seqPlayers[cmd->arg0]); AudioSeq_SequencePlayerDisableAsFinished(&gAudioCtx.seqPlayers[cmd->arg0]);
} else { } else {
func_800E5958(cmd->arg0, cmd->asInt); func_800E5958(cmd->arg0, cmd->asInt);
} }
@ -245,12 +243,12 @@ void func_800E5584(AudioCmd* cmd) {
break; break;
case 0xF0: case 0xF0:
gAudioContext.soundMode = cmd->asUInt; gAudioCtx.soundMode = cmd->asUInt;
break; break;
case 0xF1: case 0xF1:
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) { for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i]; SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[i];
seqPlayer->muted = 1; seqPlayer->muted = 1;
seqPlayer->recalculateVolume = 1; seqPlayer->recalculateVolume = 1;
@ -259,8 +257,8 @@ void func_800E5584(AudioCmd* cmd) {
case 0xF2: case 0xF2:
if (cmd->asUInt == 1) { if (cmd->asUInt == 1) {
for (i = 0; i < gAudioContext.numNotes; i++) { for (i = 0; i < gAudioCtx.numNotes; i++) {
Note* note = &gAudioContext.notes[i]; Note* note = &gAudioCtx.notes[i];
NoteSubEu* subEu = &note->noteSubEu; NoteSubEu* subEu = &note->noteSubEu;
if (subEu->bitField0.enabled && note->playbackState.unk_04 == 0) { 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++) { for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i]; SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[i];
seqPlayer->muted = 0; seqPlayer->muted = 0;
seqPlayer->recalculateVolume = 1; seqPlayer->recalculateVolume = 1;
@ -284,15 +282,15 @@ void func_800E5584(AudioCmd* cmd) {
break; break;
case 0xF4: case 0xF4:
AudioLoad_AsyncLoadSampleBank(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue); AudioLoad_AsyncLoadSampleBank(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioCtx.externalLoadQueue);
break; break;
case 0xF5: case 0xF5:
AudioLoad_AsyncLoadFont(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue); AudioLoad_AsyncLoadFont(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioCtx.externalLoadQueue);
break; break;
case 0xFC: case 0xFC:
AudioLoad_AsyncLoadSeq(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue); AudioLoad_AsyncLoadSeq(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioCtx.externalLoadQueue);
break; break;
case 0xF6: case 0xF6:
@ -300,12 +298,12 @@ void func_800E5584(AudioCmd* cmd) {
break; break;
case 0x90: case 0x90:
gAudioContext.unk_5BDC[cmd->arg0] = cmd->asUShort; gAudioCtx.unk_5BDC[cmd->arg0] = cmd->asUShort;
break; break;
case 0xF9: case 0xF9:
gAudioContext.resetStatus = 5; gAudioCtx.resetStatus = 5;
gAudioContext.audioResetSpecIdToLoad = cmd->asUInt; gAudioCtx.audioResetSpecIdToLoad = cmd->asUInt;
break; break;
case 0xFB: case 0xFB:
@ -321,8 +319,8 @@ void func_800E5584(AudioCmd* cmd) {
case 0xFE: case 0xFE:
temp_t7 = cmd->asUInt; temp_t7 = cmd->asUInt;
if (temp_t7 == 1) { if (temp_t7 == 1) {
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) { for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i]; SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[i];
if (seqPlayer->enabled) { if (seqPlayer->enabled) {
AudioSeq_SequencePlayerDisableAsFinished(seqPlayer); AudioSeq_SequencePlayerDisableAsFinished(seqPlayer);
@ -343,7 +341,7 @@ void func_800E5584(AudioCmd* cmd) {
// SetFadeOutTimer // SetFadeOutTimer
void func_800E5958(s32 playerIdx, s32 fadeTimer) { void func_800E5958(s32 playerIdx, s32 fadeTimer) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx]; SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
if (fadeTimer == 0) { if (fadeTimer == 0) {
fadeTimer = 1; fadeTimer = 1;
@ -359,7 +357,7 @@ void func_800E59AC(s32 playerIdx, s32 fadeTimer) {
SequencePlayer* seqPlayer; SequencePlayer* seqPlayer;
if (fadeTimer != 0) { if (fadeTimer != 0) {
seqPlayer = &gAudioContext.seqPlayers[playerIdx]; seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
seqPlayer->state = 1; seqPlayer->state = 1;
seqPlayer->fadeTimerUnkEu = fadeTimer; seqPlayer->fadeTimerUnkEu = fadeTimer;
seqPlayer->fadeTimer = fadeTimer; seqPlayer->fadeTimer = fadeTimer;
@ -369,30 +367,27 @@ void func_800E59AC(s32 playerIdx, s32 fadeTimer) {
} }
void Audio_InitMesgQueuesInternal(void) { void Audio_InitMesgQueuesInternal(void) {
gAudioContext.cmdWrPos = 0; gAudioCtx.cmdWrPos = 0;
gAudioContext.cmdRdPos = 0; gAudioCtx.cmdRdPos = 0;
gAudioContext.cmdQueueFinished = 0; gAudioCtx.cmdQueueFinished = 0;
gAudioContext.taskStartQueueP = &gAudioContext.taskStartQueue; gAudioCtx.taskStartQueueP = &gAudioCtx.taskStartQueue;
gAudioContext.cmdProcQueueP = &gAudioContext.cmdProcQueue; gAudioCtx.cmdProcQueueP = &gAudioCtx.cmdProcQueue;
gAudioContext.audioResetQueueP = &gAudioContext.audioResetQueue; gAudioCtx.audioResetQueueP = &gAudioCtx.audioResetQueue;
osCreateMesgQueue(gAudioContext.taskStartQueueP, gAudioContext.taskStartMsgBuf, osCreateMesgQueue(gAudioCtx.taskStartQueueP, gAudioCtx.taskStartMsgBuf, ARRAY_COUNT(gAudioCtx.taskStartMsgBuf));
ARRAY_COUNT(gAudioContext.taskStartMsgBuf)); osCreateMesgQueue(gAudioCtx.cmdProcQueueP, gAudioCtx.cmdProcMsgBuf, ARRAY_COUNT(gAudioCtx.cmdProcMsgBuf));
osCreateMesgQueue(gAudioContext.cmdProcQueueP, gAudioContext.cmdProcMsgBuf, osCreateMesgQueue(gAudioCtx.audioResetQueueP, gAudioCtx.audioResetMsgBuf, ARRAY_COUNT(gAudioCtx.audioResetMsgBuf));
ARRAY_COUNT(gAudioContext.cmdProcMsgBuf));
osCreateMesgQueue(gAudioContext.audioResetQueueP, gAudioContext.audioResetMsgBuf,
ARRAY_COUNT(gAudioContext.audioResetMsgBuf));
} }
void Audio_QueueCmd(u32 opArgs, void** data) { 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->opArgs = opArgs;
cmd->data = *data; cmd->data = *data;
gAudioContext.cmdWrPos++; gAudioCtx.cmdWrPos++;
if (gAudioContext.cmdWrPos == gAudioContext.cmdRdPos) { if (gAudioCtx.cmdWrPos == gAudioCtx.cmdRdPos) {
gAudioContext.cmdWrPos--; gAudioCtx.cmdWrPos--;
} }
} }
@ -420,15 +415,14 @@ s32 Audio_ScheduleProcessCmds(void) {
static s32 D_801304E8 = 0; static s32 D_801304E8 = 0;
s32 ret; s32 ret;
if (D_801304E8 < (u8)((gAudioContext.cmdWrPos - gAudioContext.cmdRdPos) + 0x100)) { if (D_801304E8 < (u8)((gAudioCtx.cmdWrPos - gAudioCtx.cmdRdPos) + 0x100)) {
D_801304E8 = (u8)((gAudioContext.cmdWrPos - gAudioContext.cmdRdPos) + 0x100); D_801304E8 = (u8)((gAudioCtx.cmdWrPos - gAudioCtx.cmdRdPos) + 0x100);
} }
ret = ret = osSendMesg(gAudioCtx.cmdProcQueueP,
osSendMesg(gAudioContext.cmdProcQueueP, (OSMesg)(((gAudioCtx.cmdRdPos & 0xFF) << 8) | (gAudioCtx.cmdWrPos & 0xFF)), OS_MESG_NOBLOCK);
(OSMesg)(((gAudioContext.cmdRdPos & 0xFF) << 8) | (gAudioContext.cmdWrPos & 0xFF)), OS_MESG_NOBLOCK);
if (ret != -1) { if (ret != -1) {
gAudioContext.cmdRdPos = gAudioContext.cmdWrPos; gAudioCtx.cmdRdPos = gAudioCtx.cmdWrPos;
ret = 0; ret = 0;
} else { } else {
return -1; return -1;
@ -438,8 +432,8 @@ s32 Audio_ScheduleProcessCmds(void) {
} }
void Audio_ResetCmdQueue(void) { void Audio_ResetCmdQueue(void) {
gAudioContext.cmdQueueFinished = 0; gAudioCtx.cmdQueueFinished = 0;
gAudioContext.cmdRdPos = gAudioContext.cmdWrPos; gAudioCtx.cmdRdPos = gAudioCtx.cmdWrPos;
} }
void Audio_ProcessCmd(AudioCmd* cmd) { void Audio_ProcessCmd(AudioCmd* cmd) {
@ -452,8 +446,8 @@ void Audio_ProcessCmd(AudioCmd* cmd) {
return; return;
} }
if (cmd->arg0 < gAudioContext.audioBufferParameters.numSequencePlayers) { if (cmd->arg0 < gAudioCtx.audioBufferParameters.numSequencePlayers) {
seqPlayer = &gAudioContext.seqPlayers[cmd->arg0]; seqPlayer = &gAudioCtx.seqPlayers[cmd->arg0];
if (cmd->op & 0x80) { if (cmd->op & 0x80) {
func_800E5584(cmd); func_800E5584(cmd);
return; return;
@ -468,7 +462,7 @@ void Audio_ProcessCmd(AudioCmd* cmd) {
return; return;
} }
if (cmd->arg1 == 0xFF) { if (cmd->arg1 == 0xFF) {
phi_v0 = gAudioContext.unk_5BDC[cmd->arg0]; phi_v0 = gAudioCtx.unk_5BDC[cmd->arg0];
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if (phi_v0 & 1) { if (phi_v0 & 1) {
func_800E6300(seqPlayer->channels[i], cmd); func_800E6300(seqPlayer->channels[i], cmd);
@ -484,20 +478,20 @@ void Audio_ProcessCmds(u32 msg) {
AudioCmd* cmd; AudioCmd* cmd;
u8 endPos; u8 endPos;
if (!gAudioContext.cmdQueueFinished) { if (!gAudioCtx.cmdQueueFinished) {
curCmdRdPos = msg >> 8; curCmdRdPos = msg >> 8;
} }
while (true) { while (true) {
endPos = msg & 0xFF; endPos = msg & 0xFF;
if (curCmdRdPos == endPos) { if (curCmdRdPos == endPos) {
gAudioContext.cmdQueueFinished = 0; gAudioCtx.cmdQueueFinished = 0;
return; return;
} }
cmd = &gAudioContext.cmdBuf[curCmdRdPos++ & 0xFF]; cmd = &gAudioCtx.cmdBuf[curCmdRdPos++ & 0xFF];
if (cmd->op == 0xF8) { if (cmd->op == 0xF8) {
gAudioContext.cmdQueueFinished = 1; gAudioCtx.cmdQueueFinished = 1;
return; return;
} }
@ -509,7 +503,7 @@ void Audio_ProcessCmds(u32 msg) {
u32 func_800E5E20(u32* out) { u32 func_800E5E20(u32* out) {
u32 sp1C; u32 sp1C;
if (osRecvMesg(&gAudioContext.externalLoadQueue, (OSMesg*)&sp1C, OS_MESG_NOBLOCK) == -1) { if (osRecvMesg(&gAudioCtx.externalLoadQueue, (OSMesg*)&sp1C, OS_MESG_NOBLOCK) == -1) {
*out = 0; *out = 0;
return 0; return 0;
} }
@ -522,17 +516,17 @@ u8* func_800E5E84(s32 arg0, u32* arg1) {
} }
void Audio_GetSampleBankIdsOfFont(s32 fontId, u32* sampleBankId1, u32* sampleBankId2) { void Audio_GetSampleBankIdsOfFont(s32 fontId, u32* sampleBankId1, u32* sampleBankId2) {
*sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1; *sampleBankId1 = gAudioCtx.soundFontList[fontId].sampleBankId1;
*sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2; *sampleBankId2 = gAudioCtx.soundFontList[fontId].sampleBankId2;
} }
s32 func_800E5EDC(void) { s32 func_800E5EDC(void) {
s32 pad; s32 pad;
s32 sp18; s32 sp18;
if (osRecvMesg(gAudioContext.audioResetQueueP, (OSMesg*)&sp18, OS_MESG_NOBLOCK) == -1) { if (osRecvMesg(gAudioCtx.audioResetQueueP, (OSMesg*)&sp18, OS_MESG_NOBLOCK) == -1) {
return 0; return 0;
} else if (gAudioContext.audioResetSpecIdToLoad != sp18) { } else if (gAudioCtx.audioResetSpecIdToLoad != sp18) {
return -1; return -1;
} else { } else {
return 1; return 1;
@ -542,7 +536,7 @@ s32 func_800E5EDC(void) {
void func_800E5F34(void) { void func_800E5F34(void) {
// macro? // macro?
// clang-format off // 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 // clang-format on
} }
@ -552,16 +546,16 @@ s32 func_800E5F88(s32 resetPreloadID) {
s32 pad; s32 pad;
func_800E5F34(); func_800E5F34();
resetStatus = gAudioContext.resetStatus; resetStatus = gAudioCtx.resetStatus;
if (resetStatus != 0) { if (resetStatus != 0) {
Audio_ResetCmdQueue(); Audio_ResetCmdQueue();
if (gAudioContext.audioResetSpecIdToLoad == resetPreloadID) { if (gAudioCtx.audioResetSpecIdToLoad == resetPreloadID) {
return -2; return -2;
} else if (resetStatus > 2) { } else if (resetStatus > 2) {
gAudioContext.audioResetSpecIdToLoad = resetPreloadID; gAudioCtx.audioResetSpecIdToLoad = resetPreloadID;
return -3; return -3;
} else { } 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) { void Audio_PreNMIInternal(void) {
gAudioContext.resetTimer = 1; gAudioCtx.resetTimer = 1;
if (gAudioContextInitialized) { if (gAudioContextInitialized) {
func_800E5F88(0); func_800E5F88(0);
gAudioContext.resetStatus = 0; gAudioCtx.resetStatus = 0;
} }
} }
s8 func_800E6070(s32 playerIdx, s32 channelIdx, s32 scriptIdx) { s8 func_800E6070(s32 playerIdx, s32 channelIdx, s32 scriptIdx) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx]; SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
SequenceChannel* channel; SequenceChannel* channel;
if (seqPlayer->enabled) { if (seqPlayer->enabled) {
@ -592,15 +586,15 @@ s8 func_800E6070(s32 playerIdx, s32 channelIdx, s32 scriptIdx) {
} }
s8 func_800E60C4(s32 playerIdx, s32 port) { 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) { void Audio_InitExternalPool(void* ramAddr, u32 size) {
AudioHeap_InitPool(&gAudioContext.externalPool, ramAddr, size); AudioHeap_InitPool(&gAudioCtx.externalPool, ramAddr, size);
} }
void Audio_DestroyExternalPool(void) { void Audio_DestroyExternalPool(void) {
gAudioContext.externalPool.startRamAddr = NULL; gAudioCtx.externalPool.startRamAddr = NULL;
} }
void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* cmd) { void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* cmd) {
@ -780,8 +774,8 @@ void func_800E651C(u32 arg0, s32 arg1) {
} }
void Audio_WaitForAudioTask(void) { void Audio_WaitForAudioTask(void) {
osRecvMesg(gAudioContext.taskStartQueueP, NULL, OS_MESG_NOBLOCK); osRecvMesg(gAudioCtx.taskStartQueueP, NULL, OS_MESG_NOBLOCK);
osRecvMesg(gAudioContext.taskStartQueueP, NULL, OS_MESG_BLOCK); osRecvMesg(gAudioCtx.taskStartQueueP, NULL, OS_MESG_BLOCK);
} }
s32 func_800E6590(s32 playerIdx, s32 arg1, s32 arg2) { 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 loopEnd;
s32 samplePos; s32 samplePos;
seqPlayer = &gAudioContext.seqPlayers[playerIdx]; seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
if (seqPlayer->enabled && seqPlayer->channels[arg1]->enabled) { if (seqPlayer->enabled && seqPlayer->channels[arg1]->enabled) {
layer = seqPlayer->channels[arg1]->layers[arg2]; layer = seqPlayer->channels[arg1]->layers[arg2];
if (layer == NULL) { if (layer == NULL) {
@ -841,8 +835,8 @@ s32 func_800E66C0(s32 arg0) {
TunedSample* tunedSample; TunedSample* tunedSample;
phi_v1 = 0; phi_v1 = 0;
for (i = 0; i < gAudioContext.numNotes; i++) { for (i = 0; i < gAudioCtx.numNotes; i++) {
note = &gAudioContext.notes[i]; note = &gAudioCtx.notes[i];
playbackState = &note->playbackState; playbackState = &note->playbackState;
if (note->noteSubEu.bitField0.enabled) { if (note->noteSubEu.bitField0.enabled) {
noteSubEu = &note->noteSubEu; noteSubEu = &note->noteSubEu;
@ -859,7 +853,7 @@ s32 func_800E66C0(s32 arg0) {
phi_v1++; phi_v1++;
if ((arg0 & 1) == 1) { if ((arg0 & 1) == 1) {
playbackState->adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv; playbackState->adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
playbackState->adsr.action.s.release = 1; playbackState->adsr.action.s.release = 1;
} }
} }
@ -871,8 +865,8 @@ s32 func_800E66C0(s32 arg0) {
u32 Audio_NextRandom(void) { u32 Audio_NextRandom(void) {
static u32 audRand = 0x12345678; static u32 audRand = 0x12345678;
audRand = ((osGetCount() + 0x1234567) * (audRand + gAudioContext.totalTaskCount)); audRand = ((osGetCount() + 0x1234567) * (audRand + gAudioCtx.totalTaskCount));
audRand += gAudioContext.audioRandom; audRand += gAudioCtx.audioRandom;
return audRand; return audRand;
} }

View file

@ -112,8 +112,11 @@ u8 sPrevSeqMode = 0;
f32 sAudioEnemyDist = 0.0f; f32 sAudioEnemyDist = 0.0f;
s8 sAudioEnemyVol = 127; s8 sAudioEnemyVol = 127;
u16 sPrevMainBgmSeqId = NA_BGM_DISABLED; u16 sPrevMainBgmSeqId = NA_BGM_DISABLED;
u8 D_8013062C = 0;
u8 D_80130630 = NA_BGM_GENERAL_SFX; #define SEQ_RESUME_POINT_NONE 0xC0
u8 sSeqResumePoint = 0;
u8 sPrevSceneSeqId = NA_BGM_GENERAL_SFX;
u32 sNumFramesStill = 0; u32 sNumFramesStill = 0;
u32 sNumFramesMoving = 0; u32 sNumFramesMoving = 0;
u8 sAudioBaseFilter = 0; u8 sAudioBaseFilter = 0;
@ -128,12 +131,31 @@ u8 sSeqModeInput = 0;
#define SEQ_FLAG_FANFARE (1 << 1) #define SEQ_FLAG_FANFARE (1 << 1)
#define SEQ_FLAG_FANFARE_GANON (1 << 2) #define SEQ_FLAG_FANFARE_GANON (1 << 2)
#define SEQ_FLAG_RESTORE (1 << 3) // required for func_800F5B58 to restore a sequence after func_800F5ACC #define SEQ_FLAG_RESTORE (1 << 3) // required for func_800F5B58 to restore a sequence after func_800F5ACC
#define SEQ_FLAG_4 (1 << 4)
#define SEQ_FLAG_5 (1 << 5) /**
#define SEQ_FLAG_6 (1 << 6) * These two sequence flags work together to implement a resume playing from where you left off system for scene
* sequences when leaving and returning to a scene. For a scene to resume playing from the point where it left off, it
* must have `SEQ_FLAG_RESUME` attached to it. Then, if the scene changes and the new scene sequence contain
* `SEQ_FLAG_RESUME_PREV`, the point from the previous scene sequence will be stored. Then, when returning to the
* scene with the sequence `SEQ_FLAG_RESUME`, then the sequence will resume playing from where it left off.
*
* There are only 5 sequences with `SEQ_FLAG_RESUME`, and all 5 of those sequences have special sequence
* instructions in their .seq files to read io port 7 and branch to different starting points along the sequence
* i.e. this system will only work for: kokiri forest, kakariko child, kakariko adult, zoras domain, gerudo valley
*/
#define SEQ_FLAG_RESUME (1 << 4)
#define SEQ_FLAG_RESUME_PREV (1 << 5)
/**
* Will write a value of 1 to ioPort 7 when called through the scene. How it's used depends on the sequence:
* NA_BGM_CHAMBER_OF_SAGES - ioPort 7 is never read from
* NA_BGM_FILE_SELECT - ioPort 7 skips the harp intro when a value of 1 is written to it.
* Note: NA_BGM_FILE_SELECT is not called through the scene. So this flag serves no purpose
*/
#define SEQ_FLAG_SKIP_HARP_INTRO (1 << 6)
#define SEQ_FLAG_NO_AMBIENCE (1 << 7) #define SEQ_FLAG_NO_AMBIENCE (1 << 7)
u8 sSeqFlags[0x6E] = { u8 sSeqFlags[] = {
SEQ_FLAG_FANFARE, // NA_BGM_GENERAL_SFX SEQ_FLAG_FANFARE, // NA_BGM_GENERAL_SFX
SEQ_FLAG_ENEMY, // NA_BGM_NATURE_BACKGROUND SEQ_FLAG_ENEMY, // NA_BGM_NATURE_BACKGROUND
0, // NA_BGM_FIELD_LOGIC 0, // NA_BGM_FIELD_LOGIC
@ -158,14 +180,14 @@ u8 sSeqFlags[0x6E] = {
0, // NA_BGM_FIELD_STILL_2 0, // NA_BGM_FIELD_STILL_2
0, // NA_BGM_FIELD_STILL_3 0, // NA_BGM_FIELD_STILL_3
0, // NA_BGM_FIELD_STILL_4 0, // NA_BGM_FIELD_STILL_4
SEQ_FLAG_5 | SEQ_FLAG_ENEMY, // NA_BGM_DUNGEON SEQ_FLAG_RESUME_PREV | SEQ_FLAG_ENEMY, // NA_BGM_DUNGEON
SEQ_FLAG_4, // NA_BGM_KAKARIKO_ADULT SEQ_FLAG_RESUME, // NA_BGM_KAKARIKO_ADULT
0, // NA_BGM_ENEMY 0, // NA_BGM_ENEMY
SEQ_FLAG_NO_AMBIENCE | SEQ_FLAG_RESTORE, // NA_BGM_BOSS SEQ_FLAG_NO_AMBIENCE | SEQ_FLAG_RESTORE, // NA_BGM_BOSS
SEQ_FLAG_ENEMY, // NA_BGM_INSIDE_DEKU_TREE SEQ_FLAG_ENEMY, // NA_BGM_INSIDE_DEKU_TREE
0, // NA_BGM_MARKET 0, // NA_BGM_MARKET
0, // NA_BGM_TITLE 0, // NA_BGM_TITLE
SEQ_FLAG_5, // NA_BGM_LINK_HOUSE SEQ_FLAG_RESUME_PREV, // NA_BGM_LINK_HOUSE
0, // NA_BGM_GAME_OVER 0, // NA_BGM_GAME_OVER
0, // NA_BGM_BOSS_CLEAR 0, // NA_BGM_BOSS_CLEAR
SEQ_FLAG_FANFARE, // NA_BGM_ITEM_GET SEQ_FLAG_FANFARE, // NA_BGM_ITEM_GET
@ -173,7 +195,7 @@ u8 sSeqFlags[0x6E] = {
SEQ_FLAG_FANFARE, // NA_BGM_HEART_GET SEQ_FLAG_FANFARE, // NA_BGM_HEART_GET
SEQ_FLAG_FANFARE, // NA_BGM_OCA_LIGHT SEQ_FLAG_FANFARE, // NA_BGM_OCA_LIGHT
SEQ_FLAG_ENEMY, // NA_BGM_JABU_JABU SEQ_FLAG_ENEMY, // NA_BGM_JABU_JABU
SEQ_FLAG_4, // NA_BGM_KAKARIKO_KID SEQ_FLAG_RESUME, // NA_BGM_KAKARIKO_KID
0, // NA_BGM_GREAT_FAIRY 0, // NA_BGM_GREAT_FAIRY
0, // NA_BGM_ZELDA_THEME 0, // NA_BGM_ZELDA_THEME
SEQ_FLAG_ENEMY, // NA_BGM_FIRE_TEMPLE SEQ_FLAG_ENEMY, // NA_BGM_FIRE_TEMPLE
@ -194,7 +216,7 @@ u8 sSeqFlags[0x6E] = {
SEQ_FLAG_FANFARE, // NA_BGM_SMALL_ITEM_GET SEQ_FLAG_FANFARE, // NA_BGM_SMALL_ITEM_GET
0, // NA_BGM_TEMPLE_OF_TIME 0, // NA_BGM_TEMPLE_OF_TIME
SEQ_FLAG_FANFARE, // NA_BGM_EVENT_CLEAR SEQ_FLAG_FANFARE, // NA_BGM_EVENT_CLEAR
SEQ_FLAG_4 | SEQ_FLAG_ENEMY, // NA_BGM_KOKIRI SEQ_FLAG_RESUME | SEQ_FLAG_ENEMY, // NA_BGM_KOKIRI
SEQ_FLAG_FANFARE, // NA_BGM_OCA_FAIRY_GET SEQ_FLAG_FANFARE, // NA_BGM_OCA_FAIRY_GET
SEQ_FLAG_ENEMY, // NA_BGM_SARIA_THEME SEQ_FLAG_ENEMY, // NA_BGM_SARIA_THEME
SEQ_FLAG_ENEMY, // NA_BGM_SPIRIT_TEMPLE SEQ_FLAG_ENEMY, // NA_BGM_SPIRIT_TEMPLE
@ -212,16 +234,16 @@ u8 sSeqFlags[0x6E] = {
0, // NA_BGM_DEKU_TREE_CS 0, // NA_BGM_DEKU_TREE_CS
0, // NA_BGM_WINDMILL 0, // NA_BGM_WINDMILL
0, // NA_BGM_HYRULE_CS 0, // NA_BGM_HYRULE_CS
SEQ_FLAG_5, // NA_BGM_MINI_GAME SEQ_FLAG_RESUME_PREV, // NA_BGM_MINI_GAME
0, // NA_BGM_SHEIK 0, // NA_BGM_SHEIK
SEQ_FLAG_4, // NA_BGM_ZORA_DOMAIN SEQ_FLAG_RESUME, // NA_BGM_ZORA_DOMAIN
SEQ_FLAG_FANFARE, // NA_BGM_APPEAR SEQ_FLAG_FANFARE, // NA_BGM_APPEAR
0, // NA_BGM_ADULT_LINK 0, // NA_BGM_ADULT_LINK
0, // NA_BGM_MASTER_SWORD 0, // NA_BGM_MASTER_SWORD
SEQ_FLAG_FANFARE_GANON, // NA_BGM_INTRO_GANON SEQ_FLAG_FANFARE_GANON, // NA_BGM_INTRO_GANON
SEQ_FLAG_5, // NA_BGM_SHOP SEQ_FLAG_RESUME_PREV, // NA_BGM_SHOP
SEQ_FLAG_6, // NA_BGM_CHAMBER_OF_SAGES SEQ_FLAG_SKIP_HARP_INTRO, // NA_BGM_CHAMBER_OF_SAGES
SEQ_FLAG_6, // NA_BGM_FILE_SELECT SEQ_FLAG_SKIP_HARP_INTRO, // NA_BGM_FILE_SELECT
SEQ_FLAG_ENEMY, // NA_BGM_ICE_CAVERN SEQ_FLAG_ENEMY, // NA_BGM_ICE_CAVERN
SEQ_FLAG_FANFARE, // NA_BGM_DOOR_OF_TIME SEQ_FLAG_FANFARE, // NA_BGM_DOOR_OF_TIME
SEQ_FLAG_FANFARE, // NA_BGM_OWL SEQ_FLAG_FANFARE, // NA_BGM_OWL
@ -229,7 +251,7 @@ u8 sSeqFlags[0x6E] = {
SEQ_FLAG_ENEMY, // NA_BGM_WATER_TEMPLE SEQ_FLAG_ENEMY, // NA_BGM_WATER_TEMPLE
SEQ_FLAG_FANFARE, // NA_BGM_BRIDGE_TO_GANONS SEQ_FLAG_FANFARE, // NA_BGM_BRIDGE_TO_GANONS
0, // NA_BGM_OCARINA_OF_TIME 0, // NA_BGM_OCARINA_OF_TIME
SEQ_FLAG_4 | SEQ_FLAG_ENEMY, // NA_BGM_GERUDO_VALLEY SEQ_FLAG_RESUME | SEQ_FLAG_ENEMY, // NA_BGM_GERUDO_VALLEY
0, // NA_BGM_POTION_SHOP 0, // NA_BGM_POTION_SHOP
0, // NA_BGM_KOTAKE_KOUME 0, // NA_BGM_KOTAKE_KOUME
SEQ_FLAG_NO_AMBIENCE, // NA_BGM_ESCAPE SEQ_FLAG_NO_AMBIENCE, // NA_BGM_ESCAPE
@ -1215,9 +1237,9 @@ u8 sRiverSoundMainBgmRestore;
u8 sGanonsTowerVol; u8 sGanonsTowerVol;
SfxPlayerState sSfxChannelState[0x10]; SfxPlayerState sSfxChannelState[0x10];
char sBinToStrBuf[0x20]; char sBinToStrBuf[0x20];
u8 D_8016B9D8; u8 sMalonSingingTimer;
u8 sAudioSpecPeakNumNotes[0x12]; u8 sAudioSpecPeakNumNotes[0x12];
u8 D_8016B9F2; u8 sMalonSingingDisabled;
u8 D_8016B9F3; u8 D_8016B9F3;
u8 D_8016B9F4; u8 D_8016B9F4;
u16 D_8016B9F6; u16 D_8016B9F6;
@ -1244,13 +1266,13 @@ u16 sMusicStaffCurHeldLength[OCARINA_SONG_MAX];
u16 sMusicStaffExpectedLength[OCARINA_SONG_MAX]; u16 sMusicStaffExpectedLength[OCARINA_SONG_MAX];
u8 sMusicStaffExpectedPitch[OCARINA_SONG_MAX]; u8 sMusicStaffExpectedPitch[OCARINA_SONG_MAX];
OcarinaNote sScarecrowsLongSongSecondNote; OcarinaNote sScarecrowsLongSongSecondNote;
u8 sAudioHasMalonBgm; u8 sIsMalonSinging;
f32 sAudioMalonBgmDist; f32 sMalonSingingDist;
void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 gameRequest); void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 gameRequest);
void Audio_StepFreqLerp(FreqLerp* lerp); void Audio_StepFreqLerp(FreqLerp* lerp);
void func_800F56A8(void); void Audio_UpdateSceneSequenceResumePoint(void);
void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId); void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId);
s32 Audio_SetGanonsTowerBgmVolume(u8 targetVol); s32 Audio_SetGanonsTowerBgmVolume(u8 targetVol);
@ -2200,7 +2222,7 @@ s32 AudioOcarina_MemoryGameNextNote(void) {
} }
void AudioOcarina_Update(void) { void AudioOcarina_Update(void) {
sOcarinaUpdateTaskStart = gAudioContext.totalTaskCount; sOcarinaUpdateTaskStart = gAudioCtx.totalTaskCount;
if (sOcarinaInstrumentId != OCARINA_INSTRUMENT_OFF) { if (sOcarinaInstrumentId != OCARINA_INSTRUMENT_OFF) {
if (sIsOcarinaInputEnabled == true) { if (sIsOcarinaInputEnabled == true) {
AudioOcarina_ReadControllerInput(); AudioOcarina_ReadControllerInput();
@ -2404,7 +2426,7 @@ void AudioDebug_Draw(GfxPrint* printer) {
GfxPrint_Printf(printer, "- %s -", sAudioDebugPageNames[sAudioDebugPage]); GfxPrint_Printf(printer, "- %s -", sAudioDebugPageNames[sAudioDebugPage]);
for (i = 0; i < gAudioSpecs[gAudioSpecId].numNotes; i++) { for (i = 0; i < gAudioSpecs[gAudioSpecId].numNotes; i++) {
if (gAudioContext.notes[i].noteSubEu.bitField0.enabled == 1) { if (gAudioCtx.notes[i].noteSubEu.bitField0.enabled == 1) {
numEnabledNotes++; numEnabledNotes++;
} }
} }
@ -2529,7 +2551,7 @@ void AudioDebug_Draw(GfxPrint* printer) {
for (k2 = 0; k2 < gChannelsPerBank[gSfxChannelLayout][k]; k2++) { for (k2 = 0; k2 < gChannelsPerBank[gSfxChannelLayout][k]; k2++) {
#define entryIndex (gActiveSfx[k][k2].entryIndex) #define entryIndex (gActiveSfx[k][k2].entryIndex)
#define entry (&gSfxBanks[k][entryIndex]) #define entry (&gSfxBanks[k][entryIndex])
#define chan (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[entry->channelIdx]) #define chan (gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[entry->channelIdx])
GfxPrint_SetPos(printer, 2 + sAudioIntInfoX, 5 + ind + sAudioIntInfoY); GfxPrint_SetPos(printer, 2 + sAudioIntInfoX, 5 + ind + sAudioIntInfoY);
if (sAudioIntInfoBankPage[k] == 1) { if (sAudioIntInfoBankPage[k] == 1) {
if ((entryIndex != 0xFF) && if ((entryIndex != 0xFF) &&
@ -2692,14 +2714,14 @@ void AudioDebug_Draw(GfxPrint* printer) {
GfxPrint_Printf(printer, "%1X", i); GfxPrint_Printf(printer, "%1X", i);
GfxPrint_SetPos(printer, 15 + i, 7); GfxPrint_SetPos(printer, 15 + i, 7);
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->enabled) { if (gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->enabled) {
GfxPrint_Printf(printer, "O"); GfxPrint_Printf(printer, "O");
} else { } else {
GfxPrint_Printf(printer, "X"); GfxPrint_Printf(printer, "X");
} }
GfxPrint_SetPos(printer, 15 + i, 8); GfxPrint_SetPos(printer, 15 + i, 8);
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->stopSomething2) { if (gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->stopSomething2) {
GfxPrint_Printf(printer, "O"); GfxPrint_Printf(printer, "O");
} else { } else {
GfxPrint_Printf(printer, "X"); GfxPrint_Printf(printer, "X");
@ -2708,7 +2730,7 @@ void AudioDebug_Draw(GfxPrint* printer) {
GfxPrint_SetPos(printer, 15 + i, 9); GfxPrint_SetPos(printer, 15 + i, 9);
ctr = 0; ctr = 0;
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->layers[j] != NULL) { if (gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->layers[j] != NULL) {
ctr++; ctr++;
} }
} }
@ -2763,33 +2785,32 @@ void AudioDebug_Draw(GfxPrint* printer) {
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
GfxPrint_SetPos(printer, 15 + 3 * i, 22); GfxPrint_SetPos(printer, 15 + 3 * i, 22);
GfxPrint_Printf(printer, "%02X ", GfxPrint_Printf(printer, "%02X ",
(u8)gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] (u8)gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
.channels[sAudioSubTrackInfoChannelSel] .channels[sAudioSubTrackInfoChannelSel]
->soundScriptIO[i]); ->soundScriptIO[i]);
} }
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->enabled) { if (gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->enabled) {
GfxPrint_SetPos(printer, 15, 11); GfxPrint_SetPos(printer, 15, 11);
GfxPrint_Printf(printer, "%d", GfxPrint_Printf(printer, "%d",
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] (u8)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
.channels[sAudioSubTrackInfoChannelSel] .channels[sAudioSubTrackInfoChannelSel]
->volume * ->volume *
127.1)); 127.1));
GfxPrint_SetPos(printer, 15, 12); GfxPrint_SetPos(printer, 15, 12);
GfxPrint_Printf(printer, "%d", GfxPrint_Printf(printer, "%d",
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] (u8)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
.channels[sAudioSubTrackInfoChannelSel] .channels[sAudioSubTrackInfoChannelSel]
->volumeScale * ->volumeScale *
127.1)); 127.1));
GfxPrint_SetPos(printer, 15, 13); GfxPrint_SetPos(printer, 15, 13);
GfxPrint_Printf(printer, "%X", GfxPrint_Printf(
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] printer, "%X",
.channels[sAudioSubTrackInfoChannelSel] gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->fontId);
->fontId);
ctr = (u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] ctr = (u8)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
.channels[sAudioSubTrackInfoChannelSel] .channels[sAudioSubTrackInfoChannelSel]
->instOrWave); ->instOrWave);
@ -2805,46 +2826,44 @@ void AudioDebug_Draw(GfxPrint* printer) {
GfxPrint_Printf(printer, "%d", ctr2); GfxPrint_Printf(printer, "%d", ctr2);
GfxPrint_SetPos(printer, 15, 15); GfxPrint_SetPos(printer, 15, 15);
GfxPrint_Printf(printer, "%d", GfxPrint_Printf(
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] printer, "%d",
.channels[sAudioSubTrackInfoChannelSel] gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->newPan);
->newPan);
GfxPrint_SetPos(printer, 15, 16); GfxPrint_SetPos(printer, 15, 16);
GfxPrint_Printf(printer, "%d", GfxPrint_Printf(printer, "%d",
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
.channels[sAudioSubTrackInfoChannelSel] .channels[sAudioSubTrackInfoChannelSel]
->panChannelWeight); ->panChannelWeight);
GfxPrint_SetPos(printer, 15, 17); GfxPrint_SetPos(printer, 15, 17);
GfxPrint_Printf(printer, "%d", GfxPrint_Printf(
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] printer, "%d",
.channels[sAudioSubTrackInfoChannelSel] gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->reverb);
->reverb);
GfxPrint_SetPos(printer, 15, 18); GfxPrint_SetPos(printer, 15, 18);
GfxPrint_Printf(printer, "%d", GfxPrint_Printf(printer, "%d",
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
.channels[sAudioSubTrackInfoChannelSel] .channels[sAudioSubTrackInfoChannelSel]
->notePriority); ->notePriority);
GfxPrint_SetPos(printer, 15, 19); GfxPrint_SetPos(printer, 15, 19);
GfxPrint_Printf(printer, "%d", GfxPrint_Printf(printer, "%d",
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] (u8)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
.channels[sAudioSubTrackInfoChannelSel] .channels[sAudioSubTrackInfoChannelSel]
->vibratoRateTarget / ->vibratoRateTarget /
32)); 32));
GfxPrint_SetPos(printer, 15, 20); GfxPrint_SetPos(printer, 15, 20);
GfxPrint_Printf(printer, "%d", GfxPrint_Printf(printer, "%d",
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] (u8)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
.channels[sAudioSubTrackInfoChannelSel] .channels[sAudioSubTrackInfoChannelSel]
->vibratoExtentTarget / ->vibratoExtentTarget /
8)); 8));
GfxPrint_SetPos(printer, 15, 21); GfxPrint_SetPos(printer, 15, 21);
GfxPrint_Printf(printer, "%d", GfxPrint_Printf(printer, "%d",
(u16)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel] (u16)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
.channels[sAudioSubTrackInfoChannelSel] .channels[sAudioSubTrackInfoChannelSel]
->freqScale * ->freqScale *
100)); 100));
@ -2858,47 +2877,46 @@ void AudioDebug_Draw(GfxPrint* printer) {
GfxPrint_SetPos(printer, 3, 5); GfxPrint_SetPos(printer, 3, 5);
GfxPrint_Printf(printer, "DRIVER %05X / %05X", GfxPrint_Printf(printer, "DRIVER %05X / %05X",
gAudioContext.miscPool.curRamAddr - gAudioContext.miscPool.startRamAddr, gAudioCtx.miscPool.curRamAddr - gAudioCtx.miscPool.startRamAddr, gAudioCtx.miscPool.size);
gAudioContext.miscPool.size);
GfxPrint_SetPos(printer, 3, 6); GfxPrint_SetPos(printer, 3, 6);
GfxPrint_Printf( GfxPrint_Printf(
printer, "AT-SEQ %02X-%02X (%05X-%05X / %05X)", (u8)gAudioContext.seqCache.temporary.entries[0].id, printer, "AT-SEQ %02X-%02X (%05X-%05X / %05X)", (u8)gAudioCtx.seqCache.temporary.entries[0].id,
(u8)gAudioContext.seqCache.temporary.entries[1].id, gAudioContext.seqCache.temporary.entries[0].size, (u8)gAudioCtx.seqCache.temporary.entries[1].id, gAudioCtx.seqCache.temporary.entries[0].size,
gAudioContext.seqCache.temporary.entries[1].size, gAudioContext.seqCache.temporary.pool.size); gAudioCtx.seqCache.temporary.entries[1].size, gAudioCtx.seqCache.temporary.pool.size);
GfxPrint_SetPos(printer, 3, 7); GfxPrint_SetPos(printer, 3, 7);
GfxPrint_Printf( GfxPrint_Printf(
printer, "AT-BNK %02X-%02X (%05X-%05X / %05X)", (u8)gAudioContext.fontCache.temporary.entries[0].id, printer, "AT-BNK %02X-%02X (%05X-%05X / %05X)", (u8)gAudioCtx.fontCache.temporary.entries[0].id,
(u8)gAudioContext.fontCache.temporary.entries[1].id, gAudioContext.fontCache.temporary.entries[0].size, (u8)gAudioCtx.fontCache.temporary.entries[1].id, gAudioCtx.fontCache.temporary.entries[0].size,
gAudioContext.fontCache.temporary.entries[1].size, gAudioContext.fontCache.temporary.pool.size); gAudioCtx.fontCache.temporary.entries[1].size, gAudioCtx.fontCache.temporary.pool.size);
GfxPrint_SetPos(printer, 3, 8); GfxPrint_SetPos(printer, 3, 8);
GfxPrint_Printf(printer, "ST-SEQ %02Xseqs (%05X / %06X)", gAudioContext.seqCache.persistent.numEntries, GfxPrint_Printf(printer, "ST-SEQ %02Xseqs (%05X / %06X)", gAudioCtx.seqCache.persistent.numEntries,
gAudioContext.seqCache.persistent.pool.curRamAddr - gAudioCtx.seqCache.persistent.pool.curRamAddr -
gAudioContext.seqCache.persistent.pool.startRamAddr, gAudioCtx.seqCache.persistent.pool.startRamAddr,
gAudioContext.seqCache.persistent.pool.size); gAudioCtx.seqCache.persistent.pool.size);
for (k = 0; (u32)k < gAudioContext.seqCache.persistent.numEntries; k++) { for (k = 0; (u32)k < gAudioCtx.seqCache.persistent.numEntries; k++) {
GfxPrint_SetPos(printer, 3 + 3 * k, 9); GfxPrint_SetPos(printer, 3 + 3 * k, 9);
GfxPrint_Printf(printer, "%02x", gAudioContext.seqCache.persistent.entries[k].id); GfxPrint_Printf(printer, "%02x", gAudioCtx.seqCache.persistent.entries[k].id);
} }
GfxPrint_SetPos(printer, 3, 10); GfxPrint_SetPos(printer, 3, 10);
GfxPrint_Printf(printer, "ST-BNK %02Xbanks (%05X / %06X)", gAudioContext.fontCache.persistent.numEntries, GfxPrint_Printf(printer, "ST-BNK %02Xbanks (%05X / %06X)", gAudioCtx.fontCache.persistent.numEntries,
gAudioContext.fontCache.persistent.pool.curRamAddr - gAudioCtx.fontCache.persistent.pool.curRamAddr -
gAudioContext.fontCache.persistent.pool.startRamAddr, gAudioCtx.fontCache.persistent.pool.startRamAddr,
gAudioContext.fontCache.persistent.pool.size); gAudioCtx.fontCache.persistent.pool.size);
for (k = 0; (u32)k < gAudioContext.fontCache.persistent.numEntries; k++) { for (k = 0; (u32)k < gAudioCtx.fontCache.persistent.numEntries; k++) {
GfxPrint_SetPos(printer, 3 + 3 * k, 11); GfxPrint_SetPos(printer, 3 + 3 * k, 11);
GfxPrint_Printf(printer, "%02x", gAudioContext.fontCache.persistent.entries[k].id); GfxPrint_Printf(printer, "%02x", gAudioCtx.fontCache.persistent.entries[k].id);
} }
GfxPrint_SetPos(printer, 3, 12); GfxPrint_SetPos(printer, 3, 12);
GfxPrint_Printf(printer, "E-MEM %05X / %05X", GfxPrint_Printf(printer, "E-MEM %05X / %05X",
gAudioContext.permanentPool.curRamAddr - gAudioContext.permanentPool.startRamAddr, gAudioCtx.permanentPool.curRamAddr - gAudioCtx.permanentPool.startRamAddr,
gAudioContext.permanentPool.size); gAudioCtx.permanentPool.size);
break; break;
case PAGE_BLOCK_CHANGE_BGM: case PAGE_BLOCK_CHANGE_BGM:
@ -2917,34 +2935,34 @@ void AudioDebug_Draw(GfxPrint* printer) {
SETCOL(255, 255, 255); SETCOL(255, 255, 255);
GfxPrint_SetPos(printer, 3, 7); GfxPrint_SetPos(printer, 3, 7);
GfxPrint_Printf(printer, "NEXT SCENE %02X %s", GfxPrint_Printf(printer, "NEXT SCENE %02X %s",
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2], (u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2],
sAudioSceneNames[(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2]]); sAudioSceneNames[(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2]]);
GfxPrint_SetPos(printer, 3, 8); GfxPrint_SetPos(printer, 3, 8);
GfxPrint_Printf(printer, "NOW SCENE %02X %s", GfxPrint_Printf(printer, "NOW SCENE %02X %s",
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4], (u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4],
sAudioSceneNames[(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4]]); sAudioSceneNames[(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4]]);
GfxPrint_SetPos(printer, 3, 9); GfxPrint_SetPos(printer, 3, 9);
GfxPrint_Printf(printer, "NOW BLOCK %02X", GfxPrint_Printf(printer, "NOW BLOCK %02X",
(gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[5] + 1) & 0xFF); (gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[5] + 1) & 0xFF);
GfxPrint_SetPos(printer, 3, 11); GfxPrint_SetPos(printer, 3, 11);
GfxPrint_Printf(printer, "PORT"); GfxPrint_Printf(printer, "PORT");
GfxPrint_SetPos(printer, 3, 12); GfxPrint_SetPos(printer, 3, 12);
GfxPrint_Printf(printer, "%02X %02X %02X %02X", GfxPrint_Printf(printer, "%02X %02X %02X %02X",
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[0], (u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[0],
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[1], (u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[1],
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2], (u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2],
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3]); (u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3]);
GfxPrint_SetPos(printer, 3, 13); GfxPrint_SetPos(printer, 3, 13);
GfxPrint_Printf(printer, "%02X %02X %02X %02X", GfxPrint_Printf(printer, "%02X %02X %02X %02X",
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4], (u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4],
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[5], (u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[5],
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[6], (u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[6],
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[7]); (u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[7]);
break; break;
case PAGE_OCARINA_TEST: case PAGE_OCARINA_TEST:
@ -3040,9 +3058,9 @@ void AudioDebug_Draw(GfxPrint* printer) {
GfxPrint_Printf(printer, "DEMO FLAG %d", sAudioCutsceneFlag); GfxPrint_Printf(printer, "DEMO FLAG %d", sAudioCutsceneFlag);
GfxPrint_SetPos(printer, 3, 12); GfxPrint_SetPos(printer, 3, 12);
if (sAudioHasMalonBgm == true) { if (sIsMalonSinging == true) {
GfxPrint_Printf(printer, "MARON BGM DIST %f", sAudioMalonBgmDist); GfxPrint_Printf(printer, "MARON BGM DIST %f", sMalonSingingDist);
sAudioHasMalonBgm = false; sIsMalonSinging = false;
} }
GfxPrint_SetPos(printer, 3, 23); GfxPrint_SetPos(printer, 3, 23);
@ -3682,13 +3700,13 @@ void func_800F5CF8(void);
*/ */
void func_800F3054(void) { void func_800F3054(void) {
if (func_800FAD34() == 0) { if (func_800FAD34() == 0) {
sAudioUpdateTaskStart = gAudioContext.totalTaskCount; sAudioUpdateTaskStart = gAudioCtx.totalTaskCount;
sAudioUpdateStartTime = osGetTime(); sAudioUpdateStartTime = osGetTime();
AudioOcarina_Update(); AudioOcarina_Update();
Audio_StepFreqLerp(&sRiverFreqScaleLerp); Audio_StepFreqLerp(&sRiverFreqScaleLerp);
Audio_StepFreqLerp(&sWaterfallFreqScaleLerp); Audio_StepFreqLerp(&sWaterfallFreqScaleLerp);
Audio_UpdateRiverSoundVolumes(); Audio_UpdateRiverSoundVolumes();
func_800F56A8(); Audio_UpdateSceneSequenceResumePoint();
func_800F5CF8(); func_800F5CF8();
if (gAudioSpecId == 7) { if (gAudioSpecId == 7) {
Audio_ClearSariaBgm(); Audio_ClearSariaBgm();
@ -3700,7 +3718,7 @@ void func_800F3054(void) {
AudioDebug_SetInput(); AudioDebug_SetInput();
AudioDebug_ProcessInput(); AudioDebug_ProcessInput();
Audio_ScheduleProcessCmds(); Audio_ScheduleProcessCmds();
sAudioUpdateTaskEnd = gAudioContext.totalTaskCount; sAudioUpdateTaskEnd = gAudioCtx.totalTaskCount;
sAudioUpdateEndTime = osGetTime(); sAudioUpdateEndTime = osGetTime();
} }
} }
@ -3774,9 +3792,9 @@ s8 Audio_ComputeSfxReverb(u8 bankId, u8 entryIdx, u8 channelIdx) {
} }
} }
if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx])) { if (IS_SEQUENCE_CHANNEL_VALID(gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx])) {
scriptAdd = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1]; scriptAdd = gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1];
if (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1] < 0) { if (gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1] <= SEQ_IO_VAL_NONE) {
scriptAdd = 0; scriptAdd = 0;
} }
} }
@ -3843,7 +3861,7 @@ f32 Audio_ComputeSfxFreqScale(u8 bankId, u8 entryIdx) {
f32 freq = 1.0f; f32 freq = 1.0f;
if (entry->sfxParams & SFX_FLAG_14) { if (entry->sfxParams & SFX_FLAG_14) {
freq = 1.0f - ((gAudioContext.audioRandom & 0xF) / 192.0f); freq = 1.0f - ((gAudioCtx.audioRandom & 0xF) / 192.0f);
} }
switch (bankId) { switch (bankId) {
@ -3867,7 +3885,7 @@ f32 Audio_ComputeSfxFreqScale(u8 bankId, u8 entryIdx) {
if (phi_v0 == 1) { if (phi_v0 == 1) {
if (!(entry->sfxParams & SFX_FLAG_11)) { if (!(entry->sfxParams & SFX_FLAG_11)) {
freq *= (1.0293 - ((gAudioContext.audioRandom & 0xF) / 144.0f)); freq *= (1.0293 - ((gAudioCtx.audioRandom & 0xF) / 144.0f));
} }
} }
@ -4109,7 +4127,7 @@ void func_800F4010(Vec3f* pos, u16 sfxId, f32 arg2) {
sp24 = 1.0f; sp24 = 1.0f;
} else { } else {
phi_f0 = 1.1f; phi_f0 = 1.1f;
phi_v0 = gAudioContext.audioRandom % 2; phi_v0 = gAudioCtx.audioRandom % 2;
} }
if ((phi_f0 < arg2) && (phi_v0 != 0)) { if ((phi_f0 < arg2) && (phi_v0 != 0)) {
@ -4311,15 +4329,14 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVol) {
// Sets the reverb // Sets the reverb
for (channelIdx = 0; channelIdx < 16; channelIdx++) { for (channelIdx = 0; channelIdx < 16; channelIdx++) {
if (gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx] != if (gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx] != &gAudioCtx.sequenceChannelNone) {
&gAudioContext.sequenceChannelNone) {
// soundScriptIO[5] is set to 0x40 in channels 0, 1, and 4 // soundScriptIO[5] is set to 0x40 in channels 0, 1, and 4
if ((u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx]->soundScriptIO[5] != 0xFF) { if ((u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx]->soundScriptIO[5] !=
(u8)SEQ_IO_VAL_NONE) {
// Higher volume leads to lower reverb // Higher volume leads to lower reverb
reverb = reverb = ((u16)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx]->soundScriptIO[5] -
((u16)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx]->soundScriptIO[5] - targetVol) +
targetVol) + 0x7F;
0x7F;
if (reverb > 0x7F) { if (reverb > 0x7F) {
reverb = 0x7F; reverb = 0x7F;
} }
@ -4495,7 +4512,7 @@ void Audio_SplitBgmChannels(s8 volSplit) {
channelBits = 0; channelBits = 0;
for (channelIdx = 0; channelIdx < 16; channelIdx++) { for (channelIdx = 0; channelIdx < 16; channelIdx++) {
if (notePriority > gAudioContext.seqPlayers[bgmPlayers[i]].channels[channelIdx]->notePriority) { if (notePriority > gAudioCtx.seqPlayers[bgmPlayers[i]].channels[channelIdx]->notePriority) {
// If the note currently playing in the channel is a high enough priority, // If the note currently playing in the channel is a high enough priority,
// then keep the channel on by setting a channelBit // then keep the channel on by setting a channelBit
// If this condition fails, then the channel will be shut off // If this condition fails, then the channel will be shut off
@ -4522,7 +4539,7 @@ void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax) {
dist = sqrtf(SQ(pos->z) + SQ(pos->x)); dist = sqrtf(SQ(pos->z) + SQ(pos->x));
if (sSariaBgmPtr == NULL) { if (sSariaBgmPtr == NULL) {
sSariaBgmPtr = pos; sSariaBgmPtr = pos;
func_800F5E18(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2); Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2);
} else { } else {
prevDist = sqrtf(SQ(sSariaBgmPtr->z) + SQ(sSariaBgmPtr->x)); prevDist = sqrtf(SQ(sSariaBgmPtr->z) + SQ(sSariaBgmPtr->x));
if (dist < prevDist) { if (dist < prevDist) {
@ -4558,52 +4575,60 @@ void Audio_ClearSariaBgm2(void) {
sSariaBgmPtr = NULL; sSariaBgmPtr = NULL;
} }
void func_800F5510(u16 seqId) { void Audio_PlayMorningSceneSequence(u16 seqId) {
func_800F5550(seqId); Audio_PlaySceneSequence(seqId);
func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, 0, 0, 1); // Writing a value of 1 to ioPort 0 will be used by
// `NA_BGM_FIELD_LOGIC` to play `NA_BGM_FIELD_MORNING` first
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 0, 1);
} }
void func_800F5550(u16 seqId) { void Audio_PlaySceneSequence(u16 seqId) {
u8 sp27 = 0; u8 fadeInDuration = 0;
u16 nv; u8 skipHarpIntro;
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_WINDMILL) { if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_WINDMILL) {
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == NA_BGM_LONLON) { if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == NA_BGM_LONLON) {
Audio_StopSequence(SEQ_PLAYER_BGM_SUB, 0); Audio_StopSequence(SEQ_PLAYER_BGM_SUB, 0);
// Terminate all internal audio cmds
Audio_QueueCmdS32(0xF8000000, 0); Audio_QueueCmdS32(0xF8000000, 0);
} }
if ((sSeqFlags[D_80130630] & SEQ_FLAG_5) && sSeqFlags[(seqId & 0xFF) & 0xFF] & SEQ_FLAG_4) { if ((sSeqFlags[sPrevSceneSeqId] & SEQ_FLAG_RESUME_PREV) && sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_RESUME) {
// Resume the sequence from the point where it left off last time it was played in the scene
if ((D_8013062C & 0x3F) != 0) { if ((sSeqResumePoint & 0x3F) != 0) {
sp27 = 0x1E; fadeInDuration = 30;
} }
func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, sp27, 7, D_8013062C); // Write the sequence resumePoint to start from into ioPort 7
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, fadeInDuration, 7, sSeqResumePoint);
D_8013062C = 0; sSeqResumePoint = 0;
} else { } else {
nv = (sSeqFlags[(seqId & 0xFF) & 0xFF] & SEQ_FLAG_6) ? 1 : 0xFF; // Start the sequence from the beginning
func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, nv);
if (!(sSeqFlags[seqId] & SEQ_FLAG_5)) { // Writes to ioPort 7. See `SEQ_FLAG_SKIP_HARP_INTRO` for writing a value of 1 to ioPort 7.
D_8013062C = 0xC0; skipHarpIntro = (sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_SKIP_HARP_INTRO) ? 1 : (u8)SEQ_IO_VAL_NONE;
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, skipHarpIntro);
if (!(sSeqFlags[seqId] & SEQ_FLAG_RESUME_PREV)) {
// Reset the sequence resumePoint
sSeqResumePoint = SEQ_RESUME_POINT_NONE;
} }
} }
D_80130630 = seqId & 0xFF; sPrevSceneSeqId = seqId & 0xFF;
} }
} }
void func_800F56A8(void) { void Audio_UpdateSceneSequenceResumePoint(void) {
u16 temp_v0; u16 seqId = Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
u8 bvar;
temp_v0 = Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN); if ((seqId != NA_BGM_DISABLED) && (sSeqFlags[(u8)seqId & 0xFF] & SEQ_FLAG_RESUME)) {
bvar = temp_v0 & 0xFF; if (sSeqResumePoint != SEQ_RESUME_POINT_NONE) {
if ((temp_v0 != NA_BGM_DISABLED) && (sSeqFlags[bvar] & SEQ_FLAG_4)) { // Get the current point to resume from
if (D_8013062C != 0xC0) { sSeqResumePoint = gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3];
D_8013062C = gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3];
} else { } else {
D_8013062C = 0; // Initialize the point to resume from to the start of the sequence.
sSeqResumePoint = 0;
} }
} }
} }
@ -4640,7 +4665,7 @@ void func_800F595C(u16 arg0) {
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, 0, arg0); SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, 0, arg0);
} else { } else {
func_800F5E18(SEQ_PLAYER_BGM_MAIN, arg0, 0, 7, -1); Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_MAIN, arg0, 0, 7, SEQ_IO_VAL_NONE);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0);
} }
} }
@ -4786,9 +4811,9 @@ void func_800F5CF8(void) {
} }
} }
void func_800F5E18(u8 seqPlayerIndex, u16 seqId, u8 fadeTimer, s8 ioPort, s8 ioData) { void Audio_PlaySequenceWithSeqPlayerIO(u8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, s8 ioData) {
SEQCMD_SET_PLAYER_IO(seqPlayerIndex, ioPort, ioData); SEQCMD_SET_PLAYER_IO(seqPlayerIndex, ioPort, ioData);
SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, fadeTimer, 0, seqId); SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, fadeInDuration, 0, seqId);
} }
void Audio_SetSequenceMode(u8 seqMode) { void Audio_SetSequenceMode(u8 seqMode) {
@ -4894,56 +4919,69 @@ void Audio_SetBgmEnemyVolume(f32 dist) {
sAudioEnemyDist = dist; sAudioEnemyDist = dist;
} }
void func_800F6268(f32 dist, u16 arg1) { void Audio_UpdateMalonSinging(f32 dist, u16 seqId) {
s8 pad; s8 pad;
s8 phi_v1; s8 melodyVolume;
s16 temp_a0; s16 curSeqId;
sAudioHasMalonBgm = true; sIsMalonSinging = true;
sAudioMalonBgmDist = dist; sMalonSingingDist = dist;
if (D_8016B9F2 == 0) {
temp_a0 = (s8)(Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) & 0xFF);
if (temp_a0 == (arg1 & 0xFF)) {
if ((arg1 & 0xFF) == NA_BGM_LONLON) {
if (dist > 2000.0f) { if (sMalonSingingDisabled) {
phi_v1 = 127; return;
} else if (dist < 200.0f) { }
phi_v1 = 0;
} else { curSeqId = (s8)(Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) & 0xFF);
phi_v1 = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f);
} if (curSeqId == (seqId & 0xFF)) {
// Transition volume of channels 0, 1 and 13 on seq player 0 over 3 frames if ((seqId & 0xFF) == NA_BGM_LONLON) {
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, 0, 3, 127 - phi_v1); // Malon is singing along with the Lon Lon Sequence
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, 1, 3, 127 - phi_v1);
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, 13, 3, phi_v1);
if (D_8016B9D8 == 0) {
D_8016B9D8++;
}
}
} else if ((temp_a0 == NA_BGM_NATURE_AMBIENCE) && ((arg1 & 0xFF) == NA_BGM_LONLON)) {
temp_a0 = (s8)(Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) & 0xFF);
if ((temp_a0 != (arg1 & 0xFF)) && (D_8016B9D8 < 10)) {
func_800F5E18(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0);
SEQCMD_SET_CHANNEL_DISABLE_MASK(SEQ_PLAYER_BGM_SUB, 0xFFFC);
D_8016B9D8 = 10;
}
if (dist > 2000.0f) { if (dist > 2000.0f) {
phi_v1 = 127; melodyVolume = 127;
} else if (dist < 200.0f) { } else if (dist < 200.0f) {
phi_v1 = 0; melodyVolume = 0;
} else { } else {
phi_v1 = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f); melodyVolume = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f);
} }
// Transition volume of channels 0 and 1 on seq player 0 over 3 frames
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_SUB, 0, 3, 127 - phi_v1); // Update volume for channels 0 & 1, which contain Malon's singing
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_SUB, 1, 3, 127 - phi_v1); SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, 0, 3, 127 - melodyVolume);
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, 1, 3, 127 - melodyVolume);
// Update volume for channel 13, which contains the melody line for Lon Lon's Sequence
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, 13, 3, melodyVolume);
if (sMalonSingingTimer == 0) {
sMalonSingingTimer++;
}
}
} else if ((curSeqId == NA_BGM_NATURE_AMBIENCE) && ((seqId & 0xFF) == NA_BGM_LONLON)) {
// Malon is singing along with ambience
curSeqId = (s8)(Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) & 0xFF);
if ((curSeqId != (seqId & 0xFF)) && (sMalonSingingTimer < 10)) {
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0);
// Disable all channels between 2-15.
// Only allow the two channels with Malon's singing to play, and suppress the full lon lon sequence.
SEQCMD_SET_CHANNEL_DISABLE_MASK(SEQ_PLAYER_BGM_SUB, 0xFFFC);
sMalonSingingTimer = 10;
} }
if (D_8016B9D8 < 10) { if (dist > 2000.0f) {
D_8016B9D8++; melodyVolume = 127;
} else if (dist < 200.0f) {
melodyVolume = 0;
} else {
melodyVolume = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f);
} }
// Update volume for channels 0 & 1, which contain Malon's singing
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_SUB, 0, 3, 127 - melodyVolume);
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_SUB, 1, 3, 127 - melodyVolume);
}
if (sMalonSingingTimer < 10) {
sMalonSingingTimer++;
} }
} }
@ -4960,35 +4998,55 @@ void func_800F64E0(u8 arg0) {
} }
} }
void func_800F6584(u8 arg0) { /**
* Enable or disable Malon's singing
*
* @param malonSingingDisabled true to disable, false to enable
*/
void Audio_ToggleMalonSinging(u8 malonSingingDisabled) {
u8 seqPlayerIndex; u8 seqPlayerIndex;
u16 sp34; u16 channelMaskDisable;
sMalonSingingDisabled = malonSingingDisabled;
D_8016B9F2 = arg0;
if ((Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) & 0xFF) == NA_BGM_LONLON) { if ((Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) & 0xFF) == NA_BGM_LONLON) {
// Malon is singing along with the Lon Lon Sequence
seqPlayerIndex = SEQ_PLAYER_BGM_MAIN; seqPlayerIndex = SEQ_PLAYER_BGM_MAIN;
sp34 = 0; // Do not disable any channel.
} else if ((Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) & 0xFF) == NA_BGM_LONLON) { // Allow the full lon lon sequence to play in addition to Malon's singing.
channelMaskDisable = 0;
} else if ((u8)Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == NA_BGM_LONLON) {
// Malon is singing along with ambience
seqPlayerIndex = SEQ_PLAYER_BGM_SUB; seqPlayerIndex = SEQ_PLAYER_BGM_SUB;
sp34 = 0xFFFC; // Disable all channels between 2-15.
// Only allow the two channels with Malon's singing to play, and suppress the full lon lon sequence.
channelMaskDisable = 0xFFFC;
} else { } else {
return; return;
} }
if (arg0 != 0) { if (malonSingingDisabled) {
// Turn volume off for channels 0 & 1, which contain Malon's singing
SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 0, 1, 0); SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 0, 1, 0);
SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 1, 1, 0); SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 1, 1, 0);
if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) { if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) {
SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, sp34 | 3); // When singing along with ambience, disable all 16 channels
SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, channelMaskDisable | 3);
} }
} else { } else {
if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) { if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) {
func_800F5E18(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0); // When singing along with ambience, start the sequence
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0);
} }
// Turn volume on for only channels 0 & 1, which contain Malon's singing
SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 0, 1, 0x7F); SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 0, 1, 0x7F);
SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 1, 1, 0x7F); SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, 1, 1, 0x7F);
if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) { if (seqPlayerIndex == SEQ_PLAYER_BGM_SUB) {
SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, sp34); // When singing along with ambience, disable channels 2-15
SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, channelMaskDisable);
} }
} }
} }
@ -5159,7 +5217,7 @@ void func_800F6C34(void) {
sRiverSoundMainBgmLower = false; sRiverSoundMainBgmLower = false;
sRiverSoundMainBgmRestore = false; sRiverSoundMainBgmRestore = false;
sGanonsTowerVol = 0xFF; sGanonsTowerVol = 0xFF;
D_8016B9D8 = 0; sMalonSingingTimer = 0;
sSpecReverb = sSpecReverbs[gAudioSpecId]; sSpecReverb = sSpecReverbs[gAudioSpecId];
D_80130608 = 0; D_80130608 = 0;
sPrevMainBgmSeqId = NA_BGM_DISABLED; sPrevMainBgmSeqId = NA_BGM_DISABLED;
@ -5167,7 +5225,7 @@ void func_800F6C34(void) {
sSariaBgmPtr = NULL; sSariaBgmPtr = NULL;
D_8016B9F4 = 0; D_8016B9F4 = 0;
D_8016B9F3 = 1; D_8016B9F3 = 1;
D_8016B9F2 = 0; sMalonSingingDisabled = false;
} }
void Audio_SetNatureAmbienceChannelIO(u8 channelIdxRange, u8 ioPort, u8 ioData) { void Audio_SetNatureAmbienceChannelIO(u8 channelIdxRange, u8 ioPort, u8 ioData) {
@ -5184,7 +5242,7 @@ void Audio_SetNatureAmbienceChannelIO(u8 channelIdxRange, u8 ioPort, u8 ioData)
// channelIdxRange = 01 on ioPort 1 // channelIdxRange = 01 on ioPort 1
if (((channelIdxRange << 8) + ioPort) == ((NATURE_CHANNEL_CRITTER_0 << 8) + CHANNEL_IO_PORT_1)) { if (((channelIdxRange << 8) + ioPort) == ((NATURE_CHANNEL_CRITTER_0 << 8) + CHANNEL_IO_PORT_1)) {
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) != NA_BGM_LONLON) { if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) != NA_BGM_LONLON) {
D_8016B9D8 = 0; sMalonSingingTimer = 0;
} }
} }

View file

@ -441,7 +441,7 @@ void Audio_PlayActiveSfx(u8 bankId) {
entryIndex = gActiveSfx[bankId][i].entryIndex; entryIndex = gActiveSfx[bankId][i].entryIndex;
if (entryIndex != 0xFF) { if (entryIndex != 0xFF) {
entry = &gSfxBanks[bankId][entryIndex]; 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) { if (entry->state == SFX_STATE_READY) {
entry->channelIdx = sCurSfxPlayerChannelIdx; entry->channelIdx = sCurSfxPlayerChannelIdx;
if (entry->sfxParams & SFX_FLAG_3) { if (entry->sfxParams & SFX_FLAG_3) {
@ -476,7 +476,7 @@ void Audio_PlayActiveSfx(u8 bankId) {
} else { } else {
entry->state = SFX_STATE_PLAYING_2; 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); Audio_RemoveSfxBankEntry(bankId, entryIndex);
} else if (entry->state == SFX_STATE_PLAYING_REFRESH) { } else if (entry->state == SFX_STATE_PLAYING_REFRESH) {
Audio_SetSfxProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx); Audio_SetSfxProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx);
@ -661,7 +661,7 @@ void Audio_StepUnusedBankLerp(u8 bankId) {
void func_800F8F88(void) { void func_800F8F88(void) {
u8 bankId; 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; sCurSfxPlayerChannelIdx = 0;
for (bankId = 0; bankId < ARRAY_COUNT(gSfxBanks); bankId++) { for (bankId = 0; bankId < ARRAY_COUNT(gSfxBanks); bankId++) {
Audio_ChooseActiveSfx(bankId); Audio_ChooseActiveSfx(bankId);

View file

@ -45,12 +45,12 @@ void Audio_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDura
seqArgs &= 0x7F; seqArgs &= 0x7F;
if (seqArgs == 0x7F) { if (seqArgs == 0x7F) {
// `fadeInDuration` is interpreted as skip ticks // `fadeInDuration` is interpreted as skip ticks
duration = (fadeInDuration >> 3) * 60 * gAudioContext.audioBufferParameters.updatesPerFrame; duration = (fadeInDuration >> 3) * 60 * gAudioCtx.audioBufferParameters.updatesPerFrame;
Audio_QueueCmdS32(0x85000000 | _SHIFTL(seqPlayerIndex, 16, 8) | _SHIFTL(seqId, 8, 8), duration); Audio_QueueCmdS32(0x85000000 | _SHIFTL(seqPlayerIndex, 16, 8) | _SHIFTL(seqId, 8, 8), duration);
} else { } else {
// `fadeInDuration` is interpreted as number of frames at 30 fps // `fadeInDuration` is interpreted as number of frames at 30 fps
Audio_QueueCmdS32(0x82000000 | _SHIFTL(seqPlayerIndex, 16, 8) | _SHIFTL(seqId, 8, 8), Audio_QueueCmdS32(0x82000000 | _SHIFTL(seqPlayerIndex, 16, 8) | _SHIFTL(seqId, 8, 8),
(fadeInDuration * (u16)gAudioContext.audioBufferParameters.updatesPerFrame) / 4); (fadeInDuration * (u16)gAudioCtx.audioBufferParameters.updatesPerFrame) / 4);
} }
gActiveSeqs[seqPlayerIndex].seqId = seqId | (seqArgs << 8); gActiveSeqs[seqPlayerIndex].seqId = seqId | (seqArgs << 8);
@ -78,7 +78,7 @@ void Audio_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDura
void Audio_StopSequence(u8 seqPlayerIndex, u16 fadeOutDuration) { void Audio_StopSequence(u8 seqPlayerIndex, u16 fadeOutDuration) {
Audio_QueueCmdS32(0x83000000 | ((u8)seqPlayerIndex << 16), Audio_QueueCmdS32(0x83000000 | ((u8)seqPlayerIndex << 16),
(fadeOutDuration * (u16)gAudioContext.audioBufferParameters.updatesPerFrame) / 4); (fadeOutDuration * (u16)gAudioCtx.audioBufferParameters.updatesPerFrame) / 4);
gActiveSeqs[seqPlayerIndex].seqId = NA_BGM_DISABLED; gActiveSeqs[seqPlayerIndex].seqId = NA_BGM_DISABLED;
} }
@ -408,7 +408,7 @@ void Audio_ProcessSeqCmds(void) {
} }
u16 Audio_GetActiveSeqId(u8 seqPlayerIndex) { u16 Audio_GetActiveSeqId(u8 seqPlayerIndex) {
if (!gAudioContext.seqPlayers[seqPlayerIndex].enabled) { if (!gAudioCtx.seqPlayers[seqPlayerIndex].enabled) {
return NA_BGM_DISABLED; return NA_BGM_DISABLED;
} }
return gActiveSeqs[seqPlayerIndex].seqId; return gActiveSeqs[seqPlayerIndex].seqId;
@ -541,8 +541,8 @@ void Audio_UpdateActiveSequences(void) {
} }
// Process tempo commands // Process tempo commands
if (gAudioContext.seqPlayers[seqPlayerIndex].enabled) { if (gAudioCtx.seqPlayers[seqPlayerIndex].enabled) {
tempoPrev = gAudioContext.seqPlayers[seqPlayerIndex].tempo / TATUMS_PER_BEAT; tempoPrev = gAudioCtx.seqPlayers[seqPlayerIndex].tempo / TATUMS_PER_BEAT;
tempoOp = (tempoCmd & 0xF000) >> 12; tempoOp = (tempoCmd & 0xF000) >> 12;
switch (tempoOp) { switch (tempoOp) {
case SEQCMD_SUB_OP_TEMPO_SPEED_UP: case SEQCMD_SUB_OP_TEMPO_SPEED_UP:
@ -583,7 +583,7 @@ void Audio_UpdateActiveSequences(void) {
} }
gActiveSeqs[seqPlayerIndex].tempoTarget = tempoTarget; gActiveSeqs[seqPlayerIndex].tempoTarget = tempoTarget;
gActiveSeqs[seqPlayerIndex].tempoCur = gAudioContext.seqPlayers[seqPlayerIndex].tempo / TATUMS_PER_BEAT; gActiveSeqs[seqPlayerIndex].tempoCur = gAudioCtx.seqPlayers[seqPlayerIndex].tempo / TATUMS_PER_BEAT;
gActiveSeqs[seqPlayerIndex].tempoStep = gActiveSeqs[seqPlayerIndex].tempoStep =
(gActiveSeqs[seqPlayerIndex].tempoCur - gActiveSeqs[seqPlayerIndex].tempoTarget) / tempoTimer; (gActiveSeqs[seqPlayerIndex].tempoCur - gActiveSeqs[seqPlayerIndex].tempoTarget) / tempoTimer;
gActiveSeqs[seqPlayerIndex].tempoTimer = tempoTimer; gActiveSeqs[seqPlayerIndex].tempoTimer = tempoTimer;
@ -659,7 +659,7 @@ void Audio_UpdateActiveSequences(void) {
// Only process setup commands if `seqPlayerIndex` if no longer playing // Only process setup commands if `seqPlayerIndex` if no longer playing
// i.e. the `seqPlayer` is no longer enabled // i.e. the `seqPlayer` is no longer enabled
if (gAudioContext.seqPlayers[seqPlayerIndex].enabled) { if (gAudioCtx.seqPlayers[seqPlayerIndex].enabled) {
continue; continue;
} }

View file

@ -1238,7 +1238,7 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
sp74 = actor->world.pos.y - actor->prevPos.y; sp74 = actor->world.pos.y - actor->prevPos.y;
if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & BGCHECKFLAG_GROUND)) {
func_800433A4(&play->colCtx, actor->floorBgId, actor); DynaPolyActor_TransformCarriedActor(&play->colCtx, actor->floorBgId, actor);
} }
if (flags & UPDBGCHECKINFO_FLAG_0) { if (flags & UPDBGCHECKINFO_FLAG_0) {

View file

@ -114,7 +114,7 @@ void EnAObj_Init(Actor* thisx, PlayState* play) {
thisx->focus.pos = thisx->world.pos; thisx->focus.pos = thisx->world.pos;
this->dyna.bgId = BGACTOR_NEG_ONE; this->dyna.bgId = BGACTOR_NEG_ONE;
this->dyna.interactFlags = 0; this->dyna.interactFlags = 0;
this->dyna.unk_15C = DPM_UNK; this->dyna.transformFlags = 0;
thisx->uncullZoneDownward = 1200.0f; thisx->uncullZoneDownward = 1200.0f;
thisx->uncullZoneScale = 200.0f; thisx->uncullZoneScale = 200.0f;

View file

@ -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, osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", play->sequenceCtx.seqId,
((void)0, gSaveContext.seqId)); ((void)0, gSaveContext.seqId));
if (((void)0, gSaveContext.seqId) != play->sequenceCtx.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) && } else if (((void)0, gSaveContext.dayTime) >= CLOCK_TIME(7, 0) &&
((void)0, gSaveContext.dayTime) <= CLOCK_TIME(17, 10)) { ((void)0, gSaveContext.dayTime) <= CLOCK_TIME(17, 10)) {
if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) { 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; 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) { if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) {
osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n"); osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n");
func_800F5510(play->sequenceCtx.seqId); Audio_PlayMorningSceneSequence(play->sequenceCtx.seqId);
} }
play->envCtx.timeSeqState++; play->envCtx.timeSeqState++;

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 }, { 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 // Used to map item actions to model groups
u8 sActionModelGroups[PLAYER_AP_MAX] = { u8 sActionModelGroups[PLAYER_IA_MAX] = {
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_NONE PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NONE
PLAYER_MODELGROUP_15, // PLAYER_AP_LAST_USED PLAYER_MODELGROUP_15, // PLAYER_IA_LAST_USED
PLAYER_MODELGROUP_10, // PLAYER_AP_FISHING_POLE PLAYER_MODELGROUP_10, // PLAYER_IA_FISHING_POLE
PLAYER_MODELGROUP_SWORD, // PLAYER_AP_SWORD_MASTER PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_MASTER
PLAYER_MODELGROUP_SWORD, // PLAYER_AP_SWORD_KOKIRI PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_KOKIRI
PLAYER_MODELGROUP_BGS, // PLAYER_AP_SWORD_BGS PLAYER_MODELGROUP_BGS, // PLAYER_IA_SWORD_BGS
PLAYER_MODELGROUP_10, // PLAYER_AP_STICK PLAYER_MODELGROUP_10, // PLAYER_IA_STICK
PLAYER_MODELGROUP_HAMMER, // PLAYER_AP_HAMMER PLAYER_MODELGROUP_HAMMER, // PLAYER_IA_HAMMER
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_FIRE PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_FIRE
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_ICE PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_ICE
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_LIGHT PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_LIGHT
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_0C PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0C
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_0D PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0D
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_0E PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0E
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_SLINGSHOT PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_SLINGSHOT
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_AP_HOOKSHOT PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_HOOKSHOT
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_AP_LONGSHOT PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_LONGSHOT
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_AP_BOMB PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMB
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_AP_BOMBCHU PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMBCHU
PLAYER_MODELGROUP_BOOMERANG, // PLAYER_AP_BOOMERANG PLAYER_MODELGROUP_BOOMERANG, // PLAYER_IA_BOOMERANG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MAGIC_SPELL_15 PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_15
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MAGIC_SPELL_16 PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_16
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_MAGIC_SPELL_17 PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_MAGIC_SPELL_17
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_FARORES_WIND PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FARORES_WIND
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_NAYRUS_LOVE PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NAYRUS_LOVE
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_DINS_FIRE PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DINS_FIRE
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_NUT PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NUT
PLAYER_MODELGROUP_OCARINA, // PLAYER_AP_OCARINA_FAIRY PLAYER_MODELGROUP_OCARINA, // PLAYER_IA_OCARINA_FAIRY
PLAYER_MODELGROUP_OOT, // PLAYER_AP_OCARINA_TIME PLAYER_MODELGROUP_OOT, // PLAYER_IA_OCARINA_TIME
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_FISH PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FISH
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_FIRE PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FIRE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_BUG PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BUG
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POE PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_BIG_POE PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BIG_POE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_LETTER PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_LETTER
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POTION_RED PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_RED
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POTION_BLUE PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_BLUE
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POTION_GREEN PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_GREEN
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_MILK PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_MILK_HALF PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_HALF
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_FAIRY PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FAIRY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_LETTER_ZELDA PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LETTER_ZELDA
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_WEIRD_EGG PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_WEIRD_EGG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_CHICKEN PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CHICKEN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_BEAN PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_BEAN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_POCKET_EGG PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_EGG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_POCKET_CUCCO PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_CUCCO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_COJIRO PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_COJIRO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_ODD_MUSHROOM PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_MUSHROOM
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_ODD_POTION PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_POTION
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_SAW PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_SAW
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_SWORD_BROKEN PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_SWORD_BROKEN
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_PRESCRIPTION PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_PRESCRIPTION
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_FROG PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FROG
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_EYEDROPS PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_EYEDROPS
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_CLAIM_CHECK PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CLAIM_CHECK
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_KEATON PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_KEATON
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_SKULL PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SKULL
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_SPOOKY PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SPOOKY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_BUNNY PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_BUNNY
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_GORON PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GORON
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_ZORA PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_ZORA
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_GERUDO PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GERUDO
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_TRUTH PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_TRUTH
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_LENS PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LENS
}; };
TextTriggerEntry sTextTriggers[] = { 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) || return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csMode != 0) ||
(play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) || (play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) ||
(this->stateFlags3 & PLAYER_STATE3_7) || (this->stateFlags3 & PLAYER_STATE3_7) ||
((gSaveContext.magicState != MAGIC_STATE_IDLE) && ((gSaveContext.magicState != MAGIC_STATE_IDLE) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0));
(Player_ActionToMagicSpell(this, this->itemActionParam) >= 0));
} }
s32 Player_InCsMode(PlayState* play) { 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); return gSaveContext.linkAge != LINK_AGE_ADULT && (this->currentShield == PLAYER_SHIELD_HYLIAN);
} }
s32 Player_ActionToModelGroup(Player* this, s32 actionParam) { s32 Player_ActionToModelGroup(Player* this, s32 itemAction) {
s32 modelGroup = sActionModelGroups[actionParam]; s32 modelGroup = sActionModelGroups[itemAction];
if ((modelGroup == PLAYER_MODELGROUP_SWORD) && Player_IsChildWithHylianShield(this)) { if ((modelGroup == PLAYER_MODELGROUP_SWORD) && Player_IsChildWithHylianShield(this)) {
// child, using kokiri sword with hylian shield equipped // child, using kokiri sword with hylian shield equipped
@ -522,7 +521,7 @@ s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
void Player_SetModelsForHoldingShield(Player* this) { void Player_SetModelsForHoldingShield(Player* this) {
if ((this->stateFlags1 & PLAYER_STATE1_22) && 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)) { if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) {
this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD; this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD;
this->rightHandDLists = sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD] + ((void)0, gSaveContext.linkAge); 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->sheathDLists = sPlayerDListGroups[this->sheathType] + ((void)0, gSaveContext.linkAge);
this->modelAnimType = PLAYER_ANIMTYPE_2; 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) { void func_8008EC70(Player* this) {
this->itemActionParam = this->heldItemActionParam; this->itemAction = this->heldItemAction;
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam)); Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemAction));
this->unk_6AD = 0; 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->currentTunic = TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC));
this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS)); this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS));
this->currentSwordItemId = B_BTN_ITEM; 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); 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); Inventory_UpdateBottleItem(play, item, this->heldItemButton);
if (item != ITEM_BOTTLE) { if (item != ITEM_BOTTLE) {
this->heldItemId = item; this->heldItemId = item;
this->heldItemActionParam = actionParam; this->heldItemAction = itemAction;
} }
this->itemActionParam = actionParam; this->itemAction = itemAction;
} }
void func_8008EDF0(Player* this) { void func_8008EDF0(Player* this) {
@ -645,7 +644,7 @@ s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 y
Vec3f diff; Vec3f diff;
s32 pad; 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); 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); return ((SQ(diff.x) + SQ(diff.z)) <= SQ(xzRange)) && (0.0f <= diff.y) && (diff.y <= yRange);
} else { } else {
@ -691,8 +690,8 @@ s32 Player_HasMirrorShieldSetToDraw(PlayState* play) {
return (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && (this->currentShield == PLAYER_SHIELD_MIRROR); return (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && (this->currentShield == PLAYER_SHIELD_MIRROR);
} }
s32 Player_ActionToMagicSpell(Player* this, s32 actionParam) { s32 Player_ActionToMagicSpell(Player* this, s32 itemAction) {
s32 magicSpell = actionParam - PLAYER_AP_MAGIC_SPELL_15; s32 magicSpell = itemAction - PLAYER_IA_MAGIC_SPELL_15;
if ((magicSpell >= 0) && (magicSpell < 6)) { if ((magicSpell >= 0) && (magicSpell < 6)) {
return magicSpell; return magicSpell;
@ -702,15 +701,15 @@ s32 Player_ActionToMagicSpell(Player* this, s32 actionParam) {
} }
s32 Player_HoldsHookshot(Player* this) { 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) { s32 func_8008F128(Player* this) {
return Player_HoldsHookshot(this) && (this->heldActor == NULL); return Player_HoldsHookshot(this) && (this->heldActor == NULL);
} }
s32 Player_ActionToMeleeWeapon(s32 actionParam) { s32 Player_ActionToMeleeWeapon(s32 itemAction) {
s32 meleeWeapon = actionParam - PLAYER_AP_FISHING_POLE; s32 meleeWeapon = itemAction - PLAYER_IA_FISHING_POLE;
if ((meleeWeapon > 0) && (meleeWeapon < 6)) { if ((meleeWeapon > 0) && (meleeWeapon < 6)) {
return meleeWeapon; return meleeWeapon;
@ -720,11 +719,11 @@ s32 Player_ActionToMeleeWeapon(s32 actionParam) {
} }
s32 Player_GetMeleeWeaponHeld(Player* this) { s32 Player_GetMeleeWeaponHeld(Player* this) {
return Player_ActionToMeleeWeapon(this->heldItemActionParam); return Player_ActionToMeleeWeapon(this->heldItemAction);
} }
s32 Player_HoldsTwoHandedWeapon(Player* this) { 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; return 1;
} else { } else {
return 0; return 0;
@ -732,11 +731,11 @@ s32 Player_HoldsTwoHandedWeapon(Player* this) {
} }
s32 Player_HoldsBrokenKnife(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 Player_ActionToBottle(Player* this, s32 itemAction) {
s32 bottle = actionParam - PLAYER_AP_BOTTLE; s32 bottle = itemAction - PLAYER_IA_BOTTLE;
if ((bottle >= 0) && (bottle < 13)) { if ((bottle >= 0) && (bottle < 13)) {
return bottle; return bottle;
@ -746,11 +745,11 @@ s32 Player_ActionToBottle(Player* this, s32 actionParam) {
} }
s32 Player_GetBottleHeld(Player* this) { 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 Player_ActionToExplosive(Player* this, s32 itemAction) {
s32 explosive = actionParam - PLAYER_AP_BOMB; s32 explosive = itemAction - PLAYER_IA_BOMB;
if ((explosive >= 0) && (explosive < 2)) { if ((explosive >= 0) && (explosive < 2)) {
return explosive; return explosive;
@ -760,14 +759,14 @@ s32 Player_ActionToExplosive(Player* this, s32 actionParam) {
} }
s32 Player_GetExplosiveHeld(Player* this) { 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; s32 sword = 0;
if (actionParam != PLAYER_AP_LAST_USED) { if (itemAction != PLAYER_IA_LAST_USED) {
sword = actionParam - PLAYER_AP_SWORD_MASTER; sword = itemAction - PLAYER_IA_SWORD_MASTER;
if ((sword < 0) || (sword >= 3)) { if ((sword < 0) || (sword >= 3)) {
goto return_neg; goto return_neg;
} }
@ -979,7 +978,7 @@ void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* p
s32 temp3; s32 temp3;
if ((this->actor.scale.y >= 0.0f) && !(this->stateFlags1 & PLAYER_STATE1_7) && 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; s32 pad;
sp7C = D_80126058[(void)0, gSaveContext.linkAge]; 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); Math_Vec3f_Copy(&this->leftHandPos, sCurBodyPartPos);
if (this->itemActionParam == PLAYER_AP_STICK) { if (this->itemAction == PLAYER_IA_STICK) {
Vec3f sp124[3]; Vec3f sp124[3];
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2633); 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_80090A28(this, spE4);
func_800906D4(play, this, spE4); func_800906D4(play, this, spE4);
} else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) { } 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); 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->actor.scale.y >= 0.0f) {
if ((this->heldItemActionParam == PLAYER_AP_HOOKSHOT) || if ((this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT)) {
(this->heldItemActionParam == PLAYER_AP_LONGSHOT)) {
Matrix_MultVec3f(&D_80126184, &this->unk_3C8); Matrix_MultVec3f(&D_80126184, &this->unk_3C8);
if (heldActor != NULL) { if (heldActor != NULL) {
@ -1596,8 +1594,8 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
if (func_8002DD78(this) != 0) { if (func_8002DD78(this) != 0) {
Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY); Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY);
Player_DrawHookshotReticle( Player_DrawHookshotReticle(play, this,
play, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f); (this->heldItemAction == PLAYER_IA_HOOKSHOT) ? 38600.0f : 77600.0f);
} }
} }
} }

View file

@ -84,7 +84,7 @@ void ArmsHook_Wait(ArmsHook* this, PlayState* play) {
if (this->actor.parent == NULL) { if (this->actor.parent == NULL) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
// get correct timer length for hookshot or longshot // 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); ArmsHook_SetupAction(this, ArmsHook_Shoot);
func_8002D9A4(&this->actor, 20.0f); func_8002D9A4(&this->actor, 20.0f);
@ -120,7 +120,7 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) {
Player* player = (Player*)this->actor.parent; Player* player = (Player*)this->actor.parent;
if (Player_HoldsHookshot(player)) { 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)))) { ((player->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_26)))) {
this->timer = 0; this->timer = 0;
ArmsHook_DetachHookFromActor(this); ArmsHook_DetachHookFromActor(this);

View file

@ -110,7 +110,7 @@ void BgBdanObjects_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
this->switchFlag = (thisx->params >> 8) & 0x3F; this->switchFlag = (thisx->params >> 8) & 0x3F;
thisx->params &= 0xFF; thisx->params &= 0xFF;
if (thisx->params == 2) { if (thisx->params == 2) {

View file

@ -155,7 +155,7 @@ void BgBdanSwitch_Init(Actor* thisx, PlayState* play) {
case BLUE: case BLUE:
case YELLOW_HEAVY: case YELLOW_HEAVY:
case YELLOW: case YELLOW:
BgBdanSwitch_InitDynaPoly(this, play, &gJabuFloorSwitchCol, DPM_PLAYER); BgBdanSwitch_InitDynaPoly(this, play, &gJabuFloorSwitchCol, DYNA_TRANSFORM_POS);
break; break;
case YELLOW_TALL_1: case YELLOW_TALL_1:
case YELLOW_TALL_2: case YELLOW_TALL_2:

View file

@ -38,7 +38,7 @@ void BgBomGuard_Init(Actor* thisx, PlayState* play) {
s32 pad[2]; s32 pad[2];
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gBowlingDefaultCol, &colHeader); CollisionHeader_GetVirtual(&gBowlingDefaultCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);

View file

@ -86,7 +86,7 @@ void BgBombwall_InitDynapoly(BgBombwall* this, PlayState* play) {
s32 pad2; s32 pad2;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gBgBombwallCol, &colHeader); CollisionHeader_GetVirtual(&gBgBombwallCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);

View file

@ -50,7 +50,7 @@ void BgBowlWall_Init(Actor* thisx, PlayState* play) {
s32 pad2; s32 pad2;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
if (this->dyna.actor.params == 0) { if (this->dyna.actor.params == 0) {
CollisionHeader_GetVirtual(&gBowlingFirstAndFinalRoundCol, &colHeader); CollisionHeader_GetVirtual(&gBowlingFirstAndFinalRoundCol, &colHeader);

View file

@ -82,7 +82,7 @@ void BgBreakwall_Init(Actor* thisx, PlayState* play) {
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
this->bombableWallDList = sBombableWallInfo[wallType].dList; this->bombableWallDList = sBombableWallInfo[wallType].dList;
this->colType = sBombableWallInfo[wallType].colType; this->colType = sBombableWallInfo[wallType].colType;

View file

@ -56,7 +56,7 @@ void BgDdanJd_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(&gDodongoRisingPlatformCol, &colHeader); CollisionHeader_GetVirtual(&gDodongoRisingPlatformCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
this->idleTimer = IDLE_FRAMES; this->idleTimer = IDLE_FRAMES;

View file

@ -69,7 +69,7 @@ void BgDdanKd_Init(Actor* thisx, PlayState* play) {
this->prevExplosive = NULL; this->prevExplosive = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
Collider_InitCylinder(play, &this->collider); Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit);
CollisionHeader_GetVirtual(&gDodongoFallingStairsCol, &colHeader); CollisionHeader_GetVirtual(&gDodongoFallingStairsCol, &colHeader);

View file

@ -113,7 +113,7 @@ void BgDodoago_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gDodongoLowerJawCol, &colHeader); CollisionHeader_GetVirtual(&gDodongoLowerJawCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f);

View file

@ -71,7 +71,7 @@ void BgGanonOtyuka_Init(Actor* thisx, PlayState* play2) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&sCol, &colHeader); CollisionHeader_GetVirtual(&sCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);

View file

@ -37,7 +37,7 @@ void BgGateShutter_Init(Actor* thisx, PlayState* play) {
s32 pad[2]; s32 pad[2];
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gKakarikoGuardGateCol, &colHeader); CollisionHeader_GetVirtual(&gKakarikoGuardGateCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
this->somePos.x = thisx->world.pos.x; this->somePos.x = thisx->world.pos.x;

View file

@ -44,7 +44,7 @@ void BgGjyoBridge_Init(Actor* thisx, PlayState* play) {
colHeader = NULL; colHeader = NULL;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gRainbowBridgeCol, &colHeader); CollisionHeader_GetVirtual(&gRainbowBridgeCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);

View file

@ -40,7 +40,7 @@ void BgGndFiremeiro_Init(Actor* thisx, PlayState* play) {
this->initPos = this->dyna.actor.world.pos; this->initPos = this->dyna.actor.world.pos;
if (this->dyna.actor.params == 0) { if (this->dyna.actor.params == 0) {
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gFireTrialPlatformCol, &colHeader); CollisionHeader_GetVirtual(&gFireTrialPlatformCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
this->actionFunc = BgGndFiremeiro_Rise; this->actionFunc = BgGndFiremeiro_Rise;

View file

@ -50,7 +50,7 @@ void BgGndIceblock_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gWaterTrialIceBlockCol, &colHeader); CollisionHeader_GetVirtual(&gWaterTrialIceBlockCol, &colHeader);
this->targetPos = this->dyna.actor.home.pos; this->targetPos = this->dyna.actor.home.pos;
this->actionFunc = BgGndIceblock_Idle; this->actionFunc = BgGndIceblock_Idle;

View file

@ -43,7 +43,7 @@ void BgHaka_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gGravestoneCol, &colHeader); CollisionHeader_GetVirtual(&gGravestoneCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
this->actionFunc = func_8087B7E8; this->actionFunc = func_8087B7E8;

View file

@ -76,7 +76,7 @@ void BgHakaGate_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
this->switchFlag = (thisx->params >> 8) & 0xFF; this->switchFlag = (thisx->params >> 8) & 0xFF;
thisx->params &= 0xFF; thisx->params &= 0xFF;
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
if (thisx->params == BGHAKAGATE_SKULL) { if (thisx->params == BGHAKAGATE_SKULL) {
if (sSkullOfTruthRotY != 0x100) { if (sSkullOfTruthRotY != 0x100) {
this->actionFunc = BgHakaGate_FalseSkull; this->actionFunc = BgHakaGate_FalseSkull;

View file

@ -45,7 +45,7 @@ void BgHakaHuta_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(&gBotwCoffinLidCol, &colHeader); CollisionHeader_GetVirtual(&gBotwCoffinLidCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
this->unk_16A = (thisx->params >> 8) & 0xFF; this->unk_16A = (thisx->params >> 8) & 0xFF;

View file

@ -63,7 +63,7 @@ void BgHakaMegane_Init(Actor* thisx, PlayState* play) {
BgHakaMegane* this = (BgHakaMegane*)thisx; BgHakaMegane* this = (BgHakaMegane*)thisx;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
if (thisx->params < 3) { if (thisx->params < 3) {
this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS); this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS);

View file

@ -63,12 +63,12 @@ void BgHakaMeganeBG_Init(Actor* thisx, PlayState* play) {
thisx->params &= 0xFF; thisx->params &= 0xFF;
if (thisx->params == 2) { if (thisx->params == 2) {
DynaPolyActor_Init(&this->dyna, DPM_UNK3); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y);
thisx->flags |= ACTOR_FLAG_4; thisx->flags |= ACTOR_FLAG_4;
CollisionHeader_GetVirtual(&object_haka_objects_Col_005334, &colHeader); CollisionHeader_GetVirtual(&object_haka_objects_Col_005334, &colHeader);
this->actionFunc = func_8087E258; this->actionFunc = func_8087E258;
} else { } else {
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
if (thisx->params == 0) { if (thisx->params == 0) {
CollisionHeader_GetVirtual(&object_haka_objects_Col_009168, &colHeader); CollisionHeader_GetVirtual(&object_haka_objects_Col_009168, &colHeader);

View file

@ -43,7 +43,7 @@ void BgHakaShip_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, 1); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
this->switchFlag = (thisx->params >> 8) & 0xFF; this->switchFlag = (thisx->params >> 8) & 0xFF;
this->dyna.actor.params &= 0xFF; this->dyna.actor.params &= 0xFF;

View file

@ -130,7 +130,7 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) {
this->actionFunc = func_80880484; this->actionFunc = func_80880484;
} else { } else {
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
thisx->flags |= ACTOR_FLAG_4; thisx->flags |= ACTOR_FLAG_4;
if (thisx->params == HAKA_TRAP_SPIKED_BOX) { if (thisx->params == HAKA_TRAP_SPIKED_BOX) {

View file

@ -82,7 +82,7 @@ void BgHakaTubo_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK3); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y);
CollisionHeader_GetVirtual(&object_haka_objects_Col_0108B8, &colHeader); CollisionHeader_GetVirtual(&object_haka_objects_Col_0108B8, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
Collider_InitCylinder(play, &this->potCollider); Collider_InitCylinder(play, &this->potCollider);

View file

@ -76,7 +76,7 @@ void BgHeavyBlock_SetupDynapoly(BgHeavyBlock* this, PlayState* play) {
s32 pad[2]; s32 pad[2];
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
this->dyna.actor.flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_17; this->dyna.actor.flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_17;
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gHeavyBlockCol, &colHeader); CollisionHeader_GetVirtual(&gHeavyBlockCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
} }

View file

@ -100,7 +100,7 @@ void BgHidanDalm_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gFireTempleHammerableTotemCol, &colHeader); CollisionHeader_GetVirtual(&gFireTempleHammerableTotemCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
Collider_InitTris(play, &this->collider); Collider_InitTris(play, &this->collider);

View file

@ -44,7 +44,7 @@ void BgHidanFslift_Init(Actor* thisx, PlayState* play) {
s32 pad2; s32 pad2;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(&gFireTempleHookshotElevatorCol, &colHeader); CollisionHeader_GetVirtual(&gFireTempleHookshotElevatorCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_HSBLOCK, this->dyna.actor.world.pos.x, if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_HSBLOCK, this->dyna.actor.world.pos.x,

View file

@ -134,7 +134,7 @@ void BgHidanHamstep_Init(Actor* thisx, PlayState* play) {
s32 i2; s32 i2;
BgHidanHamstep* step; BgHidanHamstep* step;
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if ((this->dyna.actor.params & 0xFF) == 0) { if ((this->dyna.actor.params & 0xFF) == 0) {

View file

@ -88,7 +88,7 @@ void BgHidanHrock_Init(Actor* thisx, PlayState* play) {
thisx->params = (thisx->params >> 8) & 0xFF; thisx->params = (thisx->params >> 8) & 0xFF;
Collider_InitTris(play, &this->collider); Collider_InitTris(play, &this->collider);
Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems); Collider_SetTris(play, &this->collider, thisx, &sTrisInit, this->colliderItems);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
sinRotY = Math_SinS(thisx->shape.rot.y); sinRotY = Math_SinS(thisx->shape.rot.y);
cosRotY = Math_CosS(thisx->shape.rot.y); cosRotY = Math_CosS(thisx->shape.rot.y);

View file

@ -67,7 +67,7 @@ void BgHidanKousi_Init(Actor* thisx, PlayState* play) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
Actor_SetFocus(thisx, 50.0f); Actor_SetFocus(thisx, 50.0f);
osSyncPrintf("◯◯◯炎の神殿オブジェクト【格子(arg_data : %0x)】出現 (%d %d)\n", thisx->params, thisx->params & 0xFF, osSyncPrintf("◯◯◯炎の神殿オブジェクト【格子(arg_data : %0x)】出現 (%d %d)\n", thisx->params, thisx->params & 0xFF,
((s32)thisx->params >> 8) & 0xFF); ((s32)thisx->params >> 8) & 0xFF);

View file

@ -78,7 +78,7 @@ void BgHidanKowarerukabe_InitDynaPoly(BgHidanKowarerukabe* this, PlayState* play
s32 pad2; s32 pad2;
if (collisionHeaders[this->dyna.actor.params & 0xFF] != NULL) { if (collisionHeaders[this->dyna.actor.params & 0xFF] != NULL) {
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(collisionHeaders[this->dyna.actor.params & 0xFF], &colHeader); CollisionHeader_GetVirtual(collisionHeaders[this->dyna.actor.params & 0xFF], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
} else { } else {

View file

@ -72,7 +72,7 @@ void BgHidanRock_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
this->type = thisx->params & 0xFF; this->type = thisx->params & 0xFF;
this->unk_169 = 0; this->unk_169 = 0;

View file

@ -127,7 +127,7 @@ void BgHidanRsekizou_Init(Actor* thisx, PlayState* play) {
colHeader = NULL; colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gFireTempleSpinningFlamethrowerCol, &colHeader); CollisionHeader_GetVirtual(&gFireTempleSpinningFlamethrowerCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
Collider_InitJntSph(play, &this->collider); Collider_InitJntSph(play, &this->collider);

View file

@ -151,7 +151,7 @@ void BgHidanSekizou_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
Collider_InitJntSph(play, &this->collider); Collider_InitJntSph(play, &this->collider);
Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements); Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->elements);
for (i = 0; i < ARRAY_COUNT(this->elements); i++) { for (i = 0; i < ARRAY_COUNT(this->elements); i++) {

View file

@ -87,7 +87,7 @@ void BgHidanSima_Init(Actor* thisx, PlayState* play) {
s32 i; s32 i;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
if (this->dyna.actor.params == 0) { if (this->dyna.actor.params == 0) {
CollisionHeader_GetVirtual(&gFireTempleStonePlatform1Col, &colHeader); CollisionHeader_GetVirtual(&gFireTempleStonePlatform1Col, &colHeader);
} else { } else {

View file

@ -40,7 +40,7 @@ void BgHidanSyoku_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(&gFireTempleFlareDancerPlatformCol, &colHeader); CollisionHeader_GetVirtual(&gFireTempleFlareDancerPlatformCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
this->actionFunc = func_8088F4B8; this->actionFunc = func_8088F4B8;

View file

@ -45,7 +45,7 @@ void BgIceObjects_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&object_ice_objects_Col_0003F0, &colHeader); CollisionHeader_GetVirtual(&object_ice_objects_Col_0003F0, &colHeader);
Math_Vec3f_Copy(&this->targetPos, &this->dyna.actor.home.pos); Math_Vec3f_Copy(&this->targetPos, &this->dyna.actor.home.pos);
this->actionFunc = BgIceObjects_Idle; this->actionFunc = BgIceObjects_Idle;

View file

@ -53,7 +53,7 @@ void BgIceShutter_Init(Actor* thisx, PlayState* play) {
colHeader = NULL; colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
sp28 = this->dyna.actor.params & 0xFF; sp28 = this->dyna.actor.params & 0xFF;
this->dyna.actor.params = (this->dyna.actor.params >> 8) & 0xFF; this->dyna.actor.params = (this->dyna.actor.params >> 8) & 0xFF;
CollisionHeader_GetVirtual(&object_ice_objects_Col_002854, &colHeader); CollisionHeader_GetVirtual(&object_ice_objects_Col_002854, &colHeader);

View file

@ -65,7 +65,7 @@ void BgIceTurara_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&object_ice_objects_Col_002594, &colHeader); CollisionHeader_GetVirtual(&object_ice_objects_Col_002594, &colHeader);
Collider_InitCylinder(play, &this->collider); Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit);

View file

@ -39,7 +39,7 @@ void BgInGate_Init(Actor* thisx, PlayState* play) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gIngoGateCol, &colHeader); CollisionHeader_GetVirtual(&gIngoGateCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);

View file

@ -59,7 +59,7 @@ void BgJyaAmishutter_InitDynaPoly(BgJyaAmishutter* this, PlayState* play, Collis
void BgJyaAmishutter_Init(Actor* thisx, PlayState* play) { void BgJyaAmishutter_Init(Actor* thisx, PlayState* play) {
BgJyaAmishutter* this = (BgJyaAmishutter*)thisx; BgJyaAmishutter* this = (BgJyaAmishutter*)thisx;
BgJyaAmishutter_InitDynaPoly(this, play, &gAmishutterCol, DPM_UNK); BgJyaAmishutter_InitDynaPoly(this, play, &gAmishutterCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
BgJyaAmishutter_SetupWaitForPlayer(this); BgJyaAmishutter_SetupWaitForPlayer(this);
} }

View file

@ -96,7 +96,7 @@ void BgJyaBombiwa_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.params & 0x3F); this->dyna.actor.params & 0x3F);
osSyncPrintf(VT_RST); osSyncPrintf(VT_RST);
} }
BgJyaBombiwa_SetupDynaPoly(this, play, &gBombiwaCol, DPM_UNK); BgJyaBombiwa_SetupDynaPoly(this, play, &gBombiwaCol, 0);
BgJyaBombiwa_InitCollider(this, play); BgJyaBombiwa_InitCollider(this, play);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
Actor_Kill(&this->dyna.actor); Actor_Kill(&this->dyna.actor);

View file

@ -397,7 +397,7 @@ void BgJyaCobra_UpdateShadowFromTop(BgJyaCobra* this) {
void BgJyaCobra_Init(Actor* thisx, PlayState* play) { void BgJyaCobra_Init(Actor* thisx, PlayState* play) {
BgJyaCobra* this = (BgJyaCobra*)thisx; BgJyaCobra* this = (BgJyaCobra*)thisx;
BgJyaCobra_InitDynapoly(this, play, &gCobraCol, DPM_UNK); BgJyaCobra_InitDynapoly(this, play, &gCobraCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (!(this->dyna.actor.params & 3) && Flags_GetSwitch(play, ((s32)this->dyna.actor.params >> 8) & 0x3F)) { if (!(this->dyna.actor.params & 3) && Flags_GetSwitch(play, ((s32)this->dyna.actor.params >> 8) & 0x3F)) {
this->dyna.actor.world.rot.y = this->dyna.actor.home.rot.y = this->dyna.actor.shape.rot.y = 0; this->dyna.actor.world.rot.y = this->dyna.actor.home.rot.y = this->dyna.actor.shape.rot.y = 0;

View file

@ -56,7 +56,7 @@ void BgJyaKanaami_InitDynaPoly(BgJyaKanaami* this, PlayState* play, CollisionHea
void BgJyaKanaami_Init(Actor* thisx, PlayState* play) { void BgJyaKanaami_Init(Actor* thisx, PlayState* play) {
BgJyaKanaami* this = (BgJyaKanaami*)thisx; BgJyaKanaami* this = (BgJyaKanaami*)thisx;
BgJyaKanaami_InitDynaPoly(this, play, &gKanaamiCol, DPM_UNK); BgJyaKanaami_InitDynaPoly(this, play, &gKanaamiCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
func_80899A08(this); func_80899A08(this);

View file

@ -61,7 +61,7 @@ void BgJyaLift_Init(Actor* thisx, PlayState* play) {
// "Goddess lift CT" // "Goddess lift CT"
osSyncPrintf("女神リフト CT\n"); osSyncPrintf("女神リフト CT\n");
BgJyaLift_InitDynapoly(this, play, &gLiftCol, DPM_UNK); BgJyaLift_InitDynapoly(this, play, &gLiftCol, 0);
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
if (Flags_GetSwitch(play, (thisx->params & 0x3F))) { if (Flags_GetSwitch(play, (thisx->params & 0x3F))) {
BgJyaLift_SetFinalPosY(this); BgJyaLift_SetFinalPosY(this);

View file

@ -159,7 +159,7 @@ void BgJyaMegami_SetupSpawnEffect(BgJyaMegami* this, PlayState* play, f32 arg2)
void BgJyaMegami_Init(Actor* thisx, PlayState* play) { void BgJyaMegami_Init(Actor* thisx, PlayState* play) {
BgJyaMegami* this = (BgJyaMegami*)thisx; BgJyaMegami* this = (BgJyaMegami*)thisx;
BgJyaMegami_InitDynaPoly(this, play, &GMegamiCol, DPM_UNK); BgJyaMegami_InitDynaPoly(this, play, &GMegamiCol, 0);
BgJyaMegami_InitCollider(this, play); BgJyaMegami_InitCollider(this, play);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
Actor_Kill(&this->dyna.actor); Actor_Kill(&this->dyna.actor);

View file

@ -110,7 +110,7 @@ void BgJyaZurerukabe_Init(Actor* thisx, PlayState* play) {
BgJyaZurerukabe* this = (BgJyaZurerukabe*)thisx; BgJyaZurerukabe* this = (BgJyaZurerukabe*)thisx;
s32 i; s32 i;
BgJyaZurerukabe_InitDynaPoly(this, play, &gZurerukabeCol, DPM_UNK); BgJyaZurerukabe_InitDynaPoly(this, play, &gZurerukabeCol, 0);
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
for (i = 0; i < ARRAY_COUNT(D_8089B9F0); i++) { for (i = 0; i < ARRAY_COUNT(D_8089B9F0); i++) {

View file

@ -36,7 +36,7 @@ void BgMenkuriKaiten_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK3); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y);
CollisionHeader_GetVirtual(&gGTGRotatingRingPlatformCol, &colHeader); CollisionHeader_GetVirtual(&gGTGRotatingRingPlatformCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
} }

View file

@ -177,7 +177,7 @@ void BgMizuBwall_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->yRot = this->dyna.actor.world.pos.y; this->yRot = this->dyna.actor.world.pos.y;
this->dList = sDLists[(u16)this->dyna.actor.params & 0xF]; this->dList = sDLists[(u16)this->dyna.actor.params & 0xF];
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(sColHeaders[(u16)this->dyna.actor.params & 0xF], &colHeader); CollisionHeader_GetVirtual(sColHeaders[(u16)this->dyna.actor.params & 0xF], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);

View file

@ -89,7 +89,7 @@ void BgMizuMovebg_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
((BgMizuMovebg*)thisx)->homeY = thisx->world.pos.y; ((BgMizuMovebg*)thisx)->homeY = thisx->world.pos.y;
((BgMizuMovebg*)thisx)->dlist = D_8089EB50[MOVEBG_TYPE(thisx->params)]; ((BgMizuMovebg*)thisx)->dlist = D_8089EB50[MOVEBG_TYPE(thisx->params)];
DynaPolyActor_Init(&((BgMizuMovebg*)thisx)->dyna, DPM_PLAYER); DynaPolyActor_Init(&((BgMizuMovebg*)thisx)->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(D_8089EB70[MOVEBG_TYPE(thisx->params)], &colHeader); CollisionHeader_GetVirtual(D_8089EB70[MOVEBG_TYPE(thisx->params)], &colHeader);
((BgMizuMovebg*)thisx)->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); ((BgMizuMovebg*)thisx)->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);

View file

@ -53,7 +53,7 @@ void BgMizuShutter_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->displayList = sDisplayLists[BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor)]; this->displayList = sDisplayLists[BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor)];
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(sCollisionHeaders[BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor)], &colHeader); CollisionHeader_GetVirtual(sCollisionHeaders[BGMIZUSHUTTER_SIZE_PARAM(&this->dyna.actor)], &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);

View file

@ -41,7 +41,7 @@ void BgMizuUzu_Init(Actor* thisx, PlayState* play) {
s32 pad2; s32 pad2;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gObjectMizuObjectsUzuCol_0074EC, &colHeader); CollisionHeader_GetVirtual(&gObjectMizuObjectsUzuCol_0074EC, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
this->actionFunc = func_8089F788; this->actionFunc = func_8089F788;

View file

@ -74,7 +74,7 @@ void BgMoriBigst_Init(Actor* thisx, PlayState* play) {
Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F), Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F),
Flags_GetTempClear(play, this->dyna.actor.room), Flags_GetClear(play, this->dyna.actor.room), Flags_GetTempClear(play, this->dyna.actor.room), Flags_GetClear(play, this->dyna.actor.room),
GET_PLAYER(play)->actor.world.pos.y); GET_PLAYER(play)->actor.world.pos.y);
BgMoriBigst_InitDynapoly(this, play, &gMoriBigstCol, DPM_UNK); BgMoriBigst_InitDynapoly(this, play, &gMoriBigstCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjIndex < 0) { if (this->moriTexObjIndex < 0) {

View file

@ -100,7 +100,7 @@ void BgMoriElevator_Init(Actor* thisx, PlayState* play) {
sIsSpawned = true; sIsSpawned = true;
this->dyna.actor.room = -1; this->dyna.actor.room = -1;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
CollisionHeader_GetVirtual(&gMoriElevatorCol, &colHeader); CollisionHeader_GetVirtual(&gMoriElevatorCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
BgMoriElevator_SetupWaitAfterInit(this); BgMoriElevator_SetupWaitAfterInit(this);

View file

@ -144,7 +144,7 @@ s32 BgMoriHashigo_InitClasp(BgMoriHashigo* this, PlayState* play) {
} }
s32 BgMoriHashigo_InitLadder(BgMoriHashigo* this, PlayState* play) { s32 BgMoriHashigo_InitLadder(BgMoriHashigo* this, PlayState* play) {
BgMoriHashigo_InitDynapoly(this, play, &gMoriHashigoCol, DPM_UNK); BgMoriHashigo_InitDynapoly(this, play, &gMoriHashigoCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChainLadder); Actor_ProcessInitChain(&this->dyna.actor, sInitChainLadder);
return true; return true;
} }

View file

@ -73,9 +73,9 @@ void BgMoriHashira4_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.params &= 0xFF; this->dyna.actor.params &= 0xFF;
if (this->dyna.actor.params == 0) { if (this->dyna.actor.params == 0) {
BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira1Col, DPM_UNK3); BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira1Col, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y);
} else { } else {
BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira2Col, DPM_UNK); BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira2Col, 0);
} }
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);

View file

@ -59,7 +59,7 @@ void BgMoriHineri_Init(Actor* thisx, PlayState* play) {
s32 t6; s32 t6;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
switchFlagParam = this->dyna.actor.params & 0x3F; switchFlagParam = this->dyna.actor.params & 0x3F;
t6 = this->dyna.actor.params & 0x4000; t6 = this->dyna.actor.params & 0x4000;

View file

@ -53,7 +53,7 @@ void BgMoriKaitenkabe_Init(Actor* thisx, PlayState* play) {
// "Forest Temple object 【Rotating Wall (arg_data: 0x% 04x)】 appears" // "Forest Temple object 【Rotating Wall (arg_data: 0x% 04x)】 appears"
osSyncPrintf("◯◯◯森の神殿オブジェクト【回転壁(arg_data : 0x%04x)】出現 \n", this->dyna.actor.params); osSyncPrintf("◯◯◯森の神殿オブジェクト【回転壁(arg_data : 0x%04x)】出現 \n", this->dyna.actor.params);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gMoriKaitenkabeCol, &colHeader); CollisionHeader_GetVirtual(&gMoriKaitenkabeCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX); this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);

View file

@ -50,7 +50,7 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) {
BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx; BgMoriRakkatenjo* this = (BgMoriRakkatenjo*)thisx;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
// "Forest Temple obj. Falling Ceiling" // "Forest Temple obj. Falling Ceiling"
osSyncPrintf("森の神殿 obj. 落下天井 (home posY %f)\n", this->dyna.actor.home.pos.y); osSyncPrintf("森の神殿 obj. 落下天井 (home posY %f)\n", this->dyna.actor.home.pos.y);
if ((fabsf(1991.0f - this->dyna.actor.home.pos.x) > 0.001f) || if ((fabsf(1991.0f - this->dyna.actor.home.pos.x) > 0.001f) ||

View file

@ -209,7 +209,7 @@ void BgPoEvent_Init(Actor* thisx, PlayState* play) {
BgPoEvent_InitPaintings(this, play); BgPoEvent_InitPaintings(this, play);
} }
} else { } else {
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
if (Flags_GetSwitch(play, thisx->params)) { if (Flags_GetSwitch(play, thisx->params)) {
Actor_Kill(thisx); Actor_Kill(thisx);
} else { } else {

View file

@ -44,7 +44,7 @@ void BgPushbox_Init(Actor* thisx, PlayState* play) {
s32 pad2; s32 pad2;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gBlockSmallCol, &colHeader); CollisionHeader_GetVirtual(&gBlockSmallCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f);

View file

@ -52,7 +52,7 @@ void BgRelayObjects_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
this->switchFlag = thisx->params & 0x3F; this->switchFlag = thisx->params & 0x3F;
thisx->params = (thisx->params >> 8) & 0xFF; thisx->params = (thisx->params >> 8) & 0xFF;
DynaPolyActor_Init(&this->dyna, 3); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y);
if (thisx->params == WINDMILL_ROTATING_GEAR) { if (thisx->params == WINDMILL_ROTATING_GEAR) {
CollisionHeader_GetVirtual(&gWindmillRotatingPlatformCol, &colHeader); CollisionHeader_GetVirtual(&gWindmillRotatingPlatformCol, &colHeader);
if (GET_EVENTCHKINF(EVENTCHKINF_65)) { if (GET_EVENTCHKINF(EVENTCHKINF_65)) {

View file

@ -39,7 +39,7 @@ void BgSpot00Break_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
if (this->dyna.actor.params == 1) { if (this->dyna.actor.params == 1) {
CollisionHeader_GetVirtual(&gBarbedWireFenceCol, &colHeader); CollisionHeader_GetVirtual(&gBarbedWireFenceCol, &colHeader);

View file

@ -53,7 +53,7 @@ void BgSpot00Hanebasi_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, 1); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
if (this->dyna.actor.params == DT_DRAWBRIDGE) { if (this->dyna.actor.params == DT_DRAWBRIDGE) {
CollisionHeader_GetVirtual(&gHyruleFieldCastleDrawbridgeCol, &colHeader); CollisionHeader_GetVirtual(&gHyruleFieldCastleDrawbridgeCol, &colHeader);

View file

@ -295,7 +295,7 @@ void BgSpot01Idohashira_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader; CollisionHeader* colHeader;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
colHeader = NULL; colHeader = NULL;
CollisionHeader_GetVirtual(&gKakarikoWellArchCol, &colHeader); CollisionHeader_GetVirtual(&gKakarikoWellArchCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);

View file

@ -42,7 +42,7 @@ void BgSpot01Idosoko_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
s32 pad2; s32 pad2;
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
CollisionHeader_GetVirtual(&gKakarikoBOTWStoneCol, &colHeader); CollisionHeader_GetVirtual(&gKakarikoBOTWStoneCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);

View file

@ -97,7 +97,7 @@ void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex].segment); gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex].segment);
this->dyna.actor.objBankIndex = this->objBankIndex; this->dyna.actor.objBankIndex = this->objBankIndex;
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
switch (this->dyna.actor.params & 7) { switch (this->dyna.actor.params & 7) {
case 4: // Shooting gallery case 4: // Shooting gallery

View file

@ -48,7 +48,7 @@ void BgSpot03Taki_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
this->switchFlag = (this->dyna.actor.params & 0x3F); this->switchFlag = (this->dyna.actor.params & 0x3F);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&object_spot03_object_Col_000C98, &colHeader); CollisionHeader_GetVirtual(&object_spot03_object_Col_000C98, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);

View file

@ -47,7 +47,7 @@ void BgSpot05Soko_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
this->switchFlag = (thisx->params >> 8) & 0xFF; this->switchFlag = (thisx->params >> 8) & 0xFF;
thisx->params &= 0xFF; thisx->params &= 0xFF;
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
if (thisx->params == 0) { if (thisx->params == 0) {
CollisionHeader_GetVirtual(&object_spot05_objects_Col_000918, &colHeader); CollisionHeader_GetVirtual(&object_spot05_objects_Col_000918, &colHeader);
if (LINK_IS_ADULT) { if (LINK_IS_ADULT) {

View file

@ -104,7 +104,7 @@ void BgSpot06Objects_Init(Actor* thisx, PlayState* play) {
switch (thisx->params) { switch (thisx->params) {
case LHO_WATER_TEMPLE_ENTRACE_GATE: case LHO_WATER_TEMPLE_ENTRACE_GATE:
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gLakeHyliaWaterTempleGateCol, &colHeader); CollisionHeader_GetVirtual(&gLakeHyliaWaterTempleGateCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
@ -170,7 +170,7 @@ void BgSpot06Objects_Init(Actor* thisx, PlayState* play) {
break; break;
case LHO_ICE_BLOCK: case LHO_ICE_BLOCK:
Actor_ProcessInitChain(thisx, sInitChain); Actor_ProcessInitChain(thisx, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK); DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gLakeHyliaZoraShortcutIceblockCol, &colHeader); CollisionHeader_GetVirtual(&gLakeHyliaZoraShortcutIceblockCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader);
this->actionFunc = BgSpot06Objects_DoNothing; this->actionFunc = BgSpot06Objects_DoNothing;

View file

@ -37,7 +37,7 @@ void BgSpot07Taki_Init(Actor* thisx, PlayState* play) {
s32 pad; s32 pad;
CollisionHeader* colHeader = NULL; CollisionHeader* colHeader = NULL;
DynaPolyActor_Init(&this->dyna, DPM_PLAYER); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (LINK_IS_ADULT) { if (LINK_IS_ADULT) {
if (this->dyna.actor.params == 0) { if (this->dyna.actor.params == 0) {

Some files were not shown because too many files have changed in this diff Show more