mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-13 11:24:40 +00:00
Merge branch 'master' into doc_pause_menu
This commit is contained in:
commit
4eae3ca126
157 changed files with 1717 additions and 1640 deletions
|
@ -124,7 +124,7 @@ f32 Audio_GetVibratoFreqScale(VibratoState* vib) {
|
|||
return 1.0f;
|
||||
}
|
||||
|
||||
//! @bug this probably meant to compare with gAudioContext.sequenceChannelNone.
|
||||
//! @bug this probably meant to compare with gAudioCtx.sequenceChannelNone.
|
||||
//! -1 isn't used as a channel pointer anywhere else.
|
||||
if (channel != ((SequenceChannel*)(-1))) {
|
||||
if (vib->extentChangeTimer) {
|
||||
|
@ -264,7 +264,7 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) {
|
|||
break;
|
||||
|
||||
default:
|
||||
adsr->delay *= gAudioContext.audioBufferParameters.updatesPerFrameScaled;
|
||||
adsr->delay *= gAudioCtx.audioBufferParameters.updatesPerFrameScaled;
|
||||
if (adsr->delay == 0) {
|
||||
adsr->delay = 1;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
#include "global.h"
|
||||
|
||||
u8 D_8016F0E0[0xA0]; // unused
|
||||
AudioContext gAudioContext;
|
||||
AudioContext gAudioCtx;
|
||||
void (*D_801755D0)(void);
|
||||
s32 D_801755D8[3]; // unused
|
||||
|
||||
|
@ -17,7 +17,7 @@ const s16 D_8014A6C0[] = {
|
|||
#define SFX_SOUNDFONT_2_SIZE 0x17B0
|
||||
|
||||
// Sizes of everything on the init pool
|
||||
#define AI_BUFFERS_SIZE (AIBUF_SIZE * ARRAY_COUNT(gAudioContext.aiBuffers))
|
||||
#define AI_BUFFERS_SIZE (AIBUF_SIZE * ARRAY_COUNT(gAudioCtx.aiBuffers))
|
||||
#define SOUNDFONT_LIST_SIZE (NUM_SOUNDFONTS * sizeof(SoundFont))
|
||||
#define PERMANENT_POOL_SIZE (SFX_SEQ_SIZE + SFX_SOUNDFONT_1_SIZE + SFX_SOUNDFONT_2_SIZE)
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,7 +31,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
|
|||
sub->bitField0.stereoStrongLeft = false;
|
||||
sub->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects;
|
||||
sub->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects;
|
||||
if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_HEADSET)) {
|
||||
if (stereoHeadsetEffects && (gAudioCtx.soundMode == SOUNDMODE_HEADSET)) {
|
||||
halfPanIndex = pan >> 1;
|
||||
if (halfPanIndex > 0x3F) {
|
||||
halfPanIndex = 0x3F;
|
||||
|
@ -43,7 +43,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
|
|||
|
||||
volLeft = gHeadsetPanVolume[pan];
|
||||
volRight = gHeadsetPanVolume[0x7F - pan];
|
||||
} else if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_STEREO)) {
|
||||
} else if (stereoHeadsetEffects && (gAudioCtx.soundMode == SOUNDMODE_STEREO)) {
|
||||
strongLeft = strongRight = 0;
|
||||
sub->haasEffectLeftDelaySize = 0;
|
||||
sub->haasEffectRightDelaySize = 0;
|
||||
|
@ -80,7 +80,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
|
|||
break;
|
||||
}
|
||||
|
||||
} else if (gAudioContext.soundMode == SOUNDMODE_MONO) {
|
||||
} else if (gAudioCtx.soundMode == SOUNDMODE_MONO) {
|
||||
sub->bitField0.stereoHeadsetEffects = false;
|
||||
sub->bitField0.usesHeadsetPanEffects = false;
|
||||
volLeft = 0.707f; // approx 1/sqrt(2)
|
||||
|
@ -163,9 +163,9 @@ void Audio_ProcessNotes(void) {
|
|||
f32 scale;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
note = &gAudioContext.notes[i];
|
||||
noteSubEu2 = &gAudioContext.noteSubsEu[gAudioContext.noteSubEuOffset + i];
|
||||
for (i = 0; i < gAudioCtx.numNotes; i++) {
|
||||
note = &gAudioCtx.notes[i];
|
||||
noteSubEu2 = &gAudioCtx.noteSubsEu[gAudioCtx.noteSubEuOffset + i];
|
||||
playbackState = ¬e->playbackState;
|
||||
if (playbackState->parentLayer != NO_LAYER) {
|
||||
if ((u32)playbackState->parentLayer < 0x7FFFFFFF) {
|
||||
|
@ -174,7 +174,7 @@ void Audio_ProcessNotes(void) {
|
|||
|
||||
if (note != playbackState->parentLayer->note && playbackState->unk_04 == 0) {
|
||||
playbackState->adsr.action.s.release = true;
|
||||
playbackState->adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
playbackState->adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
|
||||
playbackState->priority = 1;
|
||||
playbackState->unk_04 = 2;
|
||||
goto out;
|
||||
|
@ -285,7 +285,7 @@ void Audio_ProcessNotes(void) {
|
|||
}
|
||||
|
||||
subAttrs.frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale;
|
||||
subAttrs.frequency *= gAudioContext.audioBufferParameters.resampleRate;
|
||||
subAttrs.frequency *= gAudioCtx.audioBufferParameters.resampleRate;
|
||||
subAttrs.velocity *= scale;
|
||||
Audio_InitNoteSub(note, noteSubEu2, &subAttrs);
|
||||
noteSubEu->bitField1.bookOffset = bookOffset;
|
||||
|
@ -315,18 +315,18 @@ Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) {
|
|||
}
|
||||
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId)) {
|
||||
gAudioContext.audioErrorFlags = fontId + 0x10000000;
|
||||
gAudioCtx.audioErrorFlags = fontId + 0x10000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (instId >= gAudioContext.soundFontList[fontId].numInstruments) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x3000000;
|
||||
if (instId >= gAudioCtx.soundFontList[fontId].numInstruments) {
|
||||
gAudioCtx.audioErrorFlags = ((fontId << 8) + instId) + 0x3000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inst = gAudioContext.soundFontList[fontId].instruments[instId];
|
||||
inst = gAudioCtx.soundFontList[fontId].instruments[instId];
|
||||
if (inst == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
|
||||
gAudioCtx.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
|
||||
return inst;
|
||||
}
|
||||
|
||||
|
@ -341,21 +341,21 @@ Drum* Audio_GetDrum(s32 fontId, s32 drumId) {
|
|||
}
|
||||
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId)) {
|
||||
gAudioContext.audioErrorFlags = fontId + 0x10000000;
|
||||
gAudioCtx.audioErrorFlags = fontId + 0x10000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (drumId >= gAudioContext.soundFontList[fontId].numDrums) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000;
|
||||
if (drumId >= gAudioCtx.soundFontList[fontId].numDrums) {
|
||||
gAudioCtx.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000;
|
||||
return NULL;
|
||||
}
|
||||
if ((u32)gAudioContext.soundFontList[fontId].drums < AUDIO_RELOCATED_ADDRESS_START) {
|
||||
if ((u32)gAudioCtx.soundFontList[fontId].drums < AUDIO_RELOCATED_ADDRESS_START) {
|
||||
return NULL;
|
||||
}
|
||||
drum = gAudioContext.soundFontList[fontId].drums[drumId];
|
||||
drum = gAudioCtx.soundFontList[fontId].drums[drumId];
|
||||
|
||||
if (drum == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x5000000;
|
||||
gAudioCtx.audioErrorFlags = ((fontId << 8) + drumId) + 0x5000000;
|
||||
}
|
||||
|
||||
return drum;
|
||||
|
@ -369,23 +369,23 @@ SoundEffect* Audio_GetSoundEffect(s32 fontId, s32 sfxId) {
|
|||
}
|
||||
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId)) {
|
||||
gAudioContext.audioErrorFlags = fontId + 0x10000000;
|
||||
gAudioCtx.audioErrorFlags = fontId + 0x10000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (sfxId >= gAudioContext.soundFontList[fontId].numSfx) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x4000000;
|
||||
if (sfxId >= gAudioCtx.soundFontList[fontId].numSfx) {
|
||||
gAudioCtx.audioErrorFlags = ((fontId << 8) + sfxId) + 0x4000000;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((u32)gAudioContext.soundFontList[fontId].soundEffects < AUDIO_RELOCATED_ADDRESS_START) {
|
||||
if ((u32)gAudioCtx.soundFontList[fontId].soundEffects < AUDIO_RELOCATED_ADDRESS_START) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
soundEffect = &gAudioContext.soundFontList[fontId].soundEffects[sfxId];
|
||||
soundEffect = &gAudioCtx.soundFontList[fontId].soundEffects[sfxId];
|
||||
|
||||
if (soundEffect == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x5000000;
|
||||
gAudioCtx.audioErrorFlags = ((fontId << 8) + sfxId) + 0x5000000;
|
||||
}
|
||||
|
||||
if (soundEffect->tunedSample.sample == NULL) {
|
||||
|
@ -406,24 +406,24 @@ s32 Audio_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, void* val
|
|||
|
||||
switch (instrumentType) {
|
||||
case 0:
|
||||
if (index >= gAudioContext.soundFontList[fontId].numDrums) {
|
||||
if (index >= gAudioCtx.soundFontList[fontId].numDrums) {
|
||||
return -3;
|
||||
}
|
||||
gAudioContext.soundFontList[fontId].drums[index] = value;
|
||||
gAudioCtx.soundFontList[fontId].drums[index] = value;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (index >= gAudioContext.soundFontList[fontId].numSfx) {
|
||||
if (index >= gAudioCtx.soundFontList[fontId].numSfx) {
|
||||
return -3;
|
||||
}
|
||||
gAudioContext.soundFontList[fontId].soundEffects[index] = *(SoundEffect*)value;
|
||||
gAudioCtx.soundFontList[fontId].soundEffects[index] = *(SoundEffect*)value;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (index >= gAudioContext.soundFontList[fontId].numInstruments) {
|
||||
if (index >= gAudioCtx.soundFontList[fontId].numInstruments) {
|
||||
return -3;
|
||||
}
|
||||
gAudioContext.soundFontList[fontId].instruments[index] = value;
|
||||
gAudioCtx.soundFontList[fontId].instruments[index] = value;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
|
|||
if (note->playbackState.parentLayer != layer) {
|
||||
if (note->playbackState.parentLayer == NO_LAYER && note->playbackState.wantedParentLayer == NO_LAYER &&
|
||||
note->playbackState.prevParentLayer == layer && target != ADSR_STATE_DECAY) {
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
note->playbackState.adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
|
||||
note->playbackState.adsr.action.s.release = true;
|
||||
}
|
||||
return;
|
||||
|
@ -500,16 +500,16 @@ void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
|
|||
note->playbackState.prevParentLayer = note->playbackState.parentLayer;
|
||||
note->playbackState.parentLayer = NO_LAYER;
|
||||
if (target == ADSR_STATE_RELEASE) {
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
note->playbackState.adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
|
||||
note->playbackState.adsr.action.s.release = true;
|
||||
note->playbackState.unk_04 = 2;
|
||||
} else {
|
||||
note->playbackState.unk_04 = 1;
|
||||
note->playbackState.adsr.action.s.decay = true;
|
||||
if (layer->adsr.decayIndex == 0) {
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->channel->adsr.decayIndex];
|
||||
note->playbackState.adsr.fadeOutVel = gAudioCtx.adsrDecayTable[layer->channel->adsr.decayIndex];
|
||||
} else {
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->adsr.decayIndex];
|
||||
note->playbackState.adsr.fadeOutVel = gAudioCtx.adsrDecayTable[layer->adsr.decayIndex];
|
||||
}
|
||||
note->playbackState.adsr.sustain =
|
||||
((f32)(s32)(layer->channel->adsr.sustain) * note->playbackState.adsr.current) / 256.0f;
|
||||
|
@ -616,11 +616,11 @@ void Audio_InitNoteLists(NotePool* pool) {
|
|||
void Audio_InitNoteFreeList(void) {
|
||||
s32 i;
|
||||
|
||||
Audio_InitNoteLists(&gAudioContext.noteFreeLists);
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
gAudioContext.notes[i].listItem.u.value = &gAudioContext.notes[i];
|
||||
gAudioContext.notes[i].listItem.prev = NULL;
|
||||
AudioSeq_AudioListPushBack(&gAudioContext.noteFreeLists.disabled, &gAudioContext.notes[i].listItem);
|
||||
Audio_InitNoteLists(&gAudioCtx.noteFreeLists);
|
||||
for (i = 0; i < gAudioCtx.numNotes; i++) {
|
||||
gAudioCtx.notes[i].listItem.u.value = &gAudioCtx.notes[i];
|
||||
gAudioCtx.notes[i].listItem.prev = NULL;
|
||||
AudioSeq_AudioListPushBack(&gAudioCtx.noteFreeLists.disabled, &gAudioCtx.notes[i].listItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -634,22 +634,22 @@ void Audio_NotePoolClear(NotePool* pool) {
|
|||
switch (i) {
|
||||
case 0:
|
||||
source = &pool->disabled;
|
||||
dest = &gAudioContext.noteFreeLists.disabled;
|
||||
dest = &gAudioCtx.noteFreeLists.disabled;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
source = &pool->decaying;
|
||||
dest = &gAudioContext.noteFreeLists.decaying;
|
||||
dest = &gAudioCtx.noteFreeLists.decaying;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
source = &pool->releasing;
|
||||
dest = &gAudioContext.noteFreeLists.releasing;
|
||||
dest = &gAudioCtx.noteFreeLists.releasing;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
source = &pool->active;
|
||||
dest = &gAudioContext.noteFreeLists.active;
|
||||
dest = &gAudioCtx.noteFreeLists.active;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -680,22 +680,22 @@ void Audio_NotePoolFill(NotePool* pool, s32 count) {
|
|||
|
||||
switch (i) {
|
||||
case 0:
|
||||
source = &gAudioContext.noteFreeLists.disabled;
|
||||
source = &gAudioCtx.noteFreeLists.disabled;
|
||||
dest = &pool->disabled;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
source = &gAudioContext.noteFreeLists.decaying;
|
||||
source = &gAudioCtx.noteFreeLists.decaying;
|
||||
dest = &pool->decaying;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
source = &gAudioContext.noteFreeLists.releasing;
|
||||
source = &gAudioCtx.noteFreeLists.releasing;
|
||||
dest = &pool->releasing;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
source = &gAudioContext.noteFreeLists.active;
|
||||
source = &gAudioCtx.noteFreeLists.active;
|
||||
dest = &pool->active;
|
||||
break;
|
||||
}
|
||||
|
@ -805,7 +805,7 @@ void Audio_NoteReleaseAndTakeOwnership(Note* note, SequenceLayer* layer) {
|
|||
note->playbackState.wantedParentLayer = layer;
|
||||
note->playbackState.priority = layer->channel->notePriority;
|
||||
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
note->playbackState.adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
|
||||
note->playbackState.adsr.action.s.release = true;
|
||||
}
|
||||
|
||||
|
@ -899,9 +899,9 @@ Note* Audio_AllocNote(SequenceLayer* layer) {
|
|||
}
|
||||
|
||||
if (policy & 8) {
|
||||
if (!(note = Audio_AllocNoteFromDisabled(&gAudioContext.noteFreeLists, layer)) &&
|
||||
!(note = Audio_AllocNoteFromDecaying(&gAudioContext.noteFreeLists, layer)) &&
|
||||
!(note = Audio_AllocNoteFromActive(&gAudioContext.noteFreeLists, layer))) {
|
||||
if (!(note = Audio_AllocNoteFromDisabled(&gAudioCtx.noteFreeLists, layer)) &&
|
||||
!(note = Audio_AllocNoteFromDecaying(&gAudioCtx.noteFreeLists, layer)) &&
|
||||
!(note = Audio_AllocNoteFromActive(&gAudioCtx.noteFreeLists, layer))) {
|
||||
goto null_return;
|
||||
}
|
||||
return note;
|
||||
|
@ -909,13 +909,13 @@ Note* Audio_AllocNote(SequenceLayer* layer) {
|
|||
|
||||
if (!(note = Audio_AllocNoteFromDisabled(&layer->channel->notePool, layer)) &&
|
||||
!(note = Audio_AllocNoteFromDisabled(&layer->channel->seqPlayer->notePool, layer)) &&
|
||||
!(note = Audio_AllocNoteFromDisabled(&gAudioContext.noteFreeLists, layer)) &&
|
||||
!(note = Audio_AllocNoteFromDisabled(&gAudioCtx.noteFreeLists, layer)) &&
|
||||
!(note = Audio_AllocNoteFromDecaying(&layer->channel->notePool, layer)) &&
|
||||
!(note = Audio_AllocNoteFromDecaying(&layer->channel->seqPlayer->notePool, layer)) &&
|
||||
!(note = Audio_AllocNoteFromDecaying(&gAudioContext.noteFreeLists, layer)) &&
|
||||
!(note = Audio_AllocNoteFromDecaying(&gAudioCtx.noteFreeLists, layer)) &&
|
||||
!(note = Audio_AllocNoteFromActive(&layer->channel->notePool, layer)) &&
|
||||
!(note = Audio_AllocNoteFromActive(&layer->channel->seqPlayer->notePool, layer)) &&
|
||||
!(note = Audio_AllocNoteFromActive(&gAudioContext.noteFreeLists, layer))) {
|
||||
!(note = Audio_AllocNoteFromActive(&gAudioCtx.noteFreeLists, layer))) {
|
||||
goto null_return;
|
||||
}
|
||||
return note;
|
||||
|
@ -929,8 +929,8 @@ void Audio_NoteInitAll(void) {
|
|||
Note* note;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
note = &gAudioContext.notes[i];
|
||||
for (i = 0; i < gAudioCtx.numNotes; i++) {
|
||||
note = &gAudioCtx.notes[i];
|
||||
note->noteSubEu = gZeroNoteSub;
|
||||
note->playbackState.priority = 0;
|
||||
note->playbackState.unk_04 = 0;
|
||||
|
@ -947,6 +947,6 @@ void Audio_NoteInitAll(void) {
|
|||
note->playbackState.stereoHeadsetEffects = false;
|
||||
note->startSamplePos = 0;
|
||||
note->synthesisState.synthesisBuffers =
|
||||
AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, sizeof(NoteSynthesisBuffers));
|
||||
AudioHeap_AllocDmaMemory(&gAudioCtx.miscPool, sizeof(NoteSynthesisBuffers));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -252,7 +252,7 @@ s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState*
|
|||
void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
|
||||
s32 i;
|
||||
|
||||
if (channel == &gAudioContext.sequenceChannelNone) {
|
||||
if (channel == &gAudioCtx.sequenceChannelNone) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
|
|||
channel->freqScale = 1.0f;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(channel->soundScriptIO); i++) {
|
||||
channel->soundScriptIO[i] = -1;
|
||||
channel->soundScriptIO[i] = SEQ_IO_VAL_NONE;
|
||||
}
|
||||
|
||||
channel->unused = false;
|
||||
|
@ -309,7 +309,7 @@ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) {
|
|||
s32 pad;
|
||||
|
||||
if (channel->layers[layerIndex] == NULL) {
|
||||
layer = AudioSeq_AudioListPopBack(&gAudioContext.layerFreeList);
|
||||
layer = AudioSeq_AudioListPopBack(&gAudioCtx.layerFreeList);
|
||||
channel->layers[layerIndex] = layer;
|
||||
if (layer == NULL) {
|
||||
channel->layers[layerIndex] = NULL;
|
||||
|
@ -353,7 +353,7 @@ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) {
|
|||
|
||||
void AudioSeq_SeqLayerDisable(SequenceLayer* layer) {
|
||||
if (layer != NULL) {
|
||||
if (layer->channel != &gAudioContext.sequenceChannelNone && layer->channel->seqPlayer->finished == 1) {
|
||||
if (layer->channel != &gAudioCtx.sequenceChannelNone && layer->channel->seqPlayer->finished == 1) {
|
||||
Audio_SeqLayerNoteRelease(layer);
|
||||
} else {
|
||||
Audio_SeqLayerNoteDecay(layer);
|
||||
|
@ -367,7 +367,7 @@ void AudioSeq_SeqLayerFree(SequenceChannel* channel, s32 layerIndex) {
|
|||
SequenceLayer* layer = channel->layers[layerIndex];
|
||||
|
||||
if (layer != NULL) {
|
||||
AudioSeq_AudioListPushBack(&gAudioContext.layerFreeList, &layer->listItem);
|
||||
AudioSeq_AudioListPushBack(&gAudioCtx.layerFreeList, &layer->listItem);
|
||||
AudioSeq_SeqLayerDisable(layer);
|
||||
channel->layers[layerIndex] = NULL;
|
||||
}
|
||||
|
@ -452,10 +452,10 @@ void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) {
|
|||
AudioLoad_SetFontLoadStatus(seqPlayer->defaultFont, LOAD_STATUS_MAYBE_DISCARDABLE);
|
||||
}
|
||||
|
||||
if (seqPlayer->defaultFont == gAudioContext.fontCache.temporary.entries[0].id) {
|
||||
gAudioContext.fontCache.temporary.nextSide = 0;
|
||||
} else if (seqPlayer->defaultFont == gAudioContext.fontCache.temporary.entries[1].id) {
|
||||
gAudioContext.fontCache.temporary.nextSide = 1;
|
||||
if (seqPlayer->defaultFont == gAudioCtx.fontCache.temporary.entries[0].id) {
|
||||
gAudioCtx.fontCache.temporary.nextSide = 0;
|
||||
} else if (seqPlayer->defaultFont == gAudioCtx.fontCache.temporary.entries[1].id) {
|
||||
gAudioCtx.fontCache.temporary.nextSide = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,15 +488,15 @@ void* AudioSeq_AudioListPopBack(AudioListItem* list) {
|
|||
void AudioSeq_InitLayerFreelist(void) {
|
||||
s32 i;
|
||||
|
||||
gAudioContext.layerFreeList.prev = &gAudioContext.layerFreeList;
|
||||
gAudioContext.layerFreeList.next = &gAudioContext.layerFreeList;
|
||||
gAudioContext.layerFreeList.u.count = 0;
|
||||
gAudioContext.layerFreeList.pool = NULL;
|
||||
gAudioCtx.layerFreeList.prev = &gAudioCtx.layerFreeList;
|
||||
gAudioCtx.layerFreeList.next = &gAudioCtx.layerFreeList;
|
||||
gAudioCtx.layerFreeList.u.count = 0;
|
||||
gAudioCtx.layerFreeList.pool = NULL;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioContext.sequenceLayers); i++) {
|
||||
gAudioContext.sequenceLayers[i].listItem.u.value = &gAudioContext.sequenceLayers[i];
|
||||
gAudioContext.sequenceLayers[i].listItem.prev = NULL;
|
||||
AudioSeq_AudioListPushBack(&gAudioContext.layerFreeList, &gAudioContext.sequenceLayers[i].listItem);
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioCtx.sequenceLayers); i++) {
|
||||
gAudioCtx.sequenceLayers[i].listItem.u.value = &gAudioCtx.sequenceLayers[i];
|
||||
gAudioCtx.sequenceLayers[i].listItem.prev = NULL;
|
||||
AudioSeq_AudioListPushBack(&gAudioCtx.layerFreeList, &gAudioCtx.sequenceLayers[i].listItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -873,7 +873,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
|||
layer->tunedSample = NULL;
|
||||
tuning = 1.0f;
|
||||
if (instOrWave >= 0xC0) {
|
||||
layer->tunedSample = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].tunedSample;
|
||||
layer->tunedSample = &gAudioCtx.synthesisReverbs[instOrWave - 0xC0].tunedSample;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -903,12 +903,12 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
|||
portamento->extent = (freqScale2 / freqScale) - 1.0f;
|
||||
|
||||
if (PORTAMENTO_IS_SPECIAL(*portamento)) {
|
||||
speed = seqPlayer->tempo * 0x8000 / gAudioContext.tempoInternalToExternal;
|
||||
speed = seqPlayer->tempo * 0x8000 / gAudioCtx.tempoInternalToExternal;
|
||||
if (layer->delay != 0) {
|
||||
speed = speed * 0x100 / (layer->delay * layer->portamentoTime);
|
||||
}
|
||||
} else {
|
||||
speed = 0x20000 / (layer->portamentoTime * gAudioContext.audioBufferParameters.updatesPerFrame);
|
||||
speed = 0x20000 / (layer->portamentoTime * gAudioCtx.audioBufferParameters.updatesPerFrame);
|
||||
}
|
||||
|
||||
if (speed >= 0x7FFF) {
|
||||
|
@ -935,7 +935,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
|||
layer->tunedSample = NULL;
|
||||
layer->freqScale = gPitchFrequencies[semitone2];
|
||||
if (instOrWave >= 0xC0) {
|
||||
layer->tunedSample = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].tunedSample;
|
||||
layer->tunedSample = &gAudioCtx.synthesisReverbs[instOrWave - 0xC0].tunedSample;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -951,7 +951,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
|||
time = 0.0f;
|
||||
}
|
||||
time *= seqPlayer->tempo;
|
||||
time *= gAudioContext.unk_2870;
|
||||
time *= gAudioCtx.unk_2870;
|
||||
time /= layer->freqScale;
|
||||
if (time > 0x7FFE) {
|
||||
time = 0x7FFE;
|
||||
|
@ -964,7 +964,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
|||
// (It's a bit unclear if 'portamento' has actually always been
|
||||
// set when this is reached...)
|
||||
if (PORTAMENTO_IS_SPECIAL(*portamento)) {
|
||||
speed2 = seqPlayer->tempo * 0x8000 / gAudioContext.tempoInternalToExternal;
|
||||
speed2 = seqPlayer->tempo * 0x8000 / gAudioCtx.tempoInternalToExternal;
|
||||
speed2 = speed2 * 0x100 / (layer->delay * layer->portamentoTime);
|
||||
if (speed2 >= 0x7FFF) {
|
||||
speed2 = 0x7FFF;
|
||||
|
@ -1043,8 +1043,8 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
|
|||
}
|
||||
|
||||
if (channel->velocityRandomVariance != 0) {
|
||||
floatDelta = layer->velocitySquare * (gAudioContext.audioRandom % channel->velocityRandomVariance) / 100.0f;
|
||||
if ((gAudioContext.audioRandom & 0x8000) != 0) {
|
||||
floatDelta = layer->velocitySquare * (gAudioCtx.audioRandom % channel->velocityRandomVariance) / 100.0f;
|
||||
if ((gAudioCtx.audioRandom & 0x8000) != 0) {
|
||||
floatDelta = -floatDelta;
|
||||
}
|
||||
|
||||
|
@ -1064,8 +1064,8 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
|
|||
|
||||
if (channel->gateTimeRandomVariance != 0) {
|
||||
//! @bug should probably be gateTimeRandomVariance
|
||||
intDelta = (layer->gateDelay * (gAudioContext.audioRandom % channel->velocityRandomVariance)) / 100;
|
||||
if ((gAudioContext.audioRandom & 0x4000) != 0) {
|
||||
intDelta = (layer->gateDelay * (gAudioCtx.audioRandom % channel->velocityRandomVariance)) / 100;
|
||||
if ((gAudioCtx.audioRandom & 0x4000) != 0) {
|
||||
intDelta = -intDelta;
|
||||
}
|
||||
|
||||
|
@ -1244,9 +1244,9 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
cmd = (u8)cmdArgs[0];
|
||||
|
||||
if (seqPlayer->defaultFont != 0xFF) {
|
||||
cmdArgU16 = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
||||
lowBits = gAudioContext.sequenceFontTable[cmdArgU16];
|
||||
cmd = gAudioContext.sequenceFontTable[cmdArgU16 + lowBits - cmd];
|
||||
cmdArgU16 = ((u16*)gAudioCtx.sequenceFontTable)[seqPlayer->seqId];
|
||||
lowBits = gAudioCtx.sequenceFontTable[cmdArgU16];
|
||||
cmd = gAudioCtx.sequenceFontTable[cmdArgU16 + lowBits - cmd];
|
||||
}
|
||||
|
||||
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, cmd)) {
|
||||
|
@ -1373,9 +1373,9 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
cmd = (u8)cmdArgs[0];
|
||||
|
||||
if (seqPlayer->defaultFont != 0xFF) {
|
||||
cmdArgU16 = ((u16*)gAudioContext.sequenceFontTable)[seqPlayer->seqId];
|
||||
lowBits = gAudioContext.sequenceFontTable[cmdArgU16];
|
||||
cmd = gAudioContext.sequenceFontTable[cmdArgU16 + lowBits - cmd];
|
||||
cmdArgU16 = ((u16*)gAudioCtx.sequenceFontTable)[seqPlayer->seqId];
|
||||
lowBits = gAudioCtx.sequenceFontTable[cmdArgU16];
|
||||
cmd = gAudioCtx.sequenceFontTable[cmdArgU16 + lowBits - cmd];
|
||||
}
|
||||
|
||||
if (AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, cmd)) {
|
||||
|
@ -1569,12 +1569,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
|
||||
case 0xB7:
|
||||
channel->unk_22 =
|
||||
(cmdArgs[0] == 0) ? gAudioContext.audioRandom & 0xFFFF : gAudioContext.audioRandom % cmdArgs[0];
|
||||
(cmdArgs[0] == 0) ? gAudioCtx.audioRandom & 0xFFFF : gAudioCtx.audioRandom % cmdArgs[0];
|
||||
break;
|
||||
|
||||
case 0xB8:
|
||||
scriptState->value =
|
||||
(cmdArgs[0] == 0) ? gAudioContext.audioRandom & 0xFFFF : gAudioContext.audioRandom % cmdArgs[0];
|
||||
(cmdArgs[0] == 0) ? gAudioCtx.audioRandom & 0xFFFF : gAudioCtx.audioRandom % cmdArgs[0];
|
||||
break;
|
||||
|
||||
case 0xBD:
|
||||
|
@ -1664,12 +1664,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
|
||||
case 0x10:
|
||||
if (lowBits < 8) {
|
||||
channel->soundScriptIO[lowBits] = -1;
|
||||
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
|
||||
if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value,
|
||||
&channel->soundScriptIO[lowBits]) == -1) {}
|
||||
} else {
|
||||
lowBits -= 8;
|
||||
channel->soundScriptIO[lowBits] = -1;
|
||||
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
|
||||
if (AudioLoad_SlowLoadSample(channel->fontId, channel->unk_22 + 0x100,
|
||||
&channel->soundScriptIO[lowBits]) == -1) {}
|
||||
}
|
||||
|
@ -1678,7 +1678,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
case 0x60:
|
||||
scriptState->value = channel->soundScriptIO[lowBits];
|
||||
if (lowBits < 2) {
|
||||
channel->soundScriptIO[lowBits] = -1;
|
||||
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1746,11 +1746,11 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
|||
seqPlayer->tempoAcc += seqPlayer->tempo;
|
||||
seqPlayer->tempoAcc += (s16)seqPlayer->unk_0C;
|
||||
|
||||
if (seqPlayer->tempoAcc < gAudioContext.tempoInternalToExternal) {
|
||||
if (seqPlayer->tempoAcc < gAudioCtx.tempoInternalToExternal) {
|
||||
return;
|
||||
}
|
||||
|
||||
seqPlayer->tempoAcc -= (u16)gAudioContext.tempoInternalToExternal;
|
||||
seqPlayer->tempoAcc -= (u16)gAudioCtx.tempoInternalToExternal;
|
||||
|
||||
if (seqPlayer->stopScript == true) {
|
||||
return;
|
||||
|
@ -1811,8 +1811,8 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
|||
|
||||
case 0xDD:
|
||||
seqPlayer->tempo = AudioSeq_ScriptReadU8(seqScript) * TATUMS_PER_BEAT;
|
||||
if (seqPlayer->tempo > gAudioContext.tempoInternalToExternal) {
|
||||
seqPlayer->tempo = (u16)gAudioContext.tempoInternalToExternal;
|
||||
if (seqPlayer->tempo > gAudioCtx.tempoInternalToExternal) {
|
||||
seqPlayer->tempo = (u16)gAudioCtx.tempoInternalToExternal;
|
||||
}
|
||||
|
||||
if ((s16)seqPlayer->tempo <= 0) {
|
||||
|
@ -1909,9 +1909,9 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
|||
case 0xCE:
|
||||
cmd = AudioSeq_ScriptReadU8(seqScript);
|
||||
if (cmd == 0) {
|
||||
seqScript->value = (gAudioContext.audioRandom >> 2) & 0xFF;
|
||||
seqScript->value = (gAudioCtx.audioRandom >> 2) & 0xFF;
|
||||
} else {
|
||||
seqScript->value = (gAudioContext.audioRandom >> 2) % cmd;
|
||||
seqScript->value = (gAudioCtx.audioRandom >> 2) % cmd;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1992,7 +1992,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
|||
case 0x80:
|
||||
seqScript->value = seqPlayer->soundScriptIO[cmdLowBits];
|
||||
if (cmdLowBits < 2) {
|
||||
seqPlayer->soundScriptIO[cmdLowBits] = -1;
|
||||
seqPlayer->soundScriptIO[cmdLowBits] = SEQ_IO_VAL_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2038,11 +2038,10 @@ void AudioSeq_ProcessSequences(s32 arg0) {
|
|||
SequencePlayer* seqPlayer;
|
||||
u32 i;
|
||||
|
||||
gAudioContext.noteSubEuOffset =
|
||||
(gAudioContext.audioBufferParameters.updatesPerFrame - arg0 - 1) * gAudioContext.numNotes;
|
||||
gAudioCtx.noteSubEuOffset = (gAudioCtx.audioBufferParameters.updatesPerFrame - arg0 - 1) * gAudioCtx.numNotes;
|
||||
|
||||
for (i = 0; i < (u32)gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
seqPlayer = &gAudioContext.seqPlayers[i];
|
||||
for (i = 0; i < (u32)gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
|
||||
seqPlayer = &gAudioCtx.seqPlayers[i];
|
||||
if (seqPlayer->enabled == true) {
|
||||
AudioSeq_SequencePlayerProcessSequence(seqPlayer);
|
||||
Audio_SequencePlayerProcessSound(seqPlayer);
|
||||
|
@ -2089,14 +2088,14 @@ void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) {
|
|||
|
||||
void AudioSeq_InitSequencePlayerChannels(s32 playerIdx) {
|
||||
SequenceChannel* channel;
|
||||
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx];
|
||||
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
for (i = 0; i < SEQ_NUM_CHANNELS; i++) {
|
||||
seqPlayer->channels[i] = AudioHeap_AllocZeroed(&gAudioContext.miscPool, sizeof(SequenceChannel));
|
||||
seqPlayer->channels[i] = AudioHeap_AllocZeroed(&gAudioCtx.miscPool, sizeof(SequenceChannel));
|
||||
if (seqPlayer->channels[i] == NULL) {
|
||||
seqPlayer->channels[i] = &gAudioContext.sequenceChannelNone;
|
||||
seqPlayer->channels[i] = &gAudioCtx.sequenceChannelNone;
|
||||
} else {
|
||||
channel = seqPlayer->channels[i];
|
||||
channel->seqPlayer = seqPlayer;
|
||||
|
@ -2114,7 +2113,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) {
|
|||
s32 j;
|
||||
|
||||
for (i = 0; i < SEQ_NUM_CHANNELS; i++) {
|
||||
seqPlayer->channels[i] = &gAudioContext.sequenceChannelNone;
|
||||
seqPlayer->channels[i] = &gAudioCtx.sequenceChannelNone;
|
||||
}
|
||||
|
||||
seqPlayer->enabled = false;
|
||||
|
@ -2124,7 +2123,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) {
|
|||
seqPlayer->applyBend = false;
|
||||
|
||||
for (j = 0; j < ARRAY_COUNT(seqPlayer->soundScriptIO); j++) {
|
||||
seqPlayer->soundScriptIO[j] = -1;
|
||||
seqPlayer->soundScriptIO[j] = SEQ_IO_VAL_NONE;
|
||||
}
|
||||
|
||||
seqPlayer->muteBehavior = MUTE_BEHAVIOR_SOFTEN | MUTE_BEHAVIOR_STOP_NOTES;
|
||||
|
@ -2139,12 +2138,12 @@ void AudioSeq_InitSequencePlayers(void) {
|
|||
|
||||
AudioSeq_InitLayerFreelist();
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioContext.sequenceLayers); i++) {
|
||||
gAudioContext.sequenceLayers[i].channel = NULL;
|
||||
gAudioContext.sequenceLayers[i].enabled = false;
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioCtx.sequenceLayers); i++) {
|
||||
gAudioCtx.sequenceLayers[i].channel = NULL;
|
||||
gAudioCtx.sequenceLayers[i].enabled = false;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioContext.seqPlayers); i++) {
|
||||
AudioSeq_InitSequencePlayer(&gAudioContext.seqPlayers[i]);
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioCtx.seqPlayers); i++) {
|
||||
AudioSeq_InitSequencePlayer(&gAudioCtx.seqPlayers[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ u8 sNumSamplesPerWavePeriod[] = {
|
|||
void AudioSynth_InitNextRingBuf(s32 chunkLen, s32 updateIndex, s32 reverbIndex) {
|
||||
ReverbRingBufferItem* bufItem;
|
||||
s32 pad[3];
|
||||
SynthesisReverb* reverb = &gAudioContext.synthesisReverbs[reverbIndex];
|
||||
SynthesisReverb* reverb = &gAudioCtx.synthesisReverbs[reverbIndex];
|
||||
s32 temp_a0_2;
|
||||
s32 temp_a0_4;
|
||||
s32 numSamples;
|
||||
|
@ -135,10 +135,10 @@ void func_800DB03C(s32 updateIndex) {
|
|||
s32 baseIndex;
|
||||
s32 i;
|
||||
|
||||
baseIndex = gAudioContext.numNotes * updateIndex;
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
subEu = &gAudioContext.notes[i].noteSubEu;
|
||||
subEu2 = &gAudioContext.noteSubsEu[baseIndex + i];
|
||||
baseIndex = gAudioCtx.numNotes * updateIndex;
|
||||
for (i = 0; i < gAudioCtx.numNotes; i++) {
|
||||
subEu = &gAudioCtx.notes[i].noteSubEu;
|
||||
subEu2 = &gAudioCtx.noteSubsEu[baseIndex + i];
|
||||
if (subEu->bitField0.enabled) {
|
||||
subEu->bitField0.needsInit = false;
|
||||
} else {
|
||||
|
@ -158,42 +158,41 @@ Acmd* AudioSynth_Update(Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen)
|
|||
SynthesisReverb* reverb;
|
||||
|
||||
cmdP = cmdStart;
|
||||
for (i = gAudioContext.audioBufferParameters.updatesPerFrame; i > 0; i--) {
|
||||
for (i = gAudioCtx.audioBufferParameters.updatesPerFrame; i > 0; i--) {
|
||||
AudioSeq_ProcessSequences(i - 1);
|
||||
func_800DB03C(gAudioContext.audioBufferParameters.updatesPerFrame - i);
|
||||
func_800DB03C(gAudioCtx.audioBufferParameters.updatesPerFrame - i);
|
||||
}
|
||||
|
||||
aiBufP = aiStart;
|
||||
gAudioContext.curLoadedBook = NULL;
|
||||
gAudioCtx.curLoadedBook = NULL;
|
||||
|
||||
for (i = gAudioContext.audioBufferParameters.updatesPerFrame; i > 0; i--) {
|
||||
for (i = gAudioCtx.audioBufferParameters.updatesPerFrame; i > 0; i--) {
|
||||
if (i == 1) {
|
||||
chunkLen = aiBufLen;
|
||||
} else if ((aiBufLen / i) >= gAudioContext.audioBufferParameters.samplesPerUpdateMax) {
|
||||
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdateMax;
|
||||
} else if (gAudioContext.audioBufferParameters.samplesPerUpdateMin >= (aiBufLen / i)) {
|
||||
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdateMin;
|
||||
} else if ((aiBufLen / i) >= gAudioCtx.audioBufferParameters.samplesPerUpdateMax) {
|
||||
chunkLen = gAudioCtx.audioBufferParameters.samplesPerUpdateMax;
|
||||
} else if (gAudioCtx.audioBufferParameters.samplesPerUpdateMin >= (aiBufLen / i)) {
|
||||
chunkLen = gAudioCtx.audioBufferParameters.samplesPerUpdateMin;
|
||||
} else {
|
||||
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdate;
|
||||
chunkLen = gAudioCtx.audioBufferParameters.samplesPerUpdate;
|
||||
}
|
||||
|
||||
for (j = 0; j < gAudioContext.numSynthesisReverbs; j++) {
|
||||
if (gAudioContext.synthesisReverbs[j].useReverb) {
|
||||
AudioSynth_InitNextRingBuf(chunkLen, gAudioContext.audioBufferParameters.updatesPerFrame - i, j);
|
||||
for (j = 0; j < gAudioCtx.numSynthesisReverbs; j++) {
|
||||
if (gAudioCtx.synthesisReverbs[j].useReverb) {
|
||||
AudioSynth_InitNextRingBuf(chunkLen, gAudioCtx.audioBufferParameters.updatesPerFrame - i, j);
|
||||
}
|
||||
}
|
||||
|
||||
cmdP = AudioSynth_DoOneAudioUpdate(aiBufP, chunkLen, cmdP,
|
||||
gAudioContext.audioBufferParameters.updatesPerFrame - i);
|
||||
cmdP = AudioSynth_DoOneAudioUpdate(aiBufP, chunkLen, cmdP, gAudioCtx.audioBufferParameters.updatesPerFrame - i);
|
||||
aiBufLen -= chunkLen;
|
||||
aiBufP += 2 * chunkLen;
|
||||
}
|
||||
|
||||
for (j = 0; j < gAudioContext.numSynthesisReverbs; j++) {
|
||||
if (gAudioContext.synthesisReverbs[j].framesToIgnore != 0) {
|
||||
gAudioContext.synthesisReverbs[j].framesToIgnore--;
|
||||
for (j = 0; j < gAudioCtx.numSynthesisReverbs; j++) {
|
||||
if (gAudioCtx.synthesisReverbs[j].framesToIgnore != 0) {
|
||||
gAudioCtx.synthesisReverbs[j].framesToIgnore--;
|
||||
}
|
||||
gAudioContext.synthesisReverbs[j].curFrame ^= 1;
|
||||
gAudioCtx.synthesisReverbs[j].curFrame ^= 1;
|
||||
}
|
||||
|
||||
*cmdCnt = cmdP - cmdStart;
|
||||
|
@ -204,8 +203,8 @@ void func_800DB2C0(s32 updateIndex, s32 noteIndex) {
|
|||
NoteSubEu* noteSubEu;
|
||||
s32 i;
|
||||
|
||||
for (i = updateIndex + 1; i < gAudioContext.audioBufferParameters.updatesPerFrame; i++) {
|
||||
noteSubEu = &gAudioContext.noteSubsEu[(gAudioContext.numNotes * i) + noteIndex];
|
||||
for (i = updateIndex + 1; i < gAudioCtx.audioBufferParameters.updatesPerFrame; i++) {
|
||||
noteSubEu = &gAudioCtx.noteSubsEu[(gAudioCtx.numNotes * i) + noteIndex];
|
||||
if (!noteSubEu->bitField0.needsInit) {
|
||||
noteSubEu->bitField0.enabled = false;
|
||||
} else {
|
||||
|
@ -332,7 +331,7 @@ Acmd* AudioSynth_FilterReverb(Acmd* cmd, s32 size, SynthesisReverb* reverb) {
|
|||
Acmd* AudioSynth_MaybeMixRingBuffer1(Acmd* cmd, SynthesisReverb* reverb, s32 updateIndex) {
|
||||
SynthesisReverb* temp_a3;
|
||||
|
||||
temp_a3 = &gAudioContext.synthesisReverbs[reverb->unk_05];
|
||||
temp_a3 = &gAudioCtx.synthesisReverbs[reverb->unk_05];
|
||||
if (temp_a3->downsampleRate == 1) {
|
||||
cmd = AudioSynth_LoadRingBuffer1AtTemp(cmd, temp_a3, updateIndex);
|
||||
aMix(cmd++, DMEM_2CH_SIZE >> 4, reverb->unk_08, DMEM_WET_LEFT_CH, DMEM_WET_TEMP);
|
||||
|
@ -593,27 +592,27 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
|
|||
NoteSubEu* noteSubEu2;
|
||||
s32 unk14;
|
||||
|
||||
t = gAudioContext.numNotes * updateIndex;
|
||||
t = gAudioCtx.numNotes * updateIndex;
|
||||
count = 0;
|
||||
if (gAudioContext.numSynthesisReverbs == 0) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
if (gAudioContext.noteSubsEu[t + i].bitField0.enabled) {
|
||||
if (gAudioCtx.numSynthesisReverbs == 0) {
|
||||
for (i = 0; i < gAudioCtx.numNotes; i++) {
|
||||
if (gAudioCtx.noteSubsEu[t + i].bitField0.enabled) {
|
||||
noteIndices[count++] = i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (reverbIndex = 0; reverbIndex < gAudioContext.numSynthesisReverbs; reverbIndex++) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
noteSubEu = &gAudioContext.noteSubsEu[t + i];
|
||||
for (reverbIndex = 0; reverbIndex < gAudioCtx.numSynthesisReverbs; reverbIndex++) {
|
||||
for (i = 0; i < gAudioCtx.numNotes; i++) {
|
||||
noteSubEu = &gAudioCtx.noteSubsEu[t + i];
|
||||
if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex == reverbIndex) {
|
||||
noteIndices[count++] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
noteSubEu = &gAudioContext.noteSubsEu[t + i];
|
||||
if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex >= gAudioContext.numSynthesisReverbs) {
|
||||
for (i = 0; i < gAudioCtx.numNotes; i++) {
|
||||
noteSubEu = &gAudioCtx.noteSubsEu[t + i];
|
||||
if (noteSubEu->bitField0.enabled && noteSubEu->bitField1.reverbIndex >= gAudioCtx.numSynthesisReverbs) {
|
||||
noteIndices[count++] = i;
|
||||
}
|
||||
}
|
||||
|
@ -622,8 +621,8 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
|
|||
aClearBuffer(cmd++, DMEM_LEFT_CH, DMEM_2CH_SIZE);
|
||||
|
||||
i = 0;
|
||||
for (reverbIndex = 0; reverbIndex < gAudioContext.numSynthesisReverbs; reverbIndex++) {
|
||||
reverb = &gAudioContext.synthesisReverbs[reverbIndex];
|
||||
for (reverbIndex = 0; reverbIndex < gAudioCtx.numSynthesisReverbs; reverbIndex++) {
|
||||
reverb = &gAudioCtx.synthesisReverbs[reverbIndex];
|
||||
useReverb = reverb->useReverb;
|
||||
if (useReverb) {
|
||||
|
||||
|
@ -660,11 +659,11 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
|
|||
}
|
||||
|
||||
while (i < count) {
|
||||
noteSubEu2 = &gAudioContext.noteSubsEu[noteIndices[i] + t];
|
||||
noteSubEu2 = &gAudioCtx.noteSubsEu[noteIndices[i] + t];
|
||||
if (noteSubEu2->bitField1.reverbIndex == reverbIndex) {
|
||||
cmd = AudioSynth_ProcessNote(noteIndices[i], noteSubEu2,
|
||||
&gAudioContext.notes[noteIndices[i]].synthesisState, aiBuf, aiBufLen, cmd,
|
||||
updateIndex);
|
||||
cmd =
|
||||
AudioSynth_ProcessNote(noteIndices[i], noteSubEu2, &gAudioCtx.notes[noteIndices[i]].synthesisState,
|
||||
aiBuf, aiBufLen, cmd, updateIndex);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -689,9 +688,9 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat
|
|||
}
|
||||
|
||||
while (i < count) {
|
||||
cmd = AudioSynth_ProcessNote(noteIndices[i], &gAudioContext.noteSubsEu[t + noteIndices[i]],
|
||||
&gAudioContext.notes[noteIndices[i]].synthesisState, aiBuf, aiBufLen, cmd,
|
||||
updateIndex);
|
||||
cmd =
|
||||
AudioSynth_ProcessNote(noteIndices[i], &gAudioCtx.noteSubsEu[t + noteIndices[i]],
|
||||
&gAudioCtx.notes[noteIndices[i]].synthesisState, aiBuf, aiBufLen, cmd, updateIndex);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -756,7 +755,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
|
||||
bookOffset = noteSubEu->bitField1.bookOffset;
|
||||
finished = noteSubEu->bitField0.finished;
|
||||
note = &gAudioContext.notes[noteIndex];
|
||||
note = &gAudioCtx.notes[noteIndex];
|
||||
flags = A_CONTINUE;
|
||||
|
||||
if (noteSubEu->bitField0.needsInit == true) {
|
||||
|
@ -814,24 +813,24 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
}
|
||||
|
||||
if (sample->codec == CODEC_ADPCM || sample->codec == CODEC_SMALL_ADPCM) {
|
||||
if (gAudioContext.curLoadedBook != sample->book->book) {
|
||||
if (gAudioCtx.curLoadedBook != sample->book->book) {
|
||||
u32 nEntries;
|
||||
|
||||
switch (bookOffset) {
|
||||
case 1:
|
||||
gAudioContext.curLoadedBook = &D_8012FBA8[1];
|
||||
gAudioCtx.curLoadedBook = &D_8012FBA8[1];
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
default:
|
||||
gAudioContext.curLoadedBook = sample->book->book;
|
||||
gAudioCtx.curLoadedBook = sample->book->book;
|
||||
break;
|
||||
}
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
if (1) {}
|
||||
nEntries = SAMPLES_PER_FRAME * sample->book->order * sample->book->numPredictors;
|
||||
aLoadADPCM(cmd++, nEntries, gAudioContext.curLoadedBook);
|
||||
aLoadADPCM(cmd++, nEntries, gAudioCtx.curLoadedBook);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
#include "global.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 prevTransformInv;
|
||||
MtxF curTransform;
|
||||
|
@ -9,22 +12,30 @@ void func_800430A0(CollisionContext* colCtx, s32 bgId, Actor* actor) {
|
|||
Vec3f tempPos;
|
||||
|
||||
if (DynaPoly_IsBgIdBgActor(bgId)) {
|
||||
|
||||
SkinMatrix_SetTranslateRotateYXZScale(
|
||||
&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.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.pos.y, colCtx->dyna.bgActors[bgId].prevTransform.pos.z);
|
||||
|
||||
if (SkinMatrix_Invert(&prevTransform, &prevTransformInv) != 2) {
|
||||
|
||||
SkinMatrix_SetTranslateRotateYXZScale(
|
||||
&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.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.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);
|
||||
actor->world.pos = pos;
|
||||
carriedActor->world.pos = pos;
|
||||
|
||||
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) {
|
||||
|
||||
|
@ -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)) {
|
||||
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) {
|
||||
((Player*)actor)->currentYaw += rot;
|
||||
if (carriedActor->id == ACTOR_PLAYER) {
|
||||
((Player*)carriedActor)->currentYaw += rotY;
|
||||
}
|
||||
|
||||
actor->shape.rot.y += rot;
|
||||
actor->world.rot.y += rot;
|
||||
carriedActor->shape.rot.y += rotY;
|
||||
carriedActor->world.rot.y += rotY;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,14 +81,14 @@ void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Transform actor's position
|
||||
* `actor` is the actor to update
|
||||
* Update the `carriedActor`'s position and Y rotation based on the dynapoly actor identified by `bgId`, according to
|
||||
* 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;
|
||||
DynaPolyActor* dynaActor;
|
||||
|
||||
if (DynaPoly_IsBgIdBgActor(bgId) == false) {
|
||||
if (!DynaPoly_IsBgIdBgActor(bgId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -91,13 +102,13 @@ s32 func_800433A4(CollisionContext* colCtx, s32 bgId, Actor* actor) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (dynaActor->unk_15C & 1) {
|
||||
func_800430A0(colCtx, bgId, actor);
|
||||
if (dynaActor->transformFlags & DYNA_TRANSFORM_POS) {
|
||||
DynaPolyActor_UpdateCarriedActorPos(colCtx, bgId, carriedActor);
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (dynaActor->unk_15C & 2) {
|
||||
func_800432A0(colCtx, bgId, actor);
|
||||
if (dynaActor->transformFlags & DYNA_TRANSFORM_ROT_Y) {
|
||||
DynaPolyActor_UpdateCarriedActorRotY(colCtx, bgId, carriedActor);
|
||||
result = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
#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->unk_15C = flags;
|
||||
dynaActor->transformFlags = transformFlags;
|
||||
dynaActor->interactFlags = 0;
|
||||
dynaActor->unk_150 = 0.0f;
|
||||
dynaActor->unk_154 = 0.0f;
|
||||
|
|
|
@ -53,32 +53,32 @@ AudioTask* func_800E5000(void) {
|
|||
s32 sp48;
|
||||
s32 i;
|
||||
|
||||
gAudioContext.totalTaskCount++;
|
||||
if (gAudioContext.totalTaskCount % (gAudioContext.audioBufferParameters.specUnk4) != 0) {
|
||||
gAudioCtx.totalTaskCount++;
|
||||
if (gAudioCtx.totalTaskCount % (gAudioCtx.audioBufferParameters.specUnk4) != 0) {
|
||||
if (D_801755D0 != NULL) {
|
||||
D_801755D0();
|
||||
}
|
||||
|
||||
if ((gAudioContext.totalTaskCount % gAudioContext.audioBufferParameters.specUnk4) + 1 ==
|
||||
gAudioContext.audioBufferParameters.specUnk4) {
|
||||
if ((gAudioCtx.totalTaskCount % gAudioCtx.audioBufferParameters.specUnk4) + 1 ==
|
||||
gAudioCtx.audioBufferParameters.specUnk4) {
|
||||
return sWaitingAudioTask;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
osSendMesg(gAudioContext.taskStartQueueP, (OSMesg)gAudioContext.totalTaskCount, OS_MESG_NOBLOCK);
|
||||
gAudioContext.rspTaskIndex ^= 1;
|
||||
gAudioContext.curAiBufIndex++;
|
||||
gAudioContext.curAiBufIndex %= 3;
|
||||
index = (gAudioContext.curAiBufIndex - 2 + 3) % 3;
|
||||
osSendMesg(gAudioCtx.taskStartQueueP, (OSMesg)gAudioCtx.totalTaskCount, OS_MESG_NOBLOCK);
|
||||
gAudioCtx.rspTaskIndex ^= 1;
|
||||
gAudioCtx.curAiBufIndex++;
|
||||
gAudioCtx.curAiBufIndex %= 3;
|
||||
index = (gAudioCtx.curAiBufIndex - 2 + 3) % 3;
|
||||
samplesRemainingInAi = osAiGetLength() / 4;
|
||||
|
||||
if (gAudioContext.resetTimer < 16) {
|
||||
if (gAudioContext.aiBufLengths[index] != 0) {
|
||||
osAiSetNextBuffer(gAudioContext.aiBuffers[index], gAudioContext.aiBufLengths[index] * 4);
|
||||
if (gAudioContext.aiBuffers[index]) {}
|
||||
if (gAudioContext.aiBufLengths[index]) {}
|
||||
if (gAudioCtx.resetTimer < 16) {
|
||||
if (gAudioCtx.aiBufLengths[index] != 0) {
|
||||
osAiSetNextBuffer(gAudioCtx.aiBuffers[index], gAudioCtx.aiBufLengths[index] * 4);
|
||||
if (gAudioCtx.aiBuffers[index]) {}
|
||||
if (gAudioCtx.aiBufLengths[index]) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,36 +86,35 @@ AudioTask* func_800E5000(void) {
|
|||
D_801755D0();
|
||||
}
|
||||
|
||||
sp5C = gAudioContext.curAudioFrameDmaCount;
|
||||
for (i = 0; i < gAudioContext.curAudioFrameDmaCount; i++) {
|
||||
if (osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||
sp5C = gAudioCtx.curAudioFrameDmaCount;
|
||||
for (i = 0; i < gAudioCtx.curAudioFrameDmaCount; i++) {
|
||||
if (osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK) == 0) {
|
||||
sp5C--;
|
||||
}
|
||||
}
|
||||
|
||||
if (sp5C != 0) {
|
||||
for (i = 0; i < sp5C; i++) {
|
||||
osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_BLOCK);
|
||||
osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
sp48 = MQ_GET_COUNT(&gAudioContext.currAudioFrameDmaQueue);
|
||||
sp48 = MQ_GET_COUNT(&gAudioCtx.currAudioFrameDmaQueue);
|
||||
if (sp48 != 0) {
|
||||
for (i = 0; i < sp48; i++) {
|
||||
osRecvMesg(&gAudioContext.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK);
|
||||
osRecvMesg(&gAudioCtx.currAudioFrameDmaQueue, NULL, OS_MESG_NOBLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
gAudioContext.curAudioFrameDmaCount = 0;
|
||||
gAudioCtx.curAudioFrameDmaCount = 0;
|
||||
AudioLoad_DecreaseSampleDmaTtls();
|
||||
AudioLoad_ProcessLoads(gAudioContext.resetStatus);
|
||||
AudioLoad_ProcessLoads(gAudioCtx.resetStatus);
|
||||
AudioLoad_ProcessScriptLoads();
|
||||
|
||||
if (gAudioContext.resetStatus != 0) {
|
||||
if (gAudioCtx.resetStatus != 0) {
|
||||
if (AudioHeap_ResetStep() == 0) {
|
||||
if (gAudioContext.resetStatus == 0) {
|
||||
osSendMesg(gAudioContext.audioResetQueueP, (OSMesg)(u32)gAudioContext.audioResetSpecIdToLoad,
|
||||
OS_MESG_NOBLOCK);
|
||||
if (gAudioCtx.resetStatus == 0) {
|
||||
osSendMesg(gAudioCtx.audioResetQueueP, (OSMesg)(u32)gAudioCtx.audioResetSpecIdToLoad, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
sWaitingAudioTask = NULL;
|
||||
|
@ -123,63 +122,62 @@ AudioTask* func_800E5000(void) {
|
|||
}
|
||||
}
|
||||
|
||||
if (gAudioContext.resetTimer > 16) {
|
||||
if (gAudioCtx.resetTimer > 16) {
|
||||
return NULL;
|
||||
}
|
||||
if (gAudioContext.resetTimer != 0) {
|
||||
gAudioContext.resetTimer++;
|
||||
if (gAudioCtx.resetTimer != 0) {
|
||||
gAudioCtx.resetTimer++;
|
||||
}
|
||||
|
||||
gAudioContext.curTask = &gAudioContext.rspTask[gAudioContext.rspTaskIndex];
|
||||
gAudioContext.curAbiCmdBuf = gAudioContext.abiCmdBufs[gAudioContext.rspTaskIndex];
|
||||
gAudioCtx.curTask = &gAudioCtx.rspTask[gAudioCtx.rspTaskIndex];
|
||||
gAudioCtx.curAbiCmdBuf = gAudioCtx.abiCmdBufs[gAudioCtx.rspTaskIndex];
|
||||
|
||||
index = gAudioContext.curAiBufIndex;
|
||||
currAiBuffer = gAudioContext.aiBuffers[index];
|
||||
index = gAudioCtx.curAiBufIndex;
|
||||
currAiBuffer = gAudioCtx.aiBuffers[index];
|
||||
|
||||
gAudioContext.aiBufLengths[index] =
|
||||
(s16)((((gAudioContext.audioBufferParameters.samplesPerFrameTarget - samplesRemainingInAi) +
|
||||
gAudioCtx.aiBufLengths[index] =
|
||||
(s16)((((gAudioCtx.audioBufferParameters.samplesPerFrameTarget - samplesRemainingInAi) +
|
||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) &
|
||||
~0xF) +
|
||||
SAMPLES_TO_OVERPRODUCE);
|
||||
if (gAudioContext.aiBufLengths[index] < gAudioContext.audioBufferParameters.minAiBufferLength) {
|
||||
gAudioContext.aiBufLengths[index] = gAudioContext.audioBufferParameters.minAiBufferLength;
|
||||
if (gAudioCtx.aiBufLengths[index] < gAudioCtx.audioBufferParameters.minAiBufferLength) {
|
||||
gAudioCtx.aiBufLengths[index] = gAudioCtx.audioBufferParameters.minAiBufferLength;
|
||||
}
|
||||
|
||||
if (gAudioContext.aiBufLengths[index] > gAudioContext.audioBufferParameters.maxAiBufferLength) {
|
||||
gAudioContext.aiBufLengths[index] = gAudioContext.audioBufferParameters.maxAiBufferLength;
|
||||
if (gAudioCtx.aiBufLengths[index] > gAudioCtx.audioBufferParameters.maxAiBufferLength) {
|
||||
gAudioCtx.aiBufLengths[index] = gAudioCtx.audioBufferParameters.maxAiBufferLength;
|
||||
}
|
||||
|
||||
j = 0;
|
||||
if (gAudioContext.resetStatus == 0) {
|
||||
if (gAudioCtx.resetStatus == 0) {
|
||||
// msg = 0000RREE R = read pos, E = End Pos
|
||||
while (osRecvMesg(gAudioContext.cmdProcQueueP, (OSMesg*)&sp4C, OS_MESG_NOBLOCK) != -1) {
|
||||
while (osRecvMesg(gAudioCtx.cmdProcQueueP, (OSMesg*)&sp4C, OS_MESG_NOBLOCK) != -1) {
|
||||
if (1) {}
|
||||
Audio_ProcessCmds(sp4C);
|
||||
j++;
|
||||
}
|
||||
if ((j == 0) && (gAudioContext.cmdQueueFinished)) {
|
||||
if ((j == 0) && (gAudioCtx.cmdQueueFinished)) {
|
||||
Audio_ScheduleProcessCmds();
|
||||
}
|
||||
}
|
||||
|
||||
gAudioContext.curAbiCmdBuf =
|
||||
AudioSynth_Update(gAudioContext.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioContext.aiBufLengths[index]);
|
||||
gAudioCtx.curAbiCmdBuf =
|
||||
AudioSynth_Update(gAudioCtx.curAbiCmdBuf, &abiCmdCnt, currAiBuffer, gAudioCtx.aiBufLengths[index]);
|
||||
|
||||
// Update audioRandom to the next random number
|
||||
gAudioContext.audioRandom = (gAudioContext.audioRandom + gAudioContext.totalTaskCount) * osGetCount();
|
||||
gAudioContext.audioRandom =
|
||||
gAudioContext.audioRandom + gAudioContext.aiBuffers[index][gAudioContext.totalTaskCount & 0xFF];
|
||||
gAudioCtx.audioRandom = (gAudioCtx.audioRandom + gAudioCtx.totalTaskCount) * osGetCount();
|
||||
gAudioCtx.audioRandom = gAudioCtx.audioRandom + gAudioCtx.aiBuffers[index][gAudioCtx.totalTaskCount & 0xFF];
|
||||
|
||||
// gWaveSamples[8] interprets compiled assembly code as s16 samples as a way to generate sound with noise.
|
||||
// Start with the address of func_800E4FE0, and offset it by a random number between 0 - 0xFFF0
|
||||
// Use the resulting address as the starting address to interpret an array of samples i.e. `s16 samples[]`
|
||||
gWaveSamples[8] = (s16*)(((u8*)func_800E4FE0) + (gAudioContext.audioRandom & 0xFFF0));
|
||||
gWaveSamples[8] = (s16*)(((u8*)func_800E4FE0) + (gAudioCtx.audioRandom & 0xFFF0));
|
||||
|
||||
index = gAudioContext.rspTaskIndex;
|
||||
gAudioContext.curTask->msgQueue = NULL;
|
||||
gAudioContext.curTask->unk_44 = NULL;
|
||||
index = gAudioCtx.rspTaskIndex;
|
||||
gAudioCtx.curTask->msgQueue = NULL;
|
||||
gAudioCtx.curTask->unk_44 = NULL;
|
||||
|
||||
task = &gAudioContext.curTask->task.t;
|
||||
task = &gAudioCtx.curTask->task.t;
|
||||
task->type = M_AUDTASK;
|
||||
task->flags = 0;
|
||||
task->ucode_boot = aspMainTextStart;
|
||||
|
@ -193,7 +191,7 @@ AudioTask* func_800E5000(void) {
|
|||
task->output_buff = NULL;
|
||||
task->output_buff_size = NULL;
|
||||
if (1) {}
|
||||
task->data_ptr = (u64*)gAudioContext.abiCmdBufs[index];
|
||||
task->data_ptr = (u64*)gAudioCtx.abiCmdBufs[index];
|
||||
task->data_size = abiCmdCnt * sizeof(Acmd);
|
||||
task->yield_data_ptr = NULL;
|
||||
task->yield_data_size = 0;
|
||||
|
@ -202,10 +200,10 @@ AudioTask* func_800E5000(void) {
|
|||
sMaxAbiCmdCnt = abiCmdCnt;
|
||||
}
|
||||
|
||||
if (gAudioContext.audioBufferParameters.specUnk4 == 1) {
|
||||
return gAudioContext.curTask;
|
||||
if (gAudioCtx.audioBufferParameters.specUnk4 == 1) {
|
||||
return gAudioCtx.curTask;
|
||||
} else {
|
||||
sWaitingAudioTask = gAudioContext.curTask;
|
||||
sWaitingAudioTask = gAudioCtx.curTask;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -235,9 +233,9 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
break;
|
||||
|
||||
case 0x83:
|
||||
if (gAudioContext.seqPlayers[cmd->arg0].enabled) {
|
||||
if (gAudioCtx.seqPlayers[cmd->arg0].enabled) {
|
||||
if (cmd->asInt == 0) {
|
||||
AudioSeq_SequencePlayerDisableAsFinished(&gAudioContext.seqPlayers[cmd->arg0]);
|
||||
AudioSeq_SequencePlayerDisableAsFinished(&gAudioCtx.seqPlayers[cmd->arg0]);
|
||||
} else {
|
||||
func_800E5958(cmd->arg0, cmd->asInt);
|
||||
}
|
||||
|
@ -245,12 +243,12 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
break;
|
||||
|
||||
case 0xF0:
|
||||
gAudioContext.soundMode = cmd->asUInt;
|
||||
gAudioCtx.soundMode = cmd->asUInt;
|
||||
break;
|
||||
|
||||
case 0xF1:
|
||||
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i];
|
||||
for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
|
||||
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[i];
|
||||
|
||||
seqPlayer->muted = 1;
|
||||
seqPlayer->recalculateVolume = 1;
|
||||
|
@ -259,8 +257,8 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
|
||||
case 0xF2:
|
||||
if (cmd->asUInt == 1) {
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
Note* note = &gAudioContext.notes[i];
|
||||
for (i = 0; i < gAudioCtx.numNotes; i++) {
|
||||
Note* note = &gAudioCtx.notes[i];
|
||||
NoteSubEu* subEu = ¬e->noteSubEu;
|
||||
|
||||
if (subEu->bitField0.enabled && note->playbackState.unk_04 == 0) {
|
||||
|
@ -271,8 +269,8 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i];
|
||||
for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
|
||||
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[i];
|
||||
|
||||
seqPlayer->muted = 0;
|
||||
seqPlayer->recalculateVolume = 1;
|
||||
|
@ -284,15 +282,15 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
break;
|
||||
|
||||
case 0xF4:
|
||||
AudioLoad_AsyncLoadSampleBank(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
|
||||
AudioLoad_AsyncLoadSampleBank(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioCtx.externalLoadQueue);
|
||||
break;
|
||||
|
||||
case 0xF5:
|
||||
AudioLoad_AsyncLoadFont(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
|
||||
AudioLoad_AsyncLoadFont(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioCtx.externalLoadQueue);
|
||||
break;
|
||||
|
||||
case 0xFC:
|
||||
AudioLoad_AsyncLoadSeq(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioContext.externalLoadQueue);
|
||||
AudioLoad_AsyncLoadSeq(cmd->arg0, cmd->arg1, cmd->arg2, &gAudioCtx.externalLoadQueue);
|
||||
break;
|
||||
|
||||
case 0xF6:
|
||||
|
@ -300,12 +298,12 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
break;
|
||||
|
||||
case 0x90:
|
||||
gAudioContext.unk_5BDC[cmd->arg0] = cmd->asUShort;
|
||||
gAudioCtx.unk_5BDC[cmd->arg0] = cmd->asUShort;
|
||||
break;
|
||||
|
||||
case 0xF9:
|
||||
gAudioContext.resetStatus = 5;
|
||||
gAudioContext.audioResetSpecIdToLoad = cmd->asUInt;
|
||||
gAudioCtx.resetStatus = 5;
|
||||
gAudioCtx.audioResetSpecIdToLoad = cmd->asUInt;
|
||||
break;
|
||||
|
||||
case 0xFB:
|
||||
|
@ -321,8 +319,8 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
case 0xFE:
|
||||
temp_t7 = cmd->asUInt;
|
||||
if (temp_t7 == 1) {
|
||||
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[i];
|
||||
for (i = 0; i < gAudioCtx.audioBufferParameters.numSequencePlayers; i++) {
|
||||
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[i];
|
||||
|
||||
if (seqPlayer->enabled) {
|
||||
AudioSeq_SequencePlayerDisableAsFinished(seqPlayer);
|
||||
|
@ -343,7 +341,7 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
|
||||
// SetFadeOutTimer
|
||||
void func_800E5958(s32 playerIdx, s32 fadeTimer) {
|
||||
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx];
|
||||
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
|
||||
|
||||
if (fadeTimer == 0) {
|
||||
fadeTimer = 1;
|
||||
|
@ -359,7 +357,7 @@ void func_800E59AC(s32 playerIdx, s32 fadeTimer) {
|
|||
SequencePlayer* seqPlayer;
|
||||
|
||||
if (fadeTimer != 0) {
|
||||
seqPlayer = &gAudioContext.seqPlayers[playerIdx];
|
||||
seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
|
||||
seqPlayer->state = 1;
|
||||
seqPlayer->fadeTimerUnkEu = fadeTimer;
|
||||
seqPlayer->fadeTimer = fadeTimer;
|
||||
|
@ -369,30 +367,27 @@ void func_800E59AC(s32 playerIdx, s32 fadeTimer) {
|
|||
}
|
||||
|
||||
void Audio_InitMesgQueuesInternal(void) {
|
||||
gAudioContext.cmdWrPos = 0;
|
||||
gAudioContext.cmdRdPos = 0;
|
||||
gAudioContext.cmdQueueFinished = 0;
|
||||
gAudioContext.taskStartQueueP = &gAudioContext.taskStartQueue;
|
||||
gAudioContext.cmdProcQueueP = &gAudioContext.cmdProcQueue;
|
||||
gAudioContext.audioResetQueueP = &gAudioContext.audioResetQueue;
|
||||
osCreateMesgQueue(gAudioContext.taskStartQueueP, gAudioContext.taskStartMsgBuf,
|
||||
ARRAY_COUNT(gAudioContext.taskStartMsgBuf));
|
||||
osCreateMesgQueue(gAudioContext.cmdProcQueueP, gAudioContext.cmdProcMsgBuf,
|
||||
ARRAY_COUNT(gAudioContext.cmdProcMsgBuf));
|
||||
osCreateMesgQueue(gAudioContext.audioResetQueueP, gAudioContext.audioResetMsgBuf,
|
||||
ARRAY_COUNT(gAudioContext.audioResetMsgBuf));
|
||||
gAudioCtx.cmdWrPos = 0;
|
||||
gAudioCtx.cmdRdPos = 0;
|
||||
gAudioCtx.cmdQueueFinished = 0;
|
||||
gAudioCtx.taskStartQueueP = &gAudioCtx.taskStartQueue;
|
||||
gAudioCtx.cmdProcQueueP = &gAudioCtx.cmdProcQueue;
|
||||
gAudioCtx.audioResetQueueP = &gAudioCtx.audioResetQueue;
|
||||
osCreateMesgQueue(gAudioCtx.taskStartQueueP, gAudioCtx.taskStartMsgBuf, ARRAY_COUNT(gAudioCtx.taskStartMsgBuf));
|
||||
osCreateMesgQueue(gAudioCtx.cmdProcQueueP, gAudioCtx.cmdProcMsgBuf, ARRAY_COUNT(gAudioCtx.cmdProcMsgBuf));
|
||||
osCreateMesgQueue(gAudioCtx.audioResetQueueP, gAudioCtx.audioResetMsgBuf, ARRAY_COUNT(gAudioCtx.audioResetMsgBuf));
|
||||
}
|
||||
|
||||
void Audio_QueueCmd(u32 opArgs, void** data) {
|
||||
AudioCmd* cmd = &gAudioContext.cmdBuf[gAudioContext.cmdWrPos & 0xFF];
|
||||
AudioCmd* cmd = &gAudioCtx.cmdBuf[gAudioCtx.cmdWrPos & 0xFF];
|
||||
|
||||
cmd->opArgs = opArgs;
|
||||
cmd->data = *data;
|
||||
|
||||
gAudioContext.cmdWrPos++;
|
||||
gAudioCtx.cmdWrPos++;
|
||||
|
||||
if (gAudioContext.cmdWrPos == gAudioContext.cmdRdPos) {
|
||||
gAudioContext.cmdWrPos--;
|
||||
if (gAudioCtx.cmdWrPos == gAudioCtx.cmdRdPos) {
|
||||
gAudioCtx.cmdWrPos--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,15 +415,14 @@ s32 Audio_ScheduleProcessCmds(void) {
|
|||
static s32 D_801304E8 = 0;
|
||||
s32 ret;
|
||||
|
||||
if (D_801304E8 < (u8)((gAudioContext.cmdWrPos - gAudioContext.cmdRdPos) + 0x100)) {
|
||||
D_801304E8 = (u8)((gAudioContext.cmdWrPos - gAudioContext.cmdRdPos) + 0x100);
|
||||
if (D_801304E8 < (u8)((gAudioCtx.cmdWrPos - gAudioCtx.cmdRdPos) + 0x100)) {
|
||||
D_801304E8 = (u8)((gAudioCtx.cmdWrPos - gAudioCtx.cmdRdPos) + 0x100);
|
||||
}
|
||||
|
||||
ret =
|
||||
osSendMesg(gAudioContext.cmdProcQueueP,
|
||||
(OSMesg)(((gAudioContext.cmdRdPos & 0xFF) << 8) | (gAudioContext.cmdWrPos & 0xFF)), OS_MESG_NOBLOCK);
|
||||
ret = osSendMesg(gAudioCtx.cmdProcQueueP,
|
||||
(OSMesg)(((gAudioCtx.cmdRdPos & 0xFF) << 8) | (gAudioCtx.cmdWrPos & 0xFF)), OS_MESG_NOBLOCK);
|
||||
if (ret != -1) {
|
||||
gAudioContext.cmdRdPos = gAudioContext.cmdWrPos;
|
||||
gAudioCtx.cmdRdPos = gAudioCtx.cmdWrPos;
|
||||
ret = 0;
|
||||
} else {
|
||||
return -1;
|
||||
|
@ -438,8 +432,8 @@ s32 Audio_ScheduleProcessCmds(void) {
|
|||
}
|
||||
|
||||
void Audio_ResetCmdQueue(void) {
|
||||
gAudioContext.cmdQueueFinished = 0;
|
||||
gAudioContext.cmdRdPos = gAudioContext.cmdWrPos;
|
||||
gAudioCtx.cmdQueueFinished = 0;
|
||||
gAudioCtx.cmdRdPos = gAudioCtx.cmdWrPos;
|
||||
}
|
||||
|
||||
void Audio_ProcessCmd(AudioCmd* cmd) {
|
||||
|
@ -452,8 +446,8 @@ void Audio_ProcessCmd(AudioCmd* cmd) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (cmd->arg0 < gAudioContext.audioBufferParameters.numSequencePlayers) {
|
||||
seqPlayer = &gAudioContext.seqPlayers[cmd->arg0];
|
||||
if (cmd->arg0 < gAudioCtx.audioBufferParameters.numSequencePlayers) {
|
||||
seqPlayer = &gAudioCtx.seqPlayers[cmd->arg0];
|
||||
if (cmd->op & 0x80) {
|
||||
func_800E5584(cmd);
|
||||
return;
|
||||
|
@ -468,7 +462,7 @@ void Audio_ProcessCmd(AudioCmd* cmd) {
|
|||
return;
|
||||
}
|
||||
if (cmd->arg1 == 0xFF) {
|
||||
phi_v0 = gAudioContext.unk_5BDC[cmd->arg0];
|
||||
phi_v0 = gAudioCtx.unk_5BDC[cmd->arg0];
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (phi_v0 & 1) {
|
||||
func_800E6300(seqPlayer->channels[i], cmd);
|
||||
|
@ -484,20 +478,20 @@ void Audio_ProcessCmds(u32 msg) {
|
|||
AudioCmd* cmd;
|
||||
u8 endPos;
|
||||
|
||||
if (!gAudioContext.cmdQueueFinished) {
|
||||
if (!gAudioCtx.cmdQueueFinished) {
|
||||
curCmdRdPos = msg >> 8;
|
||||
}
|
||||
|
||||
while (true) {
|
||||
endPos = msg & 0xFF;
|
||||
if (curCmdRdPos == endPos) {
|
||||
gAudioContext.cmdQueueFinished = 0;
|
||||
gAudioCtx.cmdQueueFinished = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
cmd = &gAudioContext.cmdBuf[curCmdRdPos++ & 0xFF];
|
||||
cmd = &gAudioCtx.cmdBuf[curCmdRdPos++ & 0xFF];
|
||||
if (cmd->op == 0xF8) {
|
||||
gAudioContext.cmdQueueFinished = 1;
|
||||
gAudioCtx.cmdQueueFinished = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -509,7 +503,7 @@ void Audio_ProcessCmds(u32 msg) {
|
|||
u32 func_800E5E20(u32* out) {
|
||||
u32 sp1C;
|
||||
|
||||
if (osRecvMesg(&gAudioContext.externalLoadQueue, (OSMesg*)&sp1C, OS_MESG_NOBLOCK) == -1) {
|
||||
if (osRecvMesg(&gAudioCtx.externalLoadQueue, (OSMesg*)&sp1C, OS_MESG_NOBLOCK) == -1) {
|
||||
*out = 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -522,17 +516,17 @@ u8* func_800E5E84(s32 arg0, u32* arg1) {
|
|||
}
|
||||
|
||||
void Audio_GetSampleBankIdsOfFont(s32 fontId, u32* sampleBankId1, u32* sampleBankId2) {
|
||||
*sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
|
||||
*sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
|
||||
*sampleBankId1 = gAudioCtx.soundFontList[fontId].sampleBankId1;
|
||||
*sampleBankId2 = gAudioCtx.soundFontList[fontId].sampleBankId2;
|
||||
}
|
||||
|
||||
s32 func_800E5EDC(void) {
|
||||
s32 pad;
|
||||
s32 sp18;
|
||||
|
||||
if (osRecvMesg(gAudioContext.audioResetQueueP, (OSMesg*)&sp18, OS_MESG_NOBLOCK) == -1) {
|
||||
if (osRecvMesg(gAudioCtx.audioResetQueueP, (OSMesg*)&sp18, OS_MESG_NOBLOCK) == -1) {
|
||||
return 0;
|
||||
} else if (gAudioContext.audioResetSpecIdToLoad != sp18) {
|
||||
} else if (gAudioCtx.audioResetSpecIdToLoad != sp18) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
|
@ -542,7 +536,7 @@ s32 func_800E5EDC(void) {
|
|||
void func_800E5F34(void) {
|
||||
// macro?
|
||||
// clang-format off
|
||||
s32 chk = -1; OSMesg msg; do {} while (osRecvMesg(gAudioContext.audioResetQueueP, &msg, OS_MESG_NOBLOCK) != chk);
|
||||
s32 chk = -1; OSMesg msg; do {} while (osRecvMesg(gAudioCtx.audioResetQueueP, &msg, OS_MESG_NOBLOCK) != chk);
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
|
@ -552,16 +546,16 @@ s32 func_800E5F88(s32 resetPreloadID) {
|
|||
s32 pad;
|
||||
|
||||
func_800E5F34();
|
||||
resetStatus = gAudioContext.resetStatus;
|
||||
resetStatus = gAudioCtx.resetStatus;
|
||||
if (resetStatus != 0) {
|
||||
Audio_ResetCmdQueue();
|
||||
if (gAudioContext.audioResetSpecIdToLoad == resetPreloadID) {
|
||||
if (gAudioCtx.audioResetSpecIdToLoad == resetPreloadID) {
|
||||
return -2;
|
||||
} else if (resetStatus > 2) {
|
||||
gAudioContext.audioResetSpecIdToLoad = resetPreloadID;
|
||||
gAudioCtx.audioResetSpecIdToLoad = resetPreloadID;
|
||||
return -3;
|
||||
} else {
|
||||
osRecvMesg(gAudioContext.audioResetQueueP, &msg, OS_MESG_BLOCK);
|
||||
osRecvMesg(gAudioCtx.audioResetQueueP, &msg, OS_MESG_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -572,15 +566,15 @@ s32 func_800E5F88(s32 resetPreloadID) {
|
|||
}
|
||||
|
||||
void Audio_PreNMIInternal(void) {
|
||||
gAudioContext.resetTimer = 1;
|
||||
gAudioCtx.resetTimer = 1;
|
||||
if (gAudioContextInitialized) {
|
||||
func_800E5F88(0);
|
||||
gAudioContext.resetStatus = 0;
|
||||
gAudioCtx.resetStatus = 0;
|
||||
}
|
||||
}
|
||||
|
||||
s8 func_800E6070(s32 playerIdx, s32 channelIdx, s32 scriptIdx) {
|
||||
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx];
|
||||
SequencePlayer* seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
|
||||
SequenceChannel* channel;
|
||||
|
||||
if (seqPlayer->enabled) {
|
||||
|
@ -592,15 +586,15 @@ s8 func_800E6070(s32 playerIdx, s32 channelIdx, s32 scriptIdx) {
|
|||
}
|
||||
|
||||
s8 func_800E60C4(s32 playerIdx, s32 port) {
|
||||
return gAudioContext.seqPlayers[playerIdx].soundScriptIO[port];
|
||||
return gAudioCtx.seqPlayers[playerIdx].soundScriptIO[port];
|
||||
}
|
||||
|
||||
void Audio_InitExternalPool(void* ramAddr, u32 size) {
|
||||
AudioHeap_InitPool(&gAudioContext.externalPool, ramAddr, size);
|
||||
AudioHeap_InitPool(&gAudioCtx.externalPool, ramAddr, size);
|
||||
}
|
||||
|
||||
void Audio_DestroyExternalPool(void) {
|
||||
gAudioContext.externalPool.startRamAddr = NULL;
|
||||
gAudioCtx.externalPool.startRamAddr = NULL;
|
||||
}
|
||||
|
||||
void func_800E6128(SequencePlayer* seqPlayer, AudioCmd* cmd) {
|
||||
|
@ -780,8 +774,8 @@ void func_800E651C(u32 arg0, s32 arg1) {
|
|||
}
|
||||
|
||||
void Audio_WaitForAudioTask(void) {
|
||||
osRecvMesg(gAudioContext.taskStartQueueP, NULL, OS_MESG_NOBLOCK);
|
||||
osRecvMesg(gAudioContext.taskStartQueueP, NULL, OS_MESG_BLOCK);
|
||||
osRecvMesg(gAudioCtx.taskStartQueueP, NULL, OS_MESG_NOBLOCK);
|
||||
osRecvMesg(gAudioCtx.taskStartQueueP, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
s32 func_800E6590(s32 playerIdx, s32 arg1, s32 arg2) {
|
||||
|
@ -792,7 +786,7 @@ s32 func_800E6590(s32 playerIdx, s32 arg1, s32 arg2) {
|
|||
s32 loopEnd;
|
||||
s32 samplePos;
|
||||
|
||||
seqPlayer = &gAudioContext.seqPlayers[playerIdx];
|
||||
seqPlayer = &gAudioCtx.seqPlayers[playerIdx];
|
||||
if (seqPlayer->enabled && seqPlayer->channels[arg1]->enabled) {
|
||||
layer = seqPlayer->channels[arg1]->layers[arg2];
|
||||
if (layer == NULL) {
|
||||
|
@ -841,8 +835,8 @@ s32 func_800E66C0(s32 arg0) {
|
|||
TunedSample* tunedSample;
|
||||
|
||||
phi_v1 = 0;
|
||||
for (i = 0; i < gAudioContext.numNotes; i++) {
|
||||
note = &gAudioContext.notes[i];
|
||||
for (i = 0; i < gAudioCtx.numNotes; i++) {
|
||||
note = &gAudioCtx.notes[i];
|
||||
playbackState = ¬e->playbackState;
|
||||
if (note->noteSubEu.bitField0.enabled) {
|
||||
noteSubEu = ¬e->noteSubEu;
|
||||
|
@ -859,7 +853,7 @@ s32 func_800E66C0(s32 arg0) {
|
|||
|
||||
phi_v1++;
|
||||
if ((arg0 & 1) == 1) {
|
||||
playbackState->adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
playbackState->adsr.fadeOutVel = gAudioCtx.audioBufferParameters.updatesPerFrameInv;
|
||||
playbackState->adsr.action.s.release = 1;
|
||||
}
|
||||
}
|
||||
|
@ -871,8 +865,8 @@ s32 func_800E66C0(s32 arg0) {
|
|||
u32 Audio_NextRandom(void) {
|
||||
static u32 audRand = 0x12345678;
|
||||
|
||||
audRand = ((osGetCount() + 0x1234567) * (audRand + gAudioContext.totalTaskCount));
|
||||
audRand += gAudioContext.audioRandom;
|
||||
audRand = ((osGetCount() + 0x1234567) * (audRand + gAudioCtx.totalTaskCount));
|
||||
audRand += gAudioCtx.audioRandom;
|
||||
return audRand;
|
||||
}
|
||||
|
||||
|
|
|
@ -112,8 +112,11 @@ u8 sPrevSeqMode = 0;
|
|||
f32 sAudioEnemyDist = 0.0f;
|
||||
s8 sAudioEnemyVol = 127;
|
||||
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 sNumFramesMoving = 0;
|
||||
u8 sAudioBaseFilter = 0;
|
||||
|
@ -128,12 +131,31 @@ u8 sSeqModeInput = 0;
|
|||
#define SEQ_FLAG_FANFARE (1 << 1)
|
||||
#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_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)
|
||||
|
||||
u8 sSeqFlags[0x6E] = {
|
||||
u8 sSeqFlags[] = {
|
||||
SEQ_FLAG_FANFARE, // NA_BGM_GENERAL_SFX
|
||||
SEQ_FLAG_ENEMY, // NA_BGM_NATURE_BACKGROUND
|
||||
0, // NA_BGM_FIELD_LOGIC
|
||||
|
@ -158,14 +180,14 @@ u8 sSeqFlags[0x6E] = {
|
|||
0, // NA_BGM_FIELD_STILL_2
|
||||
0, // NA_BGM_FIELD_STILL_3
|
||||
0, // NA_BGM_FIELD_STILL_4
|
||||
SEQ_FLAG_5 | SEQ_FLAG_ENEMY, // NA_BGM_DUNGEON
|
||||
SEQ_FLAG_4, // NA_BGM_KAKARIKO_ADULT
|
||||
SEQ_FLAG_RESUME_PREV | SEQ_FLAG_ENEMY, // NA_BGM_DUNGEON
|
||||
SEQ_FLAG_RESUME, // NA_BGM_KAKARIKO_ADULT
|
||||
0, // NA_BGM_ENEMY
|
||||
SEQ_FLAG_NO_AMBIENCE | SEQ_FLAG_RESTORE, // NA_BGM_BOSS
|
||||
SEQ_FLAG_ENEMY, // NA_BGM_INSIDE_DEKU_TREE
|
||||
0, // NA_BGM_MARKET
|
||||
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_BOSS_CLEAR
|
||||
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_OCA_LIGHT
|
||||
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_ZELDA_THEME
|
||||
SEQ_FLAG_ENEMY, // NA_BGM_FIRE_TEMPLE
|
||||
|
@ -194,7 +216,7 @@ u8 sSeqFlags[0x6E] = {
|
|||
SEQ_FLAG_FANFARE, // NA_BGM_SMALL_ITEM_GET
|
||||
0, // NA_BGM_TEMPLE_OF_TIME
|
||||
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_ENEMY, // NA_BGM_SARIA_THEME
|
||||
SEQ_FLAG_ENEMY, // NA_BGM_SPIRIT_TEMPLE
|
||||
|
@ -212,16 +234,16 @@ u8 sSeqFlags[0x6E] = {
|
|||
0, // NA_BGM_DEKU_TREE_CS
|
||||
0, // NA_BGM_WINDMILL
|
||||
0, // NA_BGM_HYRULE_CS
|
||||
SEQ_FLAG_5, // NA_BGM_MINI_GAME
|
||||
SEQ_FLAG_RESUME_PREV, // NA_BGM_MINI_GAME
|
||||
0, // NA_BGM_SHEIK
|
||||
SEQ_FLAG_4, // NA_BGM_ZORA_DOMAIN
|
||||
SEQ_FLAG_RESUME, // NA_BGM_ZORA_DOMAIN
|
||||
SEQ_FLAG_FANFARE, // NA_BGM_APPEAR
|
||||
0, // NA_BGM_ADULT_LINK
|
||||
0, // NA_BGM_MASTER_SWORD
|
||||
SEQ_FLAG_FANFARE_GANON, // NA_BGM_INTRO_GANON
|
||||
SEQ_FLAG_5, // NA_BGM_SHOP
|
||||
SEQ_FLAG_6, // NA_BGM_CHAMBER_OF_SAGES
|
||||
SEQ_FLAG_6, // NA_BGM_FILE_SELECT
|
||||
SEQ_FLAG_RESUME_PREV, // NA_BGM_SHOP
|
||||
SEQ_FLAG_SKIP_HARP_INTRO, // NA_BGM_CHAMBER_OF_SAGES
|
||||
SEQ_FLAG_SKIP_HARP_INTRO, // NA_BGM_FILE_SELECT
|
||||
SEQ_FLAG_ENEMY, // NA_BGM_ICE_CAVERN
|
||||
SEQ_FLAG_FANFARE, // NA_BGM_DOOR_OF_TIME
|
||||
SEQ_FLAG_FANFARE, // NA_BGM_OWL
|
||||
|
@ -229,7 +251,7 @@ u8 sSeqFlags[0x6E] = {
|
|||
SEQ_FLAG_ENEMY, // NA_BGM_WATER_TEMPLE
|
||||
SEQ_FLAG_FANFARE, // NA_BGM_BRIDGE_TO_GANONS
|
||||
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_KOTAKE_KOUME
|
||||
SEQ_FLAG_NO_AMBIENCE, // NA_BGM_ESCAPE
|
||||
|
@ -1215,9 +1237,9 @@ u8 sRiverSoundMainBgmRestore;
|
|||
u8 sGanonsTowerVol;
|
||||
SfxPlayerState sSfxChannelState[0x10];
|
||||
char sBinToStrBuf[0x20];
|
||||
u8 D_8016B9D8;
|
||||
u8 sMalonSingingTimer;
|
||||
u8 sAudioSpecPeakNumNotes[0x12];
|
||||
u8 D_8016B9F2;
|
||||
u8 sMalonSingingDisabled;
|
||||
u8 D_8016B9F3;
|
||||
u8 D_8016B9F4;
|
||||
u16 D_8016B9F6;
|
||||
|
@ -1244,13 +1266,13 @@ u16 sMusicStaffCurHeldLength[OCARINA_SONG_MAX];
|
|||
u16 sMusicStaffExpectedLength[OCARINA_SONG_MAX];
|
||||
u8 sMusicStaffExpectedPitch[OCARINA_SONG_MAX];
|
||||
OcarinaNote sScarecrowsLongSongSecondNote;
|
||||
u8 sAudioHasMalonBgm;
|
||||
f32 sAudioMalonBgmDist;
|
||||
u8 sIsMalonSinging;
|
||||
f32 sMalonSingingDist;
|
||||
|
||||
void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 gameRequest);
|
||||
|
||||
void Audio_StepFreqLerp(FreqLerp* lerp);
|
||||
void func_800F56A8(void);
|
||||
void Audio_UpdateSceneSequenceResumePoint(void);
|
||||
void Audio_PlayNatureAmbienceSequence(u8 natureAmbienceId);
|
||||
s32 Audio_SetGanonsTowerBgmVolume(u8 targetVol);
|
||||
|
||||
|
@ -2200,7 +2222,7 @@ s32 AudioOcarina_MemoryGameNextNote(void) {
|
|||
}
|
||||
|
||||
void AudioOcarina_Update(void) {
|
||||
sOcarinaUpdateTaskStart = gAudioContext.totalTaskCount;
|
||||
sOcarinaUpdateTaskStart = gAudioCtx.totalTaskCount;
|
||||
if (sOcarinaInstrumentId != OCARINA_INSTRUMENT_OFF) {
|
||||
if (sIsOcarinaInputEnabled == true) {
|
||||
AudioOcarina_ReadControllerInput();
|
||||
|
@ -2404,7 +2426,7 @@ void AudioDebug_Draw(GfxPrint* printer) {
|
|||
GfxPrint_Printf(printer, "- %s -", sAudioDebugPageNames[sAudioDebugPage]);
|
||||
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
@ -2529,7 +2551,7 @@ void AudioDebug_Draw(GfxPrint* printer) {
|
|||
for (k2 = 0; k2 < gChannelsPerBank[gSfxChannelLayout][k]; k2++) {
|
||||
#define entryIndex (gActiveSfx[k][k2].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);
|
||||
if (sAudioIntInfoBankPage[k] == 1) {
|
||||
if ((entryIndex != 0xFF) &&
|
||||
|
@ -2692,14 +2714,14 @@ void AudioDebug_Draw(GfxPrint* printer) {
|
|||
GfxPrint_Printf(printer, "%1X", i);
|
||||
|
||||
GfxPrint_SetPos(printer, 15 + i, 7);
|
||||
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->enabled) {
|
||||
if (gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->enabled) {
|
||||
GfxPrint_Printf(printer, "O");
|
||||
} else {
|
||||
GfxPrint_Printf(printer, "X");
|
||||
}
|
||||
|
||||
GfxPrint_SetPos(printer, 15 + i, 8);
|
||||
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->stopSomething2) {
|
||||
if (gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[i]->stopSomething2) {
|
||||
GfxPrint_Printf(printer, "O");
|
||||
} else {
|
||||
GfxPrint_Printf(printer, "X");
|
||||
|
@ -2708,7 +2730,7 @@ void AudioDebug_Draw(GfxPrint* printer) {
|
|||
GfxPrint_SetPos(printer, 15 + i, 9);
|
||||
ctr = 0;
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
@ -2763,33 +2785,32 @@ void AudioDebug_Draw(GfxPrint* printer) {
|
|||
for (i = 0; i < 8; i++) {
|
||||
GfxPrint_SetPos(printer, 15 + 3 * i, 22);
|
||||
GfxPrint_Printf(printer, "%02X ",
|
||||
(u8)gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
(u8)gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->soundScriptIO[i]);
|
||||
}
|
||||
|
||||
if (gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->enabled) {
|
||||
if (gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->enabled) {
|
||||
GfxPrint_SetPos(printer, 15, 11);
|
||||
GfxPrint_Printf(printer, "%d",
|
||||
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
(u8)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->volume *
|
||||
127.1));
|
||||
|
||||
GfxPrint_SetPos(printer, 15, 12);
|
||||
GfxPrint_Printf(printer, "%d",
|
||||
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
(u8)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->volumeScale *
|
||||
127.1));
|
||||
|
||||
GfxPrint_SetPos(printer, 15, 13);
|
||||
GfxPrint_Printf(printer, "%X",
|
||||
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->fontId);
|
||||
GfxPrint_Printf(
|
||||
printer, "%X",
|
||||
gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->fontId);
|
||||
|
||||
ctr = (u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
ctr = (u8)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->instOrWave);
|
||||
|
||||
|
@ -2805,46 +2826,44 @@ void AudioDebug_Draw(GfxPrint* printer) {
|
|||
GfxPrint_Printf(printer, "%d", ctr2);
|
||||
|
||||
GfxPrint_SetPos(printer, 15, 15);
|
||||
GfxPrint_Printf(printer, "%d",
|
||||
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->newPan);
|
||||
GfxPrint_Printf(
|
||||
printer, "%d",
|
||||
gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->newPan);
|
||||
|
||||
GfxPrint_SetPos(printer, 15, 16);
|
||||
GfxPrint_Printf(printer, "%d",
|
||||
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->panChannelWeight);
|
||||
|
||||
GfxPrint_SetPos(printer, 15, 17);
|
||||
GfxPrint_Printf(printer, "%d",
|
||||
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->reverb);
|
||||
GfxPrint_Printf(
|
||||
printer, "%d",
|
||||
gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel].channels[sAudioSubTrackInfoChannelSel]->reverb);
|
||||
|
||||
GfxPrint_SetPos(printer, 15, 18);
|
||||
GfxPrint_Printf(printer, "%d",
|
||||
gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->notePriority);
|
||||
|
||||
GfxPrint_SetPos(printer, 15, 19);
|
||||
GfxPrint_Printf(printer, "%d",
|
||||
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
(u8)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->vibratoRateTarget /
|
||||
32));
|
||||
|
||||
GfxPrint_SetPos(printer, 15, 20);
|
||||
GfxPrint_Printf(printer, "%d",
|
||||
(u8)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
(u8)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->vibratoExtentTarget /
|
||||
8));
|
||||
|
||||
GfxPrint_SetPos(printer, 15, 21);
|
||||
GfxPrint_Printf(printer, "%d",
|
||||
(u16)(gAudioContext.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
(u16)(gAudioCtx.seqPlayers[sAudioSubTrackInfoPlayerSel]
|
||||
.channels[sAudioSubTrackInfoChannelSel]
|
||||
->freqScale *
|
||||
100));
|
||||
|
@ -2858,47 +2877,46 @@ void AudioDebug_Draw(GfxPrint* printer) {
|
|||
|
||||
GfxPrint_SetPos(printer, 3, 5);
|
||||
GfxPrint_Printf(printer, "DRIVER %05X / %05X",
|
||||
gAudioContext.miscPool.curRamAddr - gAudioContext.miscPool.startRamAddr,
|
||||
gAudioContext.miscPool.size);
|
||||
gAudioCtx.miscPool.curRamAddr - gAudioCtx.miscPool.startRamAddr, gAudioCtx.miscPool.size);
|
||||
|
||||
GfxPrint_SetPos(printer, 3, 6);
|
||||
GfxPrint_Printf(
|
||||
printer, "AT-SEQ %02X-%02X (%05X-%05X / %05X)", (u8)gAudioContext.seqCache.temporary.entries[0].id,
|
||||
(u8)gAudioContext.seqCache.temporary.entries[1].id, gAudioContext.seqCache.temporary.entries[0].size,
|
||||
gAudioContext.seqCache.temporary.entries[1].size, gAudioContext.seqCache.temporary.pool.size);
|
||||
printer, "AT-SEQ %02X-%02X (%05X-%05X / %05X)", (u8)gAudioCtx.seqCache.temporary.entries[0].id,
|
||||
(u8)gAudioCtx.seqCache.temporary.entries[1].id, gAudioCtx.seqCache.temporary.entries[0].size,
|
||||
gAudioCtx.seqCache.temporary.entries[1].size, gAudioCtx.seqCache.temporary.pool.size);
|
||||
|
||||
GfxPrint_SetPos(printer, 3, 7);
|
||||
GfxPrint_Printf(
|
||||
printer, "AT-BNK %02X-%02X (%05X-%05X / %05X)", (u8)gAudioContext.fontCache.temporary.entries[0].id,
|
||||
(u8)gAudioContext.fontCache.temporary.entries[1].id, gAudioContext.fontCache.temporary.entries[0].size,
|
||||
gAudioContext.fontCache.temporary.entries[1].size, gAudioContext.fontCache.temporary.pool.size);
|
||||
printer, "AT-BNK %02X-%02X (%05X-%05X / %05X)", (u8)gAudioCtx.fontCache.temporary.entries[0].id,
|
||||
(u8)gAudioCtx.fontCache.temporary.entries[1].id, gAudioCtx.fontCache.temporary.entries[0].size,
|
||||
gAudioCtx.fontCache.temporary.entries[1].size, gAudioCtx.fontCache.temporary.pool.size);
|
||||
|
||||
GfxPrint_SetPos(printer, 3, 8);
|
||||
GfxPrint_Printf(printer, "ST-SEQ %02Xseqs (%05X / %06X)", gAudioContext.seqCache.persistent.numEntries,
|
||||
gAudioContext.seqCache.persistent.pool.curRamAddr -
|
||||
gAudioContext.seqCache.persistent.pool.startRamAddr,
|
||||
gAudioContext.seqCache.persistent.pool.size);
|
||||
GfxPrint_Printf(printer, "ST-SEQ %02Xseqs (%05X / %06X)", gAudioCtx.seqCache.persistent.numEntries,
|
||||
gAudioCtx.seqCache.persistent.pool.curRamAddr -
|
||||
gAudioCtx.seqCache.persistent.pool.startRamAddr,
|
||||
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_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_Printf(printer, "ST-BNK %02Xbanks (%05X / %06X)", gAudioContext.fontCache.persistent.numEntries,
|
||||
gAudioContext.fontCache.persistent.pool.curRamAddr -
|
||||
gAudioContext.fontCache.persistent.pool.startRamAddr,
|
||||
gAudioContext.fontCache.persistent.pool.size);
|
||||
GfxPrint_Printf(printer, "ST-BNK %02Xbanks (%05X / %06X)", gAudioCtx.fontCache.persistent.numEntries,
|
||||
gAudioCtx.fontCache.persistent.pool.curRamAddr -
|
||||
gAudioCtx.fontCache.persistent.pool.startRamAddr,
|
||||
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_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_Printf(printer, "E-MEM %05X / %05X",
|
||||
gAudioContext.permanentPool.curRamAddr - gAudioContext.permanentPool.startRamAddr,
|
||||
gAudioContext.permanentPool.size);
|
||||
gAudioCtx.permanentPool.curRamAddr - gAudioCtx.permanentPool.startRamAddr,
|
||||
gAudioCtx.permanentPool.size);
|
||||
break;
|
||||
|
||||
case PAGE_BLOCK_CHANGE_BGM:
|
||||
|
@ -2917,34 +2935,34 @@ void AudioDebug_Draw(GfxPrint* printer) {
|
|||
SETCOL(255, 255, 255);
|
||||
GfxPrint_SetPos(printer, 3, 7);
|
||||
GfxPrint_Printf(printer, "NEXT SCENE %02X %s",
|
||||
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2],
|
||||
sAudioSceneNames[(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2]]);
|
||||
(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2],
|
||||
sAudioSceneNames[(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2]]);
|
||||
|
||||
GfxPrint_SetPos(printer, 3, 8);
|
||||
GfxPrint_Printf(printer, "NOW SCENE %02X %s",
|
||||
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4],
|
||||
sAudioSceneNames[(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4]]);
|
||||
(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4],
|
||||
sAudioSceneNames[(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4]]);
|
||||
|
||||
GfxPrint_SetPos(printer, 3, 9);
|
||||
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_Printf(printer, "PORT");
|
||||
|
||||
GfxPrint_SetPos(printer, 3, 12);
|
||||
GfxPrint_Printf(printer, "%02X %02X %02X %02X",
|
||||
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[0],
|
||||
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[1],
|
||||
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2],
|
||||
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3]);
|
||||
(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[0],
|
||||
(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[1],
|
||||
(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2],
|
||||
(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3]);
|
||||
|
||||
GfxPrint_SetPos(printer, 3, 13);
|
||||
GfxPrint_Printf(printer, "%02X %02X %02X %02X",
|
||||
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4],
|
||||
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[5],
|
||||
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[6],
|
||||
(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[7]);
|
||||
(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4],
|
||||
(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[5],
|
||||
(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[6],
|
||||
(u8)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[7]);
|
||||
break;
|
||||
|
||||
case PAGE_OCARINA_TEST:
|
||||
|
@ -3040,9 +3058,9 @@ void AudioDebug_Draw(GfxPrint* printer) {
|
|||
GfxPrint_Printf(printer, "DEMO FLAG %d", sAudioCutsceneFlag);
|
||||
|
||||
GfxPrint_SetPos(printer, 3, 12);
|
||||
if (sAudioHasMalonBgm == true) {
|
||||
GfxPrint_Printf(printer, "MARON BGM DIST %f", sAudioMalonBgmDist);
|
||||
sAudioHasMalonBgm = false;
|
||||
if (sIsMalonSinging == true) {
|
||||
GfxPrint_Printf(printer, "MARON BGM DIST %f", sMalonSingingDist);
|
||||
sIsMalonSinging = false;
|
||||
}
|
||||
|
||||
GfxPrint_SetPos(printer, 3, 23);
|
||||
|
@ -3682,13 +3700,13 @@ void func_800F5CF8(void);
|
|||
*/
|
||||
void func_800F3054(void) {
|
||||
if (func_800FAD34() == 0) {
|
||||
sAudioUpdateTaskStart = gAudioContext.totalTaskCount;
|
||||
sAudioUpdateTaskStart = gAudioCtx.totalTaskCount;
|
||||
sAudioUpdateStartTime = osGetTime();
|
||||
AudioOcarina_Update();
|
||||
Audio_StepFreqLerp(&sRiverFreqScaleLerp);
|
||||
Audio_StepFreqLerp(&sWaterfallFreqScaleLerp);
|
||||
Audio_UpdateRiverSoundVolumes();
|
||||
func_800F56A8();
|
||||
Audio_UpdateSceneSequenceResumePoint();
|
||||
func_800F5CF8();
|
||||
if (gAudioSpecId == 7) {
|
||||
Audio_ClearSariaBgm();
|
||||
|
@ -3700,7 +3718,7 @@ void func_800F3054(void) {
|
|||
AudioDebug_SetInput();
|
||||
AudioDebug_ProcessInput();
|
||||
Audio_ScheduleProcessCmds();
|
||||
sAudioUpdateTaskEnd = gAudioContext.totalTaskCount;
|
||||
sAudioUpdateTaskEnd = gAudioCtx.totalTaskCount;
|
||||
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])) {
|
||||
scriptAdd = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1];
|
||||
if (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1] < 0) {
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx])) {
|
||||
scriptAdd = gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1];
|
||||
if (gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1] <= SEQ_IO_VAL_NONE) {
|
||||
scriptAdd = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3843,7 +3861,7 @@ f32 Audio_ComputeSfxFreqScale(u8 bankId, u8 entryIdx) {
|
|||
f32 freq = 1.0f;
|
||||
|
||||
if (entry->sfxParams & SFX_FLAG_14) {
|
||||
freq = 1.0f - ((gAudioContext.audioRandom & 0xF) / 192.0f);
|
||||
freq = 1.0f - ((gAudioCtx.audioRandom & 0xF) / 192.0f);
|
||||
}
|
||||
|
||||
switch (bankId) {
|
||||
|
@ -3867,7 +3885,7 @@ f32 Audio_ComputeSfxFreqScale(u8 bankId, u8 entryIdx) {
|
|||
|
||||
if (phi_v0 == 1) {
|
||||
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;
|
||||
} else {
|
||||
phi_f0 = 1.1f;
|
||||
phi_v0 = gAudioContext.audioRandom % 2;
|
||||
phi_v0 = gAudioCtx.audioRandom % 2;
|
||||
}
|
||||
|
||||
if ((phi_f0 < arg2) && (phi_v0 != 0)) {
|
||||
|
@ -4311,15 +4329,14 @@ s32 Audio_SetGanonsTowerBgmVolume(u8 targetVol) {
|
|||
|
||||
// Sets the reverb
|
||||
for (channelIdx = 0; channelIdx < 16; channelIdx++) {
|
||||
if (gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx] !=
|
||||
&gAudioContext.sequenceChannelNone) {
|
||||
if (gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx] != &gAudioCtx.sequenceChannelNone) {
|
||||
// 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
|
||||
reverb =
|
||||
((u16)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx]->soundScriptIO[5] -
|
||||
targetVol) +
|
||||
0x7F;
|
||||
reverb = ((u16)gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[channelIdx]->soundScriptIO[5] -
|
||||
targetVol) +
|
||||
0x7F;
|
||||
if (reverb > 0x7F) {
|
||||
reverb = 0x7F;
|
||||
}
|
||||
|
@ -4495,7 +4512,7 @@ void Audio_SplitBgmChannels(s8 volSplit) {
|
|||
|
||||
channelBits = 0;
|
||||
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,
|
||||
// then keep the channel on by setting a channelBit
|
||||
// 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));
|
||||
if (sSariaBgmPtr == NULL) {
|
||||
sSariaBgmPtr = pos;
|
||||
func_800F5E18(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2);
|
||||
Audio_PlaySequenceWithSeqPlayerIO(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2);
|
||||
} else {
|
||||
prevDist = sqrtf(SQ(sSariaBgmPtr->z) + SQ(sSariaBgmPtr->x));
|
||||
if (dist < prevDist) {
|
||||
|
@ -4558,52 +4575,60 @@ void Audio_ClearSariaBgm2(void) {
|
|||
sSariaBgmPtr = NULL;
|
||||
}
|
||||
|
||||
void func_800F5510(u16 seqId) {
|
||||
func_800F5550(seqId);
|
||||
func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, 0, 0, 1);
|
||||
void Audio_PlayMorningSceneSequence(u16 seqId) {
|
||||
Audio_PlaySceneSequence(seqId);
|
||||
// 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) {
|
||||
u8 sp27 = 0;
|
||||
u16 nv;
|
||||
void Audio_PlaySceneSequence(u16 seqId) {
|
||||
u8 fadeInDuration = 0;
|
||||
u8 skipHarpIntro;
|
||||
|
||||
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_WINDMILL) {
|
||||
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) == NA_BGM_LONLON) {
|
||||
Audio_StopSequence(SEQ_PLAYER_BGM_SUB, 0);
|
||||
// Terminate all internal audio cmds
|
||||
Audio_QueueCmdS32(0xF8000000, 0);
|
||||
}
|
||||
|
||||
if ((sSeqFlags[D_80130630] & SEQ_FLAG_5) && sSeqFlags[(seqId & 0xFF) & 0xFF] & SEQ_FLAG_4) {
|
||||
|
||||
if ((D_8013062C & 0x3F) != 0) {
|
||||
sp27 = 0x1E;
|
||||
if ((sSeqFlags[sPrevSceneSeqId] & SEQ_FLAG_RESUME_PREV) && sSeqFlags[seqId & 0xFF & 0xFF] & SEQ_FLAG_RESUME) {
|
||||
// Resume the sequence from the point where it left off last time it was played in the scene
|
||||
if ((sSeqResumePoint & 0x3F) != 0) {
|
||||
fadeInDuration = 30;
|
||||
}
|
||||
|
||||
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 {
|
||||
nv = (sSeqFlags[(seqId & 0xFF) & 0xFF] & SEQ_FLAG_6) ? 1 : 0xFF;
|
||||
func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, nv);
|
||||
if (!(sSeqFlags[seqId] & SEQ_FLAG_5)) {
|
||||
D_8013062C = 0xC0;
|
||||
// Start the sequence from the beginning
|
||||
|
||||
// Writes to ioPort 7. See `SEQ_FLAG_SKIP_HARP_INTRO` for writing a value of 1 to ioPort 7.
|
||||
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) {
|
||||
u16 temp_v0;
|
||||
u8 bvar;
|
||||
void Audio_UpdateSceneSequenceResumePoint(void) {
|
||||
u16 seqId = Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
|
||||
|
||||
temp_v0 = Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN);
|
||||
bvar = temp_v0 & 0xFF;
|
||||
if ((temp_v0 != NA_BGM_DISABLED) && (sSeqFlags[bvar] & SEQ_FLAG_4)) {
|
||||
if (D_8013062C != 0xC0) {
|
||||
D_8013062C = gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3];
|
||||
if ((seqId != NA_BGM_DISABLED) && (sSeqFlags[(u8)seqId & 0xFF] & SEQ_FLAG_RESUME)) {
|
||||
if (sSeqResumePoint != SEQ_RESUME_POINT_NONE) {
|
||||
// Get the current point to resume from
|
||||
sSeqResumePoint = gAudioCtx.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3];
|
||||
} 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);
|
||||
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
@ -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_PLAY_SEQUENCE(seqPlayerIndex, fadeTimer, 0, seqId);
|
||||
SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, fadeInDuration, 0, seqId);
|
||||
}
|
||||
|
||||
void Audio_SetSequenceMode(u8 seqMode) {
|
||||
|
@ -4894,56 +4919,69 @@ void Audio_SetBgmEnemyVolume(f32 dist) {
|
|||
sAudioEnemyDist = dist;
|
||||
}
|
||||
|
||||
void func_800F6268(f32 dist, u16 arg1) {
|
||||
void Audio_UpdateMalonSinging(f32 dist, u16 seqId) {
|
||||
s8 pad;
|
||||
s8 phi_v1;
|
||||
s16 temp_a0;
|
||||
s8 melodyVolume;
|
||||
s16 curSeqId;
|
||||
|
||||
sAudioHasMalonBgm = true;
|
||||
sAudioMalonBgmDist = 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) {
|
||||
sIsMalonSinging = true;
|
||||
sMalonSingingDist = dist;
|
||||
|
||||
if (dist > 2000.0f) {
|
||||
phi_v1 = 127;
|
||||
} else if (dist < 200.0f) {
|
||||
phi_v1 = 0;
|
||||
} else {
|
||||
phi_v1 = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f);
|
||||
}
|
||||
// Transition volume of channels 0, 1 and 13 on seq player 0 over 3 frames
|
||||
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_MAIN, 0, 3, 127 - phi_v1);
|
||||
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 (sMalonSingingDisabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
curSeqId = (s8)(Audio_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) & 0xFF);
|
||||
|
||||
if (curSeqId == (seqId & 0xFF)) {
|
||||
if ((seqId & 0xFF) == NA_BGM_LONLON) {
|
||||
// Malon is singing along with the Lon Lon Sequence
|
||||
|
||||
if (dist > 2000.0f) {
|
||||
phi_v1 = 127;
|
||||
melodyVolume = 127;
|
||||
} else if (dist < 200.0f) {
|
||||
phi_v1 = 0;
|
||||
melodyVolume = 0;
|
||||
} 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);
|
||||
SEQCMD_SET_CHANNEL_VOLUME(SEQ_PLAYER_BGM_SUB, 1, 3, 127 - phi_v1);
|
||||
|
||||
// Update volume for channels 0 & 1, which contain Malon's singing
|
||||
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) {
|
||||
D_8016B9D8++;
|
||||
if (dist > 2000.0f) {
|
||||
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;
|
||||
u16 sp34;
|
||||
u16 channelMaskDisable;
|
||||
|
||||
sMalonSingingDisabled = malonSingingDisabled;
|
||||
|
||||
D_8016B9F2 = arg0;
|
||||
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;
|
||||
sp34 = 0;
|
||||
} else if ((Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) & 0xFF) == NA_BGM_LONLON) {
|
||||
// Do not disable any channel.
|
||||
// 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;
|
||||
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 {
|
||||
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, 1, 1, 0);
|
||||
|
||||
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 {
|
||||
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, 1, 1, 0x7F);
|
||||
|
||||
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;
|
||||
sRiverSoundMainBgmRestore = false;
|
||||
sGanonsTowerVol = 0xFF;
|
||||
D_8016B9D8 = 0;
|
||||
sMalonSingingTimer = 0;
|
||||
sSpecReverb = sSpecReverbs[gAudioSpecId];
|
||||
D_80130608 = 0;
|
||||
sPrevMainBgmSeqId = NA_BGM_DISABLED;
|
||||
|
@ -5167,7 +5225,7 @@ void func_800F6C34(void) {
|
|||
sSariaBgmPtr = NULL;
|
||||
D_8016B9F4 = 0;
|
||||
D_8016B9F3 = 1;
|
||||
D_8016B9F2 = 0;
|
||||
sMalonSingingDisabled = false;
|
||||
}
|
||||
|
||||
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
|
||||
if (((channelIdxRange << 8) + ioPort) == ((NATURE_CHANNEL_CRITTER_0 << 8) + CHANNEL_IO_PORT_1)) {
|
||||
if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM_SUB) != NA_BGM_LONLON) {
|
||||
D_8016B9D8 = 0;
|
||||
sMalonSingingTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@ void Audio_PlayActiveSfx(u8 bankId) {
|
|||
entryIndex = gActiveSfx[bankId][i].entryIndex;
|
||||
if (entryIndex != 0xFF) {
|
||||
entry = &gSfxBanks[bankId][entryIndex];
|
||||
channel = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[sCurSfxPlayerChannelIdx];
|
||||
channel = gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[sCurSfxPlayerChannelIdx];
|
||||
if (entry->state == SFX_STATE_READY) {
|
||||
entry->channelIdx = sCurSfxPlayerChannelIdx;
|
||||
if (entry->sfxParams & SFX_FLAG_3) {
|
||||
|
@ -476,7 +476,7 @@ void Audio_PlayActiveSfx(u8 bankId) {
|
|||
} else {
|
||||
entry->state = SFX_STATE_PLAYING_2;
|
||||
}
|
||||
} else if ((u8)channel->soundScriptIO[1] == 0xFF) {
|
||||
} else if ((u8)channel->soundScriptIO[1] == (u8)SEQ_IO_VAL_NONE) {
|
||||
Audio_RemoveSfxBankEntry(bankId, entryIndex);
|
||||
} else if (entry->state == SFX_STATE_PLAYING_REFRESH) {
|
||||
Audio_SetSfxProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx);
|
||||
|
@ -661,7 +661,7 @@ void Audio_StepUnusedBankLerp(u8 bankId) {
|
|||
void func_800F8F88(void) {
|
||||
u8 bankId;
|
||||
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[0])) {
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(gAudioCtx.seqPlayers[SEQ_PLAYER_SFX].channels[0])) {
|
||||
sCurSfxPlayerChannelIdx = 0;
|
||||
for (bankId = 0; bankId < ARRAY_COUNT(gSfxBanks); bankId++) {
|
||||
Audio_ChooseActiveSfx(bankId);
|
||||
|
|
|
@ -45,12 +45,12 @@ void Audio_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDura
|
|||
seqArgs &= 0x7F;
|
||||
if (seqArgs == 0x7F) {
|
||||
// `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);
|
||||
} else {
|
||||
// `fadeInDuration` is interpreted as number of frames at 30 fps
|
||||
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);
|
||||
|
@ -78,7 +78,7 @@ void Audio_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDura
|
|||
|
||||
void Audio_StopSequence(u8 seqPlayerIndex, u16 fadeOutDuration) {
|
||||
Audio_QueueCmdS32(0x83000000 | ((u8)seqPlayerIndex << 16),
|
||||
(fadeOutDuration * (u16)gAudioContext.audioBufferParameters.updatesPerFrame) / 4);
|
||||
(fadeOutDuration * (u16)gAudioCtx.audioBufferParameters.updatesPerFrame) / 4);
|
||||
gActiveSeqs[seqPlayerIndex].seqId = NA_BGM_DISABLED;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ void Audio_ProcessSeqCmds(void) {
|
|||
}
|
||||
|
||||
u16 Audio_GetActiveSeqId(u8 seqPlayerIndex) {
|
||||
if (!gAudioContext.seqPlayers[seqPlayerIndex].enabled) {
|
||||
if (!gAudioCtx.seqPlayers[seqPlayerIndex].enabled) {
|
||||
return NA_BGM_DISABLED;
|
||||
}
|
||||
return gActiveSeqs[seqPlayerIndex].seqId;
|
||||
|
@ -541,8 +541,8 @@ void Audio_UpdateActiveSequences(void) {
|
|||
}
|
||||
|
||||
// Process tempo commands
|
||||
if (gAudioContext.seqPlayers[seqPlayerIndex].enabled) {
|
||||
tempoPrev = gAudioContext.seqPlayers[seqPlayerIndex].tempo / TATUMS_PER_BEAT;
|
||||
if (gAudioCtx.seqPlayers[seqPlayerIndex].enabled) {
|
||||
tempoPrev = gAudioCtx.seqPlayers[seqPlayerIndex].tempo / TATUMS_PER_BEAT;
|
||||
tempoOp = (tempoCmd & 0xF000) >> 12;
|
||||
switch (tempoOp) {
|
||||
case SEQCMD_SUB_OP_TEMPO_SPEED_UP:
|
||||
|
@ -583,7 +583,7 @@ void Audio_UpdateActiveSequences(void) {
|
|||
}
|
||||
|
||||
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].tempoCur - gActiveSeqs[seqPlayerIndex].tempoTarget) / tempoTimer;
|
||||
gActiveSeqs[seqPlayerIndex].tempoTimer = tempoTimer;
|
||||
|
@ -659,7 +659,7 @@ void Audio_UpdateActiveSequences(void) {
|
|||
|
||||
// Only process setup commands if `seqPlayerIndex` if no longer playing
|
||||
// i.e. the `seqPlayer` is no longer enabled
|
||||
if (gAudioContext.seqPlayers[seqPlayerIndex].enabled) {
|
||||
if (gAudioCtx.seqPlayers[seqPlayerIndex].enabled) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1238,7 +1238,7 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
|
|||
sp74 = actor->world.pos.y - actor->prevPos.y;
|
||||
|
||||
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) {
|
||||
|
|
|
@ -114,7 +114,7 @@ void EnAObj_Init(Actor* thisx, PlayState* play) {
|
|||
thisx->focus.pos = thisx->world.pos;
|
||||
this->dyna.bgId = BGACTOR_NEG_ONE;
|
||||
this->dyna.interactFlags = 0;
|
||||
this->dyna.unk_15C = DPM_UNK;
|
||||
this->dyna.transformFlags = 0;
|
||||
thisx->uncullZoneDownward = 1200.0f;
|
||||
thisx->uncullZoneScale = 200.0f;
|
||||
|
||||
|
|
|
@ -2050,12 +2050,12 @@ void Environment_PlaySceneSequence(PlayState* play) {
|
|||
osSyncPrintf("\n\n\nBGM設定game_play->sound_info.BGM=[%d] old_bgm=[%d]\n\n", play->sequenceCtx.seqId,
|
||||
((void)0, gSaveContext.seqId));
|
||||
if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) {
|
||||
func_800F5550(play->sequenceCtx.seqId);
|
||||
Audio_PlaySceneSequence(play->sequenceCtx.seqId);
|
||||
}
|
||||
} else if (((void)0, gSaveContext.dayTime) >= CLOCK_TIME(7, 0) &&
|
||||
((void)0, gSaveContext.dayTime) <= CLOCK_TIME(17, 10)) {
|
||||
if (((void)0, gSaveContext.seqId) != play->sequenceCtx.seqId) {
|
||||
func_800F5550(play->sequenceCtx.seqId);
|
||||
Audio_PlaySceneSequence(play->sequenceCtx.seqId);
|
||||
}
|
||||
|
||||
play->envCtx.timeSeqState = TIMESEQ_FADE_DAY_BGM;
|
||||
|
@ -2092,7 +2092,7 @@ void Environment_PlayTimeBasedSequence(PlayState* play) {
|
|||
|
||||
if (play->envCtx.precipitation[PRECIP_RAIN_MAX] == 0 && play->envCtx.precipitation[PRECIP_SOS_MAX] == 0) {
|
||||
osSyncPrintf("\n\n\nNa_StartMorinigBgm\n\n");
|
||||
func_800F5510(play->sequenceCtx.seqId);
|
||||
Audio_PlayMorningSceneSequence(play->sequenceCtx.seqId);
|
||||
}
|
||||
|
||||
play->envCtx.timeSeqState++;
|
||||
|
|
|
@ -24,75 +24,75 @@ s16 sBootData[PLAYER_BOOTS_MAX][17] = {
|
|||
{ 200, 1000, 300, 800, 500, 400, 800, 400, 800, 550, -100, 600, 540, 750, 125, 400, 200 },
|
||||
};
|
||||
|
||||
// Used to map action params to model groups
|
||||
u8 sActionModelGroups[PLAYER_AP_MAX] = {
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_NONE
|
||||
PLAYER_MODELGROUP_15, // PLAYER_AP_LAST_USED
|
||||
PLAYER_MODELGROUP_10, // PLAYER_AP_FISHING_POLE
|
||||
PLAYER_MODELGROUP_SWORD, // PLAYER_AP_SWORD_MASTER
|
||||
PLAYER_MODELGROUP_SWORD, // PLAYER_AP_SWORD_KOKIRI
|
||||
PLAYER_MODELGROUP_BGS, // PLAYER_AP_SWORD_BGS
|
||||
PLAYER_MODELGROUP_10, // PLAYER_AP_STICK
|
||||
PLAYER_MODELGROUP_HAMMER, // PLAYER_AP_HAMMER
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_FIRE
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_ICE
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_LIGHT
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_0C
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_0D
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_BOW_0E
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_SLINGSHOT
|
||||
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_AP_HOOKSHOT
|
||||
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_AP_LONGSHOT
|
||||
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_AP_BOMB
|
||||
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_AP_BOMBCHU
|
||||
PLAYER_MODELGROUP_BOOMERANG, // PLAYER_AP_BOOMERANG
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MAGIC_SPELL_15
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MAGIC_SPELL_16
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_AP_MAGIC_SPELL_17
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_FARORES_WIND
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_NAYRUS_LOVE
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_DINS_FIRE
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_NUT
|
||||
PLAYER_MODELGROUP_OCARINA, // PLAYER_AP_OCARINA_FAIRY
|
||||
PLAYER_MODELGROUP_OOT, // PLAYER_AP_OCARINA_TIME
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_FISH
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_FIRE
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_BUG
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POE
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_BIG_POE
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_LETTER
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POTION_RED
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POTION_BLUE
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_POTION_GREEN
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_MILK
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_MILK_HALF
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_AP_BOTTLE_FAIRY
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_LETTER_ZELDA
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_WEIRD_EGG
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_CHICKEN
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_BEAN
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_POCKET_EGG
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_POCKET_CUCCO
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_COJIRO
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_ODD_MUSHROOM
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_ODD_POTION
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_SAW
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_SWORD_BROKEN
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_PRESCRIPTION
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_FROG
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_EYEDROPS
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_CLAIM_CHECK
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_KEATON
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_SKULL
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_SPOOKY
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_BUNNY
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_GORON
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_ZORA
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_GERUDO
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_MASK_TRUTH
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_AP_LENS
|
||||
// Used to map item actions to model groups
|
||||
u8 sActionModelGroups[PLAYER_IA_MAX] = {
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NONE
|
||||
PLAYER_MODELGROUP_15, // PLAYER_IA_LAST_USED
|
||||
PLAYER_MODELGROUP_10, // PLAYER_IA_FISHING_POLE
|
||||
PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_MASTER
|
||||
PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_KOKIRI
|
||||
PLAYER_MODELGROUP_BGS, // PLAYER_IA_SWORD_BGS
|
||||
PLAYER_MODELGROUP_10, // PLAYER_IA_STICK
|
||||
PLAYER_MODELGROUP_HAMMER, // PLAYER_IA_HAMMER
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_FIRE
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_ICE
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_LIGHT
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0C
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0D
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0E
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_SLINGSHOT
|
||||
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_HOOKSHOT
|
||||
PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_LONGSHOT
|
||||
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMB
|
||||
PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMBCHU
|
||||
PLAYER_MODELGROUP_BOOMERANG, // PLAYER_IA_BOOMERANG
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_15
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_16
|
||||
PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_MAGIC_SPELL_17
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FARORES_WIND
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NAYRUS_LOVE
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DINS_FIRE
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NUT
|
||||
PLAYER_MODELGROUP_OCARINA, // PLAYER_IA_OCARINA_FAIRY
|
||||
PLAYER_MODELGROUP_OOT, // PLAYER_IA_OCARINA_TIME
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FISH
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FIRE
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BUG
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POE
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BIG_POE
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_LETTER
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_RED
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_BLUE
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_GREEN
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_HALF
|
||||
PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FAIRY
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LETTER_ZELDA
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_WEIRD_EGG
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CHICKEN
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_BEAN
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_EGG
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_CUCCO
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_COJIRO
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_MUSHROOM
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_POTION
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_SAW
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_SWORD_BROKEN
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_PRESCRIPTION
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FROG
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_EYEDROPS
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CLAIM_CHECK
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_KEATON
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SKULL
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SPOOKY
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_BUNNY
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GORON
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_ZORA
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GERUDO
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_TRUTH
|
||||
PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LENS
|
||||
};
|
||||
|
||||
TextTriggerEntry sTextTriggers[] = {
|
||||
|
@ -491,8 +491,7 @@ s32 Player_InBlockingCsMode(PlayState* play, Player* this) {
|
|||
return (this->stateFlags1 & (PLAYER_STATE1_7 | PLAYER_STATE1_29)) || (this->csMode != 0) ||
|
||||
(play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_0) ||
|
||||
(this->stateFlags3 & PLAYER_STATE3_7) ||
|
||||
((gSaveContext.magicState != MAGIC_STATE_IDLE) &&
|
||||
(Player_ActionToMagicSpell(this, this->itemActionParam) >= 0));
|
||||
((gSaveContext.magicState != MAGIC_STATE_IDLE) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0));
|
||||
}
|
||||
|
||||
s32 Player_InCsMode(PlayState* play) {
|
||||
|
@ -509,8 +508,8 @@ s32 Player_IsChildWithHylianShield(Player* this) {
|
|||
return gSaveContext.linkAge != LINK_AGE_ADULT && (this->currentShield == PLAYER_SHIELD_HYLIAN);
|
||||
}
|
||||
|
||||
s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
|
||||
s32 modelGroup = sActionModelGroups[actionParam];
|
||||
s32 Player_ActionToModelGroup(Player* this, s32 itemAction) {
|
||||
s32 modelGroup = sActionModelGroups[itemAction];
|
||||
|
||||
if ((modelGroup == PLAYER_MODELGROUP_SWORD) && Player_IsChildWithHylianShield(this)) {
|
||||
// child, using kokiri sword with hylian shield equipped
|
||||
|
@ -522,7 +521,7 @@ s32 Player_ActionToModelGroup(Player* this, s32 actionParam) {
|
|||
|
||||
void Player_SetModelsForHoldingShield(Player* this) {
|
||||
if ((this->stateFlags1 & PLAYER_STATE1_22) &&
|
||||
((this->itemActionParam < 0) || (this->itemActionParam == this->heldItemActionParam))) {
|
||||
((this->itemAction < 0) || (this->itemAction == this->heldItemAction))) {
|
||||
if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) {
|
||||
this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD;
|
||||
this->rightHandDLists = sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD] + ((void)0, gSaveContext.linkAge);
|
||||
|
@ -533,7 +532,7 @@ void Player_SetModelsForHoldingShield(Player* this) {
|
|||
}
|
||||
this->sheathDLists = sPlayerDListGroups[this->sheathType] + ((void)0, gSaveContext.linkAge);
|
||||
this->modelAnimType = PLAYER_ANIMTYPE_2;
|
||||
this->itemActionParam = -1;
|
||||
this->itemAction = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -572,8 +571,8 @@ void Player_SetModelGroup(Player* this, s32 modelGroup) {
|
|||
}
|
||||
|
||||
void func_8008EC70(Player* this) {
|
||||
this->itemActionParam = this->heldItemActionParam;
|
||||
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam));
|
||||
this->itemAction = this->heldItemAction;
|
||||
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemAction));
|
||||
this->unk_6AD = 0;
|
||||
}
|
||||
|
||||
|
@ -583,20 +582,20 @@ void Player_SetEquipmentData(PlayState* play, Player* this) {
|
|||
this->currentTunic = TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC));
|
||||
this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS));
|
||||
this->currentSwordItemId = B_BTN_ITEM;
|
||||
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam));
|
||||
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemAction));
|
||||
Player_SetBootData(play, this);
|
||||
}
|
||||
}
|
||||
|
||||
void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 actionParam) {
|
||||
void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 itemAction) {
|
||||
Inventory_UpdateBottleItem(play, item, this->heldItemButton);
|
||||
|
||||
if (item != ITEM_BOTTLE) {
|
||||
this->heldItemId = item;
|
||||
this->heldItemActionParam = actionParam;
|
||||
this->heldItemAction = itemAction;
|
||||
}
|
||||
|
||||
this->itemActionParam = actionParam;
|
||||
this->itemAction = itemAction;
|
||||
}
|
||||
|
||||
void func_8008EDF0(Player* this) {
|
||||
|
@ -645,7 +644,7 @@ s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 y
|
|||
Vec3f diff;
|
||||
s32 pad;
|
||||
|
||||
if ((this->heldItemActionParam == PLAYER_AP_STICK) && (this->unk_860 != 0)) {
|
||||
if ((this->heldItemAction == PLAYER_IA_STICK) && (this->unk_860 != 0)) {
|
||||
Math_Vec3f_Diff(&this->meleeWeaponInfo[0].tip, pos, &diff);
|
||||
return ((SQ(diff.x) + SQ(diff.z)) <= SQ(xzRange)) && (0.0f <= diff.y) && (diff.y <= yRange);
|
||||
} else {
|
||||
|
@ -691,8 +690,8 @@ s32 Player_HasMirrorShieldSetToDraw(PlayState* play) {
|
|||
return (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && (this->currentShield == PLAYER_SHIELD_MIRROR);
|
||||
}
|
||||
|
||||
s32 Player_ActionToMagicSpell(Player* this, s32 actionParam) {
|
||||
s32 magicSpell = actionParam - PLAYER_AP_MAGIC_SPELL_15;
|
||||
s32 Player_ActionToMagicSpell(Player* this, s32 itemAction) {
|
||||
s32 magicSpell = itemAction - PLAYER_IA_MAGIC_SPELL_15;
|
||||
|
||||
if ((magicSpell >= 0) && (magicSpell < 6)) {
|
||||
return magicSpell;
|
||||
|
@ -702,15 +701,15 @@ s32 Player_ActionToMagicSpell(Player* this, s32 actionParam) {
|
|||
}
|
||||
|
||||
s32 Player_HoldsHookshot(Player* this) {
|
||||
return (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) || (this->heldItemActionParam == PLAYER_AP_LONGSHOT);
|
||||
return (this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT);
|
||||
}
|
||||
|
||||
s32 func_8008F128(Player* this) {
|
||||
return Player_HoldsHookshot(this) && (this->heldActor == NULL);
|
||||
}
|
||||
|
||||
s32 Player_ActionToMeleeWeapon(s32 actionParam) {
|
||||
s32 meleeWeapon = actionParam - PLAYER_AP_FISHING_POLE;
|
||||
s32 Player_ActionToMeleeWeapon(s32 itemAction) {
|
||||
s32 meleeWeapon = itemAction - PLAYER_IA_FISHING_POLE;
|
||||
|
||||
if ((meleeWeapon > 0) && (meleeWeapon < 6)) {
|
||||
return meleeWeapon;
|
||||
|
@ -720,11 +719,11 @@ s32 Player_ActionToMeleeWeapon(s32 actionParam) {
|
|||
}
|
||||
|
||||
s32 Player_GetMeleeWeaponHeld(Player* this) {
|
||||
return Player_ActionToMeleeWeapon(this->heldItemActionParam);
|
||||
return Player_ActionToMeleeWeapon(this->heldItemAction);
|
||||
}
|
||||
|
||||
s32 Player_HoldsTwoHandedWeapon(Player* this) {
|
||||
if ((this->heldItemActionParam >= PLAYER_AP_SWORD_BGS) && (this->heldItemActionParam <= PLAYER_AP_HAMMER)) {
|
||||
if ((this->heldItemAction >= PLAYER_IA_SWORD_BGS) && (this->heldItemAction <= PLAYER_IA_HAMMER)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -732,11 +731,11 @@ s32 Player_HoldsTwoHandedWeapon(Player* this) {
|
|||
}
|
||||
|
||||
s32 Player_HoldsBrokenKnife(Player* this) {
|
||||
return (this->heldItemActionParam == PLAYER_AP_SWORD_BGS) && (gSaveContext.swordHealth <= 0.0f);
|
||||
return (this->heldItemAction == PLAYER_IA_SWORD_BGS) && (gSaveContext.swordHealth <= 0.0f);
|
||||
}
|
||||
|
||||
s32 Player_ActionToBottle(Player* this, s32 actionParam) {
|
||||
s32 bottle = actionParam - PLAYER_AP_BOTTLE;
|
||||
s32 Player_ActionToBottle(Player* this, s32 itemAction) {
|
||||
s32 bottle = itemAction - PLAYER_IA_BOTTLE;
|
||||
|
||||
if ((bottle >= 0) && (bottle < 13)) {
|
||||
return bottle;
|
||||
|
@ -746,11 +745,11 @@ s32 Player_ActionToBottle(Player* this, s32 actionParam) {
|
|||
}
|
||||
|
||||
s32 Player_GetBottleHeld(Player* this) {
|
||||
return Player_ActionToBottle(this, this->heldItemActionParam);
|
||||
return Player_ActionToBottle(this, this->heldItemAction);
|
||||
}
|
||||
|
||||
s32 Player_ActionToExplosive(Player* this, s32 actionParam) {
|
||||
s32 explosive = actionParam - PLAYER_AP_BOMB;
|
||||
s32 Player_ActionToExplosive(Player* this, s32 itemAction) {
|
||||
s32 explosive = itemAction - PLAYER_IA_BOMB;
|
||||
|
||||
if ((explosive >= 0) && (explosive < 2)) {
|
||||
return explosive;
|
||||
|
@ -760,14 +759,14 @@ s32 Player_ActionToExplosive(Player* this, s32 actionParam) {
|
|||
}
|
||||
|
||||
s32 Player_GetExplosiveHeld(Player* this) {
|
||||
return Player_ActionToExplosive(this, this->heldItemActionParam);
|
||||
return Player_ActionToExplosive(this, this->heldItemAction);
|
||||
}
|
||||
|
||||
s32 func_8008F2BC(Player* this, s32 actionParam) {
|
||||
s32 func_8008F2BC(Player* this, s32 itemAction) {
|
||||
s32 sword = 0;
|
||||
|
||||
if (actionParam != PLAYER_AP_LAST_USED) {
|
||||
sword = actionParam - PLAYER_AP_SWORD_MASTER;
|
||||
if (itemAction != PLAYER_IA_LAST_USED) {
|
||||
sword = itemAction - PLAYER_IA_SWORD_MASTER;
|
||||
if ((sword < 0) || (sword >= 3)) {
|
||||
goto return_neg;
|
||||
}
|
||||
|
@ -979,7 +978,7 @@ void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* p
|
|||
s32 temp3;
|
||||
|
||||
if ((this->actor.scale.y >= 0.0f) && !(this->stateFlags1 & PLAYER_STATE1_7) &&
|
||||
(Player_ActionToMagicSpell(this, this->itemActionParam) < 0)) {
|
||||
(Player_ActionToMagicSpell(this, this->itemAction) < 0)) {
|
||||
s32 pad;
|
||||
|
||||
sp7C = D_80126058[(void)0, gSaveContext.linkAge];
|
||||
|
@ -1454,7 +1453,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
|||
|
||||
Math_Vec3f_Copy(&this->leftHandPos, sCurBodyPartPos);
|
||||
|
||||
if (this->itemActionParam == PLAYER_AP_STICK) {
|
||||
if (this->itemAction == PLAYER_IA_STICK) {
|
||||
Vec3f sp124[3];
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2633);
|
||||
|
@ -1490,7 +1489,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
|||
func_80090A28(this, spE4);
|
||||
func_800906D4(play, this, spE4);
|
||||
} else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) {
|
||||
Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemActionParam)];
|
||||
Color_RGB8* bottleColor = &sBottleColors[Player_ActionToBottle(this, this->itemAction)];
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2710);
|
||||
|
||||
|
@ -1580,8 +1579,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
|||
}
|
||||
|
||||
if (this->actor.scale.y >= 0.0f) {
|
||||
if ((this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ||
|
||||
(this->heldItemActionParam == PLAYER_AP_LONGSHOT)) {
|
||||
if ((this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT)) {
|
||||
Matrix_MultVec3f(&D_80126184, &this->unk_3C8);
|
||||
|
||||
if (heldActor != NULL) {
|
||||
|
@ -1596,8 +1594,8 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
|||
|
||||
if (func_8002DD78(this) != 0) {
|
||||
Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY);
|
||||
Player_DrawHookshotReticle(
|
||||
play, this, (this->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 38600.0f : 77600.0f);
|
||||
Player_DrawHookshotReticle(play, this,
|
||||
(this->heldItemAction == PLAYER_IA_HOOKSHOT) ? 38600.0f : 77600.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue