1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-28 19:25:27 +00:00

Audio Ocarina Documentation (#1026)

* Begin ocarina documentation

* Many ocarina-related docs

* More ocarina docs

* Introduce Ocarina Fonts Enum

* Fix ocarina font enum

* Fix incorrect documentation, more documentation

* Ocarina recording documentation

* cleanup

* Small touch-ups

* Fix font -> instrument

* format

* Better docs on playback, memory game

* more cleanup

* Add z64ocarina.h

* Clean up names

* final cleanup

* typo

* Fix description

* better docs

* Fix channel -> channelIdx

* Fix old "font" name to correct "instrument" name, add io port docs

* Add comments to clarify certain lines/functions

* format

* Rename noteIdx to pitch

* Missed a name

* Add comment on pitch

* `reset` -> `SetInstrument` and `displayed` -> `playback`

* Clarify audio_update and windmill comment

* Minor PR fixes

* Revert Audio_Update because there are 2 different Audio_Update functions

* PR Feedback

* Ocarina Idx -> Index

* Introduce OCARINA_BTN_C_RIGHT_OR_C_LEFT

* PR Suggestions

* Next PR Suggestions

* Next PR Feedback

* consistency

* Better docs (PR)

* Better comment
This commit is contained in:
engineer124 2022-05-10 02:59:23 +10:00 committed by GitHub
parent 6cd8029cd5
commit 95b4317931
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 1872 additions and 1593 deletions

View file

@ -1928,16 +1928,16 @@ void AudioSeq_SkipForwardSequence(SequencePlayer* seqPlayer);
void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer);
void AudioSeq_InitSequencePlayerChannels(s32 playerIdx);
void AudioSeq_InitSequencePlayers(void);
void func_800ECC04(u16);
void Audio_OcaSetInstrument(u8);
void Audio_OcaSetSongPlayback(s8 songIdxPlusOne, s8 playbackState);
void Audio_OcaSetRecordingState(u8);
OcarinaStaff* Audio_OcaGetRecordingStaff(void);
OcarinaStaff* Audio_OcaGetPlayingStaff(void);
OcarinaStaff* Audio_OcaGetDisplayingStaff(void);
void Audio_OcaMemoryGameStart(u8 minigameIdx);
s32 Audio_OcaMemoryGameGenNote(void);
void func_800EE824(void);
void AudioOcarina_Start(u16 ocarinaFlags);
void AudioOcarina_SetInstrument(u8 ocarinaInstrumentId);
void AudioOcarina_SetPlaybackSong(s8 songIndexPlusOne, s8 playbackState);
void AudioOcarina_SetRecordingState(u8 recordingState);
OcarinaStaff* AudioOcarina_GetRecordingStaff(void);
OcarinaStaff* AudioOcarina_GetPlayingStaff(void);
OcarinaStaff* AudioOcarina_GetPlaybackStaff(void);
void AudioOcarina_MemoryGameInit(u8 minigameRound);
s32 AudioOcarina_MemoryGameNextNote(void);
void AudioOcarina_PlayLongScarecrowAfterCredits(void);
void AudioDebug_Draw(GfxPrint* printer);
void AudioDebug_ScrPrt(const s8* str, u16 num);
void func_800F3054(void);
@ -2280,7 +2280,7 @@ s32 __osSpSetPc(void* pc);
f32 absf(f32);
void* __osMemset(void* dest, s32 val, size_t len);
void* __osMemmove(void* dest, const void* src, size_t len);
void Message_UpdateOcarinaGame(GlobalContext* globalCtx);
void Message_UpdateOcarinaMemoryGame(GlobalContext* globalCtx);
u8 Message_ShouldAdvance(GlobalContext* globalCtx);
void Message_CloseTextbox(GlobalContext*);
void Message_StartTextbox(GlobalContext* globalCtx, u16 textId, Actor* actor);

View file

@ -159,9 +159,9 @@
#define R_TEXTBOX_BG_YPOS XREG(61)
#define R_TEXTBOX_CLEF_XPOS VREG(7)
#define R_TEXTBOX_CLEF_YPOS VREG(8)
#define R_OCARINA_NOTES_XPOS VREG(28)
#define R_OCARINA_NOTES_YPOS(note) VREG(45 + (note))
#define R_OCARINA_NOTES_XPOS_OFFSET VREG(29)
#define R_OCARINA_NOTES_YPOS_OFFSET VREG(51)
#define R_OCARINA_BUTTONS_XPOS VREG(28)
#define R_OCARINA_BUTTONS_YPOS(note) VREG(45 + (note))
#define R_OCARINA_BUTTONS_XPOS_OFFSET VREG(29)
#define R_OCARINA_BUTTONS_YPOS_OFFSET VREG(51)
#endif

View file

@ -115,7 +115,7 @@ extern volatile OSTime gIrqMgrRetraceTime;
extern s16* gWaveSamples[9];
extern f32 gBendPitchOneOctaveFrequencies[256];
extern f32 gBendPitchTwoSemitonesFrequencies[256];
extern f32 gNoteFrequencies[];
extern f32 gPitchFrequencies[];
extern u8 gDefaultShortNoteVelocityTable[16];
extern u8 gDefaultShortNoteGateTimeTable[16];
extern AdsrEnvelope gDefaultEnvelope[4];
@ -134,9 +134,9 @@ extern u8 gChannelsPerBank[4][7];
extern u8 gUsedChannelsPerBank[4][7];
extern u8 gMorphaTransposeTable[16];
extern u8* gFrogsSongPtr;
extern OcarinaNote* gScarecrowCustomSongPtr;
extern OcarinaNote* gScarecrowLongSongPtr;
extern u8* gScarecrowSpawnSongPtr;
extern OcarinaSongInfo gOcarinaSongNotes[];
extern OcarinaSongButtons gOcarinaSongButtons[];
extern SoundParams* gSoundParams[7];
extern char D_80133390[];
extern char D_80133398[];

View file

