mirror of
https://github.com/zeldaret/mm.git
synced 2026-09-01 17:29:56 -04:00
merge master
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "global.h"
|
||||
|
||||
u8 D_80096B20 = 1;
|
||||
|
||||
@@ -63,7 +63,7 @@ void AudioEffects_SequencePlayerProcessSound(SequencePlayer* seqPlayer) {
|
||||
}
|
||||
|
||||
seqPlayer->fadeTimer--;
|
||||
if (seqPlayer->fadeTimer == 0 && seqPlayer->state == 2) {
|
||||
if ((seqPlayer->fadeTimer == 0) && (seqPlayer->state == SEQPLAYER_STATE_2)) {
|
||||
AudioSeq_SequencePlayerDisable(seqPlayer);
|
||||
return;
|
||||
}
|
||||
@@ -243,12 +243,10 @@ f32 AudioEffects_AdsrUpdate(AdsrState* adsr) {
|
||||
break;
|
||||
}
|
||||
// fallthrough
|
||||
|
||||
case ADSR_STATE_START_LOOP:
|
||||
adsr->envIndex = 0;
|
||||
adsr->action.s.state = ADSR_STATE_LOOP;
|
||||
// fallthrough
|
||||
|
||||
retry:
|
||||
case ADSR_STATE_LOOP:
|
||||
adsr->delay = adsr->envelope[adsr->envIndex].delay;
|
||||
@@ -256,18 +254,21 @@ f32 AudioEffects_AdsrUpdate(AdsrState* adsr) {
|
||||
case ADSR_DISABLE:
|
||||
adsr->action.s.state = ADSR_STATE_DISABLED;
|
||||
break;
|
||||
|
||||
case ADSR_HANG:
|
||||
adsr->action.s.state = ADSR_STATE_HANG;
|
||||
break;
|
||||
|
||||
case ADSR_GOTO:
|
||||
adsr->envIndex = adsr->envelope[adsr->envIndex].arg;
|
||||
goto retry;
|
||||
|
||||
case ADSR_RESTART:
|
||||
adsr->action.s.state = ADSR_STATE_INITIAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
adsr->delay *= gAudioContext.audioBufferParameters.unk_24;
|
||||
adsr->delay *= gAudioContext.audioBufferParameters.updatesPerFrameScaled;
|
||||
if (adsr->delay == 0) {
|
||||
adsr->delay = 1;
|
||||
}
|
||||
@@ -282,14 +283,13 @@ f32 AudioEffects_AdsrUpdate(AdsrState* adsr) {
|
||||
break;
|
||||
}
|
||||
// fallthrough
|
||||
|
||||
case ADSR_STATE_FADE:
|
||||
adsr->current += adsr->velocity;
|
||||
if (--adsr->delay <= 0) {
|
||||
adsr->delay--;
|
||||
if (adsr->delay <= 0) {
|
||||
adsr->action.s.state = ADSR_STATE_LOOP;
|
||||
}
|
||||
// fallthrough
|
||||
|
||||
case ADSR_STATE_HANG:
|
||||
break;
|
||||
|
||||
|
||||
+117
-112
@@ -4,7 +4,7 @@ void* AudioHeap_SearchRegularCaches(s32 tableType, s32 cache, s32 id);
|
||||
void AudioHeap_InitSampleCaches(size_t persistentSampleCacheSize, size_t temporarySampleCacheSize);
|
||||
SampleCacheEntry* AudioHeap_AllocTemporarySampleCacheEntry(size_t size);
|
||||
void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry);
|
||||
void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, SoundFontSample* sample);
|
||||
void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, Sample* sample);
|
||||
SampleCacheEntry* AudioHeap_AllocPersistentSampleCacheEntry(size_t size);
|
||||
void AudioHeap_DiscardSampleCaches(void);
|
||||
void AudioHeap_DiscardSampleBank(s32 sampleBankId);
|
||||
@@ -14,29 +14,37 @@ void AudioHeap_InitReverb(s32 reverbIndex, ReverbSettings* settings, s32 flags);
|
||||
|
||||
#define gTatumsPerBeat (gAudioTatumInit[1])
|
||||
|
||||
f32 func_8018B0F0(f32 arg0) {
|
||||
return 256.0f * gAudioContext.audioBufferParameters.unkUpdatesPerFrameScaled / arg0;
|
||||
/**
|
||||
* Effectively scales `updatesPerFrameInv` by the reciprocal of `scaleInv`
|
||||
* `updatesPerFrameInvScaled` is just `updatesPerFrameInv` scaled down by a factor of 256.0f
|
||||
* i.e. (256.0f * `updatesPerFrameInvScaled`) is just `updatesPerFrameInv`
|
||||
*/
|
||||
f32 AudioHeap_CalculateAdsrDecay(f32 scaleInv) {
|
||||
return 256.0f * gAudioContext.audioBufferParameters.updatesPerFrameInvScaled / scaleInv;
|
||||
}
|
||||
|
||||
void func_8018B10C(void) {
|
||||
/**
|
||||
* Initialize the decay rate table used for decaying notes as part of adsr
|
||||
*/
|
||||
void AudioHeap_InitAdsrDecayTable(void) {
|
||||
s32 i;
|
||||
|
||||
gAudioContext.adsrDecayTable[255] = func_8018B0F0(0.25f);
|
||||
gAudioContext.adsrDecayTable[254] = func_8018B0F0(0.33f);
|
||||
gAudioContext.adsrDecayTable[253] = func_8018B0F0(0.5f);
|
||||
gAudioContext.adsrDecayTable[252] = func_8018B0F0(0.66f);
|
||||
gAudioContext.adsrDecayTable[251] = func_8018B0F0(0.75f);
|
||||
gAudioContext.adsrDecayTable[255] = AudioHeap_CalculateAdsrDecay(0.25f);
|
||||
gAudioContext.adsrDecayTable[254] = AudioHeap_CalculateAdsrDecay(0.33f);
|
||||
gAudioContext.adsrDecayTable[253] = AudioHeap_CalculateAdsrDecay(0.5f);
|
||||
gAudioContext.adsrDecayTable[252] = AudioHeap_CalculateAdsrDecay(0.66f);
|
||||
gAudioContext.adsrDecayTable[251] = AudioHeap_CalculateAdsrDecay(0.75f);
|
||||
|
||||
for (i = 128; i < 251; i++) {
|
||||
gAudioContext.adsrDecayTable[i] = func_8018B0F0(251 - i);
|
||||
gAudioContext.adsrDecayTable[i] = AudioHeap_CalculateAdsrDecay(251 - i);
|
||||
}
|
||||
|
||||
for (i = 16; i < 128; i++) {
|
||||
gAudioContext.adsrDecayTable[i] = func_8018B0F0(4 * (143 - i));
|
||||
gAudioContext.adsrDecayTable[i] = AudioHeap_CalculateAdsrDecay(4 * (143 - i));
|
||||
}
|
||||
|
||||
for (i = 1; i < 16; i++) {
|
||||
gAudioContext.adsrDecayTable[i] = func_8018B0F0(60 * (23 - i));
|
||||
gAudioContext.adsrDecayTable[i] = AudioHeap_CalculateAdsrDecay(60 * (23 - i));
|
||||
}
|
||||
|
||||
gAudioContext.adsrDecayTable[0] = 0.0f;
|
||||
@@ -71,7 +79,7 @@ void AudioHeap_DiscardFont(s32 fontId) {
|
||||
Note* note = &gAudioContext.notes[i];
|
||||
|
||||
if (note->playbackState.fontId == fontId) {
|
||||
if ((note->playbackState.unk_04 == 0) && (note->playbackState.priority != 0)) {
|
||||
if ((note->playbackState.status == PLAYBACK_STATUS_0) && (note->playbackState.priority != 0)) {
|
||||
note->playbackState.parentLayer->enabled = false;
|
||||
note->playbackState.parentLayer->finished = true;
|
||||
}
|
||||
@@ -233,19 +241,19 @@ void* AudioHeap_Alloc(AudioAllocPool* pool, size_t size) {
|
||||
* Initialize a pool at the requested address with the requested size.
|
||||
* Store the metadata of this pool in AudioAllocPool* pool
|
||||
*/
|
||||
void AudioHeap_AllocPoolInit(AudioAllocPool* pool, void* addr, size_t size) {
|
||||
void AudioHeap_InitPool(AudioAllocPool* pool, void* addr, size_t size) {
|
||||
pool->curAddr = pool->startAddr = (u8*)ALIGN16((uintptr_t)addr);
|
||||
pool->size = size - ((uintptr_t)addr & 0xF);
|
||||
pool->count = 0;
|
||||
}
|
||||
|
||||
void AudioHeap_ClearPersistentCache(AudioPersistentCache* persistent) {
|
||||
void AudioHeap_InitPersistentCache(AudioPersistentCache* persistent) {
|
||||
persistent->pool.count = 0;
|
||||
persistent->numEntries = 0;
|
||||
persistent->pool.curAddr = persistent->pool.startAddr;
|
||||
}
|
||||
|
||||
void AudioHeap_ClearTemporaryCache(AudioTemporaryCache* temporary) {
|
||||
void AudioHeap_InitTemporaryCache(AudioTemporaryCache* temporary) {
|
||||
temporary->pool.count = 0;
|
||||
temporary->pool.curAddr = temporary->pool.startAddr;
|
||||
temporary->nextSide = 0;
|
||||
@@ -260,7 +268,7 @@ void AudioHeap_ResetPool(AudioAllocPool* pool) {
|
||||
pool->curAddr = pool->startAddr;
|
||||
}
|
||||
|
||||
void AudioHeap_PopCache(s32 tableType) {
|
||||
void AudioHeap_PopPersistentCache(s32 tableType) {
|
||||
AudioCache* loadedCache;
|
||||
AudioAllocPool* persistentHeap;
|
||||
AudioPersistentCache* persistent;
|
||||
@@ -306,69 +314,65 @@ void AudioHeap_PopCache(s32 tableType) {
|
||||
persistent->numEntries--;
|
||||
}
|
||||
|
||||
void AudioHeap_InitMainPool(size_t mainPoolSplitSize) {
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.audioInitPool, gAudioContext.audioHeap, mainPoolSplitSize);
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.audioSessionPool, gAudioContext.audioHeap + mainPoolSplitSize,
|
||||
gAudioContext.audioHeapSize - mainPoolSplitSize);
|
||||
void AudioHeap_InitMainPool(size_t initPoolSize) {
|
||||
AudioHeap_InitPool(&gAudioContext.initPool, gAudioContext.audioHeap, initPoolSize);
|
||||
AudioHeap_InitPool(&gAudioContext.sessionPool, gAudioContext.audioHeap + initPoolSize,
|
||||
gAudioContext.audioHeapSize - initPoolSize);
|
||||
|
||||
gAudioContext.externalPool.startAddr = NULL;
|
||||
}
|
||||
|
||||
void AudioHeap_InitSessionPool(AudioSessionPoolSplit* split) {
|
||||
gAudioContext.audioSessionPool.curAddr = gAudioContext.audioSessionPool.startAddr;
|
||||
gAudioContext.sessionPool.curAddr = gAudioContext.sessionPool.startAddr;
|
||||
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.miscPool,
|
||||
AudioHeap_Alloc(&gAudioContext.audioSessionPool, split->miscPoolSize), split->miscPoolSize);
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.cachePool,
|
||||
AudioHeap_Alloc(&gAudioContext.audioSessionPool, split->cachePoolSize),
|
||||
split->cachePoolSize);
|
||||
AudioHeap_InitPool(&gAudioContext.miscPool, AudioHeap_Alloc(&gAudioContext.sessionPool, split->miscPoolSize),
|
||||
split->miscPoolSize);
|
||||
AudioHeap_InitPool(&gAudioContext.cachePool, AudioHeap_Alloc(&gAudioContext.sessionPool, split->cachePoolSize),
|
||||
split->cachePoolSize);
|
||||
}
|
||||
|
||||
void AudioHeap_InitCachePool(AudioCachePoolSplit* split) {
|
||||
gAudioContext.cachePool.curAddr = gAudioContext.cachePool.startAddr;
|
||||
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.persistentCommonPool,
|
||||
AudioHeap_Alloc(&gAudioContext.cachePool, split->persistentCommonPoolSize),
|
||||
split->persistentCommonPoolSize);
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.temporaryCommonPool,
|
||||
AudioHeap_Alloc(&gAudioContext.cachePool, split->temporaryCommonPoolSize),
|
||||
split->temporaryCommonPoolSize);
|
||||
AudioHeap_InitPool(&gAudioContext.persistentCommonPool,
|
||||
AudioHeap_Alloc(&gAudioContext.cachePool, split->persistentCommonPoolSize),
|
||||
split->persistentCommonPoolSize);
|
||||
AudioHeap_InitPool(&gAudioContext.temporaryCommonPool,
|
||||
AudioHeap_Alloc(&gAudioContext.cachePool, split->temporaryCommonPoolSize),
|
||||
split->temporaryCommonPoolSize);
|
||||
}
|
||||
|
||||
void AudioHeap_InitPersistentCache(AudioCommonPoolSplit* split) {
|
||||
void AudioHeap_InitPersistentPoolsAndCaches(AudioCommonPoolSplit* split) {
|
||||
gAudioContext.persistentCommonPool.curAddr = gAudioContext.persistentCommonPool.startAddr;
|
||||
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.seqCache.persistent.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->seqCacheSize),
|
||||
split->seqCacheSize);
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.fontCache.persistent.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->fontCacheSize),
|
||||
split->fontCacheSize);
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.sampleBankCache.persistent.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->sampleBankCacheSize),
|
||||
split->sampleBankCacheSize);
|
||||
AudioHeap_InitPool(&gAudioContext.seqCache.persistent.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->seqCacheSize), split->seqCacheSize);
|
||||
AudioHeap_InitPool(&gAudioContext.fontCache.persistent.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->fontCacheSize),
|
||||
split->fontCacheSize);
|
||||
AudioHeap_InitPool(&gAudioContext.sampleBankCache.persistent.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.persistentCommonPool, split->sampleBankCacheSize),
|
||||
split->sampleBankCacheSize);
|
||||
|
||||
AudioHeap_ClearPersistentCache(&gAudioContext.seqCache.persistent);
|
||||
AudioHeap_ClearPersistentCache(&gAudioContext.fontCache.persistent);
|
||||
AudioHeap_ClearPersistentCache(&gAudioContext.sampleBankCache.persistent);
|
||||
AudioHeap_InitPersistentCache(&gAudioContext.seqCache.persistent);
|
||||
AudioHeap_InitPersistentCache(&gAudioContext.fontCache.persistent);
|
||||
AudioHeap_InitPersistentCache(&gAudioContext.sampleBankCache.persistent);
|
||||
}
|
||||
|
||||
void AudioHeap_InitTemporaryCache(AudioCommonPoolSplit* split) {
|
||||
void AudioHeap_InitTemporaryPoolsAndCaches(AudioCommonPoolSplit* split) {
|
||||
gAudioContext.temporaryCommonPool.curAddr = gAudioContext.temporaryCommonPool.startAddr;
|
||||
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.seqCache.temporary.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->seqCacheSize),
|
||||
split->seqCacheSize);
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.fontCache.temporary.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->fontCacheSize),
|
||||
split->fontCacheSize);
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.sampleBankCache.temporary.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->sampleBankCacheSize),
|
||||
split->sampleBankCacheSize);
|
||||
AudioHeap_InitPool(&gAudioContext.seqCache.temporary.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->seqCacheSize), split->seqCacheSize);
|
||||
AudioHeap_InitPool(&gAudioContext.fontCache.temporary.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->fontCacheSize), split->fontCacheSize);
|
||||
AudioHeap_InitPool(&gAudioContext.sampleBankCache.temporary.pool,
|
||||
AudioHeap_Alloc(&gAudioContext.temporaryCommonPool, split->sampleBankCacheSize),
|
||||
split->sampleBankCacheSize);
|
||||
|
||||
AudioHeap_ClearTemporaryCache(&gAudioContext.seqCache.temporary);
|
||||
AudioHeap_ClearTemporaryCache(&gAudioContext.fontCache.temporary);
|
||||
AudioHeap_ClearTemporaryCache(&gAudioContext.sampleBankCache.temporary);
|
||||
AudioHeap_InitTemporaryCache(&gAudioContext.seqCache.temporary);
|
||||
AudioHeap_InitTemporaryCache(&gAudioContext.fontCache.temporary);
|
||||
AudioHeap_InitTemporaryCache(&gAudioContext.sampleBankCache.temporary);
|
||||
}
|
||||
|
||||
void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) {
|
||||
@@ -764,7 +768,7 @@ void AudioHeap_LoadFilter(s16* filter, s32 lowPassCutoff, s32 highPassCutoff) {
|
||||
s32 cutOff;
|
||||
|
||||
//! @bug filter is never set if (lowPassCutoff == highPassCutoff) and does not equal 0
|
||||
if (lowPassCutoff == 0 && highPassCutoff == 0) {
|
||||
if ((lowPassCutoff == 0) && (highPassCutoff == 0)) {
|
||||
// Identity filter
|
||||
AudioHeap_LoadLowPassFilter(filter, 0);
|
||||
} else if (highPassCutoff == 0) {
|
||||
@@ -830,13 +834,13 @@ void AudioHeap_UpdateReverbs(void) {
|
||||
* Clear the Audio Interface Buffers
|
||||
*/
|
||||
void AudioHeap_ClearAiBuffers(void) {
|
||||
s32 curAiBuffferIndex = gAudioContext.curAiBuffferIndex;
|
||||
s32 curAiBufferIndex = gAudioContext.curAiBufferIndex;
|
||||
s32 i;
|
||||
|
||||
gAudioContext.aiBufLengths[curAiBuffferIndex] = gAudioContext.audioBufferParameters.minAiBufferLength;
|
||||
gAudioContext.aiBufNumSamples[curAiBufferIndex] = gAudioContext.audioBufferParameters.minAiBufNumSamples;
|
||||
|
||||
for (i = 0; i < AIBUF_LEN; i++) {
|
||||
gAudioContext.aiBuffers[curAiBuffferIndex][i] = 0;
|
||||
gAudioContext.aiBuffers[curAiBufferIndex][i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -902,8 +906,8 @@ s32 AudioHeap_ResetStep(void) {
|
||||
case 1:
|
||||
AudioHeap_Init();
|
||||
gAudioContext.resetStatus = 0;
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBufLengths); i++) {
|
||||
gAudioContext.aiBufLengths[i] = gAudioContext.audioBufferParameters.maxAiBufferLength;
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBufNumSamples); i++) {
|
||||
gAudioContext.aiBufNumSamples[i] = gAudioContext.audioBufferParameters.maxAiBufNumSamples;
|
||||
for (j = 0; j < AIBUF_LEN; j++) {
|
||||
gAudioContext.aiBuffers[i][j] = 0;
|
||||
}
|
||||
@@ -940,9 +944,9 @@ void AudioHeap_Init(void) {
|
||||
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget =
|
||||
ALIGN16(gAudioContext.audioBufferParameters.samplingFreq / gAudioContext.refreshRate);
|
||||
gAudioContext.audioBufferParameters.minAiBufferLength =
|
||||
gAudioContext.audioBufferParameters.minAiBufNumSamples =
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget - 0x10;
|
||||
gAudioContext.audioBufferParameters.maxAiBufferLength =
|
||||
gAudioContext.audioBufferParameters.maxAiBufNumSamples =
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget + 0x10;
|
||||
gAudioContext.audioBufferParameters.updatesPerFrame =
|
||||
((gAudioContext.audioBufferParameters.samplesPerFrameTarget + 0x10) / 0xD0) + 1;
|
||||
@@ -952,9 +956,10 @@ void AudioHeap_Init(void) {
|
||||
gAudioContext.audioBufferParameters.samplesPerUpdateMax = gAudioContext.audioBufferParameters.samplesPerUpdate + 8;
|
||||
gAudioContext.audioBufferParameters.samplesPerUpdateMin = gAudioContext.audioBufferParameters.samplesPerUpdate - 8;
|
||||
gAudioContext.audioBufferParameters.resampleRate = 32000.0f / (s32)gAudioContext.audioBufferParameters.samplingFreq;
|
||||
gAudioContext.audioBufferParameters.unkUpdatesPerFrameScaled =
|
||||
gAudioContext.audioBufferParameters.updatesPerFrameInvScaled =
|
||||
(1.0f / 256.0f) / gAudioContext.audioBufferParameters.updatesPerFrame;
|
||||
gAudioContext.audioBufferParameters.unk_24 = gAudioContext.audioBufferParameters.updatesPerFrame * 0.25f;
|
||||
gAudioContext.audioBufferParameters.updatesPerFrameScaled =
|
||||
gAudioContext.audioBufferParameters.updatesPerFrame / 4.0f;
|
||||
gAudioContext.audioBufferParameters.updatesPerFrameInv = 1.0f / gAudioContext.audioBufferParameters.updatesPerFrame;
|
||||
|
||||
// sample dma size
|
||||
@@ -980,12 +985,12 @@ void AudioHeap_Init(void) {
|
||||
|
||||
gAudioContext.audioBufferParameters.specUnk4 = spec->unk_04;
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget *= gAudioContext.audioBufferParameters.specUnk4;
|
||||
gAudioContext.audioBufferParameters.maxAiBufferLength *= gAudioContext.audioBufferParameters.specUnk4;
|
||||
gAudioContext.audioBufferParameters.minAiBufferLength *= gAudioContext.audioBufferParameters.specUnk4;
|
||||
gAudioContext.audioBufferParameters.maxAiBufNumSamples *= gAudioContext.audioBufferParameters.specUnk4;
|
||||
gAudioContext.audioBufferParameters.minAiBufNumSamples *= gAudioContext.audioBufferParameters.specUnk4;
|
||||
gAudioContext.audioBufferParameters.updatesPerFrame *= gAudioContext.audioBufferParameters.specUnk4;
|
||||
|
||||
if (gAudioContext.audioBufferParameters.specUnk4 >= 2) {
|
||||
gAudioContext.audioBufferParameters.maxAiBufferLength -= 0x10;
|
||||
gAudioContext.audioBufferParameters.maxAiBufNumSamples -= 0x10;
|
||||
}
|
||||
|
||||
// Determine the maximum allowable number of audio command list entries for the rsp microcode
|
||||
@@ -998,7 +1003,7 @@ void AudioHeap_Init(void) {
|
||||
temporarySize =
|
||||
spec->temporarySeqCacheSize + spec->temporaryFontCacheSize + spec->temporarySampleBankCacheSize + 0x10;
|
||||
cachePoolSize = persistentSize + temporarySize;
|
||||
miscPoolSize = gAudioContext.audioSessionPool.size - cachePoolSize - 0x100;
|
||||
miscPoolSize = gAudioContext.sessionPool.size - cachePoolSize - 0x100;
|
||||
|
||||
if (gAudioContext.externalPool.startAddr != NULL) {
|
||||
gAudioContext.externalPool.curAddr = gAudioContext.externalPool.startAddr;
|
||||
@@ -1018,13 +1023,13 @@ void AudioHeap_Init(void) {
|
||||
gAudioContext.persistentCommonPoolSplit.seqCacheSize = spec->persistentSeqCacheSize;
|
||||
gAudioContext.persistentCommonPoolSplit.fontCacheSize = spec->persistentFontCacheSize;
|
||||
gAudioContext.persistentCommonPoolSplit.sampleBankCacheSize = spec->persistentSampleBankCacheSize;
|
||||
AudioHeap_InitPersistentCache(&gAudioContext.persistentCommonPoolSplit);
|
||||
AudioHeap_InitPersistentPoolsAndCaches(&gAudioContext.persistentCommonPoolSplit);
|
||||
|
||||
// Temporary Pool Split (Split into Sequences, SoundFonts, Samples)
|
||||
gAudioContext.temporaryCommonPoolSplit.seqCacheSize = spec->temporarySeqCacheSize;
|
||||
gAudioContext.temporaryCommonPoolSplit.fontCacheSize = spec->temporaryFontCacheSize;
|
||||
gAudioContext.temporaryCommonPoolSplit.sampleBankCacheSize = spec->temporarySampleBankCacheSize;
|
||||
AudioHeap_InitTemporaryCache(&gAudioContext.temporaryCommonPoolSplit);
|
||||
AudioHeap_InitTemporaryPoolsAndCaches(&gAudioContext.temporaryCommonPoolSplit);
|
||||
|
||||
AudioHeap_ResetLoadStatus();
|
||||
|
||||
@@ -1039,12 +1044,12 @@ void AudioHeap_Init(void) {
|
||||
// Initialize audio binary interface command list buffer
|
||||
for (j = 0; j < ARRAY_COUNT(gAudioContext.abiCmdBufs); j++) {
|
||||
gAudioContext.abiCmdBufs[j] =
|
||||
AudioHeap_AllocDmaMemoryZeroed(&gAudioContext.miscPool, gAudioContext.maxAudioCmds * sizeof(u64));
|
||||
AudioHeap_AllocDmaMemoryZeroed(&gAudioContext.miscPool, gAudioContext.maxAudioCmds * sizeof(Acmd));
|
||||
}
|
||||
|
||||
// Initialize adsrDecayTable (fadeOutVelocities for ADSR)
|
||||
// Initialize the decay rate table for ADSR
|
||||
gAudioContext.adsrDecayTable = AudioHeap_Alloc(&gAudioContext.miscPool, 0x100 * sizeof(f32));
|
||||
func_8018B10C();
|
||||
AudioHeap_InitAdsrDecayTable();
|
||||
|
||||
// Initialize reverbs
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioContext.synthesisReverbs); i++) {
|
||||
@@ -1139,14 +1144,14 @@ void AudioHeap_InitSampleCaches(size_t persistentSampleCacheSize, size_t tempora
|
||||
if (addr == NULL) {
|
||||
gAudioContext.persistentSampleCache.pool.size = 0;
|
||||
} else {
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.persistentSampleCache.pool, addr, persistentSampleCacheSize);
|
||||
AudioHeap_InitPool(&gAudioContext.persistentSampleCache.pool, addr, persistentSampleCacheSize);
|
||||
}
|
||||
|
||||
addr = AudioHeap_AllocAttemptExternal(&gAudioContext.miscPool, temporarySampleCacheSize);
|
||||
if (addr == NULL) {
|
||||
gAudioContext.temporarySampleCache.pool.size = 0;
|
||||
} else {
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.temporarySampleCache.pool, addr, temporarySampleCacheSize);
|
||||
AudioHeap_InitPool(&gAudioContext.temporarySampleCache.pool, addr, temporarySampleCacheSize);
|
||||
}
|
||||
|
||||
gAudioContext.persistentSampleCache.numEntries = 0;
|
||||
@@ -1257,35 +1262,35 @@ SampleCacheEntry* AudioHeap_AllocTemporarySampleCacheEntry(size_t size) {
|
||||
void AudioHeap_UnapplySampleCacheForFont(SampleCacheEntry* entry, s32 fontId) {
|
||||
Drum* drum;
|
||||
Instrument* inst;
|
||||
SoundFontSound* sfx;
|
||||
SoundEffect* soundEffect;
|
||||
s32 instId;
|
||||
s32 drumId;
|
||||
s32 sfxId;
|
||||
|
||||
for (instId = 0; instId < gAudioContext.soundFonts[fontId].numInstruments; instId++) {
|
||||
for (instId = 0; instId < gAudioContext.soundFontList[fontId].numInstruments; instId++) {
|
||||
inst = AudioPlayback_GetInstrumentInner(fontId, instId);
|
||||
if (inst != NULL) {
|
||||
if (inst->normalRangeLo != 0) {
|
||||
AudioHeap_UnapplySampleCache(entry, inst->lowNotesSound.sample);
|
||||
AudioHeap_UnapplySampleCache(entry, inst->lowPitchTunedSample.sample);
|
||||
}
|
||||
if (inst->normalRangeHi != 0x7F) {
|
||||
AudioHeap_UnapplySampleCache(entry, inst->highNotesSound.sample);
|
||||
AudioHeap_UnapplySampleCache(entry, inst->highPitchTunedSample.sample);
|
||||
}
|
||||
AudioHeap_UnapplySampleCache(entry, inst->normalNotesSound.sample);
|
||||
AudioHeap_UnapplySampleCache(entry, inst->normalPitchTunedSample.sample);
|
||||
}
|
||||
}
|
||||
|
||||
for (drumId = 0; drumId < gAudioContext.soundFonts[fontId].numDrums; drumId++) {
|
||||
for (drumId = 0; drumId < gAudioContext.soundFontList[fontId].numDrums; drumId++) {
|
||||
drum = AudioPlayback_GetDrum(fontId, drumId);
|
||||
if (drum != NULL) {
|
||||
AudioHeap_UnapplySampleCache(entry, drum->sound.sample);
|
||||
AudioHeap_UnapplySampleCache(entry, drum->tunedSample.sample);
|
||||
}
|
||||
}
|
||||
|
||||
for (sfxId = 0; sfxId < gAudioContext.soundFonts[fontId].numSfx; sfxId++) {
|
||||
sfx = AudioPlayback_GetSfx(fontId, sfxId);
|
||||
if (sfx != NULL) {
|
||||
AudioHeap_UnapplySampleCache(entry, sfx->sample);
|
||||
for (sfxId = 0; sfxId < gAudioContext.soundFontList[fontId].numSfx; sfxId++) {
|
||||
soundEffect = AudioPlayback_GetSoundEffect(fontId, sfxId);
|
||||
if (soundEffect != NULL) {
|
||||
AudioHeap_UnapplySampleCache(entry, soundEffect->tunedSample.sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1298,8 +1303,8 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) {
|
||||
|
||||
numFonts = gAudioContext.soundFontTable->numEntries;
|
||||
for (fontId = 0; fontId < numFonts; fontId++) {
|
||||
sampleBankId1 = gAudioContext.soundFonts[fontId].sampleBankId1;
|
||||
sampleBankId2 = gAudioContext.soundFonts[fontId].sampleBankId2;
|
||||
sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
|
||||
sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
|
||||
if (((sampleBankId1 != 0xFF) && (entry->sampleBankId == sampleBankId1)) ||
|
||||
((sampleBankId2 != 0xFF) && (entry->sampleBankId == sampleBankId2)) || entry->sampleBankId == 0 ||
|
||||
entry->sampleBankId == 0xFE) {
|
||||
@@ -1313,7 +1318,7 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) {
|
||||
}
|
||||
}
|
||||
|
||||
void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, SoundFontSample* sample) {
|
||||
void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, Sample* sample) {
|
||||
if (sample != NULL) {
|
||||
if (sample->sampleAddr == entry->allocatedAddr) {
|
||||
sample->sampleAddr = entry->sampleAddr;
|
||||
@@ -1362,8 +1367,8 @@ void AudioHeap_DiscardSampleCaches(void) {
|
||||
|
||||
numFonts = gAudioContext.soundFontTable->numEntries;
|
||||
for (fontId = 0; fontId < numFonts; fontId++) {
|
||||
sampleBankId1 = gAudioContext.soundFonts[fontId].sampleBankId1;
|
||||
sampleBankId2 = gAudioContext.soundFonts[fontId].sampleBankId2;
|
||||
sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
|
||||
sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
|
||||
if ((sampleBankId1 == 0xFF) && (sampleBankId2 == 0xFF)) {
|
||||
continue;
|
||||
}
|
||||
@@ -1390,7 +1395,7 @@ typedef struct {
|
||||
u8 newMedium;
|
||||
} StorageChange;
|
||||
|
||||
void AudioHeap_ChangeStorage(StorageChange* change, SoundFontSample* sample) {
|
||||
void AudioHeap_ChangeStorage(StorageChange* change, Sample* sample) {
|
||||
if (sample != NULL && ((sample->medium == change->newMedium) || (D_801FD120 != 1)) &&
|
||||
((sample->medium == MEDIUM_RAM) || (D_801FD120 != 0))) {
|
||||
uintptr_t startAddr = change->oldAddr;
|
||||
@@ -1430,7 +1435,7 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
|
||||
s32 fontId;
|
||||
Drum* drum;
|
||||
Instrument* inst;
|
||||
SoundFontSound* sfx;
|
||||
SoundEffect* soundEffect;
|
||||
uintptr_t* newAddr;
|
||||
s32 pad[4];
|
||||
|
||||
@@ -1457,8 +1462,8 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
|
||||
}
|
||||
|
||||
for (fontId = 0; fontId < numFonts; fontId++) {
|
||||
sampleBankId1 = gAudioContext.soundFonts[fontId].sampleBankId1;
|
||||
sampleBankId2 = gAudioContext.soundFonts[fontId].sampleBankId2;
|
||||
sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
|
||||
sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
|
||||
if ((sampleBankId1 != 0xFF) || (sampleBankId2 != 0xFF)) {
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId) ||
|
||||
AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, fontId) == NULL) {
|
||||
@@ -1471,30 +1476,30 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (instId = 0; instId < gAudioContext.soundFonts[fontId].numInstruments; instId++) {
|
||||
for (instId = 0; instId < gAudioContext.soundFontList[fontId].numInstruments; instId++) {
|
||||
inst = AudioPlayback_GetInstrumentInner(fontId, instId);
|
||||
if (inst != NULL) {
|
||||
if (inst->normalRangeLo != 0) {
|
||||
AudioHeap_ChangeStorage(&change, inst->lowNotesSound.sample);
|
||||
AudioHeap_ChangeStorage(&change, inst->lowPitchTunedSample.sample);
|
||||
}
|
||||
if (inst->normalRangeHi != 0x7F) {
|
||||
AudioHeap_ChangeStorage(&change, inst->highNotesSound.sample);
|
||||
AudioHeap_ChangeStorage(&change, inst->highPitchTunedSample.sample);
|
||||
}
|
||||
AudioHeap_ChangeStorage(&change, inst->normalNotesSound.sample);
|
||||
AudioHeap_ChangeStorage(&change, inst->normalPitchTunedSample.sample);
|
||||
}
|
||||
}
|
||||
|
||||
for (drumId = 0; drumId < gAudioContext.soundFonts[fontId].numDrums; drumId++) {
|
||||
for (drumId = 0; drumId < gAudioContext.soundFontList[fontId].numDrums; drumId++) {
|
||||
drum = AudioPlayback_GetDrum(fontId, drumId);
|
||||
if (drum != NULL) {
|
||||
AudioHeap_ChangeStorage(&change, drum->sound.sample);
|
||||
AudioHeap_ChangeStorage(&change, drum->tunedSample.sample);
|
||||
}
|
||||
}
|
||||
|
||||
for (sfxId = 0; sfxId < gAudioContext.soundFonts[fontId].numSfx; sfxId++) {
|
||||
sfx = AudioPlayback_GetSfx(fontId, sfxId);
|
||||
if (sfx != NULL) {
|
||||
AudioHeap_ChangeStorage(&change, sfx->sample);
|
||||
for (sfxId = 0; sfxId < gAudioContext.soundFontList[fontId].numSfx; sfxId++) {
|
||||
soundEffect = AudioPlayback_GetSoundEffect(fontId, sfxId);
|
||||
if (soundEffect != NULL) {
|
||||
AudioHeap_ChangeStorage(&change, soundEffect->tunedSample.sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1671,9 +1676,9 @@ void AudioHeap_InitReverb(s32 reverbIndex, ReverbSettings* settings, s32 flags)
|
||||
reverb->framesToIgnore = 2;
|
||||
}
|
||||
|
||||
reverb->sound.sample = &reverb->sample;
|
||||
reverb->tunedSample.sample = &reverb->sample;
|
||||
reverb->sample.loop = &reverb->loop;
|
||||
reverb->sound.tuning = 1.0f;
|
||||
reverb->tunedSample.tuning = 1.0f;
|
||||
reverb->sample.codec = CODEC_REVERB;
|
||||
reverb->sample.medium = MEDIUM_RAM;
|
||||
reverb->sample.size = reverb->windowSize * 2;
|
||||
|
||||
@@ -5,8 +5,8 @@ const s16 gAudioTatumInit[] = {
|
||||
0x30, // gTatumsPerBeat
|
||||
};
|
||||
|
||||
const AudioContextInitSizes gAudioContextInitSizes = {
|
||||
const AudioHeapInitSizes gAudioHeapInitSizes = {
|
||||
0x137F00, // heapSize
|
||||
0x1C480, // mainPoolSplitSize
|
||||
0x1C480, // initPoolSize
|
||||
0x1A000, // permanentPoolSize
|
||||
};
|
||||
|
||||
+265
-184
@@ -16,7 +16,7 @@
|
||||
* SoundFont Notes:
|
||||
*
|
||||
*/
|
||||
// opaque type for unpatched sound font data (should maybe get rid of this?)
|
||||
// opaque type for soundfont data loaded into ram (should maybe get rid of this?)
|
||||
typedef void SoundFontData;
|
||||
|
||||
typedef struct {
|
||||
@@ -26,7 +26,7 @@ typedef struct {
|
||||
/* 0x0C */ uintptr_t baseAddr2;
|
||||
/* 0x10 */ u32 medium1;
|
||||
/* 0x14 */ u32 medium2;
|
||||
} AudioRelocInfo; // size = 0x18
|
||||
} SampleBankRelocInfo; // size = 0x18
|
||||
|
||||
void AudioLoad_DiscardFont(s32 fontId);
|
||||
s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2);
|
||||
@@ -42,7 +42,7 @@ void AudioLoad_SyncDmaUnkMedium(uintptr_t devAddr, u8* addr, size_t size, s32 un
|
||||
s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, uintptr_t devAddr, void* ramAddr, size_t size,
|
||||
OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType);
|
||||
void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue);
|
||||
SoundFontSample* AudioLoad_GetFontSample(s32 fontId, s32 instId);
|
||||
Sample* AudioLoad_GetFontSample(s32 fontId, s32 instId);
|
||||
void AudioLoad_ProcessSlowLoads(s32 resetStatus);
|
||||
void AudioLoad_DmaSlowCopy(AudioSlowLoad* slowLoad, size_t size);
|
||||
void AudioLoad_DmaSlowCopyUnkMedium(intptr_t devAddr, intptr_t ramAddr, size_t size, s32 arg3);
|
||||
@@ -56,8 +56,9 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus);
|
||||
void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, size_t size);
|
||||
void AudioLoad_AsyncDmaRamUnloaded(AudioAsyncLoad* asyncLoad, size_t size);
|
||||
void AudioLoad_AsyncDmaUnkMedium(uintptr_t devAddr, void* ramAddr, size_t size, s16 arg3);
|
||||
void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* fontData, AudioRelocInfo* relocInfo);
|
||||
void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* fontData, AudioRelocInfo* relocInfo, s32 async);
|
||||
void AudioLoad_RelocateSample(TunedSample* tunedSample, SoundFontData* fontData, SampleBankRelocInfo* sampleBankReloc);
|
||||
void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* fontData, SampleBankRelocInfo* sampleBankReloc,
|
||||
s32 isAsync);
|
||||
s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus);
|
||||
|
||||
#define MK_ASYNC_MSG(retData, tableType, id, loadStatus) \
|
||||
@@ -217,7 +218,7 @@ void* AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaI
|
||||
dma->devAddr = dmaDevAddr;
|
||||
dma->sizeUnused = transfer;
|
||||
AudioLoad_Dma(&gAudioContext.currAudioFrameDmaIoMesgBuf[gAudioContext.curAudioFrameDmaCount++], OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr, dma->ramAddr, transfer, &gAudioContext.currAudioFrameDmaQueue, medium,
|
||||
OS_READ, dmaDevAddr, dma->ramAddr, transfer, &gAudioContext.curAudioFrameDmaQueue, medium,
|
||||
"SUPERDMA");
|
||||
*dmaIndexRef = dmaIndex;
|
||||
return (devAddr - dmaDevAddr) + dma->ramAddr;
|
||||
@@ -423,10 +424,10 @@ void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1, s32 arg2, OSMesgQueue* arg3
|
||||
}
|
||||
}
|
||||
|
||||
s32 AudioLoad_SyncLoadSample(SoundFontSample* sample, s32 fontId) {
|
||||
s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) {
|
||||
void* sampleAddr;
|
||||
|
||||
if (sample->unk_bit25 == true) {
|
||||
if (sample->isRelocated == true) {
|
||||
if (sample->medium != MEDIUM_RAM) {
|
||||
sampleAddr = AudioHeap_AllocSampleCache(sample->size, fontId, (void*)sample->sampleAddr, sample->medium,
|
||||
CACHE_PERSISTENT);
|
||||
@@ -454,11 +455,11 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
|
||||
return -1;
|
||||
}
|
||||
if (instrument->normalRangeLo != 0) {
|
||||
AudioLoad_SyncLoadSample(instrument->lowNotesSound.sample, fontId);
|
||||
AudioLoad_SyncLoadSample(instrument->lowPitchTunedSample.sample, fontId);
|
||||
}
|
||||
AudioLoad_SyncLoadSample(instrument->normalNotesSound.sample, fontId);
|
||||
AudioLoad_SyncLoadSample(instrument->normalPitchTunedSample.sample, fontId);
|
||||
if (instrument->normalRangeHi != 0x7F) {
|
||||
return AudioLoad_SyncLoadSample(instrument->highNotesSound.sample, fontId);
|
||||
return AudioLoad_SyncLoadSample(instrument->highPitchTunedSample.sample, fontId);
|
||||
}
|
||||
// TODO: is this missing return UB?
|
||||
} else if (instId == 0x7F) {
|
||||
@@ -467,7 +468,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
|
||||
if (drum == NULL) {
|
||||
return -1;
|
||||
}
|
||||
AudioLoad_SyncLoadSample(drum->sound.sample, fontId);
|
||||
AudioLoad_SyncLoadSample(drum->tunedSample.sample, fontId);
|
||||
return 0;
|
||||
}
|
||||
// TODO: is this missing return UB?
|
||||
@@ -680,28 +681,29 @@ SoundFontData* AudioLoad_SyncLoadFont(u32 fontId) {
|
||||
s32 sampleBankId1;
|
||||
s32 sampleBankId2;
|
||||
s32 didAllocate;
|
||||
AudioRelocInfo relocInfo;
|
||||
SampleBankRelocInfo sampleBankReloc;
|
||||
s32 realFontId = AudioLoad_GetRealTableIndex(FONT_TABLE, fontId);
|
||||
|
||||
if (gAudioContext.fontLoadStatus[realFontId] == LOAD_STATUS_IN_PROGRESS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sampleBankId1 = gAudioContext.soundFonts[realFontId].sampleBankId1;
|
||||
sampleBankId2 = gAudioContext.soundFonts[realFontId].sampleBankId2;
|
||||
sampleBankId1 = gAudioContext.soundFontList[realFontId].sampleBankId1;
|
||||
sampleBankId2 = gAudioContext.soundFontList[realFontId].sampleBankId2;
|
||||
|
||||
relocInfo.sampleBankId1 = sampleBankId1;
|
||||
relocInfo.sampleBankId2 = sampleBankId2;
|
||||
if (relocInfo.sampleBankId1 != 0xFF) {
|
||||
relocInfo.baseAddr1 = AudioLoad_TrySyncLoadSampleBank(relocInfo.sampleBankId1, &relocInfo.medium1, false);
|
||||
sampleBankReloc.sampleBankId1 = sampleBankId1;
|
||||
sampleBankReloc.sampleBankId2 = sampleBankId2;
|
||||
if (sampleBankReloc.sampleBankId1 != 0xFF) {
|
||||
sampleBankReloc.baseAddr1 =
|
||||
AudioLoad_TrySyncLoadSampleBank(sampleBankReloc.sampleBankId1, &sampleBankReloc.medium1, false);
|
||||
} else {
|
||||
relocInfo.baseAddr1 = 0;
|
||||
sampleBankReloc.baseAddr1 = 0;
|
||||
}
|
||||
|
||||
if (sampleBankId2 != 0xFF) {
|
||||
relocInfo.baseAddr2 = AudioLoad_TrySyncLoadSampleBank(sampleBankId2, &relocInfo.medium2, false);
|
||||
sampleBankReloc.baseAddr2 = AudioLoad_TrySyncLoadSampleBank(sampleBankId2, &sampleBankReloc.medium2, false);
|
||||
} else {
|
||||
relocInfo.baseAddr2 = 0;
|
||||
sampleBankReloc.baseAddr2 = 0;
|
||||
}
|
||||
|
||||
fontData = AudioLoad_SyncLoad(FONT_TABLE, fontId, &didAllocate);
|
||||
@@ -709,7 +711,7 @@ SoundFontData* AudioLoad_SyncLoadFont(u32 fontId) {
|
||||
return NULL;
|
||||
}
|
||||
if (didAllocate == true) {
|
||||
AudioLoad_RelocateFontAndPreloadSamples(realFontId, fontData, &relocInfo, false);
|
||||
AudioLoad_RelocateFontAndPreloadSamples(realFontId, fontData, &sampleBankReloc, false);
|
||||
}
|
||||
|
||||
return fontData;
|
||||
@@ -778,7 +780,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate) {
|
||||
}
|
||||
|
||||
if (tableType == FONT_TABLE) {
|
||||
SoundFont* soundFont = &gAudioContext.soundFonts[realId];
|
||||
SoundFont* soundFont = &gAudioContext.soundFontList[realId];
|
||||
|
||||
soundFont->numInstruments = ((UnloadedFonts*)romAddr)->numInstruments;
|
||||
soundFont->numDrums = ((UnloadedFonts*)romAddr)->numDrums;
|
||||
@@ -861,89 +863,131 @@ AudioTable* AudioLoad_GetLoadTable(s32 tableType) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Read and extract information from soundFont binary loaded into ram.
|
||||
* Also relocate offsets into pointers within this loaded soundFont
|
||||
*
|
||||
* SoundFontData* mem -> the address of the soundFont as stored in memory
|
||||
* @param fontId index of font being processed
|
||||
* @param fontDataStartAddr ram address of raw soundfont binary loaded into cache
|
||||
* @param sampleBankReloc information on the sampleBank containing raw audio samples
|
||||
*/
|
||||
void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontData, AudioRelocInfo* relocInfo) {
|
||||
uintptr_t reloc;
|
||||
uintptr_t reloc2;
|
||||
void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, SampleBankRelocInfo* sampleBankReloc) {
|
||||
uintptr_t soundOffset;
|
||||
uintptr_t soundListOffset;
|
||||
Instrument* inst;
|
||||
Drum* drum;
|
||||
SoundFontSound* sfx;
|
||||
SoundEffect* soundEffect;
|
||||
s32 i;
|
||||
s32 numDrums = gAudioContext.soundFonts[fontId].numDrums;
|
||||
s32 numInstruments = gAudioContext.soundFonts[fontId].numInstruments;
|
||||
s32 numSfx = gAudioContext.soundFonts[fontId].numSfx;
|
||||
void** ptrs = (void**)fontData;
|
||||
s32 numDrums = gAudioContext.soundFontList[fontId].numDrums;
|
||||
s32 numInstruments = gAudioContext.soundFontList[fontId].numInstruments;
|
||||
s32 numSfx = gAudioContext.soundFontList[fontId].numSfx;
|
||||
u32* fontData = (u32*)fontDataStartAddr;
|
||||
|
||||
#define BASE_OFFSET(x) (void*)((uintptr_t)(x) + (uintptr_t)(fontData))
|
||||
// Relocate an offset (relative to the start of the font data) to a pointer (a ram address)
|
||||
#define RELOC_TO_RAM(x) (void*)((uintptr_t)(x) + (uintptr_t)(fontDataStartAddr))
|
||||
|
||||
// relocate drums
|
||||
reloc2 = ptrs[0];
|
||||
// Drums relocation
|
||||
|
||||
// The first u32 in fontData is an offset to a list of offsets to the drums
|
||||
soundListOffset = fontData[0];
|
||||
if (1) {}
|
||||
if ((reloc2 != 0) && (numDrums != 0)) {
|
||||
ptrs[0] = BASE_OFFSET(reloc2);
|
||||
|
||||
// If the soundFont has drums
|
||||
if ((soundListOffset != 0) && (numDrums != 0)) {
|
||||
|
||||
fontData[0] = RELOC_TO_RAM(soundListOffset);
|
||||
|
||||
// Loop through the drum offsets
|
||||
for (i = 0; i < numDrums; i++) {
|
||||
reloc = ((Drum**)ptrs[0])[i];
|
||||
if (reloc != 0) {
|
||||
reloc = BASE_OFFSET(reloc);
|
||||
((Drum**)ptrs[0])[i] = drum = reloc;
|
||||
if (!drum->loaded) {
|
||||
AudioLoad_RelocateSample(&drum->sound, fontData, relocInfo);
|
||||
reloc = drum->envelope;
|
||||
drum->envelope = BASE_OFFSET(reloc);
|
||||
drum->loaded = true;
|
||||
// Get the i'th drum offset
|
||||
soundOffset = ((Drum**)fontData[0])[i];
|
||||
|
||||
// Some drum data entries are empty, represented by an offset of 0 in the list of drum offsets
|
||||
if (soundOffset != 0) {
|
||||
soundOffset = RELOC_TO_RAM(soundOffset);
|
||||
((Drum**)fontData[0])[i] = drum = soundOffset;
|
||||
|
||||
// The drum may be in the list multiple times and already relocated
|
||||
if (!drum->isRelocated) {
|
||||
AudioLoad_RelocateSample(&drum->tunedSample, fontDataStartAddr, sampleBankReloc);
|
||||
|
||||
soundOffset = drum->envelope;
|
||||
drum->envelope = RELOC_TO_RAM(soundOffset);
|
||||
|
||||
drum->isRelocated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// relocate sfxs
|
||||
reloc2 = ptrs[1];
|
||||
// Sound effects relocation
|
||||
|
||||
// The second u32 in fontData is an offset to the first sound effect entry
|
||||
soundListOffset = fontData[1];
|
||||
if (1) {}
|
||||
if ((reloc2 != 0) && (numSfx != 0)) {
|
||||
ptrs[1] = BASE_OFFSET(reloc2);
|
||||
|
||||
// If the soundFont has sound effects
|
||||
if ((soundListOffset != 0) && (numSfx != 0)) {
|
||||
|
||||
fontData[1] = RELOC_TO_RAM(soundListOffset);
|
||||
|
||||
// Loop through the sound effects
|
||||
for (i = 0; i < numSfx; i++) {
|
||||
reloc = (SoundFontSound*)ptrs[1] + i;
|
||||
if (reloc != 0) {
|
||||
sfx = reloc;
|
||||
if (sfx->sample != NULL) {
|
||||
AudioLoad_RelocateSample(sfx, fontData, relocInfo);
|
||||
}
|
||||
// Get a pointer to the i'th sound effect
|
||||
soundOffset = (TunedSample*)fontData[1] + i;
|
||||
soundEffect = (SoundEffect*)soundOffset;
|
||||
|
||||
// Check for NULL (note: the pointer is guaranteed to be in fontData and can never be NULL)
|
||||
if ((soundEffect != NULL) && (soundEffect->tunedSample.sample != NULL)) {
|
||||
AudioLoad_RelocateSample(&soundEffect->tunedSample, fontDataStartAddr, sampleBankReloc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (numInstruments > 0x7E) {
|
||||
numInstruments = 0x7E;
|
||||
// Instruments relocation
|
||||
|
||||
// Instrument Id 126 and above is reserved.
|
||||
// There can only be 126 instruments, indexed from 0 to 125
|
||||
if (numInstruments > 126) {
|
||||
numInstruments = 126;
|
||||
}
|
||||
|
||||
// relocate instruments
|
||||
// Starting from the 3rd u32 in fontData is the list of offsets to the instruments
|
||||
// Loop through the instruments
|
||||
for (i = 2; i <= 2 + numInstruments - 1; i++) {
|
||||
if (ptrs[i] != NULL) {
|
||||
ptrs[i] = BASE_OFFSET(ptrs[i]);
|
||||
inst = ptrs[i];
|
||||
if (!inst->loaded) {
|
||||
// Some instrument data entries are empty, represented by an offset of 0 in the list of instrument offsets
|
||||
if (fontData[i] != 0) {
|
||||
fontData[i] = RELOC_TO_RAM(fontData[i]);
|
||||
inst = (Instrument*)fontData[i];
|
||||
|
||||
// The instrument may be in the list multiple times and already relocated
|
||||
if (!inst->isRelocated) {
|
||||
// Some instruments have a different sample for low pitches
|
||||
if (inst->normalRangeLo != 0) {
|
||||
AudioLoad_RelocateSample(&inst->lowNotesSound, fontData, relocInfo);
|
||||
}
|
||||
AudioLoad_RelocateSample(&inst->normalNotesSound, fontData, relocInfo);
|
||||
if (inst->normalRangeHi != 0x7F) {
|
||||
AudioLoad_RelocateSample(&inst->highNotesSound, fontData, relocInfo);
|
||||
AudioLoad_RelocateSample(&inst->lowPitchTunedSample, fontDataStartAddr, sampleBankReloc);
|
||||
}
|
||||
|
||||
reloc = inst->envelope;
|
||||
inst->envelope = BASE_OFFSET(reloc);
|
||||
inst->loaded = true;
|
||||
// Every instrument has a sample for the default range
|
||||
AudioLoad_RelocateSample(&inst->normalPitchTunedSample, fontDataStartAddr, sampleBankReloc);
|
||||
|
||||
// Some instruments have a different sample for high pitches
|
||||
if (inst->normalRangeHi != 0x7F) {
|
||||
AudioLoad_RelocateSample(&inst->highPitchTunedSample, fontDataStartAddr, sampleBankReloc);
|
||||
}
|
||||
|
||||
soundOffset = inst->envelope;
|
||||
inst->envelope = (EnvelopePoint*)RELOC_TO_RAM(soundOffset);
|
||||
|
||||
inst->isRelocated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef BASE_OFFSET
|
||||
#undef RELOC_TO_RAM
|
||||
|
||||
gAudioContext.soundFonts[fontId].drums = ptrs[0];
|
||||
gAudioContext.soundFonts[fontId].soundEffects = ptrs[1];
|
||||
gAudioContext.soundFonts[fontId].instruments = (Instrument**)(&ptrs[2]);
|
||||
// Store the relocated pointers
|
||||
gAudioContext.soundFontList[fontId].drums = (Drum**)fontData[0];
|
||||
gAudioContext.soundFontList[fontId].soundEffects = (SoundEffect*)fontData[1];
|
||||
gAudioContext.soundFontList[fontId].instruments = (Instrument**)(&fontData[2]);
|
||||
}
|
||||
|
||||
void AudioLoad_SyncDma(uintptr_t devAddr, u8* ramAddr, size_t size, s32 medium) {
|
||||
@@ -1102,7 +1146,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
|
||||
}
|
||||
|
||||
if (tableType == FONT_TABLE) {
|
||||
soundFont = &gAudioContext.soundFonts[realId];
|
||||
soundFont = &gAudioContext.soundFontList[realId];
|
||||
|
||||
soundFont->numInstruments = ((UnloadedFonts*)romAddr)->numInstruments;
|
||||
soundFont->numDrums = ((UnloadedFonts*)romAddr)->numDrums;
|
||||
@@ -1154,8 +1198,8 @@ void AudioLoad_SetUnusedHandler(void* callback) {
|
||||
sUnusedHandler = callback;
|
||||
}
|
||||
|
||||
void AudioLoad_InitSoundFontMeta(s32 fontId) {
|
||||
SoundFont* font = &gAudioContext.soundFonts[fontId];
|
||||
void AudioLoad_InitSoundFont(s32 fontId) {
|
||||
SoundFont* font = &gAudioContext.soundFontList[fontId];
|
||||
AudioTableEntry* entry = &gAudioContext.soundFontTable->entries[fontId];
|
||||
|
||||
font->sampleBankId1 = (entry->shortData1 >> 8) & 0xFF;
|
||||
@@ -1210,20 +1254,20 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
|
||||
|
||||
AudioThread_InitMesgQueues();
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBufLengths); i++) {
|
||||
gAudioContext.aiBufLengths[i] = 0xA0;
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBufNumSamples); i++) {
|
||||
gAudioContext.aiBufNumSamples[i] = 0xA0;
|
||||
}
|
||||
|
||||
gAudioContext.totalTaskCount = 0;
|
||||
gAudioContext.rspTaskIndex = 0;
|
||||
gAudioContext.curAiBuffferIndex = 0;
|
||||
gAudioContext.curAiBufferIndex = 0;
|
||||
gAudioContext.soundMode = SOUNDMODE_STEREO;
|
||||
gAudioContext.curTask = NULL;
|
||||
gAudioContext.rspTask[0].task.t.dataSize = 0;
|
||||
gAudioContext.rspTask[1].task.t.dataSize = 0;
|
||||
|
||||
osCreateMesgQueue(&gAudioContext.syncDmaQueue, &gAudioContext.syncDmaMesg, 1);
|
||||
osCreateMesgQueue(&gAudioContext.currAudioFrameDmaQueue, gAudioContext.currAudioFrameDmaMesgBuf,
|
||||
osCreateMesgQueue(&gAudioContext.curAudioFrameDmaQueue, gAudioContext.currAudioFrameDmaMesgBuf,
|
||||
ARRAY_COUNT(gAudioContext.currAudioFrameDmaMesgBuf));
|
||||
osCreateMesgQueue(&gAudioContext.externalLoadQueue, gAudioContext.externalLoadMesgBuf,
|
||||
ARRAY_COUNT(gAudioContext.externalLoadMesgBuf));
|
||||
@@ -1235,23 +1279,24 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
|
||||
|
||||
if (heap == NULL) {
|
||||
gAudioContext.audioHeap = gAudioHeap;
|
||||
gAudioContext.audioHeapSize = gAudioContextInitSizes.heapSize;
|
||||
gAudioContext.audioHeapSize = gAudioHeapInitSizes.heapSize;
|
||||
} else {
|
||||
void** hp = &heap;
|
||||
|
||||
gAudioContext.audioHeap = *hp;
|
||||
gAudioContext.audioHeapSize = heapSize;
|
||||
}
|
||||
|
||||
for (i = 0; i < (s32)gAudioContext.audioHeapSize / 8; i++) {
|
||||
for (i = 0; i < ((s32)gAudioContext.audioHeapSize / (s32)sizeof(u64)); i++) {
|
||||
((u64*)gAudioContext.audioHeap)[i] = 0;
|
||||
}
|
||||
|
||||
// Main Pool Split (split entirety of audio heap into initPool and sessionPool)
|
||||
AudioHeap_InitMainPool(gAudioContextInitSizes.mainPoolSplitSize);
|
||||
AudioHeap_InitMainPool(gAudioHeapInitSizes.initPoolSize);
|
||||
|
||||
// Initialize the audio interface buffer
|
||||
// Initialize the audio interface buffers
|
||||
for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBuffers); i++) {
|
||||
gAudioContext.aiBuffers[i] = AudioHeap_AllocZeroed(&gAudioContext.audioInitPool, AIBUF_LEN * sizeof(s16));
|
||||
gAudioContext.aiBuffers[i] = AudioHeap_AllocZeroed(&gAudioContext.initPool, AIBUF_LEN * sizeof(s16));
|
||||
}
|
||||
|
||||
// Connect audio tables to their tables in memory
|
||||
@@ -1272,18 +1317,18 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
|
||||
AudioLoad_InitTable(gAudioContext.sampleBankTable, SEGMENT_ROM_START(Audiotable), 0);
|
||||
|
||||
numFonts = gAudioContext.soundFontTable->numEntries;
|
||||
gAudioContext.soundFonts = AudioHeap_Alloc(&gAudioContext.audioInitPool, numFonts * sizeof(SoundFont));
|
||||
gAudioContext.soundFontList = AudioHeap_Alloc(&gAudioContext.initPool, numFonts * sizeof(SoundFont));
|
||||
|
||||
for (i = 0; i < numFonts; i++) {
|
||||
AudioLoad_InitSoundFontMeta(i);
|
||||
AudioLoad_InitSoundFont(i);
|
||||
}
|
||||
|
||||
if (addr = AudioHeap_Alloc(&gAudioContext.audioInitPool, gAudioContextInitSizes.permanentPoolSize), addr == NULL) {
|
||||
// cast away const from D_8014A6C4
|
||||
*((u32*)&gAudioContextInitSizes.permanentPoolSize) = 0;
|
||||
if (addr = AudioHeap_Alloc(&gAudioContext.initPool, gAudioHeapInitSizes.permanentPoolSize), addr == NULL) {
|
||||
// cast away const from gAudioHeapInitSizes
|
||||
*((u32*)&gAudioHeapInitSizes.permanentPoolSize) = 0;
|
||||
}
|
||||
|
||||
AudioHeap_AllocPoolInit(&gAudioContext.permanentPool, addr, gAudioContextInitSizes.permanentPoolSize);
|
||||
AudioHeap_InitPool(&gAudioContext.permanentPool, addr, gAudioHeapInitSizes.permanentPoolSize);
|
||||
gAudioContextInitalized = true;
|
||||
osSendMesg(gAudioContext.taskStartQueueP, (void*)gAudioContext.totalTaskCount, OS_MESG_NOBLOCK);
|
||||
}
|
||||
@@ -1294,7 +1339,7 @@ void AudioLoad_InitSlowLoads(void) {
|
||||
}
|
||||
|
||||
s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
|
||||
SoundFontSample* sample;
|
||||
Sample* sample;
|
||||
AudioSlowLoad* slowLoad;
|
||||
|
||||
sample = AudioLoad_GetFontSample(fontId, instId);
|
||||
@@ -1344,8 +1389,8 @@ s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
SoundFontSample* AudioLoad_GetFontSample(s32 fontId, s32 instId) {
|
||||
SoundFontSample* sample;
|
||||
Sample* AudioLoad_GetFontSample(s32 fontId, s32 instId) {
|
||||
Sample* sample;
|
||||
|
||||
if (instId < 0x80) {
|
||||
Instrument* instrument = AudioPlayback_GetInstrumentInner(fontId, instId);
|
||||
@@ -1353,21 +1398,21 @@ SoundFontSample* AudioLoad_GetFontSample(s32 fontId, s32 instId) {
|
||||
if (instrument == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
sample = instrument->normalNotesSound.sample;
|
||||
sample = instrument->normalPitchTunedSample.sample;
|
||||
} else if (instId < 0x100) {
|
||||
Drum* drum = AudioPlayback_GetDrum(fontId, instId - 0x80);
|
||||
|
||||
if (drum == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
sample = drum->sound.sample;
|
||||
sample = drum->tunedSample.sample;
|
||||
} else {
|
||||
SoundFontSound* sound = AudioPlayback_GetSfx(fontId, instId - 0x100);
|
||||
SoundEffect* soundEffect = AudioPlayback_GetSoundEffect(fontId, instId - 0x100);
|
||||
|
||||
if (sound == NULL) {
|
||||
if (soundEffect == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
sample = sound->sample;
|
||||
sample = soundEffect->tunedSample.sample;
|
||||
}
|
||||
|
||||
return sample;
|
||||
@@ -1377,7 +1422,7 @@ void AudioLoad_Unused2(void) {
|
||||
}
|
||||
|
||||
void AudioLoad_FinishSlowLoad(AudioSlowLoad* slowLoad) {
|
||||
SoundFontSample* sample;
|
||||
Sample* sample;
|
||||
|
||||
if (slowLoad->sample.sampleAddr == NULL) {
|
||||
return;
|
||||
@@ -1596,7 +1641,7 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
|
||||
OSMesg doneMsg;
|
||||
u32 sampleBankId1;
|
||||
u32 sampleBankId2;
|
||||
AudioRelocInfo relocInfo;
|
||||
SampleBankRelocInfo sampleBankReloc;
|
||||
|
||||
if (1) {}
|
||||
switch (ASYNC_TBLTYPE(retMsg)) {
|
||||
@@ -1608,16 +1653,16 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
|
||||
break;
|
||||
case FONT_TABLE:
|
||||
fontId = ASYNC_ID(retMsg);
|
||||
sampleBankId1 = gAudioContext.soundFonts[fontId].sampleBankId1;
|
||||
sampleBankId2 = gAudioContext.soundFonts[fontId].sampleBankId2;
|
||||
relocInfo.sampleBankId1 = sampleBankId1;
|
||||
relocInfo.sampleBankId2 = sampleBankId2;
|
||||
relocInfo.baseAddr1 =
|
||||
sampleBankId1 != 0xFF ? AudioLoad_GetSampleBank(sampleBankId1, &relocInfo.medium1) : 0;
|
||||
relocInfo.baseAddr2 =
|
||||
sampleBankId2 != 0xFF ? AudioLoad_GetSampleBank(sampleBankId2, &relocInfo.medium2) : 0;
|
||||
sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
|
||||
sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
|
||||
sampleBankReloc.sampleBankId1 = sampleBankId1;
|
||||
sampleBankReloc.sampleBankId2 = sampleBankId2;
|
||||
sampleBankReloc.baseAddr1 =
|
||||
(sampleBankId1 != 0xFF) ? AudioLoad_GetSampleBank(sampleBankId1, &sampleBankReloc.medium1) : 0;
|
||||
sampleBankReloc.baseAddr2 =
|
||||
(sampleBankId2 != 0xFF) ? AudioLoad_GetSampleBank(sampleBankId2, &sampleBankReloc.medium2) : 0;
|
||||
AudioLoad_SetFontLoadStatus(fontId, ASYNC_STATUS(retMsg));
|
||||
AudioLoad_RelocateFontAndPreloadSamples(fontId, asyncLoad->ramAddr, &relocInfo, true);
|
||||
AudioLoad_RelocateFontAndPreloadSamples(fontId, asyncLoad->ramAddr, &sampleBankReloc, true);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1700,28 +1745,48 @@ void AudioLoad_AsyncDmaRamUnloaded(AudioAsyncLoad* asyncLoad, size_t size) {
|
||||
void AudioLoad_AsyncDmaUnkMedium(uintptr_t devAddr, void* ramAddr, size_t size, s16 arg3) {
|
||||
}
|
||||
|
||||
#define RELOC(v, base) (reloc = (void*)((uintptr_t)(v) + (uintptr_t)(base)))
|
||||
|
||||
void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, AudioRelocInfo* relocInfo) {
|
||||
SoundFontSample* sample;
|
||||
/**
|
||||
* Read and extract information from TunedSample and its Sample
|
||||
* contained in the soundFont binary loaded into ram
|
||||
* TunedSample contains metadata on a sample used by a particular instrument/drum/sfx
|
||||
* Also relocate offsets into pointers within this loaded TunedSample
|
||||
*
|
||||
* @param fontId index of font being processed
|
||||
* @param fontData ram address of raw soundfont binary loaded into cache
|
||||
* @param sampleBankReloc information on the sampleBank containing raw audio samples
|
||||
*/
|
||||
void AudioLoad_RelocateSample(TunedSample* tunedSample, SoundFontData* fontData, SampleBankRelocInfo* sampleBankReloc) {
|
||||
Sample* sample;
|
||||
void* reloc;
|
||||
|
||||
if ((uintptr_t)sound->sample <= 0x80000000) {
|
||||
sample = sound->sample = RELOC(sound->sample, mem);
|
||||
if (sample->size != 0 && sample->unk_bit25 != true) {
|
||||
sample->loop = RELOC(sample->loop, mem);
|
||||
sample->book = RELOC(sample->book, mem);
|
||||
// Relocate an offset (relative to data loaded in ram at `base`) to a pointer (a ram address)
|
||||
#define AUDIO_RELOC(v, base) (reloc = (void*)((uintptr_t)(v) + (uintptr_t)(base)))
|
||||
|
||||
// Resolve the sample medium 2-bit bitfield into a real value based on relocInfo.
|
||||
if ((uintptr_t)tunedSample->sample <= AUDIO_RELOCATED_ADDRESS_START) {
|
||||
|
||||
sample = tunedSample->sample = AUDIO_RELOC(tunedSample->sample, fontData);
|
||||
|
||||
// If the sample exists and has not already been relocated
|
||||
// Note: this is important, as the same sample can be used by different drums, sound effects, instruments
|
||||
if ((sample->size != 0) && (sample->isRelocated != true)) {
|
||||
sample->loop = AUDIO_RELOC(sample->loop, fontData);
|
||||
sample->book = AUDIO_RELOC(sample->book, fontData);
|
||||
|
||||
// Resolve the sample medium 2-bit bitfield into a real value based on sampleBankReloc.
|
||||
// Then relocate the offset sample within the sampleBank (not the fontData) into absolute address.
|
||||
// sampleAddr can be either rom or ram depending on sampleBank cache policy
|
||||
// in practice, this is always in rom
|
||||
switch (sample->medium) {
|
||||
case 0:
|
||||
sample->sampleAddr = RELOC(sample->sampleAddr, relocInfo->baseAddr1);
|
||||
sample->medium = relocInfo->medium1;
|
||||
sample->sampleAddr = AUDIO_RELOC(sample->sampleAddr, sampleBankReloc->baseAddr1);
|
||||
sample->medium = sampleBankReloc->medium1;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
sample->sampleAddr = RELOC(sample->sampleAddr, relocInfo->baseAddr2);
|
||||
sample->medium = relocInfo->medium2;
|
||||
sample->sampleAddr = AUDIO_RELOC(sample->sampleAddr, sampleBankReloc->baseAddr2);
|
||||
sample->medium = sampleBankReloc->medium2;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
// Invalid? This leaves sample->medium as MEDIUM_CART and MEDIUM_DISK_DRIVE
|
||||
@@ -1729,7 +1794,8 @@ void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, AudioRe
|
||||
break;
|
||||
}
|
||||
|
||||
sample->unk_bit25 = true;
|
||||
sample->isRelocated = true;
|
||||
|
||||
if (sample->unk_bit26 && (sample->medium != MEDIUM_RAM)) {
|
||||
gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample;
|
||||
}
|
||||
@@ -1737,12 +1803,19 @@ void AudioLoad_RelocateSample(SoundFontSound* sound, SoundFontData* mem, AudioRe
|
||||
}
|
||||
}
|
||||
|
||||
#undef RELOC
|
||||
#undef AUDIO_RELOC
|
||||
|
||||
void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, AudioRelocInfo* relocInfo, s32 async) {
|
||||
/**
|
||||
* @param fontId index of font being processed
|
||||
* @param fontData ram address of raw soundfont binary loaded into cache
|
||||
* @param sampleBankReloc information on the sampleBank containing raw audio samples
|
||||
* @param isAsync bool for whether this is an asynchronous load or not
|
||||
*/
|
||||
void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* fontData, SampleBankRelocInfo* sampleBankReloc,
|
||||
s32 isAsync) {
|
||||
AudioPreloadReq* preload;
|
||||
AudioPreloadReq* topPreload;
|
||||
SoundFontSample* sample;
|
||||
Sample* sample;
|
||||
size_t size;
|
||||
s32 nChunks;
|
||||
u8* sampleRamAddr;
|
||||
@@ -1757,7 +1830,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Aud
|
||||
}
|
||||
|
||||
gAudioContext.numUsedSamples = 0;
|
||||
AudioLoad_RelocateFont(fontId, mem, relocInfo);
|
||||
AudioLoad_RelocateFont(fontId, fontData, sampleBankReloc);
|
||||
|
||||
size = 0;
|
||||
for (i = 0; i < gAudioContext.numUsedSamples; i++) {
|
||||
@@ -1772,13 +1845,13 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Aud
|
||||
|
||||
sample = gAudioContext.usedSamples[i];
|
||||
sampleRamAddr = NULL;
|
||||
switch (async) {
|
||||
switch (isAsync) {
|
||||
case false:
|
||||
if (sample->medium == relocInfo->medium1) {
|
||||
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId1,
|
||||
if (sample->medium == sampleBankReloc->medium1) {
|
||||
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId1,
|
||||
sample->sampleAddr, sample->medium, CACHE_PERSISTENT);
|
||||
} else if (sample->medium == relocInfo->medium2) {
|
||||
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId2,
|
||||
} else if (sample->medium == sampleBankReloc->medium2) {
|
||||
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId2,
|
||||
sample->sampleAddr, sample->medium, CACHE_PERSISTENT);
|
||||
} else if (sample->medium == MEDIUM_DISK_DRIVE) {
|
||||
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, 0xFE, sample->sampleAddr, sample->medium,
|
||||
@@ -1787,23 +1860,26 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Aud
|
||||
break;
|
||||
|
||||
case true:
|
||||
if (sample->medium == relocInfo->medium1) {
|
||||
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId1,
|
||||
if (sample->medium == sampleBankReloc->medium1) {
|
||||
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId1,
|
||||
sample->sampleAddr, sample->medium, CACHE_TEMPORARY);
|
||||
} else if (sample->medium == relocInfo->medium2) {
|
||||
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId2,
|
||||
} else if (sample->medium == sampleBankReloc->medium2) {
|
||||
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId2,
|
||||
sample->sampleAddr, sample->medium, CACHE_TEMPORARY);
|
||||
} else if (sample->medium == MEDIUM_DISK_DRIVE) {
|
||||
sampleRamAddr = AudioHeap_AllocSampleCache(sample->size, 0xFE, sample->sampleAddr, sample->medium,
|
||||
CACHE_TEMPORARY);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (sampleRamAddr == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (async) {
|
||||
switch (isAsync) {
|
||||
case false:
|
||||
if (sample->medium == MEDIUM_UNK) {
|
||||
AudioLoad_SyncDmaUnkMedium((uintptr_t)sample->sampleAddr, sampleRamAddr, sample->size,
|
||||
@@ -1827,6 +1903,9 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Aud
|
||||
preload->endAndMediumKey = (uintptr_t)sample->sampleAddr + sample->size + sample->medium;
|
||||
gAudioContext.preloadSampleStackTop++;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
gAudioContext.numUsedSamples = 0;
|
||||
@@ -1841,7 +1920,7 @@ void AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, SoundFontData* mem, Aud
|
||||
}
|
||||
|
||||
s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
|
||||
SoundFontSample* sample;
|
||||
Sample* sample;
|
||||
AudioPreloadReq* preload;
|
||||
u32 preloadIndex;
|
||||
u32 key;
|
||||
@@ -1902,7 +1981,7 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) {
|
||||
return true;
|
||||
}
|
||||
|
||||
s32 AudioLoad_AddToSampleSet(SoundFontSample* sample, s32 numSamples, SoundFontSample** sampleSet) {
|
||||
s32 AudioLoad_AddToSampleSet(Sample* sample, s32 numSamples, Sample** sampleSet) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < numSamples; i++) {
|
||||
@@ -1919,18 +1998,18 @@ s32 AudioLoad_AddToSampleSet(SoundFontSample* sample, s32 numSamples, SoundFontS
|
||||
return numSamples;
|
||||
}
|
||||
|
||||
s32 AudioLoad_GetSamplesForFont(s32 fontId, SoundFontSample** sampleSet) {
|
||||
s32 AudioLoad_GetSamplesForFont(s32 fontId, Sample** sampleSet) {
|
||||
s32 i;
|
||||
s32 numSamples = 0;
|
||||
s32 numDrums = gAudioContext.soundFonts[fontId].numDrums;
|
||||
s32 numInstruments = gAudioContext.soundFonts[fontId].numInstruments;
|
||||
s32 numDrums = gAudioContext.soundFontList[fontId].numDrums;
|
||||
s32 numInstruments = gAudioContext.soundFontList[fontId].numInstruments;
|
||||
|
||||
for (i = 0; i < numDrums; i++) {
|
||||
Drum* drum = AudioPlayback_GetDrum(fontId, i);
|
||||
|
||||
if (1) {}
|
||||
if (drum != NULL) {
|
||||
numSamples = AudioLoad_AddToSampleSet(drum->sound.sample, numSamples, sampleSet);
|
||||
numSamples = AudioLoad_AddToSampleSet(drum->tunedSample.sample, numSamples, sampleSet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1939,12 +2018,12 @@ s32 AudioLoad_GetSamplesForFont(s32 fontId, SoundFontSample** sampleSet) {
|
||||
|
||||
if (instrument != NULL) {
|
||||
if (instrument->normalRangeLo != 0) {
|
||||
numSamples = AudioLoad_AddToSampleSet(instrument->lowNotesSound.sample, numSamples, sampleSet);
|
||||
numSamples = AudioLoad_AddToSampleSet(instrument->lowPitchTunedSample.sample, numSamples, sampleSet);
|
||||
}
|
||||
if (instrument->normalRangeHi != 0x7F) {
|
||||
numSamples = AudioLoad_AddToSampleSet(instrument->highNotesSound.sample, numSamples, sampleSet);
|
||||
numSamples = AudioLoad_AddToSampleSet(instrument->highPitchTunedSample.sample, numSamples, sampleSet);
|
||||
}
|
||||
numSamples = AudioLoad_AddToSampleSet(instrument->normalNotesSound.sample, numSamples, sampleSet);
|
||||
numSamples = AudioLoad_AddToSampleSet(instrument->normalPitchTunedSample.sample, numSamples, sampleSet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1952,27 +2031,27 @@ s32 AudioLoad_GetSamplesForFont(s32 fontId, SoundFontSample** sampleSet) {
|
||||
return numSamples;
|
||||
}
|
||||
|
||||
void AudioLoad_AddUsedSample(SoundFontSound* sound) {
|
||||
SoundFontSample* sample = sound->sample;
|
||||
void AudioLoad_AddUsedSample(TunedSample* tunedSample) {
|
||||
Sample* sample = tunedSample->sample;
|
||||
|
||||
if ((sample->size != 0) && (sample->unk_bit26) && (sample->medium != MEDIUM_RAM)) {
|
||||
gAudioContext.usedSamples[gAudioContext.numUsedSamples++] = sample;
|
||||
}
|
||||
}
|
||||
|
||||
void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, AudioRelocInfo* relocInfo) {
|
||||
void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, SampleBankRelocInfo* sampleBankReloc) {
|
||||
s32 numDrums;
|
||||
s32 numInstruments;
|
||||
s32 numSfx;
|
||||
Drum* drum;
|
||||
Instrument* instrument;
|
||||
SoundFontSound* sound;
|
||||
SoundEffect* soundEffect;
|
||||
AudioPreloadReq* preload;
|
||||
AudioPreloadReq* topPreload;
|
||||
u8* addr;
|
||||
size_t size;
|
||||
s32 i;
|
||||
SoundFontSample* sample;
|
||||
Sample* sample;
|
||||
s32 preloadInProgress;
|
||||
s32 nChunks;
|
||||
|
||||
@@ -1983,34 +2062,34 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, AudioRelocInfo* relo
|
||||
|
||||
gAudioContext.numUsedSamples = 0;
|
||||
|
||||
numDrums = gAudioContext.soundFonts[fontId].numDrums;
|
||||
numInstruments = gAudioContext.soundFonts[fontId].numInstruments;
|
||||
numSfx = gAudioContext.soundFonts[fontId].numSfx;
|
||||
numDrums = gAudioContext.soundFontList[fontId].numDrums;
|
||||
numInstruments = gAudioContext.soundFontList[fontId].numInstruments;
|
||||
numSfx = gAudioContext.soundFontList[fontId].numSfx;
|
||||
|
||||
for (i = 0; i < numInstruments; i++) {
|
||||
instrument = AudioPlayback_GetInstrumentInner(fontId, i);
|
||||
if (instrument != NULL) {
|
||||
if (instrument->normalRangeLo != 0) {
|
||||
AudioLoad_AddUsedSample(&instrument->lowNotesSound);
|
||||
AudioLoad_AddUsedSample(&instrument->lowPitchTunedSample);
|
||||
}
|
||||
if (instrument->normalRangeHi != 0x7F) {
|
||||
AudioLoad_AddUsedSample(&instrument->highNotesSound);
|
||||
AudioLoad_AddUsedSample(&instrument->highPitchTunedSample);
|
||||
}
|
||||
AudioLoad_AddUsedSample(&instrument->normalNotesSound);
|
||||
AudioLoad_AddUsedSample(&instrument->normalPitchTunedSample);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < numDrums; i++) {
|
||||
drum = AudioPlayback_GetDrum(fontId, i);
|
||||
if (drum != NULL) {
|
||||
AudioLoad_AddUsedSample(&drum->sound);
|
||||
AudioLoad_AddUsedSample(&drum->tunedSample);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < numSfx; i++) {
|
||||
sound = AudioPlayback_GetSfx(fontId, i);
|
||||
if (sound != NULL) {
|
||||
AudioLoad_AddUsedSample(sound);
|
||||
soundEffect = AudioPlayback_GetSoundEffect(fontId, i);
|
||||
if (soundEffect != NULL) {
|
||||
AudioLoad_AddUsedSample(&soundEffect->tunedSample);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2036,21 +2115,21 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, AudioRelocInfo* relo
|
||||
|
||||
switch (async) {
|
||||
case false:
|
||||
if (sample->medium == relocInfo->medium1) {
|
||||
addr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId1, sample->sampleAddr,
|
||||
if (sample->medium == sampleBankReloc->medium1) {
|
||||
addr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId1, sample->sampleAddr,
|
||||
sample->medium, CACHE_PERSISTENT);
|
||||
} else if (sample->medium == relocInfo->medium2) {
|
||||
addr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId2, sample->sampleAddr,
|
||||
} else if (sample->medium == sampleBankReloc->medium2) {
|
||||
addr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId2, sample->sampleAddr,
|
||||
sample->medium, CACHE_PERSISTENT);
|
||||
}
|
||||
break;
|
||||
|
||||
case true:
|
||||
if (sample->medium == relocInfo->medium1) {
|
||||
addr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId1, sample->sampleAddr,
|
||||
if (sample->medium == sampleBankReloc->medium1) {
|
||||
addr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId1, sample->sampleAddr,
|
||||
sample->medium, CACHE_TEMPORARY);
|
||||
} else if (sample->medium == relocInfo->medium2) {
|
||||
addr = AudioHeap_AllocSampleCache(sample->size, relocInfo->sampleBankId2, sample->sampleAddr,
|
||||
} else if (sample->medium == sampleBankReloc->medium2) {
|
||||
addr = AudioHeap_AllocSampleCache(sample->size, sampleBankReloc->sampleBankId2, sample->sampleAddr,
|
||||
sample->medium, CACHE_TEMPORARY);
|
||||
}
|
||||
break;
|
||||
@@ -2104,23 +2183,25 @@ void AudioLoad_LoadPermanentSamples(void) {
|
||||
|
||||
sampleBankTable = AudioLoad_GetLoadTable(SAMPLE_TABLE);
|
||||
for (i = 0; i < gAudioContext.permanentPool.count; i++) {
|
||||
AudioRelocInfo relocInfo;
|
||||
SampleBankRelocInfo sampleBankReloc;
|
||||
|
||||
if (gAudioContext.permanentEntries[i].tableType == FONT_TABLE) {
|
||||
fontId = AudioLoad_GetRealTableIndex(FONT_TABLE, gAudioContext.permanentEntries[i].id);
|
||||
relocInfo.sampleBankId1 = gAudioContext.soundFonts[fontId].sampleBankId1;
|
||||
relocInfo.sampleBankId2 = gAudioContext.soundFonts[fontId].sampleBankId2;
|
||||
sampleBankReloc.sampleBankId1 = gAudioContext.soundFontList[fontId].sampleBankId1;
|
||||
sampleBankReloc.sampleBankId2 = gAudioContext.soundFontList[fontId].sampleBankId2;
|
||||
|
||||
if (relocInfo.sampleBankId1 != 0xFF) {
|
||||
relocInfo.sampleBankId1 = AudioLoad_GetRealTableIndex(SAMPLE_TABLE, relocInfo.sampleBankId1);
|
||||
relocInfo.medium1 = sampleBankTable->entries[relocInfo.sampleBankId1].medium;
|
||||
if (sampleBankReloc.sampleBankId1 != 0xFF) {
|
||||
sampleBankReloc.sampleBankId1 =
|
||||
AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankReloc.sampleBankId1);
|
||||
sampleBankReloc.medium1 = sampleBankTable->entries[sampleBankReloc.sampleBankId1].medium;
|
||||
}
|
||||
|
||||
if (relocInfo.sampleBankId2 != 0xFF) {
|
||||
relocInfo.sampleBankId2 = AudioLoad_GetRealTableIndex(SAMPLE_TABLE, relocInfo.sampleBankId2);
|
||||
relocInfo.medium2 = sampleBankTable->entries[relocInfo.sampleBankId2].medium;
|
||||
if (sampleBankReloc.sampleBankId2 != 0xFF) {
|
||||
sampleBankReloc.sampleBankId2 =
|
||||
AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankReloc.sampleBankId2);
|
||||
sampleBankReloc.medium2 = sampleBankTable->entries[sampleBankReloc.sampleBankId2].medium;
|
||||
}
|
||||
AudioLoad_PreloadSamplesForFont(fontId, false, &relocInfo);
|
||||
AudioLoad_PreloadSamplesForFont(fontId, false, &sampleBankReloc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+156
-136
@@ -4,9 +4,10 @@ void AudioPlayback_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRat
|
||||
void AudioPlayback_AudioListPushFront(AudioListItem* list, AudioListItem* item);
|
||||
void AudioPlayback_NoteInitForLayer(Note* note, SequenceLayer* layer);
|
||||
|
||||
void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) {
|
||||
f32 volRight, volLeft;
|
||||
s32 smallPanIndex;
|
||||
void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* noteSubEu, NoteSubAttributes* subAttrs) {
|
||||
f32 volLeft;
|
||||
f32 volRight;
|
||||
s32 halfPanIndex;
|
||||
u64 pad;
|
||||
u8 strongLeft;
|
||||
u8 strongRight;
|
||||
@@ -16,41 +17,41 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* at
|
||||
StereoData stereoData;
|
||||
s32 stereoHeadsetEffects = note->playbackState.stereoHeadsetEffects;
|
||||
|
||||
vel = attrs->velocity;
|
||||
pan = attrs->pan;
|
||||
reverbVol = attrs->reverbVol;
|
||||
stereoData = attrs->stereo.s;
|
||||
vel = subAttrs->velocity;
|
||||
pan = subAttrs->pan;
|
||||
reverbVol = subAttrs->reverbVol;
|
||||
stereoData = subAttrs->stereo.s;
|
||||
|
||||
sub->bitField0 = note->noteSubEu.bitField0;
|
||||
sub->bitField1 = note->noteSubEu.bitField1;
|
||||
sub->sound.samples = note->noteSubEu.sound.samples;
|
||||
sub->unk_06 = note->noteSubEu.unk_06;
|
||||
noteSubEu->bitField0 = note->noteSubEu.bitField0;
|
||||
noteSubEu->bitField1 = note->noteSubEu.bitField1;
|
||||
noteSubEu->waveSampleAddr = note->noteSubEu.waveSampleAddr;
|
||||
noteSubEu->harmonicIndexCurAndPrev = note->noteSubEu.harmonicIndexCurAndPrev;
|
||||
|
||||
AudioPlayback_NoteSetResamplingRate(sub, attrs->frequency);
|
||||
AudioPlayback_NoteSetResamplingRate(noteSubEu, subAttrs->frequency);
|
||||
|
||||
pan &= 0x7F;
|
||||
|
||||
sub->bitField0.stereoStrongRight = false;
|
||||
sub->bitField0.stereoStrongLeft = false;
|
||||
sub->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects;
|
||||
sub->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects;
|
||||
if (stereoHeadsetEffects && gAudioContext.soundMode == SOUNDMODE_HEADSET) {
|
||||
smallPanIndex = pan >> 1;
|
||||
if (smallPanIndex > 0x3F) {
|
||||
smallPanIndex = 0x3F;
|
||||
noteSubEu->bitField0.stereoStrongRight = false;
|
||||
noteSubEu->bitField0.stereoStrongLeft = false;
|
||||
noteSubEu->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects;
|
||||
noteSubEu->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects;
|
||||
if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_HEADSET)) {
|
||||
halfPanIndex = pan >> 1;
|
||||
if (halfPanIndex > 0x3F) {
|
||||
halfPanIndex = 0x3F;
|
||||
}
|
||||
|
||||
sub->headsetPanLeft = gHeadsetPanQuantization[smallPanIndex];
|
||||
sub->headsetPanRight = gHeadsetPanQuantization[0x3F - smallPanIndex];
|
||||
sub->bitField1.usesHeadsetPanEffects2 = true;
|
||||
noteSubEu->headsetPanLeft = gHeadsetPanQuantization[halfPanIndex];
|
||||
noteSubEu->headsetPanRight = gHeadsetPanQuantization[0x3F - halfPanIndex];
|
||||
noteSubEu->bitField1.usesHeadsetPanEffects2 = true;
|
||||
|
||||
volLeft = gHeadsetPanVolume[pan];
|
||||
volRight = gHeadsetPanVolume[0x7F - pan];
|
||||
} else if (stereoHeadsetEffects && gAudioContext.soundMode == SOUNDMODE_STEREO) {
|
||||
} else if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_STEREO)) {
|
||||
strongLeft = strongRight = false;
|
||||
sub->headsetPanRight = 0;
|
||||
sub->headsetPanLeft = 0;
|
||||
sub->bitField1.usesHeadsetPanEffects2 = false;
|
||||
noteSubEu->headsetPanRight = 0;
|
||||
noteSubEu->headsetPanLeft = 0;
|
||||
noteSubEu->bitField1.usesHeadsetPanEffects2 = false;
|
||||
|
||||
volLeft = gStereoPanVolume[pan];
|
||||
volRight = gStereoPanVolume[0x7F - pan];
|
||||
@@ -60,34 +61,38 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* at
|
||||
strongRight = true;
|
||||
}
|
||||
|
||||
sub->bitField0.stereoStrongRight = strongRight;
|
||||
sub->bitField0.stereoStrongLeft = strongLeft;
|
||||
// case 0:
|
||||
noteSubEu->bitField0.stereoStrongRight = strongRight;
|
||||
noteSubEu->bitField0.stereoStrongLeft = strongLeft;
|
||||
|
||||
switch (stereoData.bit2) {
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
sub->bitField0.stereoStrongRight = stereoData.strongRight;
|
||||
sub->bitField0.stereoStrongLeft = stereoData.strongLeft;
|
||||
noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight;
|
||||
noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
sub->bitField0.stereoStrongRight = stereoData.strongRight | strongRight;
|
||||
sub->bitField0.stereoStrongLeft = stereoData.strongLeft | strongLeft;
|
||||
noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight | strongRight;
|
||||
noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft | strongLeft;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
sub->bitField0.stereoStrongRight = stereoData.strongRight ^ strongRight;
|
||||
sub->bitField0.stereoStrongLeft = stereoData.strongLeft ^ strongLeft;
|
||||
noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight ^ strongRight;
|
||||
noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft ^ strongLeft;
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (gAudioContext.soundMode == SOUNDMODE_MONO) {
|
||||
sub->bitField0.stereoHeadsetEffects = false;
|
||||
sub->bitField0.usesHeadsetPanEffects = false;
|
||||
noteSubEu->bitField0.stereoHeadsetEffects = false;
|
||||
noteSubEu->bitField0.usesHeadsetPanEffects = false;
|
||||
volLeft = 0.707f; // approx 1/sqrt(2)
|
||||
volRight = 0.707f;
|
||||
} else {
|
||||
sub->bitField0.stereoStrongRight = stereoData.strongRight;
|
||||
sub->bitField0.stereoStrongLeft = stereoData.strongLeft;
|
||||
noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight;
|
||||
noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft;
|
||||
volLeft = gDefaultPanVolume[pan];
|
||||
volRight = gDefaultPanVolume[0x7F - pan];
|
||||
}
|
||||
@@ -95,15 +100,15 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* at
|
||||
vel = 0.0f > vel ? 0.0f : vel;
|
||||
vel = 1.0f < vel ? 1.0f : vel;
|
||||
|
||||
sub->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f));
|
||||
sub->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f));
|
||||
noteSubEu->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f));
|
||||
noteSubEu->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f));
|
||||
|
||||
sub->gain = attrs->gain;
|
||||
sub->filter = attrs->filter;
|
||||
sub->unk_07 = attrs->unk_14;
|
||||
sub->unk_0E = attrs->unk_16;
|
||||
sub->reverbVol = reverbVol;
|
||||
sub->unk_19 = attrs->unk_3;
|
||||
noteSubEu->gain = subAttrs->gain;
|
||||
noteSubEu->filter = subAttrs->filter;
|
||||
noteSubEu->unk_07 = subAttrs->unk_14;
|
||||
noteSubEu->unk_0E = subAttrs->unk_16;
|
||||
noteSubEu->reverbVol = reverbVol;
|
||||
noteSubEu->unk_19 = subAttrs->unk_3;
|
||||
}
|
||||
|
||||
void AudioPlayback_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput) {
|
||||
@@ -133,7 +138,7 @@ void AudioPlayback_NoteInit(Note* note) {
|
||||
¬e->playbackState.adsrVolScaleUnused);
|
||||
}
|
||||
|
||||
note->playbackState.unk_04 = 0;
|
||||
note->playbackState.status = PLAYBACK_STATUS_0;
|
||||
note->playbackState.adsr.action.s.state = ADSR_STATE_INITIAL;
|
||||
note->noteSubEu = gDefaultNoteSub;
|
||||
}
|
||||
@@ -144,7 +149,7 @@ void AudioPlayback_NoteDisable(Note* note) {
|
||||
}
|
||||
note->playbackState.priority = 0;
|
||||
note->noteSubEu.bitField0.enabled = false;
|
||||
note->playbackState.unk_04 = 0;
|
||||
note->playbackState.status = PLAYBACK_STATUS_0;
|
||||
note->noteSubEu.bitField0.finished = false;
|
||||
note->playbackState.parentLayer = NO_LAYER;
|
||||
note->playbackState.prevParentLayer = NO_LAYER;
|
||||
@@ -154,7 +159,7 @@ void AudioPlayback_NoteDisable(Note* note) {
|
||||
|
||||
void AudioPlayback_ProcessNotes(void) {
|
||||
s32 pad;
|
||||
s32 unk_04;
|
||||
s32 playbackStatus;
|
||||
NoteAttributes* attrs;
|
||||
NoteSubEu* noteSubEu2;
|
||||
NoteSubEu* noteSubEu;
|
||||
@@ -174,19 +179,19 @@ void AudioPlayback_ProcessNotes(void) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (note != playbackState->parentLayer->note && playbackState->unk_04 == 0) {
|
||||
if ((note != playbackState->parentLayer->note) && (playbackState->status == PLAYBACK_STATUS_0)) {
|
||||
playbackState->adsr.action.s.release = true;
|
||||
playbackState->adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
playbackState->priority = 1;
|
||||
playbackState->unk_04 = 2;
|
||||
playbackState->status = PLAYBACK_STATUS_2;
|
||||
goto out;
|
||||
} else if (!playbackState->parentLayer->enabled && playbackState->unk_04 == 0 &&
|
||||
playbackState->priority >= 1) {
|
||||
} else if (!playbackState->parentLayer->enabled && (playbackState->status == PLAYBACK_STATUS_0) &&
|
||||
(playbackState->priority >= 1)) {
|
||||
// do nothing
|
||||
} else if (playbackState->parentLayer->channel->seqPlayer == NULL) {
|
||||
AudioSeq_SequenceChannelDisable(playbackState->parentLayer->channel);
|
||||
playbackState->priority = 1;
|
||||
playbackState->unk_04 = 1;
|
||||
playbackState->status = PLAYBACK_STATUS_1;
|
||||
continue;
|
||||
} else if (playbackState->parentLayer->channel->seqPlayer->muted &&
|
||||
(playbackState->parentLayer->channel->muteFlags & MUTE_FLAGS_STOP_NOTES)) {
|
||||
@@ -199,8 +204,8 @@ void AudioPlayback_ProcessNotes(void) {
|
||||
AudioPlayback_AudioListRemove(¬e->listItem);
|
||||
AudioPlayback_AudioListPushFront(¬e->listItem.pool->decaying, ¬e->listItem);
|
||||
playbackState->priority = 1;
|
||||
playbackState->unk_04 = 2;
|
||||
} else if (playbackState->unk_04 == 0 && playbackState->priority >= 1) {
|
||||
playbackState->status = PLAYBACK_STATUS_2;
|
||||
} else if ((playbackState->status == PLAYBACK_STATUS_0) && (playbackState->priority >= 1)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -208,8 +213,8 @@ void AudioPlayback_ProcessNotes(void) {
|
||||
if (playbackState->priority != 0) {
|
||||
if (1) {}
|
||||
noteSubEu = ¬e->noteSubEu;
|
||||
if (playbackState->unk_04 >= 1 || noteSubEu->bitField0.finished) {
|
||||
if (playbackState->adsr.action.s.state == ADSR_STATE_DISABLED || noteSubEu->bitField0.finished) {
|
||||
if ((playbackState->status >= 1) || noteSubEu->bitField0.finished) {
|
||||
if ((playbackState->adsr.action.s.state == ADSR_STATE_DISABLED) || noteSubEu->bitField0.finished) {
|
||||
if (playbackState->wantedParentLayer != NO_LAYER) {
|
||||
AudioPlayback_NoteDisable(note);
|
||||
if (playbackState->wantedParentLayer->channel != NULL) {
|
||||
@@ -249,9 +254,9 @@ void AudioPlayback_ProcessNotes(void) {
|
||||
|
||||
scale = AudioEffects_AdsrUpdate(&playbackState->adsr);
|
||||
AudioEffects_NoteVibratoUpdate(note);
|
||||
unk_04 = playbackState->unk_04;
|
||||
playbackStatus = playbackState->status;
|
||||
attrs = &playbackState->attributes;
|
||||
if (unk_04 == 1 || unk_04 == 2) {
|
||||
if ((playbackStatus == PLAYBACK_STATUS_1) || (playbackStatus == PLAYBACK_STATUS_2)) {
|
||||
subAttrs.frequency = attrs->freqScale;
|
||||
subAttrs.velocity = attrs->velocity;
|
||||
subAttrs.pan = attrs->pan;
|
||||
@@ -317,17 +322,18 @@ void AudioPlayback_ProcessNotes(void) {
|
||||
}
|
||||
}
|
||||
|
||||
SoundFontSound* AudioPlayback_InstrumentGetSound(Instrument* instrument, s32 semitone) {
|
||||
SoundFontSound* sound;
|
||||
TunedSample* AudioPlayback_GetInstrumentTunedSample(Instrument* instrument, s32 semitone) {
|
||||
TunedSample* tunedSample;
|
||||
|
||||
if (semitone < instrument->normalRangeLo) {
|
||||
sound = &instrument->lowNotesSound;
|
||||
tunedSample = &instrument->lowPitchTunedSample;
|
||||
} else if (semitone <= instrument->normalRangeHi) {
|
||||
sound = &instrument->normalNotesSound;
|
||||
tunedSample = &instrument->normalPitchTunedSample;
|
||||
} else {
|
||||
sound = &instrument->highNotesSound;
|
||||
tunedSample = &instrument->highPitchTunedSample;
|
||||
}
|
||||
return sound;
|
||||
|
||||
return tunedSample;
|
||||
}
|
||||
|
||||
Instrument* AudioPlayback_GetInstrumentInner(s32 fontId, s32 instId) {
|
||||
@@ -338,18 +344,18 @@ Instrument* AudioPlayback_GetInstrumentInner(s32 fontId, s32 instId) {
|
||||
}
|
||||
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId)) {
|
||||
gAudioContext.audioErrorFlags = fontId + 0x10000000;
|
||||
gAudioContext.audioErrorFlags = AUDIO_ERROR(0, fontId, AUDIO_ERROR_FONT_NOT_LOADED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (instId >= gAudioContext.soundFonts[fontId].numInstruments) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x3000000;
|
||||
if (instId >= gAudioContext.soundFontList[fontId].numInstruments) {
|
||||
gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, instId, AUDIO_ERROR_INVALID_INST_ID);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
inst = gAudioContext.soundFonts[fontId].instruments[instId];
|
||||
inst = gAudioContext.soundFontList[fontId].instruments[instId];
|
||||
if (inst == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + instId) + 0x1000000;
|
||||
gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, instId, AUDIO_ERROR_NO_INST);
|
||||
return inst;
|
||||
}
|
||||
|
||||
@@ -364,58 +370,58 @@ Drum* AudioPlayback_GetDrum(s32 fontId, s32 drumId) {
|
||||
}
|
||||
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId)) {
|
||||
gAudioContext.audioErrorFlags = fontId + 0x10000000;
|
||||
gAudioContext.audioErrorFlags = AUDIO_ERROR(0, fontId, AUDIO_ERROR_FONT_NOT_LOADED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (drumId >= gAudioContext.soundFonts[fontId].numDrums) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x4000000;
|
||||
if (drumId >= gAudioContext.soundFontList[fontId].numDrums) {
|
||||
gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, drumId, AUDIO_ERROR_INVALID_DRUM_SFX_ID);
|
||||
return NULL;
|
||||
}
|
||||
if ((u32)gAudioContext.soundFonts[fontId].drums < 0x80000000) {
|
||||
if ((u32)gAudioContext.soundFontList[fontId].drums < AUDIO_RELOCATED_ADDRESS_START) {
|
||||
return NULL;
|
||||
}
|
||||
drum = gAudioContext.soundFonts[fontId].drums[drumId];
|
||||
drum = gAudioContext.soundFontList[fontId].drums[drumId];
|
||||
|
||||
if (drum == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + drumId) + 0x5000000;
|
||||
gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, drumId, AUDIO_ERROR_NO_DRUM_SFX);
|
||||
}
|
||||
|
||||
return drum;
|
||||
}
|
||||
|
||||
SoundFontSound* AudioPlayback_GetSfx(s32 fontId, s32 sfxId) {
|
||||
SoundFontSound* sfx;
|
||||
SoundEffect* AudioPlayback_GetSoundEffect(s32 fontId, s32 sfxId) {
|
||||
SoundEffect* soundEffect;
|
||||
|
||||
if (fontId == 0xFF) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!AudioLoad_IsFontLoadComplete(fontId)) {
|
||||
gAudioContext.audioErrorFlags = fontId + 0x10000000;
|
||||
gAudioContext.audioErrorFlags = AUDIO_ERROR(0, fontId, AUDIO_ERROR_FONT_NOT_LOADED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (sfxId >= gAudioContext.soundFonts[fontId].numSfx) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x4000000;
|
||||
if (sfxId >= gAudioContext.soundFontList[fontId].numSfx) {
|
||||
gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, sfxId, AUDIO_ERROR_INVALID_DRUM_SFX_ID);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((u32)gAudioContext.soundFonts[fontId].soundEffects < 0x80000000) {
|
||||
if ((u32)gAudioContext.soundFontList[fontId].soundEffects < AUDIO_RELOCATED_ADDRESS_START) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sfx = &gAudioContext.soundFonts[fontId].soundEffects[sfxId];
|
||||
soundEffect = &gAudioContext.soundFontList[fontId].soundEffects[sfxId];
|
||||
|
||||
if (sfx == NULL) {
|
||||
gAudioContext.audioErrorFlags = ((fontId << 8) + sfxId) + 0x5000000;
|
||||
if (soundEffect == NULL) {
|
||||
gAudioContext.audioErrorFlags = AUDIO_ERROR(fontId, sfxId, AUDIO_ERROR_NO_DRUM_SFX);
|
||||
}
|
||||
|
||||
if (sfx->sample == NULL) {
|
||||
if (soundEffect->tunedSample.sample == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sfx;
|
||||
return soundEffect;
|
||||
}
|
||||
|
||||
s32 AudioPlayback_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, void* value) {
|
||||
@@ -429,24 +435,24 @@ s32 AudioPlayback_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, v
|
||||
|
||||
switch (instrumentType) {
|
||||
case 0:
|
||||
if (index >= gAudioContext.soundFonts[fontId].numDrums) {
|
||||
if (index >= gAudioContext.soundFontList[fontId].numDrums) {
|
||||
return -3;
|
||||
}
|
||||
gAudioContext.soundFonts[fontId].drums[index] = value;
|
||||
gAudioContext.soundFontList[fontId].drums[index] = value;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (index >= gAudioContext.soundFonts[fontId].numSfx) {
|
||||
if (index >= gAudioContext.soundFontList[fontId].numSfx) {
|
||||
return -3;
|
||||
}
|
||||
gAudioContext.soundFonts[fontId].soundEffects[index] = *(SoundFontSound*)value;
|
||||
gAudioContext.soundFontList[fontId].soundEffects[index] = *(SoundEffect*)value;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (index >= gAudioContext.soundFonts[fontId].numInstruments) {
|
||||
if (index >= gAudioContext.soundFontList[fontId].numInstruments) {
|
||||
return -3;
|
||||
}
|
||||
gAudioContext.soundFonts[fontId].instruments[index] = value;
|
||||
gAudioContext.soundFontList[fontId].instruments[index] = value;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -456,7 +462,7 @@ s32 AudioPlayback_SetFontInstrument(s32 instrumentType, s32 fontId, s32 index, v
|
||||
void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
|
||||
Note* note;
|
||||
NoteAttributes* attrs;
|
||||
SequenceChannel* chan;
|
||||
SequenceChannel* channel;
|
||||
s32 i;
|
||||
|
||||
if (layer == NO_LAYER) {
|
||||
@@ -491,27 +497,27 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
|
||||
attrs->pan = layer->notePan;
|
||||
|
||||
if (layer->channel != NULL) {
|
||||
chan = layer->channel;
|
||||
channel = layer->channel;
|
||||
|
||||
if (layer->unk_0A.s.bit_2 == 1) {
|
||||
attrs->reverb = chan->reverb;
|
||||
attrs->reverb = channel->reverb;
|
||||
} else {
|
||||
attrs->reverb = layer->unk_09;
|
||||
}
|
||||
|
||||
if (layer->unk_08 == 0x80) {
|
||||
attrs->unk_3 = chan->unk_10;
|
||||
attrs->unk_3 = channel->unk_10;
|
||||
} else {
|
||||
attrs->unk_3 = layer->unk_08;
|
||||
}
|
||||
|
||||
if (layer->unk_0A.s.bit_9 == 1) {
|
||||
attrs->gain = chan->gain;
|
||||
attrs->gain = channel->gain;
|
||||
} else {
|
||||
attrs->gain = 0;
|
||||
}
|
||||
|
||||
attrs->filter = chan->filter;
|
||||
attrs->filter = channel->filter;
|
||||
|
||||
if (attrs->filter != NULL) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
@@ -520,18 +526,18 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
|
||||
attrs->filter = attrs->filterBuf;
|
||||
}
|
||||
|
||||
attrs->unk_6 = chan->unk_20;
|
||||
attrs->unk_4 = chan->unk_0F;
|
||||
if (chan->seqPlayer->muted && (chan->muteFlags & MUTE_FLAGS_3)) {
|
||||
attrs->unk_6 = channel->unk_20;
|
||||
attrs->unk_4 = channel->unk_0F;
|
||||
if (channel->seqPlayer->muted && (channel->muteFlags & MUTE_FLAGS_3)) {
|
||||
note->noteSubEu.bitField0.finished = true;
|
||||
}
|
||||
|
||||
if (layer->stereo.asByte == 0) {
|
||||
attrs->stereo = chan->stereo;
|
||||
attrs->stereo = channel->stereo;
|
||||
} else {
|
||||
attrs->stereo = layer->stereo;
|
||||
}
|
||||
note->playbackState.priority = chan->someOtherPriority;
|
||||
note->playbackState.priority = channel->someOtherPriority;
|
||||
} else {
|
||||
attrs->stereo = layer->stereo;
|
||||
note->playbackState.priority = 1;
|
||||
@@ -542,9 +548,9 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
|
||||
if (target == ADSR_STATE_RELEASE) {
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
note->playbackState.adsr.action.s.release = true;
|
||||
note->playbackState.unk_04 = 2;
|
||||
note->playbackState.status = PLAYBACK_STATUS_2;
|
||||
} else {
|
||||
note->playbackState.unk_04 = 1;
|
||||
note->playbackState.status = PLAYBACK_STATUS_1;
|
||||
note->playbackState.adsr.action.s.decay = true;
|
||||
if (layer->adsr.decayIndex == 0) {
|
||||
note->playbackState.adsr.fadeOutVel = gAudioContext.adsrDecayTable[layer->channel->adsr.decayIndex];
|
||||
@@ -570,10 +576,18 @@ void AudioPlayback_SeqLayerNoteRelease(SequenceLayer* layer) {
|
||||
AudioPlayback_SeqLayerDecayRelease(layer, ADSR_STATE_RELEASE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the synthetic wave to use from gWaveSamples and update corresponding frequencies
|
||||
*
|
||||
* @param note
|
||||
* @param layer
|
||||
* @param waveId the index of the type of synthetic wave to use, offset by 128
|
||||
* @return harmonicIndex, the index of the harmonic for the synthetic wave contained in gWaveSamples
|
||||
*/
|
||||
s32 AudioPlayback_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveId) {
|
||||
f32 freqScale;
|
||||
f32 ratio;
|
||||
u8 sampleCountIndex;
|
||||
f32 freqRatio;
|
||||
u8 harmonicIndex;
|
||||
|
||||
if (waveId < 128) {
|
||||
waveId = 128;
|
||||
@@ -583,42 +597,48 @@ s32 AudioPlayback_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveI
|
||||
if (layer->portamento.mode != 0 && 0.0f < layer->portamento.extent) {
|
||||
freqScale *= (layer->portamento.extent + 1.0f);
|
||||
}
|
||||
|
||||
// Map frequency to the harmonic to use from gWaveSamples
|
||||
if (freqScale < 0.99999f) {
|
||||
sampleCountIndex = 0;
|
||||
ratio = 1.0465f;
|
||||
harmonicIndex = 0;
|
||||
freqRatio = 1.0465f;
|
||||
} else if (freqScale < 1.99999f) {
|
||||
sampleCountIndex = 1;
|
||||
ratio = 0.52325f;
|
||||
harmonicIndex = 1;
|
||||
freqRatio = 1.0465f / 2;
|
||||
} else if (freqScale < 3.99999f) {
|
||||
sampleCountIndex = 2;
|
||||
ratio = 0.26263f;
|
||||
harmonicIndex = 2;
|
||||
freqRatio = 1.0465f / 4 + 1.005E-3;
|
||||
} else {
|
||||
sampleCountIndex = 3;
|
||||
ratio = 0.13081f;
|
||||
harmonicIndex = 3;
|
||||
freqRatio = 1.0465f / 8 - 2.5E-6;
|
||||
}
|
||||
layer->freqScale *= ratio;
|
||||
|
||||
// Update results
|
||||
layer->freqScale *= freqRatio;
|
||||
note->playbackState.waveId = waveId;
|
||||
note->playbackState.sampleCountIndex = sampleCountIndex;
|
||||
note->playbackState.harmonicIndex = harmonicIndex;
|
||||
|
||||
note->noteSubEu.sound.samples = &gWaveSamples[waveId - 128][sampleCountIndex * 64];
|
||||
// Save the pointer to the synthethic wave
|
||||
// waveId index starts at 128, there are WAVE_SAMPLE_COUNT samples to read from
|
||||
note->noteSubEu.waveSampleAddr = &gWaveSamples[waveId - 128][harmonicIndex * WAVE_SAMPLE_COUNT];
|
||||
|
||||
return sampleCountIndex;
|
||||
return harmonicIndex;
|
||||
}
|
||||
|
||||
void AudioPlayback_InitSyntheticWave(Note* note, SequenceLayer* layer) {
|
||||
s32 sampleCountIndex;
|
||||
s32 waveSampleCountIndex;
|
||||
s32 prevHarmonicIndex;
|
||||
s32 curHarmonicIndex;
|
||||
s32 waveId = layer->instOrWave;
|
||||
|
||||
if (waveId == 0xFF) {
|
||||
waveId = layer->channel->instOrWave;
|
||||
}
|
||||
|
||||
sampleCountIndex = note->playbackState.sampleCountIndex;
|
||||
waveSampleCountIndex = AudioPlayback_BuildSyntheticWave(note, layer, waveId);
|
||||
prevHarmonicIndex = note->playbackState.harmonicIndex;
|
||||
curHarmonicIndex = AudioPlayback_BuildSyntheticWave(note, layer, waveId);
|
||||
|
||||
if (waveSampleCountIndex != sampleCountIndex) {
|
||||
note->noteSubEu.unk_06 = waveSampleCountIndex * 4 + sampleCountIndex;
|
||||
if (curHarmonicIndex != prevHarmonicIndex) {
|
||||
note->noteSubEu.harmonicIndexCurAndPrev = (curHarmonicIndex << 2) + prevHarmonicIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -805,7 +825,7 @@ void AudioPlayback_NoteInitForLayer(Note* note, SequenceLayer* layer) {
|
||||
if (instId == 0xFF) {
|
||||
instId = channel->instOrWave;
|
||||
}
|
||||
noteSubEu->sound.soundFontSound = layer->sound;
|
||||
noteSubEu->tunedSample = layer->tunedSample;
|
||||
|
||||
if (instId >= 0x80 && instId < 0xC0) {
|
||||
noteSubEu->bitField1.isSyntheticWave = true;
|
||||
@@ -815,12 +835,12 @@ void AudioPlayback_NoteInitForLayer(Note* note, SequenceLayer* layer) {
|
||||
|
||||
if (noteSubEu->bitField1.isSyntheticWave) {
|
||||
AudioPlayback_BuildSyntheticWave(note, layer, instId);
|
||||
} else if (channel->unk_DC == 1) {
|
||||
playbackState->unk_84 = noteSubEu->sound.soundFontSound->sample->loop->start;
|
||||
} else if (channel->startSamplePos == 1) {
|
||||
playbackState->startSamplePos = noteSubEu->tunedSample->sample->loop->start;
|
||||
} else {
|
||||
playbackState->unk_84 = channel->unk_DC;
|
||||
if (playbackState->unk_84 >= noteSubEu->sound.soundFontSound->sample->loop->end) {
|
||||
playbackState->unk_84 = 0;
|
||||
playbackState->startSamplePos = channel->startSamplePos;
|
||||
if (playbackState->startSamplePos >= noteSubEu->tunedSample->sample->loop->end) {
|
||||
playbackState->startSamplePos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,7 +989,7 @@ void AudioPlayback_NoteInitAll(void) {
|
||||
note = &gAudioContext.notes[i];
|
||||
note->noteSubEu = gZeroNoteSub;
|
||||
note->playbackState.priority = 0;
|
||||
note->playbackState.unk_04 = 0;
|
||||
note->playbackState.status = PLAYBACK_STATUS_0;
|
||||
note->playbackState.parentLayer = NO_LAYER;
|
||||
note->playbackState.wantedParentLayer = NO_LAYER;
|
||||
note->playbackState.prevParentLayer = NO_LAYER;
|
||||
@@ -981,7 +1001,7 @@ void AudioPlayback_NoteInitAll(void) {
|
||||
note->playbackState.portamento.cur = 0;
|
||||
note->playbackState.portamento.speed = 0;
|
||||
note->playbackState.stereoHeadsetEffects = false;
|
||||
note->playbackState.unk_84 = 0;
|
||||
note->playbackState.startSamplePos = 0;
|
||||
note->synthesisState.synthesisBuffers = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x2E0);
|
||||
note->playbackState.attributes.filterBuf = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x10);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ u8 AudioSeq_ScriptReadU8(SeqScriptState* state);
|
||||
s16 AudioSeq_ScriptReadS16(SeqScriptState* state);
|
||||
u16 AudioSeq_ScriptReadCompressedU16(SeqScriptState* state);
|
||||
void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer);
|
||||
s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameSound);
|
||||
s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSample);
|
||||
s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer);
|
||||
s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd);
|
||||
s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd);
|
||||
@@ -320,7 +320,7 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
|
||||
|
||||
channel->unused = false;
|
||||
AudioPlayback_InitNoteLists(&channel->notePool);
|
||||
channel->unk_DC = 0;
|
||||
channel->startSamplePos = 0;
|
||||
channel->unk_E0 = 0;
|
||||
channel->sfxState = NULL;
|
||||
}
|
||||
@@ -582,7 +582,7 @@ void AudioSeq_SeqLayerProcessScript(SequenceLayer* layer) {
|
||||
} while ((cmd == -1) && (layer->delay == 0));
|
||||
|
||||
if (cmd != PROCESS_SCRIPT_END) {
|
||||
// returns `sameSound` instead of a command
|
||||
// returns `sameTunedSample` instead of a command
|
||||
cmd = AudioSeq_SeqLayerProcessScriptStep4(layer, cmd);
|
||||
}
|
||||
|
||||
@@ -611,20 +611,20 @@ void AudioSeq_SeqLayerProcessScriptStep1(SequenceLayer* layer) {
|
||||
layer->notePropertiesNeedInit = true;
|
||||
}
|
||||
|
||||
s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameSound) {
|
||||
s32 AudioSeq_SeqLayerProcessScriptStep5(SequenceLayer* layer, s32 sameTunedSample) {
|
||||
Note* note;
|
||||
|
||||
if ((layer->continuousNotes == true) && (layer->bit1 == true)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((layer->continuousNotes == true) && (layer->note != NULL) && layer->bit3 && (sameSound == true) &&
|
||||
if ((layer->continuousNotes == true) && (layer->note != NULL) && layer->bit3 && (sameTunedSample == true) &&
|
||||
(layer->note->playbackState.parentLayer == layer)) {
|
||||
if (layer->sound == NULL) {
|
||||
if (layer->tunedSample == NULL) {
|
||||
AudioPlayback_InitSyntheticWave(layer->note, layer);
|
||||
}
|
||||
} else {
|
||||
if (!sameSound) {
|
||||
if (!sameTunedSample) {
|
||||
AudioPlayback_SeqLayerNoteDecay(layer);
|
||||
}
|
||||
|
||||
@@ -815,7 +815,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
|
||||
}
|
||||
|
||||
s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
||||
s32 sameSound = true;
|
||||
s32 sameTunedSample = true;
|
||||
s32 instOrWave;
|
||||
s32 speed;
|
||||
f32 temp_f14;
|
||||
@@ -823,10 +823,10 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
||||
Portamento* portamento;
|
||||
f32 freqScale;
|
||||
f32 freqScale2;
|
||||
SoundFontSound* sound;
|
||||
TunedSample* tunedSample;
|
||||
Instrument* instrument;
|
||||
Drum* drum;
|
||||
s32 pad;
|
||||
SoundEffect* soundEffect;
|
||||
SequenceChannel* channel;
|
||||
SequencePlayer* seqPlayer;
|
||||
u8 semitone = cmd;
|
||||
@@ -861,15 +861,15 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
||||
return PROCESS_SCRIPT_END;
|
||||
}
|
||||
|
||||
sound = &drum->sound;
|
||||
tunedSample = &drum->tunedSample;
|
||||
layer->adsr.envelope = drum->envelope;
|
||||
layer->adsr.decayIndex = drum->adsrDecayIndex;
|
||||
if (!layer->ignoreDrumPan) {
|
||||
layer->pan = drum->pan;
|
||||
}
|
||||
|
||||
layer->sound = sound;
|
||||
layer->freqScale = sound->tuning;
|
||||
layer->tunedSample = tunedSample;
|
||||
layer->freqScale = tunedSample->tuning;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@@ -877,15 +877,16 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
||||
layer->semitone = semitone;
|
||||
sfxId = (layer->transposition << 6) + semitone;
|
||||
|
||||
sound = AudioPlayback_GetSfx(channel->fontId, sfxId);
|
||||
if (sound == NULL) {
|
||||
soundEffect = AudioPlayback_GetSoundEffect(channel->fontId, sfxId);
|
||||
if (soundEffect == NULL) {
|
||||
layer->stopSomething = true;
|
||||
layer->delay2 = layer->delay + 1;
|
||||
return PROCESS_SCRIPT_END;
|
||||
}
|
||||
|
||||
layer->sound = sound;
|
||||
layer->freqScale = sound->tuning;
|
||||
tunedSample = &soundEffect->tunedSample;
|
||||
layer->tunedSample = tunedSample;
|
||||
layer->freqScale = tunedSample->tuning;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -909,15 +910,15 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
||||
vel = (semitone > layer->portamentoTargetNote) ? semitone : layer->portamentoTargetNote;
|
||||
|
||||
if (instrument != NULL) {
|
||||
sound = AudioPlayback_InstrumentGetSound(instrument, vel);
|
||||
sameSound = (layer->sound == sound);
|
||||
layer->sound = sound;
|
||||
tuning = sound->tuning;
|
||||
tunedSample = AudioPlayback_GetInstrumentTunedSample(instrument, vel);
|
||||
sameTunedSample = (layer->tunedSample == tunedSample);
|
||||
layer->tunedSample = tunedSample;
|
||||
tuning = tunedSample->tuning;
|
||||
} else {
|
||||
layer->sound = NULL;
|
||||
layer->tunedSample = NULL;
|
||||
tuning = 1.0f;
|
||||
if (instOrWave >= 0xC0) {
|
||||
layer->sound = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].sound;
|
||||
layer->tunedSample = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].tunedSample;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -971,15 +972,15 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
||||
}
|
||||
|
||||
if (instrument != NULL) {
|
||||
sound = AudioPlayback_InstrumentGetSound(instrument, semitone);
|
||||
sameSound = (sound == layer->sound);
|
||||
layer->sound = sound;
|
||||
layer->freqScale = gPitchFrequencies[semitone2] * sound->tuning;
|
||||
tunedSample = AudioPlayback_GetInstrumentTunedSample(instrument, semitone);
|
||||
sameTunedSample = (tunedSample == layer->tunedSample);
|
||||
layer->tunedSample = tunedSample;
|
||||
layer->freqScale = gPitchFrequencies[semitone2] * tunedSample->tuning;
|
||||
} else {
|
||||
layer->sound = NULL;
|
||||
layer->tunedSample = NULL;
|
||||
layer->freqScale = gPitchFrequencies[semitone2];
|
||||
if (instOrWave >= 0xC0) {
|
||||
layer->sound = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].sound;
|
||||
layer->tunedSample = &gAudioContext.synthesisReverbs[instOrWave - 0xC0].tunedSample;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -989,8 +990,8 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
||||
layer->freqScale *= layer->bend;
|
||||
|
||||
if (layer->delay == 0) {
|
||||
if (layer->sound != NULL) {
|
||||
time = layer->sound->sample->loop->end;
|
||||
if (layer->tunedSample != NULL) {
|
||||
time = layer->tunedSample->sample->loop->end;
|
||||
} else {
|
||||
time = 0.0f;
|
||||
}
|
||||
@@ -1020,7 +1021,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return sameSound;
|
||||
return sameTunedSample;
|
||||
}
|
||||
|
||||
s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
|
||||
@@ -1571,7 +1572,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
||||
channel->unk_0F = 0;
|
||||
channel->unk_20 = 0;
|
||||
channel->bookOffset = 0;
|
||||
channel->unk_DC = 0;
|
||||
channel->startSamplePos = 0;
|
||||
channel->unk_E0 = 0;
|
||||
channel->freqScale = 1.0f;
|
||||
break;
|
||||
@@ -1659,7 +1660,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
||||
break;
|
||||
|
||||
case 0xBD: // channel:
|
||||
channel->unk_DC = cmdArgs[0];
|
||||
channel->startSamplePos = cmdArgs[0];
|
||||
break;
|
||||
|
||||
case 0xBE: // channel:
|
||||
@@ -1672,10 +1673,10 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xA0: // channel:
|
||||
case 0xA1: // channel:
|
||||
case 0xA2: // channel:
|
||||
case 0xA3: // channel:
|
||||
case 0xA0: // channel: read from SfxChannelState using arg
|
||||
case 0xA1: // channel: read from SfxChannelState using unk_22
|
||||
case 0xA2: // channel: write to SfxChannelState using arg
|
||||
case 0xA3: // channel: write to SfxChannelState using unk_22
|
||||
if ((cmd == 0xA0) || (cmd == 0xA2)) {
|
||||
cmdArgU16 = (u16)cmdArgs[0];
|
||||
} else {
|
||||
@@ -1958,15 +1959,15 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
||||
cmd = AudioSeq_ScriptReadU8(seqScript);
|
||||
temp = AudioSeq_ScriptReadS16(seqScript);
|
||||
switch (cmd) {
|
||||
case 0:
|
||||
case 1:
|
||||
if (seqPlayer->state != 2) {
|
||||
case SEQPLAYER_STATE_0:
|
||||
case SEQPLAYER_STATE_1:
|
||||
if (seqPlayer->state != SEQPLAYER_STATE_2) {
|
||||
seqPlayer->fadeTimerUnkEu = temp;
|
||||
seqPlayer->state = cmd;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case SEQPLAYER_STATE_2:
|
||||
seqPlayer->fadeTimer = temp;
|
||||
seqPlayer->state = cmd;
|
||||
seqPlayer->fadeVelocity = (0.0f - seqPlayer->fadeVolume) / (s32)seqPlayer->fadeTimer;
|
||||
@@ -1977,11 +1978,11 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
||||
case 0xDB: // seqPlayer: set volume
|
||||
value = AudioSeq_ScriptReadU8(seqScript);
|
||||
switch (seqPlayer->state) {
|
||||
case 1:
|
||||
seqPlayer->state = 0;
|
||||
case SEQPLAYER_STATE_1:
|
||||
seqPlayer->state = SEQPLAYER_STATE_0;
|
||||
seqPlayer->fadeVolume = 0.0f;
|
||||
// fallthrough
|
||||
case 0:
|
||||
case SEQPLAYER_STATE_0:
|
||||
seqPlayer->fadeTimer = seqPlayer->fadeTimerUnkEu;
|
||||
if (seqPlayer->fadeTimerUnkEu != 0) {
|
||||
seqPlayer->fadeVelocity =
|
||||
@@ -1991,7 +1992,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case SEQPLAYER_STATE_2:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -2102,7 +2103,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
||||
cmd = AudioSeq_ScriptReadU8(seqScript);
|
||||
if (cmd == 0xFF) {
|
||||
cmd = seqPlayer->playerIndex;
|
||||
if (seqPlayer->state == 2) {
|
||||
if (seqPlayer->state == SEQPLAYER_STATE_2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2224,7 +2225,7 @@ void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer) {
|
||||
AudioSeq_SequencePlayerDisable(seqPlayer);
|
||||
seqPlayer->stopScript = false;
|
||||
seqPlayer->delay = 0;
|
||||
seqPlayer->state = 1;
|
||||
seqPlayer->state = SEQPLAYER_STATE_1;
|
||||
seqPlayer->fadeTimer = 0;
|
||||
seqPlayer->fadeTimerUnkEu = 0;
|
||||
seqPlayer->tempoAcc = 0;
|
||||
|
||||
+6
-6
@@ -200,8 +200,8 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
||||
gfxCtx->viConfigFeatures = gViConfigFeatures;
|
||||
gfxCtx->xScale = gViConfigXScale;
|
||||
gfxCtx->yScale = gViConfigYScale;
|
||||
gameState->nextGameStateInit = NULL;
|
||||
gameState->nextGameStateSize = 0;
|
||||
gameState->init = NULL;
|
||||
gameState->size = 0;
|
||||
|
||||
{
|
||||
s32 requiredScopeTemp;
|
||||
@@ -242,12 +242,12 @@ void GameState_Destroy(GameState* gameState) {
|
||||
GameAlloc_Cleanup(&gameState->alloc);
|
||||
}
|
||||
|
||||
GameStateFunc GameState_GetNextStateInit(GameState* gameState) {
|
||||
return gameState->nextGameStateInit;
|
||||
GameStateFunc GameState_GetInit(GameState* gameState) {
|
||||
return gameState->init;
|
||||
}
|
||||
|
||||
size_t GameState_GetNextStateSize(GameState* gameState) {
|
||||
return gameState->nextGameStateSize;
|
||||
size_t GameState_GetSize(GameState* gameState) {
|
||||
return gameState->size;
|
||||
}
|
||||
|
||||
u32 GameState_IsRunning(GameState* gameState) {
|
||||
|
||||
+16
-14
@@ -6,6 +6,7 @@
|
||||
#include "overlays/gamestates/ovl_opening/z_opening.h"
|
||||
#include "overlays/gamestates/ovl_select/z_select.h"
|
||||
#include "overlays/gamestates/ovl_title/z_title.h"
|
||||
#include "z_title_setup.h"
|
||||
|
||||
FaultAddrConvClient sGraphFaultAddrConvClient;
|
||||
FaultClient sGraphFaultClient;
|
||||
@@ -63,44 +64,45 @@ void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
|
||||
}
|
||||
|
||||
GameStateOverlay* Graph_GetNextGameState(GameState* gameState) {
|
||||
GameStateFunc gameStateInit = GameState_GetNextStateInit(gameState);
|
||||
GameStateFunc gameStateInit = GameState_GetInit(gameState);
|
||||
|
||||
if (gameStateInit == (GameStateFunc)TitleSetup_Init) {
|
||||
if (gameStateInit == Setup_Init) {
|
||||
return &gGameStateOverlayTable[0];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)MapSelect_Init) {
|
||||
if (gameStateInit == MapSelect_Init) {
|
||||
return &gGameStateOverlayTable[1];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)Title_Init) {
|
||||
if (gameStateInit == ConsoleLogo_Init) {
|
||||
return &gGameStateOverlayTable[2];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)Play_Init) {
|
||||
if (gameStateInit == Play_Init) {
|
||||
return &gGameStateOverlayTable[3];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)Opening_Init) {
|
||||
if (gameStateInit == TitleSetup_Init) {
|
||||
return &gGameStateOverlayTable[4];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)FileChoose_Init) {
|
||||
if (gameStateInit == FileSelect_Init) {
|
||||
return &gGameStateOverlayTable[5];
|
||||
}
|
||||
if (gameStateInit == (GameStateFunc)Daytelop_Init) {
|
||||
if (gameStateInit == DayTelop_Init) {
|
||||
return &gGameStateOverlayTable[6];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* Graph_FaultAddrConvFunc(void* address, void* param) {
|
||||
uintptr_t addr = address;
|
||||
GameStateOverlay* gamestateOvl = &gGameStateOverlayTable[0];
|
||||
GameStateOverlay* gameStateOvl = &gGameStateOverlayTable[0];
|
||||
uintptr_t ramConv;
|
||||
void* ramStart;
|
||||
uintptr_t diff;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < graphNumGameStates; i++, gamestateOvl++) {
|
||||
diff = VRAM_PTR_SIZE(gamestateOvl);
|
||||
ramStart = gamestateOvl->loadedRamAddr;
|
||||
ramConv = (uintptr_t)gamestateOvl->vramStart - (uintptr_t)ramStart;
|
||||
for (i = 0; i < graphNumGameStates; i++, gameStateOvl++) {
|
||||
diff = VRAM_PTR_SIZE(gameStateOvl);
|
||||
ramStart = gameStateOvl->loadedRamAddr;
|
||||
ramConv = (uintptr_t)gameStateOvl->vramStart - (uintptr_t)ramStart;
|
||||
|
||||
if (ramStart != NULL) {
|
||||
if (addr >= (uintptr_t)ramStart && addr < (uintptr_t)ramStart + diff) {
|
||||
@@ -235,7 +237,7 @@ void Graph_UpdateGame(GameState* gameState) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the gamestate logic, then finalize the gfx buffer
|
||||
* Run the game state logic, then finalize the gfx buffer
|
||||
* and run the graphics task for this frame.
|
||||
*/
|
||||
void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
|
||||
+13
-15
@@ -1,14 +1,14 @@
|
||||
#include "global.h"
|
||||
#include "z_title_setup.h"
|
||||
#include "overlays/gamestates/ovl_title/z_title.h"
|
||||
|
||||
void TitleSetup_GameStateResetContext(void) {
|
||||
void Setup_SetRegs(void) {
|
||||
XREG(2) = 0;
|
||||
XREG(10) = 0x1A;
|
||||
XREG(11) = 0x14;
|
||||
XREG(12) = 0xE;
|
||||
XREG(13) = 0;
|
||||
XREG(31) = 0;
|
||||
XREG(41) = 0x50;
|
||||
R_MAGIC_CONSUME_TIMER_GIANTS_MASK = 80;
|
||||
XREG(43) = 0xFC54;
|
||||
|
||||
XREG(44) = 0xD7;
|
||||
@@ -45,23 +45,21 @@ void TitleSetup_GameStateResetContext(void) {
|
||||
YREG(43) = 0xB1;
|
||||
}
|
||||
|
||||
void TitleSetup_InitImpl(GameState* gameState) {
|
||||
void Setup_InitImpl(SetupState* this) {
|
||||
func_80185908();
|
||||
SaveContext_Init();
|
||||
TitleSetup_GameStateResetContext();
|
||||
Setup_SetRegs();
|
||||
|
||||
gameState->running = 0;
|
||||
|
||||
setNextGamestate
|
||||
:; // This label is probably a leftover of a debug ifdef, it's essential to not have gameState->running reordered!
|
||||
SET_NEXT_GAMESTATE(gameState, Title_Init, TitleContext);
|
||||
STOP_GAMESTATE(&this->state);
|
||||
SET_NEXT_GAMESTATE(&this->state, ConsoleLogo_Init, sizeof(ConsoleLogoState));
|
||||
}
|
||||
|
||||
void TitleSetup_Destroy(GameState* gameState) {
|
||||
;
|
||||
void Setup_Destroy(GameState* thisx) {
|
||||
}
|
||||
|
||||
void TitleSetup_Init(GameState* gameState) {
|
||||
gameState->destroy = TitleSetup_Destroy;
|
||||
TitleSetup_InitImpl(gameState);
|
||||
void Setup_Init(GameState* thisx) {
|
||||
SetupState* this = (SetupState*)thisx;
|
||||
|
||||
this->state.destroy = Setup_Destroy;
|
||||
Setup_InitImpl(this);
|
||||
}
|
||||
|
||||
+48
-49
@@ -692,7 +692,7 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS
|
||||
*/
|
||||
s32 Flags_GetSwitch(PlayState* play, s32 flag) {
|
||||
if (flag >= 0 && flag < 0x80) {
|
||||
return play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F));
|
||||
return play->actorCtx.sceneFlags.switches[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -702,7 +702,7 @@ s32 Flags_GetSwitch(PlayState* play, s32 flag) {
|
||||
*/
|
||||
void Flags_SetSwitch(PlayState* play, s32 flag) {
|
||||
if (flag >= 0 && flag < 0x80) {
|
||||
play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F);
|
||||
play->actorCtx.sceneFlags.switches[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,7 +711,7 @@ void Flags_SetSwitch(PlayState* play, s32 flag) {
|
||||
*/
|
||||
void Flags_UnsetSwitch(PlayState* play, s32 flag) {
|
||||
if (flag >= 0 && flag < 0x80) {
|
||||
play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] &= ~(1 << (flag & 0x1F));
|
||||
play->actorCtx.sceneFlags.switches[(flag & ~0x1F) >> 5] &= ~(1 << (flag & 0x1F));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -719,70 +719,70 @@ void Flags_UnsetSwitch(PlayState* play, s32 flag) {
|
||||
* Tests if current scene chest flag is set.
|
||||
*/
|
||||
s32 Flags_GetTreasure(PlayState* play, s32 flag) {
|
||||
return play->actorCtx.flags.chest & (1 << flag);
|
||||
return play->actorCtx.sceneFlags.chest & (1 << flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets current scene chest flag.
|
||||
*/
|
||||
void Flags_SetTreasure(PlayState* play, s32 flag) {
|
||||
play->actorCtx.flags.chest |= (1 << flag);
|
||||
play->actorCtx.sceneFlags.chest |= (1 << flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the all the chest flags.
|
||||
*/
|
||||
void Flags_SetAllTreasure(PlayState* play, s32 flag) {
|
||||
play->actorCtx.flags.chest = flag;
|
||||
play->actorCtx.sceneFlags.chest = flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the chest flags.
|
||||
*/
|
||||
s32 Flags_GetAllTreasure(PlayState* play) {
|
||||
return play->actorCtx.flags.chest;
|
||||
return play->actorCtx.sceneFlags.chest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if current scene clear flag is set.
|
||||
*/
|
||||
s32 Flags_GetClear(PlayState* play, s32 roomNumber) {
|
||||
return play->actorCtx.flags.clearedRoom & (1 << roomNumber);
|
||||
return play->actorCtx.sceneFlags.clearedRoom & (1 << roomNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets current scene clear flag.
|
||||
*/
|
||||
void Flags_SetClear(PlayState* play, s32 roomNumber) {
|
||||
play->actorCtx.flags.clearedRoom |= (1 << roomNumber);
|
||||
play->actorCtx.sceneFlags.clearedRoom |= (1 << roomNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets current scene clear flag.
|
||||
*/
|
||||
void Flags_UnsetClear(PlayState* play, s32 roomNumber) {
|
||||
play->actorCtx.flags.clearedRoom &= ~(1 << roomNumber);
|
||||
play->actorCtx.sceneFlags.clearedRoom &= ~(1 << roomNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if current scene temp clear flag is set.
|
||||
*/
|
||||
s32 Flags_GetClearTemp(PlayState* play, s32 roomNumber) {
|
||||
return play->actorCtx.flags.clearedRoomTemp & (1 << roomNumber);
|
||||
return play->actorCtx.sceneFlags.clearedRoomTemp & (1 << roomNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets current scene temp clear flag.
|
||||
*/
|
||||
void Flags_SetClearTemp(PlayState* play, s32 roomNumber) {
|
||||
play->actorCtx.flags.clearedRoomTemp |= (1 << roomNumber);
|
||||
play->actorCtx.sceneFlags.clearedRoomTemp |= (1 << roomNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsets current scene temp clear flag.
|
||||
*/
|
||||
void Flags_UnsetClearTemp(PlayState* play, s32 roomNumber) {
|
||||
play->actorCtx.flags.clearedRoomTemp &= ~(1 << roomNumber);
|
||||
play->actorCtx.sceneFlags.clearedRoomTemp &= ~(1 << roomNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -790,7 +790,7 @@ void Flags_UnsetClearTemp(PlayState* play, s32 roomNumber) {
|
||||
*/
|
||||
s32 Flags_GetCollectible(PlayState* play, s32 flag) {
|
||||
if (flag > 0 && flag < 0x80) {
|
||||
return play->actorCtx.flags.collectible[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F));
|
||||
return play->actorCtx.sceneFlags.collectible[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -800,7 +800,7 @@ s32 Flags_GetCollectible(PlayState* play, s32 flag) {
|
||||
*/
|
||||
void Flags_SetCollectible(PlayState* play, s32 flag) {
|
||||
if (flag > 0 && flag < 0x80) {
|
||||
play->actorCtx.flags.collectible[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F);
|
||||
play->actorCtx.sceneFlags.collectible[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,7 +1076,7 @@ void Actor_Init(Actor* actor, PlayState* play) {
|
||||
actor->uncullZoneScale = 350.0f;
|
||||
actor->uncullZoneDownward = 700.0f;
|
||||
|
||||
actor->hintId = 255;
|
||||
actor->hintId = TATL_HINT_ID_NONE;
|
||||
|
||||
CollisionCheck_InitInfo(&actor->colChkInfo);
|
||||
actor->floorBgId = BGCHECK_SCENE;
|
||||
@@ -2212,10 +2212,10 @@ s32 func_800B90AC(PlayState* play, Actor* actor, CollisionPoly* polygon, s32 bgI
|
||||
return false;
|
||||
}
|
||||
|
||||
void func_800B90F4(PlayState* play) {
|
||||
if (play->actorCtx.unk3 != 0) {
|
||||
play->actorCtx.unk3 = 0;
|
||||
func_80115D5C(&play->state);
|
||||
void Actor_DeactivateLens(PlayState* play) {
|
||||
if (play->actorCtx.lensActive) {
|
||||
play->actorCtx.lensActive = false;
|
||||
Magic_Reset(play);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2249,14 +2249,14 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto
|
||||
overlayEntry++;
|
||||
}
|
||||
|
||||
actorCtx->flags.chest = cycleFlags->chest;
|
||||
actorCtx->flags.switches[0] = cycleFlags->switch0;
|
||||
actorCtx->flags.switches[1] = cycleFlags->switch1;
|
||||
actorCtx->sceneFlags.chest = cycleFlags->chest;
|
||||
actorCtx->sceneFlags.switches[0] = cycleFlags->switch0;
|
||||
actorCtx->sceneFlags.switches[1] = cycleFlags->switch1;
|
||||
if (play->sceneNum == SCENE_INISIE_R) {
|
||||
cycleFlags = &gSaveContext.cycleSceneFlags[play->sceneNum];
|
||||
}
|
||||
actorCtx->flags.collectible[0] = cycleFlags->collectible;
|
||||
actorCtx->flags.clearedRoom = cycleFlags->clearedRoom;
|
||||
actorCtx->sceneFlags.collectible[0] = cycleFlags->collectible;
|
||||
actorCtx->sceneFlags.clearedRoom = cycleFlags->clearedRoom;
|
||||
|
||||
TitleCard_ContextInit(&play->state, &actorCtx->titleCtxt);
|
||||
func_800B6468(play);
|
||||
@@ -2594,7 +2594,7 @@ void func_800B9D1C(Actor* actor) {
|
||||
|
||||
void Actor_DrawAllSetup(PlayState* play) {
|
||||
play->actorCtx.undrawnActorCount = 0;
|
||||
play->actorCtx.unkB = 0;
|
||||
play->actorCtx.lensActorsDrawn = false;
|
||||
}
|
||||
|
||||
s32 Actor_RecordUndrawnActor(PlayState* play, Actor* actor) {
|
||||
@@ -2607,13 +2607,12 @@ s32 Actor_RecordUndrawnActor(PlayState* play, Actor* actor) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void func_800B9E84(Gfx** arg0, s32 arg1) {
|
||||
func_80164C14(arg0, D_801DE890, 4, 0, 6, 6, ((100 - arg1) * 0.003f) + 1.0f);
|
||||
void Actor_DrawLensOverlay(Gfx** gfxP, s32 lensMaskSize) {
|
||||
func_80164C14(gfxP, &gCircleTex, 4, 0, 6, 6, ((LENS_MASK_ACTIVE_SIZE - lensMaskSize) * 0.003f) + 1.0f);
|
||||
}
|
||||
|
||||
#ifdef NON_EQUIVALENT
|
||||
// Related to draw actors with lens
|
||||
void func_800B9EF4(PlayState* play, s32 numActors, Actor** actors) {
|
||||
void Actor_DrawLensActors(PlayState* play, s32 numActors, Actor** actors) {
|
||||
s32 spB4;
|
||||
Gfx* spAC;
|
||||
void* spA8; // pad
|
||||
@@ -2684,7 +2683,7 @@ void func_800B9EF4(PlayState* play, s32 numActors, Actor** actors) {
|
||||
}
|
||||
|
||||
// spAC = phi_s1;
|
||||
func_800B9E84(&spAC, play->actorCtx.unk4);
|
||||
Actor_DrawLensOverlay(&spAC, play->actorCtx.lensMaskSize);
|
||||
phi_s1_2 = func_801660B8(play, spAC);
|
||||
|
||||
for (spB4 = 0; spB4 < numActors; spB4++, actors++) {
|
||||
@@ -2744,7 +2743,7 @@ void func_800B9EF4(PlayState* play, s32 numActors, Actor** actors) {
|
||||
spAC = phi_s1_2;
|
||||
|
||||
// spAC = temp_s1_11;
|
||||
func_800B9E84(&spAC, (s32)play->actorCtx.unk4);
|
||||
Actor_DrawLensOverlay(&spAC, (s32)play->actorCtx.lensMaskSize);
|
||||
// temp_s1_11->words.w0 = 0xE7000000;
|
||||
// temp_s1_11->words.w1 = 0;
|
||||
// temp_s1_12 = temp_s1_11 + 8;
|
||||
@@ -2796,15 +2795,15 @@ void func_800B9EF4(PlayState* play, s32 numActors, Actor** actors) {
|
||||
// spAC = temp_s1_18 + 8;
|
||||
gDPSetPrimColor(spAC++, 0, 0, 74, 0, 0, 74);
|
||||
|
||||
func_800B9E84(&spAC, (s32)play->actorCtx.unk4);
|
||||
Actor_DrawLensOverlay(&spAC, (s32)play->actorCtx.lensMaskSize);
|
||||
|
||||
OVERLAY_DISP = spAC;
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
#else
|
||||
void func_800B9EF4(PlayState* play, s32 numActors, Actor** actors);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800B9EF4.s")
|
||||
void Actor_DrawLensActors(PlayState* play, s32 numActors, Actor** actors);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/Actor_DrawLensActors.s")
|
||||
#endif
|
||||
|
||||
s32 func_800BA2D8(PlayState* play, Actor* actor) {
|
||||
@@ -2883,7 +2882,7 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) {
|
||||
actor->isDrawn = false;
|
||||
if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & actorFlags)) {
|
||||
if ((actor->flags & ACTOR_FLAG_80) &&
|
||||
((play->roomCtx.currRoom.unk5 == 0) || (play->actorCtx.unk4 == 0x64) ||
|
||||
((play->roomCtx.currRoom.unk5 == 0) || (play->actorCtx.lensMaskSize == LENS_MASK_ACTIVE_SIZE) ||
|
||||
(actor->room != play->roomCtx.currRoom.num))) {
|
||||
if (Actor_RecordUndrawnActor(play, actor)) {}
|
||||
} else {
|
||||
@@ -2903,17 +2902,17 @@ void Actor_DrawAll(PlayState* play, ActorContext* actorCtx) {
|
||||
gSPDisplayList(sp58, &ref2[1]);
|
||||
POLY_XLU_DISP = &ref2[1];
|
||||
|
||||
if (play->actorCtx.unk3 != 0) {
|
||||
Math_StepToC(&play->actorCtx.unk4, 100, 20);
|
||||
if (play->actorCtx.lensActive) {
|
||||
Math_StepToC(&play->actorCtx.lensMaskSize, LENS_MASK_ACTIVE_SIZE, 20);
|
||||
if (GET_PLAYER(play)->stateFlags2 & 0x8000000) {
|
||||
func_800B90F4(play);
|
||||
Actor_DeactivateLens(play);
|
||||
}
|
||||
} else {
|
||||
Math_StepToC(&play->actorCtx.unk4, 0, 10);
|
||||
Math_StepToC(&play->actorCtx.lensMaskSize, 0, 10);
|
||||
}
|
||||
if (play->actorCtx.unk4 != 0) {
|
||||
play->actorCtx.unkB = 1;
|
||||
func_800B9EF4(play, play->actorCtx.undrawnActorCount, play->actorCtx.undrawnActors);
|
||||
if (play->actorCtx.lensMaskSize != 0) {
|
||||
play->actorCtx.lensActorsDrawn = true;
|
||||
Actor_DrawLensActors(play, play->actorCtx.undrawnActorCount, play->actorCtx.undrawnActors);
|
||||
}
|
||||
|
||||
tmp2 = POLY_XLU_DISP;
|
||||
@@ -2977,9 +2976,9 @@ void func_800BA798(PlayState* play, ActorContext* actorCtx) {
|
||||
}
|
||||
|
||||
CollisionCheck_ClearContext(play, &play->colChkCtx);
|
||||
actorCtx->flags.clearedRoomTemp = 0;
|
||||
actorCtx->flags.switches[3] = 0;
|
||||
actorCtx->flags.collectible[3] = 0;
|
||||
actorCtx->sceneFlags.clearedRoomTemp = 0;
|
||||
actorCtx->sceneFlags.switches[3] = 0;
|
||||
actorCtx->sceneFlags.collectible[3] = 0;
|
||||
play->msgCtx.unk_12030 = 0;
|
||||
}
|
||||
|
||||
@@ -3815,9 +3814,9 @@ typedef struct {
|
||||
} DoorLockInfo; // size = 0x1C
|
||||
|
||||
DoorLockInfo sDoorLocksInfo[DOORLOCK_MAX] = {
|
||||
/* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0, 1.0f, 0.0f, gDoorChainsDL, gDoorLockDL },
|
||||
/* DOORLOCK_BOSS */ { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, object_bdoor_DL_000530, object_bdoor_DL_000400 },
|
||||
/* DOORLOCK_2 */ { 0.6400000453f, 8500.0f, 8000.0f, 1.75f, 0.1f, gDoorChainsDL, gDoorLockDL },
|
||||
/* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0, 1.0f, 0.0f, gDoorChainDL, gDoorLockDL },
|
||||
/* DOORLOCK_BOSS */ { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, gBossDoorChainDL, gBossDoorLockDL },
|
||||
/* DOORLOCK_2 */ { 0.6400000453f, 8500.0f, 8000.0f, 1.75f, 0.1f, gDoorChainDL, gDoorLockDL },
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+5
-9
@@ -126,12 +126,11 @@ void func_800EA2B8(PlayState* play, CutsceneContext* csCtx) {
|
||||
/* Start of command handling section */
|
||||
|
||||
// Command 0x96: Miscellaneous commands.
|
||||
void Cutscene_Command_Misc(PlayState* play2, CutsceneContext* csCtx, CsCmdBase* cmd) {
|
||||
void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
|
||||
static u16 D_801BB15C = 0xFFFF;
|
||||
Player* player = GET_PLAYER(play2);
|
||||
PlayState* play = play2;
|
||||
u8 isStartFrame = false;
|
||||
Player* player = GET_PLAYER(play);
|
||||
f32 progress;
|
||||
u8 isStartFrame = false;
|
||||
SceneTableEntry* loadedScene;
|
||||
|
||||
if ((csCtx->frames < cmd->startFrame) || ((csCtx->frames >= cmd->endFrame) && (cmd->endFrame != cmd->startFrame))) {
|
||||
@@ -346,11 +345,8 @@ void Cutscene_Command_Misc(PlayState* play2, CutsceneContext* csCtx, CsCmdBase*
|
||||
|
||||
gSaveContext.save.day = 9;
|
||||
|
||||
{
|
||||
GameState* gameState = &play->state;
|
||||
gameState->running = false;
|
||||
}
|
||||
SET_NEXT_GAMESTATE(&play->state, Daytelop_Init, DaytelopContext);
|
||||
STOP_GAMESTATE(&play->state);
|
||||
SET_NEXT_GAMESTATE(&play->state, DayTelop_Init, sizeof(DayTelopState));
|
||||
|
||||
Sram_SaveSpecialNewDay(play);
|
||||
break;
|
||||
|
||||
@@ -91,63 +91,76 @@ void EffectSsDust_Spawn(PlayState* play, u16 drawFlags, Vec3f* pos, Vec3f* veloc
|
||||
|
||||
void func_800B0DE0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
|
||||
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
|
||||
EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10,
|
||||
DUST_UPDATE_NORMAL);
|
||||
}
|
||||
|
||||
void func_800B0E48(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
|
||||
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
|
||||
EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10,
|
||||
DUST_UPDATE_NORMAL);
|
||||
}
|
||||
|
||||
void func_800B0EB0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
|
||||
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) {
|
||||
EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG0, pos, velocity, accel, primColor, envColor, scale, scaleStep, life,
|
||||
DUST_UPDATE_NORMAL);
|
||||
}
|
||||
|
||||
void func_800B0F18(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
|
||||
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) {
|
||||
EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG1, pos, velocity, accel, primColor, envColor, scale, scaleStep, life,
|
||||
DUST_UPDATE_NORMAL);
|
||||
}
|
||||
|
||||
void func_800B0F80(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
|
||||
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 life) {
|
||||
EffectSsDust_Spawn(play, 2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG2, pos, velocity, accel, primColor, envColor, scale, scaleStep, life,
|
||||
DUST_UPDATE_NORMAL);
|
||||
}
|
||||
|
||||
void func_800B0FE8(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
|
||||
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
|
||||
EffectSsDust_Spawn(play, 0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG0, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10,
|
||||
DUST_UPDATE_FIRE);
|
||||
}
|
||||
|
||||
void func_800B1054(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
|
||||
Color_RGBA8* envColor, s16 scale, s16 scaleStep) {
|
||||
EffectSsDust_Spawn(play, 1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10, 1);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG1, pos, velocity, accel, primColor, envColor, scale, scaleStep, 10,
|
||||
DUST_UPDATE_FIRE);
|
||||
}
|
||||
|
||||
static Color_RGBA8 sDustBrownPrim = { 170, 130, 90, 255 };
|
||||
static Color_RGBA8 sDustBrownEnv = { 100, 60, 20, 255 };
|
||||
|
||||
void func_800B10C0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
|
||||
EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG0, pos, velocity, accel, &sDustBrownPrim,
|
||||
&sDustBrownEnv, 100, 5, 10, DUST_UPDATE_NORMAL);
|
||||
}
|
||||
|
||||
void func_800B1130(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) {
|
||||
EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, 100, 5, 10, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG1, pos, velocity, accel, &sDustBrownPrim,
|
||||
&sDustBrownEnv, 100, 5, 10, DUST_UPDATE_NORMAL);
|
||||
}
|
||||
|
||||
void func_800B11A0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
|
||||
EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG0, pos, velocity, accel, &sDustBrownPrim,
|
||||
&sDustBrownEnv, scale, scaleStep, 10, DUST_UPDATE_NORMAL);
|
||||
}
|
||||
|
||||
void func_800B1210(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep) {
|
||||
EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, 10, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG1, pos, velocity, accel, &sDustBrownPrim,
|
||||
&sDustBrownEnv, scale, scaleStep, 10, DUST_UPDATE_NORMAL);
|
||||
}
|
||||
|
||||
void func_800B1280(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) {
|
||||
EffectSsDust_Spawn(play, 4, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG0, pos, velocity, accel, &sDustBrownPrim,
|
||||
&sDustBrownEnv, scale, scaleStep, life, DUST_UPDATE_NORMAL);
|
||||
}
|
||||
void func_800B12F0(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep, s16 life) {
|
||||
EffectSsDust_Spawn(play, 5, pos, velocity, accel, &sDustBrownPrim, &sDustBrownEnv, scale, scaleStep, life, 0);
|
||||
EffectSsDust_Spawn(play, DUST_DRAWFLAG_RAND_COLOR_OFFSET | DUST_DRAWFLAG1, pos, velocity, accel, &sDustBrownPrim,
|
||||
&sDustBrownEnv, scale, scaleStep, life, DUST_UPDATE_NORMAL);
|
||||
}
|
||||
|
||||
void func_800B1360(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
|
||||
@@ -285,7 +298,7 @@ void EffectSsBomb2_SpawnLayered(PlayState* play, Vec3f* pos, Vec3f* velocity, Ve
|
||||
// EffectSsBlast Spawn Functions
|
||||
|
||||
void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor,
|
||||
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 sclaeStepDecay, s16 life) {
|
||||
Color_RGBA8* envColor, s16 scale, s16 scaleStep, s16 scaleStepDecay, s16 life) {
|
||||
EffectSsBlastInitParams initParams;
|
||||
|
||||
Math_Vec3f_Copy(&initParams.pos, pos);
|
||||
@@ -295,7 +308,7 @@ void EffectSsBlast_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* ac
|
||||
Color_RGBA8_Copy(&initParams.envColor, envColor);
|
||||
initParams.scale = scale;
|
||||
initParams.scaleStep = scaleStep;
|
||||
initParams.sclaeStepDecay = sclaeStepDecay;
|
||||
initParams.scaleStepDecay = scaleStepDecay;
|
||||
initParams.life = life;
|
||||
|
||||
EffectSs_Spawn(play, EFFECT_SS_BLAST, 128, &initParams);
|
||||
@@ -391,7 +404,7 @@ void EffectSsGSpk_SpawnSmall(PlayState* play, Actor* actor, Vec3f* pos, Vec3f* v
|
||||
|
||||
// EffectSsDFire Spawn Functions
|
||||
void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
|
||||
s16 alpha, s16 fadeDelay, s16 arg8, s32 life) {
|
||||
s16 alpha, s16 alphaStep, s16 fadeDelay, s32 life) {
|
||||
EffectSsDFireInitParams initParams;
|
||||
|
||||
Math_Vec3f_Copy(&initParams.pos, pos);
|
||||
@@ -400,8 +413,8 @@ void EffectSsDFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* ac
|
||||
initParams.scale = scale;
|
||||
initParams.scaleStep = scaleStep;
|
||||
initParams.alpha = alpha;
|
||||
initParams.alphaStep = alphaStep;
|
||||
initParams.fadeDelay = fadeDelay;
|
||||
initParams.unk_2C = arg8;
|
||||
initParams.life = life;
|
||||
|
||||
EffectSs_Spawn(play, EFFECT_SS_D_FIRE, 128, &initParams);
|
||||
@@ -492,7 +505,7 @@ void EffectSsDtBubble_SpawnColorProfile(PlayState* play, Vec3f* pos, Vec3f* velo
|
||||
Math_Vec3f_Copy(&initParams.pos, pos);
|
||||
Math_Vec3f_Copy(&initParams.velocity, velocity);
|
||||
Math_Vec3f_Copy(&initParams.accel, accel);
|
||||
initParams.customColor = 0;
|
||||
initParams.customColor = false;
|
||||
initParams.colorProfile = colorProfile;
|
||||
initParams.scale = scale;
|
||||
initParams.life = life;
|
||||
@@ -513,7 +526,7 @@ void EffectSsDtBubble_SpawnCustomColor(PlayState* play, Vec3f* pos, Vec3f* veloc
|
||||
initParams.scale = scale;
|
||||
initParams.life = life;
|
||||
initParams.randXZ = randXZ;
|
||||
initParams.customColor = 1;
|
||||
initParams.customColor = true;
|
||||
|
||||
EffectSs_Spawn(play, EFFECT_SS_DT_BUBBLE, 128, &initParams);
|
||||
}
|
||||
@@ -927,7 +940,7 @@ void EffectSsExtra_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* ac
|
||||
// EffectSsDeadDb Spawn Functions
|
||||
|
||||
void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
|
||||
Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk) {
|
||||
Color_RGBA8* env, s16 scale, s16 scaleStep, s32 life) {
|
||||
EffectSsDeadDbInitParams initParams;
|
||||
|
||||
Math_Vec3f_Copy(&initParams.pos, pos);
|
||||
@@ -942,7 +955,7 @@ void EffectSsDeadDb_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* a
|
||||
initParams.envColor.r = env->r;
|
||||
initParams.envColor.g = env->g;
|
||||
initParams.envColor.b = env->b;
|
||||
initParams.unk_30 = unk;
|
||||
initParams.life = life;
|
||||
|
||||
EffectSs_Spawn(play, EFFECT_SS_DEAD_DB, 120, &initParams);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ u16 ElfMessage_GetFirstCycleHint(PlayState* play) {
|
||||
}
|
||||
return 0x21D;
|
||||
}
|
||||
if (gSaveContext.save.playerData.magicAcquired != true) {
|
||||
if (gSaveContext.save.playerData.isMagicAcquired != true) {
|
||||
return 0x21F;
|
||||
}
|
||||
if (INV_CONTENT(ITEM_DEED_LAND) == ITEM_DEED_LAND) {
|
||||
|
||||
+133
-73
@@ -18,6 +18,11 @@ void func_800A6650(EnItem00* this, PlayState* play);
|
||||
void func_800A6780(EnItem00* this, PlayState* play);
|
||||
void func_800A6A40(EnItem00* this, PlayState* play);
|
||||
|
||||
void EnItem00_DrawRupee(EnItem00* this, PlayState* play);
|
||||
void EnItem00_DrawSprite(EnItem00* this, PlayState* play);
|
||||
void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play);
|
||||
void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play);
|
||||
|
||||
const ActorInit En_Item00_InitVars = {
|
||||
ACTOR_EN_ITEM00,
|
||||
ACTORCAT_MISC,
|
||||
@@ -102,12 +107,14 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
|
||||
this->unk154 = 0.015f;
|
||||
shadowOffset = 750.0f;
|
||||
break;
|
||||
|
||||
case ITEM00_SMALL_KEY:
|
||||
this->unk150 = 0;
|
||||
Actor_SetScale(&this->actor, 0.03f);
|
||||
this->unk154 = 0.03f;
|
||||
shadowOffset = 350.0f;
|
||||
break;
|
||||
|
||||
case ITEM00_HEART_PIECE:
|
||||
case ITEM00_HEART_CONTAINER:
|
||||
this->unk150 = 0;
|
||||
@@ -118,12 +125,14 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
|
||||
sp30 = -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM00_RECOVERY_HEART:
|
||||
this->actor.home.rot.z = randPlusMinusPoint5Scaled(65535.0f);
|
||||
this->actor.home.rot.z = randPlusMinusPoint5Scaled(0xFFFF);
|
||||
shadowOffset = 430.0f;
|
||||
Actor_SetScale(&this->actor, 0.02f);
|
||||
this->unk154 = 0.02f;
|
||||
break;
|
||||
|
||||
case ITEM00_ARROWS_10:
|
||||
case ITEM00_ARROWS_30:
|
||||
case ITEM00_ARROWS_40:
|
||||
@@ -132,6 +141,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
|
||||
this->unk154 = 0.035f;
|
||||
shadowOffset = 250.0f;
|
||||
break;
|
||||
|
||||
case ITEM00_BOMBS_A:
|
||||
case ITEM00_BOMBS_B:
|
||||
case ITEM00_NUTS_1:
|
||||
@@ -143,39 +153,47 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
|
||||
this->unk154 = 0.03f;
|
||||
shadowOffset = 320.0f;
|
||||
break;
|
||||
|
||||
case ITEM00_MAGIC_LARGE:
|
||||
Actor_SetScale(&this->actor, 0.044999998f);
|
||||
this->unk154 = 0.044999998f;
|
||||
Actor_SetScale(&this->actor, 4.5f * 0.01f);
|
||||
this->unk154 = 4.5f * 0.01f;
|
||||
shadowOffset = 320.0f;
|
||||
break;
|
||||
|
||||
case ITEM00_RUPEE_HUGE:
|
||||
Actor_SetScale(&this->actor, 0.044999998f);
|
||||
this->unk154 = 0.044999998f;
|
||||
Actor_SetScale(&this->actor, 4.5f * 0.01f);
|
||||
this->unk154 = 4.5f * 0.01f;
|
||||
shadowOffset = 750.0f;
|
||||
break;
|
||||
|
||||
case ITEM00_RUPEE_PURPLE:
|
||||
Actor_SetScale(&this->actor, 0.03f);
|
||||
this->unk154 = 0.03f;
|
||||
shadowOffset = 750.0f;
|
||||
break;
|
||||
|
||||
case ITEM00_FLEXIBLE:
|
||||
case ITEM00_BIG_FAIRY:
|
||||
shadowOffset = 500.0f;
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
this->unk154 = 0.01f;
|
||||
break;
|
||||
|
||||
case ITEM00_SHIELD_HERO:
|
||||
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2);
|
||||
EnItem00_SetObject(this, play, &shadowOffset, &shadowScale);
|
||||
break;
|
||||
|
||||
case ITEM00_MAP:
|
||||
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_MAP);
|
||||
EnItem00_SetObject(this, play, &shadowOffset, &shadowScale);
|
||||
break;
|
||||
|
||||
case ITEM00_COMPASS:
|
||||
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_COMPASS);
|
||||
EnItem00_SetObject(this, play, &shadowOffset, &shadowScale);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -191,6 +209,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
|
||||
this->unk152 = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sp30 == 0) {
|
||||
this->actionFunc = func_800A640C;
|
||||
this->unk152 = -1;
|
||||
@@ -208,61 +227,78 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
|
||||
case ITEM00_RUPEE_GREEN:
|
||||
Item_Give(play, ITEM_RUPEE_GREEN);
|
||||
break;
|
||||
|
||||
case ITEM00_RUPEE_BLUE:
|
||||
Item_Give(play, ITEM_RUPEE_BLUE);
|
||||
break;
|
||||
|
||||
case ITEM00_RUPEE_RED:
|
||||
Item_Give(play, ITEM_RUPEE_RED);
|
||||
break;
|
||||
|
||||
case ITEM00_RUPEE_PURPLE:
|
||||
Item_Give(play, ITEM_RUPEE_PURPLE);
|
||||
break;
|
||||
|
||||
case ITEM00_RUPEE_HUGE:
|
||||
Item_Give(play, ITEM_RUPEE_HUGE);
|
||||
break;
|
||||
|
||||
case ITEM00_RECOVERY_HEART:
|
||||
Item_Give(play, ITEM_RECOVERY_HEART);
|
||||
break;
|
||||
|
||||
case ITEM00_FLEXIBLE:
|
||||
case ITEM00_BIG_FAIRY:
|
||||
Health_ChangeBy(play, 0x70);
|
||||
break;
|
||||
|
||||
case ITEM00_BOMBS_A:
|
||||
case ITEM00_BOMBS_B:
|
||||
Item_Give(play, ITEM_BOMBS_5);
|
||||
break;
|
||||
|
||||
case ITEM00_ARROWS_10:
|
||||
Item_Give(play, ITEM_ARROWS_10);
|
||||
break;
|
||||
|
||||
case ITEM00_ARROWS_30:
|
||||
Item_Give(play, ITEM_ARROWS_30);
|
||||
break;
|
||||
|
||||
case ITEM00_ARROWS_40:
|
||||
Item_Give(play, ITEM_ARROWS_40);
|
||||
break;
|
||||
|
||||
case ITEM00_ARROWS_50:
|
||||
Item_Give(play, ITEM_ARROWS_50);
|
||||
break;
|
||||
|
||||
case ITEM00_MAGIC_LARGE:
|
||||
Item_Give(play, ITEM_MAGIC_LARGE);
|
||||
break;
|
||||
|
||||
case ITEM00_MAGIC_SMALL:
|
||||
Item_Give(play, ITEM_MAGIC_SMALL);
|
||||
break;
|
||||
|
||||
case ITEM00_SMALL_KEY:
|
||||
Item_Give(play, ITEM_KEY_SMALL);
|
||||
break;
|
||||
|
||||
case ITEM00_NUTS_1:
|
||||
getItemId = GI_NUTS_1;
|
||||
break;
|
||||
|
||||
case ITEM00_NUTS_10:
|
||||
getItemId = GI_NUTS_10;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ((getItemId != GI_NONE) && (Actor_HasParent(&this->actor, play) == 0)) {
|
||||
if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, play)) {
|
||||
Actor_PickUp(&this->actor, play, getItemId, 50.0f, 20.0f);
|
||||
}
|
||||
|
||||
@@ -277,11 +313,10 @@ void EnItem00_Destroy(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void EnItem00_WaitForHeartObject(EnItem00* this, PlayState* play) {
|
||||
s32 sp1C;
|
||||
s32 objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS);
|
||||
|
||||
sp1C = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS);
|
||||
if (Object_IsLoaded(&play->objectCtx, sp1C)) {
|
||||
this->actor.objBankIndex = sp1C;
|
||||
if (Object_IsLoaded(&play->objectCtx, objBankIndex)) {
|
||||
this->actor.objBankIndex = objBankIndex;
|
||||
this->actionFunc = func_800A640C;
|
||||
}
|
||||
}
|
||||
@@ -327,15 +362,15 @@ void func_800A640C(EnItem00* this, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
if ((this->actor.gravity != 0.0f) && ((this->actor.bgCheckFlags & 1) == 0)) {
|
||||
if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & 1)) {
|
||||
this->actionFunc = func_800A6650;
|
||||
}
|
||||
}
|
||||
|
||||
static Color_RGBA8 D_801ADF10 = { 255, 255, 127, 0 };
|
||||
static Color_RGBA8 D_801ADF14 = { 255, 255, 255, 0 };
|
||||
static Vec3f D_801ADF18 = { 0.0f, 0.1f, 0.0f };
|
||||
static Vec3f D_801ADF24 = { 0.0f, 0.01f, 0.0f };
|
||||
static Color_RGBA8 sEffectPrimColor = { 255, 255, 127, 0 };
|
||||
static Color_RGBA8 sEffectEnvColor = { 255, 255, 255, 0 };
|
||||
static Vec3f sEffectVelocity = { 0.0f, 0.1f, 0.0f };
|
||||
static Vec3f sEffectAccel = { 0.0f, 0.01f, 0.0f };
|
||||
|
||||
void func_800A6650(EnItem00* this, PlayState* play) {
|
||||
u32 pad;
|
||||
@@ -344,20 +379,21 @@ void func_800A6650(EnItem00* this, PlayState* play) {
|
||||
if (this->actor.params <= ITEM00_RUPEE_RED) {
|
||||
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
|
||||
}
|
||||
|
||||
if ((play->gameplayFrames & 1) != 0) {
|
||||
pos.x = this->actor.world.pos.x + randPlusMinusPoint5Scaled(10.0f);
|
||||
pos.y = this->actor.world.pos.y + randPlusMinusPoint5Scaled(10.0f);
|
||||
pos.z = this->actor.world.pos.z + randPlusMinusPoint5Scaled(10.0f);
|
||||
EffectSsKirakira_SpawnSmall(play, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14);
|
||||
EffectSsKirakira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor);
|
||||
}
|
||||
if ((this->actor.bgCheckFlags & 3) != 0) {
|
||||
|
||||
if (this->actor.bgCheckFlags & 3) {
|
||||
if (this->actor.velocity.y > -2.0f) {
|
||||
this->actionFunc = func_800A640C;
|
||||
return;
|
||||
} else {
|
||||
this->actor.velocity.y = this->actor.velocity.y * -0.8f;
|
||||
this->actor.bgCheckFlags &= ~1;
|
||||
}
|
||||
|
||||
this->actor.velocity.y = this->actor.velocity.y * -0.8f;
|
||||
this->actor.bgCheckFlags = this->actor.bgCheckFlags & 0xFFFE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,18 +420,18 @@ void func_800A6780(EnItem00* this, PlayState* play) {
|
||||
}
|
||||
|
||||
if (this->actor.params <= ITEM00_RUPEE_RED) {
|
||||
this->actor.shape.rot.y += 960;
|
||||
this->actor.shape.rot.y += 0x3C0;
|
||||
} else if ((this->actor.params >= ITEM00_SHIELD_HERO) && (this->actor.params != ITEM00_NUTS_10) &&
|
||||
(this->actor.params != ITEM00_BOMBS_0)) {
|
||||
this->actor.world.rot.x -= 700;
|
||||
this->actor.shape.rot.y += 400;
|
||||
this->actor.world.rot.x -= 0x2BC;
|
||||
this->actor.shape.rot.y += 0x190;
|
||||
this->actor.shape.rot.x = this->actor.world.rot.x - 0x4000;
|
||||
}
|
||||
|
||||
if (this->actor.velocity.y <= 2.0f) {
|
||||
var1 = (u16)this->actor.shape.rot.z + 10000;
|
||||
if (var1 < 65535) {
|
||||
this->actor.shape.rot.z += 10000;
|
||||
var1 = (u16)this->actor.shape.rot.z + 0x2710;
|
||||
if (var1 < 0xFFFF) {
|
||||
this->actor.shape.rot.z += 0x2710;
|
||||
} else {
|
||||
this->actor.shape.rot.z = -1;
|
||||
}
|
||||
@@ -405,10 +441,10 @@ void func_800A6780(EnItem00* this, PlayState* play) {
|
||||
pos.x = this->actor.world.pos.x + ((Rand_ZeroOne() - 0.5f) * 10.0f);
|
||||
pos.y = this->actor.world.pos.y + ((Rand_ZeroOne() - 0.5f) * 10.0f);
|
||||
pos.z = this->actor.world.pos.z + ((Rand_ZeroOne() - 0.5f) * 10.0f);
|
||||
EffectSsKirakira_SpawnSmall(play, &pos, &D_801ADF18, &D_801ADF24, &D_801ADF10, &D_801ADF14);
|
||||
EffectSsKirakira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor);
|
||||
}
|
||||
|
||||
if (this->actor.bgCheckFlags & 0x0003) {
|
||||
if (this->actor.bgCheckFlags & 3) {
|
||||
this->actionFunc = func_800A640C;
|
||||
this->actor.shape.rot.z = 0;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
@@ -419,7 +455,7 @@ void func_800A6A40(EnItem00* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (this->getItemId != GI_NONE) {
|
||||
if (Actor_HasParent(&this->actor, play) == 0) {
|
||||
if (!Actor_HasParent(&this->actor, play)) {
|
||||
Actor_PickUp(&this->actor, play, this->getItemId, 50.0f, 80.0f);
|
||||
this->unk152++;
|
||||
} else {
|
||||
@@ -435,7 +471,7 @@ void func_800A6A40(EnItem00* this, PlayState* play) {
|
||||
this->actor.world.pos = player->actor.world.pos;
|
||||
|
||||
if (this->actor.params <= ITEM00_RUPEE_RED) {
|
||||
this->actor.shape.rot.y = this->actor.shape.rot.y + 960;
|
||||
this->actor.shape.rot.y += 0x3C0;
|
||||
} else if (this->actor.params == ITEM00_RECOVERY_HEART) {
|
||||
this->actor.shape.rot.y = 0;
|
||||
}
|
||||
@@ -443,7 +479,7 @@ void func_800A6A40(EnItem00* this, PlayState* play) {
|
||||
this->actor.world.pos.y += (40.0f + (Math_SinS(this->unk152 * 15000) * (this->unk152 * 0.3f)));
|
||||
|
||||
if (LINK_IS_ADULT) {
|
||||
this->actor.world.pos.y = this->actor.world.pos.y + 20.0f;
|
||||
this->actor.world.pos.y += 20.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -500,7 +536,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
if (play->gameOverCtx.state != 0) {
|
||||
if (play->gameOverCtx.state != GAMEOVER_INACTIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -509,78 +545,101 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
|
||||
this->unk1A4 = 1;
|
||||
Item_Give(play, ITEM_RUPEE_GREEN);
|
||||
break;
|
||||
|
||||
case ITEM00_RUPEE_BLUE:
|
||||
this->unk1A4 = 1;
|
||||
Item_Give(play, ITEM_RUPEE_BLUE);
|
||||
break;
|
||||
|
||||
case ITEM00_RUPEE_RED:
|
||||
this->unk1A4 = 1;
|
||||
Item_Give(play, ITEM_RUPEE_RED);
|
||||
break;
|
||||
|
||||
case ITEM00_RUPEE_PURPLE:
|
||||
this->unk1A4 = 1;
|
||||
Item_Give(play, ITEM_RUPEE_PURPLE);
|
||||
break;
|
||||
|
||||
case ITEM00_RUPEE_HUGE:
|
||||
this->unk1A4 = 1;
|
||||
Item_Give(play, ITEM_RUPEE_HUGE);
|
||||
break;
|
||||
|
||||
case ITEM00_STICK:
|
||||
getItemId = GI_STICKS_1;
|
||||
break;
|
||||
|
||||
case ITEM00_NUTS_1:
|
||||
getItemId = GI_NUTS_1;
|
||||
break;
|
||||
|
||||
case ITEM00_NUTS_10:
|
||||
getItemId = GI_NUTS_10;
|
||||
break;
|
||||
|
||||
case ITEM00_RECOVERY_HEART:
|
||||
Item_Give(play, ITEM_RECOVERY_HEART);
|
||||
break;
|
||||
|
||||
case ITEM00_FLEXIBLE:
|
||||
case ITEM00_BIG_FAIRY:
|
||||
Health_ChangeBy(play, 0x70);
|
||||
break;
|
||||
|
||||
case ITEM00_BOMBS_A:
|
||||
case ITEM00_BOMBS_B:
|
||||
Item_Give(play, ITEM_BOMBS_5);
|
||||
break;
|
||||
|
||||
case ITEM00_ARROWS_10:
|
||||
Item_Give(play, ITEM_ARROWS_10);
|
||||
break;
|
||||
|
||||
case ITEM00_ARROWS_30:
|
||||
Item_Give(play, ITEM_ARROWS_30);
|
||||
break;
|
||||
|
||||
case ITEM00_ARROWS_40:
|
||||
Item_Give(play, ITEM_ARROWS_40);
|
||||
break;
|
||||
|
||||
case ITEM00_ARROWS_50:
|
||||
Item_Give(play, ITEM_ARROWS_50);
|
||||
break;
|
||||
|
||||
case ITEM00_SMALL_KEY:
|
||||
getItemId = GI_KEY_SMALL;
|
||||
break;
|
||||
|
||||
case ITEM00_HEART_PIECE:
|
||||
getItemId = GI_HEART_PIECE;
|
||||
break;
|
||||
|
||||
case ITEM00_HEART_CONTAINER:
|
||||
getItemId = GI_HEART_CONTAINER;
|
||||
break;
|
||||
|
||||
case ITEM00_MAGIC_LARGE:
|
||||
Item_Give(play, ITEM_MAGIC_LARGE);
|
||||
break;
|
||||
|
||||
case ITEM00_MAGIC_SMALL:
|
||||
Item_Give(play, ITEM_MAGIC_SMALL);
|
||||
break;
|
||||
|
||||
case ITEM00_SHIELD_HERO:
|
||||
getItemId = GI_SHIELD_HERO;
|
||||
break;
|
||||
|
||||
case ITEM00_MAP:
|
||||
getItemId = GI_MAP;
|
||||
break;
|
||||
|
||||
case ITEM00_COMPASS:
|
||||
getItemId = GI_COMPASS;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -603,6 +662,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -634,11 +694,6 @@ void EnItem00_Update(Actor* thisx, PlayState* play) {
|
||||
this->actionFunc = func_800A6A40;
|
||||
}
|
||||
|
||||
void EnItem00_DrawRupee(EnItem00* this, PlayState* play);
|
||||
void EnItem00_DrawSprite(EnItem00* this, PlayState* play);
|
||||
void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play);
|
||||
void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play);
|
||||
|
||||
void EnItem00_Draw(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnItem00* this = THIS;
|
||||
@@ -652,16 +707,20 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
|
||||
case ITEM00_RUPEE_PURPLE:
|
||||
EnItem00_DrawRupee(this, play);
|
||||
break;
|
||||
|
||||
case ITEM00_HEART_PIECE:
|
||||
EnItem00_DrawHeartPiece(this, play);
|
||||
break;
|
||||
|
||||
case ITEM00_HEART_CONTAINER:
|
||||
EnItem00_DrawHeartContainer(this, play);
|
||||
break;
|
||||
|
||||
case ITEM00_RECOVERY_HEART:
|
||||
if (this->unk152 < 0) {
|
||||
if (this->unk152 == -1) {
|
||||
s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART);
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, bankIndex)) {
|
||||
this->actor.objBankIndex = bankIndex;
|
||||
Actor_SetObjectDependency(play, &this->actor);
|
||||
@@ -673,6 +732,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
// fallthrough
|
||||
case ITEM00_BOMBS_A:
|
||||
case ITEM00_ARROWS_10:
|
||||
case ITEM00_ARROWS_30:
|
||||
@@ -688,14 +748,19 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
|
||||
case ITEM00_BOMBS_0:
|
||||
EnItem00_DrawSprite(this, play);
|
||||
break;
|
||||
|
||||
case ITEM00_SHIELD_HERO:
|
||||
GetItem_Draw(play, GID_SHIELD_HERO);
|
||||
break;
|
||||
|
||||
case ITEM00_MAP:
|
||||
GetItem_Draw(play, GID_DUNGEON_MAP);
|
||||
break;
|
||||
|
||||
case ITEM00_COMPASS:
|
||||
GetItem_Draw(play, GID_COMPASS);
|
||||
break;
|
||||
|
||||
case ITEM00_MASK:
|
||||
case ITEM00_FLEXIBLE:
|
||||
case ITEM00_3_HEARTS:
|
||||
@@ -706,17 +771,13 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
TexturePtr D_801ADF30[] = {
|
||||
gameplay_keep_Tex_061FC0, // Green rupee
|
||||
gameplay_keep_Tex_061FE0, // Blue rupee
|
||||
gameplay_keep_Tex_062000, // Red rupee
|
||||
gameplay_keep_Tex_062040, // Orange rupee
|
||||
gameplay_keep_Tex_062020 // Purple rupee
|
||||
static TexturePtr sRupeeTextures[] = {
|
||||
gRupeeGreenTex, gRupeeBlueTex, gRupeeRedTex, gRupeeOrangeTex, gRupeePurpleTex,
|
||||
};
|
||||
|
||||
void EnItem00_DrawRupee(EnItem00* this, PlayState* play) {
|
||||
s32 pad;
|
||||
s32 iconNb;
|
||||
s32 texIndex;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
@@ -724,67 +785,66 @@ void EnItem00_DrawRupee(EnItem00* this, PlayState* play) {
|
||||
func_800B8050(&this->actor, play, 0);
|
||||
|
||||
if (this->actor.params <= ITEM00_RUPEE_RED) {
|
||||
iconNb = this->actor.params;
|
||||
texIndex = this->actor.params;
|
||||
} else {
|
||||
iconNb = this->actor.params - 0x10;
|
||||
texIndex = this->actor.params - 0x10;
|
||||
}
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_801ADF30[iconNb]));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sRupeeTextures[texIndex]));
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_0622C0); // TODO symbol
|
||||
gSPDisplayList(POLY_OPA_DISP++, gRupeeDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
TexturePtr D_801ADF44[12] = {
|
||||
gameplay_keep_Tex_05E6F0, // Heart (Not used)
|
||||
gameplay_keep_Tex_05CEF0, // Bombs (A), Bombs (0)
|
||||
gameplay_keep_Tex_05BEF0, // Arrows (10)
|
||||
gameplay_keep_Tex_05B6F0, // Arrows (30)
|
||||
gameplay_keep_Tex_05C6F0, // Arrows (40), Arrows (50)
|
||||
gameplay_keep_Tex_05CEF0, // Bombs (B)
|
||||
gameplay_keep_Tex_0607C0, // Nuts (1), Nuts (10)
|
||||
gameplay_keep_Tex_060FC0, // Sticks (1)
|
||||
gameplay_keep_Tex_0617C0, // Magic (Large)
|
||||
gameplay_keep_Tex_05FFC0, // Magic (Small)
|
||||
TexturePtr sItemDropTextures[] = {
|
||||
gDropRecoveryHeartTex, // Heart (Not used)
|
||||
gDropBombTex, // Bombs (A), Bombs (0)
|
||||
gDropArrows1Tex, // Arrows (10)
|
||||
gDropArrows2Tex, // Arrows (30)
|
||||
gDropArrows3Tex, // Arrows (40), Arrows (50)
|
||||
gDropBombTex, // Bombs (B)
|
||||
gDropDekuNutTex, // Nuts (1), Nuts (10)
|
||||
gDropDekuStickTex, // Sticks (1)
|
||||
gDropMagicLargeTex, // Magic (Large)
|
||||
gDropMagicSmallTex, // Magic (Small)
|
||||
NULL,
|
||||
gameplay_keep_Tex_05F7C0 // Small Key
|
||||
gDropKeySmallTex // Small Key
|
||||
};
|
||||
|
||||
void EnItem00_DrawSprite(EnItem00* this, PlayState* play) {
|
||||
s32 iconNb = this->actor.params - 3;
|
||||
s32 texIndex = this->actor.params - 3;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
|
||||
|
||||
if (this->actor.params == ITEM00_NUTS_10) {
|
||||
iconNb = 6;
|
||||
texIndex = 6;
|
||||
} else if (this->actor.params == ITEM00_BOMBS_0) {
|
||||
iconNb = 1;
|
||||
texIndex = 1;
|
||||
} else if (this->actor.params >= ITEM00_ARROWS_30) {
|
||||
iconNb -= 3;
|
||||
texIndex -= 3;
|
||||
if (this->actor.params < ITEM00_ARROWS_50) {
|
||||
iconNb++;
|
||||
texIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_801ADF44[iconNb]));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sItemDropTextures[texIndex]));
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
void EnItem00_DrawHeartContainer(EnItem00* actor, PlayState* play) {
|
||||
s32 pad;
|
||||
s32 pad2;
|
||||
s32 pad[2];
|
||||
|
||||
if (Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS) == actor->actor.objBankIndex) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
@@ -811,7 +871,7 @@ void EnItem00_DrawHeartPiece(EnItem00* this, PlayState* play) {
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
|
||||
gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_05AAB0);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gHeartPieceInteriorDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
@@ -893,7 +953,7 @@ Actor* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, u32 params) {
|
||||
}
|
||||
spawnedActor->speedXZ = 2.0f;
|
||||
spawnedActor->gravity = -0.9f;
|
||||
spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(65536.0f);
|
||||
spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(0x10000);
|
||||
Actor_SetScale(spawnedActor, 0.0f);
|
||||
((EnItem00*)spawnedActor)->actionFunc = func_800A6780;
|
||||
((EnItem00*)spawnedActor)->unk152 = 0xDC;
|
||||
@@ -948,7 +1008,7 @@ Actor* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s32 params) {
|
||||
} else {
|
||||
spawnedActor->gravity = -0.9f;
|
||||
}
|
||||
spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(65536.0f);
|
||||
spawnedActor->world.rot.y = randPlusMinusPoint5Scaled(0x10000);
|
||||
spawnedActor->flags |= 0x10;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "overlays/gamestates/ovl_opening/z_opening.h"
|
||||
#include "overlays/gamestates/ovl_select/z_select.h"
|
||||
#include "overlays/gamestates/ovl_title/z_title.h"
|
||||
#include "z_title_setup.h"
|
||||
|
||||
#define GAMESTATE_OVERLAY(name, init, destroy, size) \
|
||||
{ \
|
||||
@@ -14,13 +15,13 @@
|
||||
{ NULL, 0, 0, NULL, NULL, 0, init, destroy, 0, 0, 0, size }
|
||||
|
||||
GameStateOverlay gGameStateOverlayTable[] = {
|
||||
GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)),
|
||||
GAMESTATE_OVERLAY_INTERNAL(Setup_Init, Setup_Destroy, sizeof(SetupState)),
|
||||
GAMESTATE_OVERLAY(select, MapSelect_Init, MapSelect_Destroy, sizeof(MapSelectState)),
|
||||
GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)),
|
||||
GAMESTATE_OVERLAY(title, ConsoleLogo_Init, ConsoleLogo_Destroy, sizeof(ConsoleLogoState)),
|
||||
GAMESTATE_OVERLAY_INTERNAL(Play_Init, Play_Destroy, sizeof(PlayState)),
|
||||
GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)),
|
||||
GAMESTATE_OVERLAY(file_choose, FileChoose_Init, FileChoose_Destroy, sizeof(FileChooseContext)),
|
||||
GAMESTATE_OVERLAY(daytelop, Daytelop_Init, Daytelop_Destroy, sizeof(DaytelopContext)),
|
||||
GAMESTATE_OVERLAY(opening, TitleSetup_Init, TitleSetup_Destroy, sizeof(TitleSetupState)),
|
||||
GAMESTATE_OVERLAY(file_choose, FileSelect_Init, FileSelect_Destroy, sizeof(FileSelectState)),
|
||||
GAMESTATE_OVERLAY(daytelop, DayTelop_Init, DayTelop_Destroy, sizeof(DayTelopState)),
|
||||
};
|
||||
|
||||
s32 graphNumGameStates = ARRAY_COUNT(gGameStateOverlayTable);
|
||||
|
||||
@@ -75,9 +75,11 @@ void KaleidoSetup_Update(PlayState* play) {
|
||||
if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) {
|
||||
if ((gSaveContext.save.cutscene < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) {
|
||||
if (!Play_InCsMode(play) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF))) {
|
||||
if ((play->unk_1887C < 2) && (gSaveContext.unk_3F28 != 8) && (gSaveContext.unk_3F28 != 9)) {
|
||||
if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) &&
|
||||
(gSaveContext.magicState != MAGIC_STATE_FILL)) {
|
||||
if (!(gSaveContext.eventInf[1] & 0x80) && !(player->stateFlags1 & 0x20)) {
|
||||
if (!(play->actorCtx.unk5 & 2) && !(play->actorCtx.unk5 & 4)) {
|
||||
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
|
||||
!(play->actorCtx.flags & ACTORCTX_FLAG_2)) {
|
||||
if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) {
|
||||
gSaveContext.unk_3F26 = gSaveContext.unk_3F22;
|
||||
pauseCtx->unk_2B9 = 0;
|
||||
@@ -137,7 +139,7 @@ void KaleidoSetup_Init(PlayState* play) {
|
||||
pauseCtx->unk_2A0 = -1;
|
||||
pauseCtx->unk_2BA = 320;
|
||||
pauseCtx->unk_2BC = 40;
|
||||
pauseCtx->unk_29E = 100;
|
||||
pauseCtx->promptAlpha = 100;
|
||||
|
||||
View_Init(&pauseCtx->view, play->state.gfxCtx);
|
||||
}
|
||||
|
||||
+477
-17
@@ -139,11 +139,11 @@ u16 sMinigameScoreDigits[] = { 0, 0, 0, 0 };
|
||||
u16 sCUpInvisible = 0;
|
||||
u16 sCUpTimer = 0;
|
||||
|
||||
s16 sMagicBarOutlinePrimRed = 255;
|
||||
s16 sMagicBarOutlinePrimGreen = 255;
|
||||
s16 sMagicBarOutlinePrimBlue = 255;
|
||||
s16 D_801BF8AC = 2; // sMagicBorderRatio
|
||||
s16 D_801BF8B0 = 1;
|
||||
s16 sMagicMeterOutlinePrimRed = 255;
|
||||
s16 sMagicMeterOutlinePrimGreen = 255;
|
||||
s16 sMagicMeterOutlinePrimBlue = 255;
|
||||
s16 sMagicBorderRatio = 2;
|
||||
s16 sMagicBorderStep = 1;
|
||||
|
||||
s16 sExtraItemBases[] = {
|
||||
ITEM_STICK, // ITEM_STICKS_5
|
||||
@@ -225,10 +225,14 @@ s16 sFinalHoursClockColorTargetIndex = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010CD98.s")
|
||||
|
||||
Gfx* func_8010CFBC(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop,
|
||||
s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy, s16 r, s16 g, s16 b, s16 a);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010CFBC.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010D2D4.s")
|
||||
|
||||
Gfx* func_8010D480(Gfx* displayListHead, void* texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop,
|
||||
s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy, s16 r, s16 g, s16 b, s16 a, s32 argE, s32 argF);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010D480.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010D7D0.s")
|
||||
@@ -600,7 +604,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
||||
return item;
|
||||
|
||||
} else if (item == ITEM_MAGIC_SMALL) {
|
||||
Parameter_AddMagic(play, 0x18);
|
||||
Magic_Add(play, MAGIC_NORMAL_METER / 2);
|
||||
if (!(gSaveContext.save.weekEventReg[12] & 0x80)) {
|
||||
gSaveContext.save.weekEventReg[12] |= 0x80;
|
||||
return ITEM_NONE;
|
||||
@@ -608,7 +612,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
||||
return item;
|
||||
|
||||
} else if (item == ITEM_MAGIC_LARGE) {
|
||||
Parameter_AddMagic(play, 0x30);
|
||||
Magic_Add(play, MAGIC_NORMAL_METER);
|
||||
if (!(gSaveContext.save.weekEventReg[12] & 0x80)) {
|
||||
gSaveContext.save.weekEventReg[12] |= 0x80;
|
||||
return ITEM_NONE;
|
||||
@@ -1145,26 +1149,482 @@ void Inventory_ChangeAmmo(s16 item, s16 ammoChange) {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Parameter_AddMagic.s")
|
||||
void Magic_Add(PlayState* play, s16 magicToAdd) {
|
||||
if (((void)0, gSaveContext.save.playerData.magic) < ((void)0, gSaveContext.magicCapacity)) {
|
||||
gSaveContext.magicToAdd += magicToAdd;
|
||||
gSaveContext.isMagicRequested = true;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115D5C.s")
|
||||
void Magic_Reset(PlayState* play) {
|
||||
if ((gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) && (gSaveContext.magicState != MAGIC_STATE_FILL)) {
|
||||
sMagicMeterOutlinePrimRed = sMagicMeterOutlinePrimGreen = sMagicMeterOutlinePrimBlue = 255;
|
||||
gSaveContext.magicState = MAGIC_STATE_IDLE;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115DB4.s")
|
||||
/**
|
||||
* Request to consume magic.
|
||||
*
|
||||
* @param magicToConsume the positive-valued amount to decrease magic by
|
||||
* @param type how the magic is consumed.
|
||||
* @return false if the request failed
|
||||
*/
|
||||
s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) {
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116088.s")
|
||||
// Magic is not acquired yet
|
||||
if (!gSaveContext.save.playerData.isMagicAcquired) {
|
||||
return false;
|
||||
}
|
||||
|
||||
s16 magicBorderColors[][3] = {
|
||||
// Not enough magic available to consume
|
||||
if ((gSaveContext.save.playerData.magic - magicToConsume) < 0) {
|
||||
if (gSaveContext.magicCapacity != 0) {
|
||||
play_sound(NA_SE_SY_ERROR);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case MAGIC_CONSUME_NOW:
|
||||
case MAGIC_CONSUME_NOW_ALT:
|
||||
// Drain magic immediately e.g. Deku Bubble
|
||||
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) ||
|
||||
(gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
|
||||
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
|
||||
play->actorCtx.lensActive = false;
|
||||
}
|
||||
if (gSaveContext.save.weekEventReg[14] & 8) {
|
||||
// Drank Chateau Romani
|
||||
magicToConsume = 0;
|
||||
}
|
||||
gSaveContext.magicToConsume = magicToConsume;
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP;
|
||||
return true;
|
||||
} else {
|
||||
play_sound(NA_SE_SY_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
case MAGIC_CONSUME_WAIT_NO_PREVIEW:
|
||||
// Sets consume target but waits to consume.
|
||||
// No yellow magic to preview target consumption.
|
||||
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) ||
|
||||
(gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
|
||||
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
|
||||
play->actorCtx.lensActive = false;
|
||||
}
|
||||
if (gSaveContext.save.weekEventReg[14] & 8) {
|
||||
// Drank Chateau Romani
|
||||
magicToConsume = 0;
|
||||
}
|
||||
gSaveContext.magicToConsume = magicToConsume;
|
||||
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_3;
|
||||
return true;
|
||||
} else {
|
||||
play_sound(NA_SE_SY_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
case MAGIC_CONSUME_LENS:
|
||||
if (gSaveContext.magicState == MAGIC_STATE_IDLE) {
|
||||
if (gSaveContext.save.playerData.magic != 0) {
|
||||
interfaceCtx->magicConsumptionTimer = 80;
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_LENS;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
case MAGIC_CONSUME_WAIT_PREVIEW:
|
||||
// Sets consume target but waits to consume.
|
||||
// Preview consumption with a yellow bar. e.g. Spin Attack
|
||||
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) ||
|
||||
(gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
|
||||
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
|
||||
play->actorCtx.lensActive = false;
|
||||
}
|
||||
gSaveContext.magicToConsume = magicToConsume;
|
||||
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_2;
|
||||
return true;
|
||||
} else {
|
||||
play_sound(NA_SE_SY_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
case MAGIC_CONSUME_GORON_ZORA:
|
||||
// Goron spiked rolling or Zora electric barrier
|
||||
if (gSaveContext.save.playerData.magic != 0) {
|
||||
interfaceCtx->magicConsumptionTimer = 10;
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA_SETUP;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
case MAGIC_CONSUME_GIANTS_MASK:
|
||||
// Wearing Giant's Mask
|
||||
if (gSaveContext.magicState == MAGIC_STATE_IDLE) {
|
||||
if (gSaveContext.save.playerData.magic != 0) {
|
||||
interfaceCtx->magicConsumptionTimer = R_MAGIC_CONSUME_TIMER_GIANTS_MASK;
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_GIANTS_MASK;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_GIANTS_MASK) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
case MAGIC_CONSUME_DEITY_BEAM:
|
||||
// Consumes magic immediately
|
||||
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) ||
|
||||
(gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
|
||||
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
|
||||
play->actorCtx.lensActive = false;
|
||||
}
|
||||
if (gSaveContext.save.weekEventReg[14] & 8) {
|
||||
// Drank Chateau Romani
|
||||
magicToConsume = 0;
|
||||
}
|
||||
gSaveContext.save.playerData.magic -= magicToConsume;
|
||||
return true;
|
||||
} else {
|
||||
play_sound(NA_SE_SY_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Magic_UpdateAddRequest(void) {
|
||||
if (gSaveContext.isMagicRequested) {
|
||||
gSaveContext.save.playerData.magic += 4;
|
||||
play_sound(NA_SE_SY_GAUGE_UP - SFX_FLAG);
|
||||
|
||||
if (((void)0, gSaveContext.save.playerData.magic) >= ((void)0, gSaveContext.magicCapacity)) {
|
||||
gSaveContext.save.playerData.magic = gSaveContext.magicCapacity;
|
||||
gSaveContext.magicToAdd = 0;
|
||||
gSaveContext.isMagicRequested = false;
|
||||
} else {
|
||||
gSaveContext.magicToAdd -= 4;
|
||||
if (gSaveContext.magicToAdd <= 0) {
|
||||
gSaveContext.magicToAdd = 0;
|
||||
gSaveContext.isMagicRequested = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s16 sMagicBorderColors[][3] = {
|
||||
{ 255, 255, 255 },
|
||||
{ 150, 150, 150 },
|
||||
};
|
||||
s16 magicBorderIndices[] = { 0, 1, 1, 0 };
|
||||
s16 magicBorderColorTimerIndex[] = { 2, 1, 2, 1 };
|
||||
s16 sMagicBorderIndices[] = { 0, 1, 1, 0 };
|
||||
s16 sMagicBorderColorTimerIndex[] = { 2, 1, 2, 1 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116114.s")
|
||||
void Magic_FlashMeterBorder(void) {
|
||||
s16 borderChangeR;
|
||||
s16 borderChangeG;
|
||||
s16 borderChangeB;
|
||||
s16 index = sMagicBorderIndices[sMagicBorderStep];
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116348.s")
|
||||
borderChangeR = ABS_ALT(sMagicMeterOutlinePrimRed - sMagicBorderColors[index][0]) / sMagicBorderRatio;
|
||||
borderChangeG = ABS_ALT(sMagicMeterOutlinePrimGreen - sMagicBorderColors[index][1]) / sMagicBorderRatio;
|
||||
borderChangeB = ABS_ALT(sMagicMeterOutlinePrimBlue - sMagicBorderColors[index][2]) / sMagicBorderRatio;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116918.s")
|
||||
if (sMagicMeterOutlinePrimRed >= sMagicBorderColors[index][0]) {
|
||||
sMagicMeterOutlinePrimRed -= borderChangeR;
|
||||
} else {
|
||||
sMagicMeterOutlinePrimRed += borderChangeR;
|
||||
}
|
||||
|
||||
if (sMagicMeterOutlinePrimGreen >= sMagicBorderColors[index][1]) {
|
||||
sMagicMeterOutlinePrimGreen -= borderChangeG;
|
||||
} else {
|
||||
sMagicMeterOutlinePrimGreen += borderChangeG;
|
||||
}
|
||||
|
||||
if (sMagicMeterOutlinePrimBlue >= sMagicBorderColors[index][2]) {
|
||||
sMagicMeterOutlinePrimBlue -= borderChangeB;
|
||||
} else {
|
||||
sMagicMeterOutlinePrimBlue += borderChangeB;
|
||||
}
|
||||
|
||||
sMagicBorderRatio--;
|
||||
if (sMagicBorderRatio == 0) {
|
||||
sMagicMeterOutlinePrimRed = sMagicBorderColors[index][0];
|
||||
sMagicMeterOutlinePrimGreen = sMagicBorderColors[index][1];
|
||||
sMagicMeterOutlinePrimBlue = sMagicBorderColors[index][2];
|
||||
|
||||
sMagicBorderRatio = sMagicBorderColorTimerIndex[sMagicBorderStep];
|
||||
|
||||
sMagicBorderStep++;
|
||||
if (sMagicBorderStep >= 4) {
|
||||
sMagicBorderStep = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Magic_Update(PlayState* play) {
|
||||
MessageContext* msgCtx = &play->msgCtx;
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
s16 magicCapacityTarget;
|
||||
|
||||
if (gSaveContext.save.weekEventReg[14] & 8) {
|
||||
// Drank Chateau Romani
|
||||
Magic_FlashMeterBorder();
|
||||
}
|
||||
|
||||
switch (gSaveContext.magicState) {
|
||||
case MAGIC_STATE_STEP_CAPACITY:
|
||||
// Step magicCapacity to the capacity determined by magicLevel
|
||||
// This changes the width of the magic meter drawn
|
||||
magicCapacityTarget = gSaveContext.save.playerData.magicLevel * MAGIC_NORMAL_METER;
|
||||
if (gSaveContext.magicCapacity != magicCapacityTarget) {
|
||||
if (gSaveContext.magicCapacity < magicCapacityTarget) {
|
||||
gSaveContext.magicCapacity += 0x10;
|
||||
if (gSaveContext.magicCapacity > magicCapacityTarget) {
|
||||
gSaveContext.magicCapacity = magicCapacityTarget;
|
||||
}
|
||||
} else {
|
||||
gSaveContext.magicCapacity -= 0x10;
|
||||
if (gSaveContext.magicCapacity <= magicCapacityTarget) {
|
||||
gSaveContext.magicCapacity = magicCapacityTarget;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Once the capacity has reached its target,
|
||||
// follow up by filling magic to magicFillTarget
|
||||
gSaveContext.magicState = MAGIC_STATE_FILL;
|
||||
}
|
||||
break;
|
||||
|
||||
case MAGIC_STATE_FILL:
|
||||
// Add magic until magicFillTarget is reached
|
||||
gSaveContext.save.playerData.magic += 0x10;
|
||||
|
||||
if ((gSaveContext.gameMode == 0) && (gSaveContext.sceneSetupIndex < 4)) {
|
||||
play_sound(NA_SE_SY_GAUGE_UP - SFX_FLAG);
|
||||
}
|
||||
|
||||
if (((void)0, gSaveContext.save.playerData.magic) >= ((void)0, gSaveContext.magicFillTarget)) {
|
||||
gSaveContext.save.playerData.magic = gSaveContext.magicFillTarget;
|
||||
gSaveContext.magicState = MAGIC_STATE_IDLE;
|
||||
}
|
||||
break;
|
||||
|
||||
case MAGIC_STATE_CONSUME_SETUP:
|
||||
// Sets the speed at which magic border flashes
|
||||
sMagicBorderRatio = 2;
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME;
|
||||
break;
|
||||
|
||||
case MAGIC_STATE_CONSUME:
|
||||
// Consume magic until target is reached or no more magic is available
|
||||
if (!(gSaveContext.save.weekEventReg[14] & 8)) {
|
||||
gSaveContext.save.playerData.magic =
|
||||
((void)0, gSaveContext.save.playerData.magic) - ((void)0, gSaveContext.magicToConsume);
|
||||
if (gSaveContext.save.playerData.magic <= 0) {
|
||||
gSaveContext.save.playerData.magic = 0;
|
||||
}
|
||||
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1;
|
||||
sMagicMeterOutlinePrimRed = sMagicMeterOutlinePrimGreen = sMagicMeterOutlinePrimBlue = 255;
|
||||
}
|
||||
// fallthrough (flash border while magic is being consumed)
|
||||
case MAGIC_STATE_METER_FLASH_1:
|
||||
case MAGIC_STATE_METER_FLASH_2:
|
||||
case MAGIC_STATE_METER_FLASH_3:
|
||||
if (!(gSaveContext.save.weekEventReg[14] & 8)) {
|
||||
Magic_FlashMeterBorder();
|
||||
}
|
||||
break;
|
||||
|
||||
case MAGIC_STATE_RESET:
|
||||
sMagicMeterOutlinePrimRed = sMagicMeterOutlinePrimGreen = sMagicMeterOutlinePrimBlue = 255;
|
||||
gSaveContext.magicState = MAGIC_STATE_IDLE;
|
||||
break;
|
||||
|
||||
case MAGIC_STATE_CONSUME_LENS:
|
||||
// Slowly consume magic while Lens of Truth is active
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
(msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
|
||||
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) &&
|
||||
!Play_InCsMode(play)) {
|
||||
|
||||
if ((gSaveContext.save.playerData.magic == 0) ||
|
||||
((func_801242DC(play) >= 2) && (func_801242DC(play) <= 4)) ||
|
||||
((BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) != ITEM_LENS) &&
|
||||
(BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) != ITEM_LENS) &&
|
||||
(BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) != ITEM_LENS)) ||
|
||||
!play->actorCtx.lensActive) {
|
||||
// Deactivate Lens of Truth and set magic state to idle
|
||||
play->actorCtx.lensActive = false;
|
||||
play_sound(NA_SE_SY_GLASSMODE_OFF);
|
||||
gSaveContext.magicState = MAGIC_STATE_IDLE;
|
||||
sMagicMeterOutlinePrimRed = sMagicMeterOutlinePrimGreen = sMagicMeterOutlinePrimBlue = 255;
|
||||
break;
|
||||
}
|
||||
|
||||
interfaceCtx->magicConsumptionTimer--;
|
||||
if (interfaceCtx->magicConsumptionTimer == 0) {
|
||||
if (!(gSaveContext.save.weekEventReg[14] & 8)) {
|
||||
gSaveContext.save.playerData.magic--;
|
||||
}
|
||||
interfaceCtx->magicConsumptionTimer = 80;
|
||||
}
|
||||
}
|
||||
if (!(gSaveContext.save.weekEventReg[14] & 8)) {
|
||||
Magic_FlashMeterBorder();
|
||||
}
|
||||
break;
|
||||
|
||||
case MAGIC_STATE_CONSUME_GORON_ZORA_SETUP:
|
||||
if (!(gSaveContext.save.weekEventReg[14] & 8)) {
|
||||
gSaveContext.save.playerData.magic -= 2;
|
||||
}
|
||||
if (gSaveContext.save.playerData.magic <= 0) {
|
||||
gSaveContext.save.playerData.magic = 0;
|
||||
}
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA;
|
||||
// fallthrough
|
||||
case MAGIC_STATE_CONSUME_GORON_ZORA:
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == 0) && (msgCtx->msgMode == 0) &&
|
||||
(play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
|
||||
(play->transitionMode == TRANS_MODE_OFF)) {
|
||||
if (!Play_InCsMode(play)) {
|
||||
interfaceCtx->magicConsumptionTimer--;
|
||||
if (interfaceCtx->magicConsumptionTimer == 0) {
|
||||
if (!(gSaveContext.save.weekEventReg[14] & 8)) {
|
||||
gSaveContext.save.playerData.magic--;
|
||||
}
|
||||
if (gSaveContext.save.playerData.magic <= 0) {
|
||||
gSaveContext.save.playerData.magic = 0;
|
||||
}
|
||||
interfaceCtx->magicConsumptionTimer = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(gSaveContext.save.weekEventReg[14] & 8)) {
|
||||
Magic_FlashMeterBorder();
|
||||
}
|
||||
break;
|
||||
|
||||
case MAGIC_STATE_CONSUME_GIANTS_MASK:
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
(msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
|
||||
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) {
|
||||
if (!Play_InCsMode(play)) {
|
||||
interfaceCtx->magicConsumptionTimer--;
|
||||
if (interfaceCtx->magicConsumptionTimer == 0) {
|
||||
if (!(gSaveContext.save.weekEventReg[14] & 8)) {
|
||||
gSaveContext.save.playerData.magic--;
|
||||
}
|
||||
if (gSaveContext.save.playerData.magic <= 0) {
|
||||
gSaveContext.save.playerData.magic = 0;
|
||||
}
|
||||
interfaceCtx->magicConsumptionTimer = R_MAGIC_CONSUME_TIMER_GIANTS_MASK;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(gSaveContext.save.weekEventReg[14] & 8)) {
|
||||
Magic_FlashMeterBorder();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
gSaveContext.magicState = MAGIC_STATE_IDLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Magic_DrawMeter(PlayState* play) {
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
s16 magicBarY;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
if (gSaveContext.save.playerData.magicLevel != 0) {
|
||||
if (gSaveContext.save.playerData.healthCapacity > 0xA0) {
|
||||
magicBarY = 42; // two rows of hearts
|
||||
} else {
|
||||
magicBarY = 34; // one row of hearts
|
||||
}
|
||||
|
||||
func_8012C654(play->state.gfxCtx);
|
||||
|
||||
gDPSetEnvColor(OVERLAY_DISP++, 100, 50, 50, 255);
|
||||
|
||||
OVERLAY_DISP = func_8010CFBC(OVERLAY_DISP, gMagicMeterEndTex, 8, 16, 18, magicBarY, 8, 16, 1 << 10, 1 << 10,
|
||||
sMagicMeterOutlinePrimRed, sMagicMeterOutlinePrimGreen, sMagicMeterOutlinePrimBlue,
|
||||
interfaceCtx->magicAlpha);
|
||||
OVERLAY_DISP =
|
||||
func_8010CFBC(OVERLAY_DISP, gMagicMeterMidTex, 24, 16, 26, magicBarY, ((void)0, gSaveContext.magicCapacity),
|
||||
16, 1 << 10, 1 << 10, sMagicMeterOutlinePrimRed, sMagicMeterOutlinePrimGreen,
|
||||
sMagicMeterOutlinePrimBlue, interfaceCtx->magicAlpha);
|
||||
OVERLAY_DISP =
|
||||
func_8010D480(OVERLAY_DISP, gMagicMeterEndTex, 8, 16, ((void)0, gSaveContext.magicCapacity) + 26, magicBarY,
|
||||
8, 16, 1 << 10, 1 << 10, sMagicMeterOutlinePrimRed, sMagicMeterOutlinePrimGreen,
|
||||
sMagicMeterOutlinePrimBlue, interfaceCtx->magicAlpha, 3, 0x100);
|
||||
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE, PRIMITIVE,
|
||||
ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE);
|
||||
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
|
||||
|
||||
if (gSaveContext.magicState == MAGIC_STATE_METER_FLASH_2) {
|
||||
// Yellow part of the meter indicating the amount of magic to be subtracted
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 250, 250, 0, interfaceCtx->magicAlpha);
|
||||
gDPLoadTextureBlock_4b(OVERLAY_DISP++, gMagicMeterFillTex, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTextureRectangle(OVERLAY_DISP++, 104, (magicBarY + 3) << 2,
|
||||
(((void)0, gSaveContext.save.playerData.magic) + 26) << 2, (magicBarY + 10) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
|
||||
// Fill the rest of the meter with the normal magic color
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
if (gSaveContext.save.weekEventReg[14] & 8) {
|
||||
// Blue magic (drank Chateau Romani)
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 200, interfaceCtx->magicAlpha);
|
||||
} else {
|
||||
// Green magic (default)
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 200, 0, interfaceCtx->magicAlpha);
|
||||
}
|
||||
|
||||
gSPTextureRectangle(
|
||||
OVERLAY_DISP++, 104, (magicBarY + 3) << 2,
|
||||
((((void)0, gSaveContext.save.playerData.magic) - ((void)0, gSaveContext.magicToConsume)) + 26) << 2,
|
||||
(magicBarY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
} else {
|
||||
// Fill the whole meter with the normal magic color
|
||||
if (gSaveContext.save.weekEventReg[14] & 8) {
|
||||
// Blue magic (drank Chateau Romani)
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 200, interfaceCtx->magicAlpha);
|
||||
} else {
|
||||
// Green magic (default)
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 200, 0, interfaceCtx->magicAlpha);
|
||||
}
|
||||
|
||||
gDPLoadTextureBlock_4b(OVERLAY_DISP++, gMagicMeterFillTex, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTextureRectangle(OVERLAY_DISP++, 104, (magicBarY + 3) << 2,
|
||||
(((void)0, gSaveContext.save.playerData.magic) + 26) << 2, (magicBarY + 10) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116FD8.s")
|
||||
|
||||
|
||||
+28
-92
@@ -724,43 +724,19 @@ void Play_UpdateTransition(PlayState* this) {
|
||||
}
|
||||
|
||||
if (gSaveContext.gameMode == 4) {
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
state->running = false;
|
||||
} while (0);
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
SET_NEXT_GAMESTATE(state, Opening_Init, OpeningContext);
|
||||
} while (0);
|
||||
STOP_GAMESTATE(&this->state);
|
||||
SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState));
|
||||
} else if (gSaveContext.gameMode != 2) {
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
state->running = false;
|
||||
} while (0);
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
SET_NEXT_GAMESTATE(state, Play_Init, PlayState);
|
||||
} while (0);
|
||||
STOP_GAMESTATE(&this->state);
|
||||
SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
|
||||
gSaveContext.save.entrance = this->nextEntrance;
|
||||
|
||||
if (gSaveContext.minigameState == 1) {
|
||||
gSaveContext.minigameState = 3;
|
||||
}
|
||||
} else {
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
state->running = false;
|
||||
} while (0);
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
SET_NEXT_GAMESTATE(state, FileChoose_Init, FileChooseContext);
|
||||
} while (0);
|
||||
STOP_GAMESTATE(&this->state);
|
||||
SET_NEXT_GAMESTATE(&this->state, FileSelect_Init, sizeof(FileSelectState));
|
||||
}
|
||||
} else {
|
||||
if (this->transitionCtx.transitionType == TRANS_TYPE_21) {
|
||||
@@ -805,16 +781,8 @@ void Play_UpdateTransition(PlayState* this) {
|
||||
this->envCtx.screenFillColor[3] = (sTransitionFillTimer / 20.0f) * 255.0f;
|
||||
|
||||
if (sTransitionFillTimer >= 20) {
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
state->running = false;
|
||||
} while (0);
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
SET_NEXT_GAMESTATE(state, Play_Init, PlayState);
|
||||
} while (0);
|
||||
STOP_GAMESTATE(&this->state);
|
||||
SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
|
||||
gSaveContext.save.entrance = this->nextEntrance;
|
||||
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
||||
this->transitionMode = TRANS_MODE_OFF;
|
||||
@@ -855,16 +823,8 @@ void Play_UpdateTransition(PlayState* this) {
|
||||
|
||||
case TRANS_MODE_INSTANT:
|
||||
if (this->transitionTrigger != TRANS_TRIGGER_END) {
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
state->running = false;
|
||||
} while (0);
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
SET_NEXT_GAMESTATE(state, Play_Init, PlayState);
|
||||
} while (0);
|
||||
STOP_GAMESTATE(&this->state);
|
||||
SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
|
||||
gSaveContext.save.entrance = this->nextEntrance;
|
||||
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
||||
this->transitionMode = TRANS_MODE_OFF;
|
||||
@@ -905,16 +865,8 @@ void Play_UpdateTransition(PlayState* this) {
|
||||
}
|
||||
} else {
|
||||
if (this->envCtx.sandstormEnvA == 255) {
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
state->running = false;
|
||||
} while (0);
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
SET_NEXT_GAMESTATE(state, Play_Init, PlayState);
|
||||
} while (0);
|
||||
STOP_GAMESTATE(&this->state);
|
||||
SET_NEXT_GAMESTATE(&this->state, Play_Init, sizeof(PlayState));
|
||||
gSaveContext.save.entrance = this->nextEntrance;
|
||||
this->transitionTrigger = TRANS_TRIGGER_OFF;
|
||||
this->transitionMode = TRANS_MODE_OFF;
|
||||
@@ -1909,16 +1861,16 @@ void Play_SaveCycleSceneFlags(GameState* thisx) {
|
||||
CycleSceneFlags* cycleSceneFlags;
|
||||
|
||||
cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(this->sceneNum)];
|
||||
cycleSceneFlags->chest = this->actorCtx.flags.chest;
|
||||
cycleSceneFlags->switch0 = this->actorCtx.flags.switches[0];
|
||||
cycleSceneFlags->switch1 = this->actorCtx.flags.switches[1];
|
||||
cycleSceneFlags->chest = this->actorCtx.sceneFlags.chest;
|
||||
cycleSceneFlags->switch0 = this->actorCtx.sceneFlags.switches[0];
|
||||
cycleSceneFlags->switch1 = this->actorCtx.sceneFlags.switches[1];
|
||||
|
||||
if (this->sceneNum == SCENE_INISIE_R) { // Inverted Stone Tower Temple
|
||||
cycleSceneFlags = &gSaveContext.cycleSceneFlags[this->sceneNum];
|
||||
}
|
||||
|
||||
cycleSceneFlags->collectible = this->actorCtx.flags.collectible[0];
|
||||
cycleSceneFlags->clearedRoom = this->actorCtx.flags.clearedRoom;
|
||||
cycleSceneFlags->collectible = this->actorCtx.sceneFlags.collectible[0];
|
||||
cycleSceneFlags->clearedRoom = this->actorCtx.sceneFlags.clearedRoom;
|
||||
}
|
||||
|
||||
void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entrance, s32 roomIndex, s32 playerParams, Vec3f* pos,
|
||||
@@ -1930,9 +1882,9 @@ void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entrance, s32 ro
|
||||
gSaveContext.respawn[respawnMode].pos = *pos;
|
||||
gSaveContext.respawn[respawnMode].yaw = yaw;
|
||||
gSaveContext.respawn[respawnMode].playerParams = playerParams;
|
||||
gSaveContext.respawn[respawnMode].tempSwitchFlags = this->actorCtx.flags.switches[2];
|
||||
gSaveContext.respawn[respawnMode].unk_18 = this->actorCtx.flags.collectible[1];
|
||||
gSaveContext.respawn[respawnMode].tempCollectFlags = this->actorCtx.flags.collectible[2];
|
||||
gSaveContext.respawn[respawnMode].tempSwitchFlags = this->actorCtx.sceneFlags.switches[2];
|
||||
gSaveContext.respawn[respawnMode].unk_18 = this->actorCtx.sceneFlags.collectible[1];
|
||||
gSaveContext.respawn[respawnMode].tempCollectFlags = this->actorCtx.sceneFlags.collectible[2];
|
||||
}
|
||||
|
||||
void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) {
|
||||
@@ -1959,9 +1911,9 @@ void func_80169ECC(PlayState* this) {
|
||||
void func_80169EFC(GameState* thisx) {
|
||||
PlayState* this = (PlayState*)thisx;
|
||||
|
||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwitchFlags = this->actorCtx.flags.switches[2];
|
||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].unk_18 = this->actorCtx.flags.collectible[1];
|
||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.collectible[2];
|
||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwitchFlags = this->actorCtx.sceneFlags.switches[2];
|
||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].unk_18 = this->actorCtx.sceneFlags.collectible[1];
|
||||
gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.sceneFlags.collectible[2];
|
||||
this->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance;
|
||||
gSaveContext.respawnFlag = 1;
|
||||
func_80169ECC(this);
|
||||
@@ -2124,16 +2076,8 @@ void Play_Init(GameState* thisx) {
|
||||
if ((gSaveContext.respawnFlag == -4) || (gSaveContext.respawnFlag == -0x63)) {
|
||||
if (gSaveContext.eventInf[2] & 0x80) {
|
||||
gSaveContext.eventInf[2] &= (u8)~0x80;
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
state->running = false;
|
||||
} while (0);
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
SET_NEXT_GAMESTATE(state, Daytelop_Init, DaytelopContext);
|
||||
} while (0);
|
||||
STOP_GAMESTATE(&this->state);
|
||||
SET_NEXT_GAMESTATE(&this->state, DayTelop_Init, sizeof(DayTelopState));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2147,16 +2091,8 @@ void Play_Init(GameState* thisx) {
|
||||
|
||||
if (gSaveContext.save.entrance == -1) {
|
||||
gSaveContext.save.entrance = 0;
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
state->running = false;
|
||||
} while (0);
|
||||
do {
|
||||
GameState* state = &this->state;
|
||||
|
||||
SET_NEXT_GAMESTATE(state, Opening_Init, OpeningContext);
|
||||
} while (0);
|
||||
STOP_GAMESTATE(&this->state);
|
||||
SET_NEXT_GAMESTATE(&this->state, TitleSetup_Init, sizeof(TitleSetupState));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2267,7 +2203,7 @@ void Play_Init(GameState* thisx) {
|
||||
|
||||
if (((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 1)) || (gSaveContext.save.cutscene >= 0xFFF0)) {
|
||||
gSaveContext.unk_3DC0 = 0;
|
||||
func_80115D5C(&this->state);
|
||||
Magic_Reset(this);
|
||||
gSaveContext.sceneSetupIndex = (gSaveContext.save.cutscene & 0xF) + 1;
|
||||
gSaveContext.save.cutscene = 0;
|
||||
} else {
|
||||
|
||||
+26
-23
@@ -1,23 +1,22 @@
|
||||
#include "global.h"
|
||||
#include "z_prenmi.h"
|
||||
|
||||
void PreNMI_Stop(PreNMIContext* prenmiCtx) {
|
||||
prenmiCtx->state.running = 0;
|
||||
prenmiCtx->state.nextGameStateInit = NULL;
|
||||
prenmiCtx->state.nextGameStateSize = 0;
|
||||
void PreNMI_Stop(PreNMIState* this) {
|
||||
STOP_GAMESTATE(&this->state);
|
||||
SET_NEXT_GAMESTATE(&this->state, NULL, 0);
|
||||
}
|
||||
|
||||
void PreNMI_Update(PreNMIContext* prenmiCtx) {
|
||||
if (prenmiCtx->timer == 0) {
|
||||
void PreNMI_Update(PreNMIState* this) {
|
||||
if (this->timer == 0) {
|
||||
ViConfig_UpdateVi(1);
|
||||
PreNMI_Stop(prenmiCtx);
|
||||
PreNMI_Stop(this);
|
||||
return;
|
||||
}
|
||||
|
||||
prenmiCtx->timer--;
|
||||
this->timer--;
|
||||
}
|
||||
|
||||
void PreNMI_Draw(PreNMIContext* prenmiCtx) {
|
||||
GraphicsContext* gfxCtx = prenmiCtx->state.gfxCtx;
|
||||
void PreNMI_Draw(PreNMIState* this) {
|
||||
GraphicsContext* gfxCtx = this->state.gfxCtx;
|
||||
|
||||
func_8012CF0C(gfxCtx, true, true, 0, 0, 0);
|
||||
|
||||
@@ -26,26 +25,30 @@ void PreNMI_Draw(PreNMIContext* prenmiCtx) {
|
||||
func_8012C470(gfxCtx);
|
||||
|
||||
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(255, 255, 255, 1) << 16) | GPACK_RGBA5551(255, 255, 255, 1));
|
||||
gDPFillRectangle(POLY_OPA_DISP++, 0, prenmiCtx->timer + 100, SCREEN_WIDTH - 1, prenmiCtx->timer + 100);
|
||||
gDPFillRectangle(POLY_OPA_DISP++, 0, this->timer + 100, SCREEN_WIDTH - 1, this->timer + 100);
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
void PreNMI_Main(PreNMIContext* prenmiCtx) {
|
||||
PreNMI_Update(prenmiCtx);
|
||||
PreNMI_Draw(prenmiCtx);
|
||||
void PreNMI_Main(GameState* thisx) {
|
||||
PreNMIState* this = (PreNMIState*)thisx;
|
||||
|
||||
prenmiCtx->state.unk_A3 = 1;
|
||||
PreNMI_Update(this);
|
||||
PreNMI_Draw(this);
|
||||
|
||||
this->state.unk_A3 = 1;
|
||||
}
|
||||
|
||||
void PreNMI_Destroy(PreNMIContext* prenmiCtx) {
|
||||
void PreNMI_Destroy(GameState* thisx) {
|
||||
}
|
||||
|
||||
void PreNMI_Init(PreNMIContext* prenmiCtx) {
|
||||
prenmiCtx->state.main = (GameStateFunc)PreNMI_Main;
|
||||
prenmiCtx->state.destroy = (GameStateFunc)PreNMI_Destroy;
|
||||
prenmiCtx->timer = 30;
|
||||
prenmiCtx->unkA8 = 10;
|
||||
void PreNMI_Init(GameState* thisx) {
|
||||
PreNMIState* this = (PreNMIState*)thisx;
|
||||
|
||||
Game_SetFramerateDivisor(&prenmiCtx->state, 1);
|
||||
this->state.main = PreNMI_Main;
|
||||
this->state.destroy = PreNMI_Destroy;
|
||||
this->timer = 30;
|
||||
this->unkA8 = 10;
|
||||
|
||||
Game_SetFramerateDivisor(&this->state, 1);
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ s32 Snap_RecordPictographedActors(PlayState* play) {
|
||||
// Actors which may be pictographed anywhere
|
||||
switch (actor->id) {
|
||||
case ACTOR_EN_KAKASI:
|
||||
if (GET_KAKASI_ABOVE_GROUND(actor) == 1) {
|
||||
if (KAKASI_GET_ABOVE_GROUND(actor) == 1) {
|
||||
seen |= PICTO_SEEN_ANYWHERE;
|
||||
break; //! @bug break is inside conditional, meaning it falls through if it is false
|
||||
}
|
||||
|
||||
+107
-111
@@ -267,11 +267,11 @@ void Sram_SaveEndOfCycle(PlayState* play) {
|
||||
sceneNum = Play_GetOriginalSceneNumber(play->sceneNum);
|
||||
Play_SaveCycleSceneFlags(&play->state);
|
||||
|
||||
play->actorCtx.flags.chest &= D_801C5FC0[sceneNum][2];
|
||||
play->actorCtx.flags.switches[0] &= D_801C5FC0[sceneNum][0];
|
||||
play->actorCtx.flags.switches[1] &= D_801C5FC0[sceneNum][1];
|
||||
play->actorCtx.flags.collectible[0] &= D_801C5FC0[sceneNum][3];
|
||||
play->actorCtx.flags.clearedRoom = 0;
|
||||
play->actorCtx.sceneFlags.chest &= D_801C5FC0[sceneNum][2];
|
||||
play->actorCtx.sceneFlags.switches[0] &= D_801C5FC0[sceneNum][0];
|
||||
play->actorCtx.sceneFlags.switches[1] &= D_801C5FC0[sceneNum][1];
|
||||
play->actorCtx.sceneFlags.collectible[0] &= D_801C5FC0[sceneNum][3];
|
||||
play->actorCtx.sceneFlags.clearedRoom = 0;
|
||||
|
||||
for (i = 0; i < SCENE_MAX; i++) {
|
||||
gSaveContext.cycleSceneFlags[i].switch0 = ((void)0, gSaveContext.cycleSceneFlags[i].switch0) & D_801C5FC0[i][0];
|
||||
@@ -597,12 +597,12 @@ SavePlayerData sSaveDefaultPlayerData = {
|
||||
0x30, // healthCapacity
|
||||
0x30, // health
|
||||
0, // magicLevel
|
||||
0x30, // magic
|
||||
MAGIC_NORMAL_METER, // magic
|
||||
0, // rupees
|
||||
0, // swordHealth
|
||||
0, // tatlTimer
|
||||
0, // magicAcquired
|
||||
0, // doubleMagic
|
||||
false, // isMagicAcquired
|
||||
false, // isDoubleMagicAcquired
|
||||
0, // doubleDefense
|
||||
0, // unk_1F
|
||||
0xFF, // unk_20
|
||||
@@ -697,12 +697,12 @@ SavePlayerData sSaveDebugPlayerData = {
|
||||
0x80, // healthCapacity
|
||||
0x80, // health
|
||||
0, // magicLevel
|
||||
0x30, // magic
|
||||
0x32, // rupees
|
||||
0x64, // swordHealth
|
||||
MAGIC_NORMAL_METER, // magic
|
||||
50, // rupees
|
||||
100, // swordHealth
|
||||
0, // tatlTimer
|
||||
1, // magicAcquired
|
||||
0, // doubleMagic
|
||||
true, // isMagicAcquired
|
||||
false, // isDoubleMagicAcquired
|
||||
0, // doubleDefense
|
||||
0, // unk_1F
|
||||
0xFF, // unk_20
|
||||
@@ -918,7 +918,7 @@ u16 D_801C6A58[] = {
|
||||
ENTRANCE(IKANA_CANYON, 4), ENTRANCE(STONE_TOWER, 3),
|
||||
};
|
||||
|
||||
void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
void Sram_OpenSave(FileSelectState* fileSelect, SramContext* sramCtx) {
|
||||
s32 i;
|
||||
s32 pad;
|
||||
s32 phi_t1;
|
||||
@@ -930,7 +930,7 @@ void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
|
||||
|
||||
if (gSaveContext.fileNum == 0xFF) {
|
||||
func_80185968(sramCtx->saveBuf, D_801C67C8[0], D_801C67F0[0]);
|
||||
} else if (fileChooseCtx->unk_2446A[gSaveContext.fileNum] != 0) {
|
||||
} else if (fileSelect->unk_2446A[gSaveContext.fileNum] != 0) {
|
||||
phi_t1 = gSaveContext.fileNum + 2;
|
||||
phi_t1 *= 2;
|
||||
|
||||
@@ -1079,8 +1079,8 @@ void func_80145698(SramContext* sramCtx) {
|
||||
|
||||
// Verifies save and use backup if corrupted?
|
||||
#ifdef NON_EQUIVALENT
|
||||
void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
FileChooseContext* fileChooseCtx = fileChooseCtx2;
|
||||
void func_801457CC(FileSelectState* fileSelect2, SramContext* sramCtx) {
|
||||
FileSelectState* fileSelect = fileSelect2;
|
||||
u16 sp7A;
|
||||
// u16 sp78;
|
||||
u16 sp76;
|
||||
@@ -1119,7 +1119,7 @@ void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
}
|
||||
|
||||
if (sp76 < 2) {
|
||||
fileChooseCtx->unk_24468[sp76] = 0;
|
||||
fileSelect->unk_24468[sp76] = 0;
|
||||
if (phi_s2) {
|
||||
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
|
||||
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, D_801C6870[sp64]);
|
||||
@@ -1157,34 +1157,33 @@ void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64 & 0xFFFFFFFF]); // TODO: Needed?
|
||||
|
||||
for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.newf); sp7A++) {
|
||||
fileChooseCtx->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A];
|
||||
fileSelect->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A];
|
||||
}
|
||||
|
||||
if (!CHECK_NEWF(fileChooseCtx->newf[sp76])) {
|
||||
fileChooseCtx->unk_2440C[sp76] = gSaveContext.save.playerData.deaths;
|
||||
if (!CHECK_NEWF(fileSelect->newf[sp76])) {
|
||||
fileSelect->unk_2440C[sp76] = gSaveContext.save.playerData.deaths;
|
||||
|
||||
for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.playerName); sp7A++) {
|
||||
fileChooseCtx->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A];
|
||||
fileSelect->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A];
|
||||
}
|
||||
|
||||
fileChooseCtx->healthCapacity[sp76] = gSaveContext.save.playerData.healthCapacity;
|
||||
fileChooseCtx->health[sp76] = gSaveContext.save.playerData.health;
|
||||
fileChooseCtx->unk_24454[sp76] = gSaveContext.save.inventory.defenseHearts;
|
||||
fileChooseCtx->unk_24444[sp76] = gSaveContext.save.inventory.questItems;
|
||||
fileChooseCtx->unk_24458[sp76] = gSaveContext.save.time;
|
||||
fileChooseCtx->unk_24460[sp76] = gSaveContext.save.day;
|
||||
fileChooseCtx->unk_24468[sp76] = gSaveContext.save.isOwlSave;
|
||||
fileChooseCtx->rupees[sp76] = gSaveContext.save.playerData.rupees;
|
||||
fileChooseCtx->unk_24474[sp76] = CUR_UPG_VALUE(4);
|
||||
fileSelect->healthCapacity[sp76] = gSaveContext.save.playerData.healthCapacity;
|
||||
fileSelect->health[sp76] = gSaveContext.save.playerData.health;
|
||||
fileSelect->unk_24454[sp76] = gSaveContext.save.inventory.defenseHearts;
|
||||
fileSelect->unk_24444[sp76] = gSaveContext.save.inventory.questItems;
|
||||
fileSelect->unk_24458[sp76] = gSaveContext.save.time;
|
||||
fileSelect->unk_24460[sp76] = gSaveContext.save.day;
|
||||
fileSelect->unk_24468[sp76] = gSaveContext.save.isOwlSave;
|
||||
fileSelect->rupees[sp76] = gSaveContext.save.playerData.rupees;
|
||||
fileSelect->unk_24474[sp76] = CUR_UPG_VALUE(4);
|
||||
|
||||
for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) {
|
||||
if (gSaveContext.save.inventory.items[sp7A + 24] != 0xFF) {
|
||||
phi_a0++;
|
||||
}
|
||||
}
|
||||
fileChooseCtx->maskCount[sp76] = phi_a0;
|
||||
fileChooseCtx->heartPieceCount[sp76] =
|
||||
((gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C);
|
||||
fileSelect->maskCount[sp76] = phi_a0;
|
||||
fileSelect->heartPieceCount[sp76] = ((gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C);
|
||||
}
|
||||
|
||||
if (sp6E == 1) {
|
||||
@@ -1209,9 +1208,9 @@ void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
}
|
||||
}
|
||||
} else if (sp76 < 4) {
|
||||
fileChooseCtx->unk_24468[sp76] = 0;
|
||||
fileSelect->unk_24468[sp76] = 0;
|
||||
|
||||
if (!CHECK_NEWF(fileChooseCtx->newf2[(s32)sp76])) { // TODO: Needed?
|
||||
if (!CHECK_NEWF(fileSelect->newf2[(s32)sp76])) { // TODO: Needed?
|
||||
if (phi_s2) {
|
||||
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
|
||||
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf,
|
||||
@@ -1251,34 +1250,34 @@ void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
Sram_CalcChecksum(&gSaveContext, D_801C6870[sp64 & 0xFFFFFFFF]); // TODO: Needed?
|
||||
|
||||
for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.newf); sp7A++) {
|
||||
fileChooseCtx->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A];
|
||||
fileSelect->newf[sp76][sp7A] = gSaveContext.save.playerData.newf[sp7A];
|
||||
}
|
||||
|
||||
if (!CHECK_NEWF(fileChooseCtx->newf[sp76])) {
|
||||
fileChooseCtx->unk_2440C[sp76] = gSaveContext.save.playerData.deaths;
|
||||
if (!CHECK_NEWF(fileSelect->newf[sp76])) {
|
||||
fileSelect->unk_2440C[sp76] = gSaveContext.save.playerData.deaths;
|
||||
|
||||
for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.playerData.playerName); sp7A++) {
|
||||
phi_s2 += 0; // TODO: Needed?
|
||||
fileChooseCtx->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A];
|
||||
fileSelect->unk_24414[sp76][sp7A] = gSaveContext.save.playerData.playerName[sp7A];
|
||||
}
|
||||
|
||||
fileChooseCtx->healthCapacity[sp76] = gSaveContext.save.playerData.healthCapacity;
|
||||
fileChooseCtx->health[sp76] = gSaveContext.save.playerData.health;
|
||||
fileChooseCtx->unk_24454[sp76] = gSaveContext.save.inventory.defenseHearts;
|
||||
fileChooseCtx->unk_24444[sp76] = gSaveContext.save.inventory.questItems;
|
||||
fileChooseCtx->unk_24458[sp76] = gSaveContext.save.time;
|
||||
fileChooseCtx->unk_24460[sp76] = gSaveContext.save.day;
|
||||
fileChooseCtx->unk_24468[sp76] = gSaveContext.save.isOwlSave;
|
||||
fileChooseCtx->rupees[sp76] = gSaveContext.save.playerData.rupees;
|
||||
fileChooseCtx->unk_24474[sp76] = CUR_UPG_VALUE(4);
|
||||
fileSelect->healthCapacity[sp76] = gSaveContext.save.playerData.healthCapacity;
|
||||
fileSelect->health[sp76] = gSaveContext.save.playerData.health;
|
||||
fileSelect->unk_24454[sp76] = gSaveContext.save.inventory.defenseHearts;
|
||||
fileSelect->unk_24444[sp76] = gSaveContext.save.inventory.questItems;
|
||||
fileSelect->unk_24458[sp76] = gSaveContext.save.time;
|
||||
fileSelect->unk_24460[sp76] = gSaveContext.save.day;
|
||||
fileSelect->unk_24468[sp76] = gSaveContext.save.isOwlSave;
|
||||
fileSelect->rupees[sp76] = gSaveContext.save.playerData.rupees;
|
||||
fileSelect->unk_24474[sp76] = CUR_UPG_VALUE(4);
|
||||
|
||||
for (sp7A = 0, phi_a0 = 0; sp7A < 24; sp7A++) {
|
||||
if (gSaveContext.save.inventory.items[sp7A + 24] != 0xFF) {
|
||||
phi_a0++;
|
||||
}
|
||||
}
|
||||
fileChooseCtx->maskCount[sp76] = phi_a0;
|
||||
fileChooseCtx->heartPieceCount[sp76] =
|
||||
fileSelect->maskCount[sp76] = phi_a0;
|
||||
fileSelect->heartPieceCount[sp76] =
|
||||
((gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C);
|
||||
}
|
||||
|
||||
@@ -1342,14 +1341,14 @@ void func_801457CC(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_801457CC.s")
|
||||
#endif
|
||||
|
||||
void func_80146580(FileChooseContext* fileChooseCtx2, SramContext* sramCtx, s32 fileNum) {
|
||||
FileChooseContext* fileChooseCtx = fileChooseCtx2;
|
||||
void func_80146580(FileSelectState* fileSelect2, SramContext* sramCtx, s32 fileNum) {
|
||||
FileSelectState* fileSelect = fileSelect2;
|
||||
s32 pad;
|
||||
|
||||
if (gSaveContext.unk_3F3F) {
|
||||
if (fileChooseCtx->unk_2446A[fileNum]) {
|
||||
if (fileSelect->unk_2446A[fileNum]) {
|
||||
func_80147314(sramCtx, fileNum);
|
||||
fileChooseCtx->unk_2446A[fileNum] = 0;
|
||||
fileSelect->unk_2446A[fileNum] = 0;
|
||||
}
|
||||
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
|
||||
Lib_MemCpy(&gSaveContext, sramCtx->saveBuf, sizeof(Save));
|
||||
@@ -1361,30 +1360,30 @@ void func_80146580(FileChooseContext* fileChooseCtx2, SramContext* sramCtx, s32
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// v0/v1
|
||||
void func_80146628(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
FileChooseContext* fileChooseCtx = fileChooseCtx2;
|
||||
void func_80146628(FileSelectState* fileSelect2, SramContext* sramCtx) {
|
||||
FileSelectState* fileSelect = fileSelect2;
|
||||
u16 i;
|
||||
s16 maskCount;
|
||||
|
||||
if (gSaveContext.unk_3F3F) {
|
||||
if (fileChooseCtx->unk_2446A[fileChooseCtx->unk_2448E]) {
|
||||
func_80147414(sramCtx, fileChooseCtx->unk_2448E, fileChooseCtx->fileNum);
|
||||
fileChooseCtx->unk_24410[fileChooseCtx->fileNum] = gSaveContext.save.playerData.deaths;
|
||||
if (fileSelect->unk_2446A[fileSelect->unk_2448E]) {
|
||||
func_80147414(sramCtx, fileSelect->unk_2448E, fileSelect->fileNum);
|
||||
fileSelect->unk_24410[fileSelect->fileNum] = gSaveContext.save.playerData.deaths;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) {
|
||||
fileChooseCtx->unk_24424[fileChooseCtx->fileNum][i] = gSaveContext.save.playerData.playerName[i];
|
||||
fileSelect->unk_24424[fileSelect->fileNum][i] = gSaveContext.save.playerData.playerName[i];
|
||||
}
|
||||
|
||||
fileChooseCtx->unk_24438[fileChooseCtx->fileNum] = gSaveContext.save.playerData.healthCapacity;
|
||||
fileChooseCtx->unk_24440[fileChooseCtx->fileNum] = gSaveContext.save.playerData.health;
|
||||
fileChooseCtx->unk_24456[fileChooseCtx->fileNum] = gSaveContext.save.inventory.defenseHearts;
|
||||
fileChooseCtx->unk_2444C[fileChooseCtx->fileNum] = gSaveContext.save.inventory.questItems;
|
||||
fileChooseCtx->unk_2445C[fileChooseCtx->fileNum] = gSaveContext.save.time;
|
||||
fileChooseCtx->unk_24464[fileChooseCtx->fileNum] = gSaveContext.save.day;
|
||||
fileChooseCtx->unk_2446A[fileChooseCtx->fileNum] = gSaveContext.save.isOwlSave;
|
||||
fileChooseCtx->unk_24470[fileChooseCtx->fileNum] = gSaveContext.save.playerData.rupees;
|
||||
fileSelect->unk_24438[fileSelect->fileNum] = gSaveContext.save.playerData.healthCapacity;
|
||||
fileSelect->unk_24440[fileSelect->fileNum] = gSaveContext.save.playerData.health;
|
||||
fileSelect->unk_24456[fileSelect->fileNum] = gSaveContext.save.inventory.defenseHearts;
|
||||
fileSelect->unk_2444C[fileSelect->fileNum] = gSaveContext.save.inventory.questItems;
|
||||
fileSelect->unk_2445C[fileSelect->fileNum] = gSaveContext.save.time;
|
||||
fileSelect->unk_24464[fileSelect->fileNum] = gSaveContext.save.day;
|
||||
fileSelect->unk_2446A[fileSelect->fileNum] = gSaveContext.save.isOwlSave;
|
||||
fileSelect->unk_24470[fileSelect->fileNum] = gSaveContext.save.playerData.rupees;
|
||||
// = CUR_UPG_VALUE(UPG_WALLET);
|
||||
fileChooseCtx->unk_24476[fileChooseCtx->fileNum] =
|
||||
fileSelect->unk_24476[fileSelect->fileNum] =
|
||||
(gSaveContext.save.inventory.upgrades & gUpgradeMasks[4]) >> gUpgradeShifts[4];
|
||||
|
||||
for (i = 0, maskCount = 0; i < 24; i++) {
|
||||
@@ -1393,41 +1392,39 @@ void func_80146628(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
fileChooseCtx->unk_2447A[fileChooseCtx->fileNum] = maskCount;
|
||||
fileChooseCtx->unk_2447E[fileChooseCtx->fileNum] =
|
||||
(gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C;
|
||||
fileSelect->unk_2447A[fileSelect->fileNum] = maskCount;
|
||||
fileSelect->unk_2447E[fileSelect->fileNum] = (gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C;
|
||||
}
|
||||
|
||||
// clear buffer
|
||||
bzero(sramCtx->saveBuf, SAVE_BUFFER_SIZE);
|
||||
// read to buffer
|
||||
func_80185968(sramCtx->saveBuf, D_801C67C8[fileChooseCtx->unk_2448E * 2],
|
||||
D_801C67F0[fileChooseCtx->unk_2448E * 2]);
|
||||
func_80185968(sramCtx->saveBuf, D_801C67C8[fileSelect->unk_2448E * 2], D_801C67F0[fileSelect->unk_2448E * 2]);
|
||||
|
||||
if (1) {}
|
||||
func_80185968(&sramCtx->saveBuf[0x2000], D_801C67C8[fileChooseCtx->unk_2448E * 2 + 1],
|
||||
D_801C67F0[fileChooseCtx->unk_2448E * 2 + 1]);
|
||||
func_80185968(&sramCtx->saveBuf[0x2000], D_801C67C8[fileSelect->unk_2448E * 2 + 1],
|
||||
D_801C67F0[fileSelect->unk_2448E * 2 + 1]);
|
||||
if (1) {}
|
||||
|
||||
// copy buffer to save context
|
||||
Lib_MemCpy(&gSaveContext.save, sramCtx->saveBuf, sizeof(Save));
|
||||
|
||||
fileChooseCtx->unk_2440C[fileChooseCtx->fileNum] = gSaveContext.save.playerData.deaths;
|
||||
fileSelect->unk_2440C[fileSelect->fileNum] = gSaveContext.save.playerData.deaths;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) {
|
||||
fileChooseCtx->unk_24414[fileChooseCtx->fileNum][i] = gSaveContext.save.playerData.playerName[i];
|
||||
fileSelect->unk_24414[fileSelect->fileNum][i] = gSaveContext.save.playerData.playerName[i];
|
||||
}
|
||||
|
||||
fileChooseCtx->healthCapacity[fileChooseCtx->fileNum] = gSaveContext.save.playerData.healthCapacity;
|
||||
fileChooseCtx->health[fileChooseCtx->fileNum] = gSaveContext.save.playerData.health;
|
||||
fileChooseCtx->unk_24454[fileChooseCtx->fileNum] = gSaveContext.save.inventory.defenseHearts;
|
||||
fileChooseCtx->unk_24444[fileChooseCtx->fileNum] = gSaveContext.save.inventory.questItems;
|
||||
fileChooseCtx->unk_24458[fileChooseCtx->fileNum] = gSaveContext.save.time;
|
||||
fileChooseCtx->unk_24460[fileChooseCtx->fileNum] = gSaveContext.save.day;
|
||||
fileChooseCtx->unk_24468[fileChooseCtx->fileNum] = gSaveContext.save.isOwlSave;
|
||||
fileChooseCtx->rupees[fileChooseCtx->fileNum] = gSaveContext.save.playerData.rupees;
|
||||
fileSelect->healthCapacity[fileSelect->fileNum] = gSaveContext.save.playerData.healthCapacity;
|
||||
fileSelect->health[fileSelect->fileNum] = gSaveContext.save.playerData.health;
|
||||
fileSelect->unk_24454[fileSelect->fileNum] = gSaveContext.save.inventory.defenseHearts;
|
||||
fileSelect->unk_24444[fileSelect->fileNum] = gSaveContext.save.inventory.questItems;
|
||||
fileSelect->unk_24458[fileSelect->fileNum] = gSaveContext.save.time;
|
||||
fileSelect->unk_24460[fileSelect->fileNum] = gSaveContext.save.day;
|
||||
fileSelect->unk_24468[fileSelect->fileNum] = gSaveContext.save.isOwlSave;
|
||||
fileSelect->rupees[fileSelect->fileNum] = gSaveContext.save.playerData.rupees;
|
||||
// = CUR_UPG_VALUE(UPG_WALLET);
|
||||
fileChooseCtx->unk_24474[fileChooseCtx->fileNum] =
|
||||
fileSelect->unk_24474[fileSelect->fileNum] =
|
||||
(gSaveContext.save.inventory.upgrades & gUpgradeMasks[4]) >> gUpgradeShifts[4];
|
||||
|
||||
for (i = 0, maskCount = 0; i < 24; i++) {
|
||||
@@ -1436,8 +1433,8 @@ void func_80146628(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
fileChooseCtx->maskCount[fileChooseCtx->fileNum] = maskCount;
|
||||
fileChooseCtx->heartPieceCount[fileChooseCtx->fileNum] =
|
||||
fileSelect->maskCount[fileSelect->fileNum] = maskCount;
|
||||
fileSelect->heartPieceCount[fileSelect->fileNum] =
|
||||
(gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C;
|
||||
}
|
||||
|
||||
@@ -1448,21 +1445,20 @@ void func_80146628(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram_NES/func_80146628.s")
|
||||
#endif
|
||||
|
||||
void Sram_InitSave(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
void Sram_InitSave(FileSelectState* fileSelect2, SramContext* sramCtx) {
|
||||
s32 phi_v0;
|
||||
u16 i;
|
||||
FileChooseContext* fileChooseCtx = fileChooseCtx2;
|
||||
FileSelectState* fileSelect = fileSelect2;
|
||||
s16 maskCount;
|
||||
|
||||
if (gSaveContext.unk_3F3F) {
|
||||
Sram_InitNewSave();
|
||||
if (fileChooseCtx->unk_24480 == 0) {
|
||||
if (fileSelect->unk_24480 == 0) {
|
||||
gSaveContext.save.cutscene = 0xFFF0;
|
||||
}
|
||||
|
||||
for (phi_v0 = 0; phi_v0 < ARRAY_COUNT(gSaveContext.save.playerData.playerName); phi_v0++) {
|
||||
gSaveContext.save.playerData.playerName[phi_v0] =
|
||||
fileChooseCtx->unk_24414[fileChooseCtx->unk_24480][phi_v0];
|
||||
gSaveContext.save.playerData.playerName[phi_v0] = fileSelect->unk_24414[fileSelect->unk_24480][phi_v0];
|
||||
}
|
||||
|
||||
gSaveContext.save.playerData.newf[0] = 'Z';
|
||||
@@ -1478,24 +1474,24 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
Lib_MemCpy(&sramCtx->saveBuf[0x2000], &gSaveContext.save, sizeof(Save));
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.newf); i++) {
|
||||
fileChooseCtx->newf[fileChooseCtx->unk_24480][i] = gSaveContext.save.playerData.newf[i];
|
||||
fileSelect->newf[fileSelect->unk_24480][i] = gSaveContext.save.playerData.newf[i];
|
||||
}
|
||||
|
||||
fileChooseCtx->unk_2440C[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.deaths;
|
||||
fileSelect->unk_2440C[fileSelect->unk_24480] = gSaveContext.save.playerData.deaths;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSaveContext.save.playerData.playerName); i++) {
|
||||
fileChooseCtx->unk_24414[fileChooseCtx->unk_24480][i] = gSaveContext.save.playerData.playerName[i];
|
||||
fileSelect->unk_24414[fileSelect->unk_24480][i] = gSaveContext.save.playerData.playerName[i];
|
||||
}
|
||||
|
||||
fileChooseCtx->healthCapacity[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.healthCapacity;
|
||||
fileChooseCtx->health[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.health;
|
||||
fileChooseCtx->unk_24454[fileChooseCtx->unk_24480] = gSaveContext.save.inventory.defenseHearts;
|
||||
fileChooseCtx->unk_24444[fileChooseCtx->unk_24480] = gSaveContext.save.inventory.questItems;
|
||||
fileChooseCtx->unk_24458[fileChooseCtx->unk_24480] = gSaveContext.save.time;
|
||||
fileChooseCtx->unk_24460[fileChooseCtx->unk_24480] = gSaveContext.save.day;
|
||||
fileChooseCtx->unk_24468[fileChooseCtx->unk_24480] = gSaveContext.save.isOwlSave;
|
||||
fileChooseCtx->rupees[fileChooseCtx->unk_24480] = gSaveContext.save.playerData.rupees;
|
||||
fileChooseCtx->unk_24474[fileChooseCtx->unk_24480] = CUR_UPG_VALUE(UPG_WALLET);
|
||||
fileSelect->healthCapacity[fileSelect->unk_24480] = gSaveContext.save.playerData.healthCapacity;
|
||||
fileSelect->health[fileSelect->unk_24480] = gSaveContext.save.playerData.health;
|
||||
fileSelect->unk_24454[fileSelect->unk_24480] = gSaveContext.save.inventory.defenseHearts;
|
||||
fileSelect->unk_24444[fileSelect->unk_24480] = gSaveContext.save.inventory.questItems;
|
||||
fileSelect->unk_24458[fileSelect->unk_24480] = gSaveContext.save.time;
|
||||
fileSelect->unk_24460[fileSelect->unk_24480] = gSaveContext.save.day;
|
||||
fileSelect->unk_24468[fileSelect->unk_24480] = gSaveContext.save.isOwlSave;
|
||||
fileSelect->rupees[fileSelect->unk_24480] = gSaveContext.save.playerData.rupees;
|
||||
fileSelect->unk_24474[fileSelect->unk_24480] = CUR_UPG_VALUE(UPG_WALLET);
|
||||
|
||||
for (i = 0, maskCount = 0; i < 24; i++) {
|
||||
if (gSaveContext.save.inventory.items[i + 24] != ITEM_NONE) {
|
||||
@@ -1503,8 +1499,8 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx2, SramContext* sramCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
fileChooseCtx->maskCount[fileChooseCtx->unk_24480] = maskCount;
|
||||
fileChooseCtx->heartPieceCount[fileChooseCtx->unk_24480] =
|
||||
fileSelect->maskCount[fileSelect->unk_24480] = maskCount;
|
||||
fileSelect->heartPieceCount[fileSelect->unk_24480] =
|
||||
(gSaveContext.save.inventory.questItems & 0xF0000000) >> 0x1C;
|
||||
}
|
||||
|
||||
@@ -1526,9 +1522,9 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
|
||||
func_801A3D98(gSaveContext.options.audioSetting);
|
||||
}
|
||||
|
||||
void Sram_Alloc(GameState* gamestate, SramContext* sramCtx) {
|
||||
void Sram_Alloc(GameState* gameState, SramContext* sramCtx) {
|
||||
if (gSaveContext.unk_3F3F) {
|
||||
sramCtx->saveBuf = THA_AllocEndAlign16(&gamestate->heap, SAVE_BUFFER_SIZE);
|
||||
sramCtx->saveBuf = THA_AllocEndAlign16(&gameState->heap, SAVE_BUFFER_SIZE);
|
||||
sramCtx->status = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ void ArmsHook_Destroy(Actor* thisx, PlayState* play) {
|
||||
ArmsHook* this = THIS;
|
||||
|
||||
if (this->grabbed != NULL) {
|
||||
this->grabbed->flags &= ~0x2000;
|
||||
this->grabbed->flags &= ~ACTOR_FLAG_2000;
|
||||
}
|
||||
Collider_DestroyQuad(play, &this->collider);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ s32 ArmsHook_AttachToPlayer(ArmsHook* this, Player* player) {
|
||||
|
||||
void ArmsHook_DetachHookFromActor(ArmsHook* this) {
|
||||
if (this->grabbed != NULL) {
|
||||
this->grabbed->flags &= ~0x2000;
|
||||
this->grabbed->flags &= ~ACTOR_FLAG_2000;
|
||||
this->grabbed = NULL;
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) {
|
||||
}
|
||||
|
||||
void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) {
|
||||
actor->flags |= 0x2000;
|
||||
actor->flags |= ACTOR_FLAG_2000;
|
||||
this->grabbed = actor;
|
||||
Math_Vec3f_Diff(&actor->world.pos, &this->actor.world.pos, &this->unk1FC);
|
||||
}
|
||||
@@ -140,10 +140,10 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
|
||||
if (this->timer != 0 && (this->collider.base.atFlags & AT_HIT) &&
|
||||
(this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) {
|
||||
Actor* touchedActor = this->collider.base.at;
|
||||
if ((touchedActor->update != NULL) && (touchedActor->flags & 0x600)) {
|
||||
if ((touchedActor->update != NULL) && (touchedActor->flags & (ACTOR_FLAG_200 | ACTOR_FLAG_400))) {
|
||||
if (this->collider.info.atHitInfo->bumperFlags & BUMP_HOOKABLE) {
|
||||
ArmsHook_AttachHookToActor(this, touchedActor);
|
||||
if ((touchedActor->flags & 0x400) == 0x400) {
|
||||
if ((touchedActor->flags & ACTOR_FLAG_400) == ACTOR_FLAG_400) {
|
||||
func_808C1154(this);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +164,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
|
||||
|
||||
grabbed = this->grabbed;
|
||||
if (grabbed != NULL) {
|
||||
if ((grabbed->update == NULL) || (grabbed->flags & 0x2000) != 0x2000) {
|
||||
if ((grabbed->update == NULL) || !CHECK_FLAG_ALL(grabbed->flags, ACTOR_FLAG_2000)) {
|
||||
grabbed = NULL;
|
||||
this->grabbed = NULL;
|
||||
} else {
|
||||
|
||||
@@ -15,7 +15,7 @@ typedef struct ArmsHook {
|
||||
/* 0x1EC */ Vec3f unk1EC;
|
||||
/* 0x1F8 */ Actor* grabbed;
|
||||
/* 0x1FC */ Vec3f unk1FC;
|
||||
/* 0x208 */ char unk208[0x2];
|
||||
/* 0x208 */ UNK_TYPE1 unk208[0x2];
|
||||
/* 0x20A */ s16 timer;
|
||||
/* 0x20C */ ArmsHookActionFunc actionFunc;
|
||||
} ArmsHook; // size = 0x210
|
||||
|
||||
@@ -81,7 +81,7 @@ void ArrowFire_Init(Actor* thisx, PlayState* play) {
|
||||
void ArrowFire_Destroy(Actor* thisx, PlayState* play) {
|
||||
ArrowFire* this = THIS;
|
||||
|
||||
func_80115D5C(&play->state);
|
||||
Magic_Reset(play);
|
||||
Collider_DestroyQuad(play, &this->collider1);
|
||||
Collider_DestroyQuad(play, &this->collider2);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void ArrowIce_Init(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void ArrowIce_Destroy(Actor* thisx, PlayState* play) {
|
||||
func_80115D5C(&play->state);
|
||||
Magic_Reset(play);
|
||||
(void)"消滅"; // Unreferenced in retail, means "Disappearance"
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ void ArrowLight_Init(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void ArrowLight_Destroy(Actor* thisx, PlayState* play) {
|
||||
func_80115D5C(&play->state);
|
||||
Magic_Reset(play);
|
||||
(void)"消滅"; // Unreferenced in retail, means "Disappearance"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File: z_bg_dblue_balance.c
|
||||
* Overlay: ovl_Bg_Dblue_Balance
|
||||
* Description: Great Bay Temple - See-Saw
|
||||
* Description: Great Bay Temple - Seesaw and Waterwheel w/ Platforms
|
||||
*/
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
@@ -43,19 +43,19 @@ const ActorInit Bg_Dblue_Balance_InitVars = {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ Gfx* unk_00;
|
||||
/* 0x04 */ CollisionHeader* unk_04;
|
||||
/* 0x00 */ Gfx* opaDList;
|
||||
/* 0x04 */ CollisionHeader* colHeader;
|
||||
/* 0x08 */ u32 unk_08;
|
||||
/* 0x0C */ f32 unk_0C;
|
||||
/* 0x10 */ f32 unk_10;
|
||||
/* 0x14 */ ActorFunc unk_14;
|
||||
/* 0x18 */ ActorFunc unk_18;
|
||||
} BgDblueBalanceStruct2;
|
||||
/* 0x14 */ ActorFunc update;
|
||||
/* 0x18 */ ActorFunc draw;
|
||||
} BgDblueBalanceTypeInfo; // size = 0x1C
|
||||
|
||||
BgDblueBalanceStruct2 D_80B83A20[] = {
|
||||
BgDblueBalanceTypeInfo sTypeInfo[] = {
|
||||
{
|
||||
object_dblue_object_DL_00B8F8,
|
||||
&object_dblue_object_Colheader_00BC08,
|
||||
gGreatBayTempleObjectSeesawShaftDL,
|
||||
&gGreatBayTempleObjectSeesawShaftCol,
|
||||
0x10,
|
||||
360.0f,
|
||||
300.0f,
|
||||
@@ -63,8 +63,8 @@ BgDblueBalanceStruct2 D_80B83A20[] = {
|
||||
BgDblueBalance_Draw,
|
||||
},
|
||||
{
|
||||
object_dblue_object_DL_00BF48,
|
||||
&object_dblue_object_Colheader_00C180,
|
||||
gGreatBayTempleObjectLargeSeesawPlatformDL,
|
||||
&gGreatBayTempleObjectLargeSeesawPlatformCol,
|
||||
0x10,
|
||||
210.0f,
|
||||
190.0f,
|
||||
@@ -72,8 +72,8 @@ BgDblueBalanceStruct2 D_80B83A20[] = {
|
||||
BgDblueBalance_Draw,
|
||||
},
|
||||
{
|
||||
object_dblue_object_DL_00C4B8,
|
||||
&object_dblue_object_Colheader_00C700,
|
||||
gGreatBayTempleObjectSmallSeesawPlatformDL,
|
||||
&gGreatBayTempleObjectSmallSeesawPlatformCol,
|
||||
0x10,
|
||||
180.0f,
|
||||
180.0f,
|
||||
@@ -81,8 +81,8 @@ BgDblueBalanceStruct2 D_80B83A20[] = {
|
||||
BgDblueBalance_Draw,
|
||||
},
|
||||
{
|
||||
object_dblue_object_DL_001E68,
|
||||
&object_dblue_object_Colheader_002E78,
|
||||
gGreatBayTempleObjectWaterwheelWithPlatformsDL,
|
||||
&gGreatBayTempleObjectWaterwheelWithPlatformsCol,
|
||||
0x30,
|
||||
1500.0f,
|
||||
1500.0f,
|
||||
@@ -311,19 +311,19 @@ void BgDblueBalance_Init(Actor* thisx, PlayState* play) {
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
|
||||
this->dyna.actor.flags = D_80B83A20[sp2C].unk_08;
|
||||
this->dyna.actor.uncullZoneScale = D_80B83A20[sp2C].unk_0C;
|
||||
this->dyna.actor.uncullZoneDownward = D_80B83A20[sp2C].unk_10;
|
||||
this->dyna.actor.update = D_80B83A20[sp2C].unk_14;
|
||||
this->dyna.actor.draw = D_80B83A20[sp2C].unk_18;
|
||||
this->dyna.actor.flags = sTypeInfo[sp2C].unk_08;
|
||||
this->dyna.actor.uncullZoneScale = sTypeInfo[sp2C].unk_0C;
|
||||
this->dyna.actor.uncullZoneDownward = sTypeInfo[sp2C].unk_10;
|
||||
this->dyna.actor.update = sTypeInfo[sp2C].update;
|
||||
this->dyna.actor.draw = sTypeInfo[sp2C].draw;
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, 1);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, D_80B83A20[sp2C].unk_04);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, sTypeInfo[sp2C].colHeader);
|
||||
|
||||
if (sp2C == 3) {
|
||||
D_80B83C70 = Lib_SegmentedToVirtual(object_dblue_object_Matanimheader_00CE00);
|
||||
D_80B83C70 = Lib_SegmentedToVirtual(gGreatBayTempleObjectWaterwheelSplashTexAnim);
|
||||
} else if (sp2C == 0) {
|
||||
D_80B83C74 = Lib_SegmentedToVirtual(object_dblue_object_Matanimheader_00D250);
|
||||
D_80B83C74 = Lib_SegmentedToVirtual(gGreatBayTempleObjectSeesawSplashTexAnim);
|
||||
}
|
||||
|
||||
if (sp2C == 0) {
|
||||
@@ -645,11 +645,11 @@ void func_80B83518(Actor* thisx, PlayState* play) {
|
||||
void BgDblueBalance_Draw(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
BgDblueBalance* this = THIS;
|
||||
BgDblueBalanceStruct2* ptr2 = &D_80B83A20[BGDBLUEBALANCE_GET_300(&this->dyna.actor)];
|
||||
BgDblueBalanceTypeInfo* ptr2 = &sTypeInfo[BGDBLUEBALANCE_GET_300(&this->dyna.actor)];
|
||||
BgDblueBalance* sp38;
|
||||
Gfx* gfx;
|
||||
|
||||
Gfx_DrawDListOpa(play, ptr2->unk_00);
|
||||
Gfx_DrawDListOpa(play, ptr2->opaDList);
|
||||
|
||||
if (!(BGDBLUEBALANCE_GET_300(&this->dyna.actor)) && (this->unk_160 != NULL)) {
|
||||
AnimatedMat_Draw(play, D_80B83C74);
|
||||
@@ -666,7 +666,7 @@ void BgDblueBalance_Draw(Actor* thisx, PlayState* play) {
|
||||
gSPDisplayList(gfx++, &sSetupDL[6 * 25]);
|
||||
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetEnvColor(gfx++, 0, 0, 0, this->unk_183);
|
||||
gSPDisplayList(gfx++, object_dblue_object_DL_00D110);
|
||||
gSPDisplayList(gfx++, gGreatBayTempleObjectSeesawSplashDL);
|
||||
|
||||
POLY_XLU_DISP = gfx;
|
||||
|
||||
@@ -681,7 +681,7 @@ void func_80B83758(Actor* thisx, PlayState* play) {
|
||||
Gfx* gfx;
|
||||
s32 i;
|
||||
BgDblueBalanceStruct* ptr;
|
||||
BgDblueBalanceStruct2* ptr2;
|
||||
BgDblueBalanceTypeInfo* ptr2;
|
||||
s32 temp;
|
||||
|
||||
if (this->unk_178 != 0) {
|
||||
@@ -695,8 +695,8 @@ void func_80B83758(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
if (this->dyna.actor.flags & ACTOR_FLAG_40) {
|
||||
ptr2 = &D_80B83A20[BGDBLUEBALANCE_GET_300(&this->dyna.actor)];
|
||||
Gfx_DrawDListOpa(play, ptr2->unk_00);
|
||||
ptr2 = &sTypeInfo[BGDBLUEBALANCE_GET_300(&this->dyna.actor)];
|
||||
Gfx_DrawDListOpa(play, ptr2->opaDList);
|
||||
|
||||
if (this->unk_183 != 0) {
|
||||
AnimatedMat_Draw(play, D_80B83C70);
|
||||
@@ -717,7 +717,7 @@ void func_80B83758(Actor* thisx, PlayState* play) {
|
||||
temp = ptr->unk_0E * (f32)this->unk_183 * 0.003921569f;
|
||||
gDPSetEnvColor(gfx++, 0, 0, 0, temp);
|
||||
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfx++, object_dblue_object_DL_00CD10);
|
||||
gSPDisplayList(gfx++, gGreatBayTempleObjectWaterwheelSplashDL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File: z_bg_dblue_movebg.c
|
||||
* Overlay: ovl_Bg_Dblue_Movebg
|
||||
* Description: Great Bay Temple - Waterwheels and push switches
|
||||
* Description: Great Bay Temple - Waterwheels, push switches, gear shafts, and whirlpools
|
||||
*/
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
@@ -57,42 +57,42 @@ const ActorInit Bg_Dblue_Movebg_InitVars = {
|
||||
(ActorFunc)BgDblueMovebg_Draw,
|
||||
};
|
||||
|
||||
Gfx* D_80A2B8AC[] = {
|
||||
static Gfx* sOpaDLists[] = {
|
||||
NULL,
|
||||
object_dblue_object_DL_0069D8,
|
||||
gGreatBayTempleObjectTwoWaySwitchDL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
object_dblue_object_DL_004848,
|
||||
object_dblue_object_DL_0061B8,
|
||||
gGreatBayTempleObjectGearShaftWithPlatformsDL,
|
||||
gGreatBayTempleObjectOneWaySwitchDL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
Gfx* D_80A2B8DC[] = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, object_dblue_object_DL_00CAA0, NULL,
|
||||
static Gfx* sXluDLists[] = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, gGreatBayTempleObjectWhirlpoolDL, NULL,
|
||||
};
|
||||
|
||||
CollisionHeader* D_80A2B90C[] = {
|
||||
static CollisionHeader* sColHeaders[] = {
|
||||
NULL,
|
||||
&object_dblue_object_Colheader_006EA8,
|
||||
&gGreatBayTempleObjectTwoWaySwitchCol,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&object_dblue_object_Colheader_00D3DC,
|
||||
&object_dblue_object_Colheader_005D28,
|
||||
&object_dblue_object_Colheader_00714C,
|
||||
&object_dblue_object_Colheader_00AED0,
|
||||
&object_dblue_object_Colheader_00AED0,
|
||||
&gGreatBayTempleObjectUnusedCol,
|
||||
&gGreatBayTempleObjectGearShaftWithPlatformsCol,
|
||||
&gGreatBayTempleObjectOneWaySwitchCol,
|
||||
&gGreatBayTempleObjectWaterwheelCol,
|
||||
&gGreatBayTempleObjectWaterwheelCol,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
AnimatedMaterial* D_80A2B93C[] = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, object_dblue_object_Matanimheader_00CC18, NULL,
|
||||
static AnimatedMaterial* sTexAnims[] = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, gGreatBayTempleObjectWhirlpoolTexAnim, NULL,
|
||||
};
|
||||
|
||||
s16 D_80A2B96C[] = { 0, 0x16C, -0x16C, 0 };
|
||||
@@ -189,13 +189,13 @@ void BgDblueMovebg_Init(Actor* thisx, PlayState* play) {
|
||||
D_80A2BBF4.unk_01 = 1;
|
||||
}
|
||||
|
||||
if (D_80A2B90C[this->unk_160] != NULL) {
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, D_80A2B90C[this->unk_160]);
|
||||
if (sColHeaders[this->unk_160] != NULL) {
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, sColHeaders[this->unk_160]);
|
||||
}
|
||||
|
||||
this->unk_164 = D_80A2B8AC[this->unk_160];
|
||||
this->unk_168 = D_80A2B8DC[this->unk_160];
|
||||
this->unk_16C = D_80A2B93C[this->unk_160];
|
||||
this->opaDList = sOpaDLists[this->unk_160];
|
||||
this->xluDList = sXluDLists[this->unk_160];
|
||||
this->texAnim = sTexAnims[this->unk_160];
|
||||
|
||||
SubS_FillCutscenesList(&this->dyna.actor, this->unk_1B6, ARRAY_COUNT(this->unk_1B6));
|
||||
|
||||
@@ -341,9 +341,9 @@ void func_80A2A1E0(BgDblueMovebg* this, PlayState* play) {
|
||||
this->dyna.actor.shape.rot.y += this->unk_1CC;
|
||||
|
||||
if (play->roomCtx.currRoom.num == 0) {
|
||||
this->unk_164 = object_dblue_object_DL_004848;
|
||||
this->opaDList = gGreatBayTempleObjectGearShaftWithPlatformsDL;
|
||||
} else if (play->roomCtx.currRoom.num == 8) {
|
||||
this->unk_164 = NULL;
|
||||
this->opaDList = NULL;
|
||||
}
|
||||
|
||||
if (play->roomCtx.currRoom.num != this->unk_170) {
|
||||
@@ -678,9 +678,9 @@ void func_80A2AED0(BgDblueMovebg* this, PlayState* play) {
|
||||
}
|
||||
|
||||
if (play->roomCtx.currRoom.num == 0) {
|
||||
this->unk_164 = object_dblue_object_DL_008778;
|
||||
this->opaDList = gGreatBayTempleObjectWaterwheelDL;
|
||||
} else if (play->roomCtx.currRoom.num == 8) {
|
||||
this->unk_164 = object_dblue_object_DL_00A528;
|
||||
this->opaDList = gGreatBayTempleObjectWaterwheelWithFakeGearDL;
|
||||
}
|
||||
|
||||
if (this == D_80A2BBF0) {
|
||||
@@ -756,7 +756,7 @@ void func_80A2B308(Actor* thisx, PlayState* play) {
|
||||
func_8012C28C(play->state.gfxCtx);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, this->unk_164);
|
||||
gSPDisplayList(POLY_OPA_DISP++, this->opaDList);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
@@ -774,34 +774,34 @@ void BgDblueMovebg_Draw(Actor* thisx, PlayState* play2) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
if ((this->unk_160 == 9) || (this->unk_160 == 8) || (this->dyna.actor.flags & ACTOR_FLAG_40)) {
|
||||
if (this->unk_16C != NULL) {
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(this->unk_16C));
|
||||
if (this->texAnim != NULL) {
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(this->texAnim));
|
||||
}
|
||||
|
||||
if ((this->unk_164 != 0) || (this->unk_160 == 6)) {
|
||||
if ((this->opaDList != NULL) || (this->unk_160 == 6)) {
|
||||
gfx2 = Gfx_CallSetupDL(POLY_OPA_DISP, 0x19);
|
||||
|
||||
gSPMatrix(&gfx2[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
if (this->unk_160 == 6) {
|
||||
gSPDisplayList(&gfx2[1], object_dblue_object_DL_0052B8);
|
||||
if (this->unk_164 != 0) {
|
||||
gSPDisplayList(&gfx2[2], this->unk_164);
|
||||
gSPDisplayList(&gfx2[1], gGreatBayTempleObjectGearShaftDL);
|
||||
if (this->opaDList != NULL) {
|
||||
gSPDisplayList(&gfx2[2], this->opaDList);
|
||||
POLY_OPA_DISP = &gfx2[3];
|
||||
} else {
|
||||
POLY_OPA_DISP = &gfx2[2];
|
||||
}
|
||||
} else {
|
||||
gSPDisplayList(&gfx2[1], this->unk_164);
|
||||
gSPDisplayList(&gfx2[1], this->opaDList);
|
||||
POLY_OPA_DISP = &gfx2[2];
|
||||
}
|
||||
}
|
||||
|
||||
if (this->unk_168 != NULL) {
|
||||
if (this->xluDList != NULL) {
|
||||
gfx = func_8012C2B4(POLY_XLU_DISP);
|
||||
|
||||
gSPMatrix(&gfx[0], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(&gfx[1], this->unk_168);
|
||||
gSPDisplayList(&gfx[1], this->xluDList);
|
||||
|
||||
POLY_XLU_DISP = &gfx[2];
|
||||
}
|
||||
@@ -812,7 +812,7 @@ void BgDblueMovebg_Draw(Actor* thisx, PlayState* play2) {
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
|
||||
if ((this->unk_160 == 8) && (this->unk_172 & 0x20)) {
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_dblue_object_Matanimheader_00CE00));
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gGreatBayTempleObjectWaterwheelSplashTexAnim));
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
@@ -844,7 +844,7 @@ void BgDblueMovebg_Draw(Actor* thisx, PlayState* play2) {
|
||||
|
||||
gSPMatrix(gfx++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetEnvColor(gfx++, 255, 255, 255, this->unk_1D8[j][i]);
|
||||
gSPDisplayList(gfx++, object_dblue_object_DL_00CD10);
|
||||
gSPDisplayList(gfx++, gGreatBayTempleObjectWaterwheelSplashDL);
|
||||
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ typedef struct BgDblueMovebg {
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ BgDblueMovebgActionFunc actionFunc;
|
||||
/* 0x160 */ s32 unk_160;
|
||||
/* 0x164 */ Gfx* unk_164;
|
||||
/* 0x168 */ Gfx* unk_168;
|
||||
/* 0x16C */ TexturePtr unk_16C;
|
||||
/* 0x164 */ Gfx* opaDList;
|
||||
/* 0x168 */ Gfx* xluDList;
|
||||
/* 0x16C */ AnimatedMaterial* texAnim;
|
||||
/* 0x170 */ s8 unk_170;
|
||||
/* 0x171 */ s8 unk_171;
|
||||
/* 0x172 */ u16 unk_172;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File: z_bg_dblue_waterfall.c
|
||||
* Overlay: ovl_Bg_Dblue_Waterfall
|
||||
* Description: Great Bay Temple - Freezable Geyser
|
||||
* Description: Great Bay Temple - Freezable Waterfall
|
||||
*/
|
||||
|
||||
#include "z_bg_dblue_waterfall.h"
|
||||
@@ -344,7 +344,7 @@ void BgDblueWaterfall_Init(Actor* thisx, PlayState* play) {
|
||||
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
|
||||
this->unk_190 = Lib_SegmentedToVirtual(object_dblue_object_Matanimheader_00B448);
|
||||
this->unk_190 = Lib_SegmentedToVirtual(gGreatBayTempleObjectWaterfallTexAnim);
|
||||
|
||||
Actor_SetFocus(&this->actor, -100.0f);
|
||||
func_80B84568(this, play);
|
||||
@@ -600,30 +600,30 @@ void BgDblueWaterfall_Draw(Actor* thisx, PlayState* play) {
|
||||
AnimatedMat_Draw(play, this->unk_190);
|
||||
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x8A, 255, 255, 255, sp38);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_00B280);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gGreatBayTempleObjectWaterfallDL);
|
||||
}
|
||||
|
||||
if (this->unk_19F > 0) {
|
||||
if (this->unk_19F < 255) {
|
||||
gSPSegment(POLY_XLU_DISP++, 0x09, D_801AEF88);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x9B, 255, 255, 255, this->unk_19F);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_003358);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gGreatBayTempleObjectIceStalactiteDL);
|
||||
} else {
|
||||
func_8012C28C(play->state.gfxCtx);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, D_801AEFA0);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x9B, 255, 255, 255, 255);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, object_dblue_object_DL_003358);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gGreatBayTempleObjectIceStalactiteDL);
|
||||
}
|
||||
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 255, 255, 255, this->unk_19F);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_003250);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gGreatBayTempleObjectIceStalactiteRimDL);
|
||||
}
|
||||
|
||||
if (this->unk_1A0 > 0) {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 255, 255, 255, this->unk_1A0);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_dblue_object_DL_003770);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gGreatBayTempleObjectFrozenWaterfallDL);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "z_bg_ikana_rotaryroom.h"
|
||||
#include "overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.h"
|
||||
#include "overlays/actors/ovl_En_Torch2/z_en_torch2.h"
|
||||
#include "overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h"
|
||||
#include "objects/object_ikana_obj/object_ikana_obj.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
|
||||
@@ -679,7 +680,8 @@ void func_80B81570(BgIkanaRotaryroom* this, PlayState* play) {
|
||||
sp70.y += this->dyna.actor.world.pos.y;
|
||||
sp70.z += this->dyna.actor.world.pos.z;
|
||||
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, sp70.x, sp70.y, sp70.z, 0, 0, 0, 1);
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, sp70.x, sp70.y, sp70.z, 0, 0, 0,
|
||||
ENWATEREFFECT_TYPE_FALLING_ROCK_SPAWNER);
|
||||
}
|
||||
|
||||
Matrix_Pop();
|
||||
|
||||
@@ -153,7 +153,7 @@ void func_80C0ABA8(BgIkninSusceil* this, PlayState* play) {
|
||||
this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y;
|
||||
if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) {
|
||||
func_80C0A86C(this, play, 4, 14, 1);
|
||||
Flags_UnsetSwitch(play, GET_SUSCEIL_SWITCHFLAG(this));
|
||||
Flags_UnsetSwitch(play, SUSCEIL_GET_SWITCHFLAG(&this->dyna.actor));
|
||||
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND);
|
||||
func_80C0AC74(this);
|
||||
} else {
|
||||
@@ -167,7 +167,7 @@ void func_80C0AC74(BgIkninSusceil* this) {
|
||||
}
|
||||
|
||||
void func_80C0AC90(BgIkninSusceil* this, PlayState* play) {
|
||||
if (Flags_GetSwitch(play, GET_SUSCEIL_SWITCHFLAG(this))) {
|
||||
if (Flags_GetSwitch(play, SUSCEIL_GET_SWITCHFLAG(&this->dyna.actor))) {
|
||||
func_80C0ACD4(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define GET_SUSCEIL_SWITCHFLAG(this) (((this)->dyna.actor.params) & 0x7F)
|
||||
#define SUSCEIL_GET_SWITCHFLAG(thisx) (((thisx)->params) & 0x7F)
|
||||
|
||||
struct BgIkninSusceil;
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ void func_80953F9C(BgIngate* this, PlayState* play) {
|
||||
if (ActorCutscene_GetCurrentIndex() != -1) {
|
||||
Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0);
|
||||
player->stateFlags1 |= 0x20;
|
||||
play->actorCtx.unk5 &= ~0x4;
|
||||
play->actorCtx.flags &= ~ACTORCTX_FLAG_2;
|
||||
} else {
|
||||
Camera_ChangeSetting(mainCam, CAM_SET_BOAT_CRUISE);
|
||||
player->stateFlags1 &= ~0x20;
|
||||
|
||||
@@ -27,9 +27,9 @@ const ActorInit Bg_Inibs_Movebg_InitVars = {
|
||||
(ActorFunc)BgInibsMovebg_Draw,
|
||||
};
|
||||
|
||||
Gfx* D_80B96560[] = { object_inibs_object_DL_0062D8, object_inibs_object_DL_001DC0 };
|
||||
Gfx* D_80B96568[] = { object_inibs_object_DL_006140, object_inibs_object_DL_001C10 };
|
||||
AnimatedMaterial* D_80B96570[] = { object_inibs_object_Matanimheader_006858, object_inibs_object_Matanimheader_002598 };
|
||||
Gfx* sOpaDLists[] = { gTwinmoldArenaNormalModeSandDL, gTwinmoldArenaGiantModeSandDL };
|
||||
Gfx* sXluDLists[] = { gTwinmoldArenaNormalModeCenterPlatformDL, gTwinmoldArenaGiantModeCenterPlatformDL };
|
||||
AnimatedMaterial* sSandTexAnims[] = { gTwinmoldArenaNormalModeSandTexAnim, gTwinmoldArenaGiantModeSandTexAnim };
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP),
|
||||
@@ -41,9 +41,9 @@ void BgInibsMovebg_Init(Actor* thisx, PlayState* play) {
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyActor_Init(&this->dyna, 1);
|
||||
|
||||
this->unk_15C = D_80B96560[BGINIBSMOVEBG_GET_F(thisx)];
|
||||
this->unk_160 = D_80B96568[BGINIBSMOVEBG_GET_F(thisx)];
|
||||
this->unk_164 = D_80B96570[BGINIBSMOVEBG_GET_F(thisx)];
|
||||
this->opaDList = sOpaDLists[BG_INIBS_MOVEBG_GET_MODE(thisx)];
|
||||
this->xluDList = sXluDLists[BG_INIBS_MOVEBG_GET_MODE(thisx)];
|
||||
this->sandTexAnim = sSandTexAnims[BG_INIBS_MOVEBG_GET_MODE(thisx)];
|
||||
}
|
||||
|
||||
void BgInibsMovebg_Destroy(Actor* thisx, PlayState* play) {
|
||||
@@ -54,23 +54,22 @@ void BgInibsMovebg_Destroy(Actor* thisx, PlayState* play) {
|
||||
|
||||
void BgInibsMovebg_Draw(Actor* thisx, PlayState* play) {
|
||||
BgInibsMovebg* this = THIS;
|
||||
AnimatedMaterial* sandTexAnim;
|
||||
Gfx* opaDList;
|
||||
Gfx* xluDList;
|
||||
|
||||
AnimatedMaterial* animMat;
|
||||
Gfx* dl1;
|
||||
Gfx* dl2;
|
||||
|
||||
animMat = this->unk_164;
|
||||
if (animMat != NULL) {
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(this->unk_164));
|
||||
sandTexAnim = this->sandTexAnim;
|
||||
if (sandTexAnim != NULL) {
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(this->sandTexAnim));
|
||||
}
|
||||
|
||||
dl1 = this->unk_15C;
|
||||
if (dl1 != NULL) {
|
||||
Gfx_DrawDListOpa(play, this->unk_15C);
|
||||
opaDList = this->opaDList;
|
||||
if (opaDList != NULL) {
|
||||
Gfx_DrawDListOpa(play, this->opaDList);
|
||||
}
|
||||
|
||||
dl2 = this->unk_160;
|
||||
if (dl2 != NULL) {
|
||||
Gfx_DrawDListXlu(play, this->unk_160);
|
||||
xluDList = this->xluDList;
|
||||
if (xluDList != NULL) {
|
||||
Gfx_DrawDListXlu(play, this->xluDList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
|
||||
struct BgInibsMovebg;
|
||||
|
||||
#define BGINIBSMOVEBG_GET_F(thisx) ((u16)((thisx)->params) & 0xF)
|
||||
#define BG_INIBS_MOVEBG_GET_MODE(thisx) ((u16)((thisx)->params) & 0xF)
|
||||
|
||||
typedef struct BgInibsMovebg {
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ Gfx* unk_15C;
|
||||
/* 0x160 */ Gfx* unk_160;
|
||||
/* 0x164 */ AnimatedMaterial* unk_164;
|
||||
/* 0x15C */ Gfx* opaDList;
|
||||
/* 0x160 */ Gfx* xluDList;
|
||||
/* 0x164 */ AnimatedMaterial* sandTexAnim;
|
||||
} BgInibsMovebg; // size = 0x168
|
||||
|
||||
extern const ActorInit Bg_Inibs_Movebg_InitVars;
|
||||
|
||||
@@ -145,7 +145,7 @@ void BgKin2Bombwall_Init(Actor* thisx, PlayState* play) {
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
bombwallCollider = &this->collider;
|
||||
Collider_InitCylinder(play, bombwallCollider);
|
||||
if (Flags_GetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(this))) {
|
||||
if (Flags_GetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(&this->dyna.actor))) {
|
||||
Actor_MarkForDeath(&this->dyna.actor);
|
||||
} else {
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gOceanSpiderHouseBombableWallCol);
|
||||
@@ -184,7 +184,7 @@ void BgKin2Bombwall_SetupPlayCutscene(BgKin2Bombwall* this) {
|
||||
void BgKin2Bombwall_PlayCutscene(BgKin2Bombwall* this, PlayState* play) {
|
||||
if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) {
|
||||
ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor);
|
||||
Flags_SetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(this));
|
||||
Flags_SetSwitch(play, BG_KIN2_BOMBWALL_SWITCH_FLAG(&this->dyna.actor));
|
||||
SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 60, NA_SE_EV_WALL_BROKEN);
|
||||
func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
this->dyna.actor.draw = NULL;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef Z_BG_KIN2_BOMBWALL_H
|
||||
#define Z_BG_KIN2_BOMBWALL_H
|
||||
|
||||
#define BG_KIN2_BOMBWALL_SWITCH_FLAG(thisx) (thisx->dyna.actor.params & 0x7F)
|
||||
#define BG_KIN2_BOMBWALL_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F)
|
||||
|
||||
#include "global.h"
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ void BgLadder_Init(Actor* thisx, PlayState* play) {
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
|
||||
this->switchFlag = GET_BGLADDER_SWITCHFLAG(thisx);
|
||||
thisx->params = GET_BGLADDER_SIZE(thisx);
|
||||
this->switchFlag = BGLADDER_GET_SWITCHFLAG(thisx);
|
||||
thisx->params = BGLADDER_GET_SIZE(thisx);
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
size = thisx->params;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define GET_BGLADDER_SIZE(actor) ((actor)->params & 0xFF)
|
||||
#define GET_BGLADDER_SWITCHFLAG(actor) (((actor)->params >> 8) & 0xFF)
|
||||
#define BGLADDER_GET_SIZE(thisx) ((thisx)->params & 0xFF)
|
||||
#define BGLADDER_GET_SWITCHFLAG(thisx) (((thisx)->params >> 8) & 0xFF)
|
||||
|
||||
struct BgLadder;
|
||||
|
||||
@@ -18,10 +18,10 @@ typedef struct BgLadder {
|
||||
} BgLadder; // size = 0x164
|
||||
|
||||
typedef enum {
|
||||
LADDER_SIZE_12RUNG,
|
||||
LADDER_SIZE_16RUNG,
|
||||
LADDER_SIZE_20RUNG,
|
||||
LADDER_SIZE_24RUNG,
|
||||
/* 0 */ LADDER_SIZE_12RUNG,
|
||||
/* 1 */ LADDER_SIZE_16RUNG,
|
||||
/* 2 */ LADDER_SIZE_20RUNG,
|
||||
/* 3 */ LADDER_SIZE_24RUNG,
|
||||
} BgLadderSize;
|
||||
|
||||
extern const ActorInit Bg_Ladder_InitVars;
|
||||
|
||||
@@ -43,7 +43,7 @@ void BgLotus_Init(Actor* thisx, PlayState* play) {
|
||||
|
||||
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
|
||||
DynaPolyActor_Init(&this->dyna, 1);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &object_lotus_Colheader_000A20);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gLilyPadCol);
|
||||
this->dyna.actor.floorHeight = BgCheck_EntityRaycastFloor5(&play->colCtx, &thisx->floorPoly, &bgId,
|
||||
&this->dyna.actor, &this->dyna.actor.world.pos);
|
||||
this->timer2 = 96;
|
||||
@@ -171,5 +171,5 @@ void BgLotus_Update(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void BgLotus_Draw(Actor* thisx, PlayState* play) {
|
||||
Gfx_DrawDListOpa(play, object_lotus_DL_000040);
|
||||
Gfx_DrawDListOpa(play, gLilyPadDL);
|
||||
}
|
||||
|
||||
@@ -27,17 +27,25 @@ static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
Gfx* D_80AF0120[] = { object_market_obj_DL_01F050, object_market_obj_DL_018DA0 };
|
||||
Gfx* D_80AF0128[] = { object_market_obj_DL_01EF10, object_market_obj_DL_018C60 };
|
||||
Gfx* sMarketDLs[] = {
|
||||
gWestClockTownMarketDayDL,
|
||||
gWestClockTownMarketNightDL,
|
||||
};
|
||||
|
||||
Gfx* sBankAdvertisementsAndDoorDLs[] = {
|
||||
gWestClockTownMarketBankAdvertisementsAndDoorDayDL,
|
||||
gWestClockTownMarketBankAdvertisementsAndDoorNightDL,
|
||||
};
|
||||
|
||||
void BgMarketStep_Init(Actor* thisx, PlayState* play) {
|
||||
BgMarketStep* this = THIS;
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
}
|
||||
void BgMarketStep_Draw(Actor* thisx, PlayState* play) {
|
||||
s32 index = thisx->params & 1;
|
||||
|
||||
Gfx_DrawDListOpa(play, D_80AF0120[index]);
|
||||
Gfx_DrawDListOpa(play, D_80AF0128[index]);
|
||||
void BgMarketStep_Draw(Actor* thisx, PlayState* play) {
|
||||
s32 timeOfDay = BG_MARKET_STEP_GET_TIME_OF_DAY(thisx);
|
||||
|
||||
Gfx_DrawDListOpa(play, sMarketDLs[timeOfDay]);
|
||||
Gfx_DrawDListOpa(play, sBankAdvertisementsAndDoorDLs[timeOfDay]);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define BG_MARKET_STEP_GET_TIME_OF_DAY(thisx) ((thisx)->params & 1)
|
||||
|
||||
struct BgMarketStep;
|
||||
|
||||
typedef struct BgMarketStep {
|
||||
|
||||
@@ -571,13 +571,13 @@ void Boss02_Init(Actor* thisx, PlayState* play) {
|
||||
} else {
|
||||
this->unk_1D20 = 1;
|
||||
}
|
||||
XREG(41) = KREG(14) + 20;
|
||||
R_MAGIC_CONSUME_TIMER_GIANTS_MASK = KREG(14) + 20;
|
||||
this->unk_01AC = 1.0f;
|
||||
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_TANRON5, 0.0f, 1000.0f, 0.0f, 0, 0, 0, 0);
|
||||
} else if (this->actor.params == TWINMOLD_TAIL) {
|
||||
this->actor.update = Boss02_Tail_Update;
|
||||
this->actor.draw = NULL;
|
||||
this->actor.hintId = 0x2E;
|
||||
this->actor.hintId = TATL_HINT_ID_TWINMOLD;
|
||||
} else {
|
||||
if (this->actor.params != TWINMOLD_BLUE) {
|
||||
this->actor.params = TWINMOLD_RED;
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
* - Seaweed
|
||||
*/
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "z_boss_03.h"
|
||||
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
|
||||
#include "overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h"
|
||||
@@ -724,7 +725,7 @@ void Boss03_ChasePlayer(Boss03* this, PlayState* play) {
|
||||
|
||||
if (sp43 != 0) {
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, player->actor.world.pos.x, this->waterHeight,
|
||||
player->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_309);
|
||||
player->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_TYPE_GYORG_RIPPLES);
|
||||
Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_KONB_SINK_OLD);
|
||||
}
|
||||
|
||||
@@ -1055,7 +1056,7 @@ void Boss03_Charge(Boss03* this, PlayState* play) {
|
||||
play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION);
|
||||
func_800BC848(&this->actor, play, 20, 15);
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, 0.0f, this->waterHeight, 0.0f, 0, 0, 0x96,
|
||||
ENWATEREFFECT_30C);
|
||||
ENWATEREFFECT_TYPE_GYORG_SHOCKWAVE);
|
||||
|
||||
// Player is above water && Player is standing on ground
|
||||
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) {
|
||||
@@ -1528,7 +1529,7 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
|
||||
if ((this->workTimer[WORK_TIMER_UNK0_C] == 0) && ((this->waterHeight - 100.0f) < this->actor.world.pos.y)) {
|
||||
this->workTimer[WORK_TIMER_UNK0_C] = Rand_ZeroFloat(15.0f) + 15.0f;
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->waterHeight,
|
||||
this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_309);
|
||||
this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_TYPE_GYORG_RIPPLES);
|
||||
|
||||
if (this->actionFunc == Boss03_DeathCutscene) {
|
||||
if ((D_809E9840 % 2) != 0) {
|
||||
@@ -1762,7 +1763,7 @@ void Boss03_SetupStunned(Boss03* this, PlayState* play) {
|
||||
}
|
||||
|
||||
void Boss03_Stunned(Boss03* this, PlayState* play) {
|
||||
this->actor.hintId = 0x29;
|
||||
this->actor.hintId = TATL_HINT_ID_GYORG_STUNNED;
|
||||
|
||||
if (this->unk_240 >= 16) {
|
||||
Boss03_PlayUnderwaterSfx(&this->actor.projectedPos, NA_SE_EN_COMMON_WEAKENED - SFX_FLAG);
|
||||
@@ -1955,7 +1956,7 @@ void Boss03_Update(Actor* thisx, PlayState* play2) {
|
||||
s16 j;
|
||||
f32 yRot;
|
||||
|
||||
this->actor.hintId = 0x28;
|
||||
this->actor.hintId = TATL_HINT_ID_GYORG;
|
||||
|
||||
if (!D_809E9842 && (player->actor.world.pos.y < (PLATFORM_HEIGHT + 5.0f))) {
|
||||
D_809E9842 = true;
|
||||
@@ -2012,7 +2013,7 @@ void Boss03_Update(Actor* thisx, PlayState* play2) {
|
||||
}
|
||||
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, this->actor.world.pos.x, this->waterHeight,
|
||||
this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_309);
|
||||
this->actor.world.pos.z, 0, 0, 0x78, ENWATEREFFECT_TYPE_GYORG_RIPPLES);
|
||||
|
||||
this->unk_280 = 27;
|
||||
this->unk_284 = this->actor.world.pos.x;
|
||||
@@ -2428,7 +2429,7 @@ void Boss03_DrawEffects(PlayState* play) {
|
||||
if (!flag) {
|
||||
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0);
|
||||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex));
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex));
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0);
|
||||
|
||||
@@ -2462,7 +2463,7 @@ void Boss03_DrawEffects(PlayState* play) {
|
||||
if (!flag) {
|
||||
func_8012C448(gfxCtx);
|
||||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gDust1Tex));
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gEffDust1Tex));
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 250, 250, 255, 0);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_water_effect_DL_004260);
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ void Boss04_Init(Actor* thisx, PlayState* play2) {
|
||||
this->actor.params = 0x64;
|
||||
Actor_SetScale(&this->actor, 0.1f);
|
||||
this->actor.targetMode = 5;
|
||||
this->actor.hintId = 0x19;
|
||||
this->actor.hintId = TATL_HINT_ID_WART;
|
||||
this->actor.colChkInfo.health = 20;
|
||||
this->actor.colChkInfo.damageTable = &sDamageTable;
|
||||
this->unk_700 = 1.0f;
|
||||
|
||||
@@ -649,7 +649,7 @@ void DemoKankyo_DrawMoonAndGiant(Actor* thisx, PlayState* play2) {
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
if (this->actor.params == DEMO_KANKYO_TYPE_GIANTS) {
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_bubble_DL_001000);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gBubbleDL);
|
||||
} else {
|
||||
gSPDisplayList(POLY_XLU_DISP++, gLightOrbVtxDL);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ Actor* func_80C1C8E8(PlayState* play) {
|
||||
}
|
||||
|
||||
tempActor = foundActor->next;
|
||||
if (tempActor == NULL || NULL) {
|
||||
if (tempActor == NULL || false) {
|
||||
foundActor = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -80,11 +80,11 @@ void DmChar01_Init(Actor* thisx, PlayState* play) {
|
||||
this->unk_348 = 255.0f;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(this->unk_1AC); i++) {
|
||||
this->unk_1AC[i] = ovl_dm_char01_Vtx_1BE0[i].v.ob[1] * 409.6f;
|
||||
this->unk_1AC[i] = gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[1] * 409.6f;
|
||||
}
|
||||
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &object_mtoride_Colheader_009E4C);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodfallSceneryPoisonWaterDamageCol);
|
||||
|
||||
this->unk_34D = true;
|
||||
if (gSaveContext.sceneSetupIndex == 1) {
|
||||
@@ -114,7 +114,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) {
|
||||
this->dyna.actor.world.rot.y += 0x8000;
|
||||
this->dyna.actor.shape.rot.y += 0x8000;
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &object_mtoride_Colheader_010C3C);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodfallSceneryTempleCol);
|
||||
this->unk_34D = true;
|
||||
this->unk_348 = 200.0f;
|
||||
this->actionFunc = func_80AA8F2C;
|
||||
@@ -131,7 +131,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) {
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_ETCETERA, 5.0f, 202.0f, 294.0f, 0, 0, 0,
|
||||
DEKU_FLOWER_PARAMS(DEKU_FLOWER_TYPE_PINK_WITH_INITIAL_BOUNCE));
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &object_mtoride_Colheader_00FE5C);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodfallSceneryTempleRampAndPlatformCol);
|
||||
|
||||
this->unk_34D = true;
|
||||
if (!(gSaveContext.save.weekEventReg[20] & 2)) {
|
||||
@@ -252,8 +252,9 @@ void func_80AA892C(DmChar01* this, PlayState* play) {
|
||||
this->unk_34C = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(ovl_dm_char01_Vtx_1BE0); i++) {
|
||||
s32 temp_s2 = sqrtf(SQ((f32)ovl_dm_char01_Vtx_1BE0[i].v.ob[2]) + SQ((f32)ovl_dm_char01_Vtx_1BE0[i].v.ob[0]));
|
||||
for (i = 0; i < ARRAY_COUNT(gWoodfallSceneryDynamicPoisonWaterVtx); i++) {
|
||||
s32 temp_s2 = sqrtf(SQ((f32)gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[2]) +
|
||||
SQ((f32)gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[0]));
|
||||
f32 cos = Math_CosS((temp_s2 / 1892.0f) * 0x4000);
|
||||
f32 temp_f20 = (1.0f - (ABS_ALT(temp_s2 - D_80AAAE22) / 1892.0f)) * D_80AAAE20 * cos;
|
||||
|
||||
@@ -265,7 +266,7 @@ void func_80AA892C(DmChar01* this, PlayState* play) {
|
||||
temp_f20 += temp_f18;
|
||||
|
||||
this->unk_1AC[i] += 1600;
|
||||
ovl_dm_char01_Vtx_1BE0[i].v.ob[1] = temp_f20;
|
||||
gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[1] = temp_f20;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,8 +298,9 @@ void func_80AA8C28(DmChar01* this, PlayState* play) {
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(ovl_dm_char01_Vtx_1BE0); i++) {
|
||||
s32 temp_s2 = sqrtf(SQ((f32)ovl_dm_char01_Vtx_1BE0[i].v.ob[2]) + SQ((f32)ovl_dm_char01_Vtx_1BE0[i].v.ob[0]));
|
||||
for (i = 0; i < ARRAY_COUNT(gWoodfallSceneryDynamicPoisonWaterVtx); i++) {
|
||||
s32 temp_s2 = sqrtf(SQ((f32)gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[2]) +
|
||||
SQ((f32)gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[0]));
|
||||
f32 cos = Math_CosS((temp_s2 / 1892.0f) * 0x4000);
|
||||
f32 temp_f20 = (1.0f - (ABS_ALT(temp_s2 - D_80AAAE22) / 1892.0f)) * D_80AAAE20 * cos;
|
||||
|
||||
@@ -310,7 +312,7 @@ void func_80AA8C28(DmChar01* this, PlayState* play) {
|
||||
temp_f20 += temp_f18;
|
||||
|
||||
this->unk_1AC[i] += 1600;
|
||||
ovl_dm_char01_Vtx_1BE0[i].v.ob[1] = temp_f20;
|
||||
gWoodfallSceneryDynamicPoisonWaterVtx[i].v.ob[1] = temp_f20;
|
||||
}
|
||||
|
||||
Math_SmoothStepToF(&this->unk_348, 0.0f, 0.02f, 0.6f, 0.4f);
|
||||
@@ -404,18 +406,18 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
|
||||
case DMCHAR01_0:
|
||||
switch (this->unk_34C) {
|
||||
case 0:
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00AA50));
|
||||
Gfx_DrawDListOpa(play, object_mtoride_DL_00A8F8);
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPoisonWaterTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryPoisonWaterDL);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (gSaveContext.sceneSetupIndex == 1) {
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_0110B8));
|
||||
Gfx_DrawDListOpa(play, object_mtoride_DL_010FD8);
|
||||
Gfx_DrawDListXlu(play, object_mtoride_DL_010EF0);
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPurifiedWaterTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryFloorDL);
|
||||
Gfx_DrawDListXlu(play, gWoodfallSceneryPurifiedWaterDL);
|
||||
Matrix_Translate(0.0f, 10.0f, 0.0f, MTXMODE_APPLY);
|
||||
}
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_009D70));
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryDynamicPoisonWaterTexAnim));
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
@@ -426,10 +428,11 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0x96, 255, 255, 255, 255);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0B, Lib_SegmentedToVirtual(ovl_dm_char01_Vtx_1BE0));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0B,
|
||||
Lib_SegmentedToVirtual(gWoodfallSceneryDynamicPoisonWaterVtx));
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, object_mtoride_DL_009928);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gWoodfallSceneryDynamicPoisonWaterDL);
|
||||
} else {
|
||||
func_8012C2DC(play->state.gfxCtx);
|
||||
|
||||
@@ -437,19 +440,20 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, (u8)this->unk_348);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x96, 255, 255, 255, (u8)this->unk_348);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x0B, Lib_SegmentedToVirtual(ovl_dm_char01_Vtx_1BE0));
|
||||
gSPSegment(POLY_XLU_DISP++, 0x0B,
|
||||
Lib_SegmentedToVirtual(gWoodfallSceneryDynamicPoisonWaterVtx));
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_mtoride_DL_009928);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gWoodfallSceneryDynamicPoisonWaterDL);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_0110B8));
|
||||
Gfx_DrawDListOpa(play, object_mtoride_DL_010FD8);
|
||||
Gfx_DrawDListXlu(play, object_mtoride_DL_010EF0);
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPurifiedWaterTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryFloorDL);
|
||||
Gfx_DrawDListXlu(play, gWoodfallSceneryPurifiedWaterDL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -457,23 +461,23 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
|
||||
case DMCHAR01_1:
|
||||
switch (this->unk_34C) {
|
||||
case 0:
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00A5C0));
|
||||
Gfx_DrawDListOpa(play, object_mtoride_DL_00A398);
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPoisonWallsTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryPoisonWallsDL);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00B1A0));
|
||||
Gfx_DrawDListOpa(play, object_mtoride_DL_00AF98);
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPurifiedWallsTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryPurifiedWallsDL);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case DMCHAR01_2:
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00FE90));
|
||||
Gfx_DrawDListOpa(play, object_mtoride_DL_00DF18);
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryTempleTexAnim));
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryTempleDL);
|
||||
|
||||
if ((this->unk_34C != 0) && ((u8)this->unk_348 != 0)) {
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&object_mtoride_Matanimheader_00F768));
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryWaterFlowingOverTempleTexAnim));
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
@@ -484,7 +488,7 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, (u8)this->unk_348);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_mtoride_DL_00F3C0);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gWoodfallSceneryWaterFlowingOverTempleDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
@@ -536,12 +540,12 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
}
|
||||
|
||||
Gfx_DrawDListXlu(play, object_mtoride_DL_00DE50);
|
||||
Gfx_DrawDListXlu(play, gWoodfallSceneryTempleEntrancesDL);
|
||||
break;
|
||||
|
||||
case DMCHAR01_3:
|
||||
if (thisx->world.pos.y > -120.0f) {
|
||||
Gfx_DrawDListOpa(play, object_mtoride_DL_00FAE8);
|
||||
Gfx_DrawDListOpa(play, gWoodfallSceneryTempleRampAndPlatformDL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ typedef enum {
|
||||
|
||||
typedef struct DmChar07 {
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ char pad15C[0x14C];
|
||||
/* 0x15C */ UNK_TYPE1 pad15C[0x14C];
|
||||
/* 0x2A8 */ DmChar07ActionFunc actionFunc;
|
||||
/* 0x2AC */ char pad2AC[0xD];
|
||||
/* 0x2AC */ UNK_TYPE1 pad2AC[0xD];
|
||||
/* 0x2B9 */ u8 spotlightFlags;
|
||||
/* 0x2BA */ u8 isStage;
|
||||
} DmChar07; // size = 0x2BC
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File: z_dm_gm.c
|
||||
* Overlay: ovl_Dm_Gm
|
||||
* Description: Anju (cutscene) (duplicate of Dm_An?)
|
||||
* Description: Complete duplicate of Dm_An
|
||||
*/
|
||||
|
||||
#include "z_dm_gm.h"
|
||||
|
||||
@@ -1089,7 +1089,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
|
||||
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
|
||||
|
||||
} else if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 0)) {
|
||||
if (!(play->actorCtx.unk5 & 2)) {
|
||||
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
|
||||
@@ -1632,7 +1632,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) {
|
||||
this->alpha = 0;
|
||||
this->fadeOutState = SK_FADE_OUT_STATE_NONE;
|
||||
gSaveContext.save.weekEventReg[12] |= 4;
|
||||
if (!(play->actorCtx.unk5 & 2)) {
|
||||
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
} else {
|
||||
this->shouldDraw = false;
|
||||
@@ -1813,9 +1813,10 @@ void DmStk_Update(Actor* thisx, PlayState* play) {
|
||||
|
||||
// This code is responsible for making in-game time pass while using the telescope in the Astral Observatory.
|
||||
// Skull Kid is always loaded in the scene, even if he isn't visible, hence why time always passes.
|
||||
if ((play->actorCtx.unk5 & 2) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) &&
|
||||
!FrameAdvance_IsEnabled(&play->state) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
|
||||
(ActorCutscene_GetCurrentIndex() == -1) && (play->csCtx.state == 0)) {
|
||||
if ((play->actorCtx.flags & ACTORCTX_FLAG_1) && (play->msgCtx.msgMode != 0) &&
|
||||
(play->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&play->state) &&
|
||||
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (ActorCutscene_GetCurrentIndex() == -1) &&
|
||||
(play->csCtx.state == 0)) {
|
||||
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15);
|
||||
if (REG(15) != 0) {
|
||||
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.daySpeed);
|
||||
|
||||
@@ -74,11 +74,11 @@ typedef struct {
|
||||
} ShutterInfo; // size = 0xC
|
||||
|
||||
ShutterInfo D_808A21B0[] = {
|
||||
{ object_bdoor_DL_0000C0, NULL, 130, 12, 50, 15 },
|
||||
{ gBossDoorDL, NULL, 130, 12, 50, 15 },
|
||||
{ gameplay_keep_DL_077990, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
|
||||
{ object_numa_obj_DL_007150, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
|
||||
{ object_hakugin_obj_DL_000128, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
|
||||
{ object_dblue_object_DL_017D00, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
|
||||
{ gGreatBayTempleObjectDoorDL, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
|
||||
{ object_ikana_obj_DL_014A40, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
|
||||
{ object_redead_obj_DL_0001A0, gameplay_keep_DL_078A80, 130, 12, 20, 15 },
|
||||
{ object_ikninside_obj_DL_004440, object_ikninside_obj_DL_005260, 130, 0, 20, 15 },
|
||||
@@ -129,8 +129,7 @@ Vec3f D_808A22C4 = { 120.0f, 0.0f, 0.0f };
|
||||
Vec3f D_808A22D0 = { -90.0f, 0.0f, 0.0f };
|
||||
|
||||
TexturePtr D_808A22DC[] = {
|
||||
object_bdoor_Tex_006BA0, object_bdoor_Tex_005BA0, object_bdoor_Tex_0005C0,
|
||||
object_bdoor_Tex_004BA0, object_bdoor_Tex_003BA0,
|
||||
gBossDoorDefaultTex, gBossDoorWoodfallTex, gBossDoorSnowheadTex, gBossDoorGreatBayTex, gBossDoorStoneTowerTex,
|
||||
};
|
||||
|
||||
void DoorShutter_SetupAction(DoorShutter* this, DoorShutterActionFunc actionFunc) {
|
||||
|
||||
@@ -10,7 +10,7 @@ typedef void (*DoorShutterActionFunc)(struct DoorShutter*, PlayState*);
|
||||
#define DOORSHUTTER_GET_1F(thisx) ((thisx)->params & 0x1F)
|
||||
#define DOORSHUTTER_GET_7F(thisx) ((thisx)->params & 0x7F)
|
||||
#define DOORSHUTTER_GET_380(thisx) (((thisx)->params >> 7) & 7)
|
||||
#define DOORSHUTTER_GET_FC00(thisx) (((u16)(thisx)->params >> 0xA))
|
||||
#define DOORSHUTTER_GET_FC00(thisx) ((u16)(thisx)->params >> 0xA)
|
||||
|
||||
typedef struct DoorShutter {
|
||||
/* 0x0000 */ Actor actor;
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
|
||||
#define THIS ((DoorSpiral*)thisx)
|
||||
|
||||
#define GET_ORIENTATION_PARAM(this) ((((Actor*)(this))->params >> 7) & 0x1)
|
||||
#define GET_UNK145_PARAM(this) ((((Actor*)(this))->params >> 8) & 0x3)
|
||||
#define GET_TRANSITION_ID_PARAM(this) ((u16)((Actor*)(this))->params >> 10)
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ SPIRAL_OVERWORLD, // does not display anything as there is not a DL in GAMEPLAY_KEEP for it
|
||||
/* 1 */ SPIRAL_DUNGEON,
|
||||
@@ -179,7 +175,7 @@ static InitChainEntry sInitChain[] = {
|
||||
void DoorSpiral_Init(Actor* thisx, PlayState* play) {
|
||||
DoorSpiral* this = THIS;
|
||||
s32 pad;
|
||||
s32 transition = GET_TRANSITION_ID_PARAM(thisx);
|
||||
s32 transition = DOORSPIRAL_GET_TRANSITION_ID(thisx);
|
||||
s8 objBankId;
|
||||
|
||||
if (this->actor.room != play->doorCtx.transitionActorList[transition].sides[0].room) {
|
||||
@@ -188,8 +184,8 @@ void DoorSpiral_Init(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
this->unk145 = GET_UNK145_PARAM(thisx); // set but never used
|
||||
this->orientation = GET_ORIENTATION_PARAM(thisx);
|
||||
this->unk145 = DOORSPIRAL_GET_UNK145(thisx); // set but never used
|
||||
this->orientation = DOORSPIRAL_GET_ORIENTATION(thisx);
|
||||
this->objectType = DoorSpiral_GetObjectType(play);
|
||||
objBankId = Object_GetIndex(&play->objectCtx, sSpiralObjectInfo[this->objectType].objectBankId);
|
||||
this->bankIndex = objBankId;
|
||||
@@ -204,7 +200,7 @@ void DoorSpiral_Init(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void DoorSpiral_Destroy(Actor* thisx, PlayState* play) {
|
||||
s32 transition = GET_TRANSITION_ID_PARAM(thisx);
|
||||
s32 transition = DOORSPIRAL_GET_TRANSITION_ID(thisx);
|
||||
|
||||
play->doorCtx.transitionActorList[transition].id *= -1;
|
||||
}
|
||||
@@ -281,7 +277,7 @@ void DoorSpiral_Wait(DoorSpiral* this, PlayState* play) {
|
||||
player->doorType = 4;
|
||||
player->doorDirection = this->orientation;
|
||||
player->doorActor = &this->actor;
|
||||
transition = GET_TRANSITION_ID_PARAM(this);
|
||||
transition = DOORSPIRAL_GET_TRANSITION_ID(&this->actor);
|
||||
player->doorNext = ((u16)play->doorCtx.transitionActorList[transition].params) >> 10;
|
||||
|
||||
func_80122F28(player);
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
|
||||
struct DoorSpiral;
|
||||
|
||||
#define DOORSPIRAL_GET_ORIENTATION(thisx) (((thisx)->params >> 7) & 0x1)
|
||||
#define DOORSPIRAL_GET_UNK145(thisx) (((thisx)->params >> 8) & 0x3)
|
||||
#define DOORSPIRAL_GET_TRANSITION_ID(thisx) ((u16)(thisx)->params >> 10)
|
||||
|
||||
typedef void (*DoorSpiralActionFunc)(struct DoorSpiral*, PlayState*);
|
||||
|
||||
typedef struct DoorSpiral {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* File: z_door_warp1.c
|
||||
* Overlay: ovl_Door_Warp1
|
||||
* Description: Blue Warp
|
||||
* Description: Blue warp portal and crystal, and the Majora's Mask-shaped boss warp platform
|
||||
*/
|
||||
|
||||
#include "z_door_warp1.h"
|
||||
@@ -152,7 +152,7 @@ void DoorWarp1_Init(Actor* thisx, PlayState* play) {
|
||||
case ENDOORWARP1_FF_5:
|
||||
this->unk_1D3 = 1;
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &object_warp1_Colheader_008BD4);
|
||||
DynaPolyActor_LoadMesh(play, &this->dyna, &gWarpBossWarpPlatformCol);
|
||||
func_808B8C48(this, play);
|
||||
break;
|
||||
|
||||
@@ -210,8 +210,8 @@ void func_808B8924(DoorWarp1* this, PlayState* play) {
|
||||
}
|
||||
|
||||
void func_808B8A7C(DoorWarp1* this, PlayState* play) {
|
||||
SkelAnime_Init(play, &this->skelAnime, &object_warp1_Skel_002CA8, &object_warp1_Anim_001374, NULL, NULL, 0);
|
||||
Animation_ChangeImpl(&this->skelAnime, &object_warp1_Anim_001374, 1.0f, 1.0f, 1.0f, 2, 40.0f, 1);
|
||||
SkelAnime_Init(play, &this->skelAnime, &gWarpCrystalSkel, &gWarpCrystalAnim, NULL, NULL, 0);
|
||||
Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 1.0f, 1.0f, 1.0f, 2, 40.0f, 1);
|
||||
this->unk_1C4 = 0;
|
||||
this->unk_1C6 = -140;
|
||||
this->unk_1C8 = -80;
|
||||
@@ -622,9 +622,8 @@ void func_808B9FD0(DoorWarp1* this, PlayState* play) {
|
||||
ActorCutscene_Start(play->playerActorCsIds[9], NULL);
|
||||
AudioSfx_PlaySfx(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
Animation_ChangeImpl(&this->skelAnime, &object_warp1_Anim_001374, 1.0f,
|
||||
Animation_GetLastFrame(&object_warp1_Anim_001374.common),
|
||||
Animation_GetLastFrame(&object_warp1_Anim_001374.common), 2, 40.0f, 1);
|
||||
Animation_ChangeImpl(&this->skelAnime, &gWarpCrystalAnim, 1.0f, Animation_GetLastFrame(&gWarpCrystalAnim),
|
||||
Animation_GetLastFrame(&gWarpCrystalAnim), 2, 40.0f, 1);
|
||||
this->unk_1CA = 50;
|
||||
D_808BC004 = player2->actor.world.pos.y;
|
||||
DoorWarp1_SetupAction(this, func_808BA550);
|
||||
@@ -992,7 +991,7 @@ void func_808BAE9C(DoorWarp1* this, PlayState* play) {
|
||||
MTXMODE_APPLY);
|
||||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(play->state.gfxCtx));
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_0001A0);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gWarpPortalDL);
|
||||
|
||||
Matrix_Pop();
|
||||
|
||||
@@ -1010,14 +1009,14 @@ void func_808BAE9C(DoorWarp1* this, PlayState* play) {
|
||||
MTXMODE_APPLY);
|
||||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x09, Matrix_NewMtx(play->state.gfxCtx));
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_0001A0);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gWarpPortalDL);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
void func_808BB4C4(DoorWarp1* this, PlayState* play) {
|
||||
Gfx_DrawDListOpa(play, object_warp1_DL_0076C0);
|
||||
Gfx_DrawDListOpa(play, gWarpBossWarpPlatformDL);
|
||||
}
|
||||
|
||||
void func_808BB4F4(DoorWarp1* this, PlayState* play2) {
|
||||
@@ -1035,8 +1034,8 @@ void func_808BB4F4(DoorWarp1* this, PlayState* play2) {
|
||||
Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + this->unk_1A4,
|
||||
this->dyna.actor.world.pos.z, MTXMODE_NEW);
|
||||
Matrix_Scale(4.0f, this->unk_1AC, 4.0f, MTXMODE_APPLY);
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_warp1_Matanimheader_0044D8));
|
||||
Gfx_DrawDListXlu(play, object_warp1_DL_003230);
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWarpBossWarpActivationBeamTexAnim));
|
||||
Gfx_DrawDListXlu(play, gWarpBossWarpActivationBeamDL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1054,7 +1053,7 @@ void func_808BB4F4(DoorWarp1* this, PlayState* play2) {
|
||||
MTXMODE_NEW);
|
||||
Matrix_RotateYS(this->dyna.actor.world.rot.y, MTXMODE_APPLY);
|
||||
Matrix_Scale(1.0f, this->unk_1A8, 1.0f, MTXMODE_APPLY);
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_warp1_Matanimheader_0057D8));
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWarpBossWarpLightShaftsTexAnim));
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
@@ -1063,13 +1062,13 @@ void func_808BB4F4(DoorWarp1* this, PlayState* play2) {
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, sp64[sp60].r, sp64[sp60].g, sp64[sp60].b, 255);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, 255);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_004690);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gWarpBossWarpLightShaftsDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(object_warp1_Matanimheader_007238));
|
||||
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gWarpBossWarpGlowTexAnim));
|
||||
Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
|
||||
MTXMODE_NEW);
|
||||
Matrix_RotateYS(this->dyna.actor.world.rot.y, MTXMODE_APPLY);
|
||||
@@ -1080,7 +1079,7 @@ void func_808BB4F4(DoorWarp1* this, PlayState* play2) {
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, sp64[sp60].r, sp64[sp60].g, sp64[sp60].b, 255);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 255, this->unk_203);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_warp1_DL_0058C8);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gWarpBossWarpGlowDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ static CollisionCheckInfoInit sColChkInfoInit = { 1, 23, 98, MASS_HEAVY };
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 14, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, 19, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_ARMOS, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32_DIV1000(gravity, -4000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
@@ -128,7 +128,7 @@ void EnAni_Init(Actor* thisx, PlayState* play) {
|
||||
this->treeReachTimer = 0;
|
||||
this->blinkFunc = EnAni_DefaultBlink;
|
||||
|
||||
if (GET_ANI_TYPE(thisx) == ANI_TYPE_TREE_HANGING) {
|
||||
if (ANI_GET_TYPE(thisx) == ANI_TYPE_TREE_HANGING) {
|
||||
Animation_Change(&this->skelAnime, &gAniTreeHangingAnim, 1.0f, 0.0f,
|
||||
Animation_GetLastFrame(&gAniTreeHangingAnim), ANIMMODE_ONCE, 0.0f);
|
||||
this->actionFunc = EnAni_HangInTree;
|
||||
|
||||
@@ -33,6 +33,6 @@ enum EnAniType {
|
||||
/* 1 */ ANI_TYPE_TREE_HANGING = 1,
|
||||
};
|
||||
|
||||
#define GET_ANI_TYPE(thisx) (thisx->params & 0xFF)
|
||||
#define ANI_GET_TYPE(thisx) ((thisx)->params & 0xFF)
|
||||
|
||||
#endif // Z_EN_ANI_H
|
||||
|
||||
@@ -139,7 +139,7 @@ void EnArrow_Destroy(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
if ((this->actor.params >= ENARROW_3) && (this->actor.params < ENARROW_6) && (this->actor.child == NULL)) {
|
||||
func_80115D5C(&play->state);
|
||||
Magic_Reset(play);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,13 +162,13 @@ void func_8088A594(EnArrow* this, PlayState* play) {
|
||||
this->bubble.unk_148++;
|
||||
if (this->bubble.unk_148 > 20) {
|
||||
this->actionFunc = func_8088ACE0;
|
||||
func_80115D5C(&play->state);
|
||||
Magic_Reset(play);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((this->actor.params != ENARROW_8) && (player->unk_D57 == 0)) {
|
||||
if (this->actor.params == ENARROW_7) {
|
||||
func_80115D5C(&play->state);
|
||||
Magic_Reset(play);
|
||||
}
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
return;
|
||||
@@ -202,7 +202,7 @@ void func_8088A594(EnArrow* this, PlayState* play) {
|
||||
this->bubble.unk_144 = CLAMP_MIN(this->bubble.unk_144, 3.5f);
|
||||
func_8088A514(this);
|
||||
this->unk_260 = 99;
|
||||
func_80115D5C(&play->state);
|
||||
Magic_Reset(play);
|
||||
} else if (this->actor.params >= ENARROW_6) {
|
||||
if ((this->actor.params == ENARROW_8) && (this->actor.world.rot.x < 0)) {
|
||||
Actor_SetScale(&this->actor, 0.009f);
|
||||
@@ -310,7 +310,7 @@ void func_8088AA98(EnArrow* this, PlayState* play) {
|
||||
return;
|
||||
}
|
||||
|
||||
func_80115D5C(&play->state);
|
||||
Magic_Reset(play);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -389,11 +389,12 @@ void func_8088ACE0(EnArrow* this, PlayState* play) {
|
||||
if (sp50 && (this->collider.info.atHitInfo->elemType != ELEMTYPE_UNK4)) {
|
||||
sp7C = this->collider.base.at;
|
||||
|
||||
if ((sp7C->update != NULL) && !(this->collider.base.atFlags & AT_BOUNCED) && (sp7C->flags & 0x4000)) {
|
||||
if ((sp7C->update != NULL) && !(this->collider.base.atFlags & AT_BOUNCED) &&
|
||||
(sp7C->flags & ACTOR_FLAG_4000)) {
|
||||
this->unk_264 = sp7C;
|
||||
func_8088A894(this, play);
|
||||
Math_Vec3f_Diff(&sp7C->world.pos, &this->actor.world.pos, &this->unk_268);
|
||||
sp7C->flags |= 0x8000;
|
||||
sp7C->flags |= ACTOR_FLAG_8000;
|
||||
this->collider.base.atFlags &= ~AT_HIT;
|
||||
this->actor.speedXZ *= 0.5f;
|
||||
this->actor.velocity.y *= 0.5f;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,10 +7,48 @@ struct EnAz;
|
||||
|
||||
typedef void (*EnAzActionFunc)(struct EnAz*, PlayState*);
|
||||
|
||||
#define BEAVER_GET_PARAM_F00(thisx) (((thisx)->params >> 8) & 0xF)
|
||||
#define BEAVER_GET_PARAM_FF(thisx) ((thisx)->params & 0xFF)
|
||||
|
||||
typedef struct EnAz {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ EnAzActionFunc actionFunc;
|
||||
/* 0x148 */ char unk_148[0x290];
|
||||
/* 0x148 */ SkelAnime skelAnime;
|
||||
/* 0x18C */ ColliderCylinder collider;
|
||||
/* 0x1D8 */ Vec3s jointTable[24];
|
||||
/* 0x268 */ Vec3s morphTable[24];
|
||||
/* 0x2F8 */ s16 unk_2F8;
|
||||
/* 0x2FA */ s16 unk_2FA; // cutscene state?
|
||||
/* 0x2FC */ s32 animIndex;
|
||||
/* 0x300 */ ActorPathing unk_300;
|
||||
/* 0x36C */ f32 unk_36C;
|
||||
/* 0x370 */ UNK_TYPE1 unk370[4];
|
||||
/* 0x374 */ u16 unk_374; // flags of some sort
|
||||
/* 0x376 */ u16 unk_376; // flags of some sort
|
||||
/* 0x378 */ u8 unk_378; // cutscene state?
|
||||
/* 0x37A */ s16 unk_37A;
|
||||
/* 0x37C */ s16 unk_37C;
|
||||
/* 0x37E */ s16 unk_37E;
|
||||
/* 0x380 */ s16 unk_380;
|
||||
/* 0x382 */ s16 unk_382;
|
||||
/* 0x384 */ s16 unk_384;
|
||||
/* 0x388 */ struct EnAz* brother;
|
||||
/* 0x38C */ UNK_TYPE1 unk38C[0x10];
|
||||
/* 0x39C */ s16 unk_39C;
|
||||
/* 0x39E */ s16 unk_39E; // some sort of rotation
|
||||
/* 0x3A0 */ UNK_TYPE1 unk3A0[4];
|
||||
/* 0x3A4 */ f32 unk_3A4;
|
||||
/* 0x3A8 */ Vec3f unk_3A8;
|
||||
/* 0x3B4 */ Vec3f unk_3B4; // translation
|
||||
/* 0x3C0 */ s16 unk_3C0; // seems to do nothing
|
||||
/* 0x3C2 */ s16 unk_3C2;
|
||||
/* 0x3C4 */ s16 unk_3C4;
|
||||
/* 0x3C6 */ UNK_TYPE1 unk3C6[6];
|
||||
/* 0x3CC */ s32 getItemId;
|
||||
/* 0x3D0 */ s16 unk_3D0[1];
|
||||
/* 0x3D2 */ u16 unk_3D2;
|
||||
/* 0x3D4 */ s16 unk_3D4;
|
||||
/* 0x3D6 */ s16 unk_3D6;
|
||||
} EnAz; // size = 0x3D8
|
||||
|
||||
extern const ActorInit En_Az_InitVars;
|
||||
|
||||
@@ -126,7 +126,7 @@ void EnBaguo_Init(Actor* thisx, PlayState* play) {
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f);
|
||||
SkelAnime_Init(play, &this->skelAnime, &gNejironSkel, NULL, this->jointTable, this->morphTable, NEJIRON_LIMB_MAX);
|
||||
this->actor.hintId = 0xB;
|
||||
this->actor.hintId = TATL_HINT_ID_NEJIRON;
|
||||
this->maxDistanceFromHome = 240.0f;
|
||||
this->maxDistanceFromHome += this->actor.world.rot.z * 40.0f;
|
||||
this->actor.world.rot.z = 0;
|
||||
|
||||
@@ -107,7 +107,7 @@ static DamageTable sDamageTable = {
|
||||
static CollisionCheckInfoInit sColChkInfoInit = { 1, 15, 30, 10 };
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_S8(hintId, 96, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_BAD_BAT, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(uncullZoneForward, 3000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP),
|
||||
|
||||
@@ -114,7 +114,7 @@ static DamageTable sDamageTable = {
|
||||
static CollisionCheckInfoInit sColChkInfoInit = { 2, 20, 40, 50 };
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_S8(hintId, 28, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_BLUE_BUBBLE, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 10, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ static DamageTable sDamageTable = {
|
||||
static CollisionCheckInfoInit sColChkInfoInit = { 2, 20, 40, 50 };
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_S8(hintId, 36, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_RED_BUBBLE, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 10, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
|
||||
@@ -17,8 +17,11 @@ void EnBee_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_80B5A9E8(EnBee* this, PlayState* play);
|
||||
void func_80B5AC3C(EnBee* this, PlayState* play);
|
||||
void func_80B5A854(EnBee* this);
|
||||
void func_80B5ABC4(EnBee* this);
|
||||
|
||||
s32 D_80B5B1F0 = 0;
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Bee_InitVars = {
|
||||
ACTOR_EN_BEE,
|
||||
ACTORCAT_ENEMY,
|
||||
@@ -31,8 +34,7 @@ const ActorInit En_Bee_InitVars = {
|
||||
(ActorFunc)EnBee_Draw,
|
||||
};
|
||||
|
||||
// static DamageTable sDamageTable = {
|
||||
static DamageTable D_80B5B214 = {
|
||||
static DamageTable sDamageTable = {
|
||||
/* Deku Nut */ DMG_ENTRY(1, 0xF),
|
||||
/* Deku Stick */ DMG_ENTRY(1, 0xF),
|
||||
/* Horse trample */ DMG_ENTRY(1, 0xF),
|
||||
@@ -67,34 +69,219 @@ static DamageTable D_80B5B214 = {
|
||||
/* Powder Keg */ DMG_ENTRY(1, 0xF),
|
||||
};
|
||||
|
||||
// static ColliderCylinderInit sCylinderInit = {
|
||||
static ColliderCylinderInit D_80B5B234 = {
|
||||
{ COLTYPE_NONE, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON, OC2_TYPE_1, COLSHAPE_CYLINDER, },
|
||||
{ ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x08, 0x02 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{
|
||||
COLTYPE_NONE,
|
||||
AT_ON | AT_TYPE_ENEMY,
|
||||
AC_ON | AC_HARD | AC_TYPE_PLAYER,
|
||||
OC1_ON,
|
||||
OC2_TYPE_1,
|
||||
COLSHAPE_CYLINDER,
|
||||
},
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0xF7CFFFFF, 0x08, 0x02 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_ON | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_ON,
|
||||
},
|
||||
{ 6, 13, -4, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#endif
|
||||
void EnBee_Init(Actor* thisx, PlayState* play) {
|
||||
EnBee* this = THIS;
|
||||
|
||||
extern DamageTable D_80B5B214;
|
||||
extern ColliderCylinderInit D_80B5B234;
|
||||
this->actor.colChkInfo.mass = 10;
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f);
|
||||
SkelAnime_Init(play, &this->skelAnime, &object_bee_Skel_001398, &object_bee_Anim_00005C, this->morphTable,
|
||||
this->jointTable, OBJECT_BEE_LIMB_MAX);
|
||||
this->actor.colChkInfo.health = 1;
|
||||
this->actor.colChkInfo.damageTable = &sDamageTable;
|
||||
this->actor.targetMode = 6;
|
||||
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
|
||||
this->unk_218 = D_80B5B1F0;
|
||||
D_80B5B1F0++;
|
||||
this->actor.shape.shadowScale = 12.0f;
|
||||
|
||||
extern UNK_TYPE D_0600005C;
|
||||
if (ActorCutscene_GetCurrentIndex() != -1) {
|
||||
func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/EnBee_Init.s")
|
||||
this->actor.hintId = TATL_HINT_ID_GIANT_BEE;
|
||||
func_80B5A854(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/EnBee_Destroy.s")
|
||||
void EnBee_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnBee* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/func_80B5A854.s")
|
||||
Collider_DestroyCylinder(play, &this->collider);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/func_80B5A9E8.s")
|
||||
void func_80B5A854(EnBee* this) {
|
||||
s32 pad;
|
||||
Vec3f sp48;
|
||||
s16 sp46;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/func_80B5ABC4.s")
|
||||
Animation_Change(&this->skelAnime, &object_bee_Anim_00005C, 1.0f, 0.0f,
|
||||
Animation_GetLastFrame(&object_bee_Anim_00005C), 0, -10.0f);
|
||||
Math_Vec3f_Copy(&sp48, &this->actor.home.pos);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/func_80B5AC3C.s")
|
||||
sp46 = (this->unk_218 * 0x700) + 0x2000;
|
||||
sp48.x += Math_SinS(sp46) * 50.0f;
|
||||
sp48.y = Rand_ZeroFloat(50.0f) + (this->actor.floorHeight + 30.0f);
|
||||
sp48.z += Math_CosS(sp46) * 50.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/func_80B5AF80.s")
|
||||
Math_Vec3f_Copy(&this->unk_21C[0], &sp48);
|
||||
Math_Vec3f_Copy(&sp48, &this->actor.home.pos);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/EnBee_Update.s")
|
||||
sp48.x += Math_SinS(sp46 - 0x4000) * 50.0f;
|
||||
sp48.y = Rand_ZeroFloat(50.0f) + (this->actor.floorHeight + 30.0f);
|
||||
sp48.z += Math_CosS(sp46 - 0x4000) * 50.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bee/EnBee_Draw.s")
|
||||
Math_Vec3f_Copy(&this->unk_21C[1], &sp48);
|
||||
|
||||
this->unk_204 = Rand_S16Offset(0x14, 0x1E);
|
||||
this->unk_208 = 0;
|
||||
this->actionFunc = func_80B5A9E8;
|
||||
}
|
||||
|
||||
void func_80B5A9E8(EnBee* this, PlayState* play) {
|
||||
Vec3f sp3C;
|
||||
s32 pad[2];
|
||||
|
||||
if ((this->actor.category != ACTORCAT_ENEMY) && (ActorCutscene_GetCurrentIndex() == -1)) {
|
||||
func_800BC154(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY);
|
||||
}
|
||||
|
||||
Math_Vec3f_Copy(&sp3C, &this->unk_21C[this->unk_214]);
|
||||
sp3C.x += Math_SinS(this->unk_20C) * 30.0f;
|
||||
sp3C.z += Math_CosS(this->unk_20C) * 30.0f;
|
||||
|
||||
if (!(this->unk_218 & 1)) {
|
||||
this->unk_20C += (s16)((s32)randPlusMinusPoint5Scaled(1000.0f) + 4000);
|
||||
} else {
|
||||
this->unk_20C -= (s16)((s32)randPlusMinusPoint5Scaled(1000.0f) + 4000);
|
||||
}
|
||||
|
||||
this->unk_210 += 1000;
|
||||
this->actor.velocity.y = Math_SinS(this->unk_210);
|
||||
|
||||
if (this->unk_20C > 0x10000) {
|
||||
this->unk_20C = 0;
|
||||
this->unk_214++;
|
||||
this->unk_214 &= 1;
|
||||
}
|
||||
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp3C), 1, 0x7D0, 0);
|
||||
Math_ApproachF(&this->actor.speedXZ, 3.0f, 0.3f, 1.0f);
|
||||
|
||||
if ((this->unk_204 == 0) && (this->actor.params != 0)) {
|
||||
func_80B5ABC4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80B5ABC4(EnBee* this) {
|
||||
Animation_Change(&this->skelAnime, &object_bee_Anim_00005C, 1.0f, 0.0f,
|
||||
Animation_GetLastFrame(&object_bee_Anim_00005C), 0, -10.0f);
|
||||
this->unk_208 = 1;
|
||||
this->actionFunc = func_80B5AC3C;
|
||||
}
|
||||
|
||||
void func_80B5AC3C(EnBee* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
Vec3f sp88;
|
||||
f32 rnd;
|
||||
f32 phi_fs1;
|
||||
s32 i;
|
||||
|
||||
Math_Vec3f_Copy(&sp88, &player->actor.world.pos);
|
||||
phi_fs1 = (this->unk_218 * 0x700) + 0x2000;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
rnd = randPlusMinusPoint5Scaled(20.0f);
|
||||
sp88.x += Math_SinS((this->actor.yawTowardsPlayer + ((f32)this->unk_20C)) + phi_fs1) * (rnd + 30.0f);
|
||||
sp88.y = (Math_SinS(this->unk_210) * 10.0f) + (player->actor.floorHeight + 40.0f);
|
||||
rnd = randPlusMinusPoint5Scaled(20.0f);
|
||||
sp88.z += Math_CosS((f32)this->actor.yawTowardsPlayer + this->unk_20C + phi_fs1) * (rnd + 30.0f);
|
||||
Math_Vec3f_Copy(&this->unk_21C[i], &sp88);
|
||||
phi_fs1 -= 16384.0f;
|
||||
}
|
||||
|
||||
Math_Vec3f_Copy(&sp88, &this->unk_21C[this->unk_214]);
|
||||
|
||||
if (!(this->unk_218 & 1)) {
|
||||
this->unk_20C += (this->unk_218 * 0x700) + (s32)randPlusMinusPoint5Scaled((this->unk_218 * 0x700) * 0.5f);
|
||||
} else {
|
||||
this->unk_20C -= (this->unk_218 * 0x700) + (s32)randPlusMinusPoint5Scaled((this->unk_218 * 0x700) * 0.5f);
|
||||
}
|
||||
|
||||
this->unk_210 += (s32)randPlusMinusPoint5Scaled(500.0f) + 1000;
|
||||
|
||||
if (this->unk_20C > 0x10000) {
|
||||
this->unk_20C = 0;
|
||||
this->unk_214++;
|
||||
this->unk_214 &= 1;
|
||||
}
|
||||
|
||||
Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp88), 1, 0x1388, 0);
|
||||
Math_ApproachF(&this->actor.world.pos.y, sp88.y, 0.3f, 3.0f);
|
||||
Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.3f, 1.0f);
|
||||
}
|
||||
|
||||
void func_80B5AF80(EnBee* this, PlayState* play) {
|
||||
if ((this->unk_206 == 0) && (this->collider.base.atFlags & AC_HIT)) {
|
||||
AudioSfx_StopByPosAndId(&this->actor.projectedPos, NA_SE_EN_BEE_FLY - SFX_FLAG);
|
||||
this->unk_206 = 5;
|
||||
}
|
||||
|
||||
if (this->collider.base.acFlags & AC_HIT) {
|
||||
Enemy_StartFinishingBlow(play, &this->actor);
|
||||
this->actor.speedXZ = 0.0f;
|
||||
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 10, NA_SE_EN_CUTBODY);
|
||||
this->actor.colChkInfo.health = 0;
|
||||
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 50, NA_SE_EN_EXTINCT);
|
||||
func_800B3030(play, &this->actor.world.pos, &gZeroVec3f, &gZeroVec3f, 100, 0, 2);
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
void EnBee_Update(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnBee* this = THIS;
|
||||
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
|
||||
if (this->actor.category == ACTORCAT_ENEMY) {
|
||||
if (this->unk_204 != 0) {
|
||||
this->unk_204--;
|
||||
}
|
||||
if (this->unk_206 != 0) {
|
||||
this->unk_206--;
|
||||
}
|
||||
}
|
||||
|
||||
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_BEE_FLY - SFX_FLAG);
|
||||
func_80B5AF80(this, play);
|
||||
Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot);
|
||||
Actor_SetFocus(&this->actor, 0.0f);
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
|
||||
this->actionFunc(this, play);
|
||||
|
||||
Actor_MoveWithGravity(&this->actor);
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 40.0f, 40.0f, 0x1D);
|
||||
|
||||
Collider_UpdateCylinder(&this->actor, &this->collider);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
||||
void EnBee_Draw(Actor* thisx, PlayState* play) {
|
||||
EnBee* this = THIS;
|
||||
|
||||
func_8012C28C(play->state.gfxCtx);
|
||||
func_8012C2DC(play->state.gfxCtx);
|
||||
SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define Z_EN_BEE_H
|
||||
|
||||
#include "global.h"
|
||||
#include "assets/objects/object_bee/object_bee.h"
|
||||
|
||||
struct EnBee;
|
||||
|
||||
@@ -9,9 +10,20 @@ typedef void (*EnBeeActionFunc)(struct EnBee*, PlayState*);
|
||||
|
||||
typedef struct EnBee {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0xBC];
|
||||
/* 0x144 */ SkelAnime skelAnime;
|
||||
/* 0x188 */ Vec3s morphTable[OBJECT_BEE_LIMB_MAX];
|
||||
/* 0x1C4 */ Vec3s jointTable[OBJECT_BEE_LIMB_MAX];
|
||||
/* 0x200 */ EnBeeActionFunc actionFunc;
|
||||
/* 0x204 */ char unk_204[0x84];
|
||||
/* 0x204 */ s16 unk_204;
|
||||
/* 0x206 */ s16 unk_206;
|
||||
/* 0x208 */ s16 unk_208;
|
||||
/* 0x20C */ s32 unk_20C;
|
||||
/* 0x210 */ s32 unk_210;
|
||||
/* 0x214 */ s32 unk_214;
|
||||
/* 0x218 */ s32 unk_218;
|
||||
/* 0x21C */ Vec3f unk_21C[2];
|
||||
/* 0x234 */ UNK_TYPE1 pad234[8];
|
||||
/* 0x23C */ ColliderCylinder collider;
|
||||
} EnBee; // size = 0x288
|
||||
|
||||
extern const ActorInit En_Bee_InitVars;
|
||||
|
||||
@@ -88,7 +88,7 @@ static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(uncullZoneForward, 2500, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE),
|
||||
ICHAIN_U8(targetMode, 2, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, 89, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_BIG_OCTO, ICHAIN_CONTINUE),
|
||||
ICHAIN_VEC3F_DIV1000(scale, 33, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
@@ -443,7 +443,7 @@ void EnBigokuta_PlayDeathEffects(EnBigokuta* this, PlayState* play) {
|
||||
bubblePos.z = this->picto.actor.world.pos.z + (2.0f * bubbleVel.z);
|
||||
|
||||
EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &bubbleVel, &D_80AC45A4, &D_80AC45B0,
|
||||
&D_80AC45B8, Rand_S16Offset(150, 50), 25, 0);
|
||||
&D_80AC45B8, Rand_S16Offset(150, 50), 25, false);
|
||||
}
|
||||
|
||||
if (this->picto.actor.params != 0xFF) {
|
||||
|
||||
@@ -154,7 +154,7 @@ static DamageTable sDamageTable = {
|
||||
};
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_S8(hintId, 90, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_BIG_POE, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 3200, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
@@ -181,8 +181,7 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) {
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
|
||||
// thisx req to match
|
||||
this->switchFlags = GET_BIGPO_SWITCHFLAGS(thisx);
|
||||
this->switchFlags = BIGPO_GET_SWITCHFLAGS(thisx);
|
||||
thisx->params &= 0xFF;
|
||||
if (thisx->params == ENBIGPO_POSSIBLEFIRE) {
|
||||
if (Flags_GetSwitch(play, this->switchFlags)) {
|
||||
@@ -220,7 +219,7 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) {
|
||||
}
|
||||
|
||||
if (thisx->params == ENBIGPO_REGULAR) { // the well poe, starts immediately
|
||||
thisx->flags &= ~0x10; // always update OFF
|
||||
thisx->flags &= ~ACTOR_FLAG_10; // always update OFF
|
||||
this->unkBool204 = true;
|
||||
EnBigpo_InitWellBigpo(this);
|
||||
} else if (thisx->params == ENBIGPO_SUMMONED) { // dampe type
|
||||
@@ -672,7 +671,7 @@ void EnBigpo_SetupDeath(EnBigpo* this) {
|
||||
this->idleTimer = 0;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
this->actor.world.rot.y = this->actor.shape.rot.y;
|
||||
this->actor.hintId = 0xFF;
|
||||
this->actor.hintId = TATL_HINT_ID_NONE;
|
||||
this->collider.base.ocFlags1 &= ~OC1_ON;
|
||||
this->actionFunc = EnBigpo_BurnAwayDeath;
|
||||
}
|
||||
|
||||
@@ -64,6 +64,6 @@ enum EnBigpoType {
|
||||
/* 5 */ ENBIGPO_UNK5,
|
||||
};
|
||||
|
||||
#define GET_BIGPO_SWITCHFLAGS(thisx) ((u8)(thisx->params >> 0x8))
|
||||
#define BIGPO_GET_SWITCHFLAGS(thisx) (u8)((thisx)->params >> 0x8)
|
||||
|
||||
#endif // Z_EN_BIGPO_H
|
||||
|
||||
@@ -303,7 +303,7 @@ static AnimationHeader* sGekkoAttackAnimations[] = {
|
||||
};
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_S8(hintId, 95, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_GEKKO_GIANT_SLIME, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32_DIV1000(targetArrowOffset, -13221, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE),
|
||||
ICHAIN_U8(targetMode, 5, ICHAIN_STOP),
|
||||
@@ -765,7 +765,7 @@ void EnBigslime_BreakIntoMinislime(EnBigslime* this, PlayState* play) {
|
||||
this->actor.colChkInfo.mass = 50;
|
||||
this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_400);
|
||||
this->actor.flags |= ACTOR_FLAG_200;
|
||||
this->actor.hintId = 95;
|
||||
this->actor.hintId = TATL_HINT_ID_GEKKO_GIANT_SLIME;
|
||||
this->gekkoRot.x = 0;
|
||||
this->gekkoRot.y = 0;
|
||||
this->actor.bgCheckFlags &= ~1;
|
||||
@@ -2308,7 +2308,7 @@ void EnBigslime_FormBigslime(EnBigslime* this, PlayState* play) {
|
||||
|
||||
if (this->minislimeCounter == MINISLIME_NUM_SPAWN) {
|
||||
this->minislimeState = MINISLIME_INACTIVE_STATE;
|
||||
this->actor.hintId = 3;
|
||||
this->actor.hintId = TATL_HINT_ID_MAD_JELLY;
|
||||
EnBigslime_SetupMoveOnCeiling(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ void EnBom_Init(Actor* thisx, PlayState* play) {
|
||||
this->flashSpeedScale = 7;
|
||||
this->isPowderKeg = ENBOM_GETX_1(&this->actor);
|
||||
if (this->isPowderKeg) {
|
||||
play->actorCtx.unk5 |= 1;
|
||||
play->actorCtx.flags |= ACTORCTX_FLAG_0;
|
||||
this->timer = gSaveContext.powderKegTimer;
|
||||
} else {
|
||||
this->timer = 70;
|
||||
@@ -188,7 +188,7 @@ void EnBom_Destroy(Actor* thisx, PlayState* play) {
|
||||
Collider_DestroyJntSph(play, &this->collider2);
|
||||
Collider_DestroyCylinder(play, &this->collider1);
|
||||
if (this->isPowderKeg) {
|
||||
play->actorCtx.unk5 &= ~1;
|
||||
play->actorCtx.flags &= ~ACTORCTX_FLAG_0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ void EnBom_Update(Actor* thisx, PlayState* play) {
|
||||
Camera_AddQuake(&play->mainCamera, 2, 11, 8);
|
||||
thisx->params = ENBOM_1;
|
||||
this->timer = 10;
|
||||
thisx->flags |= (0x100000 | 0x20);
|
||||
thisx->flags |= (ACTOR_FLAG_20 | ACTOR_FLAG_100000);
|
||||
this->actionFunc = func_808715B8;
|
||||
if (this->isPowderKeg) {
|
||||
gSaveContext.powderKegTimer = 0;
|
||||
|
||||
@@ -509,7 +509,7 @@ void func_809C59F0(EnBomBowlMan* this, PlayState* play) {
|
||||
} else {
|
||||
this->actor.textId = 0x716;
|
||||
}
|
||||
func_800B8500(&this->actor, play, 400.0f, 400.0f, -1);
|
||||
func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1);
|
||||
this->actionFunc = func_809C5AA4;
|
||||
} else {
|
||||
Actor_PickUp(&this->actor, play, GI_BOMBERS_NOTEBOOK, 300.0f, 300.0f);
|
||||
@@ -524,7 +524,7 @@ void func_809C5AA4(EnBomBowlMan* this, PlayState* play) {
|
||||
this->actionFunc = func_809C5598;
|
||||
}
|
||||
} else {
|
||||
func_800B8500(&this->actor, play, 400.0f, 400.0f, -1);
|
||||
func_800B8500(&this->actor, play, 400.0f, 400.0f, PLAYER_AP_MINUS1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ void func_808A2918(EnBoom* this, PlayState* play) {
|
||||
(this->collider.base.at->id == ACTOR_EN_SI))) {
|
||||
this->unk_1C8 = this->collider.base.at;
|
||||
if (this->collider.base.at->id == ACTOR_EN_SI) {
|
||||
this->collider.base.at->flags |= 0x2000;
|
||||
this->collider.base.at->flags |= ACTOR_FLAG_2000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ void func_808A2918(EnBoom* this, PlayState* play) {
|
||||
sp7C->gravity = -0.9f;
|
||||
sp7C->bgCheckFlags &= ~3;
|
||||
} else {
|
||||
sp7C->flags &= -0x2001;
|
||||
sp7C->flags &= ~ACTOR_FLAG_2000;
|
||||
}
|
||||
}
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
|
||||
@@ -604,7 +604,7 @@ void EnBox_Update(Actor* thisx, PlayState* play) {
|
||||
EnBox_ClipToGround(this, play);
|
||||
}
|
||||
if ((this->getItemId == GI_STRAY_FAIRY) && !Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) {
|
||||
play->actorCtx.unk5 |= 8;
|
||||
play->actorCtx.flags |= ACTORCTX_FLAG_3;
|
||||
}
|
||||
this->actionFunc(this, play);
|
||||
if (this->movementFlags & ENBOX_MOVE_0x80) {
|
||||
|
||||
@@ -15,11 +15,10 @@ void EnBubble_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnBubble_Update(Actor* thisx, PlayState* play);
|
||||
void EnBubble_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_808A029C(EnBubble* this, PlayState* play);
|
||||
void func_808A0350(EnBubble* this, PlayState* play);
|
||||
void func_808A03E8(EnBubble* this, PlayState* play);
|
||||
void EnBubble_Wait(EnBubble* this, PlayState* play);
|
||||
void EnBubble_Pop(EnBubble* this, PlayState* play);
|
||||
void EnBubble_Regrow(EnBubble* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Bubble_InitVars = {
|
||||
ACTOR_EN_BUBBLE,
|
||||
ACTORCAT_ENEMY,
|
||||
@@ -32,73 +31,396 @@ const ActorInit En_Bubble_InitVars = {
|
||||
(ActorFunc)EnBubble_Draw,
|
||||
};
|
||||
|
||||
// static ColliderJntSphElementInit sJntSphElementsInit[2] = {
|
||||
static ColliderJntSphElementInit D_808A0700[2] = {
|
||||
static ColliderJntSphElementInit sJntSphElementsInit[2] = {
|
||||
{
|
||||
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x04 }, { 0xF7CFD757, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0x00000000, 0x00, 0x04 },
|
||||
{ 0xF7CFD757, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_ON,
|
||||
},
|
||||
{ 0, { { 0, 0, 0 }, 16 }, 100 },
|
||||
},
|
||||
{
|
||||
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00002820, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK, OCELEM_NONE, },
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0x00002820, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON | BUMP_NO_AT_INFO | BUMP_NO_DAMAGE | BUMP_NO_SWORD_SFX | BUMP_NO_HITMARK,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ 0, { { 0, 0, 0 }, 16 }, 100 },
|
||||
},
|
||||
};
|
||||
|
||||
// static ColliderJntSphInit sJntSphInit = {
|
||||
static ColliderJntSphInit D_808A0748 = {
|
||||
{ COLTYPE_HIT6, AT_ON | AT_TYPE_ENEMY, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_JNTSPH, },
|
||||
ARRAY_COUNT(sJntSphElementsInit), D_808A0700, // sJntSphElementsInit,
|
||||
static ColliderJntSphInit sJntSphInit = {
|
||||
{
|
||||
COLTYPE_HIT6,
|
||||
AT_ON | AT_TYPE_ENEMY,
|
||||
AC_ON | AC_TYPE_PLAYER,
|
||||
OC1_ON | OC1_TYPE_ALL,
|
||||
OC2_TYPE_1,
|
||||
COLSHAPE_JNTSPH,
|
||||
},
|
||||
ARRAY_COUNT(sJntSphElementsInit),
|
||||
sJntSphElementsInit,
|
||||
};
|
||||
|
||||
// sColChkInfoInit
|
||||
static CollisionCheckInfoInit2 D_808A0758 = { 1, 2, 25, 25, MASS_IMMOVABLE };
|
||||
static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 2, 25, 25, MASS_IMMOVABLE };
|
||||
|
||||
#endif
|
||||
void EnBubble_SetDimensions(EnBubble* this, f32 dim) {
|
||||
f32 x;
|
||||
f32 y;
|
||||
f32 z;
|
||||
f32 norm;
|
||||
|
||||
extern ColliderJntSphElementInit D_808A0700[2];
|
||||
extern ColliderJntSphInit D_808A0748;
|
||||
extern CollisionCheckInfoInit2 D_808A0758;
|
||||
this->actor.flags |= ACTOR_FLAG_1;
|
||||
Actor_SetScale(&this->actor, 1.0f);
|
||||
this->actor.shape.yOffset = 16.0f;
|
||||
this->modelRotSpeed = 16.0f;
|
||||
this->modelEllipticity = 0.08f;
|
||||
this->modelWidth = dim;
|
||||
this->modelHeight = dim;
|
||||
x = Rand_ZeroOne();
|
||||
y = Rand_ZeroOne();
|
||||
z = Rand_ZeroOne();
|
||||
this->unk_210 = 1.0f;
|
||||
this->unk_214 = 1.0f;
|
||||
norm = SQ(x) + SQ(y) + SQ(z);
|
||||
this->unk1F8.x = x / norm;
|
||||
this->unk1F8.y = y / norm;
|
||||
this->unk1F8.z = z / norm;
|
||||
}
|
||||
|
||||
extern UNK_TYPE D_06001000;
|
||||
s32 func_8089F59C(EnBubble* this) {
|
||||
ColliderInfo* info = &this->colliderSphere.elements[0].info;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F4E0.s")
|
||||
info->toucher.dmgFlags = DMG_EXPLOSIVES;
|
||||
info->toucher.effect = 0;
|
||||
info->toucher.damage = 4;
|
||||
info->toucherFlags = TOUCH_ON;
|
||||
this->actor.velocity.y = 0.0f;
|
||||
return 6;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F59C.s")
|
||||
s32 func_8089F5D0(EnBubble* this) {
|
||||
EnBubble_SetDimensions(this, -1.0f);
|
||||
return 12;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F5D0.s")
|
||||
void EnBubble_DamagePlayer(EnBubble* this, PlayState* play) {
|
||||
play->damagePlayer(play, -this->colliderSphere.elements[0].info.toucher.damage);
|
||||
func_800B8E1C(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F5F4.s")
|
||||
s32 EnBubble_Explosion(EnBubble* this, PlayState* play) {
|
||||
static Color_RGBA8 sEffectPrimColor = { 255, 255, 255, 255 };
|
||||
static Color_RGBA8 sEffectEnvColor = { 150, 150, 150, 0 };
|
||||
s32 i;
|
||||
Vec3f effectAccel = { 0.0f, -0.5f, 0.0f };
|
||||
Vec3f effectVel;
|
||||
Vec3f effectPos;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F660.s")
|
||||
Math_SmoothStepToF(&this->modelWidth, 4.0f, 0.1f, 1000.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->modelHeight, 4.0f, 0.1f, 1000.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->modelRotSpeed, 54.0f, 0.1f, 1000.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->modelEllipticity, 0.2f, 0.1f, 1000.0f, 0.0f);
|
||||
this->actor.shape.yOffset = (this->modelHeight + 1.0f) * 16.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F8BC.s")
|
||||
if (DECR(this->explosionCountdown) != 0) {
|
||||
return -1;
|
||||
}
|
||||
effectPos.x = this->actor.world.pos.x;
|
||||
effectPos.y = this->actor.world.pos.y + this->actor.shape.yOffset;
|
||||
effectPos.z = this->actor.world.pos.z;
|
||||
for (i = 0; i < 20; i++) {
|
||||
effectVel.x = (Rand_ZeroOne() - 0.5f) * 7.0f;
|
||||
effectVel.y = Rand_ZeroOne() * 7.0f;
|
||||
effectVel.z = (Rand_ZeroOne() - 0.5f) * 7.0f;
|
||||
EffectSsDtBubble_SpawnCustomColor(play, &effectPos, &effectVel, &effectAccel, &sEffectPrimColor,
|
||||
&sEffectEnvColor, Rand_S16Offset(100, 50), 25, 0);
|
||||
}
|
||||
Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x50);
|
||||
this->actor.flags &= ~ACTOR_FLAG_1;
|
||||
return Rand_S16Offset(90, 60);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F908.s")
|
||||
s32 func_8089F8BC(EnBubble* this) {
|
||||
if (DECR(this->explosionCountdown) != 0) {
|
||||
return -1;
|
||||
} else {
|
||||
return func_8089F5D0(this);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F95C.s")
|
||||
s32 func_8089F908(EnBubble* this) {
|
||||
this->modelWidth += 1.0f / 12.0f;
|
||||
this->modelHeight += 1.0f / 12.0f;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089F9E4.s")
|
||||
if (DECR(this->explosionCountdown) != 0) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089FA54.s")
|
||||
void EnBubble_Vec3fNormalizedReflect(Vec3f* vec1, Vec3f* vec2, Vec3f* dest) {
|
||||
f32 norm;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089FF30.s")
|
||||
func_80179F64(vec1, vec2, dest);
|
||||
norm = sqrtf(SQ(dest->x) + SQ(dest->y) + SQ(dest->z));
|
||||
if (norm != 0.0f) {
|
||||
dest->x /= norm;
|
||||
dest->y /= norm;
|
||||
dest->z /= norm;
|
||||
} else {
|
||||
dest->x = dest->y = dest->z = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_8089FFCC.s")
|
||||
void EnBubble_Vec3fNormalize(Vec3f* vec) {
|
||||
f32 norm = sqrtf(SQ(vec->x) + SQ(vec->y) + SQ(vec->z));
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_808A005C.s")
|
||||
if (norm != 0.0f) {
|
||||
vec->x /= norm;
|
||||
vec->y /= norm;
|
||||
vec->z /= norm;
|
||||
} else {
|
||||
vec->x = vec->y = vec->z = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/EnBubble_Init.s")
|
||||
void EnBubble_Fly(EnBubble* this, PlayState* play) {
|
||||
CollisionPoly* poly;
|
||||
Actor* bumpActor;
|
||||
Vec3f sp84;
|
||||
Vec3f sp78;
|
||||
Vec3f sp6C;
|
||||
Vec3f normal;
|
||||
Vec3f bounceDirection;
|
||||
f32 bounceSpeed;
|
||||
s32 bgId;
|
||||
u8 bounceCount;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/EnBubble_Destroy.s")
|
||||
if (this->colliderSphere.elements[1].info.bumperFlags & BUMP_HIT) {
|
||||
bumpActor = this->colliderSphere.base.ac;
|
||||
this->normalizedBumpVelocity = bumpActor->velocity;
|
||||
EnBubble_Vec3fNormalize(&this->normalizedBumpVelocity);
|
||||
this->velocityFromBump.x += this->normalizedBumpVelocity.x * 3.0f;
|
||||
this->velocityFromBump.y += this->normalizedBumpVelocity.y * 3.0f;
|
||||
this->velocityFromBump.z += this->normalizedBumpVelocity.z * 3.0f;
|
||||
}
|
||||
this->yVelocity -= 0.1f;
|
||||
if (this->yVelocity < this->actor.terminalVelocity) {
|
||||
this->yVelocity = this->actor.terminalVelocity;
|
||||
}
|
||||
bounceDirection.x = this->velocityFromBounce.x + this->velocityFromBump.x;
|
||||
bounceDirection.y = this->velocityFromBounce.y + this->velocityFromBump.y + this->yVelocity;
|
||||
bounceDirection.z = this->velocityFromBounce.z + this->velocityFromBump.z;
|
||||
EnBubble_Vec3fNormalize(&bounceDirection);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_808A029C.s")
|
||||
sp78.x = this->actor.world.pos.x;
|
||||
sp78.y = this->actor.world.pos.y + this->actor.shape.yOffset;
|
||||
sp78.z = this->actor.world.pos.z;
|
||||
sp6C = sp78;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_808A0350.s")
|
||||
sp6C.x += (bounceDirection.x * 24.0f);
|
||||
sp6C.y += (bounceDirection.y * 24.0f);
|
||||
sp6C.z += (bounceDirection.z * 24.0f);
|
||||
if (BgCheck_EntityLineTest1(&play->colCtx, &sp78, &sp6C, &sp84, &poly, true, true, true, false, &bgId)) {
|
||||
normal.x = COLPOLY_GET_NORMAL(poly->normal.x);
|
||||
normal.y = COLPOLY_GET_NORMAL(poly->normal.y);
|
||||
normal.z = COLPOLY_GET_NORMAL(poly->normal.z);
|
||||
EnBubble_Vec3fNormalizedReflect(&bounceDirection, &normal, &bounceDirection);
|
||||
this->bounceDirection = bounceDirection;
|
||||
bounceCount = this->bounceCount;
|
||||
this->bounceCount = ++bounceCount;
|
||||
if (bounceCount > (s16)(Rand_ZeroOne() * 10.0f)) {
|
||||
this->bounceCount = 0;
|
||||
}
|
||||
bounceSpeed = (this->bounceCount == 0) ? 3.6000001f : 3.0f;
|
||||
this->velocityFromBump.x = this->velocityFromBump.y = this->velocityFromBump.z = 0.0f;
|
||||
this->velocityFromBounce.x = this->bounceDirection.x * bounceSpeed;
|
||||
this->velocityFromBounce.y = this->bounceDirection.y * bounceSpeed;
|
||||
this->velocityFromBounce.z = this->bounceDirection.z * bounceSpeed;
|
||||
this->yVelocity = 0.0f;
|
||||
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AWA_BOUND);
|
||||
this->modelRotSpeed = 128.0f;
|
||||
this->modelEllipticity = 0.48f;
|
||||
} else if ((this->actor.bgCheckFlags & 0x20) && (bounceDirection.y < 0.0f)) {
|
||||
normal.x = normal.z = 0.0f;
|
||||
normal.y = 1.0f;
|
||||
EnBubble_Vec3fNormalizedReflect(&bounceDirection, &normal, &bounceDirection);
|
||||
this->bounceDirection = bounceDirection;
|
||||
bounceCount = this->bounceCount;
|
||||
this->bounceCount = ++bounceCount;
|
||||
if (bounceCount > (s16)(Rand_ZeroOne() * 10.0f)) {
|
||||
this->bounceCount = 0;
|
||||
}
|
||||
bounceSpeed = (this->bounceCount == 0) ? 3.6000001f : 3.0f;
|
||||
this->velocityFromBump.x = this->velocityFromBump.y = this->velocityFromBump.z = 0.0f;
|
||||
this->velocityFromBounce.x = (this->bounceDirection.x * bounceSpeed);
|
||||
this->velocityFromBounce.y = (this->bounceDirection.y * bounceSpeed);
|
||||
this->velocityFromBounce.z = (this->bounceDirection.z * bounceSpeed);
|
||||
this->yVelocity = 0.0f;
|
||||
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_AWA_BOUND);
|
||||
this->modelRotSpeed = 128.0f;
|
||||
this->modelEllipticity = 0.48f;
|
||||
}
|
||||
this->actor.velocity.x = this->velocityFromBounce.x + this->velocityFromBump.x;
|
||||
this->actor.velocity.y = this->velocityFromBounce.y + this->velocityFromBump.y + this->yVelocity;
|
||||
this->actor.velocity.z = this->velocityFromBounce.z + this->velocityFromBump.z;
|
||||
Math_ApproachF(&this->velocityFromBump.x, 0.0f, 0.3f, 0.1f);
|
||||
Math_ApproachF(&this->velocityFromBump.y, 0.0f, 0.3f, 0.1f);
|
||||
Math_ApproachF(&this->velocityFromBump.z, 0.0f, 0.3f, 0.1f);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_808A03A0.s")
|
||||
s32 func_8089FF30(EnBubble* this) {
|
||||
if (((this->colliderSphere.base.acFlags & AC_HIT) != 0) == false) {
|
||||
return false;
|
||||
}
|
||||
this->colliderSphere.base.acFlags &= ~AC_HIT;
|
||||
if (this->colliderSphere.elements[1].info.bumperFlags & BUMP_HIT) {
|
||||
this->unk1F4.x = this->colliderSphere.base.ac->velocity.x / 10.0f;
|
||||
this->unk1F4.y = this->colliderSphere.base.ac->velocity.y / 10.0f;
|
||||
this->unk1F4.z = this->colliderSphere.base.ac->velocity.z / 10.0f;
|
||||
this->modelRotSpeed = 128.0f;
|
||||
this->modelEllipticity = 0.48f;
|
||||
return false;
|
||||
}
|
||||
this->timer = 8;
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/func_808A03E8.s")
|
||||
s32 EnBubble_IsPopped(EnBubble* this, PlayState* play) {
|
||||
if ((DECR(this->timer) != 0) || (this->actionFunc == EnBubble_Pop)) {
|
||||
return false;
|
||||
}
|
||||
if (this->colliderSphere.base.ocFlags2 & OC2_HIT_PLAYER) {
|
||||
this->colliderSphere.base.ocFlags2 &= ~OC2_HIT_PLAYER;
|
||||
EnBubble_DamagePlayer(this, play);
|
||||
this->timer = 8;
|
||||
return true;
|
||||
}
|
||||
return func_8089FF30(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/EnBubble_Update.s")
|
||||
void func_808A005C(EnBubble* this) {
|
||||
ColliderJntSphElementDim* dim = &this->colliderSphere.elements[0].dim;
|
||||
Vec3f src;
|
||||
Vec3f dest;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bubble/EnBubble_Draw.s")
|
||||
src.x = dim->modelSphere.center.x;
|
||||
src.y = dim->modelSphere.center.y;
|
||||
src.z = dim->modelSphere.center.z;
|
||||
|
||||
Matrix_MultVec3f(&src, &dest);
|
||||
dim->worldSphere.center.x = dest.x;
|
||||
dim->worldSphere.center.y = dest.y;
|
||||
dim->worldSphere.center.z = dest.z;
|
||||
dim->worldSphere.radius = dim->modelSphere.radius * (1.0f + this->modelWidth);
|
||||
this->colliderSphere.elements[1].dim = *dim;
|
||||
}
|
||||
|
||||
void EnBubble_Init(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnBubble* this = THIS;
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 16.0f, ActorShadow_DrawCircle, 0.2f);
|
||||
Collider_InitJntSph(play, &this->colliderSphere);
|
||||
Collider_SetJntSph(play, &this->colliderSphere, &this->actor, &sJntSphInit, this->colliderElements);
|
||||
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(9), &sColChkInfoInit);
|
||||
this->actor.hintId = 0x16;
|
||||
this->bounceDirection.x = Rand_ZeroOne();
|
||||
this->bounceDirection.y = Rand_ZeroOne();
|
||||
this->bounceDirection.z = Rand_ZeroOne();
|
||||
EnBubble_Vec3fNormalize(&this->bounceDirection);
|
||||
this->velocityFromBounce.x = this->bounceDirection.x * 3.0f;
|
||||
this->velocityFromBounce.y = this->bounceDirection.y * 3.0f;
|
||||
this->velocityFromBounce.z = this->bounceDirection.z * 3.0f;
|
||||
EnBubble_SetDimensions(this, 0);
|
||||
this->actionFunc = EnBubble_Wait;
|
||||
}
|
||||
|
||||
void EnBubble_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnBubble* this = (EnBubble*)thisx;
|
||||
|
||||
Collider_DestroyJntSph(play, &this->colliderSphere);
|
||||
}
|
||||
|
||||
void EnBubble_Wait(EnBubble* this, PlayState* play) {
|
||||
if (EnBubble_IsPopped(this, play)) {
|
||||
this->explosionCountdown = func_8089F59C(this);
|
||||
this->actionFunc = EnBubble_Pop;
|
||||
} else {
|
||||
EnBubble_Fly(this, play);
|
||||
this->actor.shape.yOffset = (this->modelHeight + 1.0f) * 16.0f;
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base);
|
||||
}
|
||||
}
|
||||
|
||||
void EnBubble_Pop(EnBubble* this, PlayState* play) {
|
||||
if (EnBubble_Explosion(this, play) > -1) {
|
||||
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK);
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
void EnBubble_Disappear(EnBubble* this, PlayState* play) {
|
||||
s32 temp_v0 = func_8089F8BC(this);
|
||||
|
||||
if (temp_v0 >= 0) {
|
||||
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;
|
||||
this->explosionCountdown = temp_v0;
|
||||
this->actionFunc = EnBubble_Regrow;
|
||||
}
|
||||
}
|
||||
|
||||
void EnBubble_Regrow(EnBubble* this, PlayState* play) {
|
||||
if (func_8089F908(this)) {
|
||||
this->actionFunc = EnBubble_Wait;
|
||||
}
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderSphere.base);
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderSphere.base);
|
||||
}
|
||||
|
||||
void EnBubble_Update(Actor* thisx, PlayState* play) {
|
||||
EnBubble* this = (EnBubble*)thisx;
|
||||
|
||||
Actor_UpdatePos(&this->actor);
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 16.0f, 16.0f, 0.0f, 7);
|
||||
this->actionFunc(this, play);
|
||||
Actor_SetFocus(&this->actor, this->actor.shape.yOffset);
|
||||
}
|
||||
|
||||
void EnBubble_Draw(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnBubble* this = (EnBubble*)thisx;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
if (this->actionFunc != EnBubble_Disappear) {
|
||||
func_8012C2DC(play->state.gfxCtx);
|
||||
Math_SmoothStepToF(&this->modelRotSpeed, 16.0f, 0.2f, 1000.0f, 0.0f);
|
||||
Math_SmoothStepToF(&this->modelEllipticity, 0.08f, 0.2f, 1000.0f, 0.0f);
|
||||
Matrix_ReplaceRotation(&play->billboardMtxF);
|
||||
Matrix_Scale(this->modelWidth + 1.0f, this->modelHeight + 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateZF(DEGF_TO_RADF((f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY);
|
||||
Matrix_Scale(this->modelEllipticity + 1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateZF(DEGF_TO_RADF(-(f32)play->state.frames) * this->modelRotSpeed, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPDisplayList(POLY_XLU_DISP++, gBubbleDL);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
|
||||
if (this->actionFunc != EnBubble_Disappear) {
|
||||
this->actor.shape.shadowScale = (this->modelWidth + 1.0f) * 0.2f;
|
||||
func_808A005C(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define Z_EN_BUBBLE_H
|
||||
|
||||
#include "global.h"
|
||||
#include "objects/object_bubble/object_bubble.h"
|
||||
|
||||
struct EnBubble;
|
||||
|
||||
@@ -10,7 +11,25 @@ typedef void (*EnBubbleActionFunc)(struct EnBubble*, PlayState*);
|
||||
typedef struct EnBubble {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ EnBubbleActionFunc actionFunc;
|
||||
/* 0x148 */ char unk_148[0x110];
|
||||
/* 0x148 */ ColliderJntSph colliderSphere;
|
||||
/* 0x168 */ ColliderJntSphElement colliderElements[2];
|
||||
/* 0x1F4 */ Vec3f unk1F4; // set but never used
|
||||
/* 0x1F4 */ Vec3f unk1F8; // randomly generated, set but never used
|
||||
/* 0x200 */ s16 timer; // set to 8 when about to pop
|
||||
/* 0x202 */ s16 explosionCountdown;
|
||||
/* 0x204 */ UNK_TYPE1 pad204[4]; // unused
|
||||
/* 0x208 */ f32 modelRotSpeed;
|
||||
/* 0x20C */ f32 modelEllipticity;
|
||||
/* 0x210 */ f32 unk_210; // set to 1.0f, never used
|
||||
/* 0x214 */ f32 unk_214; // set to 1.0f, never used
|
||||
/* 0x218 */ f32 modelWidth;
|
||||
/* 0x21C */ f32 modelHeight;
|
||||
/* 0x220 */ u8 bounceCount;
|
||||
/* 0x224 */ Vec3f bounceDirection;
|
||||
/* 0x230 */ Vec3f velocityFromBounce;
|
||||
/* 0x23C */ Vec3f normalizedBumpVelocity;
|
||||
/* 0x248 */ Vec3f velocityFromBump;
|
||||
/* 0x254 */ f32 yVelocity;
|
||||
} EnBubble; // size = 0x258
|
||||
|
||||
extern const ActorInit En_Bubble_InitVars;
|
||||
|
||||
@@ -234,7 +234,7 @@ void func_80AFE414(Actor* thisx, PlayState* play) {
|
||||
func_8012C2DC(play->state.gfxCtx);
|
||||
func_800B8118(&this->actor, play, 0);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_05AAB0);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gHeartPieceInteriorDL);
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -246,9 +246,9 @@ void func_80AFE4AC(Actor* thisx, PlayState* play) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
|
||||
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05E6F0));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropRecoveryHeartTex));
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -268,8 +268,8 @@ void func_80AFE650(Actor* thisx, PlayState* play) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
POLY_OPA_DISP = func_801660B8(play, POLY_OPA_DISP);
|
||||
POLY_OPA_DISP = func_8012C724(POLY_OPA_DISP);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05CEF0));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gDropBombTex));
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gameplay_keep_DL_05F6F0);
|
||||
gSPDisplayList(POLY_OPA_DISP++, gItemDropDL);
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ static s32 sDeadCount = 0;
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(uncullZoneForward, 3000, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, 88, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_GUAY, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
@@ -639,7 +639,7 @@ void func_80B3F78C(EnDai* this, PlayState* play) {
|
||||
};
|
||||
s32 pad;
|
||||
|
||||
if (play->actorCtx.unkB != 0) {
|
||||
if (play->actorCtx.lensActorsDrawn) {
|
||||
this->unk_1CE |= 0x40;
|
||||
} else {
|
||||
Actor_RecordUndrawnActor(play, &this->actor);
|
||||
|
||||
@@ -131,7 +131,7 @@ static CollisionCheckInfoInit2 D_808C9A30 = { 20, 28, 90, 20, 100 };
|
||||
// static InitChainEntry sInitChain[] = {
|
||||
static InitChainEntry D_808C9A60[] = {
|
||||
ICHAIN_VEC3F(scale, 0, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, 26, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_GOMESS, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 6000, ICHAIN_CONTINUE),
|
||||
ICHAIN_U8(targetMode, 5, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
@@ -109,7 +109,7 @@ static DamageTable sDamageTable = {
|
||||
};
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_S8(hintId, 77, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_MAD_SCRUB, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(gravity, -1, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 2600, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
@@ -253,7 +253,7 @@ static s32 D_8089E350 = 0;
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, 16, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_DINOLFOS, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE),
|
||||
ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
@@ -201,7 +201,7 @@ void func_80A5063C(EnDnb* this, PlayState* play) {
|
||||
void EnDnb_Draw(Actor* thisx, PlayState* play) {
|
||||
EnDnb* this = THIS;
|
||||
|
||||
if (play->actorCtx.unk4 != 0) {
|
||||
if (play->actorCtx.lensMaskSize != 0) {
|
||||
func_80A50510(this, play);
|
||||
} else {
|
||||
func_80A5063C(this, play);
|
||||
@@ -252,8 +252,8 @@ s32 func_80A5086C(EnDnbUnkStruct* arg0) {
|
||||
}
|
||||
|
||||
s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2) {
|
||||
static TexturePtr D_80A50CBC[] = {
|
||||
gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex,
|
||||
static TexturePtr sDustTextures[] = {
|
||||
gEffDust8Tex, gEffDust7Tex, gEffDust6Tex, gEffDust5Tex, gEffDust4Tex, gEffDust3Tex, gEffDust2Tex, gEffDust1Tex,
|
||||
};
|
||||
PlayState* play = play2;
|
||||
s32 isGfxSetup = false;
|
||||
@@ -286,7 +286,7 @@ s32 func_80A50950(EnDnbUnkStruct* arg0, PlayState* play2) {
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
idx = (arg0->unk_01 / (f32)arg0->unk_02) * 8.0f;
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A50CBC[idx]));
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(sDustTextures[idx]));
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_hanareyama_obj_DL_000020);
|
||||
|
||||
Matrix_Pop();
|
||||
|
||||
@@ -273,7 +273,7 @@ static DamageTable sDamageTable = {
|
||||
static CollisionCheckInfoInit sColChkInfoInit = { 3, 100, 100, 80 };
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_S8(hintId, 13, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_DODONGO, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 1400, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
@@ -242,7 +242,7 @@ void EnDragon_Init(Actor* thisx, PlayState* play) {
|
||||
this->pythonIndex = EN_DRAGON_GET_PYTHON_INDEX(&this->actor);
|
||||
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
|
||||
this->action = DEEP_PYTHON_ACTION_IDLE;
|
||||
this->actor.hintId = 0xE;
|
||||
this->actor.hintId = TATL_HINT_ID_DEEP_PYTHON;
|
||||
this->scale = 0.5f;
|
||||
this->actor.flags &= ~ACTOR_FLAG_8000000;
|
||||
|
||||
@@ -317,7 +317,8 @@ void EnDragon_SpawnBubbles(EnDragon* this, PlayState* play, Vec3f basePos) {
|
||||
sBubbleAccel.y = Rand_ZeroFloat(1.0f) * 20.0f * 3.0f;
|
||||
scale = Rand_S16Offset(380, 240);
|
||||
EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &sBubbleVelocity, &sBubbleAccel,
|
||||
&sBubblePrimColors[colorIndex], &sBubbleEnvColors[colorIndex], scale, 30, 0);
|
||||
&sBubblePrimColors[colorIndex], &sBubbleEnvColors[colorIndex], scale, 30,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ typedef struct EnDyExtra {
|
||||
/* 0x14C */ s16 unk14C;
|
||||
/* 0x14E */ s16 unk14E;
|
||||
/* 0x150 */ f32 unk150;
|
||||
/* 0x154 */ char unk154[0xC];
|
||||
/* 0x154 */ UNK_TYPE1 unk154[0xC];
|
||||
/* 0x160 */ Vec3f unk160;
|
||||
} EnDyExtra; // size = 0x16C
|
||||
|
||||
|
||||
@@ -675,8 +675,7 @@ void func_8088DD34(EnElf* this, PlayState* play) {
|
||||
!func_8088C804(&this->actor.world.pos, &refActor->actor.world.pos, 10.0f)) {
|
||||
Health_ChangeBy(play, 0x80);
|
||||
if (this->fairyFlags & 0x200) {
|
||||
Parameter_AddMagic(play, ((void)0, gSaveContext.unk_3F30) +
|
||||
(gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30);
|
||||
Magic_Add(play, MAGIC_FILL_TO_CAPACITY);
|
||||
}
|
||||
gSaveContext.jinxTimer = 0;
|
||||
this->unk_254 = 50.0f;
|
||||
@@ -1464,7 +1463,7 @@ void func_8089010C(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
if (player->tatlTextId < 0) {
|
||||
thisx->flags |= 0x10000;
|
||||
thisx->flags |= ACTOR_FLAG_10000;
|
||||
}
|
||||
|
||||
if (Actor_ProcessTalkRequest(thisx, &play->state)) {
|
||||
@@ -1481,7 +1480,7 @@ void func_8089010C(Actor* thisx, PlayState* play) {
|
||||
thisx->update = func_8088FE64;
|
||||
func_8088C51C(this, 3);
|
||||
if (this->elfMsg != NULL) {
|
||||
this->elfMsg->flags |= 0x100;
|
||||
this->elfMsg->flags |= ACTOR_FLAG_100;
|
||||
thisx->cutscene = this->elfMsg->cutscene;
|
||||
if (thisx->cutscene != -1) {
|
||||
func_8088FD04(this);
|
||||
@@ -1493,7 +1492,7 @@ void func_8089010C(Actor* thisx, PlayState* play) {
|
||||
} else {
|
||||
thisx->cutscene = -1;
|
||||
}
|
||||
thisx->flags &= ~0x10000;
|
||||
thisx->flags &= ~ACTOR_FLAG_10000;
|
||||
} else if (this->unk_264 & 4) {
|
||||
thisx->focus.pos = thisx->world.pos;
|
||||
this->fairyFlags |= 0x10;
|
||||
|
||||
@@ -62,7 +62,7 @@ void EnElfbub_Init(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 16.0f, ActorShadow_DrawCircle, 0.2f);
|
||||
this->actor.hintId = 0x16;
|
||||
this->actor.hintId = TATL_HINT_ID_IGOS_DU_IKANA;
|
||||
Actor_SetScale(&this->actor, 1.25f);
|
||||
|
||||
this->actionFunc = EnElfbub_Idle;
|
||||
@@ -113,7 +113,7 @@ void EnElfbub_Pop(EnElfbub* this, PlayState* play) {
|
||||
velocity.y = Rand_ZeroOne() * 7.0f;
|
||||
velocity.z = (Rand_ZeroOne() - 0.5f) * 7.0f;
|
||||
EffectSsDtBubble_SpawnCustomColor(play, &pos, &velocity, &sAccel, &sPrimColor, &sEnvColor,
|
||||
Rand_S16Offset(100, 50), 25, 0);
|
||||
Rand_S16Offset(100, 50), 25, false);
|
||||
}
|
||||
|
||||
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 60, NA_SE_EN_AWA_BREAK);
|
||||
@@ -161,7 +161,7 @@ void EnElfbub_Draw(Actor* thisx, PlayState* play2) {
|
||||
Matrix_RotateZS(this->zRot * -1, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_bubble_DL_001000);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gBubbleDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ void EnElfgrp_Init(Actor* thisx, PlayState* play) {
|
||||
break;
|
||||
|
||||
case ENELFGRP_2:
|
||||
if (gSaveContext.save.playerData.doubleMagic == true) {
|
||||
if (gSaveContext.save.playerData.isDoubleMagicAcquired == true) {
|
||||
func_80A396B0(this, 1);
|
||||
}
|
||||
break;
|
||||
@@ -156,7 +156,7 @@ void EnElfgrp_Init(Actor* thisx, PlayState* play) {
|
||||
func_80A396B0(this, 3);
|
||||
this->unk_14A |= 2;
|
||||
}
|
||||
} else if (gSaveContext.save.playerData.magicAcquired == true) {
|
||||
} else if (gSaveContext.save.playerData.isMagicAcquired == true) {
|
||||
func_80A396B0(this, 1);
|
||||
}
|
||||
} else {
|
||||
@@ -477,8 +477,7 @@ void func_80A3A610(EnElfgrp* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (this->unk_144 == 60) {
|
||||
Parameter_AddMagic(play,
|
||||
((void)0, gSaveContext.unk_3F30) + (gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30);
|
||||
Magic_Add(play, MAGIC_FILL_TO_CAPACITY);
|
||||
gSaveContext.healthAccumulator = 320;
|
||||
}
|
||||
|
||||
|
||||
@@ -263,7 +263,7 @@ void EnElforg_MoveToTarget(EnElforg* this, Vec3f* targetPos) {
|
||||
}
|
||||
|
||||
void func_80ACCBB8(EnElforg* this, PlayState* play) {
|
||||
play->actorCtx.unk5 |= 8;
|
||||
play->actorCtx.flags |= ACTORCTX_FLAG_3;
|
||||
}
|
||||
|
||||
void EnElforg_TrappedByBubble(EnElforg* this, PlayState* play) {
|
||||
|
||||
@@ -15,7 +15,6 @@ void EnEncount1_Update(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_808E0954(EnEncount1* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Encount1_InitVars = {
|
||||
ACTOR_EN_ENCOUNT1,
|
||||
ACTORCAT_PROP,
|
||||
@@ -28,10 +27,129 @@ const ActorInit En_Encount1_InitVars = {
|
||||
(ActorFunc)NULL,
|
||||
};
|
||||
|
||||
#endif
|
||||
static s16 sActorList[] = {
|
||||
ACTOR_EN_GRASSHOPPER,
|
||||
ACTOR_EN_WALLMAS,
|
||||
ACTOR_EN_PR2,
|
||||
ACTOR_EN_PR2,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount1/EnEncount1_Init.s")
|
||||
static s16 sActorParams[] = { 1, 0, 1, 3 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount1/func_808E0954.s")
|
||||
void EnEncount1_Init(Actor* thisx, PlayState* play) {
|
||||
EnEncount1* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Encount1/EnEncount1_Update.s")
|
||||
if (this->actor.params <= 0) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
||||
this->actorType = ENENCOUNT1_GET_TYPE(&this->actor);
|
||||
this->unk_14C = ENENCOUNT1_GET_7C0(&this->actor);
|
||||
this->unk_154 = ENENCOUNT1_GET_PATH(&this->actor);
|
||||
this->unk_158 = this->actor.world.rot.x;
|
||||
this->unk_15C = this->actor.world.rot.y;
|
||||
this->unk_160 = (this->actor.world.rot.z * 40.0f) + 120.0f;
|
||||
|
||||
if (this->unk_154 >= 0x3F) {
|
||||
this->unk_154 = -1;
|
||||
}
|
||||
if (this->actor.world.rot.z < 0) {
|
||||
this->unk_160 = -1.0f;
|
||||
}
|
||||
if (this->actorType == EN_ENCOUNT1_SKULLFISH_2) {
|
||||
this->unk_15A = ENENCOUNT1_GET_PATH(&this->actor);
|
||||
this->path = SubS_GetPathByIndex(play, this->unk_15A, 0x3F);
|
||||
this->unk_154 = -1;
|
||||
this->unk_160 = -1.0f;
|
||||
}
|
||||
this->actor.flags &= ~ACTOR_FLAG_1;
|
||||
this->actionFunc = func_808E0954;
|
||||
}
|
||||
|
||||
void func_808E0954(EnEncount1* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
Vec3f spawnPos;
|
||||
f32 sp64;
|
||||
f32 temp_fv0_2;
|
||||
s16 sp5E;
|
||||
s16 actorList;
|
||||
s32 actorParams;
|
||||
CollisionPoly* sp54;
|
||||
s32 sp50;
|
||||
|
||||
if (((this->unk_14E >= this->unk_14C) || ((this->unk_160 > 0.0f) && (this->unk_160 < this->actor.xzDistToPlayer)) ||
|
||||
((this->unk_154 > 0) && (this->unk_154 <= this->unk_152)))) {
|
||||
return;
|
||||
} else if (this->unk_156 != 0) {
|
||||
this->unk_156++;
|
||||
if (this->unk_156 < this->unk_158) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this->unk_156 = 0;
|
||||
switch (this->actorType) {
|
||||
case EN_ENCOUNT1_GRASSHOPPER:
|
||||
sp64 = randPlusMinusPoint5Scaled(40.0f) + 200.0f;
|
||||
sp5E = player->actor.shape.rot.y;
|
||||
if (this->unk_14E & 1) {
|
||||
sp5E = -sp5E;
|
||||
sp64 = randPlusMinusPoint5Scaled(20.0f) + 100.0f;
|
||||
}
|
||||
spawnPos.x = player->actor.world.pos.x + (Math_SinS(sp5E) * sp64) + randPlusMinusPoint5Scaled(40.0f);
|
||||
spawnPos.y = player->actor.floorHeight + 120.0f;
|
||||
spawnPos.z = player->actor.world.pos.z + (Math_CosS(sp5E) * sp64) + randPlusMinusPoint5Scaled(40.0f);
|
||||
temp_fv0_2 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp54, &sp50, &this->actor, &spawnPos);
|
||||
if ((temp_fv0_2 <= BGCHECK_Y_MIN) ||
|
||||
((player->actor.depthInWater != BGCHECK_Y_MIN) &&
|
||||
(temp_fv0_2 < (player->actor.world.pos.y - player->actor.depthInWater)))) {
|
||||
return;
|
||||
}
|
||||
spawnPos.y = temp_fv0_2;
|
||||
break;
|
||||
|
||||
case EN_ENCOUNT1_WALLMASTER:
|
||||
Math_Vec3f_Copy(&spawnPos, &player->actor.world.pos);
|
||||
break;
|
||||
|
||||
case EN_ENCOUNT1_SKULLFISH:
|
||||
sp64 = randPlusMinusPoint5Scaled(250.0f) + 500.0f;
|
||||
sp5E = player->actor.shape.rot.y;
|
||||
spawnPos.x = player->actor.world.pos.x + Math_SinS(sp5E) * sp64 + randPlusMinusPoint5Scaled(40.0f);
|
||||
spawnPos.y = player->actor.world.pos.y - Rand_ZeroFloat(20.0f);
|
||||
spawnPos.z = player->actor.world.pos.z + (Math_CosS(sp5E) * sp64) + randPlusMinusPoint5Scaled(40.0f);
|
||||
temp_fv0_2 = BgCheck_EntityRaycastFloor5(&play->colCtx, &sp54, &sp50, &this->actor, &spawnPos);
|
||||
if ((!(player->stateFlags1 & 0x8000000) || (temp_fv0_2 <= (BGCHECK_Y_MIN)) ||
|
||||
(player->actor.depthInWater < temp_fv0_2))) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case EN_ENCOUNT1_SKULLFISH_2:
|
||||
if ((this->path != NULL) && (!SubS_CopyPointFromPath(this->path, 0, &spawnPos))) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
actorList = sActorList[this->actorType];
|
||||
actorParams = sActorParams[this->actorType];
|
||||
if (Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, actorList, spawnPos.x, spawnPos.y, spawnPos.z, 0, 0, 0,
|
||||
actorParams) != NULL) {
|
||||
this->unk_14E++;
|
||||
if (this->unk_154 > 0) {
|
||||
this->unk_152++;
|
||||
}
|
||||
|
||||
if ((this->unk_14E >= this->unk_14C) && (this->unk_158 != 0)) {
|
||||
this->unk_156 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnEncount1_Update(Actor* thisx, PlayState* play) {
|
||||
EnEncount1* this = THIS;
|
||||
|
||||
this->actionFunc(this, play);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define ENENCOUNT1_GET_TYPE(thisx) (((thisx)->params >> 11) & 0x1F)
|
||||
#define ENENCOUNT1_GET_7C0(thisx) (((thisx)->params >> 6) & 0x1F)
|
||||
#define ENENCOUNT1_GET_PATH(thisx) ((thisx)->params & 0x3F)
|
||||
|
||||
typedef enum EnEncount1Enemy {
|
||||
/* 0x0 */ EN_ENCOUNT1_GRASSHOPPER,
|
||||
/* 0x1 */ EN_ENCOUNT1_WALLMASTER,
|
||||
/* 0x2 */ EN_ENCOUNT1_SKULLFISH,
|
||||
/* 0x3 */ EN_ENCOUNT1_SKULLFISH_2,
|
||||
} EnEncount1Enemy;
|
||||
|
||||
struct EnEncount1;
|
||||
|
||||
typedef void (*EnEncount1ActionFunc)(struct EnEncount1*, PlayState*);
|
||||
@@ -10,11 +21,17 @@ typedef void (*EnEncount1ActionFunc)(struct EnEncount1*, PlayState*);
|
||||
typedef struct EnEncount1 {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ EnEncount1ActionFunc actionFunc;
|
||||
/* 0x148 */ char unk_148[0x6];
|
||||
/* 0x148 */ Path* path;
|
||||
/* 0x14C */ s16 unk_14C;
|
||||
/* 0x14E */ s16 unk_14E;
|
||||
/* 0x150 */ char unk_150[0xA];
|
||||
/* 0x150 */ s16 actorType;
|
||||
/* 0x152 */ s16 unk_152;
|
||||
/* 0x154 */ s16 unk_154;
|
||||
/* 0x156 */ s16 unk_156;
|
||||
/* 0x158 */ s16 unk_158;
|
||||
/* 0x15A */ s16 unk_15A;
|
||||
/* 0x15C */ char unk_15C[0x8];
|
||||
/* 0x15C */ s32 unk_15C;
|
||||
/* 0x160 */ f32 unk_160;
|
||||
} EnEncount1; // size = 0x164
|
||||
|
||||
extern const ActorInit En_Encount1_InitVars;
|
||||
|
||||
@@ -114,7 +114,7 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) {
|
||||
this->dyna.actor.targetMode = 6;
|
||||
this->dyna.actor.colChkInfo.health = 1;
|
||||
this->scale = 0.1;
|
||||
this->switchFlag = GET_ENCOUNT2_SWITCH_FLAG(this);
|
||||
this->switchFlag = ENCOUNT2_GET_SWITCH_FLAG(&this->dyna.actor);
|
||||
|
||||
if (this->switchFlag == 0x7F) {
|
||||
this->switchFlag = -1;
|
||||
@@ -137,6 +137,7 @@ void EnEncount2_Init(Actor* thisx, PlayState* play) {
|
||||
|
||||
void EnEncount2_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnEncount2* this = THIS;
|
||||
|
||||
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
Collider_DestroyJntSph(play, &this->collider);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef struct EnEncount2 {
|
||||
/* 0x01D0 */ EnEncount2Effect effects[EN_ENCOUNT2_EFFECT_COUNT];
|
||||
} EnEncount2; // size = 0x2A70
|
||||
|
||||
#define GET_ENCOUNT2_SWITCH_FLAG(actor) ((s16)(((Actor*)actor)->params & 0x7F))
|
||||
#define ENCOUNT2_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F)
|
||||
|
||||
extern const ActorInit En_Encount2_InitVars;
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ void EnFall_Setup(EnFall* this, PlayState* play) {
|
||||
this->actor.draw = NULL;
|
||||
this->actionFunc = EnFall_MoonsTear_Fall;
|
||||
Actor_SetScale(&this->actor, 0.02f);
|
||||
if (!(play->actorCtx.unk5 & 2)) {
|
||||
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
|
||||
Actor_MarkForDeath(&this->actor);
|
||||
}
|
||||
moon = EnFall_MoonsTear_GetTerminaFieldMoon(play);
|
||||
|
||||
@@ -154,7 +154,7 @@ static AnimatedMaterial* sEmblemAnimatedMats[] = {
|
||||
};
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_S8(hintId, 15, ICHAIN_CONTINUE),
|
||||
ICHAIN_S8(hintId, TATL_HINT_ID_DEATH_ARMOS, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(targetArrowOffset, 3500, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
@@ -166,7 +166,7 @@ void EnFamos_Init(Actor* thisx, PlayState* play) {
|
||||
s32 i;
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
if (GET_FAMOS_PATH(thisx) != 0xFF) {
|
||||
if (FAMOS_GET_PATH(thisx) != 0xFF) {
|
||||
path = &play->setupPathList[this->actor.params];
|
||||
this->pathPoints = Lib_SegmentedToVirtual(path->points);
|
||||
this->pathNodeCount = path->count;
|
||||
@@ -193,7 +193,7 @@ void EnFamos_Init(Actor* thisx, PlayState* play) {
|
||||
this->actor.colChkInfo.mass = 250;
|
||||
this->baseHeight = this->actor.world.pos.y;
|
||||
// params: [this->actor.shape.rot.x] is used to set aggro distance
|
||||
this->aggroDistance = (GET_FAMOS_AGGRO_DISTANCE(thisx) <= 0) ? (200.0f) : (this->actor.shape.rot.x * 40.0f * 0.1f);
|
||||
this->aggroDistance = (FAMOS_GET_AGGRO_DISTANCE(thisx) <= 0) ? (200.0f) : (this->actor.shape.rot.x * 40.0f * 0.1f);
|
||||
this->actor.shape.rot.x = 0;
|
||||
this->actor.world.rot.x = 0;
|
||||
this->hasFinishedRotating = true;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user