Merge remote-tracking branch 'upstream/master' into play

This commit is contained in:
Derek Hensley
2022-10-04 17:38:41 -07:00
315 changed files with 13597 additions and 6414 deletions
+6 -6
View File
@@ -5,22 +5,22 @@ volatile OSTime sIrqMgrResetTime = 0;
volatile OSTime sIrqMgrRetraceTime = 0;
s32 sIrqMgrRetraceCount = 0;
void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* param_2, OSMesgQueue* param_3) {
void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* client, OSMesgQueue* msgQueue) {
u32 saveMask;
saveMask = osSetIntMask(1);
param_2->queue = param_3;
param_2->next = irqmgr->callbacks;
irqmgr->callbacks = param_2;
client->queue = msgQueue;
client->next = irqmgr->callbacks;
irqmgr->callbacks = client;
osSetIntMask(saveMask);
if (irqmgr->prenmiStage > 0) {
osSendMesg(param_2->queue, &irqmgr->prenmiMsg.type, OS_MESG_NOBLOCK);
osSendMesg(client->queue, &irqmgr->prenmiMsg.type, OS_MESG_NOBLOCK);
}
if (irqmgr->prenmiStage > 1) {
osSendMesg(param_2->queue, &irqmgr->nmiMsg.type, OS_MESG_NOBLOCK);
osSendMesg(client->queue, &irqmgr->nmiMsg.type, OS_MESG_NOBLOCK);
}
}
+2 -2
View File
@@ -3,7 +3,7 @@
u8 sYaz0DataBuffer[0x400];
u8* sYaz0CurDataEnd;
u32 sYaz0CurRomStart;
uintptr_t sYaz0CurRomStart;
u32 sYaz0CurSize;
u8* sYaz0MaxPtr;
u8* D_8009BE20;
@@ -123,7 +123,7 @@ s32 Yaz0_DecompressImpl(u8* src, u8* dst) {
return 0;
}
void Yaz0_Decompress(u32 romStart, void* dst, size_t size) {
void Yaz0_Decompress(uintptr_t romStart, void* dst, size_t size) {
s32 status;
u32 pad;
char sp80[0x50];
+3 -3
View File
@@ -60,7 +60,7 @@ s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
return osEPiStartDma(pihandle, mb, direction);
}
DmaEntry* DmaMgr_FindDmaEntry(u32 vrom) {
DmaEntry* DmaMgr_FindDmaEntry(uintptr_t vrom) {
DmaEntry* curr;
for (curr = dmadata; curr->vromEnd != 0; curr++) {
@@ -77,7 +77,7 @@ DmaEntry* DmaMgr_FindDmaEntry(u32 vrom) {
return NULL;
}
u32 DmaMgr_TranslateVromToRom(u32 vrom) {
u32 DmaMgr_TranslateVromToRom(uintptr_t vrom) {
DmaEntry* entry = DmaMgr_FindDmaEntry(vrom);
if (entry != NULL) {
@@ -95,7 +95,7 @@ u32 DmaMgr_TranslateVromToRom(u32 vrom) {
return -1;
}
s32 DmaMgr_FindDmaIndex(u32 vrom) {
s32 DmaMgr_FindDmaIndex(uintptr_t vrom) {
DmaEntry* entry = DmaMgr_FindDmaEntry(vrom);
if (entry != NULL) {
+85 -8
View File
@@ -857,22 +857,99 @@ EnvelopePoint gDefaultEnvelope[] = {
{ ADSR_DISABLE, 0 },
};
NoteSubEu gZeroNoteSub = { 0 };
NoteSampleState gZeroedSampleState = { 0 };
NoteSubEu gDefaultNoteSub = {
{ 1, 1, 0, 0, 0, 0, 0, 0 }, { 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
NoteSampleState gDefaultSampleState = {
{ true, true, false, false, false, false, false, false },
{ 0 },
0, // gain
0, // haasEffectLeftDelaySize
0, // haasEffectRightDelaySize
0, // targetReverbVol
0, // harmonicIndexCurAndPrev
0, // combFilterSize
0, // targetVolLeft
0, // targetVolRight
0, // frequencyFixedPoint
0, // combFilterGain
NULL, // tunedSample
NULL, // filter
0, // unk_18
0, // surroundEffectIndex
0, // unk_1A
};
u16 gHeadsetPanQuantization[64] = {
60, 58, 56, 54, 52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18,
16, 14, 12, 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
u16 gHaasEffectDelaySize[64] = {
30 * SAMPLE_SIZE,
29 * SAMPLE_SIZE,
28 * SAMPLE_SIZE,
27 * SAMPLE_SIZE,
26 * SAMPLE_SIZE,
25 * SAMPLE_SIZE,
24 * SAMPLE_SIZE,
23 * SAMPLE_SIZE,
22 * SAMPLE_SIZE,
21 * SAMPLE_SIZE,
20 * SAMPLE_SIZE,
19 * SAMPLE_SIZE,
18 * SAMPLE_SIZE,
17 * SAMPLE_SIZE,
16 * SAMPLE_SIZE,
15 * SAMPLE_SIZE,
14 * SAMPLE_SIZE,
13 * SAMPLE_SIZE,
12 * SAMPLE_SIZE,
11 * SAMPLE_SIZE,
10 * SAMPLE_SIZE,
9 * SAMPLE_SIZE,
8 * SAMPLE_SIZE,
7 * SAMPLE_SIZE,
6 * SAMPLE_SIZE,
5 * SAMPLE_SIZE,
4 * SAMPLE_SIZE,
3 * SAMPLE_SIZE,
2 * SAMPLE_SIZE,
1 * SAMPLE_SIZE,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
s32 D_801D58A4 = 0;
// clang-format off
s16 D_801D58A8[] = {
s16 gInvalidAdpcmCodeBook[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
+142 -122
View File
@@ -10,7 +10,7 @@ void AudioHeap_DiscardSampleCaches(void);
void AudioHeap_DiscardSampleBank(s32 sampleBankId);
void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId);
void AudioHeap_DiscardSampleBanks(void);
void AudioHeap_InitReverb(s32 reverbIndex, ReverbSettings* settings, s32 flags);
void AudioHeap_InitReverb(s32 reverbIndex, ReverbSettings* settings, s32 isFirstInit);
#define gTatumsPerBeat (gAudioTatumInit[1])
@@ -421,7 +421,7 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) {
if (loadStatusEntry0 == LOAD_STATUS_MAYBE_DISCARDABLE) {
for (i = 0; i < gAudioContext.numNotes; i++) {
if ((gAudioContext.notes[i].playbackState.fontId == temporaryCache->entries[0].id) &&
gAudioContext.notes[i].noteSubEu.bitField0.enabled) {
gAudioContext.notes[i].sampleState.bitField0.enabled) {
break;
}
}
@@ -435,7 +435,7 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) {
if (loadStatusEntry1 == LOAD_STATUS_MAYBE_DISCARDABLE) {
for (i = 0; i < gAudioContext.numNotes; i++) {
if ((gAudioContext.notes[i].playbackState.fontId == temporaryCache->entries[1].id) &&
gAudioContext.notes[i].noteSubEu.bitField0.enabled) {
gAudioContext.notes[i].sampleState.bitField0.enabled) {
break;
}
}
@@ -491,7 +491,7 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) {
if (loadStatusEntry0 == LOAD_STATUS_COMPLETE) {
for (i = 0; i < gAudioContext.numNotes; i++) {
if ((gAudioContext.notes[i].playbackState.fontId == temporaryCache->entries[0].id) &&
gAudioContext.notes[i].noteSubEu.bitField0.enabled) {
gAudioContext.notes[i].sampleState.bitField0.enabled) {
break;
}
}
@@ -504,7 +504,7 @@ void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id) {
if (loadStatusEntry1 == LOAD_STATUS_COMPLETE) {
for (i = 0; i < gAudioContext.numNotes; i++) {
if ((gAudioContext.notes[i].playbackState.fontId == temporaryCache->entries[1].id) &&
gAudioContext.notes[i].noteSubEu.bitField0.enabled) {
gAudioContext.notes[i].sampleState.bitField0.enabled) {
break;
}
}
@@ -814,7 +814,7 @@ void AudioHeap_UpdateReverb(SynthesisReverb* reverb) {
void AudioHeap_UpdateReverbs(void) {
s32 count;
s32 i;
s32 reverbIndex;
s32 j;
if (gAudioContext.audioBufferParameters.specUnk4 == 2) {
@@ -823,9 +823,9 @@ void AudioHeap_UpdateReverbs(void) {
count = 1;
}
for (i = 0; i < gAudioContext.numSynthesisReverbs; i++) {
for (reverbIndex = 0; reverbIndex < gAudioContext.numSynthesisReverbs; reverbIndex++) {
for (j = 0; j < count; j++) {
AudioHeap_UpdateReverb(&gAudioContext.synthesisReverbs[i]);
AudioHeap_UpdateReverb(&gAudioContext.synthesisReverbs[reverbIndex]);
}
}
}
@@ -837,7 +837,7 @@ void AudioHeap_ClearAiBuffers(void) {
s32 curAiBufferIndex = gAudioContext.curAiBufferIndex;
s32 i;
gAudioContext.aiBufNumSamples[curAiBufferIndex] = gAudioContext.audioBufferParameters.minAiBufNumSamples;
gAudioContext.aiBufNumSamples[curAiBufferIndex] = gAudioContext.audioBufferParameters.numSamplesPerFrameMin;
for (i = 0; i < AIBUF_LEN; i++) {
gAudioContext.aiBuffers[curAiBufferIndex][i] = 0;
@@ -870,7 +870,7 @@ s32 AudioHeap_ResetStep(void) {
AudioHeap_UpdateReverbs();
} else {
for (i = 0; i < gAudioContext.numNotes; i++) {
if (gAudioContext.notes[i].noteSubEu.bitField0.enabled &&
if (gAudioContext.notes[i].sampleState.bitField0.enabled &&
gAudioContext.notes[i].playbackState.adsr.action.s.state != ADSR_STATE_DISABLED) {
gAudioContext.notes[i].playbackState.adsr.fadeOutVel =
gAudioContext.audioBufferParameters.updatesPerFrameInv;
@@ -907,7 +907,7 @@ s32 AudioHeap_ResetStep(void) {
AudioHeap_Init();
gAudioContext.resetStatus = 0;
for (i = 0; i < ARRAY_COUNT(gAudioContext.aiBufNumSamples); i++) {
gAudioContext.aiBufNumSamples[i] = gAudioContext.audioBufferParameters.maxAiBufNumSamples;
gAudioContext.aiBufNumSamples[i] = gAudioContext.audioBufferParameters.numSamplesPerFrameMax;
for (j = 0; j < AIBUF_LEN; j++) {
gAudioContext.aiBuffers[i][j] = 0;
}
@@ -930,8 +930,8 @@ void AudioHeap_Init(void) {
size_t cachePoolSize;
size_t miscPoolSize;
u32 intMask;
s32 reverbIndex;
s32 i;
s32 j;
s32 pad2;
AudioSpec* spec = &gAudioSpecs[gAudioContext.audioResetSpecIdToLoad]; // Audio Specifications
@@ -942,19 +942,22 @@ void AudioHeap_Init(void) {
gAudioContext.audioBufferParameters.aiSamplingFreq =
osAiSetFrequency(gAudioContext.audioBufferParameters.samplingFreq);
gAudioContext.audioBufferParameters.samplesPerFrameTarget =
gAudioContext.audioBufferParameters.numSamplesPerFrameTarget =
ALIGN16(gAudioContext.audioBufferParameters.samplingFreq / gAudioContext.refreshRate);
gAudioContext.audioBufferParameters.minAiBufNumSamples =
gAudioContext.audioBufferParameters.samplesPerFrameTarget - 0x10;
gAudioContext.audioBufferParameters.maxAiBufNumSamples =
gAudioContext.audioBufferParameters.samplesPerFrameTarget + 0x10;
gAudioContext.audioBufferParameters.numSamplesPerFrameMin =
gAudioContext.audioBufferParameters.numSamplesPerFrameTarget - 0x10;
gAudioContext.audioBufferParameters.numSamplesPerFrameMax =
gAudioContext.audioBufferParameters.numSamplesPerFrameTarget + 0x10;
gAudioContext.audioBufferParameters.updatesPerFrame =
((gAudioContext.audioBufferParameters.samplesPerFrameTarget + 0x10) / 0xD0) + 1;
gAudioContext.audioBufferParameters.samplesPerUpdate = (gAudioContext.audioBufferParameters.samplesPerFrameTarget /
gAudioContext.audioBufferParameters.updatesPerFrame) &
~7;
gAudioContext.audioBufferParameters.samplesPerUpdateMax = gAudioContext.audioBufferParameters.samplesPerUpdate + 8;
gAudioContext.audioBufferParameters.samplesPerUpdateMin = gAudioContext.audioBufferParameters.samplesPerUpdate - 8;
((gAudioContext.audioBufferParameters.numSamplesPerFrameTarget + 0x10) / 0xD0) + 1;
gAudioContext.audioBufferParameters.numSamplesPerUpdate =
(gAudioContext.audioBufferParameters.numSamplesPerFrameTarget /
gAudioContext.audioBufferParameters.updatesPerFrame) &
~7;
gAudioContext.audioBufferParameters.numSamplesPerUpdateMax =
gAudioContext.audioBufferParameters.numSamplesPerUpdate + 8;
gAudioContext.audioBufferParameters.numSamplesPerUpdateMin =
gAudioContext.audioBufferParameters.numSamplesPerUpdate - 8;
gAudioContext.audioBufferParameters.resampleRate = 32000.0f / (s32)gAudioContext.audioBufferParameters.samplingFreq;
gAudioContext.audioBufferParameters.updatesPerFrameInvScaled =
(1.0f / 256.0f) / gAudioContext.audioBufferParameters.updatesPerFrame;
@@ -984,13 +987,13 @@ void AudioHeap_Init(void) {
gAudioContext.unk_2870 /= gAudioContext.tempoInternalToExternal;
gAudioContext.audioBufferParameters.specUnk4 = spec->unk_04;
gAudioContext.audioBufferParameters.samplesPerFrameTarget *= gAudioContext.audioBufferParameters.specUnk4;
gAudioContext.audioBufferParameters.maxAiBufNumSamples *= gAudioContext.audioBufferParameters.specUnk4;
gAudioContext.audioBufferParameters.minAiBufNumSamples *= gAudioContext.audioBufferParameters.specUnk4;
gAudioContext.audioBufferParameters.numSamplesPerFrameTarget *= gAudioContext.audioBufferParameters.specUnk4;
gAudioContext.audioBufferParameters.numSamplesPerFrameMax *= gAudioContext.audioBufferParameters.specUnk4;
gAudioContext.audioBufferParameters.numSamplesPerFrameMin *= gAudioContext.audioBufferParameters.specUnk4;
gAudioContext.audioBufferParameters.updatesPerFrame *= gAudioContext.audioBufferParameters.specUnk4;
if (gAudioContext.audioBufferParameters.specUnk4 >= 2) {
gAudioContext.audioBufferParameters.maxAiBufNumSamples -= 0x10;
gAudioContext.audioBufferParameters.numSamplesPerFrameMax -= 0x10;
}
// Determine the maximum allowable number of audio command list entries for the rsp microcode
@@ -1037,13 +1040,13 @@ void AudioHeap_Init(void) {
gAudioContext.notes = AudioHeap_AllocZeroed(&gAudioContext.miscPool, gAudioContext.numNotes * sizeof(Note));
AudioPlayback_NoteInitAll();
AudioPlayback_InitNoteFreeList();
gAudioContext.noteSubsEu =
gAudioContext.sampleStateList =
AudioHeap_AllocZeroed(&gAudioContext.miscPool, gAudioContext.audioBufferParameters.updatesPerFrame *
gAudioContext.numNotes * sizeof(NoteSubEu));
gAudioContext.numNotes * sizeof(NoteSampleState));
// Initialize audio binary interface command list buffer
for (j = 0; j < ARRAY_COUNT(gAudioContext.abiCmdBufs); j++) {
gAudioContext.abiCmdBufs[j] =
for (i = 0; i < ARRAY_COUNT(gAudioContext.abiCmdBufs); i++) {
gAudioContext.abiCmdBufs[i] =
AudioHeap_AllocDmaMemoryZeroed(&gAudioContext.miscPool, gAudioContext.maxAudioCmds * sizeof(Acmd));
}
@@ -1052,20 +1055,20 @@ void AudioHeap_Init(void) {
AudioHeap_InitAdsrDecayTable();
// Initialize reverbs
for (i = 0; i < ARRAY_COUNT(gAudioContext.synthesisReverbs); i++) {
gAudioContext.synthesisReverbs[i].useReverb = 0;
for (reverbIndex = 0; reverbIndex < ARRAY_COUNT(gAudioContext.synthesisReverbs); reverbIndex++) {
gAudioContext.synthesisReverbs[reverbIndex].useReverb = 0;
}
gAudioContext.numSynthesisReverbs = spec->numReverbs;
for (i = 0; i < gAudioContext.numSynthesisReverbs; i++) {
AudioHeap_InitReverb(i, &spec->reverbSettings[i], 1);
for (reverbIndex = 0; reverbIndex < gAudioContext.numSynthesisReverbs; reverbIndex++) {
AudioHeap_InitReverb(reverbIndex, &spec->reverbSettings[reverbIndex], true);
}
// Initialize sequence players
AudioSeq_InitSequencePlayers();
for (j = 0; j < gAudioContext.audioBufferParameters.numSequencePlayers; j++) {
AudioSeq_InitSequencePlayerChannels(j);
AudioSeq_ResetSequencePlayer(&gAudioContext.seqPlayers[j]);
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
AudioSeq_InitSequencePlayerChannels(i);
AudioSeq_ResetSequencePlayer(&gAudioContext.seqPlayers[i]);
}
// Initialize two additional caches on the audio heap to store individual audio samples
@@ -1529,149 +1532,165 @@ void AudioHeap_DiscardSampleBanks(void) {
}
}
void AudioHeap_SetReverbData(s32 reverbIndex, u32 dataType, s32 data, s32 flags) {
s32 windowSize;
void AudioHeap_SetReverbData(s32 reverbIndex, u32 dataType, s32 data, s32 isFirstInit) {
s32 delayNumSamples;
SynthesisReverb* reverb = &gAudioContext.synthesisReverbs[reverbIndex];
switch (dataType) {
case 0:
AudioHeap_InitReverb(reverbIndex, (ReverbSettings*)data, 0);
case REVERB_DATA_TYPE_SETTINGS:
AudioHeap_InitReverb(reverbIndex, (ReverbSettings*)data, false);
break;
case 1:
case REVERB_DATA_TYPE_DELAY:
if (data < 4) {
data = 4;
}
windowSize = data * 64;
if (windowSize < 0x100) {
windowSize = 0x100;
delayNumSamples = data * 64;
if (delayNumSamples < (16 * SAMPLES_PER_FRAME)) {
delayNumSamples = 16 * SAMPLES_PER_FRAME;
}
windowSize /= reverb->downsampleRate;
delayNumSamples /= reverb->downsampleRate;
if (flags == 0) {
if (reverb->unk_1E >= (data / reverb->downsampleRate)) {
if ((reverb->nextRingBufPos >= windowSize) || (reverb->unk_24 >= windowSize)) {
reverb->nextRingBufPos = 0;
reverb->unk_24 = 0;
}
} else {
if (!isFirstInit) {
if (reverb->delayNumSamplesAfterDownsampling < (data / reverb->downsampleRate)) {
break;
}
if ((reverb->nextReverbBufPos >= delayNumSamples) || (reverb->delayNumSamplesUnk >= delayNumSamples)) {
reverb->nextReverbBufPos = 0;
reverb->delayNumSamplesUnk = 0;
}
}
reverb->windowSize = windowSize;
reverb->delayNumSamples = delayNumSamples;
if ((reverb->downsampleRate != 1) || reverb->unk_18) {
reverb->unk_0E = 0x8000 / reverb->downsampleRate;
if (reverb->unk_30 == NULL) {
reverb->unk_30 = AudioHeap_AllocZeroed(&gAudioContext.miscPool, 0x20);
reverb->unk_34 = AudioHeap_AllocZeroed(&gAudioContext.miscPool, 0x20);
reverb->unk_38 = AudioHeap_AllocZeroed(&gAudioContext.miscPool, 0x20);
reverb->unk_3C = AudioHeap_AllocZeroed(&gAudioContext.miscPool, 0x20);
if (reverb->unk_3C == NULL) {
if ((reverb->downsampleRate != 1) || reverb->resampleEffectOn) {
reverb->downsamplePitch = 0x8000 / reverb->downsampleRate;
if (reverb->leftLoadResampleBuf == NULL) {
reverb->leftLoadResampleBuf =
AudioHeap_AllocZeroed(&gAudioContext.miscPool, sizeof(RESAMPLE_STATE));
reverb->rightLoadResampleBuf =
AudioHeap_AllocZeroed(&gAudioContext.miscPool, sizeof(RESAMPLE_STATE));
reverb->leftSaveResampleBuf =
AudioHeap_AllocZeroed(&gAudioContext.miscPool, sizeof(RESAMPLE_STATE));
reverb->rightSaveResampleBuf =
AudioHeap_AllocZeroed(&gAudioContext.miscPool, sizeof(RESAMPLE_STATE));
if (reverb->rightSaveResampleBuf == NULL) {
reverb->downsampleRate = 1;
}
}
}
break;
case 2:
gAudioContext.synthesisReverbs[reverbIndex].unk_0C = data;
case REVERB_DATA_TYPE_DECAY:
gAudioContext.synthesisReverbs[reverbIndex].decayRatio = data;
break;
case 3:
gAudioContext.synthesisReverbs[reverbIndex].unk_16 = data;
case REVERB_DATA_TYPE_SUB_VOLUME:
gAudioContext.synthesisReverbs[reverbIndex].subVolume = data;
break;
case 4:
gAudioContext.synthesisReverbs[reverbIndex].unk_0A = data;
case REVERB_DATA_TYPE_VOLUME:
gAudioContext.synthesisReverbs[reverbIndex].volume = data;
break;
case 5:
case REVERB_DATA_TYPE_LEAK_RIGHT:
gAudioContext.synthesisReverbs[reverbIndex].leakRtl = data;
break;
case 6:
case REVERB_DATA_TYPE_LEAK_LEFT:
gAudioContext.synthesisReverbs[reverbIndex].leakLtr = data;
break;
case 7:
case REVERB_DATA_TYPE_FILTER_LEFT:
if (data != 0) {
if ((flags != 0) || (reverb->unk_278 == 0)) {
reverb->filterLeftState = AudioHeap_AllocDmaMemoryZeroed(&gAudioContext.miscPool, 0x40);
reverb->unk_278 = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x10);
if (isFirstInit || (reverb->filterLeftInit == NULL)) {
reverb->filterLeftState = AudioHeap_AllocDmaMemoryZeroed(&gAudioContext.miscPool,
2 * (FILTER_BUF_PART1 + FILTER_BUF_PART2));
reverb->filterLeftInit = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, FILTER_SIZE);
}
reverb->filterLeft = reverb->unk_278;
if (reverb->filterLeft != 0) {
reverb->filterLeft = reverb->filterLeftInit;
if (reverb->filterLeft != NULL) {
AudioHeap_LoadLowPassFilter(reverb->filterLeft, data);
}
} else {
reverb->filterLeft = 0;
reverb->filterLeft = NULL;
if (flags != 0) {
reverb->unk_278 = 0;
if (isFirstInit) {
reverb->filterLeftInit = NULL;
}
}
break;
case 8:
case REVERB_DATA_TYPE_FILTER_RIGHT:
if (data != 0) {
if ((flags != 0) || (reverb->unk_27C == 0)) {
reverb->filterRightState = AudioHeap_AllocDmaMemoryZeroed(&gAudioContext.miscPool, 0x40);
reverb->unk_27C = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x10);
if (isFirstInit || (reverb->filterRightInit == NULL)) {
reverb->filterRightState = AudioHeap_AllocDmaMemoryZeroed(
&gAudioContext.miscPool, 2 * (FILTER_BUF_PART1 + FILTER_BUF_PART2));
reverb->filterRightInit = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, FILTER_SIZE);
}
reverb->filterRight = reverb->unk_27C;
if (reverb->unk_27C != 0) {
AudioHeap_LoadLowPassFilter(reverb->unk_27C, data);
reverb->filterRight = reverb->filterRightInit;
if (reverb->filterRight != NULL) {
AudioHeap_LoadLowPassFilter(reverb->filterRight, data);
}
} else {
reverb->filterRight = 0;
if (flags != 0) {
reverb->unk_27C = 0;
reverb->filterRight = NULL;
if (isFirstInit) {
reverb->filterRightInit = NULL;
}
}
break;
case 9:
reverb->unk_19 = data;
case REVERB_DATA_TYPE_9:
reverb->resampleEffectExtraSamples = data;
if (data == 0) {
reverb->unk_18 = false;
reverb->resampleEffectOn = false;
} else {
reverb->unk_18 = true;
reverb->resampleEffectOn = true;
}
break;
default:
break;
}
}
void AudioHeap_InitReverb(s32 reverbIndex, ReverbSettings* settings, s32 flags) {
void AudioHeap_InitReverb(s32 reverbIndex, ReverbSettings* settings, s32 isFirstInit) {
SynthesisReverb* reverb = &gAudioContext.synthesisReverbs[reverbIndex];
if (flags != 0) {
reverb->unk_1E = settings->windowSize / settings->downsampleRate;
reverb->unk_30 = 0;
} else if (reverb->unk_1E < (settings->windowSize / settings->downsampleRate)) {
if (isFirstInit) {
reverb->delayNumSamplesAfterDownsampling = settings->delayNumSamples / settings->downsampleRate;
reverb->leftLoadResampleBuf = NULL;
} else if (reverb->delayNumSamplesAfterDownsampling < (settings->delayNumSamples / settings->downsampleRate)) {
return;
}
reverb->downsampleRate = settings->downsampleRate;
reverb->unk_18 = false;
reverb->unk_19 = 0;
reverb->unk_1A = 0;
reverb->unk_1C = 0;
AudioHeap_SetReverbData(reverbIndex, 1, settings->windowSize, flags);
reverb->unk_0C = settings->unk_4;
reverb->unk_0A = settings->unk_A;
reverb->unk_14 = settings->unk_6 << 6;
reverb->unk_16 = settings->unk_8;
reverb->resampleEffectOn = false;
reverb->resampleEffectExtraSamples = 0;
reverb->resampleEffectLoadUnk = 0;
reverb->resampleEffectSaveUnk = 0;
AudioHeap_SetReverbData(reverbIndex, REVERB_DATA_TYPE_DELAY, settings->delayNumSamples, isFirstInit);
reverb->decayRatio = settings->decayRatio;
reverb->volume = settings->volume;
reverb->subDelay = settings->subDelay * 64;
reverb->subVolume = settings->subVolume;
reverb->leakRtl = settings->leakRtl;
reverb->leakLtr = settings->leakLtr;
reverb->unk_05 = settings->unk_10;
reverb->unk_08 = settings->unk_12;
reverb->useReverb = 8;
reverb->mixReverbIndex = settings->mixReverbIndex;
reverb->mixReverbStrength = settings->mixReverbStrength;
reverb->useReverb = 8; // used as a boolean
if (flags != 0) {
reverb->leftRingBuf = AudioHeap_AllocZeroedAttemptExternal(&gAudioContext.miscPool, reverb->windowSize * 2);
reverb->rightRingBuf = AudioHeap_AllocZeroedAttemptExternal(&gAudioContext.miscPool, reverb->windowSize * 2);
if (isFirstInit) {
reverb->leftReverbBuf =
AudioHeap_AllocZeroedAttemptExternal(&gAudioContext.miscPool, reverb->delayNumSamples * 2);
reverb->rightReverbBuf =
AudioHeap_AllocZeroedAttemptExternal(&gAudioContext.miscPool, reverb->delayNumSamples * 2);
reverb->resampleFlags = 1;
reverb->nextRingBufPos = 0;
reverb->unk_24 = 0;
reverb->nextReverbBufPos = 0;
reverb->delayNumSamplesUnk = 0;
reverb->curFrame = 0;
reverb->framesToIgnore = 2;
}
@@ -1681,12 +1700,13 @@ void AudioHeap_InitReverb(s32 reverbIndex, ReverbSettings* settings, s32 flags)
reverb->tunedSample.tuning = 1.0f;
reverb->sample.codec = CODEC_REVERB;
reverb->sample.medium = MEDIUM_RAM;
reverb->sample.size = reverb->windowSize * 2;
reverb->sample.sampleAddr = (u8*)reverb->leftRingBuf;
reverb->sample.size = reverb->delayNumSamples * SAMPLE_SIZE;
reverb->sample.sampleAddr = (u8*)reverb->leftReverbBuf;
reverb->loop.start = 0;
reverb->loop.count = 1;
reverb->loop.end = reverb->windowSize;
reverb->loop.loopEnd = reverb->delayNumSamples;
AudioHeap_SetReverbData(reverbIndex, 7, settings->lowPassFilterCutoffLeft, flags);
AudioHeap_SetReverbData(reverbIndex, 8, settings->lowPassFilterCutoffRight, flags);
AudioHeap_SetReverbData(reverbIndex, REVERB_DATA_TYPE_FILTER_LEFT, settings->lowPassFilterCutoffLeft, isFirstInit);
AudioHeap_SetReverbData(reverbIndex, REVERB_DATA_TYPE_FILTER_RIGHT, settings->lowPassFilterCutoffRight,
isFirstInit);
}
+177 -5
View File
@@ -1,12 +1,184 @@
#include "global.h"
const s16 gAudioTatumInit[] = {
0x1C00, // unused
0x30, // gTatumsPerBeat
0x1C00, // unused
TATUMS_PER_BEAT, // gTatumsPerBeat
};
// TODO: Extract from table?
#define NUM_SOUNDFONTS 41
#define SFX_SEQ_SIZE 0xC6A0
#define AMBIENCE_SEQ_SIZE 0xFC0
#define SOUNDFONT_0_SIZE 0x81C0
#define SOUNDFONT_1_SIZE 0x36D0
#define SOUNDFONT_2_SIZE 0xCE0
// Sizes of everything on the init pool
#define AI_BUFFERS_SIZE (AIBUF_SIZE * ARRAY_COUNT(gAudioContext.aiBuffers))
#define SOUNDFONT_LIST_SIZE (NUM_SOUNDFONTS * sizeof(SoundFont))
// 0x19BD0
#define PERMANENT_POOL_SIZE \
(SFX_SEQ_SIZE + AMBIENCE_SEQ_SIZE + SOUNDFONT_0_SIZE + SOUNDFONT_1_SIZE + SOUNDFONT_2_SIZE + 0x430)
const AudioHeapInitSizes gAudioHeapInitSizes = {
0x137F00, // heapSize
0x1C480, // initPoolSize
0x1A000, // permanentPoolSize
ALIGN16(sizeof(gAudioHeap) - 0x100), // audio heap size
ALIGN16(PERMANENT_POOL_SIZE + AI_BUFFERS_SIZE + SOUNDFONT_LIST_SIZE + 0x40), // init pool size
ALIGN16(PERMANENT_POOL_SIZE), // permanent pool size
};
#define REVERB_INDEX_0_SETTINGS \
{ 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, REVERB_INDEX_NONE, 0x3000, 0, 0 }
ReverbSettings reverbSettings0[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x20, 0x0800, 0, 0, 0x7FFF, 0x0000, 0x0000, REVERB_INDEX_NONE, 0x0000, 0, 0 },
};
ReverbSettings reverbSettings1[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x30, 0x1800, 0, 0, 0x7FFF, 0x0000, 0x0000, REVERB_INDEX_NONE, 0x0000, 11, 11 },
};
ReverbSettings reverbSettings2[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x38, 0x2800, 0, 0, 0x7FFF, 0x0000, 0x0000, REVERB_INDEX_NONE, 0x0000, 7, 7 },
};
ReverbSettings reverbSettings3[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x30, 0x6800, 0, 0, 0x7FFF, 0x1400, 0x1400, REVERB_INDEX_NONE, 0x3000, 6, 6 },
{ 2, 0x50, 0x6000, 0, 0, 0x7FFF, 0xD000, 0x3000, REVERB_INDEX_NONE, 0x3000, 0, 0 },
};
ReverbSettings reverbSettings4[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x40, 0x5000, 0, 0, 0x7FFF, 0x1800, 0x1800, REVERB_INDEX_NONE, 0x3000, 7, 7 },
};
ReverbSettings reverbSettings5[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x40, 0x5C00, 0, 0, 0x7FFF, 0x2000, 0x2000, REVERB_INDEX_NONE, 0x3000, 4, 4 },
};
ReverbSettings reverbSettings6[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x30, 0x6000, 0, 0, 0x7FFF, 0x1000, 0x1000, REVERB_INDEX_NONE, 0x3000, 10, 10 },
};
ReverbSettings reverbSettings7[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x30, 0x6800, 0, 0, 0x7FFF, 0x1400, 0x1400, REVERB_INDEX_NONE, 0x3000, 6, 6 },
};
ReverbSettings reverbSettings8[2] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x50, 0x5000, 0, 0, 0x7FFF, 0xD000, 0x3000, REVERB_INDEX_NONE, 0x3000, 0, 0 },
};
ReverbSettings reverbSettings9[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x20, 0x0000, 0, 0, 0x7FFF, 0x0000, 0x0000, REVERB_INDEX_NONE, 0x0000, 0, 0 },
};
ReverbSettings reverbSettingsA[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x30, 0x1800, 0, 0, 0x7FFF, 0x0000, 0x0000, REVERB_INDEX_NONE, 0x0000, 11, 11 },
};
ReverbSettings reverbSettingsB[3] = {
REVERB_INDEX_0_SETTINGS,
};
ReverbSettings reverbSettingsC[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x40, 0x5000, 0, 0, 0x7FFF, 0x0000, 0x0000, REVERB_INDEX_NONE, 0x3000, 0, 0 },
};
ReverbSettings reverbSettingsD[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x30, 0x6800, 0, 0, 0x7FFF, 0x1400, 0x1400, REVERB_INDEX_NONE, 0x3000, 6, 6 },
{ 2, 0x50, 0x6000, 0, 0, 0x7FFF, 0xD000, 0x3000, REVERB_INDEX_NONE, 0x3000, 0, 0 },
};
ReverbSettings reverbSettingsE[3] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x30, 0x1800, 0, 0, 0x7FFF, 0x0000, 0x0000, REVERB_INDEX_NONE, 0x0000, 11, 11 },
{ 1, 0x40, 0x5000, 0, 0, 0x7FFF, 0x1800, 0x1800, REVERB_INDEX_NONE, 0x3000, 7, 7 },
};
ReverbSettings reverbSettingsF[2] = {
REVERB_INDEX_0_SETTINGS,
{ 1, 0x50, 0x1800, 0, 0, 0x7FFF, 0x0000, 0x0000, REVERB_INDEX_NONE, 0x0000, 11, 11 },
};
ReverbSettings* gReverbSettingsTable[] = {
reverbSettings0, reverbSettings1, reverbSettings2, reverbSettings4, reverbSettings5,
reverbSettings6, reverbSettings7, reverbSettings8, reverbSettings9, reverbSettings3,
};
AudioSpec gAudioSpecs[21] = {
/* 0x0 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x1 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x2 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x3 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x4 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x5 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x6 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x7 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x8 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x9 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0xA */
{ 32000, 1, 28, 3, 0, 0, 2, reverbSettingsA, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x2800, 0x2D00, 0, 0,
0xDC800 },
/* 0xB */
{ 32000, 1, 28, 3, 0, 0, 2, reverbSettingsA, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0xC */
{ 32000, 1, 28, 5, 0, 0, 2, reverbSettingsA, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xCC800 },
/* 0xD */
{ 32000, 1, 24, 5, 0, 0, 3, reverbSettingsD, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0xE */
{ 32000, 1, 24, 5, 0, 0, 3, reverbSettingsE, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0xF */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettingsF, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4000, 0x2D00, 0, 0,
0xDC800 },
/* 0x10 */
{ 32000, 1, 22, 5, 0, 0, 2, reverbSettings0, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x11 */
{ 32000, 1, 22, 5, 0, 0, 2, reverbSettings8, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x12 */
{ 32000, 1, 16, 5, 0, 0, 2, reverbSettings0, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x13 */
{ 22050, 1, 24, 5, 0, 0, 2, reverbSettings0, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x4100, 0x2D00, 0, 0,
0xDC800 },
/* 0x14 */
{ 32000, 1, 24, 5, 0, 0, 2, reverbSettings2, 0x500, 0x200, 0x7FFF, 0xAF0, 0x2D80, 0, 0x3600, 0x2600, 0, 0,
0xDC800 },
};
+4 -4
View File
@@ -37,7 +37,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate);
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id);
void* AudioLoad_SearchCaches(s32 tableType, s32 id);
AudioTable* AudioLoad_GetLoadTable(s32 tableType);
void AudioLoad_SyncDma(uintptr_t devAddr, u8* addr, size_t size, s32 medium);
void AudioLoad_SyncDma(uintptr_t devAddr, u8* ramAddr, size_t size, s32 medium);
void AudioLoad_SyncDmaUnkMedium(uintptr_t devAddr, u8* addr, size_t size, s32 unkMediumParam);
s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, uintptr_t devAddr, void* ramAddr, size_t size,
OSMesgQueue* reqQueue, s32 medium, const char* dmaFuncType);
@@ -1218,9 +1218,9 @@ void AudioLoad_Init(void* heap, size_t heapSize) {
s32 i;
s32 j;
D_80208E68 = NULL;
D_80208E70 = NULL;
D_80208E74 = NULL;
gCustomAudioUpdateFunction = NULL;
gCustomAudioReverbFunction = NULL;
gCustomAudioSynthFunction = NULL;
for (i = 0; i < ARRAY_COUNT(gAudioContext.unk_29A8); i++) {
gAudioContext.unk_29A8[i] = NULL;
+103 -99
View File
@@ -1,10 +1,10 @@
#include "global.h"
void AudioPlayback_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput);
void AudioPlayback_NoteSetResamplingRate(NoteSampleState* sampleState, f32 resamplingRateInput);
void AudioPlayback_AudioListPushFront(AudioListItem* list, AudioListItem* item);
void AudioPlayback_NoteInitForLayer(Note* note, SequenceLayer* layer);
void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* noteSubEu, NoteSubAttributes* subAttrs) {
void AudioPlayback_InitSampleState(Note* note, NoteSampleState* sampleState, NoteSubAttributes* subAttrs) {
f32 volLeft;
f32 volRight;
s32 halfPanIndex;
@@ -13,45 +13,45 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* noteSubEu, NoteSubAttribut
u8 strongRight;
f32 vel;
u8 pan;
u8 reverbVol;
u8 targetReverbVol;
StereoData stereoData;
s32 stereoHeadsetEffects = note->playbackState.stereoHeadsetEffects;
vel = subAttrs->velocity;
pan = subAttrs->pan;
reverbVol = subAttrs->reverbVol;
stereoData = subAttrs->stereo.s;
targetReverbVol = subAttrs->targetReverbVol;
stereoData = subAttrs->stereoData;
noteSubEu->bitField0 = note->noteSubEu.bitField0;
noteSubEu->bitField1 = note->noteSubEu.bitField1;
noteSubEu->waveSampleAddr = note->noteSubEu.waveSampleAddr;
noteSubEu->harmonicIndexCurAndPrev = note->noteSubEu.harmonicIndexCurAndPrev;
sampleState->bitField0 = note->sampleState.bitField0;
sampleState->bitField1 = note->sampleState.bitField1;
sampleState->waveSampleAddr = note->sampleState.waveSampleAddr;
sampleState->harmonicIndexCurAndPrev = note->sampleState.harmonicIndexCurAndPrev;
AudioPlayback_NoteSetResamplingRate(noteSubEu, subAttrs->frequency);
AudioPlayback_NoteSetResamplingRate(sampleState, subAttrs->frequency);
pan &= 0x7F;
noteSubEu->bitField0.stereoStrongRight = false;
noteSubEu->bitField0.stereoStrongLeft = false;
noteSubEu->bitField0.stereoHeadsetEffects = stereoData.stereoHeadsetEffects;
noteSubEu->bitField0.usesHeadsetPanEffects = stereoData.usesHeadsetPanEffects;
sampleState->bitField0.strongRight = false;
sampleState->bitField0.strongLeft = false;
sampleState->bitField0.strongReverbRight = stereoData.strongReverbRight;
sampleState->bitField0.strongReverbLeft = stereoData.strongReverbLeft;
if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_HEADSET)) {
halfPanIndex = pan >> 1;
if (halfPanIndex > 0x3F) {
halfPanIndex = 0x3F;
}
noteSubEu->headsetPanLeft = gHeadsetPanQuantization[halfPanIndex];
noteSubEu->headsetPanRight = gHeadsetPanQuantization[0x3F - halfPanIndex];
noteSubEu->bitField1.usesHeadsetPanEffects2 = true;
sampleState->haasEffectRightDelaySize = gHaasEffectDelaySize[halfPanIndex];
sampleState->haasEffectLeftDelaySize = gHaasEffectDelaySize[0x3F - halfPanIndex];
sampleState->bitField1.useHaasEffect = true;
volLeft = gHeadsetPanVolume[pan];
volRight = gHeadsetPanVolume[0x7F - pan];
} else if (stereoHeadsetEffects && (gAudioContext.soundMode == SOUNDMODE_STEREO)) {
strongLeft = strongRight = false;
noteSubEu->headsetPanRight = 0;
noteSubEu->headsetPanLeft = 0;
noteSubEu->bitField1.usesHeadsetPanEffects2 = false;
sampleState->haasEffectLeftDelaySize = 0;
sampleState->haasEffectRightDelaySize = 0;
sampleState->bitField1.useHaasEffect = false;
volLeft = gStereoPanVolume[pan];
volRight = gStereoPanVolume[0x7F - pan];
@@ -62,37 +62,37 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* noteSubEu, NoteSubAttribut
}
// case 0:
noteSubEu->bitField0.stereoStrongRight = strongRight;
noteSubEu->bitField0.stereoStrongLeft = strongLeft;
sampleState->bitField0.strongRight = strongRight;
sampleState->bitField0.strongLeft = strongLeft;
switch (stereoData.bit2) {
switch (stereoData.type) {
case 0:
break;
case 1:
noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight;
noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft;
sampleState->bitField0.strongRight = stereoData.strongRight;
sampleState->bitField0.strongLeft = stereoData.strongLeft;
break;
case 2:
noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight | strongRight;
noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft | strongLeft;
sampleState->bitField0.strongRight = stereoData.strongRight | strongRight;
sampleState->bitField0.strongLeft = stereoData.strongLeft | strongLeft;
break;
case 3:
noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight ^ strongRight;
noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft ^ strongLeft;
sampleState->bitField0.strongRight = stereoData.strongRight ^ strongRight;
sampleState->bitField0.strongLeft = stereoData.strongLeft ^ strongLeft;
break;
}
} else if (gAudioContext.soundMode == SOUNDMODE_MONO) {
noteSubEu->bitField0.stereoHeadsetEffects = false;
noteSubEu->bitField0.usesHeadsetPanEffects = false;
sampleState->bitField0.strongReverbRight = false;
sampleState->bitField0.strongReverbLeft = false;
volLeft = 0.707f; // approx 1/sqrt(2)
volRight = 0.707f;
} else {
noteSubEu->bitField0.stereoStrongRight = stereoData.strongRight;
noteSubEu->bitField0.stereoStrongLeft = stereoData.strongLeft;
sampleState->bitField0.strongRight = stereoData.strongRight;
sampleState->bitField0.strongLeft = stereoData.strongLeft;
volLeft = gDefaultPanVolume[pan];
volRight = gDefaultPanVolume[0x7F - pan];
}
@@ -100,33 +100,33 @@ void AudioPlayback_InitNoteSub(Note* note, NoteSubEu* noteSubEu, NoteSubAttribut
vel = 0.0f > vel ? 0.0f : vel;
vel = 1.0f < vel ? 1.0f : vel;
noteSubEu->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f));
noteSubEu->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f));
sampleState->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f));
sampleState->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f));
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;
sampleState->gain = subAttrs->gain;
sampleState->filter = subAttrs->filter;
sampleState->combFilterSize = subAttrs->combFilterSize;
sampleState->combFilterGain = subAttrs->combFilterGain;
sampleState->targetReverbVol = targetReverbVol;
sampleState->surroundEffectIndex = subAttrs->surroundEffectIndex;
}
void AudioPlayback_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput) {
void AudioPlayback_NoteSetResamplingRate(NoteSampleState* sampleState, f32 resamplingRateInput) {
f32 resamplingRate = 0.0f;
if (resamplingRateInput < 2.0f) {
noteSubEu->bitField1.hasTwoParts = false;
sampleState->bitField1.hasTwoParts = false;
resamplingRate = CLAMP_MAX(resamplingRateInput, 1.99998f);
} else {
noteSubEu->bitField1.hasTwoParts = true;
sampleState->bitField1.hasTwoParts = true;
if (resamplingRateInput > 3.99996f) {
resamplingRate = 1.99998f;
} else {
resamplingRate = resamplingRateInput * 0.5f;
}
}
noteSubEu->resamplingRateFixedPoint = (s32)(resamplingRate * 32768.0f);
sampleState->frequencyFixedPoint = (s32)(resamplingRate * 32768.0f);
}
void AudioPlayback_NoteInit(Note* note) {
@@ -140,17 +140,17 @@ void AudioPlayback_NoteInit(Note* note) {
note->playbackState.status = PLAYBACK_STATUS_0;
note->playbackState.adsr.action.s.state = ADSR_STATE_INITIAL;
note->noteSubEu = gDefaultNoteSub;
note->sampleState = gDefaultSampleState;
}
void AudioPlayback_NoteDisable(Note* note) {
if (note->noteSubEu.bitField0.needsInit == true) {
note->noteSubEu.bitField0.needsInit = false;
if (note->sampleState.bitField0.needsInit == true) {
note->sampleState.bitField0.needsInit = false;
}
note->playbackState.priority = 0;
note->noteSubEu.bitField0.enabled = false;
note->sampleState.bitField0.enabled = false;
note->playbackState.status = PLAYBACK_STATUS_0;
note->noteSubEu.bitField0.finished = false;
note->sampleState.bitField0.finished = false;
note->playbackState.parentLayer = NO_LAYER;
note->playbackState.prevParentLayer = NO_LAYER;
note->playbackState.adsr.action.s.state = ADSR_STATE_DISABLED;
@@ -161,8 +161,8 @@ void AudioPlayback_ProcessNotes(void) {
s32 pad;
s32 playbackStatus;
NoteAttributes* attrs;
NoteSubEu* noteSubEu2;
NoteSubEu* noteSubEu;
NoteSampleState* sampleState;
NoteSampleState* noteSampleState;
Note* note;
NotePlaybackState* playbackState;
NoteSubAttributes subAttrs;
@@ -172,7 +172,7 @@ void AudioPlayback_ProcessNotes(void) {
for (i = 0; i < gAudioContext.numNotes; i++) {
note = &gAudioContext.notes[i];
noteSubEu2 = &gAudioContext.noteSubsEu[gAudioContext.noteSubEuOffset + i];
sampleState = &gAudioContext.sampleStateList[gAudioContext.sampleStateOffset + i];
playbackState = &note->playbackState;
if (playbackState->parentLayer != NO_LAYER) {
if ((u32)playbackState->parentLayer < 0x7FFFFFFF) {
@@ -211,10 +211,12 @@ void AudioPlayback_ProcessNotes(void) {
out:
if (playbackState->priority != 0) {
//! FAKE:
if (1) {}
noteSubEu = &note->noteSubEu;
if ((playbackState->status >= 1) || noteSubEu->bitField0.finished) {
if ((playbackState->adsr.action.s.state == ADSR_STATE_DISABLED) || noteSubEu->bitField0.finished) {
noteSampleState = &note->sampleState;
if ((playbackState->status >= 1) || noteSampleState->bitField0.finished) {
if ((playbackState->adsr.action.s.state == ADSR_STATE_DISABLED) ||
noteSampleState->bitField0.finished) {
if (playbackState->wantedParentLayer != NO_LAYER) {
AudioPlayback_NoteDisable(note);
if (playbackState->wantedParentLayer->channel != NULL) {
@@ -260,14 +262,14 @@ void AudioPlayback_ProcessNotes(void) {
subAttrs.frequency = attrs->freqScale;
subAttrs.velocity = attrs->velocity;
subAttrs.pan = attrs->pan;
subAttrs.reverbVol = attrs->reverb;
subAttrs.stereo = attrs->stereo;
subAttrs.targetReverbVol = attrs->targetReverbVol;
subAttrs.stereoData = attrs->stereoData;
subAttrs.gain = attrs->gain;
subAttrs.filter = attrs->filter;
subAttrs.unk_14 = attrs->unk_4;
subAttrs.unk_16 = attrs->unk_6;
subAttrs.unk_3 = attrs->unk_3;
bookOffset = noteSubEu->bitField1.bookOffset;
subAttrs.combFilterSize = attrs->combFilterSize;
subAttrs.combFilterGain = attrs->combFilterGain;
subAttrs.surroundEffectIndex = attrs->surroundEffectIndex;
bookOffset = noteSampleState->bitField1.bookOffset;
} else {
SequenceLayer* layer = playbackState->parentLayer;
SequenceChannel* channel = playbackState->parentLayer->channel;
@@ -276,34 +278,35 @@ void AudioPlayback_ProcessNotes(void) {
subAttrs.velocity = layer->noteVelocity;
subAttrs.pan = layer->notePan;
if (layer->unk_08 == 0x80) {
subAttrs.unk_3 = channel->unk_10;
if (layer->surroundEffectIndex == 0x80) {
subAttrs.surroundEffectIndex = channel->surroundEffectIndex;
} else {
subAttrs.unk_3 = layer->unk_08;
subAttrs.surroundEffectIndex = layer->surroundEffectIndex;
}
if (layer->stereo.s.bit2 == 0) {
subAttrs.stereo = channel->stereo;
if (layer->stereoData.type == 0) {
subAttrs.stereoData = channel->stereoData;
} else {
subAttrs.stereo = layer->stereo;
subAttrs.stereoData = layer->stereoData;
}
if (layer->unk_0A.s.bit_2 == 1) {
subAttrs.reverbVol = channel->reverb;
subAttrs.targetReverbVol = channel->targetReverbVol;
} else {
subAttrs.reverbVol = layer->unk_09;
subAttrs.targetReverbVol = layer->targetReverbVol;
}
if (layer->unk_0A.s.bit_9 == 1) {
subAttrs.gain = channel->gain;
} else {
subAttrs.gain = 0;
//! FAKE:
if (1) {}
}
subAttrs.filter = channel->filter;
subAttrs.unk_14 = channel->unk_0F;
subAttrs.unk_16 = channel->unk_20;
subAttrs.combFilterSize = channel->combFilterSize;
subAttrs.combFilterGain = channel->combFilterGain;
bookOffset = channel->bookOffset & 0x7;
if (channel->seqPlayer->muted && (channel->muteFlags & MUTE_FLAGS_3)) {
@@ -315,8 +318,8 @@ void AudioPlayback_ProcessNotes(void) {
subAttrs.frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale;
subAttrs.frequency *= gAudioContext.audioBufferParameters.resampleRate;
subAttrs.velocity *= scale;
AudioPlayback_InitNoteSub(note, noteSubEu2, &subAttrs);
noteSubEu->bitField1.bookOffset = bookOffset;
AudioPlayback_InitSampleState(note, sampleState, &subAttrs);
noteSampleState->bitField1.bookOffset = bookOffset;
skip:;
}
}
@@ -500,15 +503,15 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
channel = layer->channel;
if (layer->unk_0A.s.bit_2 == 1) {
attrs->reverb = channel->reverb;
attrs->targetReverbVol = channel->targetReverbVol;
} else {
attrs->reverb = layer->unk_09;
attrs->targetReverbVol = layer->targetReverbVol;
}
if (layer->unk_08 == 0x80) {
attrs->unk_3 = channel->unk_10;
if (layer->surroundEffectIndex == 0x80) {
attrs->surroundEffectIndex = channel->surroundEffectIndex;
} else {
attrs->unk_3 = layer->unk_08;
attrs->surroundEffectIndex = layer->surroundEffectIndex;
}
if (layer->unk_0A.s.bit_9 == 1) {
@@ -526,20 +529,20 @@ void AudioPlayback_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
attrs->filter = attrs->filterBuf;
}
attrs->unk_6 = channel->unk_20;
attrs->unk_4 = channel->unk_0F;
attrs->combFilterGain = channel->combFilterGain;
attrs->combFilterSize = channel->combFilterSize;
if (channel->seqPlayer->muted && (channel->muteFlags & MUTE_FLAGS_3)) {
note->noteSubEu.bitField0.finished = true;
note->sampleState.bitField0.finished = true;
}
if (layer->stereo.asByte == 0) {
attrs->stereo = channel->stereo;
if (layer->stereoData.asByte == 0) {
attrs->stereoData = channel->stereoData;
} else {
attrs->stereo = layer->stereo;
attrs->stereoData = layer->stereoData;
}
note->playbackState.priority = channel->someOtherPriority;
} else {
attrs->stereo = layer->stereo;
attrs->stereoData = layer->stereoData;
note->playbackState.priority = 1;
}
@@ -620,7 +623,7 @@ s32 AudioPlayback_BuildSyntheticWave(Note* note, SequenceLayer* layer, s32 waveI
// 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];
note->sampleState.waveSampleAddr = &gWaveSamples[waveId - 128][harmonicIndex * WAVE_SAMPLE_COUNT];
return harmonicIndex;
}
@@ -638,7 +641,7 @@ void AudioPlayback_InitSyntheticWave(Note* note, SequenceLayer* layer) {
curHarmonicIndex = AudioPlayback_BuildSyntheticWave(note, layer, waveId);
if (curHarmonicIndex != prevHarmonicIndex) {
note->noteSubEu.harmonicIndexCurAndPrev = (curHarmonicIndex << 2) + prevHarmonicIndex;
note->sampleState.harmonicIndexCurAndPrev = (curHarmonicIndex << 2) + prevHarmonicIndex;
}
}
@@ -808,7 +811,7 @@ void AudioPlayback_NoteInitForLayer(Note* note, SequenceLayer* layer) {
s16 instId;
SequenceChannel* channel = layer->channel;
NotePlaybackState* playbackState = &note->playbackState;
NoteSubEu* noteSubEu = &note->noteSubEu;
NoteSampleState* noteSampleState = &note->sampleState;
playbackState->prevParentLayer = NO_LAYER;
playbackState->parentLayer = layer;
@@ -825,28 +828,28 @@ void AudioPlayback_NoteInitForLayer(Note* note, SequenceLayer* layer) {
if (instId == 0xFF) {
instId = channel->instOrWave;
}
noteSubEu->tunedSample = layer->tunedSample;
noteSampleState->tunedSample = layer->tunedSample;
if (instId >= 0x80 && instId < 0xC0) {
noteSubEu->bitField1.isSyntheticWave = true;
noteSampleState->bitField1.isSyntheticWave = true;
} else {
noteSubEu->bitField1.isSyntheticWave = false;
noteSampleState->bitField1.isSyntheticWave = false;
}
if (noteSubEu->bitField1.isSyntheticWave) {
if (noteSampleState->bitField1.isSyntheticWave) {
AudioPlayback_BuildSyntheticWave(note, layer, instId);
} else if (channel->startSamplePos == 1) {
playbackState->startSamplePos = noteSubEu->tunedSample->sample->loop->start;
playbackState->startSamplePos = noteSampleState->tunedSample->sample->loop->start;
} else {
playbackState->startSamplePos = channel->startSamplePos;
if (playbackState->startSamplePos >= noteSubEu->tunedSample->sample->loop->end) {
if (playbackState->startSamplePos >= noteSampleState->tunedSample->sample->loop->loopEnd) {
playbackState->startSamplePos = 0;
}
}
playbackState->fontId = channel->fontId;
playbackState->stereoHeadsetEffects = channel->stereoHeadsetEffects;
noteSubEu->bitField1.reverbIndex = channel->reverbIndex & 3;
noteSampleState->bitField1.reverbIndex = channel->reverbIndex & 3;
}
void func_801963E8(Note* note, SequenceLayer* layer) {
@@ -987,7 +990,7 @@ void AudioPlayback_NoteInitAll(void) {
for (i = 0; i < gAudioContext.numNotes; i++) {
note = &gAudioContext.notes[i];
note->noteSubEu = gZeroNoteSub;
note->sampleState = gZeroedSampleState;
note->playbackState.priority = 0;
note->playbackState.status = PLAYBACK_STATUS_0;
note->playbackState.parentLayer = NO_LAYER;
@@ -1002,7 +1005,8 @@ void AudioPlayback_NoteInitAll(void) {
note->playbackState.portamento.speed = 0;
note->playbackState.stereoHeadsetEffects = false;
note->playbackState.startSamplePos = 0;
note->synthesisState.synthesisBuffers = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x2E0);
note->playbackState.attributes.filterBuf = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, 0x10);
note->synthesisState.synthesisBuffers =
AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, sizeof(NoteSynthesisBuffers));
note->playbackState.attributes.filterBuf = AudioHeap_AllocDmaMemory(&gAudioContext.miscPool, FILTER_SIZE);
}
}
+31 -30
View File
@@ -282,17 +282,17 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
channel->transposition = 0;
channel->largeNotes = false;
channel->bookOffset = 0;
channel->stereo.asByte = 0;
channel->stereoData.asByte = 0;
channel->changes.asByte = 0xFF;
channel->scriptState.depth = 0;
channel->newPan = 0x40;
channel->panChannelWeight = 0x80;
channel->unk_10 = 0xFF;
channel->surroundEffectIndex = 0xFF;
channel->velocityRandomVariance = 0;
channel->gateTimeRandomVariance = 0;
channel->noteUnused = NULL;
channel->reverbIndex = 0;
channel->reverb = 0;
channel->targetReverbVol = 0;
channel->gain = 0;
channel->notePriority = 3;
channel->someOtherPriority = 1;
@@ -308,14 +308,14 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
channel->vibrato.vibratoExtentChangeDelay = 0;
channel->vibrato.vibratoDelay = 0;
channel->filter = NULL;
channel->unk_20 = 0;
channel->unk_0F = 0;
channel->combFilterGain = 0;
channel->combFilterSize = 0;
channel->volume = 1.0f;
channel->volumeScale = 1.0f;
channel->freqScale = 1.0f;
for (i = 0; i < ARRAY_COUNT(channel->soundScriptIO); i++) {
channel->soundScriptIO[i] = -1;
channel->soundScriptIO[i] = SEQ_IO_VAL_NONE;
}
channel->unused = false;
@@ -345,7 +345,7 @@ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) {
layer->channel = channel;
layer->adsr = channel->adsr;
layer->adsr.decayIndex = 0;
layer->unk_09 = channel->reverb;
layer->targetReverbVol = channel->targetReverbVol;
layer->enabled = true;
layer->finished = false;
layer->stopSomething = false;
@@ -355,8 +355,8 @@ s32 AudioSeq_SeqChannelSetLayer(SequenceChannel* channel, s32 layerIndex) {
layer->bit1 = false;
layer->notePropertiesNeedInit = false;
layer->gateTime = 0x80;
layer->unk_08 = 0x80;
layer->stereo.asByte = 0;
layer->surroundEffectIndex = 0x80;
layer->stereoData.asByte = 0;
layer->portamento.mode = PORTAMENTO_MODE_OFF;
layer->scriptState.depth = 0;
layer->pan = 0x40;
@@ -782,7 +782,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
break;
case 0xCD: // layer: stereo effects
layer->stereo.asByte = AudioSeq_ScriptReadU8(state);
layer->stereoData.asByte = AudioSeq_ScriptReadU8(state);
break;
case 0xCE: // layer: bend pitch
@@ -796,7 +796,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
break;
case 0xF1: // layer:
layer->unk_08 = AudioSeq_ScriptReadU8(state);
layer->surroundEffectIndex = AudioSeq_ScriptReadU8(state);
break;
default:
@@ -991,13 +991,14 @@ s32 AudioSeq_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) {
if (layer->delay == 0) {
if (layer->tunedSample != NULL) {
time = layer->tunedSample->sample->loop->end;
time = layer->tunedSample->sample->loop->loopEnd;
} else {
time = 0.0f;
}
time *= seqPlayer->tempo;
time *= gAudioContext.unk_2870;
time /= layer->freqScale;
//! FAKE:
if (1) {}
if (time > 0x7FFE) {
time = 0x7FFE;
@@ -1416,9 +1417,9 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->vibrato.vibratoDelay = cmd * 16;
break;
case 0xD4: // channel: set reverb
case 0xD4: // channel: set reverb volume
cmd = (u8)cmdArgs[0];
channel->reverb = cmd;
channel->targetReverbVol = cmd;
break;
case 0xC6: // channel: set soundFont
@@ -1491,7 +1492,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
} else {
channel->stereoHeadsetEffects = false;
}
channel->stereo.asByte = cmd & 0x7F;
channel->stereoData.asByte = cmd & 0x7F;
break;
case 0xD1: // channel: set note allocation policy
@@ -1537,7 +1538,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
data += 4;
channel->newPan = data[-3];
channel->panChannelWeight = data[-2];
channel->reverb = data[-1];
channel->targetReverbVol = data[-1];
channel->reverbIndex = data[0];
//! @bug: Not marking reverb state as changed
channel->changes.s.pan = true;
@@ -1551,7 +1552,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->transposition = (s8)AudioSeq_ScriptReadU8(scriptState);
channel->newPan = AudioSeq_ScriptReadU8(scriptState);
channel->panChannelWeight = AudioSeq_ScriptReadU8(scriptState);
channel->reverb = AudioSeq_ScriptReadU8(scriptState);
channel->targetReverbVol = AudioSeq_ScriptReadU8(scriptState);
channel->reverbIndex = AudioSeq_ScriptReadU8(scriptState);
//! @bug: Not marking reverb state as changed
channel->changes.s.pan = true;
@@ -1569,8 +1570,8 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->adsr.sustain = 0;
channel->velocityRandomVariance = 0;
channel->gateTimeRandomVariance = 0;
channel->unk_0F = 0;
channel->unk_20 = 0;
channel->combFilterSize = 0;
channel->combFilterGain = 0;
channel->bookOffset = 0;
channel->startSamplePos = 0;
channel->unk_E0 = 0;
@@ -1651,8 +1652,8 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
break;
case 0xBB: // channel:
channel->unk_0F = cmdArgs[0];
channel->unk_20 = cmdArgs[1];
channel->combFilterSize = cmdArgs[0];
channel->combFilterGain = cmdArgs[1];
break;
case 0xBC: // channel: add large
@@ -1667,8 +1668,8 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
if (cmdArgs[0] < 5) {
if (1) {}
if (gAudioContext.unk_29A8[cmdArgs[0]] != NULL) {
D_80208E6C = gAudioContext.unk_29A8[cmdArgs[0]];
scriptState->value = D_80208E6C(scriptState->value, channel);
gCustomAudioSeqFunction = gAudioContext.unk_29A8[cmdArgs[0]];
scriptState->value = gCustomAudioSeqFunction(scriptState->value, channel);
}
}
break;
@@ -1693,7 +1694,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
break;
case 0xA4: // channel:
channel->unk_10 = cmdArgs[0];
channel->surroundEffectIndex = cmdArgs[0];
break;
case 0xA5: // channel:
@@ -1791,12 +1792,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0x10: // channel: load sample
if (lowBits < 8) {
channel->soundScriptIO[lowBits] = -1;
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value,
&channel->soundScriptIO[lowBits]) == -1) {}
} else {
lowBits -= 8;
channel->soundScriptIO[lowBits] = -1;
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
if (AudioLoad_SlowLoadSample(channel->fontId, channel->unk_22 + 0x100,
&channel->soundScriptIO[lowBits]) == -1) {}
}
@@ -1805,7 +1806,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0x60: // channel: io read value
scriptState->value = channel->soundScriptIO[lowBits];
if (lowBits < 2) {
channel->soundScriptIO[lowBits] = -1;
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
}
break;
@@ -2150,7 +2151,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
case 0x80: // seqPlayer: io read value
seqScript->value = seqPlayer->soundScriptIO[cmdLowBits];
if (cmdLowBits < 2) {
seqPlayer->soundScriptIO[cmdLowBits] = -1;
seqPlayer->soundScriptIO[cmdLowBits] = SEQ_IO_VAL_NONE;
}
break;
@@ -2197,7 +2198,7 @@ void AudioSeq_ProcessSequences(s32 arg0) {
SequencePlayer* seqPlayer;
u32 i;
gAudioContext.noteSubEuOffset =
gAudioContext.sampleStateOffset =
(gAudioContext.audioBufferParameters.updatesPerFrame - arg0 - 1) * gAudioContext.numNotes;
for (i = 0; i < (u32)gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
@@ -2286,7 +2287,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) {
seqPlayer->applyBend = false;
for (j = 0; j < ARRAY_COUNT(seqPlayer->soundScriptIO); j++) {
seqPlayer->soundScriptIO[j] = -1;
seqPlayer->soundScriptIO[j] = SEQ_IO_VAL_NONE;
}
seqPlayer->muteFlags = MUTE_FLAGS_SOFTEN | MUTE_FLAGS_STOP_NOTES;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -671,7 +671,7 @@ void AudioSfx_PlayActiveSfx(u8 bankId) {
// "one-frame" sfx
entry->state = SFX_STATE_PLAYING_ONE_FRAME;
}
} else if ((u8)channel->soundScriptIO[1] == 0xFF) {
} else if ((u8)channel->soundScriptIO[1] == (u8)SEQ_IO_VAL_NONE) {
// Signal from seq 0 that the sfx is finished playing. Remove entry
AudioSfx_RemoveBankEntry(bankId, entryIndex);
} else if (entry->state == SFX_STATE_PLAYING_REFRESH) {
+2 -2
View File
@@ -2,7 +2,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StartSequence.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7D04.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StopSequence.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7D84.s")
@@ -10,7 +10,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A89D0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8A50.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_GetActiveSequence.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8ABC.s")
+4 -4
View File
@@ -1,6 +1,6 @@
/**
* File: flg_set.c
* Description: Event Editor, used to view and edit weekEventReg, eventInf and maskMaskBit flags.
* Description: Event Editor, used to view and edit weekEventReg, eventInf and masksGivenOnMoon flags.
* Controls:
* + Left and Right: select different flags/bits in array element
* + Up and Down: select array element (byte) 1 up/down
@@ -123,9 +123,9 @@ static FlagSetEntry sFlagEntries[] = {
{ &gSaveContext.eventInf[6], "event_inf[6]" },
{ &gSaveContext.eventInf[7], "event_inf[7]" },
{ &gSaveContext.maskMaskBit[0], "mask_mask_bit[0]" },
{ &gSaveContext.maskMaskBit[1], "mask_mask_bit[1]" },
{ &gSaveContext.maskMaskBit[2], "mask_mask_bit[2]" },
{ &gSaveContext.masksGivenOnMoon[0], "mask_mask_bit[0]" },
{ &gSaveContext.masksGivenOnMoon[1], "mask_mask_bit[1]" },
{ &gSaveContext.masksGivenOnMoon[2], "mask_mask_bit[2]" },
{ NULL, NULL }, // used in the code to detect array end
};
+1 -1
View File
@@ -225,7 +225,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
void GameState_Destroy(GameState* gameState) {
AudioMgr_StopAllSfxExceptSystem();
func_8019E014();
Audio_Update();
osRecvMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
if (gameState->destroy != NULL) {
+1 -1
View File
@@ -232,7 +232,7 @@ void Graph_UpdateGame(GameState* gameState) {
Game_UpdateInput(gameState);
Game_IncrementFrameCount(gameState);
if (SREG(20) < 3) {
func_8019E014();
Audio_Update();
}
}
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "z64view.h"
#include "system_malloc.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_80177390.s")
+15 -13
View File
@@ -5,6 +5,7 @@
#include "global.h"
#include "z64load.h"
#include "z64quake.h"
#include "z64rumble.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
#include "overlays/actors/ovl_En_Part/z_en_part.h"
@@ -1059,7 +1060,7 @@ void Actor_SetScale(Actor* actor, f32 scale) {
}
void Actor_SetObjectDependency(PlayState* play, Actor* actor) {
gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[actor->objBankIndex].segment);
gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[actor->objBankIndex].segment);
}
void Actor_Init(Actor* actor, PlayState* play) {
@@ -2608,7 +2609,8 @@ s32 Actor_RecordUndrawnActor(PlayState* play, Actor* actor) {
}
void Actor_DrawLensOverlay(Gfx** gfxP, s32 lensMaskSize) {
func_80164C14(gfxP, &gCircleTex, 4, 0, 6, 6, ((LENS_MASK_ACTIVE_SIZE - lensMaskSize) * 0.003f) + 1.0f);
TransitionCircle_LoadAndSetTexture(gfxP, gCircleTex, 4, 0, 6, 6,
((LENS_MASK_ACTIVE_SIZE - lensMaskSize) * 0.003f) + 1.0f);
}
#ifdef NON_EQUIVALENT
@@ -3777,20 +3779,20 @@ void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx);
}
void func_800BC770(PlayState* play, s16 y, s16 countdown) {
s16 idx = Quake_Add(&play->mainCamera, 3);
void Actor_AddQuake(PlayState* play, s16 verticalMag, s16 countdown) {
s16 quakeIndex = Quake_Add(&play->mainCamera, QUAKE_TYPE_3);
Quake_SetSpeed(idx, 20000);
Quake_SetQuakeValues(idx, y, 0, 0, 0);
Quake_SetCountdown(idx, countdown);
Quake_SetSpeed(quakeIndex, 20000);
Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0);
Quake_SetCountdown(quakeIndex, countdown);
}
void func_800BC7D8(PlayState* play, s16 y, s16 countdown, s16 speed) {
s16 idx = Quake_Add(&play->mainCamera, 3);
void Actor_AddQuakeWithSpeed(PlayState* play, s16 verticalMag, s16 countdown, s16 speed) {
s16 quakeIndex = Quake_Add(&play->mainCamera, QUAKE_TYPE_3);
Quake_SetSpeed(idx, speed);
Quake_SetQuakeValues(idx, y, 0, 0, 0);
Quake_SetCountdown(idx, countdown);
Quake_SetSpeed(quakeIndex, speed);
Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0);
Quake_SetCountdown(quakeIndex, countdown);
}
// Actor_RequestRumble?
@@ -3800,7 +3802,7 @@ void func_800BC848(Actor* actor, PlayState* play, s16 y, s16 countdown) {
} else {
Rumble_Request(actor->xyzDistToPlayerSq, 180, 20, 100);
}
func_800BC770(play, y, countdown);
Actor_AddQuake(play, y, countdown);
}
typedef struct {
+10 -6
View File
@@ -4331,18 +4331,22 @@ s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly*
}
/**
* SurfaceType Get Conveyor Surface Type
* Return type 0 (CONVEYOR_WATER) if 'poly' is a surface that will only move player underwater
* Return type 1 (CONVEYOR_FLOOR) if `poly` is a surface that must be stood on to move player
* Checks if poly is a floor conveyor
*
* A conveyor surface is enabled with non-zero speed.
* When enabled, the conveyor will exhibit two types of behaviour depending on the return value:
*
* If true, then it is a floor conveyor and will push player only while being stood on
* If false, then it is a water conveyor and will push player only while in water
*/
s32 SurfaceType_GetConveyorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
u32 flags;
if (BgCheck_GetCollisionHeader(colCtx, bgId) == NULL) {
return CONVEYOR_FLOOR;
return true;
}
if (poly == NULL) {
return CONVEYOR_WATER;
return false;
}
flags = poly->flags_vIB & 0x2000;
return !!flags;
+3
View File
@@ -1,4 +1,7 @@
#include "global.h"
#include "z64quake.h"
#include "z64shrink_window.h"
#include "z64view.h"
/**
* Returns the absolute value for floats
+2 -2
View File
@@ -6,8 +6,8 @@ void SaveContext_Init(void) {
bzero(&gSaveContext, sizeof(SaveContext));
gSaveContext.save.playerForm = 0;
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.ambienceId = AMBIENCE_ID_DISABLED;
gSaveContext.unk_3F46 = NA_BGM_GENERAL_SFX;
gSaveContext.nextCutsceneIndex = 0xFFEF;
gSaveContext.cutsceneTrigger = 0;
+28 -30
View File
@@ -1,5 +1,7 @@
#include "global.h"
#include "z64quake.h"
#include "z64rumble.h"
#include "z64shrink_window.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
void Cutscene_DoNothing(PlayState* play, CutsceneContext* csCtx);
@@ -106,7 +108,7 @@ s32 func_800EA220(PlayState* play, CutsceneContext* csCtx, f32 target) {
void func_800EA258(PlayState* play, CutsceneContext* csCtx) {
Interface_SetHudVisibility(HUD_VISIBILITY_NONE);
ShrinkWindow_SetLetterboxTarget(32);
ShrinkWindow_Letterbox_SetSizeTarget(32);
if (func_800EA220(play, csCtx, 1.0f)) {
Audio_SetCutsceneFlag(true);
csCtx->state++;
@@ -116,7 +118,7 @@ void func_800EA258(PlayState* play, CutsceneContext* csCtx) {
void func_800EA2B8(PlayState* play, CutsceneContext* csCtx) {
func_800ED980(play, csCtx);
Interface_SetHudVisibility(HUD_VISIBILITY_NONE);
ShrinkWindow_SetLetterboxTarget(32);
ShrinkWindow_Letterbox_SetSizeTarget(32);
if (func_800EA220(play, csCtx, 1.0f)) {
Audio_SetCutsceneFlag(true);
csCtx->state++;
@@ -152,7 +154,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
break;
case 0x2:
if (isStartFrame) {
func_801A47DC(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0);
Audio_SetAmbienceChannelIO(AMBIENCE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0);
Environment_AddLightningBolts(play, 3);
D_801F4E68 = 1;
}
@@ -191,7 +193,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
case 0x8:
func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG);
if (isStartFrame) {
sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6);
sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6);
Quake_SetSpeed(sCutsceneQuakeIndex, 22000);
Quake_SetQuakeValues(sCutsceneQuakeIndex, 6, 4, 0, 0);
Quake_SetCountdown(sCutsceneQuakeIndex, 800);
@@ -281,7 +283,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
case 0x1A:
func_8019F128(NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG);
if (isStartFrame) {
sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6);
sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6);
Quake_SetSpeed(sCutsceneQuakeIndex, 30000);
Quake_SetQuakeValues(sCutsceneQuakeIndex, 20, 10, 0, 0);
Quake_SetCountdown(sCutsceneQuakeIndex, 800);
@@ -333,7 +335,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
case 0x24:
func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG);
if (isStartFrame) {
sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6);
sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6);
Quake_SetSpeed(sCutsceneQuakeIndex, 22000);
Quake_SetQuakeValues(sCutsceneQuakeIndex, 2, 1, 0, 0);
Quake_SetCountdown(sCutsceneQuakeIndex, 800);
@@ -376,14 +378,14 @@ void Cutscene_Command_SetLighting(PlayState* play, CutsceneContext* csCtx, CsCmd
// Command 0x12C: Plays a sequence (Background music or Fanfare)
void Cutscene_Command_PlaySequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) {
if (csCtx->frames == cmd->startFrame) {
func_801A2C88(cmd->sequence - 1);
Audio_PlaySequenceInCutscene(cmd->sequence - 1);
}
}
// Command 0x12D: Stops a sequence (Background music or Fanfare)
void Cutscene_Command_StopSequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) {
if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) {
func_801A2D54(cmd->sequence - 1);
Audio_StopSequenceInCutscene(cmd->sequence - 1);
}
}
@@ -403,9 +405,7 @@ void Cutscene_Command_FadeSequence(PlayState* play, CutsceneContext* csCtx, CsCm
// Command 0x12E: Play Ambience sequence
void Cutscene_Command_PlayAmbienceSequence(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
if (csCtx->frames == cmd->startFrame) {
// Audio_PlayNatureAmbienceSequence
// nightSeqIndex is natureAmbienceId
func_801A4A28(play->soundCtx.nightSeqIndex);
Audio_PlayAmbience(play->sequenceCtx.ambienceId);
}
}
@@ -455,29 +455,27 @@ void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
break;
case 4:
// func_801A246C(SEQ_PLAYER_NATURE, TYPE_1);
func_801A246C(SEQ_PLAYER_NATURE, 1);
// func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_1);
func_801A246C(SEQ_PLAYER_AMBIENCE, 1);
break;
case 5:
// func_801A246C(SEQ_PLAYER_NATURE, TYPE_0);
func_801A246C(SEQ_PLAYER_NATURE, 0);
// func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_0);
func_801A246C(SEQ_PLAYER_AMBIENCE, 0);
break;
case 6:
// func_801A246C(SEQ_PLAYER_NATURE, TYPE_2);
func_801A246C(SEQ_PLAYER_NATURE, 2);
// func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_2);
func_801A246C(SEQ_PLAYER_AMBIENCE, 2);
break;
case 7:
// Audio_GetActiveSequence
seqId = func_801A8A50(0);
seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN);
break;
case 8:
if (seqId != NA_BGM_DISABLED) {
// Audio_PlayBgmForDayScene
func_801A25E4(seqId, dayMinusOne);
Audio_PlaySceneSequence(seqId, dayMinusOne);
}
break;
}
@@ -647,7 +645,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
// Command 0x15F: Chooses between a cutscene or a rotating mask depending on whether the player has the corresponding
// mask
void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
if ((csCtx->frames >= cmd->startFrame) && (func_801A3950(0, true) != 0xFF)) {
if ((csCtx->frames >= cmd->startFrame) && (func_801A3950(SEQ_PLAYER_BGM_MAIN, true) != 0xFF)) {
switch (cmd->base) {
case 1:
Cutscene_TerminatorImpl(play, csCtx, cmd);
@@ -1452,8 +1450,8 @@ void func_800EDA84(PlayState* play, CutsceneContext* csCtx) {
if (gSaveContext.cutsceneTrigger == 0) {
Interface_SetHudVisibility(HUD_VISIBILITY_NONE);
ShrinkWindow_SetLetterboxTarget(32);
ShrinkWindow_SetLetterboxMagnitude(0x20);
ShrinkWindow_Letterbox_SetSizeTarget(32);
ShrinkWindow_Letterbox_SetSize(32);
csCtx->state++;
}
@@ -1500,7 +1498,7 @@ void func_800EDBE0(PlayState* play) {
sp24 = play->loadedScene;
if ((sp24->titleTextId != 0) && gSaveContext.showTitleCard) {
if ((Entrance_GetTransitionFlags(((void)0, gSaveContext.save.entrance) +
((void)0, gSaveContext.sceneSetupIndex)) &
((void)0, gSaveContext.sceneLayer)) &
0x4000) != 0) {
func_80151A68(play, sp24->titleTextId);
}
@@ -1611,13 +1609,13 @@ void Cutscene_ActorTranslateXZAndYawSmooth(Actor* actor, PlayState* play, s32 ac
actor->shape.rot.y = actor->world.rot.y;
}
s32 Cutscene_GetSceneSetupIndex(PlayState* play) {
s32 sceneSetupIndex = 0;
s32 Cutscene_GetSceneLayer(PlayState* play) {
s32 sceneLayer = 0;
if (gSaveContext.sceneSetupIndex > 0) {
sceneSetupIndex = gSaveContext.sceneSetupIndex;
if (gSaveContext.sceneLayer > 0) {
sceneLayer = gSaveContext.sceneLayer;
}
return sceneSetupIndex;
return sceneLayer;
}
s32 Cutscene_GetActorActionIndex(PlayState* play, u16 actorActionCmd) {
+6 -6
View File
@@ -50,7 +50,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, TexturePtr texture) {
SkinMatrix_SetScale(&mfScale, scale, scale, scale);
SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfScale, &mfResult);
gSegments[0x06] = PHYSICAL_TO_VIRTUAL(object);
gSegments[0x06] = VIRTUAL_TO_PHYSICAL(object);
gSPSegment(POLY_XLU_DISP++, 0x06, object);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);
@@ -702,16 +702,16 @@ void EffectSsKFire_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* ac
// EffectSsSolderSrchBall Spawn Functions
void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused,
s16* linkDetected, s16 drawFlag) {
void EffectSsSolderSrchBall_Spawn(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale,
s16* playerDetected, s16 flags) {
EffectSsSolderSrchBallInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);
Math_Vec3f_Copy(&initParams.velocity, velocity);
Math_Vec3f_Copy(&initParams.accel, accel);
initParams.unused = unused;
initParams.linkDetected = linkDetected;
initParams.drawFlag = drawFlag;
initParams.scale = scale;
initParams.playerDetected = playerDetected;
initParams.flags = flags;
EffectSs_Spawn(play, EFFECT_SS_SOLDER_SRCH_BALL, 128, &initParams);
}
+3 -3
View File
@@ -84,7 +84,7 @@ EnDoor* EnHy_FindNearestDoor(Actor* actor, PlayState* play) {
}
void EnHy_ChangeObjectAndAnim(EnHy* enHy, PlayState* play, s16 animIndex) {
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->animObjIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[enHy->animObjIndex].segment);
EnHy_ChangeAnim(&enHy->skelAnime, animIndex);
}
@@ -92,7 +92,7 @@ s32 EnHy_UpdateSkelAnime(EnHy* enHy, PlayState* play) {
s32 isUpdated = false;
if (enHy->actor.draw != NULL) {
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->animObjIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[enHy->animObjIndex].segment);
SkelAnime_Update(&enHy->skelAnime);
isUpdated = true;
}
@@ -119,7 +119,7 @@ s32 EnHy_Init(EnHy* enHy, PlayState* play, FlexSkeletonHeader* skeletonHeaderSeg
enHy->actor.objBankIndex = enHy->skelLowerObjIndex;
isInitialized = true;
ActorShape_Init(&enHy->actor.shape, 0.0f, NULL, 0.0f);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[enHy->actor.objBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[enHy->actor.objBankIndex].segment);
SkelAnime_InitFlex(play, &enHy->skelAnime, skeletonHeaderSeg, NULL, enHy->jointTable, enHy->morphTable,
ENHY_LIMB_MAX);
EnHy_ChangeObjectAndAnim(enHy, play, animIndex);
+2 -2
View File
@@ -843,10 +843,10 @@ void EnItem00_DrawSprite(EnItem00* this, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx);
}
void EnItem00_DrawHeartContainer(EnItem00* actor, PlayState* play) {
void EnItem00_DrawHeartContainer(EnItem00* this, PlayState* play) {
s32 pad[2];
if (Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS) == actor->actor.objBankIndex) {
if (Object_GetIndex(&play->objectCtx, OBJECT_GI_HEARTS) == this->actor.objBankIndex) {
OPEN_DISPS(play->state.gfxCtx);
func_8012C2DC(play->state.gfxCtx);
+1
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "z64shrink_window.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F1460.s")
+134 -9
View File
@@ -1,19 +1,144 @@
#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Start.s")
Gfx D_801D0D00[] = {
gsDPPipeSync(),
gsDPSetOtherMode(G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE |
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
G_AC_THRESHOLD | G_ZS_PRIM | AA_EN | IM_RD | CVG_DST_FULL | ZMODE_OPA | CVG_X_ALPHA | FORCE_BL |
GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA) |
GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_IN, G_BL_1)),
gsDPSetPrimColor(0, 255, 0, 0, 0, 1),
gsDPSetBlendColor(0, 0, 0, 1),
gsSPEndDisplayList(),
};
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Init.s")
//! @bug: TransitionCircle_Update should take an additional argument `s32 updateRate`
TransitionInit TransitionCircle_InitVars = {
TransitionCircle_Init, TransitionCircle_Destroy, (void*)TransitionCircle_Update, TransitionCircle_Draw,
TransitionCircle_Start, TransitionCircle_SetType, TransitionCircle_SetColor, NULL,
TransitionCircle_IsDone,
};
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Destroy.s")
void TransitionCircle_Start(void* thisx) {
TransitionCircle* this = (TransitionCircle*)thisx;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Update.s")
this->stepValue = 0.1f;
if (this->direction == TRANSITION_CIRCLE_IN) {
this->targetRadius = 0.0f;
this->startingRadius = 1.0f;
} else {
this->startingRadius = 0.0f;
this->targetRadius = 1.0f;
}
this->referenceRadius = this->startingRadius;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_SetColor.s")
void* TransitionCircle_Init(void* thisx) {
TransitionCircle* this = (TransitionCircle*)thisx;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_SetType.s")
bzero(this, sizeof(TransitionCircle));
this->maskType = 1;
this->texture = gCircleTex;
this->masks = 6;
this->maskt = 6;
this->unk_1E = 4;
this->unk_1F = 0;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/func_80164C14.s")
return this;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_Draw.s")
void TransitionCircle_Destroy(void* thisx) {
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_circle/TransitionCircle_IsDone.s")
void TransitionCircle_Update(void* thisx) {
TransitionCircle* this = (TransitionCircle*)thisx;
this->isDone = Math_StepToF(&this->referenceRadius, this->targetRadius, this->stepValue);
}
void TransitionCircle_SetColor(void* thisx, u32 color) {
TransitionCircle* this = (TransitionCircle*)thisx;
this->color.rgba = color;
}
void TransitionCircle_SetType(void* thisx, s32 type) {
TransitionCircle* this = (TransitionCircle*)thisx;
if (type & TC_SET_PARAMS) {
this->maskType = FBDEMO_CIRCLE_GET_MASK_TYPE(type);
} else if (type == 1) {
this->direction = TRANSITION_CIRCLE_OUT;
} else {
this->direction = TRANSITION_CIRCLE_IN;
}
}
void TransitionCircle_LoadAndSetTexture(Gfx** gfxp, TexturePtr texture, s32 fmt, s32 arg3, s32 masks, s32 maskt,
f32 arg6) {
Gfx* gfx = *gfxp;
s32 xh = D_801FBBCC;
s32 yh = D_801FBBCE;
s32 width = 1 << masks;
s32 height = 1 << maskt;
f32 s;
f32 t;
s32 dtdy;
s32 dsdx;
gDPLoadTextureBlock_4b(gfx++, texture, fmt, width, height, 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP,
masks, maskt, G_TX_NOLOD, G_TX_NOLOD);
gDPSetTileSize(gfx++, G_TX_RENDERTILE, ((SCREEN_WIDTH / 2) - width) << 2, ((SCREEN_HEIGHT / 2) - height) << 2,
((SCREEN_WIDTH / 2) + (width - 1)) << 2, ((SCREEN_HEIGHT / 2) + (height - 1)) << 2);
s = ((1.0f - (1.0f / arg6)) * (SCREEN_WIDTH / 2)) + 70.0f;
t = ((1.0f - (1.0f / arg6)) * (SCREEN_HEIGHT / 2)) + 50.0f;
if (s < -1023.0f) {
s = -1023.0f;
}
if (t < -1023.0f) {
t = -1023.0f;
}
if ((s <= -1023.0f) || (t <= -1023.0f)) {
dsdx = 0;
dtdy = 0;
} else {
dsdx = ((SCREEN_WIDTH - (2.0f * s)) / gScreenWidth) * (1 << 10);
dtdy = ((SCREEN_HEIGHT - (2.0f * t)) / gScreenHeight) * (1 << 10);
}
gSPTextureRectangle(gfx++, 0, 0, xh << 2, yh << 2, G_TX_RENDERTILE, (s32)(s * (1 << 5)), (s32)(t * (1 << 5)), dsdx,
dtdy);
gDPPipeSync(gfx++);
*gfxp = gfx;
}
void TransitionCircle_Draw(void* thisx, Gfx** gfxp) {
Gfx* gfx = *gfxp;
TransitionCircle* this = (TransitionCircle*)thisx;
gDPPipeSync(gfx++);
gSPDisplayList(gfx++, &D_801D0D00);
gDPSetPrimColor(gfx++, 0, this->color.a, this->color.r, this->color.g, this->color.b, 1);
if (this->maskType == 0) {
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIM_LOD_FRAC, PRIMITIVE, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
PRIM_LOD_FRAC, PRIMITIVE);
} else {
gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, 1, TEXEL0, PRIM_LOD_FRAC, PRIMITIVE, 0, 0, 0, PRIMITIVE, 1, TEXEL0,
PRIM_LOD_FRAC, PRIMITIVE);
}
TransitionCircle_LoadAndSetTexture(&gfx, this->texture, G_IM_FMT_I, 0, this->masks, this->maskt,
this->referenceRadius);
gDPPipeSync(gfx++);
*gfxp = gfx;
}
s32 TransitionCircle_IsDone(void* thisx) {
TransitionCircle* this = (TransitionCircle*)thisx;
return this->isDone;
}
+51 -2
View File
@@ -1,5 +1,54 @@
#include "global.h"
#include "initvars.h"
#include "overlays/fbdemos/ovl_fbdemo_triforce/z_fbdemo_triforce.h"
#include "overlays/fbdemos/ovl_fbdemo_wipe1/z_fbdemo_wipe1.h"
#include "overlays/fbdemos/ovl_fbdemo_wipe3/z_fbdemo_wipe3.h"
#include "overlays/fbdemos/ovl_fbdemo_wipe4/z_fbdemo_wipe4.h"
#include "overlays/fbdemos/ovl_fbdemo_wipe5/z_fbdemo_wipe5.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_dlftbls/func_80163C90.s")
#define TRANSITION_OVERLAY(name, filename) \
{ \
{ 0, 0 }, SEGMENT_START(ovl_##filename), SEGMENT_END(ovl_##filename), SEGMENT_ROM_START(ovl_##filename), \
SEGMENT_ROM_END(ovl_##filename), &name##_InitVars, sizeof(name) \
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo_dlftbls/func_80163D80.s")
#define TRANSITION_OVERLAY_INTERNAL(name) \
{ { 0, 0 }, NULL, NULL, 0, 0, &name##_InitVars, sizeof(name) }
#define TRANSITION_OVERLAY_UNSET \
{ 0 }
TransitionOverlay gTransitionOverlayTable[] = {
TRANSITION_OVERLAY_INTERNAL(TransitionFade), TRANSITION_OVERLAY(TransitionTriforce, fbdemo_triforce),
TRANSITION_OVERLAY(TransitionWipe1, fbdemo_wipe1), TRANSITION_OVERLAY(TransitionWipe3, fbdemo_wipe3),
TRANSITION_OVERLAY(TransitionWipe4, fbdemo_wipe4), TRANSITION_OVERLAY_INTERNAL(TransitionCircle),
TRANSITION_OVERLAY(TransitionWipe5, fbdemo_wipe5),
};
void Transition_Init(TransitionContext* transitionCtx) {
TransitionOverlay* overlayEntry;
ptrdiff_t relocOffset;
TransitionInit* initInfo[1];
overlayEntry = &gTransitionOverlayTable[transitionCtx->fbdemoType];
TransitionOverlay_Load(overlayEntry);
relocOffset = (uintptr_t)Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr) - (uintptr_t)overlayEntry->vramStart;
initInfo[0] = NULL;
initInfo[0] = (overlayEntry->initInfo != NULL) ? (TransitionInit*)((uintptr_t)overlayEntry->initInfo + relocOffset)
: initInfo[0];
transitionCtx->init = initInfo[0]->init;
transitionCtx->destroy = initInfo[0]->destroy;
transitionCtx->start = initInfo[0]->start;
transitionCtx->isDone = initInfo[0]->isDone;
transitionCtx->draw = initInfo[0]->draw;
transitionCtx->update = initInfo[0]->update;
transitionCtx->setType = initInfo[0]->setType;
transitionCtx->setColor = initInfo[0]->setColor;
transitionCtx->setEnvColor = initInfo[0]->setEnvColor;
}
void Transition_Destroy(TransitionContext* transitionCtx) {
TransitionOverlay_Free(&gTransitionOverlayTable[transitionCtx->fbdemoType]);
}
+5 -4
View File
@@ -1,5 +1,6 @@
#include "global.h"
#include "z64rumble.h"
#include "z64shrink_window.h"
void GameOver_Init(PlayState* play) {
play->gameOverCtx.state = GAMEOVER_INACTIVE;
@@ -46,8 +47,8 @@ void GameOver_Update(PlayState* play) {
gSaveContext.unk_3DC0 = 2000;
gSaveContext.save.playerData.tatlTimer = 0;
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.ambienceId = AMBIENCE_ID_DISABLED;
gSaveContext.eventInf[0] = 0;
gSaveContext.eventInf[1] = 0;
gSaveContext.eventInf[2] = 0;
@@ -67,7 +68,7 @@ void GameOver_Update(PlayState* play) {
gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND;
break;
case GAMEOVER_DEATH_FADE_OUT:
if (func_801A8A50(1) != NA_BGM_GAME_OVER) {
if (Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) != NA_BGM_GAME_OVER) {
Play_LoadToLastEntrance(&play->state);
if (gSaveContext.respawnFlag != -7) {
gSaveContext.respawnFlag = -6;
@@ -86,7 +87,7 @@ void GameOver_Update(PlayState* play) {
gameOverCtx->state++;
sGameOverTimer = 0;
Kankyo_InitGameOverLights(play);
ShrinkWindow_SetLetterboxTarget(32);
ShrinkWindow_Letterbox_SetSizeTarget(32);
break;
case GAMEOVER_REVIVE_RUMBLE:
sGameOverTimer = 50;
+2 -1
View File
@@ -1,5 +1,6 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64shrink_window.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
void (*sKaleidoScopeUpdateFunc)(PlayState* play);
@@ -36,7 +37,7 @@ void KaleidoScopeCall_Update(PlayState* play) {
if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) {
if (pauseCtx->state == 1 || pauseCtx->state == 19) {
if (ShrinkWindow_GetLetterboxMagnitude() == 0) {
if (ShrinkWindow_Letterbox_GetSize() == 0) {
R_PAUSE_MENU_MODE = 1;
pauseCtx->unk_200 = 0;
pauseCtx->unk_208 = 0;
+4 -2
View File
@@ -1,5 +1,7 @@
#include "global.h"
#include "z64rumble.h"
#include "z64shrink_window.h"
#include "z64view.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
s16 D_801BDB00[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_MASK, PAUSE_ITEM };
@@ -91,8 +93,8 @@ void KaleidoSetup_Update(PlayState* play) {
if (pauseCtx->state == 1) {
Game_SetFramerateDivisor(&play->state, 2);
if (ShrinkWindow_GetLetterboxTarget() != 0) {
ShrinkWindow_SetLetterboxTarget(0);
if (ShrinkWindow_Letterbox_GetSizeTarget() != 0) {
ShrinkWindow_Letterbox_SetSizeTarget(0);
}
func_801A3AEC(1);
}
+20 -10
View File
@@ -704,11 +704,29 @@ void* Lib_SegmentedToVirtual(void* ptr) {
void* Lib_SegmentedToVirtualNull(void* ptr) {
if (((uintptr_t)ptr >> 28) == 0) {
return ptr;
} else {
return SEGMENTED_TO_VIRTUAL(ptr);
}
return SEGMENTED_TO_VIRTUAL(ptr);
}
/*
* Converts a 32-bit virtual address (0x80XXXXXX) to a 24-bit physical address (0xXXXXXX). The NULL case accounts for
* the NULL virtual address being 0x00000000 and not 0x80000000. Used by transition overlays, which store their
* addresses in 24-bit fields.
*/
void* Lib_VirtualToPhysical(void* ptr) {
if (ptr == NULL) {
return NULL;
} else {
return (void*)VIRTUAL_TO_PHYSICAL(ptr);
}
}
/*
* Converts a 24-bit physical address (0xXXXXXX) to a 32-bit virtual address (0x80XXXXXX). The NULL case accounts for
* the NULL virtual address being 0x00000000 and not 0x80000000. Used by transition overlays, which store their
* addresses in 24-bit fields.
*/
void* Lib_PhysicalToVirtual(void* ptr) {
if (ptr == NULL) {
return NULL;
@@ -716,11 +734,3 @@ void* Lib_PhysicalToVirtual(void* ptr) {
return (void*)PHYSICAL_TO_VIRTUAL(ptr);
}
}
void* Lib_PhysicalToVirtualNull(void* ptr) {
if (ptr == NULL) {
return NULL;
} else {
return (void*)PHYSICAL_TO_VIRTUAL(ptr);
}
}
+3 -1
View File
@@ -1,4 +1,6 @@
#include "global.h"
#include "z64shrink_window.h"
#include "z64view.h"
#include "message_data_static.h"
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
@@ -489,7 +491,7 @@ u8 Message_GetState(MessageContext* msgCtx) {
void func_80152C64(View* view) {
SET_FULLSCREEN_VIEWPORT(view);
func_8013FBC8(view);
View_ApplyOrthoToOverlay(view);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80152CAC.s")
+95 -6
View File
@@ -1,14 +1,103 @@
/**
* @file z_overlay.c
*
* Functions for handling transition overlays in memory
*
* Status codes returned from TransitionOverlay_Load and TransitionOverlay_Free:
*
* -1 : failed allocation or null reference
* 0 : successfully loaded/freed overlay
* 1 : successfully added/removed instance
* 2 : overlay is loaded but has no instances (?) TODO: Figure out why this exists
* 3 : internal overlay, so always loaded
*/
#include "global.h"
#include "z64load.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_801651B0.s")
void* TransitionOverlay_VramToRam(TransitionOverlay* overlayEntry, void* vramAddr) {
void* loadedRamAddr = Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_80165224.s")
if ((loadedRamAddr != NULL) && (vramAddr >= overlayEntry->vramStart) && (vramAddr < overlayEntry->vramEnd)) {
return ((uintptr_t)loadedRamAddr - (uintptr_t)overlayEntry->vramStart) + (uintptr_t)vramAddr;
}
return vramAddr;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_80165288.s")
void TransitionOverlay_VramToRamArray(TransitionOverlay* overlayEntry, void** vramAddrs, s32 count) {
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_8016537C.s")
for (i = 0; i < count; i++) {
vramAddrs[i] = TransitionOverlay_VramToRam(overlayEntry, vramAddrs[i]);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_80165438.s")
s32 TransitionOverlay_Load(TransitionOverlay* overlayEntry) {
s32 count;
void* loadedRamAddr;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_overlay/func_80165444.s")
if (overlayEntry->vromStart == 0) {
return 3;
}
if (Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr) == NULL) {
loadedRamAddr = ZeldaArena_Malloc(VRAM_PTR_SIZE(overlayEntry));
if (loadedRamAddr == NULL) {
return -1;
}
Load2_LoadOverlay(overlayEntry->vromStart, overlayEntry->vromEnd, overlayEntry->vramStart,
overlayEntry->vramEnd, loadedRamAddr);
overlayEntry->loadInfo.addr = Lib_VirtualToPhysical(loadedRamAddr);
overlayEntry->loadInfo.count = 1;
return 0;
} else {
count = overlayEntry->loadInfo.count;
if (count != 0) {
count++;
overlayEntry->loadInfo.count = count;
if (count == 0) {
return 2;
} else {
return 1;
}
}
return 2;
}
}
s32 TransitionOverlay_Free(TransitionOverlay* overlayEntry) {
s32 count;
void* loadedRamAddr;
if (overlayEntry->vromStart == 0) {
return 3;
}
loadedRamAddr = Lib_PhysicalToVirtual(overlayEntry->loadInfo.addr);
if (loadedRamAddr != NULL) {
count = overlayEntry->loadInfo.count;
if (count != 0) {
count--;
overlayEntry->loadInfo.count = count;
if (count == 0) {
ZeldaArena_Free(loadedRamAddr);
overlayEntry->loadInfo.addr = Lib_VirtualToPhysical(NULL);
return 0;
}
return 1;
}
return 2;
}
return -1;
}
void TransitionOverlay_ClearLoadInfo(TransitionOverlay* overlayEntry) {
overlayEntry->loadInfo.word = 0; // Equivalent to overlayEntry->loadInfo.count = 0, overlayEntry->loadInfo.addr = 0;
}
void TransitionOverlay_SetSegment(TransitionOverlay* overlayEntry, void* vramStart, void* vramEnd, uintptr_t vromStart,
uintptr_t vromEnd) {
overlayEntry->vramStart = vramStart;
overlayEntry->vramEnd = vramEnd;
overlayEntry->vromStart = vromStart;
overlayEntry->vromEnd = vromEnd;
}
+3 -3
View File
@@ -1,5 +1,5 @@
#include "global.h"
#include "z64view.h"
#include "interface/parameter_static/parameter_static.h"
#include "interface/do_action_static/do_action_static.h"
#include "misc/story_static/story_static.h"
@@ -2264,7 +2264,7 @@ void Magic_Update(PlayState* play) {
// Add magic until magicFillTarget is reached
gSaveContext.save.playerData.magic += 0x10;
if ((gSaveContext.gameMode == 0) && (gSaveContext.sceneSetupIndex < 4)) {
if ((gSaveContext.gameMode == 0) && (gSaveContext.sceneLayer < 4)) {
play_sound(NA_SE_SY_GAUGE_UP - SFX_FLAG);
}
@@ -2863,7 +2863,7 @@ void Interface_DrawTimers(PlayState* play) {
if (sTimerId == TIMER_ID_MOON_CRASH) {
gSaveContext.save.day = 4;
if ((play->sceneId == SCENE_OKUJOU) && (gSaveContext.sceneSetupIndex == 3)) {
if ((play->sceneId == SCENE_OKUJOU) && (gSaveContext.sceneLayer == 3)) {
play->nextEntrance = ENTRANCE(TERMINA_FIELD, 1);
gSaveContext.nextCutsceneIndex = 0xFFF0;
play->transitionTrigger = TRANS_TRIGGER_START;
+25 -23
View File
@@ -1,5 +1,8 @@
#include "global.h"
#include "z64rumble.h"
#include "z64quake.h"
#include "z64shrink_window.h"
#include "z64view.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/gamestates/ovl_opening/z_opening.h"
#include "overlays/gamestates/ovl_file_choose/z_file_choose.h"
@@ -309,7 +312,7 @@ void Play_SetupTransition(PlayState* this, s32 transitionType) {
transitionCtx->transitionType = transitionType;
transitionCtx->fbdemoType = fbdemoType;
if (fbdemoType != -1) {
func_80163C90(transitionCtx);
Transition_Init(transitionCtx);
}
}
@@ -379,7 +382,7 @@ const char D_801DFB28[] = "fk";
void Play_ClearTransitionInstanceType(PlayState* this) {
if (this->transitionCtx.fbdemoType != -1) {
func_80163D80(&this->transitionCtx, this);
Transition_Destroy(&this->transitionCtx);
}
this->transitionCtx.transitionType = -1;
}
@@ -577,7 +580,7 @@ void func_80166968(PlayState* this, Camera* camera) {
Distortion_ClearType(0x10);
Distortion_ClearType(8);
if (sQuakeIndex != 0) {
Quake_RemoveFromIdx(sQuakeIndex);
Quake_Remove(sQuakeIndex);
}
func_800F694C(this);
func_801A3EC0(0);
@@ -612,20 +615,20 @@ void Play_UpdateTransition(PlayState* this) {
((this->nextEntrance == ENTRANCE(ROAD_TO_IKANA, 1)) &&
!(gSaveContext.save.weekEventReg[0x34] & 0x20))) &&
(!func_800FE590(this) || (Entrance_GetSceneId(this->nextEntrance + sceneLayer) < 0) ||
(func_801A8A50(0) != NA_BGM_FINAL_HOURS))) {
(Audio_GetActiveSequence(0) != NA_BGM_FINAL_HOURS))) {
func_801A4058(20);
gSaveContext.seqIndex = 0xFF;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.seqId = 0xFF;
gSaveContext.ambienceId = 0xFF;
}
if (func_800FD768()) {
func_801A4058(20);
gSaveContext.seqIndex = 0xFF;
gSaveContext.nightSeqIndex = 0xFF;
gSaveContext.seqId = 0xFF;
gSaveContext.ambienceId = 0xFF;
}
if (func_800FE590(this) && (Entrance_GetSceneId(this->nextEntrance + sceneLayer) >= 0) &&
(func_801A8A50(0) == NA_BGM_FINAL_HOURS)) {
(Audio_GetActiveSequence(0) == NA_BGM_FINAL_HOURS)) {
func_801A41C8(20);
}
}
@@ -703,8 +706,8 @@ void Play_UpdateTransition(PlayState* this) {
}
this->transitionCtx.setColor(&this->transitionCtx.instanceData, color);
if (this->transitionCtx.setUnkColor != NULL) {
this->transitionCtx.setUnkColor(&this->transitionCtx.instanceData, color);
if (this->transitionCtx.setEnvColor != NULL) {
this->transitionCtx.setEnvColor(&this->transitionCtx.instanceData, color);
}
this->transitionCtx.setType(&this->transitionCtx.instanceData,
@@ -1190,9 +1193,9 @@ void Play_Draw(PlayState* this) {
var_fv0 = 12800.0f;
}
func_8013F0D0(&this->view, this->view.fovy, this->view.zNear, var_fv0);
View_SetPerspective(&this->view, this->view.fovy, this->view.zNear, var_fv0);
View_RenderView(&this->view, 0xF);
View_Apply(&this->view, 0xF);
// The billboard matrix temporarily stores the viewing matrix
Matrix_MtxToMtxF(&this->view.viewing, &this->billboardMtxF);
@@ -1238,7 +1241,7 @@ void Play_Draw(PlayState* this) {
SET_FULLSCREEN_VIEWPORT(&spA8);
func_801400CC(&spA8, &sp218);
View_ApplyTo(&spA8, &sp218);
this->transitionCtx.draw(&this->transitionCtx.instanceData, &sp218);
}
@@ -1421,7 +1424,7 @@ void Play_Draw(PlayState* this) {
Vec3s sp4C;
Camera_Update(&sp4C, GET_ACTIVE_CAM(this));
func_80140024(&this->view);
View_UpdateViewingMatrix(&this->view);
this->view.unk164 = 0;
if ((this->skyboxId != 0) && !this->envCtx.skyboxDisabled) {
SkyboxDraw_UpdateMatrix(&this->skyboxCtx, this->view.eye.x, this->view.eye.y, this->view.eye.z);
@@ -2204,18 +2207,17 @@ void Play_Init(GameState* thisx) {
if (((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 1)) || (gSaveContext.save.cutscene >= 0xFFF0)) {
gSaveContext.unk_3DC0 = 0;
Magic_Reset(this);
gSaveContext.sceneSetupIndex = (gSaveContext.save.cutscene & 0xF) + 1;
gSaveContext.sceneLayer = (gSaveContext.save.cutscene & 0xF) + 1;
gSaveContext.save.cutscene = 0;
} else {
gSaveContext.sceneSetupIndex = 0;
gSaveContext.sceneLayer = 0;
}
sp87 = gSaveContext.sceneSetupIndex;
sp87 = gSaveContext.sceneLayer;
Play_SpawnScene(
this,
Entrance_GetSceneIdAbsolute(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneSetupIndex)),
Entrance_GetSpawnNum(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneSetupIndex)));
this, Entrance_GetSceneIdAbsolute(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneLayer)),
Entrance_GetSpawnNum(((void)0, gSaveContext.save.entrance) + ((void)0, gSaveContext.sceneLayer)));
KaleidoScopeCall_Init(this);
func_80121FC4(this);
@@ -2317,8 +2319,8 @@ void Play_Init(GameState* thisx) {
func_800F15D8(&this->mainCamera);
func_801129E4(this);
func_800FB758(this);
gSaveContext.seqIndex = this->soundCtx.seqIndex;
gSaveContext.nightSeqIndex = this->soundCtx.nightSeqIndex;
gSaveContext.seqId = this->sequenceCtx.seqId;
gSaveContext.ambienceId = this->sequenceCtx.ambienceId;
AnimationContext_Update(this, &this->animationCtx);
func_800EDBE0(this);
gSaveContext.respawnFlag = 0;
+2 -2
View File
@@ -1107,7 +1107,7 @@ void Player_DrawGetItemImpl(PlayState* play, Player* player, Vec3f* refPos, s32
OPEN_DISPS(play->state.gfxCtx);
gSegments[6] = PHYSICAL_TO_VIRTUAL(player->giObjectSegment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(player->giObjectSegment);
gSPSegment(POLY_OPA_DISP++, 0x06, player->giObjectSegment);
gSPSegment(POLY_XLU_DISP++, 0x06, player->giObjectSegment);
@@ -1187,7 +1187,7 @@ void func_80127488(PlayState* play, Player* player, u8 alpha) {
}
void Player_DrawCouplesMask(PlayState* play, Player* player) {
gSegments[0xA] = PHYSICAL_TO_VIRTUAL(player->maskObjectSegment);
gSegments[0xA] = VIRTUAL_TO_PHYSICAL(player->maskObjectSegment);
AnimatedMat_DrawOpa(play, Lib_SegmentedToVirtual(&object_mask_meoto_Matanimheader_001CD8));
}
+185 -120
View File
@@ -1,7 +1,47 @@
#include "global.h"
#include "z64quake.h"
#include "z64view.h"
typedef struct {
/* 0x00 */ s16 randIndex;
/* 0x02 */ s16 countdownMax;
/* 0x04 */ Camera* camera;
/* 0x08 */ u32 type;
/* 0x0C */ s16 verticalMag;
/* 0x0E */ s16 horizontalMag;
/* 0x10 */ s16 zoom;
/* 0x12 */ s16 rollOffset;
/* 0x14 */ Vec3s shakePlaneOffset; // angle deviations from shaking in the perpendicular plane
/* 0x1A */ s16 speed;
/* 0x1C */ s16 isShakePerpendicular;
/* 0x1E */ s16 countdown;
/* 0x20 */ s16 camId;
} QuakeRequest; // size = 0x24
typedef struct {
/* 0x0 */ PlayState* play;
/* 0x4 */ s32 type; // bitfield, highest set bit determines type
/* 0x8 */ s16 countdown;
/* 0xA */ s16 state;
} DistortionRequest; // size = 0xC
typedef struct {
/* 0x00 */ Vec3f atOffset;
/* 0x0C */ Vec3f eyeOffset;
/* 0x18 */ s16 rollOffset;
/* 0x1A */ s16 zoom;
} ShakeInfo; // size = 0x1C
typedef s16 (*QuakeCallbackFunc)(QuakeRequest*, ShakeInfo*);
typedef enum {
/* 0 */ DISTORTION_INACTIVE,
/* 1 */ DISTORTION_ACTIVE,
/* 2 */ DISTORTION_SETUP
} DistortionState;
QuakeRequest sQuakeRequest[4];
DistortionContext sDistortionContext;
DistortionRequest sDistortionRequest;
static s16 sIsQuakeInitialized = true;
static s16 sQuakeRequestCount = 0;
@@ -51,7 +91,7 @@ void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 verticalPert
shake->zoom = req->zoom * verticalPertubation;
}
s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) {
s16 Quake_CallbackType1(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 perpendicularPertubation = Math_SinS(req->speed * req->countdown);
@@ -61,7 +101,7 @@ s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) {
return req->countdown;
}
s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) {
s16 Quake_CallbackType5(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 perpendicularPertubation = Math_SinS(req->speed * req->countdown);
@@ -71,7 +111,7 @@ s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) {
return req->countdown;
}
s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) {
s16 Quake_CallbackType6(QuakeRequest* req, ShakeInfo* shake) {
f32 perpendicularPertubation;
req->countdown--;
@@ -80,7 +120,7 @@ s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) {
return 1;
}
s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) {
s16 Quake_CallbackType3(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 perpendicularPertubation =
Math_SinS(req->speed * req->countdown) * ((f32)req->countdown / (f32)req->countdownMax);
@@ -91,7 +131,7 @@ s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) {
return req->countdown;
}
s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) {
s16 Quake_CallbackType2(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 perpendicularPertubation = Quake_Random();
@@ -101,7 +141,7 @@ s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) {
return req->countdown;
}
s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake) {
s16 Quake_CallbackType4(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 perpendicularPertubation = Quake_Random() * ((f32)req->countdown / (f32)req->countdownMax);
@@ -117,7 +157,7 @@ s16 Quake_GetFreeIndex(void) {
s32 min = 0x10000;
for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
if (sQuakeRequest[i].callbackIdx == 0) {
if (sQuakeRequest[i].type == 0) {
ret = i;
break;
}
@@ -131,43 +171,43 @@ s16 Quake_GetFreeIndex(void) {
return ret;
}
QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx) {
s16 idx = Quake_GetFreeIndex();
QuakeRequest* req = &sQuakeRequest[idx];
QuakeRequest* Quake_AddImpl(Camera* camera, u32 type) {
s16 index = Quake_GetFreeIndex();
QuakeRequest* req = &sQuakeRequest[index];
__osMemset(req, 0, sizeof(QuakeRequest));
req->camera = camera;
req->camId = camera->camId;
req->callbackIdx = callbackIdx;
req->type = type;
req->isShakePerpendicular = true;
req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx;
req->randIndex = ((s16)(Rand_ZeroOne() * 0x10000) & ~3) + index;
sQuakeRequestCount++;
return req;
}
void Quake_Remove(QuakeRequest* req) {
req->callbackIdx = 0;
void Quake_RemoveRequest(QuakeRequest* req) {
req->type = 0;
req->countdown = -1;
sQuakeRequestCount--;
}
QuakeRequest* Quake_GetRequest(s16 idx) {
QuakeRequest* req = &sQuakeRequest[idx & 3];
QuakeRequest* Quake_GetRequest(s16 quakeIndex) {
QuakeRequest* req = &sQuakeRequest[quakeIndex & 3];
if (req->callbackIdx == 0) {
if (req->type == 0) {
return NULL;
}
if (idx != req->randIdx) {
if (quakeIndex != req->randIndex) {
return NULL;
}
return req;
}
u32 Quake_SetValue(s16 idx, s16 valueType, s16 value) {
QuakeRequest* req = Quake_GetRequest(idx);
u32 Quake_SetValue(s16 quakeIndex, s16 valueType, s16 value) {
QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req == NULL) {
return false;
@@ -176,62 +216,75 @@ u32 Quake_SetValue(s16 idx, s16 valueType, s16 value) {
case QUAKE_SPEED:
req->speed = value;
break;
case QUAKE_VERTICAL_MAG:
req->verticalMag = value;
break;
case QUAKE_HORIZONTAL_MAG:
req->horizontalMag = value;
break;
case QUAKE_ZOOM:
req->zoom = value;
break;
case QUAKE_ROLL_OFFSET:
req->rollOffset = value;
break;
case QUAKE_SHAKE_PLANE_OFFSET_X:
req->shakePlaneOffset.x = value;
break;
case QUAKE_SHAKE_PLANE_OFFSET_Y:
req->shakePlaneOffset.y = value;
break;
case QUAKE_SHAKE_PLANE_OFFSET_Z:
req->shakePlaneOffset.z = value;
break;
case QUAKE_COUNTDOWN:
req->countdown = value;
req->countdownMax = req->countdown;
break;
case QUAKE_IS_SHAKE_PERPENDICULAR:
req->isShakePerpendicular = value;
break;
default:
break;
}
return true;
}
}
u32 Quake_SetSpeed(s16 idx, s16 value) {
QuakeRequest* req = Quake_GetRequest(idx);
u32 Quake_SetSpeed(s16 quakeIndex, s16 speed) {
QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req != NULL) {
req->speed = value;
req->speed = speed;
return true;
}
return false;
}
u32 Quake_SetCountdown(s16 idx, s16 value) {
QuakeRequest* req = Quake_GetRequest(idx);
u32 Quake_SetCountdown(s16 quakeIndex, s16 countdown) {
QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req != NULL) {
req->countdown = value;
req->countdown = countdown;
req->countdownMax = req->countdown;
return true;
}
return false;
}
s16 Quake_GetCountdown(s16 idx) {
QuakeRequest* req = Quake_GetRequest(idx);
s16 Quake_GetCountdown(s16 quakeIndex) {
QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req != NULL) {
return req->countdown;
@@ -239,8 +292,8 @@ s16 Quake_GetCountdown(s16 idx) {
return 0;
}
u32 Quake_SetQuakeValues(s16 idx, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset) {
QuakeRequest* req = Quake_GetRequest(idx);
u32 Quake_SetQuakeValues(s16 quakeIndex, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset) {
QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req != NULL) {
req->verticalMag = verticalMag;
@@ -252,8 +305,8 @@ u32 Quake_SetQuakeValues(s16 idx, s16 verticalMag, s16 horizontalMag, s16 zoom,
return false;
}
u32 Quake_SetQuakeValues2(s16 idx, s16 isShakePerpendicular, Vec3s shakePlaneOffset) {
QuakeRequest* req = Quake_GetRequest(idx);
u32 Quake_SetQuakeValues2(s16 quakeIndex, s16 isShakePerpendicular, Vec3s shakePlaneOffset) {
QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req != NULL) {
req->isShakePerpendicular = isShakePerpendicular;
@@ -267,29 +320,35 @@ void Quake_Init(void) {
s16 i;
for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
sQuakeRequest[i].callbackIdx = 0;
sQuakeRequest[i].type = 0;
sQuakeRequest[i].countdown = 0;
}
sIsQuakeInitialized = true;
sQuakeRequestCount = 0;
}
s16 Quake_Add(Camera* camera, u32 callbackIdx) {
return Quake_AddImpl(camera, callbackIdx)->randIdx;
s16 Quake_Add(Camera* camera, u32 type) {
return Quake_AddImpl(camera, type)->randIndex;
}
u32 Quake_RemoveFromIdx(s16 idx) {
QuakeRequest* req = Quake_GetRequest(idx);
u32 Quake_Remove(s16 index) {
QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
Quake_Remove(req);
Quake_RemoveRequest(req);
return true;
}
return false;
}
static QuakeCallbackFunc sQuakeCallbacks[] = {
NULL, Quake_Callback1, Quake_Callback2, Quake_Callback3, Quake_Callback4, Quake_Callback5, Quake_Callback6,
NULL,
Quake_CallbackType1,
Quake_CallbackType2,
Quake_CallbackType3,
Quake_CallbackType4,
Quake_CallbackType5,
Quake_CallbackType6,
};
s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
@@ -299,7 +358,7 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
f32 absSpeedDiv;
f32 maxCurr;
f32 maxNext;
s32 idx;
s32 index;
s32 ret;
u32 eq;
Vec3f originVec;
@@ -323,16 +382,16 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
}
ret = 0;
for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) {
req = &sQuakeRequest[idx];
if (req->callbackIdx != 0) {
for (index = 0; index < ARRAY_COUNT(sQuakeRequest); index++) {
req = &sQuakeRequest[index];
if (req->type != 0) {
if (play->cameraPtrs[req->camId] == NULL) {
Quake_Remove(req);
Quake_RemoveRequest(req);
} else {
eq = (camera->camId != req->camera->camId);
absSpeedDiv = ABS(req->speed) / (f32)0x8000;
if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) {
Quake_Remove(req);
if (sQuakeCallbacks[req->type](req, &shake) == 0) {
Quake_RemoveRequest(req);
} else if (eq == 0) {
if (fabsf(camData->atOffset.x) < fabsf(shake.atOffset.x)) {
camData->atOffset.x = shake.atOffset.x;
@@ -383,35 +442,35 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
}
void Distortion_Init(PlayState* play) {
sDistortionContext.play = play;
sDistortionRequest.play = play;
View_ClearDistortion(&play->view);
sDistortionContext.type = 0;
sDistortionContext.countdown = 0;
sDistortionContext.state = DISTORTION_INACTIVE;
sDistortionRequest.type = 0;
sDistortionRequest.countdown = 0;
sDistortionRequest.state = DISTORTION_INACTIVE;
}
void Distortion_SetCountdown(s16 countdown) {
sDistortionContext.countdown = countdown;
sDistortionContext.state = DISTORTION_SETUP;
sDistortionRequest.countdown = countdown;
sDistortionRequest.state = DISTORTION_SETUP;
}
s16 Distortion_GetCountdown(void) {
return sDistortionContext.countdown;
return sDistortionRequest.countdown;
}
s16 Distortion_GetType(void) {
return sDistortionContext.type;
return sDistortionRequest.type;
}
void Distortion_SetType(s32 type) {
if (sDistortionContext.type < type) {
sDistortionContext.type = type;
if (sDistortionRequest.type < type) {
sDistortionRequest.type = type;
}
}
void Distortion_ClearType(s32 type) {
if (sDistortionContext.type == type) {
sDistortionContext.type = 0;
if (sDistortionRequest.type == type) {
sDistortionRequest.type = 0;
}
}
@@ -419,9 +478,9 @@ void Distortion_ClearType(s32 type) {
* Checks that the bg surface is an underwater conveyor type and if so, returns the conveyor speed
*/
s32 Distortion_GetUnderwaterCurrentSpeed(Player* player) {
if (SurfaceType_GetConveyorType(&sDistortionContext.play->colCtx, player->actor.floorPoly,
player->actor.floorBgId) == CONVEYOR_WATER) {
return SurfaceType_GetConveyorSpeed(&sDistortionContext.play->colCtx, player->actor.floorPoly,
if (!SurfaceType_IsFloorConveyor(&sDistortionRequest.play->colCtx, player->actor.floorPoly,
player->actor.floorBgId)) {
return SurfaceType_GetConveyorSpeed(&sDistortionRequest.play->colCtx, player->actor.floorPoly,
player->actor.floorBgId);
}
return 0;
@@ -446,14 +505,14 @@ void Distortion_Update(void) {
f32 zScale;
f32 speed;
Player* player;
PlayState* play = sDistortionContext.play;
PlayState* play = sDistortionRequest.play;
PosRot playerPosRot;
Camera* camera = GET_ACTIVE_CAM(play);
f32 speedRatio = CLAMP_MAX(camera->speedRatio, 1.0f);
if (sDistortionContext.type != 0) {
if (sDistortionContext.type & 0x800) {
sDistortionContext.countdown = 2;
if (sDistortionRequest.type != 0) {
if (sDistortionRequest.type & DISTORTION_TYPE_B) {
sDistortionRequest.countdown = 2;
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
@@ -469,11 +528,11 @@ void Distortion_Update(void) {
zScale = 0.0f;
speed = 0.6f;
xyScaleFactor = zScaleFactor = sDistortionContext.countdown / 60.0f;
xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / 60.0f;
speedScaleFactor = 1.0f;
} else if (sDistortionContext.type & 0x400) {
if (sDistortionContext.state == DISTORTION_SETUP) {
countdownMax = sDistortionContext.countdown;
} else if (sDistortionRequest.type & DISTORTION_TYPE_A) {
if (sDistortionRequest.state == DISTORTION_SETUP) {
countdownMax = sDistortionRequest.countdown;
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
}
@@ -490,11 +549,11 @@ void Distortion_Update(void) {
zScale = 0.0f;
speed = 0.4f;
xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionContext.countdown) / (f32)countdownMax;
xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax;
speedScaleFactor = 0.5f;
} else if (sDistortionContext.type & 0x200) {
if (sDistortionContext.state == DISTORTION_SETUP) {
countdownMax = sDistortionContext.countdown;
} else if (sDistortionRequest.type & DISTORTION_TYPE_9) {
if (sDistortionRequest.state == DISTORTION_SETUP) {
countdownMax = sDistortionRequest.countdown;
depthPhase = 0x1FC;
screenPlanePhase = 0x156;
}
@@ -511,11 +570,11 @@ void Distortion_Update(void) {
zScale = 0.0f;
speed = 0.1f;
xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionContext.countdown) / (f32)countdownMax;
xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax;
speedScaleFactor = 1.0f;
} else if (sDistortionContext.type & 0x100) {
if (sDistortionContext.state == DISTORTION_SETUP) {
countdownMax = sDistortionContext.countdown;
} else if (sDistortionRequest.type & DISTORTION_TYPE_8) {
if (sDistortionRequest.state == DISTORTION_SETUP) {
countdownMax = sDistortionRequest.countdown;
depthPhase = 0x2710;
screenPlanePhase = 0x3E8;
}
@@ -532,15 +591,15 @@ void Distortion_Update(void) {
zScale = 0.01f;
speed = 1.5f;
if (sDistortionContext.countdown < 5) {
xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionContext.countdown) / (f32)countdownMax;
if (sDistortionRequest.countdown < 5) {
xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax;
} else {
xyScaleFactor = zScaleFactor = 0.0f;
}
speedScaleFactor = 1.0f;
} else if (sDistortionContext.type & 0x80) {
if (sDistortionContext.state == DISTORTION_SETUP) {
countdownMax = sDistortionContext.countdown;
} else if (sDistortionRequest.type & DISTORTION_TYPE_7) {
if (sDistortionRequest.state == DISTORTION_SETUP) {
countdownMax = sDistortionRequest.countdown;
depthPhase = 0x4B0;
screenPlanePhase = 0x7D0;
}
@@ -557,11 +616,11 @@ void Distortion_Update(void) {
zScale = 0.01f;
speed = 1.5f;
xyScaleFactor = zScaleFactor = sDistortionContext.countdown / (f32)countdownMax;
xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / (f32)countdownMax;
speedScaleFactor = 1.0f;
} else if (sDistortionContext.type & 0x40) {
if (sDistortionContext.state == DISTORTION_SETUP) {
countdownMax = sDistortionContext.countdown;
} else if (sDistortionRequest.type & DISTORTION_TYPE_6) {
if (sDistortionRequest.state == DISTORTION_SETUP) {
countdownMax = sDistortionRequest.countdown;
depthPhase = 0x9C4;
screenPlanePhase = 0xBB8;
}
@@ -578,15 +637,15 @@ void Distortion_Update(void) {
zScale = 0.01f;
speed = 1.3f;
if (sDistortionContext.countdown < 4) {
xyScaleFactor = zScaleFactor = sDistortionContext.countdown / (f32)countdownMax;
if (sDistortionRequest.countdown < 4) {
xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / (f32)countdownMax;
} else {
xyScaleFactor = zScaleFactor = 0.0f;
}
speedScaleFactor = 1.0f;
} else if (sDistortionContext.type & 0x20) {
sDistortionContext.countdown = 2;
if (sDistortionContext.state == DISTORTION_SETUP) {
} else if (sDistortionRequest.type & DISTORTION_TYPE_5) {
sDistortionRequest.countdown = 2;
if (sDistortionRequest.state == DISTORTION_SETUP) {
depthPhase = 0x9C4;
screenPlanePhase = 0xBB8;
}
@@ -609,9 +668,9 @@ void Distortion_Update(void) {
zScaleFactor = 1.0f;
xyScaleFactor = 1.0f;
speedScaleFactor = 1.0f;
} else if (sDistortionContext.type & 0x10) {
if (sDistortionContext.state == DISTORTION_SETUP) {
countdownMax = sDistortionContext.countdown;
} else if (sDistortionRequest.type & DISTORTION_TYPE_4) {
if (sDistortionRequest.state == DISTORTION_SETUP) {
countdownMax = sDistortionRequest.countdown;
depthPhase = 0x760;
screenPlanePhase = 0x1BC;
}
@@ -628,14 +687,14 @@ void Distortion_Update(void) {
zScale = 0.2f;
speed = 0.25f;
countdownRatio = sDistortionContext.countdown / (f32)countdownMax;
countdownRatio = sDistortionRequest.countdown / (f32)countdownMax;
zScaleFactor = xyScaleFactor = countdownRatio;
speedScaleFactor = 1.0f;
} else if (sDistortionContext.type & 8) {
} else if (sDistortionRequest.type & DISTORTION_TYPE_3) {
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
sDistortionContext.countdown = 2;
sDistortionRequest.countdown = 2;
player = GET_PLAYER(play);
if (player != NULL) {
@@ -656,18 +715,21 @@ void Distortion_Update(void) {
zScale = 0.03f;
speed = 0.33f;
break;
case 2:
xScale = -0.06f;
yScale = 0.1f;
zScale = 0.03f;
speed = 0.33f;
break;
case 1:
xScale = -0.06f;
yScale = 0.1f;
zScale = 0.03f;
speed = 0.33f;
break;
default:
xScale = -0.06f;
yScale = 0.1f;
@@ -683,11 +745,11 @@ void Distortion_Update(void) {
}
zScaleFactor = -xyScaleFactor;
speedScaleFactor = 1.0f;
} else if (sDistortionContext.type & 4) {
} else if (sDistortionRequest.type & DISTORTION_TYPE_2) {
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
sDistortionContext.countdown = 2;
sDistortionRequest.countdown = 2;
player = GET_PLAYER(play);
depthPhaseStep = 359.2f;
@@ -703,18 +765,21 @@ void Distortion_Update(void) {
zScale = 0.08f;
speed = 0.18f;
break;
case 2:
xScale = 0.12f;
yScale = 0.12f;
zScale = 0.08f;
speed = 0.12f;
break;
case 1:
xScale = 0.12f;
yScale = 0.12f;
zScale = 0.08f;
speed = 0.08f;
break;
default:
xScale = 0.12f;
yScale = 0.12f;
@@ -731,12 +796,12 @@ void Distortion_Update(void) {
xyScaleFactor = speedScaleFactor = (waterYScaleFactor * 0.15f) + 0.35f + (speedRatio * 0.4f);
zScaleFactor = 0.9f - xyScaleFactor;
} else if (sDistortionContext.type & 1) {
} else if (sDistortionRequest.type & DISTORTION_TYPE_0) {
// Gives a small mirage-like appearance
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
sDistortionContext.countdown = 2;
sDistortionRequest.countdown = 2;
depthPhaseStep = 0.0f;
screenPlanePhaseStep = 150.0f;
@@ -759,29 +824,29 @@ void Distortion_Update(void) {
depthPhase += CAM_DEG_TO_BINANG(depthPhaseStep);
screenPlanePhase += CAM_DEG_TO_BINANG(screenPlanePhaseStep);
View_SetDistortionDirRot(&sDistortionContext.play->view,
Math_CosS(depthPhase) * (DEGF_TO_RADF(rotX) * xyScaleFactor),
Math_SinS(depthPhase) * (DEGF_TO_RADF(rotY) * xyScaleFactor),
Math_SinS(screenPlanePhase) * (DEGF_TO_RADF(rotZ) * zScaleFactor));
View_SetDistortionScale(&sDistortionContext.play->view,
View_SetDistortionOrientation(&sDistortionRequest.play->view,
Math_CosS(depthPhase) * (DEGF_TO_RADF(rotX) * xyScaleFactor),
Math_SinS(depthPhase) * (DEGF_TO_RADF(rotY) * xyScaleFactor),
Math_SinS(screenPlanePhase) * (DEGF_TO_RADF(rotZ) * zScaleFactor));
View_SetDistortionScale(&sDistortionRequest.play->view,
(Math_SinS(screenPlanePhase) * (xScale * xyScaleFactor)) + 1.0f,
(Math_CosS(screenPlanePhase) * (yScale * xyScaleFactor)) + 1.0f,
(Math_CosS(depthPhase) * (zScale * zScaleFactor)) + 1.0f);
View_SetDistortionSpeed(&sDistortionContext.play->view, speed * speedScaleFactor);
View_SetDistortionSpeed(&sDistortionRequest.play->view, speed * speedScaleFactor);
sDistortionContext.state = DISTORTION_ACTIVE;
sDistortionRequest.state = DISTORTION_ACTIVE;
} else if (sDistortionContext.state != DISTORTION_INACTIVE) {
} else if (sDistortionRequest.state != DISTORTION_INACTIVE) {
View_ClearDistortion(&play->view);
sDistortionContext.state = DISTORTION_INACTIVE;
sDistortionContext.countdown = 0;
sDistortionRequest.state = DISTORTION_INACTIVE;
sDistortionRequest.countdown = 0;
}
if (sDistortionContext.countdown != 0) {
sDistortionContext.countdown--;
if (sDistortionContext.countdown == 0) {
sDistortionContext.type = 0;
if (sDistortionRequest.countdown != 0) {
sDistortionRequest.countdown--;
if (sDistortionRequest.countdown == 0) {
sDistortionRequest.type = 0;
}
}
}
@@ -790,16 +855,16 @@ s32 Quake_NumActiveQuakes(void) {
QuakeRequest* req = sQuakeRequest;
s32 numActiveQuakes = 0;
if (req[0].callbackIdx != 0) {
if (req[0].type != 0) {
numActiveQuakes++;
}
if (req[1].callbackIdx != 0) {
if (req[1].type != 0) {
numActiveQuakes++;
}
if (req[2].callbackIdx != 0) {
if (req[2].type != 0) {
numActiveQuakes++;
}
if (req[3].callbackIdx != 0) {
if (req[3].type != 0) {
numActiveQuakes++;
}
+2 -2
View File
@@ -105,7 +105,7 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) {
roomCtx->unk31 = 0;
roomCtx->curRoom.segment = roomCtx->activeRoomVram;
// TODO: Segment number enum
gSegments[0x03] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram);
gSegments[0x03] = VIRTUAL_TO_PHYSICAL(roomCtx->activeRoomVram);
Scene_ProcessHeader(play, (SceneCmd*)roomCtx->curRoom.segment);
func_80123140(play, GET_PLAYER(play));
@@ -130,7 +130,7 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) {
void Room_Draw(PlayState* play, Room* room, u32 flags) {
if (room->segment != NULL) {
// TODO: Segment number enum
gSegments[0x03] = PHYSICAL_TO_VIRTUAL(room->segment);
gSegments[0x03] = VIRTUAL_TO_PHYSICAL(room->segment);
roomDrawFuncs[room->mesh->type0.type](play, room, flags);
}
return;
+12 -11
View File
@@ -52,7 +52,7 @@ void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) {
objectCtx->spaceEnd = (void*)((u32)objectCtx->spaceStart + spaceSize);
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, GAMEPLAY_KEEP);
gSegments[0x04] = PHYSICAL_TO_VIRTUAL(objectCtx->status[objectCtx->mainKeepIndex].segment);
gSegments[0x04] = VIRTUAL_TO_PHYSICAL(objectCtx->status[objectCtx->mainKeepIndex].segment);
}
void Object_UpdateBank(ObjectContext* objectCtx) {
@@ -108,7 +108,7 @@ s32 Object_IsLoaded(ObjectContext* objectCtx, s32 index) {
void Object_LoadAll(ObjectContext* objectCtx) {
s32 i;
s32 id;
u32 vromSize;
uintptr_t vromSize;
for (i = 0; i < objectCtx->num; i++) {
id = objectCtx->status[i].id;
@@ -124,7 +124,7 @@ void Object_LoadAll(ObjectContext* objectCtx) {
void* func_8012F73C(ObjectContext* objectCtx, s32 iParm2, s16 id) {
u32 addr;
u32 vromSize;
uintptr_t vromSize;
RomFile* fileTableEntry;
objectCtx->status[iParm2].id = -id;
@@ -224,7 +224,7 @@ void Scene_HeaderCmdSpecialFiles(PlayState* play, SceneCmd* cmd) {
if (cmd->specialFiles.subKeepIndex != 0) {
play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.subKeepIndex);
// TODO: Segment number enum?
gSegments[0x05] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment);
gSegments[0x05] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment);
}
if (cmd->specialFiles.cUpElfMsgNum != 0) {
@@ -350,7 +350,7 @@ void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex) {
{ SEGMENT_ROM_START(scene_texture_07), SEGMENT_ROM_END(scene_texture_07) },
{ SEGMENT_ROM_START(scene_texture_08), SEGMENT_ROM_END(scene_texture_08) },
};
u32 vromStart = sceneTextureFiles[fileIndex].vromStart;
uintptr_t vromStart = sceneTextureFiles[fileIndex].vromStart;
size_t size = sceneTextureFiles[fileIndex].vromEnd - vromStart;
if (size != 0) {
@@ -436,11 +436,12 @@ void Scene_HeaderCmd09(PlayState* play, SceneCmd* cmd) {
// SceneTableEntry Header Command 0x15: Sound Settings=
void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) {
play->soundCtx.seqIndex = cmd->soundSettings.musicSeq;
play->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX;
play->sequenceCtx.seqId = cmd->soundSettings.seqId;
play->sequenceCtx.ambienceId = cmd->soundSettings.ambienceId;
if (gSaveContext.seqIndex == (u8)NA_BGM_DISABLED || func_801A8A50(0) == NA_BGM_FINAL_HOURS) {
audio_setBGM(cmd->soundSettings.bgmId);
if (gSaveContext.seqId == (u8)NA_BGM_DISABLED ||
Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS) {
Audio_SetSpec(cmd->soundSettings.specId);
}
}
@@ -454,9 +455,9 @@ void Scene_HeaderCmdAltHeaderList(PlayState* play, SceneCmd* cmd) {
SceneCmd** altHeaderList;
SceneCmd* altHeader;
if (gSaveContext.sceneSetupIndex != 0) {
if (gSaveContext.sceneLayer != 0) {
altHeaderList = Lib_SegmentedToVirtual(cmd->altHeaders.segment);
altHeader = altHeaderList[gSaveContext.sceneSetupIndex - 1];
altHeader = altHeaderList[gSaveContext.sceneLayer - 1];
if (altHeader != NULL) {
Scene_ProcessHeader(play, Lib_SegmentedToVirtual(altHeader));
+2 -2
View File
@@ -459,8 +459,8 @@ void AnimatedMat_DrawStep(PlayState* play, AnimatedMaterial* matAnim, u32 step)
/**
* Draws an animated material with a step to only the OPA buffer.
*/
void AnimatedMat_DrawStepOpa(PlayState* play, AnimatedMaterial* textures, u32 step) {
AnimatedMat_DrawMain(play, textures, 1, step, 1);
void AnimatedMat_DrawStepOpa(PlayState* play, AnimatedMaterial* matAnim, u32 step) {
AnimatedMat_DrawMain(play, matAnim, 1, step, 1);
}
/**
+50 -43
View File
@@ -4,70 +4,78 @@
*/
#include "prevent_bss_reordering.h"
#include "global.h"
#include "z64shrink_window.h"
ShrinkWindowContext gShrinkWindowContext;
ShrinkWindowContext* gShrinkWindowContextPtr;
typedef struct {
/* 0x0 */ s8 letterboxTarget;
/* 0x1 */ s8 letterboxSize;
/* 0x2 */ s8 pillarboxTarget;
/* 0x3 */ s8 pillarboxSize;
} ShrinkWindow; // size = 0x4
void ShrinkWindow_SetLetterboxTarget(s32 target) {
gShrinkWindowContextPtr->letterboxTarget = target;
ShrinkWindow sShrinkWindow;
ShrinkWindow* sShrinkWindowPtr;
void ShrinkWindow_Letterbox_SetSizeTarget(s32 target) {
sShrinkWindowPtr->letterboxTarget = target;
}
s32 ShrinkWindow_GetLetterboxTarget(void) {
return gShrinkWindowContextPtr->letterboxTarget;
s32 ShrinkWindow_Letterbox_GetSizeTarget(void) {
return sShrinkWindowPtr->letterboxTarget;
}
void ShrinkWindow_SetLetterboxMagnitude(s32 magnitude) {
gShrinkWindowContextPtr->letterboxMagnitude = magnitude;
void ShrinkWindow_Letterbox_SetSize(s32 size) {
sShrinkWindowPtr->letterboxSize = size;
}
s32 ShrinkWindow_GetLetterboxMagnitude(void) {
return gShrinkWindowContextPtr->letterboxMagnitude;
s32 ShrinkWindow_Letterbox_GetSize(void) {
return sShrinkWindowPtr->letterboxSize;
}
void ShrinkWindow_SetPillarboxTarget(s32 target) {
gShrinkWindowContextPtr->pillarboxTarget = target;
void ShrinkWindow_Pillarbox_SetSizeTarget(s32 target) {
sShrinkWindowPtr->pillarboxTarget = target;
}
s32 ShrinkWindow_GetPillarboxTarget(void) {
return gShrinkWindowContextPtr->pillarboxTarget;
s32 ShrinkWindow_Pillarbox_GetSizeTarget(void) {
return sShrinkWindowPtr->pillarboxTarget;
}
void ShrinkWindow_SetPillarboxMagnitude(s32 magnitude) {
gShrinkWindowContextPtr->pillarboxMagnitude = magnitude;
void ShrinkWindow_Pillarbox_SetSize(s32 size) {
sShrinkWindowPtr->pillarboxSize = size;
}
s32 ShrinkWindow_GetPillarboxMagnitude(void) {
return gShrinkWindowContextPtr->pillarboxMagnitude;
s32 ShrinkWindow_Pillarbox_GetSize(void) {
return sShrinkWindowPtr->pillarboxSize;
}
void ShrinkWindow_Init(void) {
gShrinkWindowContextPtr = &gShrinkWindowContext;
bzero(gShrinkWindowContextPtr, sizeof(gShrinkWindowContext));
sShrinkWindowPtr = &sShrinkWindow;
bzero(sShrinkWindowPtr, sizeof(sShrinkWindow));
}
void ShrinkWindow_Destroy(void) {
gShrinkWindowContextPtr = NULL;
sShrinkWindowPtr = NULL;
}
void ShrinkWindow_Update(s32 framerateDivisor) {
s32 step = ((framerateDivisor == 3) ? 10 : 30 / framerateDivisor);
s32 nextMagnitude;
s32 step = (framerateDivisor == 3) ? 10 : (30 / framerateDivisor);
s32 nextSize;
nextMagnitude = gShrinkWindowContextPtr->letterboxMagnitude;
Math_StepToIGet(&nextMagnitude, gShrinkWindowContextPtr->letterboxTarget, step);
gShrinkWindowContextPtr->letterboxMagnitude = nextMagnitude;
nextSize = sShrinkWindowPtr->letterboxSize;
Math_StepToIGet(&nextSize, sShrinkWindowPtr->letterboxTarget, step);
sShrinkWindowPtr->letterboxSize = nextSize;
nextMagnitude = gShrinkWindowContextPtr->pillarboxMagnitude;
Math_StepToIGet(&nextMagnitude, gShrinkWindowContextPtr->pillarboxTarget, step);
gShrinkWindowContextPtr->pillarboxMagnitude = nextMagnitude;
nextSize = sShrinkWindowPtr->pillarboxSize;
Math_StepToIGet(&nextSize, sShrinkWindowPtr->pillarboxTarget, step);
sShrinkWindowPtr->pillarboxSize = nextSize;
}
void ShrinkWindow_Draw(GraphicsContext* gfxCtx) {
Gfx* gfx;
s8 letterboxMagnitude = gShrinkWindowContextPtr->letterboxMagnitude;
s8 pillarboxMagnitude = gShrinkWindowContextPtr->pillarboxMagnitude;
s8 letterboxSize = sShrinkWindowPtr->letterboxSize;
s8 pillarboxSize = sShrinkWindowPtr->pillarboxSize;
if (letterboxMagnitude > 0) {
if (letterboxSize > 0) {
OPEN_DISPS(gfxCtx);
gfx = OVERLAY_DISP;
@@ -76,23 +84,23 @@ void ShrinkWindow_Draw(GraphicsContext* gfxCtx) {
gDPSetCycleType(gfx++, G_CYC_FILL);
gDPSetRenderMode(gfx++, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor(gfx++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
gDPFillRectangle(gfx++, 0, 0, gScreenWidth - 1, letterboxMagnitude - 1);
gDPFillRectangle(gfx++, 0, gScreenHeight - letterboxMagnitude, gScreenWidth - 1, gScreenHeight - 1);
gDPFillRectangle(gfx++, 0, 0, gScreenWidth - 1, letterboxSize - 1);
gDPFillRectangle(gfx++, 0, gScreenHeight - letterboxSize, gScreenWidth - 1, gScreenHeight - 1);
gDPPipeSync(gfx++);
gDPSetCycleType(gfx++, G_CYC_1CYCLE);
gDPSetRenderMode(gfx++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, 0);
gDPFillRectangle(gfx++, 0, letterboxMagnitude, gScreenWidth, letterboxMagnitude + 1);
gDPFillRectangle(gfx++, 0, gScreenHeight - letterboxMagnitude - 1, gScreenWidth,
gScreenHeight - letterboxMagnitude);
gDPFillRectangle(gfx++, 0, letterboxSize, gScreenWidth, letterboxSize + 1);
gDPFillRectangle(gfx++, 0, gScreenHeight - letterboxSize - 1, gScreenWidth, gScreenHeight - letterboxSize);
gDPPipeSync(gfx++);
OVERLAY_DISP = gfx++;
CLOSE_DISPS(gfxCtx);
}
if (pillarboxMagnitude > 0) {
if (pillarboxSize > 0) {
OPEN_DISPS(gfxCtx);
gfx = OVERLAY_DISP;
@@ -102,17 +110,16 @@ void ShrinkWindow_Draw(GraphicsContext* gfxCtx) {
gDPSetRenderMode(gfx++, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor(gfx++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
gDPFillRectangle(gfx++, 0, 0, pillarboxMagnitude - 1, gScreenHeight - 1);
gDPFillRectangle(gfx++, gScreenWidth - pillarboxMagnitude, 0, gScreenWidth - 1, gScreenHeight - 1);
gDPFillRectangle(gfx++, 0, 0, pillarboxSize - 1, gScreenHeight - 1);
gDPFillRectangle(gfx++, gScreenWidth - pillarboxSize, 0, gScreenWidth - 1, gScreenHeight - 1);
gDPPipeSync(gfx++);
gDPSetCycleType(gfx++, G_CYC_1CYCLE);
gDPSetRenderMode(gfx++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, 0);
gDPFillRectangle(gfx++, pillarboxMagnitude, 0, pillarboxMagnitude + 2, gScreenHeight);
gDPFillRectangle(gfx++, gScreenWidth - pillarboxMagnitude - 2, 0, gScreenWidth - pillarboxMagnitude,
gScreenHeight);
gDPFillRectangle(gfx++, pillarboxSize, 0, pillarboxSize + 2, gScreenHeight);
gDPFillRectangle(gfx++, gScreenWidth - pillarboxSize - 2, 0, gScreenWidth - pillarboxSize, gScreenHeight);
gDPPipeSync(gfx++);
OVERLAY_DISP = gfx++;
+2 -2
View File
@@ -8,9 +8,9 @@ s32 SkelAnime_LoopFull(SkelAnime* skelAnime);
s32 SkelAnime_LoopPartial(SkelAnime* skelAnime);
s32 SkelAnime_Once(SkelAnime* skelAnime);
void Animation_PlayLoop(SkelAnime* skelAnime, AnimationHeader* animation);
void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* pos, s16 angle);
void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle);
void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHeader* animation, f32 playSpeed,
f32 frame, f32 frameCount, u8 animationMode, f32 morphFrames);
f32 startFrame, f32 endFrame, u8 mode, f32 morphFrames);
void SkelAnime_CopyFrameTable(SkelAnime* skelAnime, Vec3s* dst, Vec3s* src);
static AnimationEntryCallback sAnimationLoadDone[] = {
+2 -2
View File
@@ -292,8 +292,8 @@ void Sram_SaveEndOfCycle(PlayState* play) {
gSaveContext.cycleSceneFlags[i].collectible = 0;
}
for (i = 0; i < ARRAY_COUNT(gSaveContext.maskMaskBit); i++) {
gSaveContext.maskMaskBit[i] = 0;
for (i = 0; i < ARRAY_COUNT(gSaveContext.masksGivenOnMoon); i++) {
gSaveContext.masksGivenOnMoon[i] = 0;
}
if (gSaveContext.save.weekEventReg[84] & 0x20) {
+142 -105
View File
@@ -1,4 +1,9 @@
#include "global.h"
#include "z64shrink_window.h"
#include "z64view.h"
s32 View_ApplyPerspective(View* view);
s32 View_ApplyOrtho(View* view);
void View_ViewportToVp(Vp* dest, Viewport* src) {
s32 width = src->rightX - src->leftX;
@@ -13,41 +18,45 @@ void View_ViewportToVp(Vp* dest, Viewport* src) {
dest->vp.vtrans[2] = 0x01FF;
dest->vp.vtrans[3] = 0;
if (src->leftX == 0 && src->rightX == 576 && src->topY == 0 && src->bottomY) {}
if ((src->leftX == 0) && (src->rightX == SCREEN_WIDTH_HIGH_RES) && (src->topY == 0) &&
(src->bottomY == SCREEN_HEIGHT_HIGH_RES)) {}
}
void View_Init(View* view, GraphicsContext* gfxCtx) {
view->gfxCtx = gfxCtx;
view->viewport.topY = 0;
view->viewport.bottomY = 240;
view->viewport.bottomY = SCREEN_HEIGHT;
view->viewport.leftX = 0;
view->viewport.rightX = 320;
view->viewport.rightX = SCREEN_WIDTH;
view->magic = 0x56494557; // "VIEW"
view->unk164 = 0;
view->flags = 1 | 2 | 4;
if (1) {
;
}
if (1) {}
view->scale = 1.0f;
view->up.y = 1.0f;
view->fovy = 60.0f;
view->eye.x = 0.0f;
view->eye.y = 0.0f;
view->at.x = 0.0f;
view->up.x = 0.0f;
view->up.z = 0.0f;
view->zNear = 10.0f;
view->zFar = 12800.0f;
view->eye.x = 0.0f;
view->eye.y = 0.0f;
view->eye.z = -1.0f;
view->at.x = 0.0f;
view->up.x = 0.0f;
view->up.y = 1.0f;
view->up.z = 0.0f;
view->unk164 = 0;
view->flags = VIEW_VIEWING | VIEW_VIEWPORT | VIEW_PROJECTION_PERSPECTIVE;
View_InitDistortion(view);
}
void View_SetViewOrientation(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) {
if (eye->x == at->x && eye->z == at->z) {
void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) {
if ((eye->x == at->x) && (eye->z == at->z)) {
eye->z += 0.1f;
up->z = 0.0f;
up->x = 0.0f;
@@ -57,17 +66,21 @@ void View_SetViewOrientation(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) {
view->eye = *eye;
view->at = *at;
view->up = *up;
view->flags |= 1;
view->flags |= VIEW_VIEWING;
}
void func_8013F050(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) {
/*
* Unused. View_LookAt is always used instead. This version is similar but
* is missing the input sanitization and the update to the flags.
*/
void View_LookAtUnsafe(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) {
view->eye = *eye;
view->at = *at;
view->up = *up;
}
void View_SetScale(View* view, f32 scale) {
view->flags |= 4;
view->flags |= VIEW_PROJECTION_PERSPECTIVE;
view->scale = scale;
}
@@ -75,28 +88,32 @@ void View_GetScale(View* view, f32* scale) {
*scale = view->scale;
}
void func_8013F0D0(View* view, f32 fovy, f32 zNear, f32 zFar) {
void View_SetPerspective(View* view, f32 fovy, f32 zNear, f32 zFar) {
view->fovy = fovy;
view->zNear = zNear;
view->zFar = zFar;
view->flags |= 4;
view->flags |= VIEW_PROJECTION_PERSPECTIVE;
}
void func_8013F100(View* view, f32* fovy, f32* zNear, f32* zFar) {
void View_GetPerspective(View* view, f32* fovy, f32* zNear, f32* zFar) {
*fovy = view->fovy;
*zNear = view->zNear;
*zFar = view->zFar;
}
void func_8013F120(View* view, f32 fovy, f32 zNear, f32 zFar) {
void View_SetOrtho(View* view, f32 fovy, f32 zNear, f32 zFar) {
view->fovy = fovy;
view->zNear = zNear;
view->zFar = zFar;
view->flags |= 8;
view->flags |= VIEW_PROJECTION_ORTHO;
view->scale = 1.0f;
}
void func_8013F15C(View* view, f32* fovy, f32* zNear, f32* zFar) {
/*
* Identical to View_GetPerspective, and never called.
* Named as it seems to fit the "set, get" pattern.
*/
void View_GetOrtho(View* view, f32* fovy, f32* zNear, f32* zFar) {
*fovy = view->fovy;
*zNear = view->zNear;
*zFar = view->zFar;
@@ -104,14 +121,14 @@ void func_8013F15C(View* view, f32* fovy, f32* zNear, f32* zFar) {
void View_SetViewport(View* view, Viewport* viewport) {
view->viewport = *viewport;
view->flags |= 2;
view->flags |= VIEW_VIEWPORT;
}
void View_GetViewport(View* view, Viewport* viewport) {
*viewport = view->viewport;
}
void View_WriteScissor(Gfx** gfx, s32 ulx, s32 uly, s32 lrx, s32 lry) {
void View_SetScissor(Gfx** gfx, s32 ulx, s32 uly, s32 lrx, s32 lry) {
Gfx* gfxp = *gfx;
gDPSetScissor(gfxp++, G_SC_NON_INTERLACE, ulx, uly, lrx, lry);
@@ -119,7 +136,7 @@ void View_WriteScissor(Gfx** gfx, s32 ulx, s32 uly, s32 lrx, s32 lry) {
*gfx = gfxp;
}
void View_SyncAndWriteScissor(View* view, Gfx** gfx) {
void View_ClearScissor(View* view, Gfx** gfx) {
Gfx* gfxp = *gfx;
s32 ulx = view->viewport.leftX;
s32 uly = view->viewport.topY;
@@ -127,12 +144,12 @@ void View_SyncAndWriteScissor(View* view, Gfx** gfx) {
s32 lry = view->viewport.bottomY;
gDPPipeSync(gfxp++);
View_WriteScissor(&gfxp, ulx, uly, lrx, lry);
View_SetScissor(&gfxp, ulx, uly, lrx, lry);
*gfx = gfxp;
}
void View_SetScissorForLetterbox(View* view) {
void View_ApplyLetterbox(View* view) {
s32 letterboxY;
s32 letterboxX;
s32 pad1;
@@ -143,20 +160,21 @@ void View_SetScissorForLetterbox(View* view) {
OPEN_DISPS(view->gfxCtx);
letterboxY = ShrinkWindow_GetLetterboxMagnitude();
letterboxY = ShrinkWindow_Letterbox_GetSize();
letterboxX = -1; // The following is optimized to varX = 0 but affects codegen
if (letterboxX < 0) {
letterboxX = 0;
}
if (letterboxX > 160) {
letterboxX = 160;
if (letterboxX > (SCREEN_WIDTH / 2)) {
letterboxX = SCREEN_WIDTH / 2;
}
if (letterboxY < 0) {
letterboxY = 0;
} else if (letterboxY > 120) {
letterboxY = 120;
} else if (letterboxY > (SCREEN_HEIGHT / 2)) {
letterboxY = SCREEN_HEIGHT / 2;
}
ulx = view->viewport.leftX + letterboxX;
@@ -166,31 +184,31 @@ void View_SetScissorForLetterbox(View* view) {
gDPPipeSync(POLY_OPA_DISP++);
{
s32 pad3;
s32 pad2;
Gfx* polyOpa;
polyOpa = POLY_OPA_DISP;
View_WriteScissor(&polyOpa, ulx, uly, lrx, lry);
View_SetScissor(&polyOpa, ulx, uly, lrx, lry);
POLY_OPA_DISP = polyOpa;
}
gDPPipeSync(POLY_XLU_DISP++);
{
Gfx* polyXlu;
s32 pad4;
s32 pad3;
polyXlu = POLY_XLU_DISP;
View_WriteScissor(&polyXlu, ulx, uly, lrx, lry);
View_SetScissor(&polyXlu, ulx, uly, lrx, lry);
POLY_XLU_DISP = polyXlu;
}
CLOSE_DISPS(view->gfxCtx);
}
s32 View_SetDistortionDirRot(View* view, f32 dirRotX, f32 dirRotY, f32 dirRotZ) {
view->distortionDirRot.x = dirRotX;
view->distortionDirRot.y = dirRotY;
view->distortionDirRot.z = dirRotZ;
s32 View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ) {
view->distortionOrientation.x = rotX;
view->distortionOrientation.y = rotY;
view->distortionOrientation.z = rotZ;
return 1;
}
@@ -207,22 +225,22 @@ s32 View_SetDistortionSpeed(View* view, f32 speed) {
}
s32 View_InitDistortion(View* view) {
view->distortionDirRot.x = 0.0f;
view->distortionDirRot.y = 0.0f;
view->distortionDirRot.z = 0.0f;
view->distortionOrientation.x = 0.0f;
view->distortionOrientation.y = 0.0f;
view->distortionOrientation.z = 0.0f;
view->distortionScale.x = 1.0f;
view->distortionScale.y = 1.0f;
view->distortionScale.z = 1.0f;
view->curDistortionDirRot = view->distortionDirRot;
view->curDistortionOrientation = view->distortionOrientation;
view->curDistortionScale = view->distortionScale;
view->distortionSpeed = 0.0f;
return 1;
}
s32 View_ClearDistortion(View* view) {
view->distortionDirRot.x = 0.0f;
view->distortionDirRot.y = 0.0f;
view->distortionDirRot.z = 0.0f;
view->distortionOrientation.x = 0.0f;
view->distortionOrientation.y = 0.0f;
view->distortionOrientation.z = 0.0f;
view->distortionScale.x = 1.0f;
view->distortionScale.y = 1.0f;
view->distortionScale.z = 1.0f;
@@ -230,8 +248,8 @@ s32 View_ClearDistortion(View* view) {
return 1;
}
s32 View_SetDistortion(View* view, Vec3f dirRot, Vec3f scale, f32 speed) {
view->distortionDirRot = dirRot;
s32 View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed) {
view->distortionOrientation = orientation;
view->distortionScale = scale;
view->distortionSpeed = speed;
return 1;
@@ -242,17 +260,19 @@ s32 View_StepDistortion(View* view, Mtx* projectionMtx) {
if (view->distortionSpeed == 0.0f) {
return false;
} else if (view->distortionSpeed == 1.0f) {
view->curDistortionDirRot = view->distortionDirRot;
}
if (view->distortionSpeed == 1.0f) {
view->curDistortionOrientation = view->distortionOrientation;
view->curDistortionScale = view->distortionScale;
view->distortionSpeed = 0.0f;
} else {
view->curDistortionDirRot.x =
F32_LERPIMP(view->curDistortionDirRot.x, view->distortionDirRot.x, view->distortionSpeed);
view->curDistortionDirRot.y =
F32_LERPIMP(view->curDistortionDirRot.y, view->distortionDirRot.y, view->distortionSpeed);
view->curDistortionDirRot.z =
F32_LERPIMP(view->curDistortionDirRot.z, view->distortionDirRot.z, view->distortionSpeed);
view->curDistortionOrientation.x =
F32_LERPIMP(view->curDistortionOrientation.x, view->distortionOrientation.x, view->distortionSpeed);
view->curDistortionOrientation.y =
F32_LERPIMP(view->curDistortionOrientation.y, view->distortionOrientation.y, view->distortionSpeed);
view->curDistortionOrientation.z =
F32_LERPIMP(view->curDistortionOrientation.z, view->distortionOrientation.z, view->distortionSpeed);
view->curDistortionScale.x =
F32_LERPIMP(view->curDistortionScale.x, view->distortionScale.x, view->distortionSpeed);
@@ -264,29 +284,32 @@ s32 View_StepDistortion(View* view, Mtx* projectionMtx) {
Matrix_MtxToMtxF(projectionMtx, &projectionMtxF);
Matrix_Put(&projectionMtxF);
Matrix_RotateXFApply(view->curDistortionDirRot.x);
Matrix_RotateYF(view->curDistortionDirRot.y, MTXMODE_APPLY);
Matrix_RotateZF(view->curDistortionDirRot.z, MTXMODE_APPLY);
Matrix_RotateXFApply(view->curDistortionOrientation.x);
Matrix_RotateYF(view->curDistortionOrientation.y, MTXMODE_APPLY);
Matrix_RotateZF(view->curDistortionOrientation.z, MTXMODE_APPLY);
Matrix_Scale(view->curDistortionScale.x, view->curDistortionScale.y, view->curDistortionScale.z, MTXMODE_APPLY);
Matrix_RotateZF(-view->curDistortionDirRot.z, MTXMODE_APPLY);
Matrix_RotateYF(-view->curDistortionDirRot.y, MTXMODE_APPLY);
Matrix_RotateXFApply(-view->curDistortionDirRot.x);
Matrix_RotateZF(-view->curDistortionOrientation.z, MTXMODE_APPLY);
Matrix_RotateYF(-view->curDistortionOrientation.y, MTXMODE_APPLY);
Matrix_RotateXFApply(-view->curDistortionOrientation.x);
Matrix_ToMtx(projectionMtx);
return true;
}
void View_RenderView(View* view, s32 uParm2) {
uParm2 = (view->flags & uParm2) | uParm2 >> 4;
/**
* Apply view to POLY_OPA_DISP, POLY_XLU_DISP (and OVERLAY_DISP if ortho)
*/
void View_Apply(View* view, s32 mask) {
mask = (view->flags & mask) | (mask >> 4);
if (uParm2 & 8) {
View_RenderToOrthographicMatrix(view);
if (mask & VIEW_PROJECTION_ORTHO) {
View_ApplyOrtho(view);
} else {
View_RenderToPerspectiveMatrix(view);
View_ApplyPerspective(view);
}
}
s32 View_RenderToPerspectiveMatrix(View* view) {
s32 View_ApplyPerspective(View* view) {
f32 aspect;
s32 width;
s32 height;
@@ -297,36 +320,39 @@ s32 View_RenderToPerspectiveMatrix(View* view) {
OPEN_DISPS(gfxCtx);
vp = GRAPH_ALLOC(gfxCtx, sizeof(*vp));
// Viewport
vp = GRAPH_ALLOC(gfxCtx, sizeof(Vp));
View_ViewportToVp(vp, &view->viewport);
view->vp = *vp;
View_SetScissorForLetterbox(view);
View_ApplyLetterbox(view);
gSPViewport(POLY_OPA_DISP++, vp);
gSPViewport(POLY_XLU_DISP++, vp);
projection = GRAPH_ALLOC(gfxCtx, sizeof(*projection));
// Perspective projection
projection = GRAPH_ALLOC(gfxCtx, sizeof(Mtx));
view->projectionPtr = projection;
width = view->viewport.rightX - view->viewport.leftX;
height = view->viewport.bottomY - view->viewport.topY;
aspect = (f32)width / (f32)height;
guPerspective(projection, &view->normal, view->fovy, aspect, view->zNear, view->zFar, view->scale);
guPerspective(projection, &view->perspNorm, view->fovy, aspect, view->zNear, view->zFar, view->scale);
view->projection = *projection;
View_StepDistortion(view, projection);
gSPPerspNormalize(POLY_OPA_DISP++, view->normal);
gSPPerspNormalize(POLY_OPA_DISP++, view->perspNorm);
gSPMatrix(POLY_OPA_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPPerspNormalize(POLY_XLU_DISP++, view->normal);
gSPPerspNormalize(POLY_XLU_DISP++, view->perspNorm);
gSPMatrix(POLY_XLU_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
viewing = GRAPH_ALLOC(gfxCtx, sizeof(*viewing));
// View matrix (look-at)
viewing = GRAPH_ALLOC(gfxCtx, sizeof(Mtx));
view->viewingPtr = viewing;
if (view->eye.x == view->at.x && view->eye.y == view->at.y && view->eye.z == view->at.z) {
if ((view->eye.x == view->at.x) && (view->eye.y == view->at.y) && (view->eye.z == view->at.z)) {
view->eye.z += 2.0f;
}
@@ -343,24 +369,24 @@ s32 View_RenderToPerspectiveMatrix(View* view) {
return 1;
}
s32 View_RenderToOrthographicMatrix(View* view) {
s32 View_ApplyOrtho(View* view) {
Vp* vp;
Mtx* projection;
GraphicsContext* gfxCtx = view->gfxCtx;
OPEN_DISPS(gfxCtx);
vp = GRAPH_ALLOC(gfxCtx, sizeof(*vp));
vp = GRAPH_ALLOC(gfxCtx, sizeof(Vp));
View_ViewportToVp(vp, &view->viewport);
view->vp = *vp;
View_SetScissorForLetterbox(view);
View_ApplyLetterbox(view);
gSPViewport(POLY_OPA_DISP++, vp);
gSPViewport(POLY_XLU_DISP++, vp);
gSPViewport(OVERLAY_DISP++, vp);
projection = GRAPH_ALLOC(gfxCtx, sizeof(*projection));
projection = GRAPH_ALLOC(gfxCtx, sizeof(Mtx));
view->projectionPtr = projection;
guOrtho(projection, gScreenWidth * -0.5f, gScreenWidth * 0.5f, gScreenHeight * -0.5f, gScreenHeight * 0.5f,
@@ -376,7 +402,10 @@ s32 View_RenderToOrthographicMatrix(View* view) {
return 1;
}
s32 func_8013FBC8(View* view) {
/**
* Apply scissor, viewport and projection (ortho) to OVERLAY_DISP.
*/
s32 View_ApplyOrthoToOverlay(View* view) {
Vp* vp;
Mtx* projection;
GraphicsContext* gfxCtx;
@@ -385,7 +414,7 @@ s32 func_8013FBC8(View* view) {
OPEN_DISPS(gfxCtx);
vp = GRAPH_ALLOC(gfxCtx, sizeof(*vp));
vp = GRAPH_ALLOC(gfxCtx, sizeof(Vp));
View_ViewportToVp(vp, &view->viewport);
view->vp = *vp;
@@ -395,26 +424,29 @@ s32 func_8013FBC8(View* view) {
s32 pad;
overlay = OVERLAY_DISP;
View_WriteScissor(&overlay, view->viewport.leftX, view->viewport.topY, view->viewport.rightX,
view->viewport.bottomY);
View_SetScissor(&overlay, view->viewport.leftX, view->viewport.topY, view->viewport.rightX,
view->viewport.bottomY);
OVERLAY_DISP = overlay;
}
gSPViewport(OVERLAY_DISP++, vp);
projection = GRAPH_ALLOC(gfxCtx, sizeof(*projection));
projection = GRAPH_ALLOC(gfxCtx, sizeof(Mtx));
view->projectionPtr = projection;
guOrtho(projection, gScreenWidth * -0.5f, gScreenWidth * 0.5f, gScreenHeight * -0.5f, gScreenHeight * 0.5f,
view->zNear, view->zFar, view->scale);
view->projection = *projection;
gSPMatrix(OVERLAY_DISP++, projection, G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(OVERLAY_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
CLOSE_DISPS(gfxCtx);
return 1;
}
s32 func_8013FD74(View* view) {
/**
* Apply scissor, viewport, view and projection (perspective) to OVERLAY_DISP.
*/
s32 View_ApplyPerspectiveToOverlay(View* view) {
f32 aspect;
s32 width;
s32 height;
@@ -428,7 +460,7 @@ s32 func_8013FD74(View* view) {
OPEN_DISPS(gfxCtx);
vp = GRAPH_ALLOC(gfxCtx, sizeof(*vp));
vp = GRAPH_ALLOC(gfxCtx, sizeof(Vp));
View_ViewportToVp(vp, &view->viewport);
view->vp = *vp;
@@ -438,28 +470,30 @@ s32 func_8013FD74(View* view) {
Gfx* overlay;
overlay = OVERLAY_DISP;
View_WriteScissor(&overlay, view->viewport.leftX, view->viewport.topY, view->viewport.rightX,
view->viewport.bottomY);
View_SetScissor(&overlay, view->viewport.leftX, view->viewport.topY, view->viewport.rightX,
view->viewport.bottomY);
OVERLAY_DISP = overlay;
}
gSPViewport(OVERLAY_DISP++, vp);
projection = GRAPH_ALLOC(gfxCtx, sizeof(*projection));
projection = GRAPH_ALLOC(gfxCtx, sizeof(Mtx));
view->projectionPtr = projection;
width = view->viewport.rightX - view->viewport.leftX;
height = view->viewport.bottomY - view->viewport.topY;
aspect = (f32)width / (f32)height;
guPerspective(projection, &view->normal, view->fovy, aspect, view->zNear, view->zFar, view->scale);
guPerspective(projection, &view->perspNorm, view->fovy, aspect, view->zNear, view->zFar, view->scale);
view->projection = *projection;
gSPPerspNormalize(OVERLAY_DISP++, view->normal);
gSPPerspNormalize(OVERLAY_DISP++, view->perspNorm);
gSPMatrix(OVERLAY_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
viewing = GRAPH_ALLOC(gfxCtx, sizeof(*viewing));
viewing = GRAPH_ALLOC(gfxCtx, sizeof(Mtx));
view->viewingPtr = viewing;
// This check avoids a divide-by-zero in guLookAt if eye == at
if (view->eye.x == view->at.x && view->eye.y == view->at.y && view->eye.z == view->at.z) {
view->eye.z += 2.0f;
}
@@ -476,7 +510,10 @@ s32 func_8013FD74(View* view) {
return 1;
}
s32 func_80140024(View* view) {
/**
* Just updates view's view matrix from its eye/at/up vectors.
*/
s32 View_UpdateViewingMatrix(View* view) {
guLookAt(view->viewingPtr, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x,
view->up.y, view->up.z);
@@ -486,22 +523,22 @@ s32 func_80140024(View* view) {
return 1;
}
s32 func_801400CC(View* view, Gfx** gfxp) {
s32 View_ApplyTo(View* view, Gfx** gfxp) {
Gfx* gfx = *gfxp;
GraphicsContext* gfxCtx = view->gfxCtx;
Viewport* viewport = &view->viewport;
Mtx* projection;
Vp* vp;
vp = GRAPH_ALLOC(gfxCtx, sizeof(*vp));
vp = GRAPH_ALLOC(gfxCtx, sizeof(Vp));
View_ViewportToVp(vp, viewport);
view->vp = *vp;
View_SyncAndWriteScissor(view, &gfx);
View_ClearScissor(view, &gfx);
gSPViewport(gfx++, vp);
projection = GRAPH_ALLOC(gfxCtx, sizeof(*projection));
projection = GRAPH_ALLOC(gfxCtx, sizeof(Mtx));
view->projectionPtr = projection;
guOrtho(projection, gScreenWidth * -0.5f, gScreenWidth * 0.5f, gScreenHeight * -0.5f, gScreenHeight * 0.5f,
@@ -509,7 +546,7 @@ s32 func_801400CC(View* view, Gfx** gfxp) {
view->projection = *projection;
gSPMatrix(gfx++, projection, G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(gfx++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
*gfxp = gfx;
return 1;
+3 -3
View File
@@ -32,9 +32,9 @@ OSPiHandle* osFlashReInit(u8 latency, u8 pulse, u8 pageSize, u8 relDuration, u32
return &__osFlashHandler;
}
void osFlashChange(u32 flash_num) {
__osFlashHandler.baseAddress = RDRAM_UNCACHED | (FRAM_STATUS_REGISTER + (flash_num << 17));
__osFlashHandler.type = 8 + flash_num;
void osFlashChange(u32 flashNum) {
__osFlashHandler.baseAddress = RDRAM_UNCACHED | (FRAM_STATUS_REGISTER + (flashNum << 17));
__osFlashHandler.type = 8 + flashNum;
return;
}
+1 -1
View File
@@ -1,6 +1,6 @@
#include "global.h"
s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size) {
s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, uintptr_t cartAddr, void* dramAddr, size_t size) {
s32 status;
OSPiHandle* curHandle;
+1 -1
View File
@@ -1,6 +1,6 @@
#include "global.h"
s32 __osSiRawReadIo(u32 devAddr, u32* data) {
s32 __osSiRawReadIo(uintptr_t devAddr, u32* data) {
if (__osSiDeviceBusy()) {
return -1;
}
+1 -1
View File
@@ -1,6 +1,6 @@
#include "global.h"
s32 __osSiRawWriteIo(u32 devAddr, u32 data) {
s32 __osSiRawWriteIo(uintptr_t devAddr, u32 data) {
if (__osSiDeviceBusy() != 0) {
return -1;
}
@@ -5,6 +5,7 @@
*/
#include "z_bg_crace_movebg.h"
#include "overlays/actors/ovl_En_Dno/z_en_dno.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -15,22 +16,30 @@ void BgCraceMovebg_Destroy(Actor* thisx, PlayState* play);
void BgCraceMovebg_Update(Actor* thisx, PlayState* play);
void BgCraceMovebg_Draw(Actor* thisx, PlayState* play);
s32 func_80A7090C(PlayState* play);
void func_80A70970(BgCraceMovebg* this, PlayState* play);
void func_80A7099C(BgCraceMovebg* this, PlayState* play);
void func_80A709E4(BgCraceMovebg* this, PlayState* play);
void func_80A70A08(BgCraceMovebg* this, PlayState* play);
void func_80A70A84(BgCraceMovebg* this, PlayState* play);
void func_80A70A9C(BgCraceMovebg* this, PlayState* play);
void func_80A70C04(BgCraceMovebg* this, PlayState* play);
void func_80A70D74(BgCraceMovebg* this, PlayState* play);
void func_80A70DA8(BgCraceMovebg* this, PlayState* play);
void func_80A70E2C(BgCraceMovebg* this, PlayState* play);
void func_80A70E70(BgCraceMovebg* this, PlayState* play);
void func_80A70F14(BgCraceMovebg* this, PlayState* play);
void func_80A70F2C(BgCraceMovebg* this, PlayState* play);
void func_80A70FF4(BgCraceMovebg* this, PlayState* play);
void func_80A71040(BgCraceMovebg* this, PlayState* play);
s32 BgCraceMovebg_GetRaceStatus(PlayState* play);
void BgCraceMovebg_OpeningDoor_SetupIdle(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_OpeningDoor_Idle(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_OpeningDoor_SetupOpen(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_OpeningDoor_Open(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_OpeningDoor_SetupDoNothing(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_OpeningDoor_DoNothing(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_ClosingDoor_SetupIdle(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_ClosingDoor_Idle(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_ClosingDoor_SetupWaitToClose(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_ClosingDoor_WaitToClose(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_ClosingDoor_SetupClose(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_ClosingDoor_Close(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_ClosingDoor_SetupDoNothing(BgCraceMovebg* this, PlayState* play);
void BgCraceMovebg_ClosingDoor_DoNothing(BgCraceMovebg* this, PlayState* play);
typedef enum {
/* 0 */ BG_CRACE_MOVEBG_RACE_STATUS_BUTLER_NOT_PRESENT,
/* 1 */ BG_CRACE_MOVEBG_RACE_STATUS_FIRST_RACE,
/* 2 */ BG_CRACE_MOVEBG_RACE_STATUS_SUBSEQUENT_RACE
} BgCraceMovebgRaceStatus;
u8 sIsLoaded[32];
const ActorInit Bg_Crace_Movebg_InitVars = {
ACTOR_BG_CRACE_MOVEBG,
@@ -44,13 +53,14 @@ const ActorInit Bg_Crace_Movebg_InitVars = {
(ActorFunc)BgCraceMovebg_Draw,
};
static u8 D_80A710A0 = 0;
static u8 D_80A710A4 = 0;
static u8 sHasInitializedIsLoaded = 0;
static u8 sLoadedDoorCount = 0;
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP),
};
static Vec3f D_80A710AC[] = { 0.0f, 0.0f, 1.0f };
u8 D_80A711B0[32];
static Vec3f sUnitVecZ = { 0.0f, 0.0f, 1.0f };
void BgCraceMovebg_Init(Actor* thisx, PlayState* play) {
BgCraceMovebg* this = THIS;
@@ -58,122 +68,138 @@ void BgCraceMovebg_Init(Actor* thisx, PlayState* play) {
s32 j;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (D_80A710A0 == 0) {
for (i = 0; i < ARRAY_COUNT(D_80A711B0); i++) {
D_80A711B0[i] = 0;
if (!sHasInitializedIsLoaded) {
for (i = 0; i < ARRAY_COUNT(sIsLoaded); i++) {
sIsLoaded[i] = 0;
}
D_80A710A0 = 1;
sHasInitializedIsLoaded = true;
}
DynaPolyActor_Init(&this->dyna, 1);
DynaPolyActor_LoadMesh(play, &this->dyna, &object_crace_object_Colheader_000E00);
DynaPolyActor_LoadMesh(play, &this->dyna, &gDekuShrineSlidingDoorCol);
this->unk184 = this->dyna.actor.world.rot.x;
this->unk16C = this->dyna.actor.world.rot.z;
this->index = BG_CRACE_MOVEBG_GET_INDEX(&this->dyna.actor);
this->openSpeed = BG_CRACE_MOVEBG_GET_OPEN_SPEED(&this->dyna.actor);
this->dyna.actor.world.rot.x = 0;
this->dyna.actor.world.rot.z = 0;
this->dyna.actor.home.rot.x = 0;
this->dyna.actor.home.rot.z = 0;
this->dyna.actor.flags |= ACTOR_FLAG_10000000;
switch (BGCRACEMOVEBG_GET_F(&this->dyna.actor)) {
case 0:
case 2:
for (j = 0; j < D_80A710A4; j++) {
if (D_80A711B0[j] == this->unk184) {
this->unk170 |= 8;
switch (BG_CRACE_MOVEBG_GET_TYPE(&this->dyna.actor)) {
case BG_CRACE_MOVEBG_TYPE_CLOSING:
case BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING:
for (j = 0; j < sLoadedDoorCount; j++) {
if (sIsLoaded[j] == this->index) {
this->stateFlags |= BG_CRACE_MOVEBG_FLAG_ALREADY_LOADED;
Actor_MarkForDeath(&this->dyna.actor);
return;
}
}
if (D_80A710A4 < ARRAY_COUNT(D_80A711B0)) {
D_80A711B0[(s32)D_80A710A4++] = this->unk184;
if (sLoadedDoorCount < ARRAY_COUNT(sIsLoaded)) {
sIsLoaded[(s32)sLoadedDoorCount] = this->index;
sLoadedDoorCount++;
}
this->dyna.actor.room = -1;
switch (func_80A7090C(play)) {
case 0:
func_80A70D74(this, play);
switch (BgCraceMovebg_GetRaceStatus(play)) {
case BG_CRACE_MOVEBG_RACE_STATUS_BUTLER_NOT_PRESENT:
BgCraceMovebg_ClosingDoor_SetupIdle(this, play);
break;
case 1:
func_80A70D74(this, play);
case BG_CRACE_MOVEBG_RACE_STATUS_FIRST_RACE:
BgCraceMovebg_ClosingDoor_SetupIdle(this, play);
break;
case 2:
Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1);
func_80A70D74(this, play);
case BG_CRACE_MOVEBG_RACE_STATUS_SUBSEQUENT_RACE:
// Makes sure no lingering switch flags are set from the last time the player did a race.
Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1);
BgCraceMovebg_ClosingDoor_SetupIdle(this, play);
break;
}
break;
case 1:
func_80A70970(this, play);
case BG_CRACE_MOVEBG_TYPE_OPENING:
BgCraceMovebg_OpeningDoor_SetupIdle(this, play);
break;
default:
Actor_MarkForDeath(&this->dyna.actor);
break;
}
}
s32 func_80A7090C(PlayState* play) {
s32 BgCraceMovebg_GetRaceStatus(PlayState* play) {
s32 pad;
s32 returnVal = 0;
Actor* tempActor = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_DNO);
s32 raceStatus = BG_CRACE_MOVEBG_RACE_STATUS_BUTLER_NOT_PRESENT;
Actor* butler = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_DNO);
if (tempActor != NULL) {
if (Flags_GetSwitch(play, BGCRACEMOVEBG_GET_3F80(tempActor))) {
returnVal = 2;
if (butler != NULL) {
if (Flags_GetSwitch(play, EN_DNO_GET_RACE_STARTED_SWITCH_FLAG(butler))) {
raceStatus = BG_CRACE_MOVEBG_RACE_STATUS_SUBSEQUENT_RACE;
} else {
returnVal = 1;
raceStatus = BG_CRACE_MOVEBG_RACE_STATUS_FIRST_RACE;
}
}
return returnVal;
return raceStatus;
}
void func_80A70970(BgCraceMovebg* this, PlayState* play) {
this->unk164 = 0.0f;
this->unk160 = 0.0f;
this->actionFunc = func_80A7099C;
void BgCraceMovebg_OpeningDoor_SetupIdle(BgCraceMovebg* this, PlayState* play) {
this->targetDoorHeight = 0.0f;
this->doorHeight = 0.0f;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
this->actionFunc = BgCraceMovebg_OpeningDoor_Idle;
}
void func_80A7099C(BgCraceMovebg* this, PlayState* play) {
if (Flags_GetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor))) {
func_80A709E4(this, play);
/**
* Wait for this door's switch flag to be set, then start opening.
*/
void BgCraceMovebg_OpeningDoor_Idle(BgCraceMovebg* this, PlayState* play) {
if (Flags_GetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor))) {
BgCraceMovebg_OpeningDoor_SetupOpen(this, play);
}
}
void func_80A709E4(BgCraceMovebg* this, PlayState* play) {
this->actionFunc = func_80A70A08;
this->unk164 = 180.0f;
void BgCraceMovebg_OpeningDoor_SetupOpen(BgCraceMovebg* this, PlayState* play) {
this->targetDoorHeight = 180.0f;
this->actionFunc = BgCraceMovebg_OpeningDoor_Open;
}
void func_80A70A08(BgCraceMovebg* this, PlayState* play) {
/**
* Silde open, then do nothing.
*/
void BgCraceMovebg_OpeningDoor_Open(BgCraceMovebg* this, PlayState* play) {
func_800B9010(&this->dyna.actor, NA_SE_EV_STONEDOOR_OPEN_S - SFX_FLAG);
Math_SmoothStepToF(&this->unk160, this->unk164, 2.0f, this->unk16C, 0.01f);
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160;
if (this->unk160 == this->unk164) {
func_80A70A84(this, play);
Math_SmoothStepToF(&this->doorHeight, this->targetDoorHeight, 2.0f, this->openSpeed, 0.01f);
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->doorHeight;
if (this->doorHeight == this->targetDoorHeight) {
BgCraceMovebg_OpeningDoor_SetupDoNothing(this, play);
}
}
void func_80A70A84(BgCraceMovebg* this, PlayState* play) {
this->actionFunc = func_80A70A9C;
void BgCraceMovebg_OpeningDoor_SetupDoNothing(BgCraceMovebg* this, PlayState* play) {
this->actionFunc = BgCraceMovebg_OpeningDoor_DoNothing;
}
void func_80A70A9C(BgCraceMovebg* this, PlayState* play) {
void BgCraceMovebg_OpeningDoor_DoNothing(BgCraceMovebg* this, PlayState* play) {
}
void BgCraceMovebg_Destroy(Actor* thisx, PlayState* play) {
BgCraceMovebg* this = THIS;
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
if (!(this->unk170 & 0x8)) {
switch (BGCRACEMOVEBG_GET_F(&this->dyna.actor)) {
case 0:
case 2:
Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(thisx));
Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(thisx) + 1);
if (!(this->stateFlags & BG_CRACE_MOVEBG_FLAG_ALREADY_LOADED)) {
switch (BG_CRACE_MOVEBG_GET_TYPE(&this->dyna.actor)) {
case BG_CRACE_MOVEBG_TYPE_CLOSING:
case BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING:
Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(thisx));
Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(thisx) + 1);
break;
case 1:
Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(thisx));
case BG_CRACE_MOVEBG_TYPE_OPENING:
Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(thisx));
break;
}
}
@@ -183,117 +209,147 @@ void BgCraceMovebg_Update(Actor* thisx, PlayState* play) {
BgCraceMovebg* this = THIS;
s32 pad;
Player* player = GET_PLAYER(play);
s16 tempRot;
s16 yawDiff;
switch (BGCRACEMOVEBG_GET_F(&this->dyna.actor)) {
case 0:
case 2:
tempRot = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.home.rot.y;
if ((tempRot >= -0x4000) && (tempRot <= 0x4000)) {
switch (BG_CRACE_MOVEBG_GET_TYPE(&this->dyna.actor)) {
case BG_CRACE_MOVEBG_TYPE_CLOSING:
case BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING:
yawDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.home.rot.y;
if ((yawDiff >= -0x4000) && (yawDiff <= 0x4000)) {
this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y;
} else {
this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y + 0x8000;
}
break;
default:
this->actionFunc(this, play);
Math_Vec3f_Copy(&this->unk188, &player->bodyPartsPos[0]);
break;
}
this->actionFunc(this, play);
Math_Vec3f_Copy(&this->prevPlayerPos, &player->bodyPartsPos[0]);
}
void func_80A70C04(BgCraceMovebg* this, PlayState* play) {
/**
* Updates this door's flags if the player has moved beyond it. If the door is of type
* BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING, then nothing happens here, so the door never
* knows the player has moved beyond it.
*/
void BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(BgCraceMovebg* this, PlayState* play) {
s32 pad;
Player* player = GET_PLAYER(play);
Vec3f intersect;
Vec3f diff;
Vec3f posDiff;
if ((BGCRACEMOVEBG_GET_F(&this->dyna.actor) != 2) &&
SubS_LineSegVsPlane(&this->dyna.actor.home.pos, &this->dyna.actor.home.rot, D_80A710AC, &this->unk188,
if ((BG_CRACE_MOVEBG_GET_TYPE(&this->dyna.actor) != BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING) &&
SubS_LineSegVsPlane(&this->dyna.actor.home.pos, &this->dyna.actor.home.rot, &sUnitVecZ, &this->prevPlayerPos,
&player->bodyPartsPos[0], &intersect)) {
Matrix_RotateYS(-this->dyna.actor.home.rot.y, MTXMODE_NEW);
Math_Vec3f_Diff(&player->bodyPartsPos[0], &this->dyna.actor.home.pos, &diff);
Matrix_MultVec3f(&diff, &this->unk178);
if (fabsf(this->unk178.x) < 100.0f && this->unk178.y >= -10.0f && this->unk178.y <= 180.0f) {
if (this->unk178.z < 0.0f) {
Flags_SetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1);
this->unk170 |= 2;
Math_Vec3f_Diff(&player->bodyPartsPos[0], &this->dyna.actor.home.pos, &posDiff);
Matrix_MultVec3f(&posDiff, &this->intersectionOffsetFromHome);
if (fabsf(this->intersectionOffsetFromHome.x) < 100.0f && this->intersectionOffsetFromHome.y >= -10.0f &&
this->intersectionOffsetFromHome.y <= 180.0f) {
if (this->intersectionOffsetFromHome.z < 0.0f) {
Flags_SetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1);
this->stateFlags |= BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR;
} else {
Flags_UnsetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1);
this->unk170 &= ~2;
Flags_UnsetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1);
this->stateFlags &= ~BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR;
}
}
}
}
void func_80A70D74(BgCraceMovebg* this, PlayState* play) {
this->unk164 = 180.0f;
this->unk160 = 180.0f;
this->actionFunc = func_80A70DA8;
void BgCraceMovebg_ClosingDoor_SetupIdle(BgCraceMovebg* this, PlayState* play) {
this->targetDoorHeight = 180.0f;
this->doorHeight = 180.0f;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 180.0f;
this->actionFunc = BgCraceMovebg_ClosingDoor_Idle;
}
void func_80A70DA8(BgCraceMovebg* this, PlayState* play) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160;
func_80A70C04(this, play);
if (this->unk170 & 1) {
func_80A70E2C(this, play);
/**
* Wait for the Deku Butler to move beyond the door, or wait for this door's switch flag
* to be set. In either case, start closing; how long to wait before closing depends on
* what triggered it to close.
*/
void BgCraceMovebg_ClosingDoor_Idle(BgCraceMovebg* this, PlayState* play) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->doorHeight;
BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(this, play);
if (this->stateFlags & BG_CRACE_MOVEBG_FLAG_BUTLER_IS_BEYOND_DOOR) {
BgCraceMovebg_ClosingDoor_SetupWaitToClose(this, play);
}
if (Flags_GetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor))) {
func_80A70F14(this, play);
if (Flags_GetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor))) {
BgCraceMovebg_ClosingDoor_SetupClose(this, play);
}
}
void func_80A70E2C(BgCraceMovebg* this, PlayState* play) {
this->unk174 = BGCRACEMOVEBG_GET_F800(&this->dyna.actor) * 10;
this->unk164 = 180.0f;
this->unk160 = 180.0f;
this->actionFunc = func_80A70E70;
void BgCraceMovebg_ClosingDoor_SetupWaitToClose(BgCraceMovebg* this, PlayState* play) {
this->closeWaitTimer = BG_CRACE_MOVEBG_GET_CLOSE_WAIT_TIMER(&this->dyna.actor) * 10;
this->targetDoorHeight = 180.0f;
this->doorHeight = 180.0f;
this->actionFunc = BgCraceMovebg_ClosingDoor_WaitToClose;
}
void func_80A70E70(BgCraceMovebg* this, PlayState* play) {
if (this->unk174 > 0) {
this->unk174--;
/**
* Wait until the closeWaitTimer reaches 0, then set the door's switch flag and start closing.
*/
void BgCraceMovebg_ClosingDoor_WaitToClose(BgCraceMovebg* this, PlayState* play) {
if (this->closeWaitTimer > 0) {
this->closeWaitTimer--;
}
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160;
func_80A70C04(this, play);
if (this->unk174 <= 0) {
this->unk160 = 180.0f;
this->unk164 = 0.0f;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->doorHeight;
BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(this, play);
if (this->closeWaitTimer <= 0) {
this->doorHeight = 180.0f;
this->targetDoorHeight = 0.0f;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 180.0f;
Flags_SetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor));
func_80A70F14(this, play);
Flags_SetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor));
BgCraceMovebg_ClosingDoor_SetupClose(this, play);
}
}
void func_80A70F14(BgCraceMovebg* this, PlayState* play) {
this->actionFunc = func_80A70F2C;
void BgCraceMovebg_ClosingDoor_SetupClose(BgCraceMovebg* this, PlayState* play) {
this->actionFunc = BgCraceMovebg_ClosingDoor_Close;
}
void func_80A70F2C(BgCraceMovebg* this, PlayState* play) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->unk160;
func_80A70C04(this, play);
if (Math_StepToF(&this->unk160, 0.0f, 1.0f)) {
if (!(this->unk170 & 2) && !Flags_GetSwitch(play, BGCRACEMOVEBG_GET_7F0(&this->dyna.actor) + 1)) {
play->haltAllActors = true;
/**
* Slowly slide closed, then check to see if the player is beyond the door. If the player has
* not moved beyond the door, trigger a voidout. Otherwise, do nothing.
*/
void BgCraceMovebg_ClosingDoor_Close(BgCraceMovebg* this, PlayState* play) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + this->doorHeight;
BgCraceMovebg_ClosingDoor_CheckIfPlayerIsBeyondDoor(this, play);
if (Math_StepToF(&this->doorHeight, 0.0f, 1.0f)) {
if (!(this->stateFlags & BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR) &&
!Flags_GetSwitch(play, BG_CRACE_MOVEBG_GET_SWITCH_FLAG(&this->dyna.actor) + 1)) {
play->haltAllActors = 1;
Play_TriggerRespawn(&play->state);
play_sound(NA_SE_OC_ABYSS);
}
func_80A70FF4(this, play);
BgCraceMovebg_ClosingDoor_SetupDoNothing(this, play);
} else {
func_800B9010(&this->dyna.actor, NA_SE_EV_STONEDOOR_CLOSE_S - SFX_FLAG);
}
}
void func_80A70FF4(BgCraceMovebg* this, PlayState* play) {
this->unk164 = 0.0f;
this->unk160 = 0.0f;
void BgCraceMovebg_ClosingDoor_SetupDoNothing(BgCraceMovebg* this, PlayState* play) {
this->targetDoorHeight = 0.0f;
this->doorHeight = 0.0f;
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP);
this->actionFunc = func_80A71040;
this->actionFunc = BgCraceMovebg_ClosingDoor_DoNothing;
}
void func_80A71040(BgCraceMovebg* this, PlayState* play) {
void BgCraceMovebg_ClosingDoor_DoNothing(BgCraceMovebg* this, PlayState* play) {
}
void BgCraceMovebg_Draw(Actor* thisx, PlayState* play) {
Gfx_DrawDListOpa(play, object_crace_object_DL_0003A0);
Gfx_DrawDListOpa(play, gDekuShrineSlidingDoorDL);
}
@@ -8,23 +8,34 @@ struct BgCraceMovebg;
typedef void (*BgCraceMovebgActionFunc)(struct BgCraceMovebg*, PlayState*);
#define BGCRACEMOVEBG_GET_F(thisx) (((thisx)->params) & 0xF)
#define BGCRACEMOVEBG_GET_7F0(thisx) (((thisx)->params >> 4) & 0x7F)
#define BGCRACEMOVEBG_GET_3F80(thisx) (((thisx)->params >> 7) & 0x7F)
#define BGCRACEMOVEBG_GET_F800(thisx) (((thisx)->params >> 0xB) & 0x1F)
#define BG_CRACE_MOVEBG_GET_TYPE(thisx) (((thisx)->params) & 0xF)
#define BG_CRACE_MOVEBG_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 4) & 0x7F)
#define BG_CRACE_MOVEBG_GET_CLOSE_WAIT_TIMER(thisx) (((thisx)->params >> 0xB) & 0x1F)
#define BG_CRACE_MOVEBG_GET_INDEX(thisx) ((thisx)->world.rot.x)
#define BG_CRACE_MOVEBG_GET_OPEN_SPEED(thisx) ((thisx)->world.rot.z)
#define BG_CRACE_MOVEBG_FLAG_BUTLER_IS_BEYOND_DOOR (1 << 0)
#define BG_CRACE_MOVEBG_FLAG_PLAYER_IS_BEYOND_DOOR (1 << 1)
#define BG_CRACE_MOVEBG_FLAG_ALREADY_LOADED (1 << 3)
typedef enum {
/* 0 */ BG_CRACE_MOVEBG_TYPE_CLOSING,
/* 1 */ BG_CRACE_MOVEBG_TYPE_OPENING,
/* 2 */ BG_CRACE_MOVEBG_TYPE_UNUSED_CLOSING // Not triggered to close by the Deku Butler, and triggers a voidout no matter which side of the door they're on.
} BgCraceMovebgType;
typedef struct BgCraceMovebg {
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ BgCraceMovebgActionFunc actionFunc;
/* 0x160 */ f32 unk160;
/* 0x164 */ f32 unk164;
/* 0x160 */ f32 doorHeight;
/* 0x164 */ f32 targetDoorHeight;
/* 0x168 */ UNK_TYPE1 pad168[0x4];
/* 0x16C */ f32 unk16C;
/* 0x170 */ s32 unk170;
/* 0x174 */ s32 unk174;
/* 0x178 */ Vec3f unk178;
/* 0x184 */ u8 unk184;
/* 0x188 */ Vec3f unk188;
/* 0x16C */ f32 openSpeed;
/* 0x170 */ s32 stateFlags;
/* 0x174 */ s32 closeWaitTimer;
/* 0x178 */ Vec3f intersectionOffsetFromHome;
/* 0x184 */ u8 index;
/* 0x188 */ Vec3f prevPlayerPos;
} BgCraceMovebg; // size = 0x194
extern const ActorInit Bg_Crace_Movebg_InitVars;
@@ -16,7 +16,7 @@
void BgDblueMovebg_Init(Actor* thisx, PlayState* play);
void BgDblueMovebg_Destroy(Actor* thisx, PlayState* play);
void BgDblueMovebg_Update(Actor* thisx, PlayState* play);
void BgDblueMovebg_Draw(Actor* thisx, PlayState* play);
void BgDblueMovebg_Draw(Actor* thisx, PlayState* play2);
void func_80A2A1E0(BgDblueMovebg* this, PlayState* play);
void func_80A2A32C(BgDblueMovebg* this, PlayState* play);
@@ -6,6 +6,7 @@
#include "prevent_bss_reordering.h"
#include "z_bg_hakugin_post.h"
#include "z64quake.h"
#include "z64rumble.h"
#include "objects/object_hakugin_obj/object_hakugin_obj.h"
@@ -509,7 +510,7 @@ void func_80A9C058(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct*
s32 pad;
Vec3f sp44;
s32 pad2[2];
s16 quake;
s16 quakeIndex;
if (this->unk_170 == 0) {
for (i = 0; i < unkStruct->count; i++) {
@@ -520,10 +521,12 @@ void func_80A9C058(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct*
sp44.y = this->unk_16C + unkStruct1->unk_14.y;
sp44.z = this->dyna.actor.home.pos.z + unkStruct1->unk_14.z;
Rumble_Request(Math3D_Vec3fDistSq(&sp44, &GET_PLAYER(play)->actor.world.pos), 255, 20, 150);
quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
Quake_SetSpeed(quake, 20000);
Quake_SetQuakeValues(quake, 7, 0, 0, 0);
Quake_SetCountdown(quake, 12);
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 20000);
Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 12);
if (this->unk_179 <= 0) {
func_8019F128(NA_SE_EV_STONEDOOR_STOP);
this->unk_179 = 40;
@@ -538,15 +541,16 @@ void func_80A9C18C(BgHakuginPost* this, PlayState* play) {
s32 pad;
Player* player = GET_PLAYER(play);
Camera* activeCam = GET_ACTIVE_CAM(play);
s16 quake;
s16 quakeIndex;
Rumble_Request(Math3D_XZDistanceSquared(player->actor.world.pos.x, player->actor.world.pos.z,
this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.z),
255, 20, 150);
quake = Quake_Add(activeCam, 3);
Quake_SetSpeed(quake, 17232);
Quake_SetQuakeValues(quake, 6, 0, 0, 0);
Quake_SetCountdown(quake, 20);
quakeIndex = Quake_Add(activeCam, QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 17232);
Quake_SetQuakeValues(quakeIndex, 6, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 20);
}
void func_80A9C228(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct) {
@@ -5,13 +5,14 @@
*/
#include "z_bg_ikana_dharma.h"
#include "z64quake.h"
#include "assets/objects/object_ikana_obj/object_ikana_obj.h"
#define FLAGS (ACTOR_FLAG_10)
#define THIS ((BgIkanaDharma*)thisx)
void BgIkanaDharma_Init(Actor* thisx, PlayState* play);
void BgIkanaDharma_Init(Actor* thisx, PlayState* play2);
void BgIkanaDharma_Destroy(Actor* thisx, PlayState* play);
void BgIkanaDharma_Update(Actor* thisx, PlayState* play);
void BgIkanaDharma_Draw(Actor* thisx, PlayState* play);
@@ -226,11 +227,12 @@ void BgIkanaDharma_Update(Actor* thisx, PlayState* play) {
Actor_MoveWithGravity(&this->dyna.actor);
Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4);
if (this->dyna.actor.bgCheckFlags & 2) {
s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 21536);
Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 12);
Quake_SetSpeed(quake, 21536);
Quake_SetQuakeValues(quake, 4, 0, 0, 0);
Quake_SetCountdown(quake, 12);
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
}
} else {
@@ -16,7 +16,7 @@
#define THIS ((BgIkanaMirror*)thisx)
void BgIkanaMirror_Init(Actor* thisx, PlayState* play);
void BgIkanaMirror_Init(Actor* thisx, PlayState* play2);
void BgIkanaMirror_Destroy(Actor* thisx, PlayState* play);
void BgIkanaMirror_Update(Actor* thisx, PlayState* play);
void BgIkanaMirror_Draw(Actor* thisx, PlayState* play);
@@ -5,6 +5,7 @@
*/
#include "z_bg_ikana_rotaryroom.h"
#include "z64quake.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"
@@ -831,11 +832,11 @@ void func_80B81A80(Actor* thisx, PlayState* play) {
func_80B81B84(this);
} else if (this->unk_584 == 15) {
s16 sp26 = Quake_Add(GET_ACTIVE_CAM(play), 3);
s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(sp26, 0x7B30);
Quake_SetQuakeValues(sp26, 6, 0, 100, 0);
Quake_SetCountdown(sp26, 22);
Quake_SetSpeed(quakeIndex, 31536);
Quake_SetQuakeValues(quakeIndex, 6, 0, 100, 0);
Quake_SetCountdown(quakeIndex, 22);
}
}
@@ -858,11 +859,11 @@ void func_80B81BA0(Actor* thisx, PlayState* play) {
thisx->shape.rot.x += 0x1F4;
if (!(this->unk_584 & 7)) {
s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quake, 0x7B30);
Quake_SetQuakeValues(quake, (s32)(Rand_ZeroOne() * 2.5f) + 3, 0, 10, 0);
Quake_SetCountdown(quake, 15);
Quake_SetSpeed(quakeIndex, 31536);
Quake_SetQuakeValues(quakeIndex, (s32)(Rand_ZeroOne() * 2.5f) + 3, 0, 10, 0);
Quake_SetCountdown(quakeIndex, 15);
}
if (Flags_GetSwitch(play, BGIKANAROTARYROOM_GET_FE(&this->dyna.actor))) {
@@ -928,11 +929,11 @@ void func_80B81DC8(Actor* thisx, PlayState* play) {
ActorCutscene_Stop(this->dyna.actor.cutscene);
func_80B818B4(this);
} else if (this->unk_584 == 19) {
s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quake, 0x4E20);
Quake_SetQuakeValues(quake, 5, 0, 40, 60);
Quake_SetCountdown(quake, 17);
Quake_SetSpeed(quakeIndex, 20000);
Quake_SetQuakeValues(quakeIndex, 5, 0, 40, 60);
Quake_SetCountdown(quakeIndex, 17);
}
}
@@ -5,6 +5,7 @@
*/
#include "z_bg_ikana_shutter.h"
#include "z64quake.h"
#include "objects/object_ikana_obj/object_ikana_obj.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -144,16 +145,17 @@ void func_80BD59F8(BgIkanaShutter* this) {
void func_80BD5A18(BgIkanaShutter* this, PlayState* play) {
s32 pad[2];
s16 quake;
s16 quakeIndex;
this->dyna.actor.velocity.y += -5.0f;
this->dyna.actor.velocity.y *= 0.978f;
this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y;
if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) {
quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
Quake_SetSpeed(quake, 0x5420);
Quake_SetQuakeValues(quake, 4, 0, 0, 0);
Quake_SetCountdown(quake, 12);
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 21536);
Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 12);
func_80BD5828(this);
}
}
@@ -5,6 +5,7 @@
*/
#include "z_bg_iknin_susceil.h"
#include "z64quake.h"
#include "z64rumble.h"
#include "objects/object_ikninside_obj/object_ikninside_obj.h"
@@ -70,11 +71,12 @@ void func_80C0A838(BgIkninSusceil* this, PlayState* play) {
void func_80C0A86C(BgIkninSusceil* this, PlayState* play, s16 verticalMag, s16 countdown, s32 arg4) {
s32 pad;
s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 31536);
Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0);
Quake_SetCountdown(quakeIndex, countdown);
Quake_SetSpeed(quake, 0x7B30);
Quake_SetQuakeValues(quake, verticalMag, 0, 0, 0);
Quake_SetCountdown(quake, countdown);
if (arg4 == 1) {
Rumble_Request(SQ(100.0f), 255, 20, 150);
} else if (arg4 == 2) {
@@ -131,7 +131,7 @@ void BgIknvObj_UpdateWaterwheel(BgIknvObj* this, PlayState* play) {
func_800B9010(&this->dyna.actor, NA_SE_EV_WOOD_WATER_WHEEL - SFX_FLAG);
}
if ((play->csCtx.state != 0) && (gSaveContext.sceneSetupIndex == 1) && (play->csCtx.currentCsIndex == 4) &&
if ((play->csCtx.state != 0) && (gSaveContext.sceneLayer == 1) && (play->csCtx.currentCsIndex == 4) &&
(play->csCtx.frames == 1495)) {
func_8019F128(NA_SE_EV_DOOR_UNLOCK);
}
@@ -11,7 +11,7 @@
#define THIS ((BgIngate*)thisx)
void BgIngate_Init(Actor* thisx, PlayState* play);
void BgIngate_Init(Actor* thisx, PlayState* play2);
void BgIngate_Destroy(Actor* thisx, PlayState* play);
void BgIngate_Update(Actor* thisx, PlayState* play);
void BgIngate_Draw(Actor* thisx, PlayState* play);
@@ -120,19 +120,12 @@ static InitChainEntry sInitChain[] = {
};
s32 BgKin2Fence_CheckHitMask(BgKin2Fence* this) {
ColliderJntSphElement* elements = this->collider.elements;
s32 i;
if (elements[0].info.bumperFlags & BUMP_HIT) {
return 0;
}
if (elements[1].info.bumperFlags & BUMP_HIT) {
return 1;
}
if (elements[2].info.bumperFlags & BUMP_HIT) {
return 2;
}
if (elements[3].info.bumperFlags & BUMP_HIT) {
return 3;
for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) {
if (this->collider.elements[i].info.bumperFlags & BUMP_HIT) {
return i;
}
}
return -1;
}
@@ -25,7 +25,7 @@ typedef struct {
void BgLastBwall_Init(Actor* thisx, PlayState* play);
void BgLastBwall_Destroy(Actor* thisx, PlayState* play);
void BgLastBwall_Update(Actor* thisx, PlayState* play);
void BgLastBwall_Draw(Actor* thisx, PlayState* play);
void BgLastBwall_Draw(Actor* thisx, PlayState* play2);
void BgLastBwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, ColliderTris* collider,
BgLastBwallInitColliderStruct* arg4);
@@ -15,7 +15,7 @@
void BgNumaHana_Init(Actor* thisx, PlayState* play);
void BgNumaHana_Destroy(Actor* thisx, PlayState* play);
void BgNumaHana_Update(Actor* thisx, PlayState* play);
void BgNumaHana_Draw(Actor* thisx, PlayState* play);
void BgNumaHana_Draw(Actor* thisx, PlayState* play2);
void BgNumaHana_SetupDoNothing(BgNumaHana* this);
void BgNumaHana_DoNothing(BgNumaHana* this, PlayState* play);
@@ -6,6 +6,7 @@
#include "z_bg_open_shutter.h"
#include "objects/object_open_obj/object_open_obj.h"
#include "z64quake.h"
#include "z64rumble.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -14,7 +15,7 @@
void BgOpenShutter_Init(Actor* thisx, PlayState* play);
void BgOpenShutter_Destroy(Actor* thisx, PlayState* play);
void BgOpenShutter_Update(Actor* thisx, PlayState* play);
void BgOpenShutter_Update(Actor* thisx, PlayState* play2);
void BgOpenShutter_Draw(Actor* thisx, PlayState* play);
void func_80ACAD88(BgOpenShutter* this, PlayState* play);
@@ -105,7 +106,7 @@ void BgOpenShutter_Destroy(Actor* thisx, PlayState* play) {
}
void func_80ACAD88(BgOpenShutter* this, PlayState* play) {
s32 quake;
s32 doorDirection;
if (this->unk_15C != 0) {
Player* player = GET_PLAYER(play);
@@ -118,10 +119,10 @@ void func_80ACAD88(BgOpenShutter* this, PlayState* play) {
} else {
Player* player = GET_PLAYER(play);
quake = func_80ACABA8(this, play);
if (quake > 0) {
doorDirection = func_80ACABA8(this, play);
if (doorDirection > 0) {
player->doorType = 2;
player->doorDirection = quake;
player->doorDirection = doorDirection;
player->doorActor = &this->dyna.actor;
func_80122F28(player);
}
@@ -142,18 +143,21 @@ void func_80ACAE5C(BgOpenShutter* this, PlayState* play) {
void func_80ACAEF0(BgOpenShutter* this, PlayState* play) {
s32 pad;
s16 quake;
s16 quakeIndex;
Math_StepToF(&this->dyna.actor.velocity.y, 20.0f, 8.0f);
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) {
this->dyna.actor.floorHeight = this->dyna.actor.home.pos.y;
Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 60.0f, 10, 8.0f, 500, 10, true);
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND);
quake = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3);
Quake_SetSpeed(quake, -0x7F18);
Quake_SetQuakeValues(quake, 2, 0, 0, 0);
Quake_SetCountdown(quake, 10);
quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -32536);
Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 10);
Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100);
this->unk_15C = 0;
this->actionFunc = func_80ACAD88;
}
@@ -6,6 +6,7 @@
#include "z_boss_01.h"
#include "z64rumble.h"
#include "z64shrink_window.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20)
+4 -3
View File
@@ -6,6 +6,7 @@
#include "z_boss_02.h"
#include "z64rumble.h"
#include "z64shrink_window.h"
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -17,7 +18,7 @@
void Boss02_Init(Actor* thisx, PlayState* play);
void Boss02_Destroy(Actor* thisx, PlayState* play);
void Boss02_Twinmold_Update(Actor* thisx, PlayState* play);
void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play);
void Boss02_Twinmold_Draw(Actor* thisx, PlayState* play2);
void func_809DAA74(Boss02* this, PlayState* play);
void func_809DAA98(Boss02* this, PlayState* play);
@@ -2033,7 +2034,7 @@ void func_809DD934(Boss02* this, PlayState* play) {
Matrix_RotateZF(this->unk_1D54, MTXMODE_APPLY);
Matrix_MultVecY(1.0f, &this->subCamUp);
Play_SetCameraAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp);
ShrinkWindow_SetLetterboxTarget(27);
ShrinkWindow_Letterbox_SetSizeTarget(27);
}
}
@@ -2241,6 +2242,6 @@ void func_809DEAC4(Boss02* this, PlayState* play) {
Play_SetCameraAtEyeUp(play, this->subCamId, &this->subCamAt, &subCamEye, &this->subCamUp);
this->subCamUp.z = this->subCamUp.x = 0.0f;
this->subCamUp.y = 1.0f;
ShrinkWindow_SetLetterboxTarget(27);
ShrinkWindow_Letterbox_SetSizeTarget(27);
}
}
+3 -4
View File
@@ -52,7 +52,6 @@
* - Effect Update/Draw
* - Seaweed
*/
#include "prevent_bss_reordering.h"
#include "z_boss_03.h"
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
@@ -78,9 +77,9 @@
#define PLATFORM_HEIGHT 440.0f
#define WATER_HEIGHT 430.0f
void Boss03_Init(Actor* thisx, PlayState* play);
void Boss03_Init(Actor* thisx, PlayState* play2);
void Boss03_Destroy(Actor* thisx, PlayState* play);
void Boss03_Update(Actor* thisx, PlayState* play);
void Boss03_Update(Actor* thisx, PlayState* play2);
void Boss03_Draw(Actor* thisx, PlayState* play);
void func_809E344C(Boss03* this, PlayState* play);
@@ -2156,7 +2155,7 @@ void Boss03_SetObject(PlayState* play, s16 objectId) {
OPEN_DISPS(play->state.gfxCtx);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIndex].segment);
gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[objectIndex].segment);
+6 -5
View File
@@ -5,14 +5,15 @@
*/
#include "z_boss_04.h"
#include "z64shrink_window.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20)
#define THIS ((Boss04*)thisx)
void Boss04_Init(Actor* thisx, PlayState* play);
void Boss04_Init(Actor* thisx, PlayState* play2);
void Boss04_Destroy(Actor* thisx, PlayState* play);
void Boss04_Update(Actor* thisx, PlayState* play);
void Boss04_Update(Actor* thisx, PlayState* play2);
void Boss04_Draw(Actor* thisx, PlayState* play);
void func_809EC544(Boss04* this);
@@ -399,7 +400,7 @@ void func_809EC568(Boss04* this, PlayState* play) {
if (this->subCamId != SUB_CAM_ID_DONE) {
Vec3f subCamAt;
ShrinkWindow_SetLetterboxTarget(27);
ShrinkWindow_Letterbox_SetSizeTarget(27);
if (this->subCamAtOscillator != 0) {
this->subCamAtOscillator--;
}
@@ -521,7 +522,7 @@ void func_809ED224(Boss04* this) {
this->unk_2C8 = 200;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_ME_DEAD);
this->actor.flags &= ~ACTOR_FLAG_1;
func_801A2ED8();
Audio_RestorePrevBgm();
this->unk_1F6 = 10;
}
@@ -759,7 +760,7 @@ void Boss04_Update(Actor* thisx, PlayState* play2) {
if (D_809EE4D0 != 0) {
D_809EE4D0--;
if (D_809EE4D0 == 0) {
func_801A2E54(0x38);
Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS);
}
}
+3 -2
View File
@@ -6,6 +6,7 @@
#include "prevent_bss_reordering.h"
#include "z_boss_06.h"
#include "z64shrink_window.h"
#include "overlays/actors/ovl_En_Knight/z_en_knight.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/object_knight/object_knight.h"
@@ -17,7 +18,7 @@
void Boss06_Init(Actor* thisx, PlayState* play);
void Boss06_Destroy(Actor* thisx, PlayState* play);
void Boss06_Update(Actor* thisx, PlayState* play);
void Boss06_Draw(Actor* thisx, PlayState* play);
void Boss06_Draw(Actor* thisx, PlayState* play2);
void func_809F24A8(Boss06* this);
void func_809F24C8(Boss06* this, PlayState* play);
@@ -339,7 +340,7 @@ void func_809F24C8(Boss06* this, PlayState* play) {
}
if (this->subCamId != SUB_CAM_ID_DONE) {
ShrinkWindow_SetLetterboxTarget(27);
ShrinkWindow_Letterbox_SetSizeTarget(27);
Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye);
}
}
@@ -5,6 +5,7 @@
*/
#include "z_boss_07.h"
#include "z64shrink_window.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20)
@@ -5,6 +5,7 @@
*/
#include "z_boss_hakugin.h"
#include "z64quake.h"
#include "z64rumble.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20)
@@ -508,7 +508,7 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, PlayState* play2) {
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20);
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(gSun1Tex));
gSPDisplayList(POLY_XLU_DISP++, gameplay_keep_DL_07AB10);
gSPDisplayList(POLY_XLU_DISP++, gSunSparkleMaterialDL);
for (i = 0; i < play->envCtx.unk_F2[3]; i++) {
worldPos.x = this->effects[i].posBase.x + this->effects[i].posOffset.x;
@@ -575,7 +575,7 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, PlayState* play2) {
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_07AB58);
gSPDisplayList(POLY_XLU_DISP++, gSunSparkleModelDL);
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ void DmAn_Update(Actor* thisx, PlayState* play);
void func_80C1C958(DmAn* this, PlayState* play);
void func_80C1CAB0(DmAn* this, PlayState* play);
void func_80C1CC80(DmAn* this, PlayState* play);
void func_80C1D0B0(Actor* this, PlayState* play);
void func_80C1D0B0(Actor* thisx, PlayState* play);
const ActorInit Dm_An_InitVars = {
ACTOR_DM_AN,
+14 -14
View File
@@ -15,7 +15,7 @@
void DmChar00_Init(Actor* thisx, PlayState* play);
void DmChar00_Destroy(Actor* thisx, PlayState* play);
void DmChar00_Update(Actor* thisx, PlayState* play);
void DmChar00_Draw(Actor* thisx, PlayState* play);
void DmChar00_Draw(Actor* thisx, PlayState* play2);
void func_80AA67F8(DmChar00* this, PlayState* play);
void func_80AA695C(DmChar00* this, PlayState* play);
@@ -451,13 +451,13 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) {
if (play->csCtx.state != 0) {
switch (play->sceneId) {
case SCENE_LOST_WOODS:
if (gSaveContext.sceneSetupIndex == 1) {
if (gSaveContext.sceneLayer == 1) {
func_80AA561C(this, play);
}
break;
case SCENE_OPENINGDAN:
if (gSaveContext.sceneSetupIndex == 0) {
if (gSaveContext.sceneLayer == 0) {
if (play->csCtx.currentCsIndex == 0) {
func_80AA5720(this, play);
} else if (play->csCtx.currentCsIndex == 1) {
@@ -469,7 +469,7 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) {
break;
case SCENE_OKUJOU:
if (gSaveContext.sceneSetupIndex == 0) {
if (gSaveContext.sceneLayer == 0) {
if (play->csCtx.currentCsIndex == 0) {
func_80AA58CC(this, play);
} else if (play->csCtx.currentCsIndex == 1) {
@@ -477,7 +477,7 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) {
} else if (play->csCtx.currentCsIndex == 2) {
func_80AA5960(this, play);
}
} else if (gSaveContext.sceneSetupIndex == 2) {
} else if (gSaveContext.sceneLayer == 2) {
if (play->csCtx.currentCsIndex == 0) {
func_80AA59E4(this, play);
} else if (play->csCtx.currentCsIndex == 1) {
@@ -487,13 +487,13 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) {
break;
case SCENE_00KEIKOKU:
if (gSaveContext.sceneSetupIndex == 3) {
if (gSaveContext.sceneLayer == 3) {
if (play->csCtx.currentCsIndex == 0) {
func_80AA5AF4(this, play);
} else if (play->csCtx.currentCsIndex == 2) {
func_80AA5E2C(this, play);
}
} else if (gSaveContext.sceneSetupIndex == 7) {
} else if (gSaveContext.sceneLayer == 7) {
if (play->csCtx.currentCsIndex == 0) {
func_80AA5BF8(this, play);
} else if (play->csCtx.currentCsIndex == 1) {
@@ -503,19 +503,19 @@ void func_80AA5EBC(DmChar00* this, PlayState* play) {
break;
case SCENE_MITURIN:
if ((gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 1)) {
if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 1)) {
func_80AA5DC8(this, play);
}
break;
case SCENE_INSIDETOWER:
if ((gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 0)) {
if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0)) {
func_80AA5D10(this, play);
}
break;
case SCENE_PIRATE:
if ((gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 0)) {
if ((gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 0)) {
func_80AA5D6C(this, play);
}
break;
@@ -853,7 +853,7 @@ void func_80AA62FC(DmChar00* this, PlayState* play) {
void func_80AA67F8(DmChar00* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if ((play->csCtx.state == 0) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.currentCsIndex == 1)) {
if ((play->csCtx.state == 0) && (gSaveContext.sceneLayer == 0) && (play->csCtx.currentCsIndex == 1)) {
if (this->unk_261 != 42) {
this->unk_261 = 42;
func_80AA5580(&this->skelAnime, &sAnimationInfo[this->unk_261], 0);
@@ -914,9 +914,9 @@ void DmChar00_Draw(Actor* thisx, PlayState* play2) {
s32 pad;
Gfx* gfx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Gfx) * 4);
if ((play->csCtx.state == 0) && ((play->sceneId != SCENE_OPENINGDAN) || (gSaveContext.sceneSetupIndex != 0) ||
(play->roomCtx.curRoom.num != 0) || (play->csCtx.currentCsIndex != 1) ||
(DMCHAR00_GET(&this->actor) != DMCHAR00_0))) {
if ((play->csCtx.state == 0) &&
((play->sceneId != SCENE_OPENINGDAN) || (gSaveContext.sceneLayer != 0) || (play->roomCtx.curRoom.num != 0) ||
(play->csCtx.currentCsIndex != 1) || (DMCHAR00_GET(&this->actor) != DMCHAR00_0))) {
return;
}
@@ -14,7 +14,7 @@
void DmChar01_Init(Actor* thisx, PlayState* play);
void DmChar01_Destroy(Actor* thisx, PlayState* play);
void DmChar01_Update(Actor* thisx, PlayState* play);
void DmChar01_Update(Actor* thisx, PlayState* play2);
void DmChar01_Draw(Actor* thisx, PlayState* play);
void func_80AA8698(DmChar01* this, PlayState* play);
@@ -73,7 +73,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) {
break;
}
if (gSaveContext.sceneSetupIndex == 0) {
if (gSaveContext.sceneLayer == 0) {
play->envCtx.unk_1F = 5;
play->envCtx.unk_20 = 5;
}
@@ -87,7 +87,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_LoadMesh(play, &this->dyna, &gWoodfallSceneryPoisonWaterDamageCol);
this->unk_34D = true;
if (gSaveContext.sceneSetupIndex == 1) {
if (gSaveContext.sceneLayer == 1) {
this->unk_34C = 1;
this->actionFunc = func_80AA8C28;
} else {
@@ -97,7 +97,7 @@ void DmChar01_Init(Actor* thisx, PlayState* play) {
break;
case DMCHAR01_1:
if ((gSaveContext.save.weekEventReg[20] & 2) || (gSaveContext.sceneSetupIndex == 1)) {
if ((gSaveContext.save.weekEventReg[20] & 2) || (gSaveContext.sceneLayer == 1)) {
this->unk_34C = 1;
this->actionFunc = func_80AA8F1C;
} else {
@@ -411,7 +411,7 @@ void DmChar01_Draw(Actor* thisx, PlayState* play) {
break;
case 1:
if (gSaveContext.sceneSetupIndex == 1) {
if (gSaveContext.sceneLayer == 1) {
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(&gWoodfallSceneryPurifiedWaterTexAnim));
Gfx_DrawDListOpa(play, gWoodfallSceneryFloorDL);
Gfx_DrawDListXlu(play, gWoodfallSceneryPurifiedWaterDL);
@@ -545,7 +545,7 @@ void func_80AAD4A8(DmChar05* this, PlayState* play) {
}
} else if (DMCHAR05_GET(&this->actor) == DMCHAR05_3) {
if (play->sceneId == SCENE_OKUJOU) {
if (gSaveContext.sceneSetupIndex == 2) {
if (gSaveContext.sceneLayer == 2) {
if (play->csCtx.currentCsIndex == 0) {
func_80AAD3F8(this, play);
} else if (play->csCtx.currentCsIndex == 1) {
@@ -553,11 +553,11 @@ void func_80AAD4A8(DmChar05* this, PlayState* play) {
}
}
} else if (play->sceneId == SCENE_SPOT00) {
if (gSaveContext.sceneSetupIndex == 9) {
if (gSaveContext.sceneLayer == 9) {
if ((play->csCtx.currentCsIndex == 0) && (play->csCtx.frames == 255)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER);
}
} else if ((gSaveContext.sceneSetupIndex == 0xB) && (play->csCtx.frames == 115)) {
} else if ((gSaveContext.sceneLayer == 0xB) && (play->csCtx.frames == 115)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EVIL_POWER_PREDEMO);
}
}
@@ -95,7 +95,7 @@ void DmOpstage_Update(Actor* thisx, PlayState* play) {
DmOpstage* this = THIS;
this->actionFunc(this, play);
if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneSetupIndex == 0) && (play->csCtx.frames == 480)) {
if ((play->sceneId == SCENE_SPOT00) && (gSaveContext.sceneLayer == 0) && (play->csCtx.frames == 480)) {
// This actor is responsible for playing the fairy sound during the exposition in the intro,
// during the transition to Lost Woods, before Ocarina gets stolen.
func_8019F128(NA_SE_EV_NAVY_FLY_REBIRTH);
+25 -25
View File
@@ -311,7 +311,7 @@ void DmStk_LoadObjectForAnimation(DmStk* this, PlayState* play) {
}
if (objectIndex >= 0) {
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[objectIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIndex].segment);
}
}
@@ -670,7 +670,7 @@ void DmStk_PlaySfxForPlayingWithFairiesCutscene(DmStk* this, PlayState* play) {
void DmStk_PlaySfxForEndingCutsceneFirstPart(DmStk* this, PlayState* play) {
switch (play->csCtx.frames) {
case 5:
func_801A4A28(12);
Audio_PlayAmbience(AMBIENCE_ID_0C);
break;
case 660:
@@ -688,7 +688,7 @@ void DmStk_PlaySfxForEndingCutsceneSecondPart(DmStk* this, PlayState* play) {
switch (play->csCtx.frames) {
case 5:
func_801A4A28(12);
Audio_PlayAmbience(AMBIENCE_ID_0C);
break;
case 45:
@@ -919,23 +919,23 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) {
if (play->csCtx.state != 0) {
switch (play->sceneId) {
case SCENE_LOST_WOODS:
if (gSaveContext.sceneSetupIndex == 1) {
if (gSaveContext.sceneLayer == 1) {
DmStk_PlaySfxForIntroCutsceneFirstPart(this, play);
} else if (gSaveContext.sceneSetupIndex == 0) {
} else if (gSaveContext.sceneLayer == 0) {
DmStk_PlaySfxForIntroCutsceneSecondPart(this, play);
} else if ((gSaveContext.sceneSetupIndex == 2) && (play->csCtx.currentCsIndex == 0)) {
} else if ((gSaveContext.sceneLayer == 2) && (play->csCtx.currentCsIndex == 0)) {
DmStk_PlaySfxForObtainingMajorasMaskCutscene(this, play);
}
break;
case SCENE_CLOCKTOWER:
if (gSaveContext.sceneSetupIndex == 1) {
if (gSaveContext.sceneLayer == 1) {
DmStk_PlaySfxForTitleCutscene(this, play);
}
break;
case SCENE_OPENINGDAN:
if (gSaveContext.sceneSetupIndex == 0) {
if (gSaveContext.sceneLayer == 0) {
if (play->csCtx.currentCsIndex == 0) {
DmStk_PlaySfxForCurseCutsceneFirstPart(this, play);
} else if (play->csCtx.currentCsIndex == 1) {
@@ -945,7 +945,7 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) {
break;
case SCENE_OKUJOU:
if (gSaveContext.sceneSetupIndex == 0) {
if (gSaveContext.sceneLayer == 0) {
if (play->csCtx.currentCsIndex == 0) {
DmStk_PlaySfxForClockTowerIntroCutsceneVersion1(this, play);
} else if (play->csCtx.currentCsIndex == 1) {
@@ -955,7 +955,7 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) {
} else if (play->csCtx.currentCsIndex == 3) {
DmStk_PlaySfxForCutsceneAfterPlayingOathToOrder(this, play);
}
} else if (gSaveContext.sceneSetupIndex == 2) {
} else if (gSaveContext.sceneLayer == 2) {
if (play->csCtx.currentCsIndex == 0) {
DmStk_PlaySfxForMoonWarpCutsceneVersion1(this, play);
} else if (play->csCtx.currentCsIndex == 1) {
@@ -965,13 +965,13 @@ void DmStk_PlaySfxForCutscenes(DmStk* this, PlayState* play) {
break;
case SCENE_00KEIKOKU:
if (gSaveContext.sceneSetupIndex == 3) {
if (gSaveContext.sceneLayer == 3) {
if (play->csCtx.currentCsIndex == 0) {
DmStk_PlaySfxForShiveringInRainCutscene(this, play);
} else if (play->csCtx.currentCsIndex == 2) {
DmStk_PlaySfxForPlayingWithFairiesCutscene(this, play);
}
} else if (gSaveContext.sceneSetupIndex == 7) {
} else if (gSaveContext.sceneLayer == 7) {
if (play->csCtx.currentCsIndex == 0) {
DmStk_PlaySfxForEndingCutsceneFirstPart(this, play);
} else if (play->csCtx.currentCsIndex == 1) {
@@ -1028,7 +1028,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
this->fogG = play->lightCtx.unk8;
this->fogB = play->lightCtx.unk9;
if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) {
if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneLayer == 1)) {
this->alpha = 0;
this->fogN = 0;
this->fogF = 1000;
@@ -1044,7 +1044,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->collider);
if (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_ROOFTOP, 0)) {
if (gSaveContext.sceneSetupIndex == 0) {
if (gSaveContext.sceneLayer == 0) {
if (gSaveContext.timerStates[TIMER_ID_MOON_CRASH] == TIMER_STATE_OFF) {
// Starts a 5 minute (300 second) timer until the moon falls.
Interface_StartTimer(TIMER_ID_MOON_CRASH, 300);
@@ -1060,7 +1060,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
this->actionFunc = DmStk_ClockTower_StartIntroCutsceneVersion2;
}
} else if (gSaveContext.sceneSetupIndex == 3) {
} else if (gSaveContext.sceneLayer == 3) {
this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED;
if (gSaveContext.timerStates[TIMER_ID_MOON_CRASH] == TIMER_STATE_OFF) {
// This code is called when the Giants fail to stop the moon.
@@ -1088,7 +1088,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
} else if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 0)) {
} else if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 0)) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
Actor_MarkForDeath(&this->actor);
}
@@ -1127,7 +1127,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
Actor_SetScale(&this->actor, 0.01f);
if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && (play->csCtx.currentCsIndex > 0)) {
if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 3) && (play->csCtx.currentCsIndex > 0)) {
play->envCtx.unk_17 = 15;
play->envCtx.unk_18 = 15;
}
@@ -1684,7 +1684,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) {
this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK;
} else if (((this->animIndex >= SK_ANIM_HUDDLE_WITH_FAIRIES) && (this->animIndex <= SK_ANIM_DRAW)) ||
((this->animIndex >= SK_ANIM_PLAY_FLUTE) && (this->animIndex <= SK_ANIM_CARTWHEEL)) ||
((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 7))) {
((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 7))) {
this->maskType = SK_MASK_TYPE_NO_MASK;
if ((this->animIndex == SK_ANIM_HOLD_UP_MASK_START) || (this->animIndex == SK_ANIM_HOLD_UP_MASK_LOOP)) {
this->handType = SK_HAND_TYPE_HOLDING_MAJORAS_MASK_AND_FLUTE;
@@ -1823,7 +1823,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) {
}
}
if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 3) && (play->csCtx.currentCsIndex > 0)) {
if ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 3) && (play->csCtx.currentCsIndex > 0)) {
play->envCtx.unk_17 = 15;
play->envCtx.unk_18 = 15;
}
@@ -1886,7 +1886,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
break;
case SK_MASK_TYPE_NORMAL:
if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1) &&
if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneLayer == 1) &&
(play->csCtx.frames < 1400)) {
if (this->fogN == this->fogF) {
this->fogF = this->fogN;
@@ -1909,13 +1909,13 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
(this->objectStk2ObjectIndex >= 0)) {
Matrix_Push();
Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectStk2ObjectIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectStk2ObjectIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objectStk2ObjectIndex].segment);
AnimatedMat_Draw(play, Lib_SegmentedToVirtual(gSkullKidMajorasMaskCurseOverlayTexAnim));
Gfx_DrawDListOpa(play, gSkullKidMajorasMaskCurseOverlayDL);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectStkObjectIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectStkObjectIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objectStkObjectIndex].segment);
@@ -1948,7 +1948,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
case SK_HAND_TYPE_HOLDING_OCARINA:
gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaHoldingRightHand);
if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneSetupIndex == 1)) {
if ((play->sceneId == SCENE_LOST_WOODS) && (gSaveContext.sceneLayer == 1)) {
gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaOfTimeDL);
}
break;
@@ -1986,7 +1986,7 @@ void DmStk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
break;
case SK_HAND_TYPE_HOLDING_OCARINA:
if ((play->sceneId != SCENE_LOST_WOODS) || (gSaveContext.sceneSetupIndex != 1)) {
if ((play->sceneId != SCENE_LOST_WOODS) || (gSaveContext.sceneLayer != 1)) {
gSPDisplayList(POLY_OPA_DISP++, gSkullKidOcarinaOfTimeDL);
}
gSPDisplayList(POLY_OPA_DISP++, gSkullKidTwoFingersExtendedLeftHand);
@@ -2027,7 +2027,7 @@ void DmStk_Draw(Actor* thisx, PlayState* play) {
return;
}
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->objectStkObjectIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectStkObjectIndex].segment);
OPEN_DISPS(play->state.gfxCtx);
+220 -15
View File
@@ -18,7 +18,6 @@ void func_80C229AC(DmTag* this, PlayState* play);
void func_80C229EC(DmTag* this, PlayState* play);
void func_80C229FC(DmTag* this, PlayState* play);
#if 0
const ActorInit Dm_Tag_InitVars = {
ACTOR_DM_TAG,
ACTORCAT_ITEMACTION,
@@ -31,30 +30,236 @@ const ActorInit Dm_Tag_InitVars = {
(ActorFunc)NULL,
};
#endif
s32 D_80C22BF0[] = {
0x0E28F00C,
0x15090000,
0x10000000,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/func_80C22350.s")
s32 D_80C22BFC[] = {
0x0900000E, 0x28F10C09, 0x00000E28, 0xF20C0900, 0x000E28F3, 0x0C090000, 0x0E28F40C,
0x0900000E, 0x28F50C09, 0x00000E28, 0xF60C1511, 0x55040900, 0x00100000,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/func_80C22400.s")
s32 D_80C22C30[] = {
0x0E28EF0C,
0x10000000,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/func_80C2247C.s")
Actor* func_80C22350(DmTag* this, PlayState* play, u8 actorCat, s16 actorId) {
Actor* foundActor = NULL;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/func_80C224D8.s")
while (true) {
foundActor = SubS_FindActor(play, foundActor, actorCat, actorId);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/func_80C227E8.s")
if ((foundActor == NULL) || (((this != (DmTag*)foundActor)) && (foundActor->update != NULL))) {
break;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/func_80C22880.s")
if (foundActor->next == NULL) {
foundActor = NULL;
break;
}
foundActor = foundActor->next;
}
return foundActor;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/func_80C2291C.s")
s32 func_80C22400(DmTag* this, s16 arg1) {
s32 ret = false;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/func_80C229AC.s")
if (ActorCutscene_GetCurrentIndex() == 0x7C) {
ActorCutscene_Stop(0x7C);
ActorCutscene_SetIntentToPlay(arg1);
} else if (ActorCutscene_GetCanPlayNext(arg1)) {
ActorCutscene_StartAndSetUnkLinkFields(arg1, &this->actor);
ret = true;
} else {
ActorCutscene_SetIntentToPlay(arg1);
}
return ret;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/func_80C229EC.s")
s16 func_80C2247C(DmTag* this, s32 arg1) {
s32 i;
s16 cs = this->actor.cutscene;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/func_80C229FC.s")
for (i = 0; i < arg1; i++) {
cs = ActorCutscene_GetAdditionalCutscene(cs);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/DmTag_Init.s")
return cs;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/DmTag_Destroy.s")
s32 func_80C224D8(DmTag* this, PlayState* play) {
s32 pad;
Actor* sp30;
Actor* sp2C;
s16 sp2A = this->actor.cutscene;
s32 ret = false;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Dm_Tag/DmTag_Update.s")
sp30 = func_80C22350(this, play, ACTORCAT_NPC, ACTOR_EN_AN);
sp2C = func_80C22350(this, play, ACTORCAT_NPC, ACTOR_EN_AH);
switch (this->unk_1A4) {
case 0:
if (func_80C22400(this, sp2A)) {
if ((sp2C != NULL) && (sp2C->update != NULL)) {
Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(sp2A)), sp2C);
}
this->unk_1A4++;
ret = true;
}
break;
case 1:
if ((sp30 != NULL) && (sp30->update != NULL)) {
Camera_SetTargetActor(Play_GetCamera(play, ActorCutscene_GetCurrentSubCamId(func_80C2247C(this, 0))),
sp30);
}
this->unk_1A4++;
ret = true;
break;
case 2:
ActorCutscene_Stop(func_80C2247C(this, 0));
if (func_80C22400(this, func_80C2247C(this, 1))) {
this->unk_1A4++;
ret = true;
}
break;
case 3:
ActorCutscene_Stop(func_80C2247C(this, 1));
if (func_80C22400(this, func_80C2247C(this, 2))) {
this->unk_1A4++;
ret = true;
}
break;
case 4:
ActorCutscene_Stop(func_80C2247C(this, 2));
if (func_80C22400(this, func_80C2247C(this, 3))) {
this->unk_1A4++;
ret = true;
}
break;
case 5:
ActorCutscene_Stop(func_80C2247C(this, 3));
if (func_80C22400(this, func_80C2247C(this, 4))) {
this->unk_1A4++;
ret = true;
}
break;
case 6:
func_800B7298(play, &this->actor, 7);
play->nextEntrance = ENTRANCE(STOCK_POT_INN, 5);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_BLACK;
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK_SLOW;
this->unk_1A4++;
break;
}
return ret;
}
s32 func_80C227E8(DmTag* this, PlayState* play) {
if (this->unk_1A4 == 0) {
func_800B7298(play, &this->actor, 7);
play->nextEntrance = ENTRANCE(STOCK_POT_INN, 4);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_BLACK;
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK_SLOW;
this->unk_1A4++;
}
return false;
}
s32* func_80C22880(DmTag* this, PlayState* play) {
s32 time;
switch (this->unk_18E) {
case 1:
time = gSaveContext.save.time - 0x3FFC;
if ((time >= 0xA54B) && (time < 0xB54A) && (gSaveContext.save.day == 2)) {
this->msgEventCallback = func_80C227E8;
return D_80C22BF0;
}
return D_80C22C30;
case 2:
this->msgEventCallback = func_80C224D8;
return D_80C22BFC;
}
return NULL;
}
s32 func_80C2291C(DmTag* this, PlayState* play) {
s32 ret = false;
if (this->unk_18C & 7) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
this->unk_18C |= 8;
SubS_UpdateFlags(&this->unk_18C, 0, 7);
this->msgEventScript = func_80C22880(this, play);
this->actionFunc = func_80C229FC;
ret = true;
}
}
return ret;
}
void func_80C229AC(DmTag* this, PlayState* play) {
SubS_UpdateFlags(&this->unk_18C, 3, 7);
this->actor.flags |= ACTOR_FLAG_1;
}
void func_80C229EC(DmTag* this, PlayState* play) {
}
void func_80C229FC(DmTag* this, PlayState* play) {
if (func_8010BF58(&this->actor, play, this->msgEventScript, this->msgEventCallback, &this->msgEventArg4)) {
this->actionFunc = func_80C229AC;
}
}
void DmTag_Init(Actor* thisx, PlayState* play) {
DmTag* this = (DmTag*)thisx;
Player* player = GET_PLAYER(play);
if (gSaveContext.save.weekEventReg[85] & 4) {
Actor_MarkForDeath(&this->actor);
return;
}
if ((play->sceneId == SCENE_YADOYA) && (play->curSpawn == 4)) {
player->stateFlags1 |= PLAYER_STATE1_20;
this->unk_18E = 2;
this->unk_18C = 0;
SubS_UpdateFlags(&this->unk_18C, 4, 7);
this->actor.flags &= ~ACTOR_FLAG_1;
this->actionFunc = func_80C229EC;
} else if (this->actor.room == 2) {
Actor_MarkForDeath(&this->actor);
} else {
this->actor.targetMode = 1;
this->unk_18E = 1;
this->unk_18C = 0;
this->actionFunc = func_80C229AC;
}
}
void DmTag_Destroy(Actor* thisx, PlayState* play) {
}
void DmTag_Update(Actor* thisx, PlayState* play) {
DmTag* this = THIS;
func_80C2291C(this, play);
this->actionFunc(this, play);
func_8013C964(&this->actor, play, 40.0f, fabsf(this->actor.playerHeightRel) + 1.0f, 0, this->unk_18C & 7);
Actor_SetFocus(&this->actor, 0.0f);
}
+9 -2
View File
@@ -6,12 +6,19 @@
struct DmTag;
typedef void (*DmTagActionFunc)(struct DmTag*, PlayState*);
typedef s32 (*DmTagMsgEventFunc)(struct DmTag*, PlayState*);
typedef struct DmTag {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x44];
/* 0x144 */ UNK_TYPE1 pad144[0x44];
/* 0x188 */ DmTagActionFunc actionFunc;
/* 0x18C */ char unk_18C[0x20];
/* 0x18C */ u16 unk_18C;
/* 0x18E */ u8 unk_18E;
/* 0x190 */ s32* msgEventScript;
/* 0x194 */ s32 msgEventArg4;
/* 0x198 */ UNK_TYPE1 pad198[0xC];
/* 0x1A4 */ s16 unk_1A4;
/* 0x1A8 */ DmTagMsgEventFunc msgEventCallback;
} DmTag; // size = 0x1AC
extern const ActorInit Dm_Tag_InitVars;
@@ -5,6 +5,7 @@
*/
#include "z_door_shutter.h"
#include "z64quake.h"
#include "z64rumble.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/object_bdoor/object_bdoor.h"
@@ -23,7 +24,7 @@
#define THIS ((DoorShutter*)thisx)
void DoorShutter_Init(Actor* thisx, PlayState* play);
void DoorShutter_Init(Actor* thisx, PlayState* play2);
void DoorShutter_Destroy(Actor* thisx, PlayState* play);
void DoorShutter_Update(Actor* thisx, PlayState* play);
@@ -538,7 +539,7 @@ void func_808A1784(DoorShutter* this, PlayState* play) {
} else {
DoorShutter_SetupAction(this, func_808A1090);
}
func_801A2ED8();
Audio_RestorePrevBgm();
}
}
@@ -600,7 +601,7 @@ s32 func_808A1A70(DoorShutter* this) {
}
void func_808A1B48(DoorShutter* this, PlayState* play) {
s16 quake;
s16 quakeIndex;
if (func_808A1A70(this)) {
if (this->actor.velocity.y > 20.0f) {
@@ -608,11 +609,14 @@ void func_808A1B48(DoorShutter* this, PlayState* play) {
Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 45.0f, 10, 8.0f, 500, 10, 0);
}
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BIGWALL_BOUND);
quake = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3);
Quake_SetSpeed(quake, -32536);
Quake_SetQuakeValues(quake, 2, 0, 0, 0);
Quake_SetCountdown(quake, 10);
quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -32536);
Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 10);
Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100);
func_808A1884(this, play);
}
}
@@ -21,8 +21,8 @@ void func_80918D64(EffDust* this, PlayState* play);
void func_80918FE4(EffDust* this, PlayState* play);
void func_80919230(EffDust* this, PlayState* play);
void func_80919768(Actor* thisx, PlayState* play);
void func_809199FC(Actor* thisx, PlayState* play);
void func_80919768(Actor* thisx, PlayState* play2);
void func_809199FC(Actor* thisx, PlayState* play2);
const ActorInit Eff_Dust_InitVars = {
ACTOR_EFF_DUST,
@@ -71,7 +71,7 @@ void EffDust_Init(Actor* thisx, PlayState* play) {
this->dz = 0.8f;
this->scalingFactor = 0.5f;
break;
case EFF_DUST_TYPE_2:
case EFF_DUST_TYPE_SPIN_ATTACK_CHARGE:
case EFF_DUST_TYPE_3:
this->actionFunc = func_80919230;
this->actor.draw = func_809199FC;
@@ -203,7 +203,7 @@ void func_80919230(EffDust* this, PlayState* play) {
if (this->distanceTraveled[i] >= 1.0f) {
theta = randPlusMinusPoint5Scaled(0x10000);
switch (this->actor.params) {
case EFF_DUST_TYPE_2:
case EFF_DUST_TYPE_SPIN_ATTACK_CHARGE:
this->initialPositions[i].x = (Rand_ZeroOne() * 4500.0f) + 700.0f;
if (this->initialPositions[i].x > 3000.0f) {
this->initialPositions[i].y = (3000.0f * Rand_ZeroOne()) * Math_SinS(theta);
@@ -24,7 +24,7 @@ typedef struct EffDust {
typedef enum {
/* 0x0 */ EFF_DUST_TYPE_0,
/* 0x1 */ EFF_DUST_TYPE_1,
/* 0x2 */ EFF_DUST_TYPE_2,
/* 0x2 */ EFF_DUST_TYPE_SPIN_ATTACK_CHARGE,
/* 0x3 */ EFF_DUST_TYPE_3,
/* 0x4 */ EFF_DUST_TYPE_4,
/* 0x5 */ EFF_DUST_TYPE_5
+1 -1
View File
@@ -35,7 +35,7 @@ void func_808B07A8(EnAm* this, PlayState* play);
void func_808B0820(EnAm* this);
void func_808B0894(EnAm* this, PlayState* play);
void func_808B0B4C(EnAm* this, PlayState* play);
void EnAm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* actor);
void EnAm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx);
const ActorInit En_Am_InitVars = {
ACTOR_EN_AM,
+8 -5
View File
@@ -6,6 +6,7 @@
*/
#include "z_en_ani.h"
#include "z64quake.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8)
@@ -209,7 +210,7 @@ void EnAni_LandOnFoot(EnAni* this, PlayState* play) {
void EnAni_FallToGround(EnAni* this, PlayState* play) {
s32 pad;
s16 quakeValue;
s16 quakeIndex;
if (this->actor.bgCheckFlags & 1) { // hit the ground
this->actor.flags &= ~ACTOR_FLAG_10;
@@ -219,10 +220,12 @@ void EnAni_FallToGround(EnAni* this, PlayState* play) {
// the animation gets cut short, (first 16 frames only) only the landing part is seen
Animation_Change(&this->skelAnime, &gAniLandingThenStandingUpAnim, 1.0f, 0.0f, 16.0f, ANIMMODE_ONCE, 0.0f);
this->stateFlags |= ANI_STATE_WRITHING;
quakeValue = Quake_Add(play->cameraPtrs[CAM_ID_MAIN], 3);
Quake_SetSpeed(quakeValue, 0x6978);
Quake_SetQuakeValues(quakeValue, 7, 0, 0, 0);
Quake_SetCountdown(quakeValue, 0x14);
quakeIndex = Quake_Add(play->cameraPtrs[CAM_ID_MAIN], QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 27000);
Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 20);
Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_HAMMER_HIT);
}
@@ -671,7 +671,7 @@ void func_809C2730(EnAob01* this, PlayState* play) {
void func_809C2788(EnAob01* this, PlayState* play) {
this->unk_2D2 |= 0x20;
if (func_809C25E4(this, play)) {
if (func_801A8A50(0) != 0x41) {
if (Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) != NA_BGM_HORSE_GOAL) {
play->nextEntrance = ENTRANCE(DOGGY_RACETRACK, 1);
gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & (u8)~7) | 3;
play->transitionType = TRANS_TYPE_64;
+7 -7
View File
@@ -18,16 +18,16 @@ typedef struct {
/* 0x4 */ f32 unk_4;
} struct_80A98F94; // size = 0x8
void EnAz_Init(Actor* thisx, PlayState* play);
void EnAz_Destroy(Actor* thisx, PlayState* play);
void EnAz_Update(Actor* thisx, PlayState* play);
void EnAz_Draw(Actor* thisx, PlayState* play);
void EnAz_Init(Actor* thisx, PlayState* play2);
void EnAz_Destroy(Actor* thisx, PlayState* play2);
void EnAz_Update(Actor* thisx, PlayState* play2);
void EnAz_Draw(Actor* thisx, PlayState* play2);
void func_80A982E0(PlayState* play, ActorPathing* actorPathing);
void func_80A98414(EnAz* this, PlayState* play);
s32 func_80A98DA4(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
void func_80A98E48(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx);
void func_80A98EFC(EnAz* this, PlayState* play, u16 textId, s32 arg3, s32 arg4);
void func_80A98EFC(EnAz* this, PlayState* play, u16 textId, s32 animIndex, s32 brotherAnimIndex);
void func_80A98F94(struct_80A98F94* yData, f32 frame, f32* yInterp);
void func_80A95C5C(EnAz* this, PlayState* play);
@@ -1426,7 +1426,7 @@ void func_80A97AB4(EnAz* this, PlayState* play) {
if (play->msgCtx.choiceIndex == 0) {
func_8019F208();
play->msgCtx.msgMode = 0x44;
func_800FD750(NA_BGM_MINI_GAME_2);
func_800FD750(NA_BGM_TIMED_MINI_GAME);
func_80A94AB8(this, play, 1);
func_80A979DC(this, play);
} else {
@@ -1466,7 +1466,7 @@ void func_80A97C4C(EnAz* this, PlayState* play) {
func_80A97410(this, play);
if ((this->unk_2FA == 1) || (this->unk_2FA == 3) || (this->unk_2FA == 6) || (this->unk_2FA == 8)) {
gSaveContext.save.weekEventReg[24] &= (u8)~1;
func_800FD750(NA_BGM_MINI_GAME_2);
func_800FD750(NA_BGM_TIMED_MINI_GAME);
play->nextEntrance = Entrance_CreateFromSpawn(1);
gSaveContext.nextCutsceneIndex = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
@@ -262,8 +262,8 @@ s32 EnBba01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) {
OPEN_DISPS(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.headObjIndex].segment);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.headObjIndex].segment);
gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.headObjIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelLowerObjIndex].segment);
CLOSE_DISPS(play->state.gfxCtx);
}
if (limbIndex == BBA_LIMB_RIGHT_LOWER_ARM_ROOT) {
@@ -298,7 +298,7 @@ void EnBba01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro
if (limbIndex == BBA_LIMB_HEAD) {
OPEN_DISPS(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->enHy.skelUpperObjIndex].segment);
gSegments[0x06] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment);
gSegments[0x06] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->enHy.skelUpperObjIndex].segment);
CLOSE_DISPS(play->state.gfxCtx);
}
@@ -14,7 +14,7 @@
void EnBbfall_Init(Actor* thisx, PlayState* play);
void EnBbfall_Destroy(Actor* thisx, PlayState* play);
void EnBbfall_Update(Actor* thisx, PlayState* play);
void EnBbfall_Draw(Actor* thisx, PlayState* play);
void EnBbfall_Draw(Actor* thisx, PlayState* play2);
void EnBbfall_SetupWaitForPlayer(EnBbfall* this);
void EnBbfall_WaitForPlayer(EnBbfall* this, PlayState* play);
@@ -5,6 +5,7 @@
*/
#include "z_en_bigpamet.h"
#include "z64quake.h"
#include "z64rumble.h"
#include "overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -518,7 +519,7 @@ void func_80A28760(EnBigpamet* this) {
}
void func_80A287E8(EnBigpamet* this, PlayState* play) {
s16 quake;
s16 quakeIndex;
this->actor.shape.rot.y += 0x3B00;
func_800B9010(&this->actor, NA_SE_EN_B_PAMET_ROLL - SFX_FLAG);
@@ -538,12 +539,16 @@ void func_80A287E8(EnBigpamet* this, PlayState* play) {
}
if (this->actor.bgCheckFlags & 8) {
quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
this->actor.velocity.y = this->unk_29E * 0.375f;
Quake_SetSpeed(quake, 0x4E20);
Quake_SetQuakeValues(quake, 15, 0, 0, 0);
Quake_SetCountdown(quake, 10);
Quake_SetSpeed(quakeIndex, 20000);
Quake_SetQuakeValues(quakeIndex, 15, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 10);
Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100);
func_80A27B58(this);
func_80A27DD8(this, play);
func_80A28970(this);
+10 -10
View File
@@ -12,8 +12,8 @@
#define THIS ((EnBigpo*)thisx)
void EnBigpo_Init(Actor* thisx, PlayState* play);
void EnBigpo_Destroy(Actor* thisx, PlayState* play);
void EnBigpo_Init(Actor* thisx, PlayState* play2);
void EnBigpo_Destroy(Actor* thisx, PlayState* play2);
void EnBigpo_Update(Actor* thisx, PlayState* play);
void EnBigpo_UpdateFire(Actor* thisx, PlayState* play);
@@ -220,7 +220,7 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) {
if (thisx->params == ENBIGPO_REGULAR) { // the well poe, starts immediately
thisx->flags &= ~ACTOR_FLAG_10; // always update OFF
this->unkBool204 = true;
this->storePrevBgm = true;
EnBigpo_InitWellBigpo(this);
} else if (thisx->params == ENBIGPO_SUMMONED) { // dampe type
EnBigpo_InitDampeMainPo(this);
@@ -439,9 +439,9 @@ void EnBigpo_SpawnCutsceneStage6(EnBigpo* this, PlayState* play) {
*/
void EnBigpo_SpawnCutsceneStage7(EnBigpo* this) {
this->idleTimer = 15;
if (this->unkBool204 == false) {
func_801A2E54(NA_BGM_MINI_BOSS);
this->unkBool204 = true;
if (this->storePrevBgm == false) {
Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS);
this->storePrevBgm = true;
}
this->actionFunc = EnBigpo_SpawnCutsceneStage8;
}
@@ -525,9 +525,9 @@ void EnBigpo_WarpingIn(EnBigpo* this, PlayState* play) {
this->mainColor.a = this->idleTimer * (255.0f / 32.0f);
if (this->idleTimer == 32) {
this->mainColor.a = 255; // fully visible
if (this->unkBool204 == false) {
func_801A2E54(NA_BGM_MINI_BOSS);
this->unkBool204 = true;
if (this->storePrevBgm == false) {
Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS);
this->storePrevBgm = true;
}
EnBigpo_SetupIdleFlying(this);
}
@@ -1124,7 +1124,7 @@ s32 EnBigpo_ApplyDamage(EnBigpo* this, PlayState* play) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DEAD);
Enemy_StartFinishingBlow(play, &this->actor);
if (this->actor.params == ENBIGPO_SUMMONED) { // dampe type
func_801A2ED8();
Audio_RestorePrevBgm();
}
} else {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DAMAGE);
@@ -30,7 +30,7 @@ typedef struct EnBigpo {
/* 0x188 */ Vec3s jointTable[ENBIGPO_LIMBCOUNT];
/* 0x1C4 */ Vec3s morphTable[ENBIGPO_LIMBCOUNT];
/* 0x200 */ EnBigPoActionFunc actionFunc;
/* 0x204 */ u8 unkBool204; // need to know what func_801A2E54 does to know what this is
/* 0x204 */ u8 storePrevBgm;
/* 0x206 */ s16 idleTimer; // frame counter
/* 0x208 */ s16 unk208; // facing rotY?
/* 0x20A */ s16 rotVelocity;
@@ -5,6 +5,7 @@
*/
#include "z_en_bigslime.h"
#include "z64quake.h"
#include "z64rumble.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
#include "objects/object_bigslime/object_bigslime.h"
@@ -14,7 +15,7 @@
#define THIS ((EnBigslime*)thisx)
void EnBigslime_Init(Actor* thisx, PlayState* play);
void EnBigslime_Init(Actor* thisx, PlayState* play2);
void EnBigslime_Destroy(Actor* thisx, PlayState* play);
void EnBigslime_UpdateGekko(Actor* thisx, PlayState* play);
void EnBigslime_DrawGekko(Actor* thisx, PlayState* play);
@@ -743,12 +744,14 @@ void EnBigslime_EndThrowMinislime(EnBigslime* this) {
void EnBigslime_BreakIntoMinislime(EnBigslime* this, PlayState* play) {
s32 i;
s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 20000);
Quake_SetQuakeValues(quakeIndex, 15, 0, 0, 0);
Quake_SetCountdown(quakeIndex, 15);
Quake_SetSpeed(quake, 20000);
Quake_SetQuakeValues(quake, 15, 0, 0, 0);
Quake_SetCountdown(quake, 15);
Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100);
this->bigslimeCollider[0].base.atFlags &= ~AT_ON;
this->gekkoCollider.base.acFlags &= ~(AC_ON | AC_HIT);
@@ -1005,7 +1008,7 @@ void EnBigslime_CallMinislime(EnBigslime* this, PlayState* play) {
} else if (this->isAnimUpdate) {
Animation_PlayLoop(&this->skelAnime, &gGekkoNervousIdleAnim);
EnBigslime_UpdateCameraIntroCs(this, play, 25);
func_801A2E54(0x38);
Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS);
EnBigslime_InitFallMinislime(this);
play->envCtx.lightSettingOverride = 0xFF;
this->callTimer = 35;
@@ -2620,7 +2623,7 @@ void EnBigslime_ApplyDamageEffectGekko(EnBigslime* this, PlayState* play) {
if (this->actor.colChkInfo.damageEffect != BIGSLIME_DMGEFF_HOOKSHOT) {
if (Actor_ApplyDamage(&this->actor) == 0) {
func_800BE504(&this->actor, &this->gekkoCollider);
func_801A2ED8();
Audio_RestorePrevBgm();
Enemy_StartFinishingBlow(play, &this->actor);
this->gekkoCollider.base.acFlags &= ~AC_ON;
EnBigslime_GekkoThaw(this, play);
+227 -19
View File
@@ -5,6 +5,8 @@
*/
#include "z_en_bombal.h"
#include "assets/objects/object_fusen/object_fusen.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -18,8 +20,11 @@ void EnBombal_Draw(Actor* thisx, PlayState* play);
void func_80C05B3C(EnBombal* this, PlayState* play);
void func_80C05C44(EnBombal* this, PlayState* play);
void func_80C05DE8(EnBombal* this, PlayState* play);
void func_80C05B24(EnBombal* this);
void EnBombal_InitEffects(EnBombal* this, Vec3f* pos, s16 fadeDelay);
void EnBombal_UpdateEffects(EnBombal* this, PlayState* play);
void EnBombal_DrawEffects(EnBombal*, PlayState*);
#if 0
const ActorInit En_Bombal_InitVars = {
ACTOR_EN_BOMBAL,
ACTORCAT_PROP,
@@ -32,37 +37,240 @@ const ActorInit En_Bombal_InitVars = {
(ActorFunc)EnBombal_Draw,
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_80C06460 = {
{ COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_NONE, OC2_TYPE_2, COLSHAPE_CYLINDER, },
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x004138B0, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_ON | AC_TYPE_PLAYER,
OC1_NONE,
OC2_TYPE_2,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
{ 0x00000000, 0x00, 0x00 },
{ 0x004138B0, 0x00, 0x00 },
TOUCH_NONE | TOUCH_SFX_NORMAL,
BUMP_ON,
OCELEM_NONE,
},
{ 60, 90, -50, { 0, 0, 0 } },
};
#endif
void EnBombal_Init(Actor* thisx, PlayState* play) {
EnBombal* this = THIS;
extern ColliderCylinderInit D_80C06460;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f);
this->actor.colChkInfo.mass = 0;
Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.targetMode = 6;
this->actor.colChkInfo.health = 1;
this->scale = 0.1f;
this->cutscene = this->actor.cutscene;
func_80C05B24(this);
}
extern UNK_TYPE D_06000A00;
void EnBombal_Destroy(Actor* thisx, PlayState* play) {
EnBombal* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Init.s")
Collider_DestroyCylinder(play, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Destroy.s")
void func_80C05B24(EnBombal* this) {
this->isPopped = false;
this->actionFunc = func_80C05B3C;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05B24.s")
void func_80C05B3C(EnBombal* this, PlayState* play) {
Player* player;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05B3C.s")
this->oscillationAngle += 1500.0f;
this->actor.velocity.y = Math_SinS(this->oscillationAngle);
Math_ApproachF(&this->scale, 0.1f, 0.3f, 0.01f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05C44.s")
if (play->msgCtx.msgLength == 0) {
if (this->collider.base.acFlags & AC_HIT) {
player = GET_PLAYER(play);
this->collider.base.acFlags &= ~AC_HIT;
if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) &&
!(gSaveContext.save.weekEventReg[85] & 2)) {
player->stateFlags1 |= ACTOR_FLAG_20;
this->actor.flags |= ACTOR_FLAG_100000;
}
this->actionFunc = func_80C05C44;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05DE8.s")
void func_80C05C44(EnBombal* this, PlayState* play) {
s32 phi_s0 = false;
s32 i;
Vec3f pos;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Update.s")
if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) &&
!(gSaveContext.save.weekEventReg[85] & 2)) {
if (ActorCutscene_GetCurrentIndex() == 0x7C) {
ActorCutscene_Stop(0x7C);
ActorCutscene_SetIntentToPlay(this->cutscene);
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/EnBombal_Draw.s")
if (!ActorCutscene_GetCanPlayNext(this->cutscene)) {
ActorCutscene_SetIntentToPlay(this->cutscene);
} else {
ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &this->actor);
phi_s0 = true;
}
} else {
phi_s0 = true;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C05F90.s")
if (phi_s0) {
Math_Vec3f_Copy(&pos, &this->actor.world.pos);
pos.y += 60.0f;
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, pos.x, pos.y, pos.z, 255, 255, 200,
CLEAR_TAG_LARGE_EXPLOSION);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C060B8.s")
for (i = 0; i < 100; i++) {
EnBombal_InitEffects(this, &pos, 10);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Bombal/func_80C06208.s")
gSaveContext.save.weekEventReg[83] |= 4;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_MUJURA_BALLOON_BROKEN);
this->timer = 30;
this->isPopped = true;
this->actionFunc = func_80C05DE8;
}
}
void func_80C05DE8(EnBombal* this, PlayState* play) {
if (this->timer == 0) {
if (!(gSaveContext.save.weekEventReg[75] & 0x40) && !(gSaveContext.save.weekEventReg[73] & 0x10) &&
!(gSaveContext.save.weekEventReg[85] & 2)) {
ActorCutscene_Stop(this->cutscene);
}
Actor_MarkForDeath(&this->actor);
} else if (this->timer < 10) {
this->actor.colChkInfo.health = 0;
}
}
void EnBombal_Update(Actor* thisx, PlayState* play) {
s32 pad;
EnBombal* this = THIS;
if (this->timer != 0) {
this->timer--;
}
this->actor.shape.rot.y = this->actor.world.rot.y;
Actor_SetFocus(&this->actor, 30.0f);
Actor_SetScale(&this->actor, this->scale);
this->actionFunc(this, play);
Actor_MoveWithGravity(&this->actor);
EnBombal_UpdateEffects(this, play);
if (!this->isPopped) {
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
}
void EnBombal_Draw(Actor* thisx, PlayState* play) {
EnBombal* this = THIS;
if (this->isPopped != true) {
Gfx_DrawDListOpa(play, gMajoraBalloonDL);
Gfx_DrawDListOpa(play, gMajoraBalloonKnotDL);
}
EnBombal_DrawEffects(this, play);
}
void EnBombal_InitEffects(EnBombal* this, Vec3f* pos, s16 fadeDelay) {
s16 i;
EnBombalEffect* sPtr = this->effects;
for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) {
if (!sPtr->isEnabled) {
sPtr->isEnabled = true;
sPtr->pos = *pos;
sPtr->alphaFadeDelay = fadeDelay;
sPtr->alpha = 255;
sPtr->accel.x = (Rand_ZeroOne() - 0.5f) * 10.0f;
sPtr->accel.y = (Rand_ZeroOne() - 0.5f) * 10.0f;
sPtr->accel.z = (Rand_ZeroOne() - 0.5f) * 10.0f;
sPtr->velocity.x = Rand_ZeroOne() - 0.5f;
sPtr->velocity.y = Rand_ZeroOne() - 0.5f;
sPtr->velocity.z = Rand_ZeroOne() - 0.5f;
sPtr->scale = (Rand_ZeroFloat(1.0f) * 0.5f) + 2.0f;
return;
}
}
}
void EnBombal_UpdateEffects(EnBombal* this, PlayState* play) {
s32 i;
EnBombalEffect* sPtr = this->effects;
for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) {
if (sPtr->isEnabled) {
sPtr->pos.x += sPtr->velocity.x;
sPtr->pos.y += sPtr->velocity.y;
sPtr->pos.z += sPtr->velocity.z;
sPtr->velocity.x += sPtr->accel.x;
sPtr->velocity.y += sPtr->accel.y;
sPtr->velocity.z += sPtr->accel.z;
if (sPtr->alphaFadeDelay != 0) {
sPtr->alphaFadeDelay--;
} else {
sPtr->alpha -= 10;
if (sPtr->alpha < 10) {
sPtr->isEnabled = 0;
}
}
}
}
}
void EnBombal_DrawEffects(EnBombal* this, PlayState* play) {
s16 i;
GraphicsContext* gfxCtx = play->state.gfxCtx;
EnBombalEffect* sPtr = this->effects;
OPEN_DISPS(gfxCtx);
func_8012C28C(gfxCtx);
func_8012C2DC(play->state.gfxCtx);
for (i = 0; i < ARRAY_COUNT(this->effects); i++, sPtr++) {
if (sPtr->isEnabled != 0) {
Matrix_Translate(sPtr->pos.x, sPtr->pos.y, sPtr->pos.z, MTXMODE_NEW);
Matrix_Scale(sPtr->scale, sPtr->scale, sPtr->scale, MTXMODE_APPLY);
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14);
gSPSegment(POLY_XLU_DISP++, 0x08, Lib_SegmentedToVirtual(&gSun1Tex));
gSPDisplayList(POLY_XLU_DISP++, &gSunSparkleMaterialDL);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 250, 180, 255, sPtr->alpha);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZF(DEGF_TO_RADF(play->state.frames * 20.0f), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, &gSunSparkleModelDL);
}
}
CLOSE_DISPS(gfxCtx);
}
@@ -7,15 +7,27 @@ struct EnBombal;
typedef void (*EnBombalActionFunc)(struct EnBombal*, PlayState*);
typedef struct EnBombalEffect {
/* 0x00 */ u8 isEnabled;
/* 0x04 */ Vec3f pos;
/* 0x10 */ UNK_TYPE4 unk10;
/* 0x14 */ s16 alpha;
/* 0x16 */ s16 alphaFadeDelay;
/* 0x18 */ Vec3f velocity;
/* 0x24 */ Vec3f accel;
/* 0x30 */ f32 scale;
} EnBombalEffect;
typedef struct EnBombal {
/* 0x0000 */ Actor actor;
/* 0x0144 */ EnBombalActionFunc actionFunc;
/* 0x0148 */ char unk148[0x4];
/* 0x014C */ s16 unk_14C;
/* 0x0150 */ f32 unk_150;
/* 0x0154 */ char unk154[0x150];
/* 0x02A4 */ Vec3f unk_2A4;
/* 0x02B0 */ char unk2B0[0x2794];
/* 0x000 */ Actor actor;
/* 0x144 */ EnBombalActionFunc actionFunc;
/* 0x148 */ s16 timer;
/* 0x14A */ s16 isPopped;
/* 0x14C */ s16 cutscene;
/* 0x150 */ f32 scale;
/* 0x154 */ f32 oscillationAngle;
/* 0x158 */ ColliderCylinder collider;
/* 0x1A4 */ EnBombalEffect effects[200];
} EnBombal; // size = 0x2A44
extern const ActorInit En_Bombal_InitVars;
@@ -12,7 +12,7 @@
#define THIS ((EnBombf*)thisx)
void EnBombf_Init(Actor* thisx, PlayState* play);
void EnBombf_Init(Actor* thisx, PlayState* play2);
void EnBombf_Destroy(Actor* thisx, PlayState* play);
void EnBombf_Update(Actor* thisx, PlayState* play);
void EnBombf_Draw(Actor* thisx, PlayState* play);
@@ -39,6 +39,17 @@ void func_80C00168(EnBomjima* this, PlayState* play);
void func_80C00234(EnBomjima* this);
void func_80C00284(EnBomjima* this, PlayState* play);
typedef enum EN_BOMJIMA_ACTION {
/* 0 */ EN_BOMJIMA_ACTION_0,
/* 1 */ EN_BOMJIMA_ACTION_1,
/* 2 */ EN_BOMJIMA_ACTION_2,
/* 3 */ EN_BOMJIMA_ACTION_3,
/* 4 */ EN_BOMJIMA_ACTION_4,
/* 5 */ EN_BOMJIMA_ACTION_5,
/* 6 */ EN_BOMJIMA_ACTION_6,
/* 7 */ EN_BOMJIMA_ACTION_7,
} EN_BOMJIMA_ACTION;
static s32 D_80C009F0 = 0;
static s32 D_80C009F4 = 0;
@@ -129,7 +140,7 @@ void EnBomjima_Init(Actor* thisx, PlayState* play) {
while (cs != -1) {
// clang-format off
this->unk_2D4[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs);
this->cutscenes[i] = cs; cs = ActorCutscene_GetAdditionalCutscene(cs);
// clang-format on
i++;
}
@@ -197,31 +208,31 @@ void func_80BFE32C(EnBomjima* this, PlayState* play, s32 arg2) {
}
}
void func_80BFE494(EnBomjima* this, s32 arg1, f32 arg2) {
this->unk_2EC = arg1;
this->unk_2CC = Animation_GetLastFrame(sAnimations[arg1]);
Animation_Change(&this->skelAnime, sAnimations[this->unk_2EC], arg2, 0.0f, this->unk_2CC, D_80C00AE4[this->unk_2EC],
-4.0f);
void func_80BFE494(EnBomjima* this, s32 animIndex, f32 playSpeed) {
this->animIndex = animIndex;
this->animLastFrame = Animation_GetLastFrame(sAnimations[animIndex]);
Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animLastFrame,
D_80C00AE4[this->animIndex], -4.0f);
}
void func_80BFE524(EnBomjima* this) {
if ((this->unk_2EC == 5) &&
if ((this->animIndex == 5) &&
(Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) ||
Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK);
}
if ((this->unk_2EC == 18) &&
if ((this->animIndex == 18) &&
(Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) ||
Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_WALK);
}
if ((this->unk_2EC == 15) && Animation_OnFrame(&this->skelAnime, 15.0f)) {
if ((this->animIndex == 15) && Animation_OnFrame(&this->skelAnime, 15.0f)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND);
}
if ((this->unk_2EC == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) {
if ((this->animIndex == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_LAND);
}
}
@@ -326,10 +337,11 @@ void func_80BFEA94(EnBomjima* this, PlayState* play) {
continue;
}
this->unk_2F0 = (EnBombal*)actor;
this->bombal = (EnBombal*)actor;
Math_Vec3f_Copy(&this->unk_2B0, &actor->world.pos);
if (this->unk_2F4 == 0) {
this->unk_2F4 = this->unk_2F0->actor.cutscene;
if (this->bombalCutscene == 0) {
this->bombalCutscene = this->bombal->actor.cutscene;
}
func_80BFEB1C(this);
break;
@@ -339,7 +351,7 @@ void func_80BFEA94(EnBomjima* this, PlayState* play) {
void func_80BFEB1C(EnBomjima* this) {
func_80BFE494(this, 1, 1.0f);
func_80BFE65C(this);
this->unk_2A0 = 0;
this->action = EN_BOMJIMA_ACTION_0;
this->actionFunc = func_80BFEB64;
}
@@ -381,7 +393,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) {
func_800B8614(&this->actor, play, 70.0f);
}
if ((this->unk_2F0->actor.update == NULL) || (this->unk_2F0->actor.colChkInfo.health == 0)) {
if ((this->bombal->actor.update == NULL) || (this->bombal->actor.colChkInfo.health == 0)) {
func_80BFEFF0(this);
return;
}
@@ -394,14 +406,14 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) {
break;
case 1:
this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2F0->actor.world.pos);
this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bombal->actor.world.pos);
if (Animation_OnFrame(&this->skelAnime, 19.0f)) {
this->unk_2C0 = 5;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BOMBERS_SHOT_BREATH);
}
if (this->unk_2C0 == 1) {
s16 sp3E = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2F0->actor.world.pos);
s16 sp3E = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bombal->actor.world.pos);
if (Rand_ZeroOne() < 0.5f) {
sp3E += 0x4000;
@@ -409,9 +421,9 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) {
sp3E += 0xC000;
}
sp40.x = (Math_SinS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->unk_2F0->actor.world.pos.x;
sp40.y = this->unk_2F0->actor.world.pos.y - randPlusMinusPoint5Scaled(40.0f);
sp40.z = (Math_CosS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->unk_2F0->actor.world.pos.z;
sp40.x = (Math_SinS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->bombal->actor.world.pos.x;
sp40.y = this->bombal->actor.world.pos.y - randPlusMinusPoint5Scaled(40.0f);
sp40.z = (Math_CosS(sp3E) * (Rand_ZeroFloat(20.0f) + 40.0f)) + this->bombal->actor.world.pos.z;
SoundSource_PlaySfxAtFixedWorldPos(play, &sp40, 50, NA_SE_EV_BOMBERS_SHOT_EXPLOSUIN);
EffectSsHitmark_SpawnFixedScale(play, 0, &sp40);
@@ -443,10 +455,10 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) {
}
void func_80BFEFF0(EnBomjima* this) {
this->unk_2F0 = NULL;
this->bombal = NULL;
func_80BFE494(this, 19, 1.0f);
func_80BFE65C(this);
this->unk_2A0 = 1;
this->action = EN_BOMJIMA_ACTION_1;
this->actionFunc = func_80BFF03C;
}
@@ -455,25 +467,25 @@ void func_80BFF03C(EnBomjima* this, PlayState* play) {
if (ActorCutscene_GetCurrentIndex() == 0x7C) {
ActorCutscene_Stop(0x7C);
ActorCutscene_SetIntentToPlay(this->unk_2D4[0]);
} else if (!ActorCutscene_GetCanPlayNext(this->unk_2D4[0])) {
ActorCutscene_SetIntentToPlay(this->unk_2D4[0]);
ActorCutscene_SetIntentToPlay(this->cutscenes[0]);
} else if (!ActorCutscene_GetCanPlayNext(this->cutscenes[0])) {
ActorCutscene_SetIntentToPlay(this->cutscenes[0]);
} else {
player->stateFlags1 &= ~0x20;
gSaveContext.save.weekEventReg[83] &= (u8)~4;
this->actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play));
this->unk_2DC = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play));
ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[0], &this->actor);
ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[0], &this->actor);
func_80BFF120(this);
}
}
void func_80BFF120(EnBomjima* this) {
func_80BFE65C(this);
this->unk_2C4 = 30;
this->cutsceneTimer = 30;
func_80BFE494(this, 6, 1.0f);
this->unk_2DE = 0;
this->unk_2A0 = 2;
this->cutsceneEnded = false;
this->action = EN_BOMJIMA_ACTION_2;
this->actionFunc = func_80BFF174;
}
@@ -481,9 +493,9 @@ void func_80BFF174(EnBomjima* this, PlayState* play) {
f32 sp2C = this->skelAnime.curFrame;
Player* player = GET_PLAYER(play);
if (this->unk_2C4 == 1) {
ActorCutscene_Stop(this->unk_2D4[0]);
this->unk_2DE = 1;
if (this->cutsceneTimer == 1) {
ActorCutscene_Stop(this->cutscenes[0]);
this->cutsceneEnded = true;
}
if (Text_GetFaceReaction(play, 0x11) != 0) {
@@ -498,9 +510,9 @@ void func_80BFF174(EnBomjima* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0);
if ((this->unk_2CC <= sp2C) && (this->unk_2BC < 5)) {
if ((this->animLastFrame <= sp2C) && (this->unk_2BC < 5)) {
this->unk_2BC++;
if (this->unk_2EC != 19) {
if (this->animIndex != 19) {
func_80BFE494(this, 19, 1.0f);
}
}
@@ -541,7 +553,7 @@ void func_80BFF174(EnBomjima* this, PlayState* play) {
func_80BFE32C(this, play, 1);
}
if (this->unk_2DE != 0) {
if (this->cutsceneEnded != false) {
if (this->unk_2BC >= 5) {
func_80BFE67C(this, play);
}
@@ -551,20 +563,20 @@ void func_80BFF174(EnBomjima* this, PlayState* play) {
void func_80BFF3F0(EnBomjima* this) {
func_80BFE494(this, 15, 1.0f);
this->unk_2A0 = 3;
this->action = EN_BOMJIMA_ACTION_3;
this->actionFunc = func_80BFF430;
}
void func_80BFF430(EnBomjima* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
if (this->unk_2CC <= curFrame) {
if (this->animLastFrame <= curFrame) {
EnBombal* bombal = (EnBombal*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBAL, this->unk_2B0.x,
this->unk_2B0.y, this->unk_2B0.z, 0, 0, 0, 0);
if (bombal != NULL) {
bombal->unk_150 = 0.0f;
bombal->unk_14C = this->unk_2F4;
bombal->scale = 0.0f;
bombal->cutscene = this->bombalCutscene;
Actor_ChangeFocus(&this->actor, play, &bombal->actor);
gSaveContext.save.weekEventReg[83] &= (u8)~4;
func_80BFE65C(this);
@@ -576,7 +588,7 @@ void func_80BFF430(EnBomjima* this, PlayState* play) {
void func_80BFF4F4(EnBomjima* this) {
func_80BFE65C(this);
this->unk_2A0 = 4;
this->action = EN_BOMJIMA_ACTION_4;
this->actionFunc = func_80BFF52C;
}
@@ -599,7 +611,7 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) {
func_80151938(play, this->actor.textId);
play_sound(NA_SE_SY_FOUND);
func_80BFE494(this, 15, 1.0f);
this->unk_2A0 = 5;
this->action = EN_BOMJIMA_ACTION_5;
this->actionFunc = func_80BFF6CC;
} else {
Player* player = GET_PLAYER(play);
@@ -623,7 +635,7 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) {
void func_80BFF6CC(EnBomjima* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
if (this->unk_2CC <= curFrame) {
if (this->animLastFrame <= curFrame) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
func_801477B4(play);
func_80BFE494(this, 1, 1.0f);
@@ -635,7 +647,7 @@ void func_80BFF6CC(EnBomjima* this, PlayState* play) {
void func_80BFF754(EnBomjima* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Vec3f spA0;
EnBombal* temp_s3;
EnBomjima* bomjima;
s32 i;
f32 x;
f32 y;
@@ -643,12 +655,12 @@ void func_80BFF754(EnBomjima* this, PlayState* play) {
if (ActorCutscene_GetCurrentIndex() == 0x7C) {
ActorCutscene_Stop(0x7C);
ActorCutscene_SetIntentToPlay(this->unk_2D4[1]);
ActorCutscene_SetIntentToPlay(this->cutscenes[1]);
return;
}
if (!ActorCutscene_GetCanPlayNext(this->unk_2D4[1])) {
ActorCutscene_SetIntentToPlay(this->unk_2D4[1]);
if (!ActorCutscene_GetCanPlayNext(this->cutscenes[1])) {
ActorCutscene_SetIntentToPlay(this->cutscenes[1]);
return;
}
@@ -663,9 +675,9 @@ void func_80BFF754(EnBomjima* this, PlayState* play) {
spA0.y += y * (2.0f + (i * 0.2f));
spA0.z += z * (2.0f + (i * 0.2f));
temp_s3 = (EnBombal*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOMJIMA, spA0.x, spA0.y,
spA0.z, 0, 0, 0, i + 32);
if (temp_s3 != NULL) {
bomjima = (EnBomjima*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOMJIMA, spA0.x, spA0.y,
spA0.z, 0, 0, 0, i + 32);
if (bomjima != NULL) {
s32 index = (i * 2) - 2;
Math_Vec3f_Copy(&spA0, &this->actor.world.pos);
@@ -673,12 +685,12 @@ void func_80BFF754(EnBomjima* this, PlayState* play) {
spA0.x += Math_SinS(D_80C00AF8[(i * 2) - 2] + this->actor.world.rot.y) * D_80C00AF8[index + 1];
spA0.z += Math_CosS(D_80C00AF8[index] + this->actor.world.rot.y) * D_80C00AF8[index + 1];
Math_Vec3f_Copy(&temp_s3->unk_2A4, &spA0);
Math_Vec3f_Copy(&bomjima->unk_2A4, &spA0);
}
}
D_80C009F0 = 0;
ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[1], &this->actor);
ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[1], &this->actor);
this->actionFunc = func_80BFF9B0;
}
@@ -741,7 +753,7 @@ void func_80BFFB40(EnBomjima* this, PlayState* play) {
void func_80BFFBC4(EnBomjima* this, PlayState* play) {
f32 curFrame = this->skelAnime.curFrame;
if ((this->unk_2EC != 1) && (this->unk_2CC <= curFrame)) {
if ((this->animIndex != 1) && (this->animLastFrame <= curFrame)) {
func_80BFE494(this, 1, 1.0f);
}
@@ -762,14 +774,14 @@ void func_80BFFBC4(EnBomjima* this, PlayState* play) {
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_86;
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
ActorCutscene_Stop(this->unk_2D4[1]);
ActorCutscene_Stop(this->cutscenes[1]);
}
}
void func_80BFFCFC(EnBomjima* this) {
func_80BFE65C(this);
func_80BFE494(this, 18, 1.0f);
this->unk_2A0 = 6;
this->action = EN_BOMJIMA_ACTION_6;
this->actionFunc = func_80BFFD48;
}
@@ -825,22 +837,22 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) {
}
if (this->unk_2E4 != 4) {
if ((this->unk_2EC != 0) && (this->unk_2CC <= curFrame)) {
if ((this->animIndex != 0) && (this->animLastFrame <= curFrame)) {
D_80C009F0++;
func_80BFE494(this, 0, 1.0f);
}
} else if ((this->unk_2EC != 8) && (this->unk_2CC <= curFrame)) {
} else if ((this->animIndex != 8) && (this->animLastFrame <= curFrame)) {
func_80BFE494(this, 8, 1.0f);
D_80C009F4 = 1;
}
if (this->unk_2EC == 8) {
if (this->animIndex == 8) {
if ((D_80C009F4 == 1) && Animation_OnFrame(&this->skelAnime, 7.0f)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HUMAN_BOUND);
D_80C009F4 = 2;
}
if ((this->unk_2CC <= curFrame) && (this->unk_2C0 == 0)) {
if ((this->animLastFrame <= curFrame) && (this->unk_2C0 == 0)) {
this->unk_2C0 = 10;
}
@@ -853,7 +865,7 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) {
void func_80C0011C(EnBomjima* this) {
func_80BFE65C(this);
func_80BFE494(this, 0, 1.0f);
this->unk_2A0 = 7;
this->action = EN_BOMJIMA_ACTION_7;
this->actionFunc = func_80C00168;
}
@@ -894,8 +906,9 @@ void func_80C00284(EnBomjima* this, PlayState* play) {
f32 sp28 = this->skelAnime.curFrame;
Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0);
if (((this->unk_2A0 == 0) || (this->unk_2C8 == 10) || (this->unk_2C8 == 11) || (this->unk_2CA == 1)) &&
(this->unk_2CC <= sp28)) {
if (((this->action == EN_BOMJIMA_ACTION_0) || (this->unk_2C8 == 10) || (this->unk_2C8 == 11) ||
(this->unk_2CA == 1)) &&
(this->animLastFrame <= sp28)) {
if (!(this->unk_2BC & 1)) {
func_80BFE494(this, 3, 1.0f);
} else {
@@ -919,14 +932,15 @@ void func_80C00284(EnBomjima* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
this->collider.dim.radius = 10;
this->collider.dim.height = 30;
if ((this->unk_2A0 == 4) || (this->unk_2CA == 1) || ((this->unk_2CA == 3) && (this->unk_2C8 >= 2))) {
if ((this->action == EN_BOMJIMA_ACTION_4) || (this->unk_2CA == 1) ||
((this->unk_2CA == 3) && (this->unk_2C8 >= 2))) {
this->unk_28E = 0;
if (player->stateFlags1 & 0x20) {
player->stateFlags1 &= ~0x20;
}
if ((this->unk_2F0 == 0) || (this->unk_2F0->actor.update == NULL) ||
(this->unk_2F0->actor.colChkInfo.health <= 0)) {
if ((this->bombal == 0) || (this->bombal->actor.update == NULL) ||
(this->bombal->actor.colChkInfo.health <= 0)) {
func_80BFF3F0(this);
} else {
func_80BFE65C(this);
@@ -941,7 +955,7 @@ void func_80C00284(EnBomjima* this, PlayState* play) {
switch (this->unk_2CA) {
case 0:
this->unk_28E = 0;
if (this->unk_2A0 == 7) {
if (this->action == EN_BOMJIMA_ACTION_7) {
func_80C0011C(this);
} else {
func_80BFEB1C(this);
@@ -953,7 +967,7 @@ void func_80C00284(EnBomjima* this, PlayState* play) {
func_80BFE65C(this);
this->unk_28E = 0;
func_80BFE494(this, 1, 1.0f);
this->unk_2A0 = 2;
this->action = EN_BOMJIMA_ACTION_2;
this->actionFunc = func_80BFF174;
return;
}
@@ -1008,8 +1022,8 @@ void EnBomjima_Update(Actor* thisx, PlayState* play) {
this->unk_2C6--;
}
if (this->unk_2C4 != 0) {
this->unk_2C4--;
if (this->cutsceneTimer != 0) {
this->cutsceneTimer--;
}
SkelAnime_Update(&this->skelAnime);
@@ -26,7 +26,7 @@ typedef struct EnBomjima {
/* 0x296 */ UNK_TYPE1 unk296[4];
/* 0x29A */ s16 unk_29A;
/* 0x29C */ UNK_TYPE1 unk29C[4];
/* 0x2A0 */ s16 unk_2A0;
/* 0x2A0 */ s16 action;
/* 0x2A2 */ s16 unk_2A2;
/* 0x2A4 */ Vec3f unk_2A4;
/* 0x2B0 */ Vec3f unk_2B0;
@@ -34,25 +34,25 @@ typedef struct EnBomjima {
/* 0x2BE */ s16 unk_2BE;
/* 0x2C0 */ s16 unk_2C0;
/* 0x2C2 */ s16 unk_2C2;
/* 0x2C4 */ s16 unk_2C4;
/* 0x2C4 */ s16 cutsceneTimer;
/* 0x2C6 */ s16 unk_2C6;
/* 0x2C8 */ s16 unk_2C8;
/* 0x2CA */ s16 unk_2CA;
/* 0x2CC */ f32 unk_2CC;
/* 0x2CC */ f32 animLastFrame;
/* 0x2D0 */ f32 unk_2D0;
/* 0x2D4 */ s16 unk_2D4[2];
/* 0x2D4 */ s16 cutscenes[2];
/* 0x2D8 */ UNK_TYPE1 unk2D8[4]; // maybe a part of the above?
/* 0x2DC */ s16 unk_2DC;
/* 0x2DE */ s16 unk_2DE;
/* 0x2DE */ s16 cutsceneEnded;
/* 0x2E0 */ s16 unk_2E0;
/* 0x2E2 */ s16 unk_2E2;
/* 0x2E4 */ s16 unk_2E4;
/* 0x2E6 */ s16 unk_2E6;
/* 0x2E8 */ s16 unk_2E8;
/* 0x2EA */ s16 unk_2EA;
/* 0x2EC */ s32 unk_2EC;
/* 0x2F0 */ EnBombal* unk_2F0;
/* 0x2F4 */ s16 unk_2F4;
/* 0x2EC */ s32 animIndex;
/* 0x2F0 */ EnBombal* bombal;
/* 0x2F4 */ s16 bombalCutscene;
/* 0x2F8 */ ColliderCylinder collider;
} EnBomjima; // size = 0x344
@@ -14,7 +14,7 @@
void EnBomjimb_Init(Actor* thisx, PlayState* play);
void EnBomjimb_Destroy(Actor* thisx, PlayState* play);
void EnBomjimb_Update(Actor* thisx, PlayState* play);
void EnBomjimb_Update(Actor* thisx, PlayState* play2);
void EnBomjimb_Draw(Actor* thisx, PlayState* play);
void func_80C01494(EnBomjimb* this);
@@ -691,7 +691,7 @@ void func_80C02740(EnBomjimb* this, PlayState* play) {
gSaveContext.save.bombersCaughtNum++;
if (gSaveContext.save.bombersCaughtNum > 4) {
func_801A3098(0x922);
Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900);
} else {
Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_PIECE_OF_HEART);
}
+1 -1
View File
@@ -482,7 +482,7 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) {
this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z,
-1);
func_801A3098(0x2B | 0x900);
Audio_PlayFanfare(NA_BGM_OPEN_CHEST | 0x900);
}
if (this->getItemId == GI_STRAY_FAIRY) {

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