@ -10,6 +10,7 @@
#include "z64player.h"
#include "z64audio.h"
#include "z64object.h"
#include "z64ocarina.h"
#include "z64camera.h"
#include "z64environment.h"
#include "z64cutscene.h"
@ -359,97 +360,6 @@ typedef struct {
/* 0x150 */ char unk_150[0x10];
} SkyboxContext; // size = 0x160
typedef enum {
/* 0 */ OCARINA_SONG_MINUET,
/* 1 */ OCARINA_SONG_BOLERO,
/* 2 */ OCARINA_SONG_SERENADE,
/* 3 */ OCARINA_SONG_REQUIEM,
/* 4 */ OCARINA_SONG_NOCTURNE,
/* 5 */ OCARINA_SONG_PRELUDE,
/* 6 */ OCARINA_SONG_SARIAS,
/* 7 */ OCARINA_SONG_EPONAS,
/* 8 */ OCARINA_SONG_LULLABY,
/* 9 */ OCARINA_SONG_SUNS,
/* 10 */ OCARINA_SONG_TIME,
/* 11 */ OCARINA_SONG_STORMS,
/* 12 */ OCARINA_SONG_SCARECROW,
/* 13 */ OCARINA_SONG_MEMORY_GAME,
/* 14 */ OCARINA_SONG_MAX,
/* 14 */ OCARINA_SONG_SCARECROW_LONG = OCARINA_SONG_MAX // anything larger than 13 is considered the long scarecrow's song
} OcarinaSongId;
typedef enum {
/* 0x00 */ OCARINA_ACTION_UNK_0, // acts like free play but never set
/* 0x01 */ OCARINA_ACTION_FREE_PLAY,
/* 0x02 */ OCARINA_ACTION_TEACH_MINUET, // Song demonstrations by teachers
/* 0x03 */ OCARINA_ACTION_TEACH_BOLERO,
/* 0x04 */ OCARINA_ACTION_TEACH_SERENADE,
/* 0x05 */ OCARINA_ACTION_TEACH_REQUIEM,
/* 0x06 */ OCARINA_ACTION_TEACH_NOCTURNE,
/* 0x07 */ OCARINA_ACTION_TEACH_PRELUDE,
/* 0x08 */ OCARINA_ACTION_TEACH_SARIA,
/* 0x09 */ OCARINA_ACTION_TEACH_EPONA,
/* 0x0A */ OCARINA_ACTION_TEACH_LULLABY,
/* 0x0B */ OCARINA_ACTION_TEACH_SUNS,
/* 0x0C */ OCARINA_ACTION_TEACH_TIME,
/* 0x0D */ OCARINA_ACTION_TEACH_STORMS,
/* 0x0E */ OCARINA_ACTION_UNK_E,
/* 0x0F */ OCARINA_ACTION_PLAYBACK_MINUET, // Playing back a particular song
/* 0x10 */ OCARINA_ACTION_PLAYBACK_BOLERO,
/* 0x11 */ OCARINA_ACTION_PLAYBACK_SERENADE,
/* 0x12 */ OCARINA_ACTION_PLAYBACK_REQUIEM,
/* 0x13 */ OCARINA_ACTION_PLAYBACK_NOCTURNE,
/* 0x14 */ OCARINA_ACTION_PLAYBACK_PRELUDE,
/* 0x15 */ OCARINA_ACTION_PLAYBACK_SARIA,
/* 0x16 */ OCARINA_ACTION_PLAYBACK_EPONA,
/* 0x17 */ OCARINA_ACTION_PLAYBACK_LULLABY,
/* 0x18 */ OCARINA_ACTION_PLAYBACK_SUNS,
/* 0x19 */ OCARINA_ACTION_PLAYBACK_TIME,
/* 0x1A */ OCARINA_ACTION_PLAYBACK_STORMS,
/* 0x1B */ OCARINA_ACTION_UNK_1B,
/* 0x1C */ OCARINA_ACTION_CHECK_MINUET, // Playing songs for check spots
/* 0x1D */ OCARINA_ACTION_CHECK_BOLERO,
/* 0x1E */ OCARINA_ACTION_CHECK_SERENADE,
/* 0x1F */ OCARINA_ACTION_CHECK_REQUIEM,
/* 0020 */ OCARINA_ACTION_CHECK_NOCTURNE,
/* 0x21 */ OCARINA_ACTION_CHECK_PRELUDE,
/* 0x22 */ OCARINA_ACTION_CHECK_SARIA,
/* 0x23 */ OCARINA_ACTION_CHECK_EPONA,
/* 0x24 */ OCARINA_ACTION_CHECK_LULLABY,
/* 0x25 */ OCARINA_ACTION_CHECK_SUNS,
/* 0x26 */ OCARINA_ACTION_CHECK_TIME,
/* 0x27 */ OCARINA_ACTION_CHECK_STORMS,
/* 0x28 */ OCARINA_ACTION_CHECK_SCARECROW, // Playing back the song as adult that was set as child
/* 0x29 */ OCARINA_ACTION_FREE_PLAY_DONE,
/* 0x2A */ OCARINA_ACTION_SCARECROW_LONG_RECORDING,
/* 0x2B */ OCARINA_ACTION_SCARECROW_LONG_PLAYBACK,
/* 0x2C */ OCARINA_ACTION_SCARECROW_RECORDING,
/* 0x2D */ OCARINA_ACTION_SCARECROW_PLAYBACK,
/* 0x2E */ OCARINA_ACTION_MEMORY_GAME,
/* 0x2F */ OCARINA_ACTION_FROGS,
/* 0x30 */ OCARINA_ACTION_CHECK_NOWARP, // Check for any of sarias - storms
/* 0x31 */ OCARINA_ACTION_CHECK_NOWARP_DONE
} OcarinaSongActionIDs;
typedef enum {
/* 0x00 */ OCARINA_MODE_00,
/* 0x01 */ OCARINA_MODE_01,
/* 0x02 */ OCARINA_MODE_02,
/* 0x03 */ OCARINA_MODE_03,
/* 0x04 */ OCARINA_MODE_04,
/* 0x05 */ OCARINA_MODE_05,
/* 0x06 */ OCARINA_MODE_06,
/* 0x07 */ OCARINA_MODE_07,
/* 0x08 */ OCARINA_MODE_08,
/* 0x09 */ OCARINA_MODE_09,
/* 0x0A */ OCARINA_MODE_0A,
/* 0x0B */ OCARINA_MODE_0B,
/* 0x0C */ OCARINA_MODE_0C,
/* 0x0D */ OCARINA_MODE_0D,
/* 0x0E */ OCARINA_MODE_0E,
/* 0x0F */ OCARINA_MODE_0F
} OcarinaMode;
typedef enum {
TEXTBOX_ICON_TRIANGLE,
TEXTBOX_ICON_SQUARE,
@ -508,11 +418,11 @@ typedef enum {
/* 0x21 */ MSGMODE_SCARECROW_LONG_RECORDING_START,
/* 0x22 */ MSGMODE_SCARECROW_LONG_RECORDING_ONGOING,
/* 0x23 */ MSGMODE_SCARECROW_LONG_PLAYBACK,
/* 0x24 */ MSGMODE_SCARECROW_RECORDING_START,
/* 0x25 */ MSGMODE_SCARECROW_RECORDING_ONGOING,
/* 0x26 */ MSGMODE_SCARECROW_RECORDING_FAILED,
/* 0x27 */ MSGMODE_SCARECROW_RECORDING_DONE,
/* 0x28 */ MSGMODE_SCARECROW_PLAYBACK,
/* 0x24 */ MSGMODE_SCARECROW_SPAWN_RECORDING_START,
/* 0x25 */ MSGMODE_SCARECROW_SPAWN_RECORDING_ONGOING,
/* 0x26 */ MSGMODE_SCARECROW_SPAWN_RECORDING_FAILED,
/* 0x27 */ MSGMODE_SCARECROW_SPAWN_RECORDING_DONE,
/* 0x28 */ MSGMODE_SCARECROW_SPAWN_PLAYBACK,
/* 0x29 */ MSGMODE_MEMORY_GAME_START,
/* 0x2A */ MSGMODE_MEMORY_GAME_LEFT_SKULLKID_PLAYING,
/* 0x2B */ MSGMODE_MEMORY_GAME_LEFT_SKULLKID_WAIT,
@ -626,7 +536,7 @@ typedef struct {
/* 0xE408 */ Actor* talkActor;
/* 0xE40C */ s16 disableWarpSongs; // warp song flag set by scene commands
/* 0xE40E */ s16 unk_E40E; // ocarina related
/* 0xE410 */ u8 lastOcaNoteIdx;
/* 0xE410 */ u8 lastOcarinaButtonIndex;
} MessageContext; // size = 0xE418
typedef enum {

View file

@ -814,7 +814,7 @@ typedef struct {
/* 0x2894 */ s32 numNotes;
/* 0x2898 */ s16 tempoInternalToExternal;
/* 0x289A */ s8 soundMode;
/* 0x289C */ s32 totalTaskCnt;
/* 0x289C */ s32 totalTaskCount;
/* 0x28A0 */ s32 curAudioFrameDmaCount;
/* 0x28A4 */ s32 rspTaskIdx;
/* 0x28A8 */ s32 curAIBufIdx;
@ -1011,34 +1011,4 @@ typedef struct {
u16 params;
} SoundParams;
typedef struct {
/* 0x0000 */ u8 noteIdx;
/* 0x0001 */ u8 unk_01;
/* 0x0002 */ u16 unk_02;
/* 0x0004 */ u8 volume;
/* 0x0005 */ u8 vibrato;
/* 0x0006 */ s8 tone;
/* 0x0007 */ u8 semitone;
} OcarinaNote; // size = 0x8
typedef struct {
u8 len;
u8 notesIdx[8];
} OcarinaSongInfo;
typedef struct {
u8 noteIdx;
u8 state; // original name: "status"
u8 pos; // original name: "locate"
} OcarinaStaff;
typedef enum {
/* 0 */ OCARINA_NOTE_A,
/* 1 */ OCARINA_NOTE_C_DOWN,
/* 2 */ OCARINA_NOTE_C_RIGHT,
/* 3 */ OCARINA_NOTE_C_LEFT,
/* 4 */ OCARINA_NOTE_C_UP,
/* -1 */ OCARINA_NOTE_INVALID = 0xFF
} OcarinaNoteIdx;
#endif

180
include/z64ocarina.h Normal file
View file

@ -0,0 +1,180 @@
#ifndef Z64OCARINA_H
#define Z64OCARINA_H
#include "ultra64.h"
typedef enum {
/* 0 */ OCARINA_SONG_MINUET,
/* 1 */ OCARINA_SONG_BOLERO,
/* 2 */ OCARINA_SONG_SERENADE,
/* 3 */ OCARINA_SONG_REQUIEM,
/* 4 */ OCARINA_SONG_NOCTURNE,
/* 5 */ OCARINA_SONG_PRELUDE,
/* 6 */ OCARINA_SONG_SARIAS,
/* 7 */ OCARINA_SONG_EPONAS,
/* 8 */ OCARINA_SONG_LULLABY,
/* 9 */ OCARINA_SONG_SUNS,
/* 10 */ OCARINA_SONG_TIME,
/* 11 */ OCARINA_SONG_STORMS,
/* 12 */ OCARINA_SONG_SCARECROW_SPAWN,
/* 13 */ OCARINA_SONG_MEMORY_GAME,
/* 14 */ OCARINA_SONG_MAX,
/* 14 */ OCARINA_SONG_SCARECROW_LONG = OCARINA_SONG_MAX // anything larger than 13 is considered the long scarecrow's song
} OcarinaSongId;
typedef enum {
/* 0x00 */ OCARINA_ACTION_UNK_0, // acts like free play but never set
/* 0x01 */ OCARINA_ACTION_FREE_PLAY,
/* 0x02 */ OCARINA_ACTION_TEACH_MINUET, // Song demonstrations by teachers
/* 0x03 */ OCARINA_ACTION_TEACH_BOLERO,
/* 0x04 */ OCARINA_ACTION_TEACH_SERENADE,
/* 0x05 */ OCARINA_ACTION_TEACH_REQUIEM,
/* 0x06 */ OCARINA_ACTION_TEACH_NOCTURNE,
/* 0x07 */ OCARINA_ACTION_TEACH_PRELUDE,
/* 0x08 */ OCARINA_ACTION_TEACH_SARIA,
/* 0x09 */ OCARINA_ACTION_TEACH_EPONA,
/* 0x0A */ OCARINA_ACTION_TEACH_LULLABY,
/* 0x0B */ OCARINA_ACTION_TEACH_SUNS,
/* 0x0C */ OCARINA_ACTION_TEACH_TIME,
/* 0x0D */ OCARINA_ACTION_TEACH_STORMS,
/* 0x0E */ OCARINA_ACTION_UNK_E,
/* 0x0F */ OCARINA_ACTION_PLAYBACK_MINUET, // Playing back a particular song
/* 0x10 */ OCARINA_ACTION_PLAYBACK_BOLERO,
/* 0x11 */ OCARINA_ACTION_PLAYBACK_SERENADE,
/* 0x12 */ OCARINA_ACTION_PLAYBACK_REQUIEM,
/* 0x13 */ OCARINA_ACTION_PLAYBACK_NOCTURNE,
/* 0x14 */ OCARINA_ACTION_PLAYBACK_PRELUDE,
/* 0x15 */ OCARINA_ACTION_PLAYBACK_SARIA,
/* 0x16 */ OCARINA_ACTION_PLAYBACK_EPONA,
/* 0x17 */ OCARINA_ACTION_PLAYBACK_LULLABY,
/* 0x18 */ OCARINA_ACTION_PLAYBACK_SUNS,
/* 0x19 */ OCARINA_ACTION_PLAYBACK_TIME,
/* 0x1A */ OCARINA_ACTION_PLAYBACK_STORMS,
/* 0x1B */ OCARINA_ACTION_UNK_1B,
/* 0x1C */ OCARINA_ACTION_CHECK_MINUET, // Playing songs for check spots
/* 0x1D */ OCARINA_ACTION_CHECK_BOLERO,
/* 0x1E */ OCARINA_ACTION_CHECK_SERENADE,
/* 0x1F */ OCARINA_ACTION_CHECK_REQUIEM,
/* 0x20 */ OCARINA_ACTION_CHECK_NOCTURNE,
/* 0x21 */ OCARINA_ACTION_CHECK_PRELUDE,
/* 0x22 */ OCARINA_ACTION_CHECK_SARIA,
/* 0x23 */ OCARINA_ACTION_CHECK_EPONA,
/* 0x24 */ OCARINA_ACTION_CHECK_LULLABY,
/* 0x25 */ OCARINA_ACTION_CHECK_SUNS,
/* 0x26 */ OCARINA_ACTION_CHECK_TIME,
/* 0x27 */ OCARINA_ACTION_CHECK_STORMS,
/* 0x28 */ OCARINA_ACTION_CHECK_SCARECROW_SPAWN, // Playing back the song as adult that was set as child
/* 0x29 */ OCARINA_ACTION_FREE_PLAY_DONE,
/* 0x2A */ OCARINA_ACTION_SCARECROW_LONG_RECORDING,
/* 0x2B */ OCARINA_ACTION_SCARECROW_LONG_PLAYBACK,
/* 0x2C */ OCARINA_ACTION_SCARECROW_SPAWN_RECORDING,
/* 0x2D */ OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK,
/* 0x2E */ OCARINA_ACTION_MEMORY_GAME,
/* 0x2F */ OCARINA_ACTION_FROGS,
/* 0x30 */ OCARINA_ACTION_CHECK_NOWARP, // Check for any of sarias - storms
/* 0x31 */ OCARINA_ACTION_CHECK_NOWARP_DONE
} OcarinaSongActionId;
typedef enum {
/* 0x00 */ OCARINA_MODE_00,
/* 0x01 */ OCARINA_MODE_01,
/* 0x02 */ OCARINA_MODE_02,
/* 0x03 */ OCARINA_MODE_03,
/* 0x04 */ OCARINA_MODE_04,
/* 0x05 */ OCARINA_MODE_05,
/* 0x06 */ OCARINA_MODE_06,
/* 0x07 */ OCARINA_MODE_07,
/* 0x08 */ OCARINA_MODE_08,
/* 0x09 */ OCARINA_MODE_09,
/* 0x0A */ OCARINA_MODE_0A,
/* 0x0B */ OCARINA_MODE_0B,
/* 0x0C */ OCARINA_MODE_0C,
/* 0x0D */ OCARINA_MODE_0D,
/* 0x0E */ OCARINA_MODE_0E,
/* 0x0F */ OCARINA_MODE_0F
} OcarinaMode;
typedef enum {
/* 0 */ OCARINA_BTN_A,
/* 1 */ OCARINA_BTN_C_DOWN,
/* 2 */ OCARINA_BTN_C_RIGHT,
/* 3 */ OCARINA_BTN_C_LEFT,
/* 4 */ OCARINA_BTN_C_UP,
/* 5 */ OCARINA_BTN_C_RIGHT_OR_C_LEFT, // Special case for bFlat4: Interface/Overlap between C_RIGHT and C_LEFT
/* 0xFF */ OCARINA_BTN_INVALID = 0xFF
} OcarinaButtonIndex;
// Uses scientific pitch notation relative to middle C
// https://en.wikipedia.org/wiki/Scientific_pitch_notation
typedef enum {
/* 0x0 */ OCARINA_PITCH_C4,
/* 0x1 */ OCARINA_PITCH_DFLAT4,
/* 0x2 */ OCARINA_PITCH_D4,
/* 0x3 */ OCARINA_PITCH_EFLAT4,
/* 0x4 */ OCARINA_PITCH_E4,
/* 0x5 */ OCARINA_PITCH_F4,
/* 0x6 */ OCARINA_PITCH_GFLAT4,
/* 0x7 */ OCARINA_PITCH_G4,
/* 0x8 */ OCARINA_PITCH_AFLAT4,
/* 0x9 */ OCARINA_PITCH_A4,
/* 0xA */ OCARINA_PITCH_BFLAT4,
/* 0xB */ OCARINA_PITCH_B4,
/* 0xC */ OCARINA_PITCH_C5,
/* 0xD */ OCARINA_PITCH_DFLAT5,
/* 0xE */ OCARINA_PITCH_D5,
/* 0xF */ OCARINA_PITCH_EFLAT5,
/* 0xFF */ OCARINA_PITCH_NONE = 0xFF
} OcarinaPitch;
typedef enum {
/* 0 */ OCARINA_INSTRUMENT_OFF,
/* 1 */ OCARINA_INSTRUMENT_DEFAULT,
/* 2 */ OCARINA_INSTRUMENT_MALON,
/* 3 */ OCARINA_INSTRUMENT_WHISTLE,
/* 4 */ OCARINA_INSTRUMENT_HARP,
/* 5 */ OCARINA_INSTRUMENT_GRIND_ORGAN,
/* 6 */ OCARINA_INSTRUMENT_FLUTE,
/* 7 */ OCARINA_INSTRUMENT_MAX,
/* 7 */ OCARINA_INSTRUMENT_DEFAULT_COPY1 = OCARINA_INSTRUMENT_MAX, // Unused but present in Sequence 0 table
/* 8 */ OCARINA_INSTRUMENT_DEFAULT_COPY2 = OCARINA_INSTRUMENT_MAX + 1 // Unused but present in Sequence 0 table
} OcarinaInstrumentId;
typedef enum {
/* 0 */ OCARINA_RECORD_OFF,
/* 1 */ OCARINA_RECORD_SCARECROW_LONG,
/* 2 */ OCARINA_RECORD_SCARECROW_SPAWN,
/* 0xFF */ OCARINA_RECORD_REJECTED = 0xFF
} OcarinaRecordingState;
/**
* bFlat4Flag Note:
* Flag for resolving whether (pitch = OCARINA_PITCH_BFLAT4)
* gets mapped to either C_RIGHT and C_LEFT
*
* This is required as C_RIGHT and C_LEFT are the only notes
* that map to two semitones apart (OCARINA_PITCH_A4 and OCARINA_PITCH_B4)
* 0x40 - BTN_Z is pressed to lower note by a semitone
* 0x80 - BTN_R is pressed to raise note by a semitone
*/
typedef struct {
/* 0x0 */ u8 pitch; // number of semitones above middle C
/* 0x2 */ u16 length; // number of frames the note is sustained
/* 0x4 */ u8 volume;
/* 0x5 */ u8 vibrato;
/* 0x6 */ s8 bend; // frequency multiplicative offset from the pitch
/* 0x7 */ u8 bFlat4Flag; // See note above
} OcarinaNote; // size = 0x8
typedef struct {
/* 0x0 */ u8 numButtons;
/* 0x1 */ u8 buttonsIndex[8];
} OcarinaSongButtons; // size = 0x9
typedef struct {
/* 0x0 */ u8 buttonIndex;
/* 0x1 */ u8 state; // multi-use. Playing: used as songIndex. Playback: used as repeat count of song. Recording: used as OcarinaRecordingState. "status"
/* 0x2 */ u8 pos; // "locate"
} OcarinaStaff; // size = 0x3
#endif

View file

@ -104,8 +104,8 @@ typedef struct {
/* 0x0F34 */ char unk_F34[0x04];
/* 0x0F38 */ u32 worldMapAreaData; // "area_arrival"
/* 0x0F3C */ char unk_F3C[0x4];
/* 0x0F40 */ u8 scarecrowCustomSongSet;
/* 0x0F41 */ u8 scarecrowCustomSong[0x360];
/* 0x0F40 */ u8 scarecrowLongSongSet;
/* 0x0F41 */ u8 scarecrowLongSong[0x360];
/* 0x12A1 */ char unk_12A1[0x24];
/* 0x12C5 */ u8 scarecrowSpawnSongSet;
/* 0x12C6 */ u8 scarecrowSpawnSong[0x80];

View file

@ -404,135 +404,135 @@ f32 gBendPitchTwoSemitonesFrequencies[] = {
1.117368f, 1.118385f, 1.119403f, 1.120422f, 1.121441f, 1.122462f,
};
f32 gNoteFrequencies[] = {
/* 0x00 */ 0.105112f, // NOTE_A0
/* 0x01 */ 0.111362f, // NOTE_BFLAT0
/* 0x02 */ 0.117984f, // NOTE_B0
/* 0x03 */ 0.125f, // NOTE_C1
/* 0x04 */ 0.132433f, // NOTE_DFLAT1
/* 0x05 */ 0.140308f, // NOTE_D1
/* 0x06 */ 0.148651f, // NOTE_EFLAT1
/* 0x07 */ 0.15749f, // NOTE_E1
/* 0x08 */ 0.166855f, // NOTE_F1
/* 0x09 */ 0.176777f, // NOTE_GFLAT1
/* 0x0A */ 0.187288f, // NOTE_G1
/* 0x0B */ 0.198425f, // NOTE_AFLAT1
/* 0x0C */ 0.210224f, // NOTE_A1
/* 0x0D */ 0.222725f, // NOTE_BFLAT1
/* 0x0E */ 0.235969f, // NOTE_B1
/* 0x0F */ 0.25f, // NOTE_C2
/* 0x10 */ 0.264866f, // NOTE_DFLAT2
/* 0x11 */ 0.280616f, // NOTE_D2
/* 0x12 */ 0.297302f, // NOTE_EFLAT2
/* 0x13 */ 0.31498f, // NOTE_E2
/* 0x14 */ 0.33371f, // NOTE_F2
/* 0x15 */ 0.353553f, // NOTE_GFLAT2
/* 0x16 */ 0.374577f, // NOTE_G2
/* 0x17 */ 0.39685f, // NOTE_AFLAT2
/* 0x18 */ 0.420448f, // NOTE_A2
/* 0x19 */ 0.445449f, // NOTE_BFLAT2
/* 0x1A */ 0.471937f, // NOTE_B2
/* 0x1B */ 0.5f, // NOTE_C3
/* 0x1C */ 0.529732f, // NOTE_DFLAT3
/* 0x1D */ 0.561231f, // NOTE_D3
/* 0x1E */ 0.594604f, // NOTE_EFLAT3
/* 0x1F */ 0.629961f, // NOTE_E3
/* 0x20 */ 0.66742f, // NOTE_F3
/* 0x21 */ 0.707107f, // NOTE_GFLAT3
/* 0x22 */ 0.749154f, // NOTE_G3
/* 0x23 */ 0.793701f, // NOTE_AFLAT3
/* 0x24 */ 0.840897f, // NOTE_A3
/* 0x25 */ 0.890899f, // NOTE_BFLAT3
/* 0x26 */ 0.943875f, // NOTE_B3
/* 0x27 */ 1.0f, // NOTE_C4 (Middle C)
/* 0x28 */ 1.059463f, // NOTE_DFLAT4
/* 0x29 */ 1.122462f, // NOTE_D4
/* 0x2A */ 1.189207f, // NOTE_EFLAT4
/* 0x2B */ 1.259921f, // NOTE_E4
/* 0x2C */ 1.33484f, // NOTE_F4
/* 0x2D */ 1.414214f, // NOTE_GFLAT4
/* 0x2E */ 1.498307f, // NOTE_G4
/* 0x2F */ 1.587401f, // NOTE_AFLAT4
/* 0x30 */ 1.681793f, // NOTE_A4
/* 0x31 */ 1.781798f, // NOTE_BFLAT4
/* 0x32 */ 1.887749f, // NOTE_B4
/* 0x33 */ 2.0f, // NOTE_C5
/* 0x34 */ 2.118926f, // NOTE_DFLAT5
/* 0x35 */ 2.244924f, // NOTE_D5
/* 0x36 */ 2.378414f, // NOTE_EFLAT5
/* 0x37 */ 2.519842f, // NOTE_E5
/* 0x38 */ 2.66968f, // NOTE_F5
/* 0x39 */ 2.828428f, // NOTE_GFLAT5
/* 0x3A */ 2.996615f, // NOTE_G5
/* 0x3B */ 3.174803f, // NOTE_AFLAT5
/* 0x3C */ 3.363586f, // NOTE_A5
/* 0x3D */ 3.563596f, // NOTE_BFLAT5
/* 0x3E */ 3.775498f, // NOTE_B5
/* 0x3F */ 4.0f, // NOTE_C6
/* 0x40 */ 4.237853f, // NOTE_DFLAT6
/* 0x41 */ 4.489849f, // NOTE_D6
/* 0x42 */ 4.756829f, // NOTE_EFLAT6
/* 0x43 */ 5.039685f, // NOTE_E6
/* 0x44 */ 5.33936f, // NOTE_F6
/* 0x45 */ 5.656855f, // NOTE_GFLAT6
/* 0x46 */ 5.993229f, // NOTE_G6
/* 0x47 */ 6.349606f, // NOTE_AFLAT6
/* 0x48 */ 6.727173f, // NOTE_A6
/* 0x49 */ 7.127192f, // NOTE_BFLAT6
/* 0x4A */ 7.550996f, // NOTE_B6
/* 0x4B */ 8.0f, // NOTE_C7
/* 0x4C */ 8.475705f, // NOTE_DFLAT7
/* 0x4D */ 8.979697f, // NOTE_D7
/* 0x4E */ 9.513658f, // NOTE_EFLAT7
/* 0x4F */ 10.07937f, // NOTE_E7
/* 0x50 */ 10.6787205f, // NOTE_F7
/* 0x51 */ 11.31371f, // NOTE_GFLAT7
/* 0x52 */ 11.986459f, // NOTE_G7
/* 0x53 */ 12.699211f, // NOTE_AFLAT7
/* 0x54 */ 13.454346f, // NOTE_A7
/* 0x55 */ 14.254383f, // NOTE_BFLAT7
/* 0x56 */ 15.101993f, // NOTE_B7
/* 0x57 */ 16.0f, // NOTE_C8
/* 0x58 */ 16.95141f, // NOTE_DFLAT8
/* 0x59 */ 17.959395f, // NOTE_D8
/* 0x5A */ 19.027315f, // NOTE_EFLAT8
/* 0x5B */ 20.15874f, // NOTE_E8
/* 0x5C */ 21.35744f, // NOTE_F8
/* 0x5D */ 22.62742f, // NOTE_GFLAT8
/* 0x5E */ 23.972918f, // NOTE_G8
/* 0x5F */ 25.398422f, // NOTE_AFLAT8
/* 0x60 */ 26.908691f, // NOTE_A8
/* 0x61 */ 28.508766f, // NOTE_BFLAT8
/* 0x62 */ 30.203985f, // NOTE_B8
/* 0x63 */ 32.0f, // NOTE_C9
/* 0x64 */ 33.90282f, // NOTE_DFLAT9
/* 0x65 */ 35.91879f, // NOTE_D9
/* 0x66 */ 38.05463f, // NOTE_EFLAT9
/* 0x67 */ 40.31748f, // NOTE_E9
/* 0x68 */ 42.71488f, // NOTE_F9
/* 0x69 */ 45.25484f, // NOTE_GFLAT9
/* 0x6A */ 47.945835f, // NOTE_G9
/* 0x6B */ 50.796845f, // NOTE_AFLAT9
/* 0x6C */ 53.817383f, // NOTE_A9
/* 0x6D */ 57.017532f, // NOTE_BFLAT9
/* 0x6E */ 60.40797f, // NOTE_B9
/* 0x6F */ 64.0f, // NOTE_C10
/* 0x70 */ 67.80564f, // NOTE_DFLAT10
/* 0x71 */ 71.83758f, // NOTE_D10
/* 0x72 */ 76.10926f, // NOTE_EFLAT10
/* 0x73 */ 80.63496f, // NOTE_E10
/* 0x74 */ 85.42976f, // NOTE_F10
/* 0x75 */ 0.055681f, // NOTE_BFLATNEG1
/* 0x76 */ 0.058992f, // NOTE_BNEG1
/* 0x77 */ 0.0625f, // NOTE_C0
/* 0x78 */ 0.066216f, // NOTE_DFLAT0
/* 0x79 */ 0.070154f, // NOTE_D0
/* 0x7A */ 0.074325f, // NOTE_EFLAT0
/* 0x7B */ 0.078745f, // NOTE_E0
/* 0x7C */ 0.083427f, // NOTE_F0
/* 0x7D */ 0.088388f, // NOTE_GFLAT0
/* 0x7E */ 0.093644f, // NOTE_G0
/* 0x7F */ 0.099213f, // NOTE_AFLAT0
f32 gPitchFrequencies[] = {
/* 0x00 */ 0.105112f, // PITCH_A0
/* 0x01 */ 0.111362f, // PITCH_BFLAT0
/* 0x02 */ 0.117984f, // PITCH_B0
/* 0x03 */ 0.125f, // PITCH_C1
/* 0x04 */ 0.132433f, // PITCH_DFLAT1
/* 0x05 */ 0.140308f, // PITCH_D1
/* 0x06 */ 0.148651f, // PITCH_EFLAT1
/* 0x07 */ 0.15749f, // PITCH_E1
/* 0x08 */ 0.166855f, // PITCH_F1
/* 0x09 */ 0.176777f, // PITCH_GFLAT1
/* 0x0A */ 0.187288f, // PITCH_G1
/* 0x0B */ 0.198425f, // PITCH_AFLAT1
/* 0x0C */ 0.210224f, // PITCH_A1
/* 0x0D */ 0.222725f, // PITCH_BFLAT1
/* 0x0E */ 0.235969f, // PITCH_B1
/* 0x0F */ 0.25f, // PITCH_C2
/* 0x10 */ 0.264866f, // PITCH_DFLAT2
/* 0x11 */ 0.280616f, // PITCH_D2
/* 0x12 */ 0.297302f, // PITCH_EFLAT2
/* 0x13 */ 0.31498f, // PITCH_E2
/* 0x14 */ 0.33371f, // PITCH_F2
/* 0x15 */ 0.353553f, // PITCH_GFLAT2
/* 0x16 */ 0.374577f, // PITCH_G2
/* 0x17 */ 0.39685f, // PITCH_AFLAT2
/* 0x18 */ 0.420448f, // PITCH_A2
/* 0x19 */ 0.445449f, // PITCH_BFLAT2
/* 0x1A */ 0.471937f, // PITCH_B2
/* 0x1B */ 0.5f, // PITCH_C3
/* 0x1C */ 0.529732f, // PITCH_DFLAT3
/* 0x1D */ 0.561231f, // PITCH_D3
/* 0x1E */ 0.594604f, // PITCH_EFLAT3
/* 0x1F */ 0.629961f, // PITCH_E3
/* 0x20 */ 0.66742f, // PITCH_F3
/* 0x21 */ 0.707107f, // PITCH_GFLAT3
/* 0x22 */ 0.749154f, // PITCH_G3
/* 0x23 */ 0.793701f, // PITCH_AFLAT3
/* 0x24 */ 0.840897f, // PITCH_A3
/* 0x25 */ 0.890899f, // PITCH_BFLAT3
/* 0x26 */ 0.943875f, // PITCH_B3
/* 0x27 */ 1.0f, // PITCH_C4 (Middle C)
/* 0x28 */ 1.059463f, // PITCH_DFLAT4
/* 0x29 */ 1.122462f, // PITCH_D4
/* 0x2A */ 1.189207f, // PITCH_EFLAT4
/* 0x2B */ 1.259921f, // PITCH_E4
/* 0x2C */ 1.33484f, // PITCH_F4
/* 0x2D */ 1.414214f, // PITCH_GFLAT4
/* 0x2E */ 1.498307f, // PITCH_G4
/* 0x2F */ 1.587401f, // PITCH_AFLAT4
/* 0x30 */ 1.681793f, // PITCH_A4
/* 0x31 */ 1.781798f, // PITCH_BFLAT4
/* 0x32 */ 1.887749f, // PITCH_B4
/* 0x33 */ 2.0f, // PITCH_C5
/* 0x34 */ 2.118926f, // PITCH_DFLAT5
/* 0x35 */ 2.244924f, // PITCH_D5
/* 0x36 */ 2.378414f, // PITCH_EFLAT5
/* 0x37 */ 2.519842f, // PITCH_E5
/* 0x38 */ 2.66968f, // PITCH_F5
/* 0x39 */ 2.828428f, // PITCH_GFLAT5
/* 0x3A */ 2.996615f, // PITCH_G5
/* 0x3B */ 3.174803f, // PITCH_AFLAT5
/* 0x3C */ 3.363586f, // PITCH_A5
/* 0x3D */ 3.563596f, // PITCH_BFLAT5
/* 0x3E */ 3.775498f, // PITCH_B5
/* 0x3F */ 4.0f, // PITCH_C6
/* 0x40 */ 4.237853f, // PITCH_DFLAT6
/* 0x41 */ 4.489849f, // PITCH_D6
/* 0x42 */ 4.756829f, // PITCH_EFLAT6
/* 0x43 */ 5.039685f, // PITCH_E6
/* 0x44 */ 5.33936f, // PITCH_F6
/* 0x45 */ 5.656855f, // PITCH_GFLAT6
/* 0x46 */ 5.993229f, // PITCH_G6
/* 0x47 */ 6.349606f, // PITCH_AFLAT6
/* 0x48 */ 6.727173f, // PITCH_A6
/* 0x49 */ 7.127192f, // PITCH_BFLAT6
/* 0x4A */ 7.550996f, // PITCH_B6
/* 0x4B */ 8.0f, // PITCH_C7
/* 0x4C */ 8.475705f, // PITCH_DFLAT7
/* 0x4D */ 8.979697f, // PITCH_D7
/* 0x4E */ 9.513658f, // PITCH_EFLAT7
/* 0x4F */ 10.07937f, // PITCH_E7
/* 0x50 */ 10.6787205f, // PITCH_F7
/* 0x51 */ 11.31371f, // PITCH_GFLAT7
/* 0x52 */ 11.986459f, // PITCH_G7
/* 0x53 */ 12.699211f, // PITCH_AFLAT7
/* 0x54 */ 13.454346f, // PITCH_A7
/* 0x55 */ 14.254383f, // PITCH_BFLAT7
/* 0x56 */ 15.101993f, // PITCH_B7
/* 0x57 */ 16.0f, // PITCH_C8
/* 0x58 */ 16.95141f, // PITCH_DFLAT8
/* 0x59 */ 17.959395f, // PITCH_D8
/* 0x5A */ 19.027315f, // PITCH_EFLAT8
/* 0x5B */ 20.15874f, // PITCH_E8
/* 0x5C */ 21.35744f, // PITCH_F8
/* 0x5D */ 22.62742f, // PITCH_GFLAT8
/* 0x5E */ 23.972918f, // PITCH_G8
/* 0x5F */ 25.398422f, // PITCH_AFLAT8
/* 0x60 */ 26.908691f, // PITCH_A8
/* 0x61 */ 28.508766f, // PITCH_BFLAT8
/* 0x62 */ 30.203985f, // PITCH_B8
/* 0x63 */ 32.0f, // PITCH_C9
/* 0x64 */ 33.90282f, // PITCH_DFLAT9
/* 0x65 */ 35.91879f, // PITCH_D9
/* 0x66 */ 38.05463f, // PITCH_EFLAT9
/* 0x67 */ 40.31748f, // PITCH_E9
/* 0x68 */ 42.71488f, // PITCH_F9
/* 0x69 */ 45.25484f, // PITCH_GFLAT9
/* 0x6A */ 47.945835f, // PITCH_G9
/* 0x6B */ 50.796845f, // PITCH_AFLAT9
/* 0x6C */ 53.817383f, // PITCH_A9
/* 0x6D */ 57.017532f, // PITCH_BFLAT9
/* 0x6E */ 60.40797f, // PITCH_B9
/* 0x6F */ 64.0f, // PITCH_C10
/* 0x70 */ 67.80564f, // PITCH_DFLAT10
/* 0x71 */ 71.83758f, // PITCH_D10
/* 0x72 */ 76.10926f, // PITCH_EFLAT10
/* 0x73 */ 80.63496f, // PITCH_E10
/* 0x74 */ 85.42976f, // PITCH_F10
/* 0x75 */ 0.055681f, // PITCH_BFLATNEG1
/* 0x76 */ 0.058992f, // PITCH_BNEG1
/* 0x77 */ 0.0625f, // PITCH_C0
/* 0x78 */ 0.066216f, // PITCH_DFLAT0
/* 0x79 */ 0.070154f, // PITCH_D0
/* 0x7A */ 0.074325f, // PITCH_EFLAT0
/* 0x7B */ 0.078745f, // PITCH_E0
/* 0x7C */ 0.083427f, // PITCH_F0
/* 0x7D */ 0.088388f, // PITCH_GFLAT0
/* 0x7E */ 0.093644f, // PITCH_G0
/* 0x7F */ 0.099213f, // PITCH_AFLAT0
};
u8 gDefaultShortNoteVelocityTable[] = {

View file

@ -1098,7 +1098,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
gAudioContext.aiBufLengths[i] = 0xA0;
}
gAudioContext.totalTaskCnt = 0;
gAudioContext.totalTaskCount = 0;
gAudioContext.rspTaskIdx = 0;
gAudioContext.curAIBufIdx = 0;
gAudioContext.soundMode = 0;
@ -1162,7 +1162,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) {
AudioHeap_AllocPoolInit(&gAudioContext.permanentPool, temp_v0_3, D_8014A6C4.permanentPoolSize);
gAudioContextInitalized = true;
osSendMesg(gAudioContext.taskStartQueueP, (OSMesg)gAudioContext.totalTaskCnt, OS_MESG_NOBLOCK);
osSendMesg(gAudioContext.taskStartQueueP, (OSMesg)gAudioContext.totalTaskCount, OS_MESG_NOBLOCK);
}
void AudioLoad_InitSlowLoads(void) {

View file

@ -716,8 +716,8 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
}
}
temp_f2 = gNoteFrequencies[semitone2] * tuning;
temp_f14 = gNoteFrequencies[layer->portamentoTargetNote] * tuning;
temp_f2 = gPitchFrequencies[semitone2] * tuning;
temp_f14 = gPitchFrequencies[layer->portamentoTargetNote] * tuning;
switch (PORTAMENTO_MODE(*portamento)) {
case PORTAMENTO_MODE_1:
@ -767,10 +767,10 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
sound = Audio_InstrumentGetSound(instrument, semitone);
sameSound = (sound == layer->sound);
layer->sound = sound;
layer->freqScale = gNoteFrequencies[semitone2] * sound->tuning;
layer->freqScale = gPitchFrequencies[semitone2] * sound->tuning;
} else {
layer->sound = NULL;
layer->freqScale = gNoteFrequencies[semitone2];
layer->freqScale = gPitchFrequencies[semitone2];
if (instOrWave >= 0xC0) {
layer->sound = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].sound;
}

View file

@ -35,6 +35,9 @@ AudioTask* func_800E4FE0(void) {
return func_800E5000();
}
/**
* This is Audio_Update for the audio thread
*/
AudioTask* func_800E5000(void) {
static s32 sMaxAbiCmdCnt = 0x80;
static AudioTask* sWaitingAudioTask = NULL;
@ -50,13 +53,13 @@ AudioTask* func_800E5000(void) {
s32 sp48;
s32 i;
gAudioContext.totalTaskCnt++;
if (gAudioContext.totalTaskCnt % (gAudioContext.audioBufferParameters.specUnk4) != 0) {
gAudioContext.totalTaskCount++;
if (gAudioContext.totalTaskCount % (gAudioContext.audioBufferParameters.specUnk4) != 0) {
if (D_801755D0 != NULL) {
D_801755D0();
}
if ((gAudioContext.totalTaskCnt % gAudioContext.audioBufferParameters.specUnk4) + 1 ==
if ((gAudioContext.totalTaskCount % gAudioContext.audioBufferParameters.specUnk4) + 1 ==
gAudioContext.audioBufferParameters.specUnk4) {
return sWaitingAudioTask;
} else {
@ -64,7 +67,7 @@ AudioTask* func_800E5000(void) {
}
}
osSendMesg(gAudioContext.taskStartQueueP, (OSMesg)gAudioContext.totalTaskCnt, OS_MESG_NOBLOCK);
osSendMesg(gAudioContext.taskStartQueueP, (OSMesg)gAudioContext.totalTaskCount, OS_MESG_NOBLOCK);
gAudioContext.rspTaskIdx ^= 1;
gAudioContext.curAIBufIdx++;
gAudioContext.curAIBufIdx %= 3;
@ -163,9 +166,9 @@ AudioTask* func_800E5000(void) {
gAudioContext.curAbiCmdBuf =
AudioSynth_Update(gAudioContext.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioContext.aiBufLengths[index]);
gAudioContext.audioRandom = (gAudioContext.audioRandom + gAudioContext.totalTaskCnt) * osGetCount();
gAudioContext.audioRandom = (gAudioContext.audioRandom + gAudioContext.totalTaskCount) * osGetCount();
gAudioContext.audioRandom =
gAudioContext.aiBuffers[index][gAudioContext.totalTaskCnt & 0xFF] + gAudioContext.audioRandom;
gAudioContext.aiBuffers[index][gAudioContext.totalTaskCount & 0xFF] + gAudioContext.audioRandom;
gWaveSamples[8] = (s16*)(((u8*)func_800E4FE0) + (gAudioContext.audioRandom & 0xFFF0));
index = gAudioContext.rspTaskIdx;
@ -809,7 +812,7 @@ s32 func_800E66C0(s32 arg0) {
u32 Audio_NextRandom(void) {
static u32 audRand = 0x12345678;
audRand = ((osGetCount() + 0x1234567) * (audRand + gAudioContext.totalTaskCnt));
audRand = ((osGetCount() + 0x1234567) * (audRand + gAudioContext.totalTaskCount));
audRand += gAudioContext.audioRandom;
return audRand;
}

File diff suppressed because it is too large Load diff

View file

@ -533,8 +533,8 @@ void func_80111070(void) {
VREG(25) = 0;
VREG(26) = 0;
VREG(27) = 0;
R_OCARINA_NOTES_XPOS = 98;
R_OCARINA_NOTES_XPOS_OFFSET = 18;
R_OCARINA_BUTTONS_XPOS = 98;
R_OCARINA_BUTTONS_XPOS_OFFSET = 18;
VREG(30) = 0;
VREG(31) = 0;
VREG(32) = 0;
@ -551,13 +551,13 @@ void func_80111070(void) {
VREG(42) = 250;
VREG(43) = 440;
VREG(44) = 10;
R_OCARINA_NOTES_YPOS(0) = 190;
R_OCARINA_NOTES_YPOS(1) = 184;
R_OCARINA_NOTES_YPOS(2) = 176;
R_OCARINA_NOTES_YPOS(3) = 172;
R_OCARINA_NOTES_YPOS(4) = 170;
R_OCARINA_BUTTONS_YPOS(0) = 190;
R_OCARINA_BUTTONS_YPOS(1) = 184;
R_OCARINA_BUTTONS_YPOS(2) = 176;
R_OCARINA_BUTTONS_YPOS(3) = 172;
R_OCARINA_BUTTONS_YPOS(4) = 170;
VREG(50) = 30;
R_OCARINA_NOTES_YPOS_OFFSET = 0;
R_OCARINA_BUTTONS_YPOS_OFFSET = 0;
VREG(52) = -16;
VREG(53) = 230;
VREG(54) = 230;

View file

@ -420,7 +420,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase*
}
break;
case 35:
func_800EE824();
AudioOcarina_PlayLongScarecrowAfterCredits();
csCtx->frames = cmd->startFrame - 1;
break;
}

File diff suppressed because it is too large Load diff

View file

@ -47,8 +47,8 @@ typedef struct {
/* 0x0F18 */ char unk_F18[0x04];
/* 0x0F1C */ u32 worldMapAreaData; // "area_arrival"
/* 0x0F20 */ char unk_F20[0x4];
/* 0x0F24 */ u8 scarecrowCustomSongSet;
/* 0x0F25 */ u8 scarecrowCustomSong[0x360];
/* 0x0F24 */ u8 scarecrowLongSongSet;
/* 0x0F25 */ u8 scarecrowLongSong[0x360];
/* 0x1285 */ char unk_1285[0x24];
/* 0x12A9 */ u8 scarecrowSpawnSongSet;
/* 0x12AA */ u8 scarecrowSpawnSong[0x80];
@ -393,14 +393,14 @@ void Sram_OpenSave(SramContext* sramCtx) {
gSaveContext.health = 0x30;
}
if (gSaveContext.scarecrowCustomSongSet) {
if (gSaveContext.scarecrowLongSongSet) {
osSyncPrintf(VT_FGCOL(BLUE));
osSyncPrintf("\n====================================================================\n");
MemCpy(gScarecrowCustomSongPtr, gSaveContext.scarecrowCustomSong, sizeof(gSaveContext.scarecrowCustomSong));
MemCpy(gScarecrowLongSongPtr, gSaveContext.scarecrowLongSong, sizeof(gSaveContext.scarecrowLongSong));
ptr = (u8*)gScarecrowCustomSongPtr;
for (i = 0; i < ARRAY_COUNT(gSaveContext.scarecrowCustomSong); i++, ptr++) {
ptr = (u8*)gScarecrowLongSongPtr;
for (i = 0; i < ARRAY_COUNT(gSaveContext.scarecrowLongSong); i++, ptr++) {
osSyncPrintf("%d, ", *ptr);
}

View file

@ -208,7 +208,7 @@ static u8 sJumpOrder[] = {
};
static u8 sOcarinaNotes[] = {
OCARINA_NOTE_A, OCARINA_NOTE_C_DOWN, OCARINA_NOTE_C_RIGHT, OCARINA_NOTE_C_LEFT, OCARINA_NOTE_C_UP,
OCARINA_BTN_A, OCARINA_BTN_C_DOWN, OCARINA_BTN_C_RIGHT, OCARINA_BTN_C_LEFT, OCARINA_BTN_C_UP,
};
void EnFr_OrientUnderwater(EnFr* this) {
@ -696,21 +696,22 @@ void EnFr_ListeningToOcarinaNotes(EnFr* this, GlobalContext* globalCtx) {
case OCARINA_MODE_04:
EnFr_OcarinaMistake(this, globalCtx);
break;
case OCARINA_MODE_01: // Ocarina note played, but no song played
switch (globalCtx->msgCtx.lastOcaNoteIdx) { // Jumping frogs in open ocarina based on ocarina note played
case OCARINA_NOTE_A:
case OCARINA_MODE_01: // Ocarina note played, but no song played
switch (globalCtx->msgCtx.lastOcarinaButtonIndex) {
// Jumping frogs in open ocarina based on ocarina note played
case OCARINA_BTN_A:
EnFr_SetupJumpingUp(this, FROG_BLUE);
break;
case OCARINA_NOTE_C_DOWN:
case OCARINA_BTN_C_DOWN:
EnFr_SetupJumpingUp(this, FROG_YELLOW);
break;
case OCARINA_NOTE_C_RIGHT:
case OCARINA_BTN_C_RIGHT:
EnFr_SetupJumpingUp(this, FROG_RED);
break;
case OCARINA_NOTE_C_LEFT:
case OCARINA_BTN_C_LEFT:
EnFr_SetupJumpingUp(this, FROG_PURPLE);
break;
case OCARINA_NOTE_C_UP:
case OCARINA_BTN_C_UP:
EnFr_SetupJumpingUp(this, FROG_WHITE);
break;
}
@ -834,7 +835,7 @@ s32 EnFr_IsFrogSongComplete(EnFr* this, GlobalContext* globalCtx) {
MessageContext* msgCtx = &globalCtx->msgCtx;
u8 ocarinaNoteIndex;
if (this->ocarinaNote == (*msgCtx).lastOcaNoteIdx) { // required to match, possibly an array?
if (this->ocarinaNote == (*msgCtx).lastOcarinaButtonIndex) { // required to match, possibly an array?
this->ocarinaNoteIndex++;
ocarinaNoteIndex = this->ocarinaNoteIndex;
if (1) {}
@ -856,7 +857,7 @@ void EnFr_OcarinaMistake(EnFr* this, GlobalContext* globalCtx) {
Message_CloseTextbox(globalCtx);
this->reward = GI_NONE;
func_80078884(NA_SE_SY_OCARINA_ERROR);
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
sEnFrPointers.flags = 12;
EnFr_DeactivateButterfly();
this->actionFunc = EnFr_Deactivate;
@ -889,20 +890,20 @@ void EnFr_ContinueFrogSong(EnFr* this, GlobalContext* globalCtx) {
if (globalCtx->msgCtx.msgMode == MSGMODE_FROGS_WAITING) {
globalCtx->msgCtx.msgMode = MSGMODE_FROGS_START;
switch (globalCtx->msgCtx.lastOcaNoteIdx) {
case OCARINA_NOTE_A:
switch (globalCtx->msgCtx.lastOcarinaButtonIndex) {
case OCARINA_BTN_A:
EnFr_SetupJumpingUp(this, FROG_BLUE);
break;
case OCARINA_NOTE_C_DOWN:
case OCARINA_BTN_C_DOWN:
EnFr_SetupJumpingUp(this, FROG_YELLOW);
break;
case OCARINA_NOTE_C_RIGHT:
case OCARINA_BTN_C_RIGHT:
EnFr_SetupJumpingUp(this, FROG_RED);
break;
case OCARINA_NOTE_C_LEFT:
case OCARINA_BTN_C_LEFT:
EnFr_SetupJumpingUp(this, FROG_PURPLE);
break;
case OCARINA_NOTE_C_UP:
case OCARINA_BTN_C_UP:
EnFr_SetupJumpingUp(this, FROG_WHITE);
}
if (EnFr_IsFrogSongComplete(this, globalCtx)) {
@ -921,7 +922,7 @@ void EnFr_SetupReward(EnFr* this, GlobalContext* globalCtx, u8 unkCondition) {
func_80078884(NA_SE_SY_CORRECT_CHIME);
}
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
this->actionFunc = EnFr_PrintTextBox;
}

View file

@ -203,7 +203,8 @@ void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx) {
// if dialog state is 2, start song demonstration
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
this->behaviorFlags &= ~FU_WAIT;
Audio_OcaSetInstrument(4); // seems to be related to setting instrument type
// Ocarina is set to harp here but is immediately overwritten to the grind organ in the message system
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_HARP);
func_8010BD58(globalCtx, OCARINA_ACTION_TEACH_STORMS);
this->actionFunc = EnFu_WaitForPlayback;
}

View file

@ -92,7 +92,7 @@ void func_80A8F28C(EnKakasi* this) {
}
void func_80A8F320(EnKakasi* this, GlobalContext* globalCtx, s16 arg) {
s16 ocarinaNote = globalCtx->msgCtx.lastOcaNoteIdx;
s16 ocarinaNote = globalCtx->msgCtx.lastOcarinaButtonIndex;
s16 currentFrame;
if (arg != 0) {
@ -105,30 +105,30 @@ void func_80A8F320(EnKakasi* this, GlobalContext* globalCtx, s16 arg) {
ocarinaNote = this->unk_1A6;
}
switch (ocarinaNote) {
case OCARINA_NOTE_A:
case OCARINA_BTN_A:
this->unk_19A++;
if (this->unk_1A4 == 0) {
this->unk_1A4 = 1;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_KAKASHI_ROLL);
}
break;
case OCARINA_NOTE_C_DOWN:
case OCARINA_BTN_C_DOWN:
this->unk_19A++;
this->unk_1B8 = 1.0f;
break;
case OCARINA_NOTE_C_RIGHT:
case OCARINA_BTN_C_RIGHT:
this->unk_19A++;
if (this->unk_1AC == 0) {
this->unk_1AC = 0x1388;
}
break;
case OCARINA_NOTE_C_LEFT:
case OCARINA_BTN_C_LEFT:
this->unk_19A++;
if (this->unk_1A8 == 0) {
this->unk_1A8 = 0x1388;
}
break;
case OCARINA_NOTE_C_UP:
case OCARINA_BTN_C_UP:
this->unk_19A++;
this->unk_1B8 = 2.0f;
break;
@ -178,13 +178,13 @@ void func_80A8F660(EnKakasi* this, GlobalContext* globalCtx) {
this->unk_196 = TEXT_STATE_DONE;
if (!LINK_IS_ADULT) {
this->unk_194 = false;
if (gSaveContext.scarecrowCustomSongSet) {
if (gSaveContext.scarecrowLongSongSet) {
this->actor.textId = 0x407A;
this->unk_196 = TEXT_STATE_EVENT;
}
} else {
this->unk_194 = true;
if (gSaveContext.scarecrowCustomSongSet) {
if (gSaveContext.scarecrowLongSongSet) {
this->actor.textId = 0x4079;
this->unk_196 = TEXT_STATE_EVENT;
}
@ -341,7 +341,7 @@ void EnKakasi_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (BREG(3) != 0) {
osSyncPrintf("\n\n");
// "flag!"
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ フラグ! ☆☆☆☆☆ %d\n" VT_RST, gSaveContext.scarecrowCustomSongSet);
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ フラグ! ☆☆☆☆☆ %d\n" VT_RST, gSaveContext.scarecrowLongSongSet);
}
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount,

View file

@ -96,7 +96,7 @@ void func_80A90E28(EnKakasi3* this) {
void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) {
s16 currentFrame;
s16 ocarinaNote = globalCtx->msgCtx.lastOcaNoteIdx;
s16 ocarinaNote = globalCtx->msgCtx.lastOcarinaButtonIndex;
if (arg != 0) {
if (this->unk_19C[3] == 0) {
@ -108,30 +108,30 @@ void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) {
ocarinaNote = this->unk_1A6;
}
switch (ocarinaNote) {
case OCARINA_NOTE_A:
case OCARINA_BTN_A:
this->unk_19A++;
if (this->unk_1A4 == 0) {
this->unk_1A4 = 1;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_KAKASHI_ROLL);
}
break;
case OCARINA_NOTE_C_DOWN:
case OCARINA_BTN_C_DOWN:
this->unk_19A++;
this->unk_1B8 = 1.0f;
break;
case OCARINA_NOTE_C_RIGHT:
case OCARINA_BTN_C_RIGHT:
this->unk_19A++;
if (this->unk_1AE == 0x0) {
this->unk_1AE = 0x1388;
}
break;
case OCARINA_NOTE_C_LEFT:
case OCARINA_BTN_C_LEFT:
this->unk_19A++;
if (this->unk_1AA == 0x0) {
this->unk_1AA = 0x1388;
}
break;
case OCARINA_NOTE_C_UP:
case OCARINA_BTN_C_UP:
this->unk_19A++;
this->unk_1B8 = 2.0f;
break;
@ -269,7 +269,7 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) {
void func_80A915B8(EnKakasi3* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) {
Message_CloseTextbox(globalCtx);
func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_RECORDING);
func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_SPAWN_RECORDING);
this->actionFunc = func_80A91620;
}
}
@ -312,7 +312,7 @@ void func_80A91760(EnKakasi3* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
if (this->dialogState == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) {
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_PLAYBACK);
func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK);
this->actionFunc = func_80A917FC;
this->camId = OnePointCutscene_Init(globalCtx, 2280, -99, &this->actor, MAIN_CAM);
}
@ -333,7 +333,7 @@ void func_80A917FC(EnKakasi3* this, GlobalContext* globalCtx) {
void func_80A9187C(EnKakasi3* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT && Message_ShouldAdvance(globalCtx)) {
Message_CloseTextbox(globalCtx);
func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_SCARECROW);
func_8010BD58(globalCtx, OCARINA_ACTION_CHECK_SCARECROW_SPAWN);
this->actionFunc = func_80A918E4;
}
}

View file

@ -367,7 +367,7 @@ void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) {
void func_80AA106C(EnMa1* this, GlobalContext* globalCtx) {
GET_PLAYER(globalCtx)->stateFlags2 |= PLAYER_STATE2_23;
if (this->unk_1E8.unk_00 == 2) {
Audio_OcaSetInstrument(2);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_MALON);
func_8010BD58(globalCtx, OCARINA_ACTION_TEACH_EPONA);
this->actor.flags &= ~ACTOR_FLAG_16;
this->actionFunc = func_80AA10EC;

View file

@ -1440,7 +1440,7 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) {
sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->minigameState =
SKULL_KID_OCARINA_PLAY_NOTES;
}
Message_UpdateOcarinaGame(globalCtx);
Message_UpdateOcarinaMemoryGame(globalCtx);
}
break;
case MSGMODE_MEMORY_GAME_RIGHT_SKULLKID_WAIT:
@ -1448,7 +1448,7 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) {
sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->minigameState = SKULL_KID_OCARINA_WAIT;
}
if (!Audio_IsSfxPlaying(NA_SE_SY_METRONOME)) {
Message_UpdateOcarinaGame(globalCtx);
Message_UpdateOcarinaMemoryGame(globalCtx);
this->songFailTimer = 160;
}
break;
@ -1472,8 +1472,8 @@ void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) {
SKULL_KID_OCARINA_PLAY_NOTES;
}
this->songFailTimer = 160;
Audio_OcaSetInstrument(6); // related instrument sound (flute?)
Audio_OcaSetSongPlayback(OCARINA_SONG_MEMORY_GAME + 1, 1);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_FLUTE);
AudioOcarina_SetPlaybackSong(OCARINA_SONG_MEMORY_GAME + 1, 1);
globalCtx->msgCtx.msgMode = MSGMODE_MEMORY_GAME_LEFT_SKULLKID_PLAYING;
globalCtx->msgCtx.stateTimer = 2;
}

View file

@ -2779,7 +2779,7 @@ s32 func_80835C58(GlobalContext* globalCtx, Player* this, PlayerFunc674 func, s3
}
if (func_8084E3C4 == this->func_674) {
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
this->stateFlags2 &= ~(PLAYER_STATE2_24 | PLAYER_STATE2_25);
} else if (func_808507F4 == this->func_674) {
func_80832340(globalCtx, this);

View file

@ -187,9 +187,9 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
}
D_8082A11C = 0;
Audio_OcaSetInstrument(1);
func_800ECC04((1 << pauseCtx->ocarinaSongIdx) + 0x8000);
pauseCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT);
AudioOcarina_Start((1 << pauseCtx->ocarinaSongIdx) + 0x8000);
pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
pauseCtx->ocarinaStaff->pos = 0;
pauseCtx->ocarinaStaff->state = 0xFF;
VREG(21) = -62;
@ -198,13 +198,13 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
VREG(24) = -46;
VREG(25) = -41;
pauseCtx->unk_1E4 = 8;
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
}
}
} else if (pauseCtx->unk_1E4 == 5) {
if ((pauseCtx->stickRelX != 0) || (pauseCtx->stickRelY != 0)) {
pauseCtx->unk_1E4 = 0;
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
}
} else if (pauseCtx->unk_1E4 == 8) {
if (CHECK_BTN_ALL(input->press.button, BTN_A) && (sp216 >= QUEST_SONG_MINUET) &&
@ -274,12 +274,12 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
VREG(24) = -46;
VREG(25) = -41;
sp216 = pauseCtx->cursorSlot[PAUSE_QUEST];
Audio_OcaSetInstrument(1);
Audio_OcaSetInstrument(1);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT);
pauseCtx->ocarinaSongIdx = gOcarinaSongItemMap[sp216 - QUEST_SONG_MINUET];
Audio_OcaSetSongPlayback(pauseCtx->ocarinaSongIdx + 1, 1);
AudioOcarina_SetPlaybackSong(pauseCtx->ocarinaSongIdx + 1, 1);
pauseCtx->unk_1E4 = 2;
pauseCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
pauseCtx->ocarinaStaff->pos = 0;
sp216 = pauseCtx->cursorSlot[PAUSE_QUEST];
KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx);
@ -471,12 +471,12 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
}
if (pauseCtx->unk_1E4 == 2) {
pauseCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
if (pauseCtx->ocarinaStaff->pos != 0) {
if (D_8082A11C + 1 == pauseCtx->ocarinaStaff->pos) {
D_8082A11C++;
D_8082A124[pauseCtx->ocarinaStaff->pos - 1] = pauseCtx->ocarinaStaff->noteIdx;
D_8082A124[pauseCtx->ocarinaStaff->pos - 1] = pauseCtx->ocarinaStaff->buttonIndex;
}
for (sp218 = 0, phi_s3 = 0; sp218 < 8; sp218++, phi_s3 += 4, sp21A += 4) {
@ -517,11 +517,11 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
}
} else if (((pauseCtx->unk_1E4 >= 4) && (pauseCtx->unk_1E4 <= 6)) || (pauseCtx->unk_1E4 == 8)) {
sp224 = pauseCtx->ocarinaSongIdx;
sp226 = gOcarinaSongNotes[sp224].len;
sp226 = gOcarinaSongButtons[sp224].numButtons;
for (sp218 = sp21A, phi_s3 = 0; phi_s3 < sp226; phi_s3++, sp21A += 4) {
pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] =
VREG(21 + gOcarinaSongNotes[sp224].notesIdx[phi_s3]);
VREG(21 + gOcarinaSongButtons[sp224].buttonsIndex[phi_s3]);
pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] =
pauseCtx->questVtx[sp21A + 0].v.ob[1] - 12;
@ -529,7 +529,7 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
gDPPipeSync(POLY_OPA_DISP++);
if (pauseCtx->unk_1E4 == 8) {
if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == 0) {
if (gOcarinaSongButtons[sp224].buttonsIndex[phi_s3] == OCARINA_BTN_A) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, 200);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, 200);
@ -542,21 +542,21 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[gOcarinaSongNotes[sp224].notesIdx[phi_s3]], G_IM_FMT_IA,
G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[gOcarinaSongButtons[sp224].buttonsIndex[phi_s3]],
G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
}
if (pauseCtx->unk_1E4 != 8) {
pauseCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
pauseCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
if (pauseCtx->ocarinaStaff->pos != 0) {
if (D_8082A11C == (pauseCtx->ocarinaStaff->pos - 1)) {
if ((pauseCtx->ocarinaStaff->noteIdx >= OCARINA_NOTE_A) &&
(pauseCtx->ocarinaStaff->noteIdx <= OCARINA_NOTE_C_UP)) {
D_8082A124[pauseCtx->ocarinaStaff->pos - 1] = pauseCtx->ocarinaStaff->noteIdx;
if ((pauseCtx->ocarinaStaff->buttonIndex >= OCARINA_BTN_A) &&
(pauseCtx->ocarinaStaff->buttonIndex <= OCARINA_BTN_C_UP)) {
D_8082A124[pauseCtx->ocarinaStaff->pos - 1] = pauseCtx->ocarinaStaff->buttonIndex;
D_8082A124[pauseCtx->ocarinaStaff->pos] = 0xFF;
D_8082A11C++;
}
@ -608,9 +608,9 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx
}
D_8082A11C = 0;
Audio_OcaSetInstrument(1);
func_800ECC04((1 << pauseCtx->ocarinaSongIdx) + 0x8000);
pauseCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT);
AudioOcarina_Start((1 << pauseCtx->ocarinaSongIdx) + 0x8000);
pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
pauseCtx->ocarinaStaff->pos = 0;
pauseCtx->ocarinaStaff->state = 0xFE;
pauseCtx->unk_1E4 = 5;

View file

@ -2927,10 +2927,10 @@ void KaleidoScope_Update(GlobalContext* globalCtx) {
break;
case 2:
pauseCtx->ocarinaStaff = Audio_OcaGetDisplayingStaff();
pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff();
if (pauseCtx->ocarinaStaff->state == 0) {
pauseCtx->unk_1E4 = 4;
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
}
break;
@ -2942,10 +2942,10 @@ void KaleidoScope_Update(GlobalContext* globalCtx) {
break;
case 5:
pauseCtx->ocarinaStaff = Audio_OcaGetPlayingStaff();
pauseCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff();
if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
Interface_SetDoAction(globalCtx, DO_ACTION_NONE);
pauseCtx->state = 0x12;
WREG(2) = -6240;
@ -2953,7 +2953,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) {
pauseCtx->unk_1E4 = 0;
break;
} else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
pauseCtx->unk_1E4 = 0;
pauseCtx->mode = 0;
pauseCtx->promptChoice = 0;
@ -2986,7 +2986,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) {
if (D_8082B25C == 0) {
pauseCtx->unk_1E4 = D_8082B258;
if (pauseCtx->unk_1E4 == 0) {
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
}
}
break;
@ -2996,14 +2996,14 @@ void KaleidoScope_Update(GlobalContext* globalCtx) {
case 8:
if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
Interface_SetDoAction(globalCtx, DO_ACTION_NONE);
pauseCtx->state = 0x12;
WREG(2) = -6240;
func_800F64E0(0);
pauseCtx->unk_1E4 = 0;
} else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
Audio_OcaSetInstrument(0);
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
pauseCtx->unk_1E4 = 0;
pauseCtx->mode = 0;
pauseCtx->promptChoice = 0;

View file

@ -177,12 +177,12 @@ ocarina_action_ids = {
0x25: "OCARINA_ACTION_CHECK_SUNS",
0x26: "OCARINA_ACTION_CHECK_TIME",
0x27: "OCARINA_ACTION_CHECK_STORMS",
0x28: "OCARINA_ACTION_CHECK_SCARECROW",
0x28: "OCARINA_ACTION_CHECK_SCARECROW_SPAWN",
0x29: "OCARINA_ACTION_FREE_PLAY_DONE",
0x2A: "OCARINA_ACTION_SCARECROW_LONG_RECORDING",
0x2B: "OCARINA_ACTION_SCARECROW_LONG_PLAYBACK",
0x2C: "OCARINA_ACTION_SCARECROW_RECORDING",
0x2D: "OCARINA_ACTION_SCARECROW_PLAYBACK",
0x2C: "OCARINA_ACTION_SCARECROW_SPAWN_RECORDING",
0x2D: "OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK",
0x2E: "OCARINA_ACTION_MEMORY_GAME",
0x2F: "OCARINA_ACTION_FROGS",
0x30: "OCARINA_ACTION_CHECK_NOWARP",