mirror of
https://github.com/n64decomp/sm64
synced 2026-07-25 22:18:09 -04:00
Refresh 3
This commit is contained in:
+6
-6
@@ -7,15 +7,15 @@
|
||||
// Format:
|
||||
// - frequency
|
||||
// - max number of simultaneous notes
|
||||
// - unk5 (chunk size/discretization step?)
|
||||
// - unk6 (some memory req)
|
||||
// - unk8 (gain?)
|
||||
// - reverb downsample rate (makes the ring buffer be downsampled to save memory)
|
||||
// - reverb window size (ring buffer size, length affects reverb delay)
|
||||
// - reverb gain (0 = min reverb, 32767 = max reverb, 32769 to 65535 = louder and louder...)
|
||||
// - volume
|
||||
// - memory used for persistent sequences
|
||||
// - memory used for persistent banks
|
||||
// - memory used for temporary sequences
|
||||
// - memory used for temporary banks
|
||||
struct Struct80332190 D_80332190[18] = {
|
||||
struct AudioSessionSettings gAudioSessionPresets[18] = {
|
||||
#ifdef VERSION_JP
|
||||
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
|
||||
{ 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
|
||||
@@ -366,8 +366,8 @@ f32 gVolRampingRhs128[128] = {
|
||||
|
||||
s16 gTatumsPerBeat = TATUMS_PER_BEAT;
|
||||
s8 gUnusedCount80333EE8 = 16;
|
||||
s32 gAudioHeapSize = 0x31150;
|
||||
s32 D_80333EF0 = 0x2500;
|
||||
s32 gAudioHeapSize = DOUBLE_SIZE_ON_64_BIT(0x31150);
|
||||
s32 D_80333EF0 = DOUBLE_SIZE_ON_64_BIT(0x2500);
|
||||
volatile s32 gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
|
||||
s8 sUnused8033EF8 = 24;
|
||||
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
#define NUMAIBUFFERS 3
|
||||
|
||||
// constant .data
|
||||
extern struct Struct80332190 D_80332190[18];
|
||||
extern struct AudioSessionSettings gAudioSessionPresets[18];
|
||||
extern u16 D_80332388[128]; // unused
|
||||
|
||||
extern f32 gPitchBendFrequencyScale[255];
|
||||
@@ -39,7 +39,7 @@ extern f32 gVolRampingRhs128[128];
|
||||
extern s16 gTatumsPerBeat;
|
||||
extern s8 gUnusedCount80333EE8;
|
||||
extern s32 gAudioHeapSize;
|
||||
extern s32 D_80333EF0; // amount of heap designated to gSoundPool, 0x2500
|
||||
extern s32 D_80333EF0; // amount of heap designated to gAudioInitPool, 0x2500
|
||||
extern volatile s32 gAudioLoadLock;
|
||||
|
||||
// .bss
|
||||
|
||||
@@ -683,7 +683,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
// across this function call.
|
||||
flags = 0;
|
||||
|
||||
gAudioCmd = func_80313CD4(gAudioCmd, &writtenCmds, gCurrAiBuffer, gAiBufferLengths[index]);
|
||||
gAudioCmd = synthesis_execute(gAudioCmd, &writtenCmds, gCurrAiBuffer, gAiBufferLengths[index]);
|
||||
D_80226EB8 = ((D_80226EB8 + gActiveAudioFrames) * gActiveAudioFrames);
|
||||
|
||||
index = gAudioTaskIndex;
|
||||
@@ -2074,7 +2074,7 @@ void sound_reset(u8 arg0) {
|
||||
sGameLoopTicked = 0;
|
||||
disable_all_sequence_players();
|
||||
sound_init();
|
||||
func_80316928(&D_80332190[arg0]);
|
||||
audio_reset_session(&gAudioSessionPresets[arg0]);
|
||||
osWritebackDCacheAll();
|
||||
if (arg0 != 7) {
|
||||
preload_sequence(SEQ_EVENT_SOLVE_PUZZLE, PRELOAD_BANKS | PRELOAD_SEQUENCE);
|
||||
|
||||
+19
-20
@@ -337,14 +337,14 @@ struct SequenceChannelLayer // Maybe SequenceTrack?
|
||||
struct Note
|
||||
{
|
||||
/*0x00*/ u8 enabled : 1;
|
||||
/*0x00*/ u8 unk0b40 : 1;
|
||||
/*0x00*/ u8 unk0b20 : 1;
|
||||
/*0x00*/ u8 unk0b10 : 1;
|
||||
/*0x00*/ u8 unk0b8 : 1;
|
||||
/*0x00*/ u8 needsInit : 1;
|
||||
/*0x00*/ u8 restart : 1;
|
||||
/*0x00*/ u8 finished : 1;
|
||||
/*0x00*/ u8 envMixerNeedsInit : 1;
|
||||
/*0x00*/ u8 stereoStrongRight : 1;
|
||||
/*0x00*/ u8 stereoStrongLeft : 1;
|
||||
/*0x00*/ u8 stereoHeadsetEffects : 1;
|
||||
/*0x01*/ u8 usesStereo;
|
||||
/*0x01*/ u8 usesHeadsetPanEffects;
|
||||
/*0x02*/ u8 unk2;
|
||||
/*0x03*/ u8 sampleDmaIndex;
|
||||
/*0x04*/ u8 priority;
|
||||
@@ -357,15 +357,15 @@ struct Note
|
||||
/*0x0E*/ u16 headsetPanLeft;
|
||||
/*0x10*/ u16 prevHeadsetPanRight;
|
||||
/*0x12*/ u16 prevHeadsetPanLeft;
|
||||
/*0x14*/ s32 unk14;
|
||||
/*0x14*/ s32 samplePosInt;
|
||||
/*0x18*/ f32 portamentoFreqScale;
|
||||
/*0x1C*/ f32 vibratoFreqScale;
|
||||
/*0x20*/ u16 unk20;
|
||||
/*0x20*/ u16 samplePosFrac;
|
||||
/*0x24*/ struct AudioBankSound *sound;
|
||||
/*0x28*/ struct SequenceChannelLayer *prevParentLayer;
|
||||
/*0x2C*/ struct SequenceChannelLayer *parentLayer;
|
||||
/*0x30*/ struct SequenceChannelLayer *wantedParentLayer;
|
||||
/*0x34*/ struct SubStruct_func_80318F04 *unk34; // or s16*
|
||||
/*0x34*/ struct NoteSynthesisBuffers *synthesisBuffers;
|
||||
/*0x38*/ f32 frequency;
|
||||
/*0x3C*/ u16 targetVolLeft;
|
||||
/*0x3E*/ u16 targetVolRight;
|
||||
@@ -383,25 +383,24 @@ struct Note
|
||||
/* */ u8 pad2[0xc];
|
||||
}; // size = 0xC0
|
||||
|
||||
//this is probably just an array with a bunch of indexes
|
||||
struct SubStruct_func_80318F04
|
||||
struct NoteSynthesisBuffers
|
||||
{
|
||||
s16 unk00[0x10];
|
||||
s16 unk20[0x10];
|
||||
s16 unk40[0x28];
|
||||
s16 unk90[0x10];
|
||||
s16 unkB0[0x20];
|
||||
s16 unkF0[0x10];
|
||||
s16 adpcmdecState[0x10];
|
||||
s16 finalResampleState[0x10];
|
||||
s16 mixEnvelopeState[0x28];
|
||||
s16 panResampleState[0x10];
|
||||
s16 panSamplesBuffer[0x20];
|
||||
s16 dummyResampleState[0x10];
|
||||
s16 samples[0x40];
|
||||
};
|
||||
|
||||
struct Struct80332190
|
||||
struct AudioSessionSettings
|
||||
{
|
||||
/*0x00*/ u32 frequency;
|
||||
/*0x04*/ u8 maxSimultaneousNotes;
|
||||
/*0x05*/ u8 unk5; // stored to D_802212A2, always 1
|
||||
/*0x06*/ u16 unk6; // memory requirement of some sort
|
||||
/*0x08*/ u16 unk8; // gain? stored to D_802211B0.unk4
|
||||
/*0x05*/ u8 reverbDownsampleRate; // always 1
|
||||
/*0x06*/ u16 reverbWindowSize;
|
||||
/*0x08*/ u16 reverbGain;
|
||||
/*0x0A*/ u16 volume;
|
||||
/*0x0C*/ u32 persistentSeqMem;
|
||||
/*0x10*/ u32 persistentBankMem;
|
||||
|
||||
+39
-48
@@ -12,11 +12,11 @@ struct SharedDma {
|
||||
/*0x0*/ u8 *buffer; // target, points to pre-allocated buffer
|
||||
/*0x4*/ uintptr_t source; // device address
|
||||
/*0x8*/ u16 sizeUnused; // set to bufSize, never read
|
||||
/*0xA*/ u16 bufSize;
|
||||
/*0xC*/ u8 unused2; // set to 0, never read
|
||||
/*0xD*/ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
|
||||
/*0xE*/ u8 ttl; // duration after which the DMA can be discarded
|
||||
}; // size = 0x10
|
||||
/*0xA*/ u16 bufSize; // size of buffer
|
||||
/*0xC*/ u8 unused2; // set to 0, never read
|
||||
/*0xD*/ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
|
||||
/*0xE*/ u8 ttl; // duration after which the DMA can be discarded
|
||||
}; // size = 0x10
|
||||
|
||||
struct Note *gNotes;
|
||||
struct SequencePlayer gSequencePlayers[SEQUENCE_PLAYERS];
|
||||
@@ -126,25 +126,23 @@ void decrease_sample_dma_ttls() {
|
||||
sUnused80226B40 = 0;
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
|
||||
void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
ssize_t bufferPos; // v0
|
||||
struct SharedDma *dma; // sp58, v1, t0
|
||||
u32 transfer; // v0
|
||||
u32 dmaDevAddr; // s0
|
||||
u32 i; // a0
|
||||
u32 dmaIndex; // sp48, t2
|
||||
s32 hasDma = 0; // t4
|
||||
UNUSED s32 pad;
|
||||
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
s32 hasDma = FALSE;
|
||||
struct SharedDma *dma;
|
||||
uintptr_t dmaDevAddr;
|
||||
u32 transfer;
|
||||
u32 i;
|
||||
u32 dmaIndex;
|
||||
ssize_t bufferPos;
|
||||
UNUSED u32 pad;
|
||||
|
||||
if (arg2 != 0 || *arg3 >= sSampleDmaListSize1) {
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
|
||||
dma = sSampleDmas + i;
|
||||
bufferPos = (uintptr_t) devAddr - dma->source;
|
||||
bufferPos = devAddr - dma->source;
|
||||
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
|
||||
// We already have a DMA request for this memory range.
|
||||
if (dma->ttl == 0 && sSampleDmaReuseQueueHead2 != sSampleDmaReuseQueueTail2) {
|
||||
if (dma->ttl == 0 && sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2) {
|
||||
// Move the DMA out of the reuse queue, by swapping it with the
|
||||
// tail, and then incrementing the tail.
|
||||
if (dma->reuseIndex != sSampleDmaReuseQueueTail2) {
|
||||
@@ -157,21 +155,21 @@ void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
}
|
||||
dma->ttl = 60;
|
||||
*arg3 = (u8) i;
|
||||
bufferPos = (uintptr_t) devAddr - dma->source;
|
||||
return dma->buffer + bufferPos;
|
||||
return (devAddr - dma->source) + dma->buffer;
|
||||
}
|
||||
}
|
||||
|
||||
if (sSampleDmaReuseQueueHead2 != sSampleDmaReuseQueueTail2 && arg2 != 0) {
|
||||
if (sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2 && arg2 != 0) {
|
||||
// Allocate a DMA from reuse queue 2. This queue can be empty, since
|
||||
// TTL 60 is pretty large.
|
||||
dmaIndex = sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2++];
|
||||
dma = &sSampleDmas[dmaIndex];
|
||||
hasDma = 1;
|
||||
dmaIndex = sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
|
||||
sSampleDmaReuseQueueTail2++;
|
||||
dma = sSampleDmas + dmaIndex;
|
||||
hasDma = TRUE;
|
||||
}
|
||||
} else {
|
||||
dma = &sSampleDmas[*arg3];
|
||||
bufferPos = (uintptr_t) devAddr - dma->source;
|
||||
dma = sSampleDmas + *arg3;
|
||||
bufferPos = devAddr - dma->source;
|
||||
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
|
||||
// We already have DMA for this memory range.
|
||||
if (dma->ttl == 0) {
|
||||
@@ -184,10 +182,9 @@ void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
dma->reuseIndex;
|
||||
}
|
||||
sSampleDmaReuseQueueTail1++;
|
||||
bufferPos = (uintptr_t) devAddr - dma->source;
|
||||
}
|
||||
dma->ttl = 2;
|
||||
return dma->buffer + bufferPos;
|
||||
return (devAddr - dma->source) + dma->buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,12 +192,12 @@ void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
// Allocate a DMA from reuse queue 1. This queue will hopefully never
|
||||
// be empty, since TTL 2 is so small.
|
||||
dmaIndex = sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1++];
|
||||
dma = &sSampleDmas[dmaIndex];
|
||||
hasDma = 1;
|
||||
dma = sSampleDmas + dmaIndex;
|
||||
hasDma = TRUE;
|
||||
}
|
||||
|
||||
transfer = dma->bufSize;
|
||||
dmaDevAddr = (uintptr_t) devAddr & ~0xF;
|
||||
dmaDevAddr = devAddr & ~0xF;
|
||||
dma->ttl = 2;
|
||||
dma->source = dmaDevAddr;
|
||||
dma->sizeUnused = transfer;
|
||||
@@ -211,15 +208,9 @@ void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3) {
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount - 1], OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
*arg3 = dmaIndex;
|
||||
return dma->buffer + (uintptr_t) devAddr - dmaDevAddr;
|
||||
return dma->buffer + (devAddr - dmaDevAddr);
|
||||
}
|
||||
|
||||
#elif defined(VERSION_JP)
|
||||
GLOBAL_ASM("asm/non_matchings/dma_sample_data_jp.s")
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/dma_sample_data_us.s")
|
||||
#endif
|
||||
|
||||
// called from sound_reset
|
||||
void func_8031758C(UNUSED s32 arg0) {
|
||||
s32 i;
|
||||
@@ -227,7 +218,7 @@ void func_8031758C(UNUSED s32 arg0) {
|
||||
|
||||
D_80226D68 = 144 * 9;
|
||||
for (i = 0; i < gMaxSimultaneousNotes * 3; i++) {
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&D_802212C8, D_80226D68);
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, D_80226D68);
|
||||
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
|
||||
goto out1;
|
||||
}
|
||||
@@ -255,7 +246,7 @@ out1:
|
||||
|
||||
D_80226D68 = 160 * 9;
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&D_802212C8, D_80226D68);
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, D_80226D68);
|
||||
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
|
||||
goto out2;
|
||||
}
|
||||
@@ -726,17 +717,17 @@ void audio_init() {
|
||||
gCurrAudioFrameDmaCount = 0;
|
||||
gSampleDmaNumListItems = 0;
|
||||
|
||||
func_80316108(D_80333EF0);
|
||||
sound_init_main_pools(D_80333EF0);
|
||||
|
||||
for (i = 0; i < NUMAIBUFFERS; i++) {
|
||||
gAiBuffers[i] = soundAlloc(&gSoundPool, 0xa00);
|
||||
gAiBuffers[i] = soundAlloc(&gAudioInitPool, 0xa00);
|
||||
|
||||
for (j = 0; j < 0x500; j++) {
|
||||
gAiBuffers[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
func_80316928(&D_80332190[0]);
|
||||
audio_reset_session(&gAudioSessionPresets[0]);
|
||||
|
||||
// Load header for sequence data (assets/music_data.sbk.s)
|
||||
gSeqFileHeader = (ALSeqFile *) buf;
|
||||
@@ -744,7 +735,7 @@ void audio_init() {
|
||||
audio_dma_copy_immediate((uintptr_t) data, gSeqFileHeader, 0x10);
|
||||
gSequenceCount = gSeqFileHeader->seqCount;
|
||||
size = ALIGN16(gSequenceCount * sizeof(ALSeqData) + 4);
|
||||
gSeqFileHeader = soundAlloc(&gSoundPool, size);
|
||||
gSeqFileHeader = soundAlloc(&gAudioInitPool, size);
|
||||
audio_dma_copy_immediate((uintptr_t) data, gSeqFileHeader, size);
|
||||
alSeqFileNew(gSeqFileHeader, data);
|
||||
|
||||
@@ -754,8 +745,8 @@ void audio_init() {
|
||||
audio_dma_copy_immediate((uintptr_t) data, gAlCtlHeader, 0x10);
|
||||
size = gAlCtlHeader->seqCount * sizeof(ALSeqData) + 4;
|
||||
size = ALIGN16(size);
|
||||
gCtlEntries = soundAlloc(&gSoundPool, gAlCtlHeader->seqCount * sizeof(struct CtlEntry));
|
||||
gAlCtlHeader = soundAlloc(&gSoundPool, size);
|
||||
gCtlEntries = soundAlloc(&gAudioInitPool, gAlCtlHeader->seqCount * sizeof(struct CtlEntry));
|
||||
gAlCtlHeader = soundAlloc(&gAudioInitPool, size);
|
||||
audio_dma_copy_immediate((uintptr_t) data, gAlCtlHeader, size);
|
||||
alSeqFileNew(gAlCtlHeader, data);
|
||||
|
||||
@@ -764,12 +755,12 @@ void audio_init() {
|
||||
audio_dma_copy_immediate((uintptr_t) data, gAlTbl, 0x10);
|
||||
size = gAlTbl->seqCount * sizeof(ALSeqData) + 4;
|
||||
size = ALIGN16(size);
|
||||
gAlTbl = soundAlloc(&gSoundPool, size);
|
||||
gAlTbl = soundAlloc(&gAudioInitPool, size);
|
||||
audio_dma_copy_immediate((uintptr_t) gSoundDataRaw, gAlTbl, size);
|
||||
alSeqFileNew(gAlTbl, gSoundDataRaw);
|
||||
|
||||
// Load bank sets for each sequence (assets/bank_sets.s)
|
||||
gAlBankSets = soundAlloc(&gSoundPool, 0x100);
|
||||
gAlBankSets = soundAlloc(&gAudioInitPool, 0x100);
|
||||
audio_dma_copy_immediate((uintptr_t) gBankSetsData, gAlBankSets, 0x100);
|
||||
|
||||
func_8031D4B8();
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ extern u8 *gAlBankSets;
|
||||
|
||||
void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg);
|
||||
void decrease_sample_dma_ttls(void);
|
||||
void *dma_sample_data(u8 *devAddr, u32 size, s32 arg2, u8 *arg3);
|
||||
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *arg3);
|
||||
void func_8031758C(s32 arg0);
|
||||
void func_8031784C(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums);
|
||||
void preload_sequence(u32 seqId, u8 preloadMask);
|
||||
|
||||
+109
-109
@@ -10,37 +10,37 @@
|
||||
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
|
||||
struct Struct803161E0 {
|
||||
struct PoolSplit {
|
||||
u32 wantSeq;
|
||||
u32 wantBank;
|
||||
u32 wantUnused;
|
||||
u32 wantCustom;
|
||||
}; // size = 0x10
|
||||
|
||||
struct U32Pair {
|
||||
struct PoolSplit2 {
|
||||
u32 wantPersistent;
|
||||
u32 wantTemporary;
|
||||
}; // size = 0x8
|
||||
|
||||
s16 D_802212A0;
|
||||
s8 D_802212A2;
|
||||
u8 D_802212A3;
|
||||
s16 gVolume;
|
||||
s8 gReverbDownsampleRate;
|
||||
u8 sReverbDownsampleRateLog; // never read
|
||||
|
||||
struct SoundAllocPool D_802212A8;
|
||||
struct SoundAllocPool gSoundPool;
|
||||
struct SoundAllocPool D_802212C8;
|
||||
struct SoundAllocPool gAudioSessionPool;
|
||||
struct SoundAllocPool gAudioInitPool;
|
||||
struct SoundAllocPool gNotesAndBuffersPool;
|
||||
u8 sAudioMemoryPad[0x20]; // probably two unused pools
|
||||
struct SoundAllocPool D_802212F8;
|
||||
struct SoundAllocPool D_80221308;
|
||||
struct SoundAllocPool D_80221318;
|
||||
struct SoundAllocPool gSeqAndBankPool;
|
||||
struct SoundAllocPool gPersistentCommonPool;
|
||||
struct SoundAllocPool gTemporaryCommonPool;
|
||||
struct SoundMultiPool gSeqLoadedPool;
|
||||
struct SoundMultiPool gBankLoadedPool;
|
||||
struct SoundMultiPool gUnusedLoadedPool;
|
||||
|
||||
struct Struct803161E0 D_80221898;
|
||||
struct U32Pair D_802218A8;
|
||||
struct Struct803161E0 D_802218B0;
|
||||
struct Struct803161E0 D_802218C0;
|
||||
struct PoolSplit sSessionPoolSplit;
|
||||
struct PoolSplit2 sSeqAndBankPoolSplit;
|
||||
struct PoolSplit sPersistentCommonPoolSplit;
|
||||
struct PoolSplit sTemporaryCommonPoolSplit;
|
||||
|
||||
u8 gBankLoadStatus[0x40];
|
||||
u8 gSeqLoadStatus[0x100];
|
||||
@@ -108,19 +108,19 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) {
|
||||
return start;
|
||||
}
|
||||
|
||||
void func_80316094(struct SoundAllocPool *pool, void *arg1, u32 arg2) {
|
||||
pool->cur = pool->start = (u8 *) (((uintptr_t) arg1 + 0xf) & -0x10);
|
||||
pool->size = arg2;
|
||||
void sound_alloc_pool_init(struct SoundAllocPool *pool, void *memAddr, u32 size) {
|
||||
pool->cur = pool->start = (u8 *) (((uintptr_t) memAddr + 0xf) & -0x10);
|
||||
pool->size = size;
|
||||
pool->unused = 0;
|
||||
}
|
||||
|
||||
void func_803160B4(struct PersistentPool *persistent) {
|
||||
void persistent_pool_clear(struct PersistentPool *persistent) {
|
||||
persistent->pool.unused = 0;
|
||||
persistent->pool.cur = persistent->pool.start;
|
||||
persistent->numEntries = 0;
|
||||
}
|
||||
|
||||
void func_803160C8(struct TemporaryPool *temporary) {
|
||||
void temporary_pool_clear(struct TemporaryPool *temporary) {
|
||||
temporary->pool.unused = 0;
|
||||
temporary->pool.cur = temporary->pool.start;
|
||||
temporary->nextSide = 0;
|
||||
@@ -135,43 +135,43 @@ void unused_803160F8(struct SoundAllocPool *pool) {
|
||||
pool->cur = pool->start;
|
||||
}
|
||||
|
||||
void func_80316108(s32 arg0) {
|
||||
func_80316094(&gSoundPool, gAudioHeap, arg0);
|
||||
func_80316094(&D_802212A8, gAudioHeap + arg0, gAudioHeapSize - arg0);
|
||||
void sound_init_main_pools(s32 sizeForAudioInitPool) {
|
||||
sound_alloc_pool_init(&gAudioInitPool, gAudioHeap, sizeForAudioInitPool);
|
||||
sound_alloc_pool_init(&gAudioSessionPool, gAudioHeap + sizeForAudioInitPool, gAudioHeapSize - sizeForAudioInitPool);
|
||||
}
|
||||
|
||||
void func_80316164(struct Struct803161E0 *a) {
|
||||
D_802212A8.cur = D_802212A8.start;
|
||||
func_80316094(&D_802212C8, soundAlloc(&D_802212A8, a->wantSeq), a->wantSeq);
|
||||
func_80316094(&D_802212F8, soundAlloc(&D_802212A8, a->wantCustom), a->wantCustom);
|
||||
void session_pools_init(struct PoolSplit *a) {
|
||||
gAudioSessionPool.cur = gAudioSessionPool.start;
|
||||
sound_alloc_pool_init(&gNotesAndBuffersPool, soundAlloc(&gAudioSessionPool, a->wantSeq), a->wantSeq);
|
||||
sound_alloc_pool_init(&gSeqAndBankPool, soundAlloc(&gAudioSessionPool, a->wantCustom), a->wantCustom);
|
||||
}
|
||||
|
||||
void func_803161E0(struct U32Pair *a) {
|
||||
D_802212F8.cur = D_802212F8.start;
|
||||
func_80316094(&D_80221308, soundAlloc(&D_802212F8, a->wantPersistent), a->wantPersistent);
|
||||
func_80316094(&D_80221318, soundAlloc(&D_802212F8, a->wantTemporary), a->wantTemporary);
|
||||
void seq_and_bank_pool_init(struct PoolSplit2 *a) {
|
||||
gSeqAndBankPool.cur = gSeqAndBankPool.start;
|
||||
sound_alloc_pool_init(&gPersistentCommonPool, soundAlloc(&gSeqAndBankPool, a->wantPersistent), a->wantPersistent);
|
||||
sound_alloc_pool_init(&gTemporaryCommonPool, soundAlloc(&gSeqAndBankPool, a->wantTemporary), a->wantTemporary);
|
||||
}
|
||||
|
||||
void func_8031625C(struct Struct803161E0 *a) {
|
||||
D_80221308.cur = D_80221308.start;
|
||||
func_80316094(&gSeqLoadedPool.persistent.pool, soundAlloc(&D_80221308, a->wantSeq), a->wantSeq);
|
||||
func_80316094(&gBankLoadedPool.persistent.pool, soundAlloc(&D_80221308, a->wantBank), a->wantBank);
|
||||
func_80316094(&gUnusedLoadedPool.persistent.pool, soundAlloc(&D_80221308, a->wantUnused),
|
||||
void persistent_pools_init(struct PoolSplit *a) {
|
||||
gPersistentCommonPool.cur = gPersistentCommonPool.start;
|
||||
sound_alloc_pool_init(&gSeqLoadedPool.persistent.pool, soundAlloc(&gPersistentCommonPool, a->wantSeq), a->wantSeq);
|
||||
sound_alloc_pool_init(&gBankLoadedPool.persistent.pool, soundAlloc(&gPersistentCommonPool, a->wantBank), a->wantBank);
|
||||
sound_alloc_pool_init(&gUnusedLoadedPool.persistent.pool, soundAlloc(&gPersistentCommonPool, a->wantUnused),
|
||||
a->wantUnused);
|
||||
func_803160B4(&gSeqLoadedPool.persistent);
|
||||
func_803160B4(&gBankLoadedPool.persistent);
|
||||
func_803160B4(&gUnusedLoadedPool.persistent);
|
||||
persistent_pool_clear(&gSeqLoadedPool.persistent);
|
||||
persistent_pool_clear(&gBankLoadedPool.persistent);
|
||||
persistent_pool_clear(&gUnusedLoadedPool.persistent);
|
||||
}
|
||||
|
||||
void func_80316318(struct Struct803161E0 *a) {
|
||||
D_80221318.cur = D_80221318.start;
|
||||
func_80316094(&gSeqLoadedPool.temporary.pool, soundAlloc(&D_80221318, a->wantSeq), a->wantSeq);
|
||||
func_80316094(&gBankLoadedPool.temporary.pool, soundAlloc(&D_80221318, a->wantBank), a->wantBank);
|
||||
func_80316094(&gUnusedLoadedPool.temporary.pool, soundAlloc(&D_80221318, a->wantUnused),
|
||||
void temporary_pools_init(struct PoolSplit *a) {
|
||||
gTemporaryCommonPool.cur = gTemporaryCommonPool.start;
|
||||
sound_alloc_pool_init(&gSeqLoadedPool.temporary.pool, soundAlloc(&gTemporaryCommonPool, a->wantSeq), a->wantSeq);
|
||||
sound_alloc_pool_init(&gBankLoadedPool.temporary.pool, soundAlloc(&gTemporaryCommonPool, a->wantBank), a->wantBank);
|
||||
sound_alloc_pool_init(&gUnusedLoadedPool.temporary.pool, soundAlloc(&gTemporaryCommonPool, a->wantUnused),
|
||||
a->wantUnused);
|
||||
func_803160C8(&gSeqLoadedPool.temporary);
|
||||
func_803160C8(&gBankLoadedPool.temporary);
|
||||
func_803160C8(&gUnusedLoadedPool.temporary);
|
||||
temporary_pool_clear(&gSeqLoadedPool.temporary);
|
||||
temporary_pool_clear(&gBankLoadedPool.temporary);
|
||||
temporary_pool_clear(&gUnusedLoadedPool.temporary);
|
||||
}
|
||||
|
||||
static void unused_803163D4() {
|
||||
@@ -366,8 +366,8 @@ void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_803168CC(void) {
|
||||
D_802211B0.unk4 -= D_802211B0.unk4 / 4;
|
||||
void decrease_reverb_gain(void) {
|
||||
gSynthesisReverb.reverbGain -= gSynthesisReverb.reverbGain / 4;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -381,10 +381,10 @@ void wait_for_audio_frames(s32 frames) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_80316928(struct Struct80332190 *arg0) {
|
||||
void audio_reset_session(struct AudioSessionSettings *preset) {
|
||||
s8 updatesPerFrame;
|
||||
s16 *mem;
|
||||
s32 sp2C;
|
||||
s32 reverbWindowSize;
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 k;
|
||||
@@ -396,7 +396,7 @@ void func_80316928(struct Struct80332190 *arg0) {
|
||||
s32 remainingDmas;
|
||||
|
||||
if (gAudioLoadLock != AUDIO_LOCK_UNINITIALIZED) {
|
||||
func_803168CC();
|
||||
decrease_reverb_gain();
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
if (gNotes[i].enabled && gNotes[i].adsr.state != ADSR_STATE_DISABLED) {
|
||||
gNotes[i].adsr.fadeOutVel = 0x8000 / gAudioUpdatesPerFrame;
|
||||
@@ -425,7 +425,7 @@ void func_80316928(struct Struct80332190 *arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
func_803168CC();
|
||||
decrease_reverb_gain();
|
||||
wait_for_audio_frames(3);
|
||||
gAudioLoadLock = AUDIO_LOCK_LOADING;
|
||||
wait_for_audio_frames(3);
|
||||
@@ -447,34 +447,34 @@ void func_80316928(struct Struct80332190 *arg0) {
|
||||
}
|
||||
|
||||
gSampleDmaNumListItems = 0;
|
||||
sp2C = arg0->unk6;
|
||||
gAiFrequency = osAiSetFrequency(arg0->frequency);
|
||||
gMaxSimultaneousNotes = arg0->maxSimultaneousNotes;
|
||||
reverbWindowSize = preset->reverbWindowSize;
|
||||
gAiFrequency = osAiSetFrequency(preset->frequency);
|
||||
gMaxSimultaneousNotes = preset->maxSimultaneousNotes;
|
||||
D_80226D74 = ALIGN16(gAiFrequency / 60);
|
||||
D_802212A2 = arg0->unk5;
|
||||
gReverbDownsampleRate = preset->reverbDownsampleRate;
|
||||
|
||||
switch (D_802212A2) {
|
||||
switch (gReverbDownsampleRate) {
|
||||
case 1:
|
||||
D_802212A3 = 0;
|
||||
sReverbDownsampleRateLog = 0;
|
||||
break;
|
||||
case 2:
|
||||
D_802212A3 = 1;
|
||||
sReverbDownsampleRateLog = 1;
|
||||
break;
|
||||
case 4:
|
||||
D_802212A3 = 2;
|
||||
sReverbDownsampleRateLog = 2;
|
||||
break;
|
||||
case 8:
|
||||
D_802212A3 = 3;
|
||||
sReverbDownsampleRateLog = 3;
|
||||
break;
|
||||
case 16:
|
||||
D_802212A3 = 4;
|
||||
sReverbDownsampleRateLog = 4;
|
||||
break;
|
||||
default:
|
||||
D_802212A3 = 0;
|
||||
sReverbDownsampleRateLog = 0;
|
||||
}
|
||||
|
||||
D_802212A2 = arg0->unk5;
|
||||
D_802212A0 = arg0->volume;
|
||||
gReverbDownsampleRate = preset->reverbDownsampleRate;
|
||||
gVolume = preset->volume;
|
||||
gMinAiBufferLength = D_80226D74 - 0x10;
|
||||
updatesPerFrame = D_80226D74 / 160 + 1;
|
||||
gAudioUpdatesPerFrame = D_80226D74 / 160 + 1;
|
||||
@@ -489,60 +489,60 @@ void func_80316928(struct Struct80332190 *arg0) {
|
||||
#endif
|
||||
|
||||
D_80226D6C = gMaxSimultaneousNotes * 20 * updatesPerFrame + 320;
|
||||
persistentMem = arg0->persistentBankMem + arg0->persistentSeqMem;
|
||||
temporaryMem = arg0->temporaryBankMem + arg0->temporarySeqMem;
|
||||
persistentMem = DOUBLE_SIZE_ON_64_BIT(preset->persistentBankMem + preset->persistentSeqMem);
|
||||
temporaryMem = DOUBLE_SIZE_ON_64_BIT(preset->temporaryBankMem + preset->temporarySeqMem);
|
||||
totalMem = persistentMem + temporaryMem;
|
||||
wantMisc = D_802212A8.size - totalMem - 0x100;
|
||||
D_80221898.wantSeq = wantMisc;
|
||||
D_80221898.wantCustom = totalMem;
|
||||
func_80316164(&D_80221898);
|
||||
D_802218A8.wantPersistent = persistentMem;
|
||||
D_802218A8.wantTemporary = temporaryMem;
|
||||
func_803161E0(&D_802218A8);
|
||||
D_802218B0.wantSeq = arg0->persistentSeqMem;
|
||||
D_802218B0.wantBank = arg0->persistentBankMem;
|
||||
D_802218B0.wantUnused = 0;
|
||||
func_8031625C(&D_802218B0);
|
||||
D_802218C0.wantSeq = arg0->temporarySeqMem;
|
||||
D_802218C0.wantBank = arg0->temporaryBankMem;
|
||||
D_802218C0.wantUnused = 0;
|
||||
func_80316318(&D_802218C0);
|
||||
wantMisc = gAudioSessionPool.size - totalMem - 0x100;
|
||||
sSessionPoolSplit.wantSeq = wantMisc;
|
||||
sSessionPoolSplit.wantCustom = totalMem;
|
||||
session_pools_init(&sSessionPoolSplit);
|
||||
sSeqAndBankPoolSplit.wantPersistent = persistentMem;
|
||||
sSeqAndBankPoolSplit.wantTemporary = temporaryMem;
|
||||
seq_and_bank_pool_init(&sSeqAndBankPoolSplit);
|
||||
sPersistentCommonPoolSplit.wantSeq = DOUBLE_SIZE_ON_64_BIT(preset->persistentSeqMem);
|
||||
sPersistentCommonPoolSplit.wantBank = DOUBLE_SIZE_ON_64_BIT(preset->persistentBankMem);
|
||||
sPersistentCommonPoolSplit.wantUnused = 0;
|
||||
persistent_pools_init(&sPersistentCommonPoolSplit);
|
||||
sTemporaryCommonPoolSplit.wantSeq = DOUBLE_SIZE_ON_64_BIT(preset->temporarySeqMem);
|
||||
sTemporaryCommonPoolSplit.wantBank = DOUBLE_SIZE_ON_64_BIT(preset->temporaryBankMem);
|
||||
sTemporaryCommonPoolSplit.wantUnused = 0;
|
||||
temporary_pools_init(&sTemporaryCommonPoolSplit);
|
||||
reset_bank_and_seq_load_status();
|
||||
|
||||
for (j = 0; j < 2; j++) {
|
||||
gAudioCmdBuffers[j] = soundAlloc(&D_802212C8, D_80226D6C * 8);
|
||||
gAudioCmdBuffers[j] = soundAlloc(&gNotesAndBuffersPool, D_80226D6C * 8);
|
||||
}
|
||||
|
||||
gNotes = soundAlloc(&D_802212C8, gMaxSimultaneousNotes * sizeof(struct Note));
|
||||
gNotes = soundAlloc(&gNotesAndBuffersPool, gMaxSimultaneousNotes * sizeof(struct Note));
|
||||
note_init_all();
|
||||
init_note_free_list();
|
||||
|
||||
if (sp2C == 0) {
|
||||
D_802211B0.unk1 = 0;
|
||||
if (reverbWindowSize == 0) {
|
||||
gSynthesisReverb.useReverb = 0;
|
||||
} else {
|
||||
D_802211B0.unk1 = 8;
|
||||
D_802211B0.unk14.unk00 = soundAlloc(&D_802212C8, sp2C * 2);
|
||||
D_802211B0.unk14.unk04 = soundAlloc(&D_802212C8, sp2C * 2);
|
||||
D_802211B0.unk8 = 0;
|
||||
D_802211B0.unkC = 0;
|
||||
D_802211B0.unk3 = 0;
|
||||
D_802211B0.unk10 = sp2C;
|
||||
D_802211B0.unk4 = arg0->unk8;
|
||||
D_802211B0.unk2 = 2;
|
||||
if (D_802212A2 != 1) {
|
||||
D_802211B0.unk0 = 1;
|
||||
D_802211B0.unk6 = 0x8000 / D_802212A2;
|
||||
D_802211B0.unk1C = soundAlloc(&D_802212C8, 32);
|
||||
D_802211B0.unk20 = soundAlloc(&D_802212C8, 32);
|
||||
D_802211B0.unk24 = soundAlloc(&D_802212C8, 32);
|
||||
D_802211B0.unk28 = soundAlloc(&D_802212C8, 32);
|
||||
gSynthesisReverb.useReverb = 8;
|
||||
gSynthesisReverb.ringBuffer.left = soundAlloc(&gNotesAndBuffersPool, reverbWindowSize * 2);
|
||||
gSynthesisReverb.ringBuffer.right = soundAlloc(&gNotesAndBuffersPool, reverbWindowSize * 2);
|
||||
gSynthesisReverb.nextRingBufferPos = 0;
|
||||
gSynthesisReverb.unkC = 0;
|
||||
gSynthesisReverb.curFrame = 0;
|
||||
gSynthesisReverb.bufSizePerChannel = reverbWindowSize;
|
||||
gSynthesisReverb.reverbGain = preset->reverbGain;
|
||||
gSynthesisReverb.framesLeftToIgnore = 2;
|
||||
if (gReverbDownsampleRate != 1) {
|
||||
gSynthesisReverb.resampleFlags = A_INIT;
|
||||
gSynthesisReverb.resampleRate = 0x8000 / gReverbDownsampleRate;
|
||||
gSynthesisReverb.resampleStateLeft = soundAlloc(&gNotesAndBuffersPool, 16 * sizeof(s16));
|
||||
gSynthesisReverb.resampleStateRight = soundAlloc(&gNotesAndBuffersPool, 16 * sizeof(s16));
|
||||
gSynthesisReverb.unk24 = soundAlloc(&gNotesAndBuffersPool, 16 * sizeof(s16));
|
||||
gSynthesisReverb.unk28 = soundAlloc(&gNotesAndBuffersPool, 16 * sizeof(s16));
|
||||
for (i = 0; i < gAudioUpdatesPerFrame; i++) {
|
||||
mem = soundAlloc(&D_802212C8, 0x280);
|
||||
D_802211B0.unk2C[0][i].unk4 = mem;
|
||||
D_802211B0.unk2C[0][i].unk8 = mem + 0xA0;
|
||||
mem = soundAlloc(&D_802212C8, 0x280);
|
||||
D_802211B0.unk2C[1][i].unk4 = mem;
|
||||
D_802211B0.unk2C[1][i].unk8 = mem + 0xA0;
|
||||
mem = soundAlloc(&gNotesAndBuffersPool, 0x280);
|
||||
gSynthesisReverb.items[0][i].toDownsampleLeft = mem;
|
||||
gSynthesisReverb.items[0][i].toDownsampleRight = mem + 0xA0;
|
||||
mem = soundAlloc(&gNotesAndBuffersPool, 0x280);
|
||||
gSynthesisReverb.items[1][i].toDownsampleLeft = mem;
|
||||
gSynthesisReverb.items[1][i].toDownsampleRight = mem + 0xA0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -47,20 +47,20 @@ struct SoundMultiPool
|
||||
}; // size = 0x1D0
|
||||
|
||||
extern u8 gAudioHeap[];
|
||||
extern s16 D_802212A0;
|
||||
extern s8 D_802212A2;
|
||||
extern u8 D_802212A3;
|
||||
extern struct SoundAllocPool gSoundPool;
|
||||
extern struct SoundAllocPool D_802212C8;
|
||||
extern s16 gVolume;
|
||||
extern s8 gReverbDownsampleRate;
|
||||
extern u8 sReverbDownsampleRateLog;
|
||||
extern struct SoundAllocPool gAudioInitPool;
|
||||
extern struct SoundAllocPool gNotesAndBuffersPool;
|
||||
extern struct SoundMultiPool gSeqLoadedPool;
|
||||
extern struct SoundMultiPool gBankLoadedPool;
|
||||
extern u8 gBankLoadStatus[64];
|
||||
extern u8 gSeqLoadStatus[256];
|
||||
|
||||
void *soundAlloc(struct SoundAllocPool *pool, u32 size);
|
||||
void func_80316108(s32 arg0);
|
||||
void sound_init_main_pools(s32 sizeForAudioInitPool);
|
||||
void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id);
|
||||
void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 arg2);
|
||||
void func_80316928(struct Struct80332190 *arg0);
|
||||
void audio_reset_session(struct AudioSessionSettings *preset);
|
||||
|
||||
#endif /* _AUDIO_MEMORY_H */
|
||||
|
||||
+10
-10
@@ -53,8 +53,8 @@ void func_80318908(void) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
note = &gNotes[i];
|
||||
if (note->priority != NOTE_PRIORITY_DISABLED) {
|
||||
if (note->priority == NOTE_PRIORITY_STOPPING || note->unk0b10) {
|
||||
if (note->adsrVolScale == 0 || note->unk0b10) {
|
||||
if (note->priority == NOTE_PRIORITY_STOPPING || note->finished) {
|
||||
if (note->adsrVolScale == 0 || note->finished) {
|
||||
if (note->wantedParentLayer != NO_LAYER) {
|
||||
note_disable2(note);
|
||||
if (note->wantedParentLayer->seqChannel != NULL) {
|
||||
@@ -219,7 +219,7 @@ void func_80318F04(struct Note *note, struct SequenceChannelLayer *seqLayer) {
|
||||
note->instOrWave = (u8) seqLayer->seqChannel->instOrWave;
|
||||
for (i = -1, pos = 0; pos < 0x40; pos += stepSize) {
|
||||
i++;
|
||||
note->unk34->samples[i] = gWaveSamples[seqLayer->seqChannel->instOrWave - 0x80][pos];
|
||||
note->synthesisBuffers->samples[i] = gWaveSamples[seqLayer->seqChannel->instOrWave - 0x80][pos];
|
||||
}
|
||||
|
||||
// Repeat sample
|
||||
@@ -227,25 +227,25 @@ void func_80318F04(struct Note *note, struct SequenceChannelLayer *seqLayer) {
|
||||
lim = note->sampleCount;
|
||||
if (offset < 0 || offset > 0) {
|
||||
for (j = 0; j < lim; j++) {
|
||||
note->unk34->samples[offset + j] = note->unk34->samples[j];
|
||||
note->synthesisBuffers->samples[offset + j] = note->synthesisBuffers->samples[j];
|
||||
}
|
||||
} else {
|
||||
for (j = 0; j < lim; j++) {
|
||||
note->unk34->samples[offset + j] = note->unk34->samples[j];
|
||||
note->synthesisBuffers->samples[offset + j] = note->synthesisBuffers->samples[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
osWritebackDCache(note->unk34->samples, sizeof(note->unk34->samples));
|
||||
osWritebackDCache(note->synthesisBuffers->samples, sizeof(note->synthesisBuffers->samples));
|
||||
}
|
||||
|
||||
void func_80319164(struct Note *note, struct SequenceChannelLayer *seqLayer) {
|
||||
s32 sampleCount = note->sampleCount;
|
||||
func_80318F04(note, seqLayer);
|
||||
if (sampleCount != 0) {
|
||||
note->unk14 *= note->sampleCount / sampleCount;
|
||||
note->samplePosInt *= note->sampleCount / sampleCount;
|
||||
} else {
|
||||
note->unk14 = 0;
|
||||
note->samplePosInt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,7 +591,7 @@ void note_init_all(void) {
|
||||
note->wantedParentLayer = NO_LAYER;
|
||||
note->prevParentLayer = NO_LAYER;
|
||||
note->reverb = 0;
|
||||
note->usesStereo = FALSE;
|
||||
note->usesHeadsetPanEffects = FALSE;
|
||||
note->sampleCount = 0;
|
||||
note->instOrWave = 0;
|
||||
note->targetVolLeft = 0;
|
||||
@@ -605,6 +605,6 @@ void note_init_all(void) {
|
||||
note->vibratoState.active = FALSE;
|
||||
note->portamento.cur = 0.0f;
|
||||
note->portamento.speed = 0.0f;
|
||||
note->unk34 = soundAlloc(&D_802212C8, 0x190);
|
||||
note->synthesisBuffers = soundAlloc(&gNotesAndBuffersPool, sizeof(struct NoteSynthesisBuffers));
|
||||
}
|
||||
}
|
||||
|
||||
+451
-343
File diff suppressed because it is too large
Load Diff
+26
-26
@@ -5,41 +5,41 @@
|
||||
|
||||
#define MAX_UPDATES_PER_FRAME 4
|
||||
|
||||
struct struct_3920_sp1c
|
||||
struct ReverbRingBufferItem
|
||||
{
|
||||
s16 unk00;
|
||||
s16 numSamplesAfterDownsampling;
|
||||
s16 chunkLen; // never read
|
||||
s16 *unk4;
|
||||
s16 *unk8;
|
||||
s32 unkC;
|
||||
s16 unk10[2];
|
||||
s16 *toDownsampleLeft;
|
||||
s16 *toDownsampleRight; // data pointed to by left and right are adjacent in memory
|
||||
s32 startPos; // start pos in ring buffer
|
||||
s16 lengths[2]; // first length in ring buffer (max until end) and second length in ring buffer (from pos 0)
|
||||
}; // size = 0x14
|
||||
|
||||
struct Struct802211B0
|
||||
struct SynthesisReverb
|
||||
{
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
s32 unk8;
|
||||
s32 unkC;
|
||||
s32 unk10;
|
||||
u8 resampleFlags;
|
||||
u8 useReverb;
|
||||
u8 framesLeftToIgnore;
|
||||
u8 curFrame;
|
||||
u16 reverbGain;
|
||||
u16 resampleRate;
|
||||
s32 nextRingBufferPos;
|
||||
s32 unkC; // never read
|
||||
s32 bufSizePerChannel;
|
||||
struct
|
||||
{
|
||||
s16 *unk00;
|
||||
s16 *unk04;
|
||||
} unk14;
|
||||
void *unk1C;
|
||||
void *unk20;
|
||||
void *unk24; // never read
|
||||
void *unk28;
|
||||
struct struct_3920_sp1c unk2C[2][MAX_UPDATES_PER_FRAME];
|
||||
s16 *left;
|
||||
s16 *right;
|
||||
} ringBuffer;
|
||||
s16 *resampleStateLeft;
|
||||
s16 *resampleStateRight;
|
||||
s16 *unk24; // never read
|
||||
s16 *unk28; // never read
|
||||
struct ReverbRingBufferItem items[2][MAX_UPDATES_PER_FRAME];
|
||||
}; // 0xCC <= size <= 0x100
|
||||
extern struct Struct802211B0 D_802211B0;
|
||||
extern struct SynthesisReverb gSynthesisReverb;
|
||||
|
||||
u64 *func_80313CD4(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen);
|
||||
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen);
|
||||
void note_init_volume(struct Note *note);
|
||||
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb);
|
||||
void note_set_frequency(struct Note *note, f32 frequency);
|
||||
|
||||
+11
-11
@@ -2,35 +2,35 @@
|
||||
|
||||
#include "buffers.h"
|
||||
|
||||
u8 gDecompressionHeap[0xD000];
|
||||
ALIGNED8 u8 gDecompressionHeap[0xD000];
|
||||
|
||||
u8 gAudioHeap[0x31200];
|
||||
ALIGNED16 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(0x31200)];
|
||||
|
||||
// Yield buffer for audio, 0x400 bytes. Stubbed out post-JP since the audio
|
||||
// task never yields.
|
||||
#ifdef VERSION_JP
|
||||
u8 gAudioSPTaskYieldBuffer[OS_YIELD_AUDIO_SIZE];
|
||||
ALIGNED8 u8 gAudioSPTaskYieldBuffer[OS_YIELD_AUDIO_SIZE];
|
||||
#endif
|
||||
|
||||
// Probably Thread 2 stack space. Unreferenced, and stubbed out with f3dex to
|
||||
// avoid an overflowing .buffers segment.
|
||||
#ifndef F3DEX_GBI_SHARED
|
||||
u8 gUnusedThread2Stack[0x1400];
|
||||
ALIGNED8 u8 gUnusedThread2Stack[0x1400];
|
||||
#endif
|
||||
|
||||
u8 gIdleThreadStack[0x800];
|
||||
u8 gThread3Stack[0x2000];
|
||||
u8 gThread4Stack[0x2000];
|
||||
u8 gThread5Stack[0x2000];
|
||||
ALIGNED8 u8 gIdleThreadStack[0x800];
|
||||
ALIGNED8 u8 gThread3Stack[0x2000];
|
||||
ALIGNED8 u8 gThread4Stack[0x2000];
|
||||
ALIGNED8 u8 gThread5Stack[0x2000];
|
||||
|
||||
// 0xc00 bytes for f3dex, 0x900 otherwise
|
||||
u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
|
||||
ALIGNED8 u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
|
||||
|
||||
// 0x200 bytes
|
||||
struct SaveBuffer gSaveBuffer;
|
||||
ALIGNED8 struct SaveBuffer gSaveBuffer;
|
||||
|
||||
// 0x400 bytes
|
||||
u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
|
||||
ALIGNED8 u8 gGfxSPTaskStack[SP_DRAM_STACK_SIZE8];
|
||||
|
||||
// 0x190a0 bytes
|
||||
struct GfxPool gGfxPools[2];
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "sm64.h"
|
||||
|
||||
// 0x70800 bytes
|
||||
#if BUGFIXES_CRITICAL
|
||||
u16 gFrameBuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#else
|
||||
u16 gFrameBuffer0[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFrameBuffer1[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
u16 gFrameBuffer2[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef FRAMEBUFFERS_H
|
||||
#define FRAMEBUFFERS_H
|
||||
|
||||
// level_script.c assumes that the frame buffers are adjacent, while game.c's
|
||||
// -g codegen implies that they are separate variables. This is impossible to
|
||||
// reconcile without undefined behavior. Avoid that on non-IDO.
|
||||
#if BUGFIXES_CRITICAL
|
||||
extern u16 gFrameBuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#define gFrameBuffer0 gFrameBuffers[0]
|
||||
#define gFrameBuffer1 gFrameBuffers[1]
|
||||
#define gFrameBuffer2 gFrameBuffers[2]
|
||||
#else
|
||||
extern u16 gFrameBuffer0[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u16 gFrameBuffer1[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u16 gFrameBuffer2[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
// 0x1f000 bytes, aligned to a 0x1000-byte boundary through sm64.ld. (This results
|
||||
// in a bunch of unused space: ~0x100 in JP, ~0x300 in US.)
|
||||
u64 gGfxSPTaskOutputBuffer[0x3e00];
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef GFX_OUTPUT_BUFFER_H
|
||||
#define GFX_OUTPUT_BUFFER_H
|
||||
|
||||
extern u64 gGfxSPTaskOutputBuffer[0x3e00];
|
||||
|
||||
#endif
|
||||
@@ -118,9 +118,9 @@ static s32 beh_cmd_graph_node(void) {
|
||||
|
||||
static s32 beh_cmd_obj_load_chill(void) {
|
||||
u32 model = (u32) gBehCommand[1];
|
||||
void *arg1 = (void *) gBehCommand[2];
|
||||
const BehaviorScript *behavior = (const BehaviorScript *) gBehCommand[2];
|
||||
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, arg1);
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
|
||||
copy_object_pos_and_angle(object, gCurrentObject);
|
||||
|
||||
@@ -130,9 +130,9 @@ static s32 beh_cmd_obj_load_chill(void) {
|
||||
|
||||
static s32 beh_cmd_obj_spawn(void) {
|
||||
u32 model = (u32) gBehCommand[1];
|
||||
void *arg1 = (void *) gBehCommand[2];
|
||||
const BehaviorScript *behavior = (const BehaviorScript *) gBehCommand[2];
|
||||
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, arg1);
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
|
||||
copy_object_pos_and_angle(object, gCurrentObject);
|
||||
|
||||
@@ -145,9 +145,9 @@ static s32 beh_cmd_obj_spawn(void) {
|
||||
static s32 beh_cmd_obj_load_chill_param(void) {
|
||||
u32 behParam = (s16)(gBehCommand[0] & 0xFFFF);
|
||||
u32 model = (u32) gBehCommand[1];
|
||||
void *arg2 = (void *) gBehCommand[2];
|
||||
const BehaviorScript *behavior = (const BehaviorScript *) gBehCommand[2];
|
||||
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, arg2);
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
|
||||
copy_object_pos_and_angle(object, gCurrentObject);
|
||||
|
||||
@@ -172,18 +172,18 @@ static s32 beh_cmd_break2(void) {
|
||||
}
|
||||
|
||||
static s32 beh_cmd_call(void) {
|
||||
uintptr_t *jumpAddress;
|
||||
const BehaviorScript *jumpAddress;
|
||||
|
||||
gBehCommand++;
|
||||
cur_object_stack_push((uintptr_t)(gBehCommand + 1));
|
||||
jumpAddress = segmented_to_virtual((void *) gBehCommand[0]);
|
||||
jumpAddress = segmented_to_virtual((const BehaviorScript *) gBehCommand[0]);
|
||||
gBehCommand = jumpAddress;
|
||||
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
|
||||
static s32 beh_cmd_return(void) {
|
||||
gBehCommand = (uintptr_t *) cur_object_stack_pop();
|
||||
gBehCommand = (const BehaviorScript *) cur_object_stack_pop();
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ static s32 beh_cmd_delay_var(void) {
|
||||
|
||||
static s32 beh_cmd_goto(void) {
|
||||
gBehCommand++;
|
||||
gBehCommand = segmented_to_virtual((void *) gBehCommand[0]);
|
||||
gBehCommand = segmented_to_virtual((const BehaviorScript *) gBehCommand[0]);
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ static s32 beh_cmd_end_repeat(void) {
|
||||
|
||||
count--;
|
||||
if (count != 0) {
|
||||
gBehCommand = (uintptr_t *) cur_object_stack_pop();
|
||||
gBehCommand = (const BehaviorScript *) cur_object_stack_pop();
|
||||
cur_object_stack_push((uintptr_t) gBehCommand);
|
||||
cur_object_stack_push(count);
|
||||
} else {
|
||||
@@ -264,7 +264,7 @@ static s32 beh_cmd_end_repeat_nobreak(void) {
|
||||
|
||||
count--;
|
||||
if (count != 0) {
|
||||
gBehCommand = (uintptr_t *) cur_object_stack_pop();
|
||||
gBehCommand = (const BehaviorScript *) cur_object_stack_pop();
|
||||
cur_object_stack_push((uintptr_t) gBehCommand);
|
||||
cur_object_stack_push(count);
|
||||
} else {
|
||||
@@ -283,7 +283,7 @@ static s32 beh_cmd_begin_loop(void) {
|
||||
}
|
||||
|
||||
static s32 beh_cmd_end_loop(void) {
|
||||
gBehCommand = (uintptr_t *) cur_object_stack_pop();
|
||||
gBehCommand = (const BehaviorScript *) cur_object_stack_pop();
|
||||
cur_object_stack_push((uintptr_t) gBehCommand);
|
||||
|
||||
return BEH_BREAK;
|
||||
@@ -432,10 +432,10 @@ static s32 beh_cmd_obj_bit_clear_int(void) {
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
|
||||
static s32 beh_cmd_obj_set_int32(void) {
|
||||
static s32 beh_cmd_obj_set_anims(void) {
|
||||
u8 objectOffset = (u8)((gBehCommand[0] >> 16) & 0xFF);
|
||||
|
||||
cur_object_set_int(objectOffset, gBehCommand[1]);
|
||||
cur_object_set_vptr(objectOffset, gBehCommand[1]);
|
||||
|
||||
gBehCommand += 2;
|
||||
return BEH_CONTINUE;
|
||||
@@ -722,7 +722,7 @@ static BehCommandProc BehaviorJumpTable[] = {
|
||||
Behavior24,
|
||||
beh_cmd_delay_var,
|
||||
Behavior26,
|
||||
beh_cmd_obj_set_int32,
|
||||
beh_cmd_obj_set_anims,
|
||||
beh_cmd_obj_animate,
|
||||
beh_cmd_obj_load_chill_param,
|
||||
beh_cmd_collision_data,
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define cur_object_set_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) = (s32)(value)
|
||||
#define cur_object_or_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) |= (s32)(value)
|
||||
#define cur_object_and_int(offset, value) gCurrentObject->OBJECT_FIELD_S32(offset) &= (s32)(value)
|
||||
#define cur_object_set_vptr(offset, value) gCurrentObject->OBJECT_FIELD_VPTR(offset) = (void *)(value)
|
||||
|
||||
#define object_and_int(object, offset, value) object->OBJECT_FIELD_S32(offset) &= (s32)(value)
|
||||
|
||||
|
||||
+34
-34
@@ -107,7 +107,7 @@ u32 unused_8038B894[3] = { 0 };
|
||||
cmd+0x04: void *branchTarget
|
||||
*/
|
||||
void geo_layout_cmd_branch_and_link(void) {
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + 4 + sizeof(void *));
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (gCurGraphNodeIndex << 16) + gGeoLayoutReturnIndex;
|
||||
gGeoLayoutReturnIndex = gGeoLayoutStackIndex;
|
||||
gGeoLayoutCommand = segmented_to_virtual(cur_geo_cmd_ptr(0x04));
|
||||
@@ -127,7 +127,7 @@ void geo_layout_cmd_end(void) {
|
||||
*/
|
||||
void geo_layout_cmd_branch(void) {
|
||||
if (cur_geo_cmd_u8(0x01) == 1) {
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + 4 + sizeof(void *));
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
|
||||
}
|
||||
|
||||
gGeoLayoutCommand = segmented_to_virtual(cur_geo_cmd_ptr(0x04));
|
||||
@@ -142,13 +142,13 @@ void geo_layout_cmd_return(void) {
|
||||
void geo_layout_cmd_open_node(void) {
|
||||
gCurGraphNodeList[gCurGraphNodeIndex + 1] = gCurGraphNodeList[gCurGraphNodeIndex];
|
||||
gCurGraphNodeIndex++;
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
// 0x05: Close node
|
||||
void geo_layout_cmd_close_node(void) {
|
||||
gCurGraphNodeIndex--;
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -164,7 +164,7 @@ void geo_layout_cmd_assign_as_view(void) {
|
||||
gGeoViews[index] = gCurGraphNodeList[gCurGraphNodeIndex];
|
||||
}
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -188,7 +188,7 @@ void geo_layout_cmd_update_node_flags(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -227,7 +227,7 @@ void geo_layout_cmd_node_root(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x0C;
|
||||
gGeoLayoutCommand += 0x0C << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -242,7 +242,7 @@ void geo_layout_cmd_node_ortho_projection(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -263,14 +263,14 @@ void geo_layout_cmd_node_perspective(void) {
|
||||
if (cur_geo_cmd_u8(0x01) != 0) {
|
||||
// optional asm function
|
||||
frustumFunc = (GraphNodeFunc) cur_geo_cmd_ptr(0x08);
|
||||
gGeoLayoutCommand += sizeof(void *);
|
||||
gGeoLayoutCommand += 4 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_perspective(gGraphNodePool, NULL, (f32) fov, near, far, frustumFunc, 0);
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -284,12 +284,12 @@ void geo_layout_cmd_node_start(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
// 0x1F: No operation
|
||||
void geo_layout_cmd_nop3(void) {
|
||||
gGeoLayoutCommand += 0x10;
|
||||
gGeoLayoutCommand += 0x10 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -303,7 +303,7 @@ void geo_layout_cmd_node_master_list(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -321,7 +321,7 @@ void geo_layout_cmd_node_level_of_detail(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -344,7 +344,7 @@ void geo_layout_cmd_node_switch_case(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
gGeoLayoutCommand += 0x04 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -374,7 +374,7 @@ void geo_layout_cmd_node_camera(void) {
|
||||
|
||||
gGeoViews[0] = &graphNode->fnNode.node;
|
||||
|
||||
gGeoLayoutCommand += 0x10 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x14 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -438,14 +438,14 @@ void geo_layout_cmd_node_translation_rotation(void) {
|
||||
case 3:
|
||||
vec3s_copy(translation, gVec3sZero);
|
||||
vec3s_set(rotation, 0, (cmdPos[1] << 15) / 180, 0);
|
||||
cmdPos += 2;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += sizeof(void*) / 2;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_translation_rotation(gGraphNodePool, NULL, drawingLayer, displayList,
|
||||
@@ -480,7 +480,7 @@ void geo_layout_cmd_node_translation(void) {
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += sizeof(void*) / 2;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode =
|
||||
@@ -516,7 +516,7 @@ void geo_layout_cmd_node_rotation(void) {
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += sizeof(void*) / 2;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_rotation(gGraphNodePool, NULL, drawingLayer, displayList, sp2c);
|
||||
@@ -545,19 +545,19 @@ void geo_layout_cmd_node_scale(void) {
|
||||
if (params & 0x80) {
|
||||
displayList = cur_geo_cmd_ptr(0x08);
|
||||
drawingLayer = params & 0x0F;
|
||||
gGeoLayoutCommand += sizeof(void *);
|
||||
gGeoLayoutCommand += 4 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_scale(gGraphNodePool, NULL, drawingLayer, displayList, scale);
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
// 0x1E: No operation
|
||||
void geo_layout_cmd_nop2(void) {
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -582,7 +582,7 @@ void geo_layout_cmd_node_animated_part(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x08 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x0C << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -608,7 +608,7 @@ void geo_layout_cmd_node_billboard(void) {
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += sizeof(void*) / 2;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_billboard(gGraphNodePool, NULL, drawingLayer, displayList, translation);
|
||||
@@ -632,7 +632,7 @@ void geo_layout_cmd_node_display_list(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -651,7 +651,7 @@ void geo_layout_cmd_node_shadow(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
// 0x17: Create scene graph node that manages the group of all object nodes
|
||||
@@ -662,7 +662,7 @@ void geo_layout_cmd_node_object_parent(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -679,7 +679,7 @@ void geo_layout_cmd_node_generated(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
gGeoLayoutCommand += 0x04 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -698,12 +698,12 @@ void geo_layout_cmd_node_background(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
gGeoLayoutCommand += 0x04 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
// 0x1A: No operation
|
||||
void geo_layout_cmd_nop(void) {
|
||||
gGeoLayoutCommand += 0x08;
|
||||
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -730,7 +730,7 @@ void geo_layout_cmd_copy_view(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -752,7 +752,7 @@ void geo_layout_cmd_node_held_obj(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
gGeoLayoutCommand += 0x08 + sizeof(void *);
|
||||
gGeoLayoutCommand += 0x0C << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -764,7 +764,7 @@ void geo_layout_cmd_node_culling_radius(void) {
|
||||
struct GraphNodeCullingRadius *graphNode;
|
||||
graphNode = init_graph_node_culling_radius(gGraphNodePool, NULL, cur_geo_cmd_s16(0x02));
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
gGeoLayoutCommand += 0x04;
|
||||
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr) {
|
||||
|
||||
@@ -7,20 +7,23 @@
|
||||
#define GEO_CMD_FLAGS_SET 1
|
||||
#define GEO_CMD_FLAGS_CLEAR 2
|
||||
|
||||
#define CMD_SIZE_SHIFT (sizeof(void *) >> 3)
|
||||
#define CMD_PROCESS_OFFSET(offset) ((offset & 3) | ((offset & ~3) << CMD_SIZE_SHIFT))
|
||||
|
||||
#define cur_geo_cmd_u8(offset) \
|
||||
(gGeoLayoutCommand[offset])
|
||||
(gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)])
|
||||
|
||||
#define cur_geo_cmd_s16(offset) \
|
||||
(*(s16 *) &gGeoLayoutCommand[offset])
|
||||
(*(s16 *) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)])
|
||||
|
||||
#define cur_geo_cmd_s32(offset) \
|
||||
(*(s32 *) &gGeoLayoutCommand[offset])
|
||||
(*(s32 *) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)])
|
||||
|
||||
#define cur_geo_cmd_u32(offset) \
|
||||
(*(u32 *) &gGeoLayoutCommand[offset])
|
||||
(*(u32 *) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)])
|
||||
|
||||
#define cur_geo_cmd_ptr(offset) \
|
||||
(*(void **) &gGeoLayoutCommand[offset])
|
||||
(*(void **) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)])
|
||||
|
||||
extern struct AllocOnlyPool *gGraphNodePool;
|
||||
extern struct GraphNode *gCurRootGraphNode;
|
||||
|
||||
@@ -497,9 +497,9 @@ struct GraphNodeBackground *init_graph_node_background(struct AllocOnlyPool *poo
|
||||
*/
|
||||
struct GraphNodeHeldObject *init_graph_node_held_object(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeHeldObject *graphNode,
|
||||
struct GraphNodeObject *objNode,
|
||||
struct Object *objNode,
|
||||
Vec3s translation,
|
||||
GraphNodeFunc nodeFunc, s32 unused) {
|
||||
GraphNodeFunc nodeFunc, s32 playerIndex) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeHeldObject));
|
||||
}
|
||||
@@ -509,7 +509,7 @@ struct GraphNodeHeldObject *init_graph_node_held_object(struct AllocOnlyPool *po
|
||||
vec3s_copy(graphNode->translation, translation);
|
||||
graphNode->objNode = objNode;
|
||||
graphNode->fnNode.func = nodeFunc;
|
||||
graphNode->unused = unused;
|
||||
graphNode->playerIndex = playerIndex;
|
||||
|
||||
if (nodeFunc != NULL) {
|
||||
nodeFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
|
||||
@@ -855,8 +855,8 @@ void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f posit
|
||||
s16 frame;
|
||||
|
||||
if (animation != NULL) {
|
||||
attribute = segmented_to_virtual(animation->index);
|
||||
values = segmented_to_virtual(animation->values);
|
||||
attribute = segmented_to_virtual((void *) animation->index);
|
||||
values = segmented_to_virtual((void *) animation->values);
|
||||
|
||||
frame = obj->unk38.animFrame;
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ extern Vec3s gVec3sOne;
|
||||
// - for GEO_CONTEXT_CREATE it is the AllocOnlyPool from which the node was allocated
|
||||
// - for GEO_CONTEXT_RENDER or GEO_CONTEXT_HELD_OBJ it is the top of the float matrix stack with type Mat4
|
||||
// - for GEO_CONTEXT_AREA_* it is the root geo node
|
||||
typedef s32 (*GraphNodeFunc)(s32 callContext, struct GraphNode *node, void *context);
|
||||
typedef Gfx *(*GraphNodeFunc)(s32 callContext, struct GraphNode *node, void *context);
|
||||
|
||||
/** An extension of a graph node that includes a function pointer.
|
||||
* Many graph node types have an update function that gets called
|
||||
@@ -343,8 +343,8 @@ struct GraphNodeBackground
|
||||
struct GraphNodeHeldObject
|
||||
{
|
||||
/*0x00*/ struct FnGraphNode fnNode;
|
||||
/*0x18*/ s32 unused;
|
||||
/*0x1C*/ struct GraphNodeObject *objNode; // assumed type
|
||||
/*0x18*/ s32 playerIndex;
|
||||
/*0x1C*/ struct Object *objNode;
|
||||
/*0x20*/ Vec3s translation;
|
||||
};
|
||||
|
||||
@@ -402,7 +402,7 @@ struct GraphNodeGenerated *init_graph_node_generated(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeBackground *init_graph_node_background(struct AllocOnlyPool *pool, struct GraphNodeBackground *sp1c,
|
||||
u16 sp22, GraphNodeFunc sp24, s32 sp28);
|
||||
struct GraphNodeHeldObject *init_graph_node_held_object(struct AllocOnlyPool *pool, struct GraphNodeHeldObject *sp1c,
|
||||
struct GraphNodeObject *objNode, Vec3s translation, GraphNodeFunc nodeFunc, s32 unused);
|
||||
struct Object *objNode, Vec3s translation, GraphNodeFunc nodeFunc, s32 playerIndex);
|
||||
|
||||
struct GraphNode *geo_add_child(struct GraphNode *, struct GraphNode *);
|
||||
struct GraphNode *geo_remove_child(struct GraphNode *);
|
||||
|
||||
@@ -9,14 +9,30 @@
|
||||
#include "game/area.h"
|
||||
#include "geo_layout.h"
|
||||
|
||||
#if IS_64_BIT
|
||||
static s16 next_s16_in_geo_script(s16 **src) {
|
||||
s16 ret;
|
||||
if (((uintptr_t)(*src) & 7) == 4) {
|
||||
*src += 2; // skip 32 bits
|
||||
}
|
||||
ret = *(*src)++;
|
||||
if (((uintptr_t)(*src) & 7) == 4) {
|
||||
*src += 2; // skip 32 bits
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
#define next_s16_in_geo_script(src) (*(*src)++)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Takes a pointer to three shorts (supplied by a geo layout script) and
|
||||
* copies it to the destination float vector.
|
||||
*/
|
||||
s16 *read_vec3s_to_vec3f(Vec3f dst, s16 *src) {
|
||||
dst[0] = *src++;
|
||||
dst[1] = *src++;
|
||||
dst[2] = *src++;
|
||||
dst[0] = next_s16_in_geo_script(&src);
|
||||
dst[1] = next_s16_in_geo_script(&src);
|
||||
dst[2] = next_s16_in_geo_script(&src);
|
||||
return src;
|
||||
}
|
||||
|
||||
@@ -26,9 +42,9 @@ s16 *read_vec3s_to_vec3f(Vec3f dst, s16 *src) {
|
||||
* with the other two 'geo-script vector to internal vector' functions.
|
||||
*/
|
||||
s16 *read_vec3s(Vec3s dst, s16 *src) {
|
||||
dst[0] = *src++;
|
||||
dst[1] = *src++;
|
||||
dst[2] = *src++;
|
||||
dst[0] = next_s16_in_geo_script(&src);
|
||||
dst[1] = next_s16_in_geo_script(&src);
|
||||
dst[2] = next_s16_in_geo_script(&src);
|
||||
return src;
|
||||
}
|
||||
|
||||
@@ -38,9 +54,9 @@ s16 *read_vec3s(Vec3s dst, s16 *src) {
|
||||
* range.
|
||||
*/
|
||||
s16 *read_vec3s_angle(Vec3s dst, s16 *src) {
|
||||
dst[0] = ((*src++) << 15) / 180;
|
||||
dst[1] = ((*src++) << 15) / 180;
|
||||
dst[2] = ((*src++) << 15) / 180;
|
||||
dst[0] = (next_s16_in_geo_script(&src) << 15) / 180;
|
||||
dst[1] = (next_s16_in_geo_script(&src) << 15) / 180;
|
||||
dst[2] = (next_s16_in_geo_script(&src) << 15) / 180;
|
||||
return src;
|
||||
}
|
||||
|
||||
|
||||
+35
-32
@@ -2,29 +2,33 @@
|
||||
|
||||
#include "sm64.h"
|
||||
#include "audio/external.h"
|
||||
#include "buffers/framebuffers.h"
|
||||
#include "game/area.h"
|
||||
#include "game/display.h"
|
||||
#include "game/game.h"
|
||||
#include "geo_layout.h"
|
||||
#include "graph_node.h"
|
||||
#include "level_script.h"
|
||||
#include "game/mario.h"
|
||||
#include "math_util.h"
|
||||
#include "game/memory.h"
|
||||
#include "game/object_helpers.h"
|
||||
#include "game/object_list_processor.h"
|
||||
#include "game/area.h"
|
||||
#include "game/profiler.h"
|
||||
#include "game/save_file.h"
|
||||
#include "game/sound_init.h"
|
||||
#include "goddard/renderer.h"
|
||||
#include "geo_layout.h"
|
||||
#include "graph_node.h"
|
||||
#include "level_script.h"
|
||||
#include "math_util.h"
|
||||
#include "surface_collision.h"
|
||||
#include "surface_load.h"
|
||||
#include "goddard/renderer.h"
|
||||
#include "game/profiler.h"
|
||||
|
||||
#define CMD_GET(type, offset) (*(type *) ((offset) + (u8 *) sCurrentCmd))
|
||||
#define CMD_SIZE_SHIFT (sizeof(void *) >> 3)
|
||||
#define CMD_PROCESS_OFFSET(offset) ((offset & 3) | ((offset & ~3) << CMD_SIZE_SHIFT))
|
||||
|
||||
#define CMD_GET(type, offset) (*(type *) (CMD_PROCESS_OFFSET(offset) + (u8 *) sCurrentCmd))
|
||||
|
||||
// These are equal
|
||||
#define CMD_NEXT ((struct LevelCommand *) ((u8 *) sCurrentCmd + sCurrentCmd->size))
|
||||
#define NEXT_CMD ((struct LevelCommand *) (sCurrentCmd->size + (u8 *) sCurrentCmd))
|
||||
#define CMD_NEXT ((struct LevelCommand *) ((u8 *) sCurrentCmd + (sCurrentCmd->size << CMD_SIZE_SHIFT)))
|
||||
#define NEXT_CMD ((struct LevelCommand *) ((sCurrentCmd->size << CMD_SIZE_SHIFT) + (u8 *) sCurrentCmd))
|
||||
|
||||
struct LevelCommand {
|
||||
/*00*/ u8 type;
|
||||
@@ -85,22 +89,22 @@ static s32 eval_script_op(s8 op, s32 arg) {
|
||||
|
||||
static void level_cmd_load_and_execute(void) {
|
||||
main_pool_push_state();
|
||||
load_segment(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 4 + sizeof(void *)), MEMORY_POOL_LEFT);
|
||||
load_segment(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 8), MEMORY_POOL_LEFT);
|
||||
|
||||
*sStackTop++ = (uintptr_t) NEXT_CMD;
|
||||
*sStackTop++ = (uintptr_t) sStackBase;
|
||||
sStackBase = sStackTop;
|
||||
|
||||
sCurrentCmd = segmented_to_virtual(CMD_GET(void *, 4 + 2 * sizeof(void *)));
|
||||
sCurrentCmd = segmented_to_virtual(CMD_GET(void *, 12));
|
||||
}
|
||||
|
||||
static void level_cmd_exit_and_execute(void) {
|
||||
void *targetAddr = CMD_GET(void *, 4 + 2 * sizeof(void *));
|
||||
void *targetAddr = CMD_GET(void *, 12);
|
||||
|
||||
main_pool_pop_state();
|
||||
main_pool_push_state();
|
||||
|
||||
load_segment(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 4 + sizeof(void *)),
|
||||
load_segment(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 8),
|
||||
MEMORY_POOL_LEFT);
|
||||
|
||||
sStackTop = sStackBase;
|
||||
@@ -224,18 +228,16 @@ static void level_cmd_skippable_nop(void) {
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
// Converting data pointer to function pointer
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
|
||||
static void level_cmd_call(void) {
|
||||
s32 (*func)(s16, s32) = CMD_GET(void *, 4);
|
||||
typedef s32 (*Func)(s16, s32);
|
||||
Func func = CMD_GET(Func, 4);
|
||||
sRegister = func(CMD_GET(s16, 2), sRegister);
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
static void level_cmd_call_loop(void) {
|
||||
s32 (*func)(s16, s32) = CMD_GET(void *, 4);
|
||||
typedef s32 (*Func)(s16, s32);
|
||||
Func func = CMD_GET(Func, 4);
|
||||
sRegister = func(CMD_GET(s16, 2), sRegister);
|
||||
|
||||
if (sRegister == 0) {
|
||||
@@ -246,8 +248,6 @@ static void level_cmd_call_loop(void) {
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
static void level_cmd_set_register(void) {
|
||||
sRegister = CMD_GET(s16, 2);
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
@@ -264,29 +264,28 @@ static void level_cmd_pop_pool_state(void) {
|
||||
}
|
||||
|
||||
static void level_cmd_load_to_fixed_address(void) {
|
||||
load_to_fixed_pool_addr(CMD_GET(void *, 4), CMD_GET(void *, 4 + sizeof(void *)),
|
||||
CMD_GET(void *, 4 + 2 * sizeof(void *)));
|
||||
load_to_fixed_pool_addr(CMD_GET(void *, 4), CMD_GET(void *, 8), CMD_GET(void *, 12));
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
static void level_cmd_load_raw(void) {
|
||||
load_segment(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 4 + sizeof(void *)),
|
||||
load_segment(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 8),
|
||||
MEMORY_POOL_LEFT);
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
static void level_cmd_load_mio0(void) {
|
||||
load_segment_decompress(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 4 + sizeof(void *)));
|
||||
load_segment_decompress(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 8));
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
static void level_cmd_load_mario_head(void) {
|
||||
// TODO: Fix these hardcoded sizes
|
||||
void *addr = main_pool_alloc(0xE1000, MEMORY_POOL_LEFT);
|
||||
void *addr = main_pool_alloc(DOUBLE_SIZE_ON_64_BIT(0xE1000), MEMORY_POOL_LEFT);
|
||||
if (addr != NULL) {
|
||||
gdm_init(addr, 0xE1000);
|
||||
gd_add_to_heap(gZBuffer, SCREEN_WIDTH * SCREEN_HEIGHT * 2); // 0x25800
|
||||
gd_add_to_heap(gFrameBuffer0, SCREEN_WIDTH * SCREEN_HEIGHT * 2 * 3); // 0x70800
|
||||
gdm_init(addr, DOUBLE_SIZE_ON_64_BIT(0xE1000));
|
||||
gd_add_to_heap(gZBuffer, sizeof(gZBuffer)); // 0x25800
|
||||
gd_add_to_heap(gFrameBuffer0, 3 * sizeof(gFrameBuffer0)); // 0x70800
|
||||
gdm_setup();
|
||||
gdm_maketestdl(CMD_GET(s16, 2));
|
||||
} else {
|
||||
@@ -296,7 +295,7 @@ static void level_cmd_load_mario_head(void) {
|
||||
}
|
||||
|
||||
static void level_cmd_load_mio0_texture(void) {
|
||||
func_80278304(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 4 + sizeof(void *)));
|
||||
func_80278304(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 8));
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
@@ -405,7 +404,7 @@ static void level_cmd_23(void) {
|
||||
s16 arg0H = CMD_GET(u16, 2) >> 12;
|
||||
void *arg1 = CMD_GET(void *, 4);
|
||||
// load an f32, but using an integer load instruction for some reason (hence the union)
|
||||
arg2.i = CMD_GET(s32, 4 + sizeof(void *));
|
||||
arg2.i = CMD_GET(s32, 8);
|
||||
|
||||
if (model < 256) {
|
||||
// GraphNodeScale has a GraphNode at the top. This
|
||||
@@ -631,7 +630,11 @@ static void level_cmd_2A(void) {
|
||||
static void level_cmd_set_mario_start_pos(void) {
|
||||
gMarioSpawnInfo->areaIndex = CMD_GET(u8, 2);
|
||||
|
||||
#if IS_64_BIT
|
||||
vec3s_set(gMarioSpawnInfo->startPos, CMD_GET(s16, 6), CMD_GET(s16, 8), CMD_GET(s16, 10));
|
||||
#else
|
||||
vec3s_copy(gMarioSpawnInfo->startPos, CMD_GET(Vec3s, 6));
|
||||
#endif
|
||||
vec3s_set(gMarioSpawnInfo->startAngle, 0, CMD_GET(s16, 4) * 0x8000 / 180, 0);
|
||||
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#ifndef _LEVEL_SCRIPT_H
|
||||
#define _LEVEL_SCRIPT_H
|
||||
|
||||
extern u8 gFrameBuffer0[];
|
||||
extern u8 gFrameBuffer1[];
|
||||
extern u8 gFrameBuffer2[];
|
||||
|
||||
struct LevelCommand *level_script_execute(struct LevelCommand *cmd);
|
||||
|
||||
extern u8 level_script_entry[];
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "math_util.h"
|
||||
#include "surface_collision.h"
|
||||
|
||||
extern s16 gArctanTable[];
|
||||
#include "trig_tables.inc.c"
|
||||
|
||||
// Variables for a spline curve animation (used for the flight path in the grand star cutscene)
|
||||
Vec4s *gSplineKeyframe;
|
||||
@@ -568,6 +568,9 @@ void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
|
||||
* and no crashes occur.
|
||||
*/
|
||||
void mtxf_to_mtx(Mtx *dest, Mat4 src) {
|
||||
#if ENDIAN_IND
|
||||
guMtxF2L(src, dest);
|
||||
#else
|
||||
s32 asFixedPoint;
|
||||
register s32 i;
|
||||
register s16 *a3 = (s16 *) dest; // all integer parts stored in first 16 bytes
|
||||
@@ -579,6 +582,7 @@ void mtxf_to_mtx(Mtx *dest, Mat4 src) {
|
||||
*a3++ = GET_HIGH_S16_OF_32(asFixedPoint); // integer part
|
||||
*t0++ = GET_LOW_S16_OF_32(asFixedPoint); // fraction part
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+17
-1
@@ -1,8 +1,24 @@
|
||||
#ifndef _MATH_UTIL_H_
|
||||
#define _MATH_UTIL_H_
|
||||
|
||||
/*
|
||||
* The sine and cosine tables overlap, but "#define gCosineTable (gSineTable +
|
||||
* 0x400)" doesn't give expected codegen; gSineTable and gCosineTable need to
|
||||
* be different symbols for code to match. Most likely the tables were placed
|
||||
* adjacent to each other, and gSineTable cut short, such that reads overflow
|
||||
* into gCosineTable.
|
||||
*
|
||||
* These kinds of out of bounds reads are undefined behavior, and break on
|
||||
* e.g. GCC (which doesn't place the tables next to each other, and probably
|
||||
* exploits array sizes for range analysis-based optimizations as well).
|
||||
* Thus, for non-IDO compilers we use the standard-compliant version.
|
||||
*/
|
||||
extern f32 gSineTable[];
|
||||
#if BUGFIXES_CRITICAL
|
||||
#define gCosineTable (gSineTable + 0x400)
|
||||
#else
|
||||
extern f32 gCosineTable[];
|
||||
#endif
|
||||
|
||||
#define sins(x) gSineTable[(u16) (x) >> 4]
|
||||
#define coss(x) gCosineTable[(u16) (x) >> 4]
|
||||
@@ -41,7 +57,7 @@ void mtxf_mul_vec3s(f32 a[4][4], Vec3s b);
|
||||
void mtxf_to_mtx(Mtx *a, f32 b[4][4]);
|
||||
void mtxf_rotate_xy(Mtx *a, s16 b);
|
||||
void get_pos_from_transform_mtx(Vec3f a, f32 b[4][4], f32 c[4][4]);
|
||||
void vec3f_get_dist_and_angle(Vec3f a, Vec3f b, f32 *c, s16 *d, s16 *e);
|
||||
void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw);
|
||||
void vec3f_set_dist_and_angle(Vec3f a, Vec3f b, f32 c, s16 d, s16 e);
|
||||
s32 approach_s32(s32 a, s32 b, s32 c, s32 d);
|
||||
f32 approach_f32(f32 a, f32 b, f32 c, f32 d);
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ u8 gWarpTransBlue = 0;
|
||||
s16 gCurrSaveFileNum = 1;
|
||||
s16 gCurrLevelNum = 1;
|
||||
|
||||
void *D_8032CE9C[] = {
|
||||
const BehaviorScript *D_8032CE9C[] = {
|
||||
bhvDoorWarp, bhvStar, bhvExitPodiumWarp, bhvWarp, bhvWarpPipe, bhvFadingWarp, bhvWarps60,
|
||||
bhvWarps64, bhvWarps68, bhvWarps6C, bhvWarps70, bhvWarps74, bhvWarps78, bhvWarps94,
|
||||
bhvWarps7C, bhvWarps80, bhvWarps88, bhvWarps84, bhvWarps8C, bhvWarps90,
|
||||
@@ -117,7 +117,7 @@ void print_intro_text(void) {
|
||||
|
||||
u32 get_mario_spawn_type(struct Object *o) {
|
||||
s32 i;
|
||||
void *behavior = virtual_to_segmented(0x13, o->behavior);
|
||||
const BehaviorScript *behavior = virtual_to_segmented(0x13, o->behavior);
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
if (D_8032CE9C[i] == behavior) {
|
||||
|
||||
@@ -42,11 +42,11 @@
|
||||
// BSS
|
||||
s16 D_8035FF10;
|
||||
|
||||
struct Struct8032F24A {
|
||||
struct WFRotatingPlatformData {
|
||||
s16 pad;
|
||||
s16 unk0;
|
||||
void *unk1;
|
||||
s16 unk2;
|
||||
s16 scale;
|
||||
const Collision *collisionData;
|
||||
s16 collisionDistance;
|
||||
};
|
||||
|
||||
struct Struct8032F34C {
|
||||
@@ -54,7 +54,7 @@ struct Struct8032F34C {
|
||||
s16 bridgeRelativeStartingXorZ;
|
||||
s16 platformWidth;
|
||||
s16 model;
|
||||
void *segAddr;
|
||||
const void *segAddr;
|
||||
};
|
||||
|
||||
struct Struct8032F698 {
|
||||
@@ -70,7 +70,7 @@ struct Struct802C0DF0 {
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 model;
|
||||
void *behavior;
|
||||
const BehaviorScript *behavior;
|
||||
};
|
||||
|
||||
struct Struct8032FE4C {
|
||||
|
||||
@@ -16,4 +16,560 @@ extern void play_penguin_walking_sound(s32);
|
||||
extern s32 func_802C5A64(s32*);
|
||||
extern void func_802C76E0(s32, f32, f32, f32, f32);
|
||||
|
||||
void bhv_cap_switch_loop(void);
|
||||
void bhv_tiny_star_particles_init(void);
|
||||
void bhv_grindel_thwomp_loop(void);
|
||||
void bhv_koopa_shell_underwater_loop(void);
|
||||
void bhv_door_init(void);
|
||||
void bhv_door_loop(void);
|
||||
void bhv_star_door_loop(void);
|
||||
void bhv_mr_i_loop(void);
|
||||
void bhv_mr_i_body_loop(void);
|
||||
void bhv_mr_i_particle_loop(void);
|
||||
void bhv_piranha_particle_loop(void);
|
||||
void bhv_giant_pole_loop(void);
|
||||
void bhv_pole_init(void);
|
||||
void BehClimbDetectLoop(void);
|
||||
void bhv_thi_huge_island_top_loop(void);
|
||||
void bhv_thi_tiny_island_top_loop(void);
|
||||
void bhv_king_bobomb_loop(void);
|
||||
void bhv_bobomb_anchor_mario_loop(void);
|
||||
void bhv_beta_chest_bottom_init(void);
|
||||
void bhv_beta_chest_bottom_loop(void);
|
||||
void bhv_beta_chest_lid_loop(void);
|
||||
void bhv_bubble_wave_init(void);
|
||||
void bhv_bubble_maybe_loop(void);
|
||||
void bhv_small_water_loop(void);
|
||||
void bhv_water_air_bubble_init(void);
|
||||
void bhv_water_air_bubble_loop(void);
|
||||
void bhv_particle_init(void);
|
||||
void bhv_particle_loop(void);
|
||||
void bhv_water_waves_init(void);
|
||||
void bhv_small_bubbles_loop(void);
|
||||
void bhv_fish_group_loop(void);
|
||||
void bhv_cannon_base_loop(void);
|
||||
void bhv_cannon_barrel_loop(void);
|
||||
void bhv_cannon_base_unused_loop(void);
|
||||
void bhv_chuckya_loop(void);
|
||||
void bhv_chuckya_anchor_mario_loop(void);
|
||||
void bhv_rotating_platform_loop(void);
|
||||
void bhv_wf_breakable_wall_loop(void);
|
||||
void bhv_kickable_board_loop(void);
|
||||
void bhv_tower_door_loop(void);
|
||||
void bhv_wf_rotating_wooden_platform_loop(void);
|
||||
void bhv_koopa_shell_underwater_loop(void);
|
||||
void BehFadingWarpLoop(void);
|
||||
void bhv_warp_loop(void);
|
||||
void bhv_white_puff_exploding_loop(void);
|
||||
void bhv_unused_080c_init(void);
|
||||
void bhv_unused_080c_loop(void);
|
||||
void bhv_coin_init(void);
|
||||
void bhv_coin_loop(void);
|
||||
void bhv_coin_inside_boo_loop(void);
|
||||
void bhv_coin_formation_init(void);
|
||||
void bhv_coin_formation_spawn_loop(void);
|
||||
void bhv_coin_formation_loop(void);
|
||||
void bhv_temp_coin_loop(void);
|
||||
void bhv_coin_sparkles_loop(void);
|
||||
void bhv_golden_coin_sparkles_loop(void);
|
||||
void bhv_wall_tiny_star_particle_loop(void);
|
||||
void bhv_pound_tiny_star_particle_loop(void);
|
||||
void bhv_pound_tiny_star_particle_init(void);
|
||||
void bhv_punch_tiny_triangle_loop(void);
|
||||
void bhv_punch_tiny_triangle_init(void);
|
||||
void bhv_tumbling_bridge_platform_loop(void);
|
||||
void bhv_tumbling_bridge_loop(void);
|
||||
void bhv_elevator_init(void);
|
||||
void bhv_elevator_loop(void);
|
||||
void bhv_water_mist_loop(void);
|
||||
void bhv_water_mist_spawn_loop(void);
|
||||
void bhv_water_mist_2_loop(void);
|
||||
void bhv_pound_white_puffs_init(void);
|
||||
void bhv_unused_0e40_init(void);
|
||||
void bhv_ground_snow_init(void);
|
||||
void bhv_wind_loop(void);
|
||||
void bhv_unused_particle_spawn_loop(void);
|
||||
void bhv_ukiki_cage_star_loop(void);
|
||||
void bhv_ukiki_cage_loop(void);
|
||||
void bhv_bitfs_sinking_platform_loop(void);
|
||||
void bhv_bitfs_sinking_cage_platform_loop(void);
|
||||
void bhv_ddd_moving_pole_loop(void);
|
||||
void bhv_tilting_platform_init(void);
|
||||
void bhv_tilting_platform_loop(void);
|
||||
void bhv_squishable_platform_loop(void);
|
||||
void bhv_beta_moving_flames_spawn_loop(void);
|
||||
void bhv_beta_moving_flames_loop(void);
|
||||
void bhv_rr_rotating_bridge_platform_loop(void);
|
||||
void bhv_flamethrower_loop(void);
|
||||
void bhv_flamethrower_flame_loop(void);
|
||||
void bhv_bouncing_fireball_loop(void);
|
||||
void bhv_bouncing_fireball_flame_loop(void);
|
||||
void bhv_bowser_shock_wave_loop(void);
|
||||
void bhv_flame_mario_loop(void);
|
||||
void bhv_black_smoke_mario_loop(void);
|
||||
void bhv_black_smoke_bowser_loop(void);
|
||||
void bhv_black_smoke_upward_loop(void);
|
||||
void bhv_beta_fish_splash_spawner_loop(void);
|
||||
void bhv_spindrift_loop(void);
|
||||
void bhv_tower_platform_group_loop(void);
|
||||
void bhv_wf_sliding_tower_platform_loop(void);
|
||||
void bhv_wf_elevator_tower_platform_loop(void);
|
||||
void bhv_wf_solid_tower_platform_loop(void);
|
||||
void bhv_snow_leaf_particle_spawn_init(void);
|
||||
void bhv_tree_snow_or_leaf_loop(void);
|
||||
void bhv_piranha_plant_bubble_loop(void);
|
||||
void bhv_piranha_plant_waking_bubbles_loop(void);
|
||||
void bhv_purple_switch_loop(void);
|
||||
void bhv_hidden_object_loop(void);
|
||||
void bhv_breakable_box_loop(void);
|
||||
void bhv_pushable_loop(void);
|
||||
void bhv_init_room(void);
|
||||
void bhv_small_water_wave_loop(void);
|
||||
void bhv_yellow_coin_init(void);
|
||||
void bhv_yellow_coin_loop(void);
|
||||
void bhv_squarish_path_moving_loop(void);
|
||||
void bhv_heave_ho_loop(void);
|
||||
void bhv_heave_ho_throw_mario_loop(void);
|
||||
void bhv_ccm_touched_star_spawn_loop(void);
|
||||
void bhv_unused_poundable_platform(void);
|
||||
void bhv_beta_trampoline_top_loop(void);
|
||||
void bhv_beta_trampoline_spring_loop(void);
|
||||
void bhv_jumping_box_loop(void);
|
||||
void bhv_boo_cage_loop(void);
|
||||
void bhv_bowser_key_loop(void);
|
||||
void bhv_grand_star_loop(void);
|
||||
void bhv_beta_boo_key_loop(void);
|
||||
void bhv_alpha_boo_key_loop(void);
|
||||
void bhv_bullet_bill_init(void);
|
||||
void bhv_bullet_bill_loop(void);
|
||||
void bhv_white_puff_smoke_init(void);
|
||||
void bhv_bowser_tail_anchor_loop(void);
|
||||
void bhv_bowser_init(void);
|
||||
void bhv_bowser_loop(void);
|
||||
void bhv_bowser_body_anchor_loop(void);
|
||||
void bhv_bowser_flame_spawn_loop(void);
|
||||
void bhv_falling_bowser_platform_loop(void);
|
||||
void bhv_blue_bowser_flame_init(void);
|
||||
void bhv_blue_bowser_flame_loop(void);
|
||||
void bhv_flame_floating_landing_init(void);
|
||||
void bhv_flame_floating_landing_loop(void);
|
||||
void bhv_blue_flames_group_loop(void);
|
||||
void bhv_flame_bouncing_init(void);
|
||||
void bhv_flame_bouncing_loop(void);
|
||||
void bhv_flame_moving_forward_growing_init(void);
|
||||
void bhv_flame_moving_forward_growing_loop(void);
|
||||
void bhv_flame_bowser_init(void);
|
||||
void bhv_flame_bowser_loop(void);
|
||||
void bhv_flame_large_burning_out_init(void);
|
||||
void bhv_blue_fish_loop(void);
|
||||
void bhv_tank_fish_group_loop(void);
|
||||
void bhv_checkerboard_elevator_group_init(void);
|
||||
void bhv_checkerboard_platform_init(void);
|
||||
void bhv_checkerboard_platform_loop(void);
|
||||
void bhv_bowser_key_unlock_door_loop(void);
|
||||
void bhv_bowser_key_course_exit_loop(void);
|
||||
void bhv_invisible_objects_under_bridge_init(void);
|
||||
void bhv_water_level_pillar_init(void);
|
||||
void bhv_water_level_pillar_loop(void);
|
||||
void bhv_ddd_warp_loop(void);
|
||||
void bhv_moat_grills_loop(void);
|
||||
void bhv_rotating_clock_arm_loop(void);
|
||||
void bhv_ukiki_init(void);
|
||||
void bhv_ukiki_loop(void);
|
||||
void bhv_lll_sinking_rock_block_loop(void);
|
||||
void bhv_lll_moving_octagonal_mesh_platform_loop(void);
|
||||
void bhv_lll_rotating_block_fire_bars_loop(void);
|
||||
void bhv_lll_rotating_hex_flame_loop(void);
|
||||
void bhv_lll_wood_piece_loop(void);
|
||||
void bhv_lll_floating_wood_bridge_loop(void);
|
||||
void bhv_volcano_flames_loop(void);
|
||||
void bhv_lll_rotating_hexagonal_ring_loop(void);
|
||||
void bhv_lll_sinking_rectangular_platform_loop(void);
|
||||
void bhv_lll_sinking_square_platforms_loop(void);
|
||||
void bhv_koopa_shell_loop(void);
|
||||
void bhv_koopa_shell_flame_loop(void);
|
||||
void bhv_tox_box_loop(void);
|
||||
void bhv_piranha_plant_loop(void);
|
||||
void bhv_lll_bowser_puzzle_piece_loop(void);
|
||||
void bhv_lll_bowser_puzzle_loop(void);
|
||||
void bhv_tuxies_mother_loop(void);
|
||||
void bhv_small_penguin_loop(void);
|
||||
void bhv_fish_loop(void);
|
||||
void bhv_fish_group_2_loop(void);
|
||||
void bhv_wdw_express_elevator_loop(void);
|
||||
void bhv_bird_chirp_chirp_loop(void);
|
||||
void bhv_cheep_cheep_loop(void);
|
||||
void bhv_exclamation_box_loop(void);
|
||||
void bhv_rotatin_exclamation_box_loop(void);
|
||||
void bhv_sound_spawner_init(void);
|
||||
void bhv_bowsers_sub_loop(void);
|
||||
void bhv_sushi_shark_loop(void);
|
||||
void bhv_sushi_shark_collision_loop(void);
|
||||
void bhv_jrb_sliding_box_loop(void);
|
||||
void bhv_ship_part_3_loop(void);
|
||||
void bhv_sunken_ship_part_loop(void);
|
||||
void bhv_white_puff_1_loop(void);
|
||||
void bhv_white_puff_2_loop(void);
|
||||
void bhv_blue_coin_switch_loop(void);
|
||||
void bhv_hidden_blue_coin_loop(void);
|
||||
void bhv_openable_cage_door_loop(void);
|
||||
void bhv_openable_grill_loop(void);
|
||||
void bhv_water_level_diamond_loop(void);
|
||||
void bhv_init_changing_water_level_loop(void);
|
||||
void bhv_tweester_sand_particle_loop(void);
|
||||
void bhv_tweester_loop(void);
|
||||
void bhv_merry_go_round_boo_manager_loop(void);
|
||||
void bhv_animated_texture_loop(void);
|
||||
void bhv_boo_in_castle_loop(void);
|
||||
void bhv_boo_with_cage_init(void);
|
||||
void bhv_boo_with_cage_loop(void);
|
||||
void bhv_boo_init(void);
|
||||
void bhv_big_boo_loop(void);
|
||||
void bhv_courtyard_boo_triplet_init(void);
|
||||
void bhv_boo_loop(void);
|
||||
void bhv_boo_boss_spawned_bridge_loop(void);
|
||||
void bhv_bbh_tilting_trap_platform_loop(void);
|
||||
void bhv_haunted_bookshelf_loop(void);
|
||||
void bhv_merry_go_round_loop(void);
|
||||
void bhv_play_music_track_when_touched_loop(void);
|
||||
void bhv_beta_bowser_anchor_loop(void);
|
||||
void bhv_static_checkered_platform_loop(void);
|
||||
void bhv_castle_floor_trap_init(void);
|
||||
void bhv_castle_floor_trap_loop(void);
|
||||
void bhv_floor_trap_in_castle_loop(void);
|
||||
void bhv_sparkle_spawn_loop(void);
|
||||
void bhv_scuttlebug_loop(void);
|
||||
void bhv_scuttlebug_spawn_loop(void);
|
||||
void bhv_whomp_loop(void);
|
||||
void bhv_water_splash_loop(void);
|
||||
void bhv_water_drops_loop(void);
|
||||
void bhv_water_surface_white_wave_init(void);
|
||||
void bhv_object_bubble_ripples_init(void);
|
||||
void bhv_surface_waves_loop(void);
|
||||
void bhv_surface_wave_shrinking_init(void);
|
||||
void bhv_wave_trail_loop(void);
|
||||
void bhv_white_wind_particle_loop(void);
|
||||
void bhv_snowman_wind_blowing_loop(void);
|
||||
void bhv_walking_penguin_loop(void);
|
||||
void bhv_menu_button_init(void);
|
||||
void bhv_menu_button_loop(void);
|
||||
void bhv_menu_button_manager_init(void);
|
||||
void bhv_menu_button_manager_loop(void);
|
||||
void bhv_act_selector_star_type_loop(void);
|
||||
void bhv_act_selector_init(void);
|
||||
void bhv_act_selector_loop(void);
|
||||
void bhv_moving_yellow_coin_init(void);
|
||||
void bhv_moving_yellow_coin_loop(void);
|
||||
void bhv_moving_blue_coin_init(void);
|
||||
void bhv_moving_blue_coin_loop(void);
|
||||
void bhv_blue_coin_sliding_jumping_init(void);
|
||||
void bhv_blue_coin_sliding_loop(void);
|
||||
void bhv_blue_coin_jumping_loop(void);
|
||||
void bhv_seaweed_init(void);
|
||||
void bhv_seaweed_bundle_init(void);
|
||||
void bhv_bobomb_init(void);
|
||||
void bhv_bobomb_loop(void);
|
||||
void bhv_bobomb_fuse_smoke_init(void);
|
||||
void bhv_bobomb_buddy_init(void);
|
||||
void bhv_bobomb_buddy_loop(void);
|
||||
void bhv_cannon_closed_init(void);
|
||||
void bhv_cannon_closed_loop(void);
|
||||
void bhv_whirlpool_init(void);
|
||||
void bhv_whirlpool_loop(void);
|
||||
void bhv_jet_stream_loop(void);
|
||||
void bhv_homing_amp_init(void);
|
||||
void bhv_homing_amp_loop(void);
|
||||
void bhv_circling_amp_init(void);
|
||||
void bhv_circling_amp_loop(void);
|
||||
void bhv_butterfly_init(void);
|
||||
void bhv_butterfly_loop(void);
|
||||
void bhv_hoot_init(void);
|
||||
void bhv_hoot_loop(void);
|
||||
void bhv_beta_holdable_object_init(void);
|
||||
void bhv_beta_holdable_object_loop(void);
|
||||
void bhv_object_bubble_init(void);
|
||||
void bhv_object_bubble_loop(void);
|
||||
void bhv_object_water_wave_init(void);
|
||||
void bhv_object_water_wave_loop(void);
|
||||
void bhv_explosion_init(void);
|
||||
void bhv_explosion_loop(void);
|
||||
void bhv_bobomb_bully_death_smoke_init(void);
|
||||
void bhv_bobomb_explosion_bubble_init(void);
|
||||
void bhv_bobomb_explosion_bubble_loop(void);
|
||||
void bhv_respawner_loop(void);
|
||||
void bhv_small_bully_init(void);
|
||||
void bhv_bully_loop(void);
|
||||
void bhv_big_bully_init(void);
|
||||
void bhv_big_bully_with_minions_init(void);
|
||||
void bhv_big_bully_with_minions_loop(void);
|
||||
void bhv_jet_stream_ring_spawner_loop(void);
|
||||
void bhv_jet_stream_water_ring_init(void);
|
||||
void bhv_jet_stream_water_ring_loop(void);
|
||||
void bhv_manta_ray_water_ring_init(void);
|
||||
void bhv_manta_ray_water_ring_loop(void);
|
||||
void bhv_bowser_bomb_loop(void);
|
||||
void bhv_bowser_bomb_explosion_loop(void);
|
||||
void bhv_bowser_bomb_smoke_loop(void);
|
||||
void bhv_celebration_star_init(void);
|
||||
void bhv_celebration_star_loop(void);
|
||||
void bhv_celebration_star_sparkle_loop(void);
|
||||
void bhv_star_key_collection_puff_spawner_loop(void);
|
||||
void bhv_lll_drawbridge_spawner_loop(void);
|
||||
void bhv_lll_drawbridge_loop(void);
|
||||
void bhv_small_bomp_init(void);
|
||||
void bhv_small_bomp_loop(void);
|
||||
void bhv_large_bomp_init(void);
|
||||
void bhv_large_bomp_loop(void);
|
||||
void bhv_wf_sliding_platform_init(void);
|
||||
void bhv_wf_sliding_platform_loop(void);
|
||||
void bhv_moneybag_init(void);
|
||||
void bhv_moneybag_loop(void);
|
||||
void bhv_moneybag_hidden_loop(void);
|
||||
void bhv_bob_pit_bowling_ball_init(void);
|
||||
void bhv_bob_pit_bowling_ball_loop(void);
|
||||
void bhv_free_bowling_ball_init(void);
|
||||
void bhv_free_bowling_ball_loop(void);
|
||||
void bhv_bowling_ball_init(void);
|
||||
void bhv_bowling_ball_loop(void);
|
||||
void bhv_generic_bowling_ball_spawner_init(void);
|
||||
void bhv_generic_bowling_ball_spawner_loop(void);
|
||||
void bhv_thi_bowling_ball_spawner_loop(void);
|
||||
void bhv_rr_cruiser_wing_init(void);
|
||||
void bhv_rr_cruiser_wing_loop(void);
|
||||
void bhv_spindel_init(void);
|
||||
void bhv_spindel_loop(void);
|
||||
void bhv_ssl_moving_pyramid_wall_init(void);
|
||||
void bhv_ssl_moving_pyramid_wall_loop(void);
|
||||
void bhv_pyramid_elevator_init(void);
|
||||
void bhv_pyramid_elevator_loop(void);
|
||||
void bhv_pyramid_elevator_trajectory_marker_ball_loop(void);
|
||||
void bhv_pyramid_top_init(void);
|
||||
void bhv_pyramid_top_loop(void);
|
||||
void bhv_pyramid_top_fragment_init(void);
|
||||
void bhv_pyramid_top_fragment_loop(void);
|
||||
void bhv_pyramid_pillar_touch_detector_loop(void);
|
||||
void bhv_waterfall_sound_loop(void);
|
||||
void bhv_volcano_sound_loop(void);
|
||||
void bhv_castle_flag_init(void);
|
||||
void bhv_birds_sound_loop(void);
|
||||
void bhv_ambient_sounds_init(void);
|
||||
void bhv_sand_sound_loop(void);
|
||||
void bhv_castle_cannon_grate_init(void);
|
||||
void bhv_snowmans_bottom_init(void);
|
||||
void bhv_snowmans_bottom_loop(void);
|
||||
void bhv_snowmans_head_init(void);
|
||||
void bhv_snowmans_head_loop(void);
|
||||
void bhv_snowmans_body_checkpoint_loop(void);
|
||||
void bhv_big_boulder_init(void);
|
||||
void bhv_big_boulder_loop(void);
|
||||
void bhv_big_boulder_generator_loop(void);
|
||||
void bhv_wing_cap_init(void);
|
||||
void bhv_wing_vanish_cap_loop(void);
|
||||
void bhv_metal_cap_init(void);
|
||||
void bhv_metal_cap_loop(void);
|
||||
void bhv_normal_cap_init(void);
|
||||
void bhv_normal_cap_loop(void);
|
||||
void bhv_vanish_cap_init(void);
|
||||
void bhv_collect_star_init(void);
|
||||
void bhv_collect_star_loop(void);
|
||||
void bhv_star_spawn_init(void);
|
||||
void bhv_star_spawn_loop(void);
|
||||
void bhv_hidden_red_coin_star_init(void);
|
||||
void bhv_hidden_red_coin_star_loop(void);
|
||||
void bhv_red_coin_init(void);
|
||||
void bhv_red_coin_loop(void);
|
||||
void bhv_bowser_course_red_coin_star_loop(void);
|
||||
void bhv_hidden_star_init(void);
|
||||
void bhv_hidden_star_loop(void);
|
||||
void bhv_hidden_star_trigger_loop(void);
|
||||
void bhv_ttm_rolling_log_init(void);
|
||||
void bhv_rolling_log_loop(void);
|
||||
void bhv_lll_rolling_log_init(void);
|
||||
void bhv_1up_common_init(void);
|
||||
void bhv_1up_walking_loop(void);
|
||||
void bhv_1up_running_away_loop(void);
|
||||
void bhv_1up_sliding_loop(void);
|
||||
void bhv_1up_init(void);
|
||||
void bhv_1up_loop(void);
|
||||
void bhv_1up_jump_on_approach_loop(void);
|
||||
void bhv_1up_hidden_loop(void);
|
||||
void bhv_1up_hidden_trigger_loop(void);
|
||||
void bhv_1up_hidden_in_pole_loop(void);
|
||||
void bhv_1up_hidden_in_pole_trigger_loop(void);
|
||||
void bhv_1up_hidden_in_pole_spawner_loop(void);
|
||||
void bhv_controllable_platform_init(void);
|
||||
void bhv_controllable_platform_loop(void);
|
||||
void bhv_controllable_platform_sub_loop(void);
|
||||
void bhv_breakable_box_small_init(void);
|
||||
void bhv_breakable_box_small_loop(void);
|
||||
void bhv_sliding_snow_mound_loop(void);
|
||||
void bhv_snow_mound_spawn_loop(void);
|
||||
void bhv_floating_platform_loop(void);
|
||||
void bhv_arrow_lift_loop(void);
|
||||
void bhv_orange_number_init(void);
|
||||
void bhv_orange_number_loop(void);
|
||||
void bhv_manta_ray_init(void);
|
||||
void bhv_manta_ray_loop(void);
|
||||
void bhv_falling_pillar_init(void);
|
||||
void bhv_falling_pillar_loop(void);
|
||||
void bhv_falling_pillar_hitbox_loop(void);
|
||||
void bhv_jrb_floating_box_loop(void);
|
||||
void bhv_decorative_pendulum_init(void);
|
||||
void bhv_decorative_pendulum_loop(void);
|
||||
void bhv_treasure_chest_ship_init(void);
|
||||
void bhv_treasure_chest_ship_loop(void);
|
||||
void bhv_treasure_chest_jrb_init(void);
|
||||
void bhv_treasure_chest_jrb_loop(void);
|
||||
void bhv_treasure_chest_init(void);
|
||||
void bhv_treasure_chest_loop(void);
|
||||
void bhv_treasure_chest_bottom_init(void);
|
||||
void bhv_treasure_chest_bottom_loop(void);
|
||||
void bhv_treasure_chest_top_loop(void);
|
||||
void bhv_mips_init(void);
|
||||
void bhv_mips_loop(void);
|
||||
void bhv_yoshi_init(void);
|
||||
void bhv_koopa_init(void);
|
||||
void bhv_koopa_update(void);
|
||||
void bhv_koopa_race_endpoint_update(void);
|
||||
void bhv_pokey_update(void);
|
||||
void bhv_pokey_body_part_update(void);
|
||||
void bhv_swoop_update(void);
|
||||
void bhv_fly_guy_update(void);
|
||||
void bhv_goomba_init(void);
|
||||
void bhv_goomba_update(void);
|
||||
void bhv_goomba_triplet_spawner_update(void);
|
||||
void bhv_chain_chomp_update(void);
|
||||
void bhv_chain_chomp_chain_part_update(void);
|
||||
void bhv_wooden_post_update(void);
|
||||
void bhv_chain_chomp_gate_init(void);
|
||||
void bhv_chain_chomp_gate_update(void);
|
||||
void bhv_wiggler_update(void);
|
||||
void bhv_wiggler_body_part_update(void);
|
||||
void bhv_enemy_lakitu_update(void);
|
||||
void bhv_camera_lakitu_init(void);
|
||||
void bhv_camera_lakitu_update(void);
|
||||
void bhv_cloud_update(void);
|
||||
void bhv_cloud_part_update(void);
|
||||
void bhv_spiny_update(void);
|
||||
void bhv_monty_mole_init(void);
|
||||
void bhv_monty_mole_update(void);
|
||||
void bhv_monty_mole_hole_update(void);
|
||||
void bhv_monty_mole_rock_update(void);
|
||||
void bhv_platform_on_track_init(void);
|
||||
void bhv_platform_on_track_update(void);
|
||||
void bhv_track_ball_update(void);
|
||||
void bhv_seesaw_platform_init(void);
|
||||
void bhv_seesaw_platform_update(void);
|
||||
void bhv_ferris_wheel_axle_init(void);
|
||||
void bhv_ferris_wheel_platform_update(void);
|
||||
void bhv_water_bomb_spawner_update(void);
|
||||
void bhv_water_bomb_update(void);
|
||||
void bhv_water_bomb_shadow_update(void);
|
||||
void bhv_ttc_rotating_solid_init(void);
|
||||
void bhv_ttc_rotating_solid_update(void);
|
||||
void bhv_ttc_pendulum_init(void);
|
||||
void bhv_ttc_pendulum_update(void);
|
||||
void bhv_ttc_treadmill_init(void);
|
||||
void bhv_ttc_treadmill_update(void);
|
||||
void bhv_ttc_moving_bar_init(void);
|
||||
void bhv_ttc_moving_bar_update(void);
|
||||
void bhv_ttc_cog_init(void);
|
||||
void bhv_ttc_cog_update(void);
|
||||
void bhv_ttc_pit_block_init(void);
|
||||
void bhv_ttc_pit_block_update(void);
|
||||
void bhv_ttc_elevator_init(void);
|
||||
void bhv_ttc_elevator_update(void);
|
||||
void bhv_ttc_2d_rotator_init(void);
|
||||
void bhv_ttc_2d_rotator_update(void);
|
||||
void bhv_ttc_spinner_update(void);
|
||||
void bhv_mr_blizzard_init(void);
|
||||
void bhv_mr_blizzard_update(void);
|
||||
void bhv_mr_blizzard_snowball(void);
|
||||
void bhv_sliding_plat_2_init(void);
|
||||
void bhv_sliding_plat_2_loop(void);
|
||||
void bhv_rotating_octagonal_plat_init(void);
|
||||
void bhv_rotating_octagonal_plat_loop(void);
|
||||
void bhv_animates_on_floor_switch_press_init(void);
|
||||
void bhv_animates_on_floor_switch_press_loop(void);
|
||||
void bhv_activated_back_and_forth_platform_init(void);
|
||||
void bhv_activated_back_and_forth_platform_update(void);
|
||||
void bhv_recovery_heart_loop(void);
|
||||
void bhv_water_bomb_cannon_loop(void);
|
||||
void bhv_bubble_cannon_barrel_loop(void);
|
||||
void bhv_unagi_init(void);
|
||||
void bhv_unagi_loop(void);
|
||||
void bhv_unagi_subobject_loop(void);
|
||||
void bhv_dorrie_update(void);
|
||||
void bhv_haunted_chair_init(void);
|
||||
void bhv_haunted_chair_loop(void);
|
||||
void bhv_mad_piano_update(void);
|
||||
void bhv_flying_bookend_loop(void);
|
||||
void bhv_bookend_spawn_loop(void);
|
||||
void bhv_haunted_bookshelf_manager_loop(void);
|
||||
void bhv_book_switch_loop(void);
|
||||
void bhv_fire_piranha_plant_init(void);
|
||||
void bhv_fire_piranha_plant_update(void);
|
||||
void bhv_small_piranha_flame_loop(void);
|
||||
void bhv_fire_spitter_update(void);
|
||||
void bhv_fly_guy_flame_loop(void);
|
||||
void bhv_snufit_loop(void);
|
||||
void bhv_snufit_balls_loop(void);
|
||||
void bhv_horizontal_grindel_init(void);
|
||||
void bhv_horizontal_grindel_update(void);
|
||||
void bhv_eyerok_boss_loop(void);
|
||||
void bhv_eyerok_hand_loop(void);
|
||||
void bhv_klepto_init(void);
|
||||
void bhv_klepto_update(void);
|
||||
void bhv_bird_update(void);
|
||||
void bhv_racing_penguin_init(void);
|
||||
void bhv_racing_penguin_update(void);
|
||||
void bhv_penguin_race_finish_line_update(void);
|
||||
void bhv_penguin_race_shortcut_check_update(void);
|
||||
void bhv_coffin_manager_loop(void);
|
||||
void bhv_coffin_loop(void);
|
||||
void bhv_clam_loop(void);
|
||||
void bhv_skeeter_update(void);
|
||||
void bhv_skeeter_wave_update(void);
|
||||
void bhv_swing_platform_init(void);
|
||||
void bhv_swing_platform_update(void);
|
||||
void bhv_donut_platform_spawner_update(void);
|
||||
void bhv_donut_platform_update(void);
|
||||
void bhv_ddd_pole_init(void);
|
||||
void bhv_ddd_pole_update(void);
|
||||
void bhv_red_coin_star_marker_init(void);
|
||||
void bhv_triplet_butterfly_update(void);
|
||||
void bhv_bubba_loop(void);
|
||||
void bhv_intro_lakitu_loop(void);
|
||||
void bhv_intro_peach_loop(void);
|
||||
void bhv_end_birds_1_loop(void);
|
||||
void bhv_end_birds_2_loop(void);
|
||||
void bhv_intro_scene_loop(void);
|
||||
void BehDustSmokeLoop(void);
|
||||
void BehYoshiLoop(void);
|
||||
void bhvLllVolcanoFallingTrap_loop(void);
|
||||
|
||||
extern s32 Geo18_802B1BB0(s32 run, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
|
||||
// Bowser
|
||||
extern Gfx *Geo18_802B7D44(s32 a0, struct GraphNode *node, UNUSED s32 a2);
|
||||
extern Gfx *Geo18_802B798C(s32 run, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
extern s32 geo_switch_bowser_eyes(s32 run, struct GraphNode *node, UNUSED Mat4 *mtx);
|
||||
|
||||
// Tuxie
|
||||
extern s32 geo_switch_tuxie_mother_eyes(s32 run, struct GraphNode *node, UNUSED Mat4 *mtx);
|
||||
|
||||
// Cap switch
|
||||
extern Gfx *Geo18_802A719C(s32 run, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
|
||||
// Snufit
|
||||
extern Gfx *Geo18_8030D93C(s32 arg0, struct GraphNode *node, UNUSED void *arg2);
|
||||
extern Gfx *Geo18_8030D9AC(s32 arg0, struct GraphNode *node, UNUSED void *arg2);
|
||||
|
||||
// Bowser key cutscene
|
||||
extern Gfx *Geo18_802BA2B0(s32 run, struct GraphNode *node, UNUSED f32 mtx[4][4]);
|
||||
|
||||
// Water splash
|
||||
extern struct WaterSplashParams D_8032FDD0;
|
||||
extern struct WaterSplashParams D_8032FE18;
|
||||
|
||||
#endif // _BEHAVIOR_ACTIONS_H
|
||||
|
||||
@@ -390,7 +390,7 @@ void BobombBuddyTurnToTalkLoop(void) {
|
||||
if ((s16) o->oMoveAngleYaw == (s16) o->oAngleToMario)
|
||||
o->oAction = BOBOMB_BUDDY_ACT_TALK;
|
||||
|
||||
PlaySound2(SOUND_ACTION_UNKNOWN45B);
|
||||
PlaySound2(SOUND_ACTION_READ_SIGN);
|
||||
}
|
||||
|
||||
void BobombBuddyActionLoop(void) {
|
||||
|
||||
@@ -615,9 +615,9 @@ void ActionBowser7(void) {
|
||||
case 3:
|
||||
o->oBowserUnkF8 = 0;
|
||||
set_obj_animation_and_sound_state(21);
|
||||
spawn_object_relative_with_scale(0, 100, -50, 0, 3.0f, o, MODEL_SMOKE, &bhvWhitePuffSmoke2);
|
||||
spawn_object_relative_with_scale(0, 100, -50, 0, 3.0f, o, MODEL_SMOKE, bhvWhitePuffSmoke2);
|
||||
spawn_object_relative_with_scale(0, -100, -50, 0, 3.0f, o, MODEL_SMOKE,
|
||||
&bhvWhitePuffSmoke2);
|
||||
bhvWhitePuffSmoke2);
|
||||
if (approach_f32_signed(&o->oForwardVel, 0, -1.0f))
|
||||
o->oSubAction = 2;
|
||||
func_8029F728();
|
||||
@@ -767,9 +767,9 @@ void ActionBowser3(void) {
|
||||
|
||||
void func_802B5C78(void) {
|
||||
if (BITS)
|
||||
gSecondCameraFocus = spawn_object(o, MODEL_STAR, &bhvGrandStar);
|
||||
gSecondCameraFocus = spawn_object(o, MODEL_STAR, bhvGrandStar);
|
||||
else {
|
||||
gSecondCameraFocus = spawn_object(o, MODEL_BOWSER_KEY, &bhvBowserKey);
|
||||
gSecondCameraFocus = spawn_object(o, MODEL_BOWSER_KEY, bhvBowserKey);
|
||||
PlaySound2(SOUND_GENERAL2_BOWSER_KEY);
|
||||
}
|
||||
gSecondCameraFocus->oAngleVelYaw = o->oAngleVelYaw;
|
||||
@@ -1254,7 +1254,7 @@ s32 geo_switch_bowser_eyes(s32 run, struct GraphNode *node, UNUSED Mat4 *mtx) {
|
||||
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
|
||||
if (run == TRUE) {
|
||||
if (gCurGraphNodeHeldObject != NULL)
|
||||
obj = (struct Object *) gCurGraphNodeHeldObject->objNode;
|
||||
obj = gCurGraphNodeHeldObject->objNode;
|
||||
switch (sp36 = obj->oBowserEyesShut) {
|
||||
case 0: // eyes open, handle eye looking direction
|
||||
func_802B70C8(obj, switchCase);
|
||||
@@ -1278,7 +1278,7 @@ Gfx *Geo18_802B7D44(s32 a0, struct GraphNode *node, UNUSED s32 a2) {
|
||||
sp24 = (struct Object *) gCurGraphNodeObject;
|
||||
sp20 = (struct GraphNodeGenerated *) node;
|
||||
if (gCurGraphNodeHeldObject != 0)
|
||||
sp24 = (struct Object *) gCurGraphNodeHeldObject->objNode;
|
||||
sp24 = gCurGraphNodeHeldObject->objNode;
|
||||
if (sp24->oOpacity == 0xFF)
|
||||
sp20->fnNode.node.flags = (sp20->fnNode.node.flags & 0xFF) | 0x100;
|
||||
else
|
||||
@@ -1294,9 +1294,9 @@ Gfx *Geo18_802B7D44(s32 a0, struct GraphNode *node, UNUSED s32 a2) {
|
||||
}
|
||||
|
||||
void ActionFallingBowserPlatform0(void) {
|
||||
o->oPlatformUnkF8 = obj_nearest_object_with_behavior(&bhvBowser);
|
||||
o->oPlatformUnkF8 = obj_nearest_object_with_behavior(bhvBowser);
|
||||
set_object_collision_data(o, D_8032F698[o->oBehParams2ndByte].unk0);
|
||||
if (o->oBowserUnkF8 != 0)
|
||||
if (o->oPlatformUnkF8 != 0)
|
||||
o->oAction = 1;
|
||||
}
|
||||
|
||||
@@ -1384,9 +1384,9 @@ void bhv_falling_bowser_platform_loop(void) {
|
||||
|
||||
void func_802B7A58(void) {
|
||||
mark_object_for_deletion(o);
|
||||
spawn_object_with_scale(o, MODEL_NONE, &bhvBlackSmokeUpward, 1.0f);
|
||||
spawn_object_with_scale(o, MODEL_NONE, bhvBlackSmokeUpward, 1.0f);
|
||||
if (RandomFloat() < 0.1)
|
||||
spawn_object(o, MODEL_YELLOW_COIN, &bhvTemporaryYellowCoin);
|
||||
spawn_object(o, MODEL_YELLOW_COIN, bhvTemporaryYellowCoin);
|
||||
}
|
||||
|
||||
s32 func_802B7ADC(s32 a0) {
|
||||
@@ -1478,7 +1478,7 @@ void bhv_flame_moving_forward_growing_loop(void) {
|
||||
mark_object_for_deletion(o);
|
||||
if (o->oPosY < o->oFloorHeight) {
|
||||
o->oPosY = o->oFloorHeight;
|
||||
sp18 = spawn_object(o, MODEL_RED_FLAME, &bhvFlameBowser);
|
||||
sp18 = spawn_object(o, MODEL_RED_FLAME, bhvFlameBowser);
|
||||
mark_object_for_deletion(o);
|
||||
}
|
||||
}
|
||||
@@ -1506,9 +1506,9 @@ void bhv_flame_floating_landing_loop(void) {
|
||||
o->oVelY = D_8032F748[o->oBehParams2ndByte];
|
||||
if (o->oMoveFlags & 1) {
|
||||
if (o->oBehParams2ndByte == 0)
|
||||
spawn_object(o, MODEL_RED_FLAME, &bhvFlameLargeBurningOut);
|
||||
spawn_object(o, MODEL_RED_FLAME, bhvFlameLargeBurningOut);
|
||||
else
|
||||
spawn_object(o, MODEL_NONE, &bhvBlueFlamesGroup); //? wonder if they meant MODEL_BLUE_FLAME?
|
||||
spawn_object(o, MODEL_NONE, bhvBlueFlamesGroup); //? wonder if they meant MODEL_BLUE_FLAME?
|
||||
mark_object_for_deletion(o);
|
||||
}
|
||||
o->oGraphYOffset = o->header.gfx.scale[1] * 14.0f;
|
||||
@@ -1537,12 +1537,12 @@ void bhv_blue_bowser_flame_loop(void) {
|
||||
if (o->oBehParams2ndByte == 0)
|
||||
for (i = 0; i < 3; i++)
|
||||
spawn_object_relative_with_scale(0, 0, 0, 0, 5.0f, o, MODEL_RED_FLAME,
|
||||
&bhvFlameFloatingLanding);
|
||||
bhvFlameFloatingLanding);
|
||||
else {
|
||||
spawn_object_relative_with_scale(1, 0, 0, 0, 8.0f, o, MODEL_BLUE_FLAME,
|
||||
&bhvFlameFloatingLanding);
|
||||
bhvFlameFloatingLanding);
|
||||
spawn_object_relative_with_scale(2, 0, 0, 0, 8.0f, o, MODEL_BLUE_FLAME,
|
||||
&bhvFlameFloatingLanding);
|
||||
bhvFlameFloatingLanding);
|
||||
}
|
||||
mark_object_for_deletion(o);
|
||||
}
|
||||
@@ -1559,7 +1559,7 @@ void bhv_flame_bouncing_init(void) {
|
||||
void bhv_flame_bouncing_loop(void) {
|
||||
struct Object *sp1C;
|
||||
if (o->oTimer == 0)
|
||||
o->oFlameUnk100 = obj_nearest_object_with_behavior(&bhvBowser);
|
||||
o->oFlameUnk100 = obj_nearest_object_with_behavior(bhvBowser);
|
||||
sp1C = o->oFlameUnk100;
|
||||
o->oForwardVel = 15.0f;
|
||||
o->oBounce = -1.0f;
|
||||
|
||||
@@ -84,7 +84,8 @@ static struct BowserPuzzlePiece sBowserPuzzlePieces[] = {
|
||||
/**
|
||||
* Spawn a single puzzle piece.
|
||||
*/
|
||||
void bhv_lll_bowser_puzzle_spawn_piece(s16 model, void *behavior, f32 xOffset, f32 zOffset,
|
||||
void bhv_lll_bowser_puzzle_spawn_piece(s16 model, const BehaviorScript *behavior,
|
||||
f32 xOffset, f32 zOffset,
|
||||
s8 initialAction, s8 *actionList) {
|
||||
struct Object *puzzlePiece = spawn_object(o, model, behavior);
|
||||
puzzlePiece->oPosX += xOffset;
|
||||
|
||||
@@ -48,7 +48,7 @@ void bhv_respawner_loop(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void create_respawner(s32 model, void *behToSpawn, s32 minSpawnDist) {
|
||||
void create_respawner(s32 model, const BehaviorScript *behToSpawn, s32 minSpawnDist) {
|
||||
struct Object *respawner = spawn_object_abs_with_rot(o, 0, MODEL_NONE, bhvRespawner, o->oHomeX,
|
||||
o->oHomeY, o->oHomeZ, 0, 0, 0);
|
||||
respawner->oBehParams = o->oBehParams;
|
||||
|
||||
@@ -20,7 +20,7 @@ static s32 func_8030D284(s32 arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
static void eyerok_spawn_hand(s16 side, s32 model, void *behavior) {
|
||||
static void eyerok_spawn_hand(s16 side, s32 model, const BehaviorScript *behavior) {
|
||||
struct Object *hand;
|
||||
|
||||
hand = spawn_object_relative_with_scale(side, -500 * side, 0, 300, 1.5f, o, model, behavior);
|
||||
|
||||
@@ -33,7 +33,7 @@ void bhv_falling_pillar_spawn_hitboxes(void) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
spawn_object_relative(i, 0, i * 400 + 300, 0, o, MODEL_NONE, &bhvFallingPillarHitbox);
|
||||
spawn_object_relative(i, 0, i * 400 + 300, 0, o, MODEL_NONE, bhvFallingPillarHitbox);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ void bhv_openable_grill_loop(void) {
|
||||
o->oAction++;
|
||||
break;
|
||||
case 1:
|
||||
if ((o->oOpenableGrillUnkF4 = obj_nearest_object_with_behavior(&bhvFloorSwitchGrills))
|
||||
if ((o->oOpenableGrillUnkF4 = obj_nearest_object_with_behavior(bhvFloorSwitchGrills))
|
||||
!= NULL)
|
||||
o->oAction++;
|
||||
break;
|
||||
|
||||
@@ -1,43 +1,60 @@
|
||||
// intro_lakitu.inc.c
|
||||
/**
|
||||
* @file intro_lakitu.inc.c
|
||||
* This file implements lakitu's behvaior during the intro cutscene.
|
||||
* It's also used during the ending cutscene.
|
||||
*/
|
||||
|
||||
void func_8029AB70(struct Object *o, Vec3f b) {
|
||||
f32 sp2C;
|
||||
Vec3s sp24;
|
||||
s16 sp22, sp20;
|
||||
|
||||
vec3f_add(b, gCurrLevelCamera->pos);
|
||||
vec3f_get_dist_and_angle(gCurrLevelCamera->pos, gCurrLevelCamera->focus, &sp2C, &sp24[0], &sp24[1]);
|
||||
vec3f_get_dist_and_angle(gCurrLevelCamera->pos, b, &sp2C, &sp22, &sp20);
|
||||
vec3f_set_dist_and_angle(gCurrLevelCamera->pos, b, sp2C, sp24[0] + sp22, sp24[1] + sp20);
|
||||
vec3f_to_object_pos(o, b);
|
||||
/**
|
||||
* Add the camera's position to `offset`, rotate the point to be relative to the camera's focus, then
|
||||
* set lakitu's location.
|
||||
*/
|
||||
void intro_lakitu_set_offset_from_camera(struct Object *o, Vec3f offset) {
|
||||
f32 dist;
|
||||
Vec3s focusAngles;
|
||||
s16 offsetPitch, offsetYaw;
|
||||
|
||||
vec3f_add(offset, gCurrLevelCamera->pos);
|
||||
vec3f_get_dist_and_angle(gCurrLevelCamera->pos, gCurrLevelCamera->focus,
|
||||
&dist, &focusAngles[0], &focusAngles[1]);
|
||||
vec3f_get_dist_and_angle(gCurrLevelCamera->pos, offset, &dist, &offsetPitch, &offsetYaw);
|
||||
vec3f_set_dist_and_angle(gCurrLevelCamera->pos, offset, dist,
|
||||
focusAngles[0] + offsetPitch, focusAngles[1] + offsetYaw);
|
||||
vec3f_to_object_pos(o, offset);
|
||||
}
|
||||
|
||||
void func_8029AC3C(struct Object *o, Vec3f b) {
|
||||
UNUSED Vec3f sp3C;
|
||||
Vec3f sp30;
|
||||
f32 sp2C;
|
||||
s16 sp2A, sp28;
|
||||
UNUSED u32 sp24;
|
||||
void intro_lakitu_set_focus(struct Object *o, Vec3f newFocus) {
|
||||
UNUSED Vec3f unusedVec3f;
|
||||
Vec3f origin;
|
||||
f32 dist;
|
||||
s16 pitch, yaw;
|
||||
UNUSED u32 unused;
|
||||
|
||||
vec3f_set(sp30, 0.f, 0.f, 0.f);
|
||||
vec3f_get_dist_and_angle(sp30, b, &sp2C, &sp2A, &sp28);
|
||||
o->oFaceAnglePitch = sp2A;
|
||||
o->oFaceAngleYaw = sp28;
|
||||
// newFocus is an offset from lakitu's origin, not a point in the world.
|
||||
vec3f_set(origin, 0.f, 0.f, 0.f);
|
||||
vec3f_get_dist_and_angle(origin, newFocus, &dist, &pitch, &yaw);
|
||||
o->oFaceAnglePitch = pitch;
|
||||
o->oFaceAngleYaw = yaw;
|
||||
}
|
||||
|
||||
s32 func_8029ACAC(struct Object *o, struct CinematicCameraTable b[], struct CinematicCameraTable c[]) {
|
||||
Vec3f sp2C, sp20;
|
||||
s32 sp1C = 0;
|
||||
s16 sp1A = o->oIntroLakituUnkFC;
|
||||
/**
|
||||
* Move lakitu along the spline `offset`, relative to the camera, and face him towards the corresponding
|
||||
* location along the spline `focus`.
|
||||
*/
|
||||
s32 intro_lakitu_set_pos_and_focus(struct Object *o, struct CutsceneSplinePoint offset[],
|
||||
struct CutsceneSplinePoint focus[]) {
|
||||
Vec3f newOffset, newFocus;
|
||||
s32 splineFinished = 0;
|
||||
s16 splineSegment = o->oIntroLakituSplineSegment;
|
||||
|
||||
if ((func_80287CFC(sp20, b, &sp1A, &(o->oIntroLakituUnkF8)) == 1)
|
||||
|| (func_80287CFC(sp2C, c, &sp1A, &(o->oIntroLakituUnkF8)) == 1))
|
||||
sp1C += 1;
|
||||
if ((move_point_along_spline(newFocus, offset, &splineSegment, &(o->oIntroLakituSplineSegmentProgress)) == 1)
|
||||
|| (move_point_along_spline(newOffset, focus, &splineSegment, &(o->oIntroLakituSplineSegmentProgress)) == 1))
|
||||
splineFinished += 1;
|
||||
|
||||
o->oIntroLakituUnkFC = sp1A;
|
||||
func_8029AB70(o, sp2C);
|
||||
func_8029AC3C(o, sp20);
|
||||
return sp1C;
|
||||
o->oIntroLakituSplineSegment = splineSegment;
|
||||
intro_lakitu_set_offset_from_camera(o, newOffset);
|
||||
intro_lakitu_set_focus(o, newFocus);
|
||||
return splineFinished;
|
||||
}
|
||||
|
||||
void bhv_intro_lakitu_loop(void) {
|
||||
@@ -47,9 +64,9 @@ void bhv_intro_lakitu_loop(void) {
|
||||
switch (gCurrentObject->oAction) {
|
||||
case 0:
|
||||
obj_disable_rendering();
|
||||
gCurrentObject->oIntroLakituUnkFC = 0.f;
|
||||
gCurrentObject->oIntroLakituUnkF8 = 0.f;
|
||||
gCurrentObject->oIntroLakituUnk1AC =
|
||||
gCurrentObject->oIntroLakituSplineSegment = 0.f;
|
||||
gCurrentObject->oIntroLakituSplineSegmentProgress = 0.f;
|
||||
gCurrentObject->oIntroLakituCloud =
|
||||
spawn_object_relative_with_scale(1, 0, 0, 0, 2.f, gCurrentObject, MODEL_MIST, bhvCloud);
|
||||
if (gCurrLevelCamera->cutscene == CUTSCENE_END_WAVING)
|
||||
gCurrentObject->oAction = 100;
|
||||
@@ -66,16 +83,18 @@ void bhv_intro_lakitu_loop(void) {
|
||||
}
|
||||
if (gCutsceneTimer > 52)
|
||||
PlaySound(SOUND_AIR_LAKITU_FLY_HIGHPRIO);
|
||||
if (func_8029ACAC(gCurrentObject, D_8032E3CC, D_8032E2B4) == 1)
|
||||
|
||||
if (intro_lakitu_set_pos_and_focus(gCurrentObject, gIntroLakituStartToPipeOffsetFromCamera,
|
||||
gIntroLakituStartToPipeFocus) == 1)
|
||||
gCurrentObject->oAction += 1;
|
||||
|
||||
switch (gCurrentObject->oTimer) {
|
||||
#ifdef VERSION_US
|
||||
case 534:
|
||||
PlaySound2(SOUND_ACTION_UNKNOWN456);
|
||||
PlaySound2(SOUND_ACTION_FLYING_FAST);
|
||||
break;
|
||||
case 581:
|
||||
PlaySound2(SOUND_ACTION_UNKNOWN45E);
|
||||
PlaySound2(SOUND_ACTION_INTRO_UNK45E);
|
||||
break;
|
||||
#endif
|
||||
case 73:
|
||||
@@ -93,9 +112,9 @@ void bhv_intro_lakitu_loop(void) {
|
||||
}
|
||||
#ifdef VERSION_EU
|
||||
if (gCurrentObject->oTimer == 446)
|
||||
PlaySound2(SOUND_ACTION_UNKNOWN456);
|
||||
PlaySound2(SOUND_ACTION_FLYING_FAST);
|
||||
if (gCurrentObject->oTimer == 485)
|
||||
PlaySound2(SOUND_ACTION_UNKNOWN45E);
|
||||
PlaySound2(SOUND_ACTION_INTRO_UNK45E);
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
@@ -134,6 +153,7 @@ void bhv_intro_lakitu_loop(void) {
|
||||
|
||||
if (gCurrentObject->oTimer == 31) {
|
||||
gCurrentObject->oPosY -= 158.f;
|
||||
// Spawn white ground particles
|
||||
func_802ADA94();
|
||||
gCurrentObject->oPosY += 158.f;
|
||||
}
|
||||
@@ -145,11 +165,11 @@ void bhv_intro_lakitu_loop(void) {
|
||||
|
||||
if (gCurrentObject->oTimer == TIMER) {
|
||||
mark_object_for_deletion(gCurrentObject);
|
||||
mark_object_for_deletion(gCurrentObject->oIntroLakituUnk1AC);
|
||||
mark_object_for_deletion(gCurrentObject->oIntroLakituCloud);
|
||||
}
|
||||
#ifndef VERSION_JP
|
||||
if (gCurrentObject->oTimer == 14)
|
||||
PlaySound2(SOUND_ACTION_UNKNOWN45F);
|
||||
PlaySound2(SOUND_ACTION_INTRO_UNK45F);
|
||||
#endif
|
||||
break;
|
||||
case 100:
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
// intro_peach.inc.c
|
||||
|
||||
void func_8029A87C(struct Object *o, f32 b, f32 c) {
|
||||
Vec3f sp2C;
|
||||
s16 sp2A, sp28;
|
||||
f32 sp24, sp20;
|
||||
/**
|
||||
* Set peach's location relative to the camera focus.
|
||||
* If nonzero, make peach's opacity approach targetOpacity by increment
|
||||
*/
|
||||
void intro_peach_set_pos_and_opacity(struct Object *o, f32 targetOpacity, f32 increment) {
|
||||
Vec3f newPos;
|
||||
s16 focusPitch, focusYaw;
|
||||
f32 UNUSED dist, newOpacity;
|
||||
|
||||
vec3f_get_dist_and_angle(gCameraStatus.pos, gCameraStatus.focus, &sp24, &sp2A, &sp28);
|
||||
vec3f_set_dist_and_angle(gCameraStatus.pos, sp2C, o->oIntroPeachUnk110, o->oIntroPeachUnk10C + sp2A,
|
||||
o->oIntroPeachUnk108 + sp28);
|
||||
vec3f_to_object_pos(o, sp2C);
|
||||
sp20 = o->oOpacity;
|
||||
camera_approach_f32_symmetric_bool(&sp20, b, c);
|
||||
o->oOpacity = sp20;
|
||||
vec3f_get_dist_and_angle(gCameraStatus.pos, gCameraStatus.focus, &dist, &focusPitch, &focusYaw);
|
||||
vec3f_set_dist_and_angle(gCameraStatus.pos, newPos, o->oIntroPeachDistToCamera, o->oIntroPeachPitchFromFocus + focusPitch,
|
||||
o->oIntroPeachYawFromFocus + focusYaw);
|
||||
vec3f_to_object_pos(o, newPos);
|
||||
newOpacity = o->oOpacity;
|
||||
camera_approach_f32_symmetric_bool(&newOpacity, targetOpacity, increment);
|
||||
o->oOpacity = newOpacity;
|
||||
}
|
||||
|
||||
void bhv_intro_peach_loop(void) {
|
||||
@@ -21,26 +25,26 @@ void bhv_intro_peach_loop(void) {
|
||||
gCurrentObject->oFaceAnglePitch = 0x400;
|
||||
gCurrentObject->oFaceAngleYaw = 0x7500;
|
||||
gCurrentObject->oFaceAngleRoll = -0x3700;
|
||||
gCurrentObject->oIntroPeachUnk110 = 186.f;
|
||||
gCurrentObject->oIntroPeachUnk10C = -9984.f;
|
||||
gCurrentObject->oIntroPeachUnk108 = -768.f;
|
||||
gCurrentObject->oIntroPeachDistToCamera = 186.f;
|
||||
gCurrentObject->oIntroPeachPitchFromFocus = -9984.f;
|
||||
gCurrentObject->oIntroPeachYawFromFocus = -768.f;
|
||||
gCurrentObject->oOpacity = 255;
|
||||
gCurrentObject->header.gfx.unk38.animFrame = 100;
|
||||
break;
|
||||
case 1:
|
||||
func_8029A87C(gCurrentObject, 0.f, 0.f);
|
||||
intro_peach_set_pos_and_opacity(gCurrentObject, 0.f, 0.f);
|
||||
|
||||
if (gCurrentObject->oTimer > 20)
|
||||
gCurrentObject->oAction += 1;
|
||||
break;
|
||||
case 2:
|
||||
func_8029A87C(gCurrentObject, 255.f, 3.f);
|
||||
intro_peach_set_pos_and_opacity(gCurrentObject, 255.f, 3.f);
|
||||
|
||||
if ((gCurrentObject->oTimer > 100) && (get_dialog_id() == -1))
|
||||
gCurrentObject->oAction += 1;
|
||||
break;
|
||||
case 3:
|
||||
func_8029A87C(gCurrentObject, 0.f, 8.f);
|
||||
intro_peach_set_pos_and_opacity(gCurrentObject, 0.f, 8.f);
|
||||
|
||||
if (gCurrentObject->oTimer > 60)
|
||||
mark_object_for_deletion(gCurrentObject);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
// intro_scene.inc.c
|
||||
|
||||
void func_8029B964(struct Object *parent, s16 xOffset, s16 yOffset, s16 zOffset, s16 pitchOffset,
|
||||
s16 yawOffset, s16 rollOffset, s16 forwardVel, s32 model, void *behavior) {
|
||||
s16 yawOffset, s16 rollOffset, s16 forwardVel,
|
||||
s32 model, const BehaviorScript *behavior) {
|
||||
struct Object *sp1C = spawn_object(parent, model, behavior);
|
||||
|
||||
sp1C->header.gfx.unk38.animFrame = RandomFloat() * 6.f;
|
||||
|
||||
@@ -97,8 +97,8 @@ f32 sMontyMoleLastKilledPosZ;
|
||||
* The result is a singly linked list in reverse processing order. Return the
|
||||
* start of this list.
|
||||
*/
|
||||
static struct Object *link_objects_with_behavior(void *behavior) {
|
||||
void *behaviorAddr;
|
||||
static struct Object *link_objects_with_behavior(const BehaviorScript *behavior) {
|
||||
const BehaviorScript *behaviorAddr;
|
||||
struct Object *obj;
|
||||
struct Object *lastObject;
|
||||
struct ObjectNode *listHead;
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// rotating_platform.c.inc
|
||||
|
||||
extern u8 wf_seg7_collision_rotating_platform[];
|
||||
extern u8 wdw_seg7_collision_070186B4[];
|
||||
struct Struct8032F24A D_8032F24A[] = { { 0, 100, wf_seg7_collision_rotating_platform, 2000 },
|
||||
{ 0, 150, wdw_seg7_collision_070186B4, 1000 } };
|
||||
#include "levels/wf/header.h"
|
||||
#include "levels/wdw/header.h"
|
||||
|
||||
struct WFRotatingPlatformData sWFRotatingPlatformData[] = {
|
||||
{ 0, 100, wf_seg7_collision_rotating_platform, 2000 },
|
||||
{ 0, 150, wdw_seg7_collision_070186B4, 1000 }
|
||||
};
|
||||
|
||||
void bhv_wf_rotating_wooden_platform_loop(void) {
|
||||
if (o->oAction == 0) {
|
||||
@@ -24,9 +27,9 @@ void bhv_wf_rotating_wooden_platform_loop(void) {
|
||||
void bhv_rotating_platform_loop(void) {
|
||||
s8 sp1F = o->oBehParams >> 24;
|
||||
if (o->oTimer == 0) {
|
||||
set_object_collision_data(o, D_8032F24A[o->oBehParams2ndByte].unk1);
|
||||
o->oCollisionDistance = D_8032F24A[o->oBehParams2ndByte].unk2;
|
||||
obj_scale(D_8032F24A[o->oBehParams2ndByte].unk0 * 0.01f);
|
||||
set_object_collision_data(o, sWFRotatingPlatformData[o->oBehParams2ndByte].collisionData);
|
||||
o->oCollisionDistance = sWFRotatingPlatformData[o->oBehParams2ndByte].collisionDistance;
|
||||
obj_scale(sWFRotatingPlatformData[o->oBehParams2ndByte].scale * 0.01f);
|
||||
}
|
||||
o->oAngleVelYaw = sp1F << 4;
|
||||
o->oFaceAngleYaw += o->oAngleVelYaw;
|
||||
|
||||
@@ -55,7 +55,7 @@ void bhv_wf_sliding_tower_platform_loop(void) {
|
||||
mark_object_for_deletion(o);
|
||||
}
|
||||
|
||||
void func_802AF9A4(s16 a, u32 *beh) {
|
||||
void func_802AF9A4(s16 a, const BehaviorScript *beh) {
|
||||
s16 yaw;
|
||||
struct Object *platform = spawn_object(o, a, beh);
|
||||
yaw = o->oPlatformSpawnerUnkF4 * o->oPlatformSpawnerUnkFC + o->oPlatformSpawnerUnkF8;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
struct TripletButterflyActivationData {
|
||||
s32 model;
|
||||
void *behavior;
|
||||
const BehaviorScript *behavior;
|
||||
f32 scale;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// tumbling_bridge.c.inc
|
||||
|
||||
extern u8 wf_seg7_collision_tumbling_bridge[];
|
||||
extern u8 bbh_seg7_collision_07026B1C[];
|
||||
extern u8 lll_seg7_collision_0701D21C[];
|
||||
extern u8 bitfs_seg7_collision_07015288[];
|
||||
#include "levels/wf/header.h"
|
||||
#include "levels/bbh/header.h"
|
||||
#include "levels/lll/header.h"
|
||||
#include "levels/bitfs/header.h"
|
||||
|
||||
struct Struct8032F34C sTumblingBridgeParams[] = {
|
||||
{ 9, -512, 0x80, MODEL_WF_TUMBLING_BRIDGE_PART, wf_seg7_collision_tumbling_bridge },
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
/**
|
||||
* Behavior for bhvWiggler and bhvWigglerBodyPart.
|
||||
* The bhvWiggler object controls the wiggler's behavior, and physically manifests
|
||||
* as the wiggler's head. The bhvWigglerBodyPart objects represent the 3 tail body
|
||||
* Behavior for bhvWigglerHead and bhvWigglerBody.
|
||||
* The bhvWigglerHead object controls the wiggler's behavior, and physically manifests
|
||||
* as the wiggler's head. The bhvWigglerBody objects represent the 3 tail body
|
||||
* parts, numbered 1 closest to the head, and 3 at the end of the tail.
|
||||
* Processing order is bhvWiggler, then bhvWigglerBodyPart 1, 2, then 3.
|
||||
* Processing order is bhvWigglerHead, then bhvWigglerBody 1, 2, then 3.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ static u8 sWigglerAttackHandlers[] = {
|
||||
static f32 sWigglerSpeeds[] = { 2.0f, 40.0f, 30.0f, 16.0f };
|
||||
|
||||
/**
|
||||
* Update function for bhvWigglerBodyPart.
|
||||
* Update function for bhvWigglerBody.
|
||||
* Set object position and angle based on wiggler segment data and avoid falling
|
||||
* through the floor.
|
||||
* Tangible if the wiggler is not in the shrinking action, but does nothing on
|
||||
@@ -142,7 +142,7 @@ static void wiggler_init_segments(void) {
|
||||
// Spawn each body part
|
||||
for (i = 1; i <= 3; i++) {
|
||||
bodyPart =
|
||||
spawn_object_relative(i, 0, 0, 0, o, MODEL_WIGGLER_BODY_PART, bhvWigglerBodyPart);
|
||||
spawn_object_relative(i, 0, 0, 0, o, MODEL_WIGGLER_BODY, bhvWigglerBody);
|
||||
if (bodyPart != NULL) {
|
||||
func_8029EE20(bodyPart, wiggler_seg5_anims_0500C874, 0);
|
||||
bodyPart->header.gfx.unk38.animFrame = (23 * i) % 26 - 1;
|
||||
@@ -392,7 +392,7 @@ void wiggler_jumped_on_attack_handler(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Update function for bhvWiggler.
|
||||
* Update function for bhvWigglerHead.
|
||||
*/
|
||||
void bhv_wiggler_update(void) {
|
||||
// PARTIAL_UPDATE
|
||||
|
||||
+261
-204
@@ -89,10 +89,19 @@ struct Struct8033B4B8 D_8033B498;
|
||||
struct Struct8033B4B8 D_8033B4B8;
|
||||
s16 gCameraMovementFlags;
|
||||
s16 gCameraFlags2;
|
||||
struct CinematicCameraTable D_8033B4E0[32];
|
||||
struct CinematicCameraTable D_8033B5E0[32];
|
||||
s16 D_8033B6E0;
|
||||
f32 D_8033B6E4;
|
||||
struct CutsceneSplinePoint D_8033B4E0[32];
|
||||
struct CutsceneSplinePoint D_8033B5E0[32];
|
||||
|
||||
/**
|
||||
* The current segment of the CutsceneSplinePoint[] being used.
|
||||
*/
|
||||
s16 sCutsceneSplineSegment;
|
||||
|
||||
/**
|
||||
* The progress (from 0 to 1) through the current spline segment.
|
||||
* When it becomes >= 1, 1.0 is subtracted from it and sCutsceneSplineSegment is increased.
|
||||
*/
|
||||
f32 sCutsceneSplineSegmentProgress;
|
||||
s16 D_8033B6E8;
|
||||
s16 D_8033B6EA;
|
||||
s16 gCutsceneTimer;
|
||||
@@ -2513,11 +2522,11 @@ void init_camera(struct LevelCamera *c) {
|
||||
sGeometryForMario.prevFloorType = sGeometryForMario.currFloorType;
|
||||
sGeometryForMario.prevCeilType = sGeometryForMario.currCeilType;
|
||||
for (i = 0; i < 32; i++) {
|
||||
D_8033B4E0[i].unk0 = -1;
|
||||
D_8033B5E0[i].unk0 = -1;
|
||||
D_8033B4E0[i].index = -1;
|
||||
D_8033B5E0[i].index = -1;
|
||||
}
|
||||
D_8033B6E0 = 0;
|
||||
D_8033B6E4 = 0.f;
|
||||
sCutsceneSplineSegment = 0;
|
||||
sCutsceneSplineSegmentProgress = 0.f;
|
||||
D_8033B6E8 = 0;
|
||||
sSplinePositionLimit = 0.f;
|
||||
sPositionAlongSpline = 0.f;
|
||||
@@ -2697,8 +2706,8 @@ void func_802876D0(struct GraphNodeCamera *a) {
|
||||
func_80287404(a);
|
||||
}
|
||||
|
||||
s32 geo_camera_preset_and_pos(s32 a, struct GraphNodeCamera *b, struct AllocOnlyPool *c) {
|
||||
struct GraphNodeCamera *sp2C = b;
|
||||
Gfx *geo_camera_preset_and_pos(s32 a, struct GraphNode *b, struct AllocOnlyPool *c) {
|
||||
struct GraphNodeCamera *sp2C = (struct GraphNodeCamera *) b;
|
||||
UNUSED struct AllocOnlyPool *sp28 = c;
|
||||
|
||||
switch (a) {
|
||||
@@ -2709,7 +2718,7 @@ s32 geo_camera_preset_and_pos(s32 a, struct GraphNodeCamera *b, struct AllocOnly
|
||||
func_802876D0(sp2C);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void dummy_802877D8(UNUSED struct LevelCamera *c) {
|
||||
@@ -2785,56 +2794,81 @@ void evaluate_cubic_spline(f32 u, Vec3f Q, Vec3f a0, Vec3f a1, Vec3f a2, Vec3f a
|
||||
unused_spline_yaw = atan2s(z, x);
|
||||
}
|
||||
|
||||
s32 func_80287CFC(Vec3f a, struct CinematicCameraTable b[], s16 *c, f32 *d) {
|
||||
s32 sp6C = 0;
|
||||
Vec3f sp3C[4];
|
||||
/**
|
||||
* Computes the point that is `progress` percent of the way through segment `splineSegment` of `spline`,
|
||||
* and stores the result in `p`. `progress` and `splineSegment` are updated if `progress` becomes >= 1.0.
|
||||
*
|
||||
* When neither of next two points' speeds == 0, the number of frames is between 1 and 255. Otherwise
|
||||
* it's infinite.
|
||||
*
|
||||
* To calculate the number of frames it will take to progress through a spline segment:
|
||||
* If the next two speeds are the same and nonzero, it's 1.0 / firstSpeed.
|
||||
*
|
||||
* s1 and s2 are short hand for first/secondSpeed. The progress at any frame n is defined by a recurrency relation:
|
||||
* p(n+1) = (s2 - s1 + 1) * p(n) + s1
|
||||
* Which can be written as
|
||||
* p(n) = (s2 * ((s2 - s1 + 1)^(n) - 1)) / (s2 - s1)
|
||||
*
|
||||
* Solving for the number of frames:
|
||||
* n = log(((s2 - s1) / s1) + 1) / log(s2 - s1 + 1)
|
||||
*
|
||||
* @return 1 if the point has reached the end of the spline, when `progress` reaches 1.0 or greater, and
|
||||
* the 4th CutsceneSplinePoint in the current segment away from spline[splineSegment] has an index of -1.
|
||||
*/
|
||||
s32 move_point_along_spline(Vec3f p, struct CutsceneSplinePoint spline[], s16 *splineSegment, f32 *progress) {
|
||||
s32 finished = 0;
|
||||
Vec3f controlPoints[4];
|
||||
s32 i = 0;
|
||||
f32 sp34 = *d;
|
||||
UNUSED f32 sp30;
|
||||
f32 sp2C = 0;
|
||||
f32 sp28 = 0;
|
||||
s32 sp24 = *c;
|
||||
f32 u = *progress;
|
||||
f32 progressChange;
|
||||
f32 firstSpeed = 0;
|
||||
f32 secondSpeed = 0;
|
||||
s32 segment = *splineSegment;
|
||||
|
||||
if (*c < 0) {
|
||||
sp24 = 0;
|
||||
sp34 = 0;
|
||||
if (*splineSegment < 0) {
|
||||
segment = 0;
|
||||
u = 0;
|
||||
}
|
||||
if (b[sp24].unk0 == -1 || b[sp24 + 1].unk0 == -1 || b[sp24 + 2].unk0 == -1) {
|
||||
if (spline[segment].index == -1 || spline[segment + 1].index == -1 || spline[segment + 2].index == -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
sp3C[i][0] = b[sp24 + i].unk2[0];
|
||||
sp3C[i][1] = b[sp24 + i].unk2[1];
|
||||
sp3C[i][2] = b[sp24 + i].unk2[2];
|
||||
controlPoints[i][0] = spline[segment + i].point[0];
|
||||
controlPoints[i][1] = spline[segment + i].point[1];
|
||||
controlPoints[i][2] = spline[segment + i].point[2];
|
||||
}
|
||||
evaluate_cubic_spline(sp34, a, sp3C[0], sp3C[1], sp3C[2], sp3C[3]);
|
||||
if (b[*c + 1].unk1 != 0) {
|
||||
sp2C = 1.0f / b[*c + 1].unk1;
|
||||
evaluate_cubic_spline(u, p, controlPoints[0], controlPoints[1], controlPoints[2], controlPoints[3]);
|
||||
|
||||
if (spline[*splineSegment + 1].speed != 0) {
|
||||
firstSpeed = 1.0f / spline[*splineSegment + 1].speed;
|
||||
}
|
||||
if (b[*c + 2].unk1 != 0) {
|
||||
sp28 = 1.0f / b[*c + 2].unk1;
|
||||
if (spline[*splineSegment + 2].speed != 0) {
|
||||
secondSpeed = 1.0f / spline[*splineSegment + 2].speed;
|
||||
}
|
||||
sp30 = (sp28 - sp2C) * *d + sp2C;
|
||||
progressChange = (secondSpeed - firstSpeed) * *progress + firstSpeed;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
if (gCurrLevelCamera->cutscene == CUTSCENE_INTRO_PEACH) {
|
||||
sp30 += sp30 * 0.19f;
|
||||
progressChange += progressChange * 0.19f;
|
||||
}
|
||||
if (gCurrLevelCamera->cutscene == CUTSCENE_CREDITS) {
|
||||
sp30 += sp30 * 0.15f;
|
||||
progressChange += progressChange * 0.15f;
|
||||
}
|
||||
if (gCurrLevelCamera->cutscene == CUTSCENE_PEACH_END) {
|
||||
sp30 += sp30 * 0.1f;
|
||||
progressChange += progressChange * 0.1f;
|
||||
}
|
||||
#endif
|
||||
if (1 <= (*d += sp30)) {
|
||||
(*c)++;
|
||||
if (b[*c + 3].unk0 == -1) {
|
||||
*c = 0;
|
||||
sp6C = 1;
|
||||
|
||||
if (1 <= (*progress += progressChange)) {
|
||||
(*splineSegment)++;
|
||||
if (spline[*splineSegment + 3].index == -1) {
|
||||
*splineSegment = 0;
|
||||
finished = 1;
|
||||
}
|
||||
*d -= 1;
|
||||
*progress -= 1;
|
||||
}
|
||||
return sp6C;
|
||||
return finished;
|
||||
}
|
||||
|
||||
s32 select_or_activate_mario_cam(s32 angle) {
|
||||
@@ -5134,7 +5168,7 @@ struct TableCamera *TableLevelCinematicCamera[40] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032DDF0[23] = {
|
||||
struct CutsceneSplinePoint sIntroStartToPipePosition[23] = {
|
||||
{ 0, 0, { 2122, 8762, 9114 } }, { 0, 0, { 2122, 8762, 9114 } }, { 1, 0, { 2122, 7916, 9114 } },
|
||||
{ 1, 0, { 2122, 7916, 9114 } }, { 2, 0, { 957, 5166, 8613 } }, { 3, 0, { 589, 4338, 7727 } },
|
||||
{ 4, 0, { 690, 3366, 6267 } }, { 5, 0, { -1600, 2151, 4955 } }, { 6, 0, { -1557, 232, 1283 } },
|
||||
@@ -5145,7 +5179,7 @@ struct CinematicCameraTable D_8032DDF0[23] = {
|
||||
{ 0, 0, { 448, 136, 564 } }, { -1, 0, { 448, 136, 564 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032DEA8[23] = {
|
||||
struct CutsceneSplinePoint sIntroStartToPipeFocus[23] = {
|
||||
{ 0, 50, { 1753, 29800, 8999 } }, { 0, 50, { 1753, 29800, 8999 } },
|
||||
{ 1, 50, { 1753, 8580, 8999 } }, { 1, 100, { 1753, 8580, 8999 } },
|
||||
{ 2, 50, { 520, 5400, 8674 } }, { 3, 50, { 122, 4437, 7875 } },
|
||||
@@ -5160,7 +5194,12 @@ struct CinematicCameraTable D_8032DEA8[23] = {
|
||||
{ -1, 0, { 48, 191, 227 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032DF60[14] = {
|
||||
/**
|
||||
* Describes the spline the camera follows, starting when the camera jumps to Lakitu and ending after
|
||||
* mario jumps out of the pipe when the first dialog opens. This table specifically updates the
|
||||
* camera's position.
|
||||
*/
|
||||
struct CutsceneSplinePoint sIntroPipeToDialogPosition[14] = {
|
||||
{ 0, 0, { -785, 625, 4527 } }, { 1, 0, { -785, 625, 4527 } }, { 2, 0, { -1286, 644, 4376 } },
|
||||
{ 3, 0, { -1286, 623, 4387 } }, { 4, 0, { -1286, 388, 3963 } }, { 5, 0, { -1286, 358, 4093 } },
|
||||
{ 6, 0, { -1386, 354, 4159 } }, { 7, 0, { -1477, 306, 4223 } }, { 8, 0, { -1540, 299, 4378 } },
|
||||
@@ -5168,7 +5207,10 @@ struct CinematicCameraTable D_8032DF60[14] = {
|
||||
{ 0, 0, { -1328, 485, 5017 } }, { -1, 0, { -1328, 485, 5017 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032DFD0[14] = {
|
||||
/**
|
||||
* Describes the spline that the camera's focus follows, during the same part of the intro as the above.
|
||||
*/
|
||||
struct CutsceneSplinePoint sIntroPipeToDialogFocus[14] = {
|
||||
{ 0, 20, { -1248, 450, 4596 } }, { 1, 59, { -1258, 485, 4606 } }, { 2, 59, { -1379, 344, 4769 } },
|
||||
{ 3, 20, { -1335, 366, 4815 } }, { 4, 23, { -1315, 370, 4450 } }, { 5, 40, { -1322, 333, 4591 } },
|
||||
{ 6, 25, { -1185, 329, 4616 } }, { 7, 21, { -1059, 380, 4487 } }, { 8, 14, { -1086, 421, 4206 } },
|
||||
@@ -5176,21 +5218,21 @@ struct CinematicCameraTable D_8032DFD0[14] = {
|
||||
{ 0, 0, { -1328, 385, 4354 } }, { -1, 0, { -1328, 385, 4354 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032E040[10] = {
|
||||
struct CutsceneSplinePoint D_8032E040[10] = {
|
||||
{ 0, 0, { -86, 876, 640 } }, { 1, 0, { -86, 876, 610 } }, { 2, 0, { -66, 945, 393 } },
|
||||
{ 3, 0, { -80, 976, 272 } }, { 4, 0, { -66, 1306, -36 } }, { 5, 0, { -70, 1869, -149 } },
|
||||
{ 6, 0, { -10, 2093, -146 } }, { 7, 0, { -10, 2530, -248 } }, { 8, 0, { -10, 2530, -263 } },
|
||||
{ 9, 0, { -10, 2530, -273 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032E090[11] = {
|
||||
struct CutsceneSplinePoint D_8032E090[11] = {
|
||||
{ 0, 50, { -33, 889, -7 } }, { 1, 35, { -33, 889, -7 } }, { 2, 31, { -17, 1070, -193 } },
|
||||
{ 3, 25, { -65, 1182, -272 } }, { 4, 20, { -64, 1559, -542 } }, { 5, 25, { -68, 2029, -677 } },
|
||||
{ 6, 25, { -9, 2204, -673 } }, { 7, 25, { -8, 2529, -772 } }, { 8, 0, { -8, 2529, -772 } },
|
||||
{ 9, 0, { -8, 2529, -772 } }, { -1, 0, { -8, 2529, -772 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032E0E8[20] = {
|
||||
struct CutsceneSplinePoint D_8032E0E8[20] = {
|
||||
{ 0, 50, { 1, 120, -1150 } }, { 1, 50, { 1, 120, -1150 } }, { 2, 40, { 118, 121, -1199 } },
|
||||
{ 3, 40, { 147, 74, -1306 } }, { 4, 40, { 162, 95, -1416 } }, { 5, 40, { 25, 111, -1555 } },
|
||||
{ 6, 40, { -188, 154, -1439 } }, { 7, 40, { -203, 181, -1242 } }, { 8, 40, { 7, 191, -1057 } },
|
||||
@@ -5200,25 +5242,25 @@ struct CinematicCameraTable D_8032E0E8[20] = {
|
||||
{ 8, 0, { -6, 72, 574 } }, { -1, 0, { -6, 72, 574 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032E188[9] = {
|
||||
struct CutsceneSplinePoint D_8032E188[9] = {
|
||||
{ 0, 0, { -130, 1111, -1815 } }, { 1, 0, { -131, 1052, -1820 } }, { 2, 0, { -271, 1008, -1651 } },
|
||||
{ 3, 0, { -439, 1043, -1398 } }, { 4, 0, { -433, 1040, -1120 } }, { 5, 0, { -417, 1040, -1076 } },
|
||||
{ 6, 0, { -417, 1040, -1076 } }, { 7, 0, { -417, 1040, -1076 } }, { -1, 0, { -417, 1040, -1076 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032E1D0[9] = {
|
||||
struct CutsceneSplinePoint D_8032E1D0[9] = {
|
||||
{ 0, 50, { -37, 1020, -1332 } }, { 1, 20, { -36, 1012, -1330 } }, { 2, 20, { -24, 1006, -1215 } },
|
||||
{ 3, 20, { 28, 1002, -1224 } }, { 4, 24, { 45, 1013, -1262 } }, { 5, 35, { 34, 1000, -1287 } },
|
||||
{ 6, 0, { 34, 1000, -1287 } }, { 7, 0, { 34, 1000, -1287 } }, { -1, 0, { 34, 1000, -1287 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032E218[8] = {
|
||||
struct CutsceneSplinePoint D_8032E218[8] = {
|
||||
{ 0, 50, { 200, 1066, -1414 } }, { 0, 50, { 200, 1066, -1414 } }, { 0, 30, { 198, 1078, -1412 } },
|
||||
{ 0, 33, { 15, 1231, -1474 } }, { 0, 39, { -94, 1381, -1368 } }, { 0, 0, { -92, 1374, -1379 } },
|
||||
{ 0, 0, { -92, 1374, -1379 } }, { -1, 0, { -92, 1374, -1379 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032E258[7] = {
|
||||
struct CutsceneSplinePoint D_8032E258[7] = {
|
||||
{ 0, 50, { 484, 1368, -888 } }, { 0, 72, { 479, 1372, -892 } }, { 0, 50, { 351, 1817, -918 } },
|
||||
{ 0, 50, { 351, 1922, -598 } }, { 0, 0, { 636, 2027, -415 } }, { 0, 0, { 636, 2027, -415 } },
|
||||
{ -1, 0, { 636, 2027, -415 } }
|
||||
@@ -5602,8 +5644,8 @@ void set_cam_yaw_from_focus_and_pos(struct LevelCamera *c) {
|
||||
}
|
||||
|
||||
void func_8028FABC(void) {
|
||||
D_8033B6E0 = 0;
|
||||
D_8033B6E4 = 0;
|
||||
sCutsceneSplineSegment = 0;
|
||||
sCutsceneSplineSegmentProgress = 0;
|
||||
}
|
||||
|
||||
void func_8028FAE0(struct LevelCamera *c) {
|
||||
@@ -5618,32 +5660,32 @@ void cap_switch_save(s16 dummy) {
|
||||
save_file_do_save(gCurrSaveFileNum - 1);
|
||||
}
|
||||
|
||||
void func_8028FB80(struct CinematicCameraTable *a, s8 b, u8 c, Vec3s d) {
|
||||
a->unk0 = b;
|
||||
a->unk1 = c;
|
||||
vec3s_copy(a->unk2, d);
|
||||
void func_8028FB80(struct CutsceneSplinePoint *a, s8 b, u8 c, Vec3s d) {
|
||||
a->index = b;
|
||||
a->speed = c;
|
||||
vec3s_copy(a->point, d);
|
||||
}
|
||||
|
||||
void func_8028FBD8(struct CinematicCameraTable a[], struct CinematicCameraTable b[]) {
|
||||
void func_8028FBD8(struct CutsceneSplinePoint a[], struct CutsceneSplinePoint b[]) {
|
||||
s32 j = 0;
|
||||
s32 i = 0;
|
||||
UNUSED s32 pad[2];
|
||||
|
||||
func_8028FB80(&a[i], b[j].unk0, b[j].unk1, b[j].unk2);
|
||||
func_8028FB80(&a[i], b[j].index, b[j].speed, b[j].point);
|
||||
i += 1;
|
||||
|
||||
do {
|
||||
do {
|
||||
func_8028FB80(&a[i], b[j].unk0, b[j].unk1, b[j].unk2);
|
||||
func_8028FB80(&a[i], b[j].index, b[j].speed, b[j].point);
|
||||
i += 1;
|
||||
j += 1;
|
||||
} while ((b[j].unk0 != -1) && (b[j].unk0 != -1)); //! same comparison performed twice
|
||||
} while ((b[j].index != -1) && (b[j].index != -1)); //! same comparison performed twice
|
||||
} while (j > 16);
|
||||
|
||||
func_8028FB80(&a[i], 0, b[j].unk1, b[j].unk2);
|
||||
func_8028FB80(&a[i + 1], 0, 0, b[j].unk2);
|
||||
func_8028FB80(&a[i + 2], 0, 0, b[j].unk2);
|
||||
func_8028FB80(&a[i + 3], -1, 0, b[j].unk2);
|
||||
func_8028FB80(&a[i], 0, b[j].speed, b[j].point);
|
||||
func_8028FB80(&a[i + 1], 0, 0, b[j].point);
|
||||
func_8028FB80(&a[i + 2], 0, 0, b[j].point);
|
||||
func_8028FB80(&a[i + 3], -1, 0, b[j].point);
|
||||
}
|
||||
|
||||
s16 func_8028FD94(s32 a) {
|
||||
@@ -5666,6 +5708,7 @@ static void unused_8028FE50(UNUSED struct LevelCamera *a) {
|
||||
gCutsceneTimer = func_8028FD94(2);
|
||||
}
|
||||
|
||||
// Lower the volume and start the peach letter background music
|
||||
CmdRet CutsceneIntroPeach0_2(UNUSED struct LevelCamera *a) {
|
||||
#ifdef VERSION_US
|
||||
func_8031FFB4(0, 60, 40);
|
||||
@@ -5865,8 +5908,8 @@ CmdRet CutscenePeachEndCommon367A(UNUSED struct LevelCamera *c) {
|
||||
}
|
||||
|
||||
CmdRet CutscenePeachEnd3_1(struct LevelCamera *c) {
|
||||
func_80287CFC(c->pos, D_8032E040, &D_8033B6E0, &D_8033B6E4);
|
||||
func_80287CFC(c->focus, D_8032E090, &D_8033B6E0, &D_8033B6E4);
|
||||
move_point_along_spline(c->pos, D_8032E040, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
move_point_along_spline(c->focus, D_8032E090, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
}
|
||||
|
||||
CmdRet CutscenePeachEnd3(struct LevelCamera *c) {
|
||||
@@ -5876,8 +5919,8 @@ CmdRet CutscenePeachEnd3(struct LevelCamera *c) {
|
||||
}
|
||||
|
||||
CmdRet CutscenePeachEnd1(struct LevelCamera *c) {
|
||||
vec3f_set(c->focus, D_8032E090[0].unk2[0], D_8032E090[0].unk2[1] + 80.f, D_8032E090[0].unk2[2]);
|
||||
vec3f_set(c->pos, D_8032E040[0].unk2[0], D_8032E040[0].unk2[1], D_8032E040[0].unk2[2] + 150.f);
|
||||
vec3f_set(c->focus, D_8032E090[0].point[0], D_8032E090[0].point[1] + 80.f, D_8032E090[0].point[2]);
|
||||
vec3f_set(c->pos, D_8032E040[0].point[0], D_8032E040[0].point[1], D_8032E040[0].point[2] + 150.f);
|
||||
move_credits_camera(c, -0x800, 0x2000, -0x2000, 0x2000);
|
||||
}
|
||||
|
||||
@@ -5900,7 +5943,7 @@ CmdRet CutscenePeachEnd5_1(UNUSED struct LevelCamera *c) {
|
||||
}
|
||||
|
||||
CmdRet CutscenePeachEnd5_2(struct LevelCamera *c) {
|
||||
func_80287CFC(c->pos, D_8032E0E8, &D_8033B6E0, &D_8033B6E4);
|
||||
move_point_along_spline(c->pos, D_8032E0E8, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
c->pos[1] += gCutsceneFocus->oPosY + D_8033B6F0[3].unk4[1];
|
||||
}
|
||||
|
||||
@@ -5911,7 +5954,7 @@ CmdRet CutscenePeachEnd5_3(UNUSED struct LevelCamera *c) {
|
||||
CmdRet CutscenePeachEnd5_4(struct LevelCamera *c) {
|
||||
Vec3f sp1C;
|
||||
|
||||
func_80287CFC(sp1C, D_8032E0E8, &D_8033B6E0, &D_8033B6E4);
|
||||
move_point_along_spline(sp1C, D_8032E0E8, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
c->pos[0] = sp1C[0];
|
||||
c->pos[2] = sp1C[2];
|
||||
approach_f32_exponential_bool(&c->pos[1], (sp1C[1] += gCutsceneFocus->oPosY), 0.07f);
|
||||
@@ -5929,21 +5972,21 @@ CmdRet CutscenePeachEnd5(struct LevelCamera *c) {
|
||||
|
||||
CmdRet CutscenePeachEnd6(struct LevelCamera *c) {
|
||||
call_cutscene_func_in_time_range(CutscenePeachEndCommon367A, c, 0, 0);
|
||||
func_80287CFC(c->pos, D_8032E188, &D_8033B6E0, &D_8033B6E4);
|
||||
func_80287CFC(c->focus, D_8032E1D0, &D_8033B6E0, &D_8033B6E4);
|
||||
move_point_along_spline(c->pos, D_8032E188, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
move_point_along_spline(c->focus, D_8032E1D0, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
move_credits_camera(c, -0x2000, 0x2000, -0x2000, 0x2000);
|
||||
}
|
||||
|
||||
CmdRet CutscenePeachEnd7_1(UNUSED struct LevelCamera *c) {
|
||||
func_80287CFC(c->focus, D_8032E218, &D_8033B6E0, &D_8033B6E4);
|
||||
move_point_along_spline(c->focus, D_8032E218, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
}
|
||||
|
||||
CmdRet CutscenePeachEnd7(struct LevelCamera *c) {
|
||||
call_cutscene_func_in_time_range(CutscenePeachEndCommon367A, c, 0, 0);
|
||||
call_cutscene_func_in_time_range(CutscenePeachEnd7_1, c, 0, 0);
|
||||
call_cutscene_func_in_time_range(CutscenePeachEnd7_1, c, 250, -1);
|
||||
func_80299C60(7, 300);
|
||||
func_80299C60(9, 340);
|
||||
set_cutscene_phase_at_frame(7, 300);
|
||||
set_cutscene_phase_at_frame(9, 340);
|
||||
vec3f_set(c->pos, -163.f, 978.f, -1082.f);
|
||||
move_credits_camera(c, -0x800, 0x2000, -0x2000, 0x2000);
|
||||
}
|
||||
@@ -5978,7 +6021,7 @@ CmdRet CutscenePeachEnd9(struct LevelCamera *c) {
|
||||
}
|
||||
|
||||
CmdRet CutscenePeachEndA_1(struct LevelCamera *c) {
|
||||
func_80287CFC(c->focus, D_8032E258, &D_8033B6E0, &D_8033B6E4);
|
||||
move_point_along_spline(c->focus, D_8032E258, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
vec3f_set(c->pos, 699.f, 1680.f, -703.f);
|
||||
}
|
||||
|
||||
@@ -5991,10 +6034,10 @@ CmdRet CutscenePeachEndA(struct LevelCamera *c) {
|
||||
call_cutscene_func_in_time_range(CutscenePeachEndA_1, c, 0, 0);
|
||||
call_cutscene_func_in_time_range(CutscenePeachEndA_2, c, 0, 499);
|
||||
call_cutscene_func_in_time_range(CutscenePeachEndA_1, c, 500, -1);
|
||||
func_80299C60(8, 600);
|
||||
func_80299C60(8, 608);
|
||||
func_80299C60(8, 624);
|
||||
func_80299C60(8, 710);
|
||||
set_cutscene_phase_at_frame(8, 600);
|
||||
set_cutscene_phase_at_frame(8, 608);
|
||||
set_cutscene_phase_at_frame(8, 624);
|
||||
set_cutscene_phase_at_frame(8, 710);
|
||||
}
|
||||
|
||||
CmdRet CutscenePeachEndB(struct LevelCamera *c) {
|
||||
@@ -6520,7 +6563,7 @@ CmdRet CutsceneEnterBowserPlatform2(struct LevelCamera *c) {
|
||||
}
|
||||
|
||||
CmdRet CutsceneEnterBowserPlatform0(struct LevelCamera *c) {
|
||||
func_80299C60(2, 0);
|
||||
set_cutscene_phase_at_frame(2, 0);
|
||||
|
||||
if (gSecondCameraFocus != NULL) {
|
||||
call_cutscene_func_in_time_range(CutsceneEnterBowserPlatform0_1, c, 0, -1);
|
||||
@@ -7495,22 +7538,35 @@ CmdRet CutsceneUnlockKeyDoor0(UNUSED struct LevelCamera *c) {
|
||||
call_cutscene_func_in_time_range(CutsceneUnlockKeyDoor0_6, c, 112, 112);
|
||||
}
|
||||
|
||||
s32 func_80296DDC(struct LevelCamera *a, struct CinematicCameraTable b[],
|
||||
struct CinematicCameraTable c[]) {
|
||||
Vec3f sp24;
|
||||
s32 sp20 = 0;
|
||||
s32 sp1C = 0;
|
||||
/**
|
||||
* Move the camera along `positionSpline` and point its focus at the corresponding point along
|
||||
* `focusSpline`. sCutsceneSplineSegmentProgress is updated after pos and focus are calculated.
|
||||
*/
|
||||
s32 intro_peach_move_camera_start_to_pipe(struct LevelCamera *c, struct CutsceneSplinePoint positionSpline[],
|
||||
struct CutsceneSplinePoint focusSpline[]) {
|
||||
Vec3f offset;
|
||||
s32 posReturn = 0;
|
||||
s32 focusReturn = 0;
|
||||
|
||||
sp20 = func_80287CFC(a->pos, b, &D_8033B6E0, &D_8033B6E4);
|
||||
sp1C = func_80287CFC(a->focus, c, &D_8033B6E0, &D_8033B6E4);
|
||||
rotate_in_xz(a->focus, a->focus, -0x8000);
|
||||
rotate_in_xz(a->pos, a->pos, -0x8000);
|
||||
/**
|
||||
* The position spline's speed parameters are all 0, so sCutsceneSplineSegmentProgress doesn't get
|
||||
* updated. Otherwise position would move two frames ahead, and c->focus would always be one frame
|
||||
* further along the spline than c->pos.
|
||||
*/
|
||||
posReturn = move_point_along_spline(c->pos, positionSpline, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
focusReturn = move_point_along_spline(c->focus, focusSpline, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
|
||||
vec3f_set(sp24, -1328.f, 260.f, 4664.f);
|
||||
vec3f_add(a->focus, sp24);
|
||||
vec3f_add(a->pos, sp24);
|
||||
sp20 += sp1C;
|
||||
return sp1C;
|
||||
// The two splines used by this function are reflected in the horizontal plane for some reason,
|
||||
// so they are rotated every frame. Why do this, Nintendo?
|
||||
rotate_in_xz(c->focus, c->focus, -0x8000);
|
||||
rotate_in_xz(c->pos, c->pos, -0x8000);
|
||||
|
||||
vec3f_set(offset, -1328.f, 260.f, 4664.f);
|
||||
vec3f_add(c->focus, offset);
|
||||
vec3f_add(c->pos, offset);
|
||||
|
||||
posReturn += focusReturn; // Unused
|
||||
return focusReturn;
|
||||
}
|
||||
|
||||
CmdRet peach_letter_text(UNUSED struct LevelCamera *c) {
|
||||
@@ -7524,7 +7580,7 @@ CmdRet play_sound_peach_reading_letter(UNUSED struct LevelCamera *c) {
|
||||
#endif
|
||||
|
||||
CmdRet CutsceneIntroPeachCommon(struct LevelCamera *c) {
|
||||
if (func_80296DDC(c, D_8032DDF0, D_8032DEA8) != 0) {
|
||||
if (intro_peach_move_camera_start_to_pipe(c, sIntroStartToPipePosition, sIntroStartToPipeFocus) != 0) {
|
||||
gCameraMovementFlags &= ~CAM_MOVE_C_UP_MODE;
|
||||
gCutsceneTimer = 0x7FFF;
|
||||
}
|
||||
@@ -7541,8 +7597,8 @@ CmdRet CutsceneIntroPeach4(struct LevelCamera *c) {
|
||||
}
|
||||
|
||||
CmdRet CutsceneIntroPeach3_2(struct LevelCamera *c) {
|
||||
func_80287CFC(c->pos, D_8032DF60, &D_8033B6E0, &D_8033B6E4);
|
||||
func_80287CFC(c->focus, D_8032DFD0, &D_8033B6E0, &D_8033B6E4);
|
||||
move_point_along_spline(c->pos, sIntroPipeToDialogPosition, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
move_point_along_spline(c->focus, sIntroPipeToDialogFocus, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
}
|
||||
|
||||
CmdRet CutsceneIntroPeach2_2(UNUSED struct LevelCamera *c) {
|
||||
@@ -7555,8 +7611,8 @@ CmdRet CutsceneIntroPeach0_1(UNUSED struct LevelCamera *c) {
|
||||
}
|
||||
|
||||
CmdRet CutsceneIntroPeach3_1(UNUSED struct LevelCamera *c) {
|
||||
D_8033B6E0 = 0;
|
||||
D_8033B6E4 = 0.1f;
|
||||
sCutsceneSplineSegment = 0;
|
||||
sCutsceneSplineSegmentProgress = 0.1f;
|
||||
set_spline_values(4);
|
||||
}
|
||||
|
||||
@@ -7578,7 +7634,7 @@ CmdRet CutsceneIntroPeach2(struct LevelCamera *c) {
|
||||
#ifndef VERSION_JP
|
||||
call_cutscene_func_in_time_range(play_sound_intro_turn_on_hud, c, 818, 818);
|
||||
#endif
|
||||
func_80299C60(6, 1);
|
||||
set_cutscene_phase_at_frame(6, 1);
|
||||
call_cutscene_func_in_time_range(CutsceneIntroPeach2_1, c, 0, 0);
|
||||
call_cutscene_func_in_time_range(CutsceneIntroPeachCommon, c, 0, -1);
|
||||
call_cutscene_func_in_time_range(CutsceneIntroPeach2_2, c, 717, 717);
|
||||
@@ -7600,6 +7656,7 @@ CmdRet CutsceneIntroPeach3(struct LevelCamera *c) {
|
||||
+ (sMarioStatusForCamera->pos[1] - sGeometryForMario.currFloorHeight) * 1.1f,
|
||||
0.4f);
|
||||
|
||||
// Make the camera look up as mario jumps out of the pipe
|
||||
if (c->focus[1] < D_8033B6F0[1].unk4[1]) {
|
||||
c->focus[1] = D_8033B6F0[1].unk4[1];
|
||||
}
|
||||
@@ -7612,7 +7669,7 @@ CmdRet CutsceneIntroPeach1(UNUSED struct LevelCamera *c) {
|
||||
}
|
||||
|
||||
CmdRet CutsceneIntroPeach0(struct LevelCamera *c) {
|
||||
func_80299C60(5, 0);
|
||||
set_cutscene_phase_at_frame(5, 0);
|
||||
call_cutscene_func_in_time_range(CutsceneIntroPeach0_1, c, 0, 0);
|
||||
call_cutscene_func_in_time_range(CutsceneIntroPeach0_2, c, 65, 65);
|
||||
#ifdef VERSION_EU
|
||||
@@ -7636,7 +7693,7 @@ CmdRet CutsceneEndWaving0_1(UNUSED struct LevelCamera *c) {
|
||||
}
|
||||
|
||||
// 3rd part of data
|
||||
struct CinematicCameraTable D_8032E2B4[35] = {
|
||||
struct CutsceneSplinePoint gIntroLakituStartToPipeFocus[35] = {
|
||||
{ 0, 32, { 58, -250, 346 } }, { 1, 50, { -159, -382, 224 } }, { 2, 37, { 0, -277, 237 } },
|
||||
{ 3, 15, { 1, -44, 245 } }, { 4, 35, { 0, -89, 228 } }, { 5, 15, { 28, 3, 259 } },
|
||||
{ 6, 25, { -38, -201, 371 } }, { 7, 20, { -642, 118, 652 } }, { 8, 25, { 103, -90, 861 } },
|
||||
@@ -7651,7 +7708,7 @@ struct CinematicCameraTable D_8032E2B4[35] = {
|
||||
{ 0, 15, { -227, 511, 1550 } }, { -1, 15, { -227, 511, 1600 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032E3CC[35] = {
|
||||
struct CutsceneSplinePoint gIntroLakituStartToPipeOffsetFromCamera[35] = {
|
||||
{ 0, 0, { -46, 87, -15 } }, { 1, 0, { -38, 91, -11 } }, { 2, 0, { -31, 93, -13 } },
|
||||
{ 3, 0, { -50, 84, -16 } }, { 4, 0, { -52, 83, -17 } }, { 5, 0, { -10, 99, 3 } },
|
||||
{ 6, 0, { -54, 83, -10 } }, { 7, 0, { -31, 85, -40 } }, { 8, 0, { -34, 91, 19 } },
|
||||
@@ -7666,13 +7723,13 @@ struct CinematicCameraTable D_8032E3CC[35] = {
|
||||
{ 33, 0, { 51, -11, 84 } }, { -1, 0, { 51, -11, 84 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032E4E4[9] = {
|
||||
struct CutsceneSplinePoint D_8032E4E4[9] = {
|
||||
{ 0, 0, { -5, 975, -917 } }, { 0, 0, { -5, 975, -917 } }, { 0, 0, { -5, 975, -917 } },
|
||||
{ 0, 0, { -76, 1067, 742 } }, { 0, 0, { -105, 1576, 3240 } }, { 0, 0, { -177, 1709, 5586 } },
|
||||
{ 0, 0, { -177, 1709, 5586 } }, { 0, 0, { -177, 1709, 5586 } }, { 0, 0, { -177, 1709, 5586 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable D_8032E52C[9] = {
|
||||
struct CutsceneSplinePoint D_8032E52C[9] = {
|
||||
{ 0, 50, { 18, 1013, -1415 } }, { 0, 100, { 17, 1037, -1412 } }, { 0, 100, { 16, 1061, -1408 } },
|
||||
{ 0, 100, { -54, 1053, 243 } }, { 0, 100, { -84, 1575, 2740 } }, { 0, 50, { -156, 1718, 5086 } },
|
||||
{ 0, 0, { -156, 1718, 5086 } }, { 0, 0, { -156, 1718, 5086 } }, { 0, 0, { -156, 1718, 5086 } }
|
||||
@@ -7680,58 +7737,58 @@ struct CinematicCameraTable D_8032E52C[9] = {
|
||||
|
||||
CmdRet CutsceneEndWaving0(struct LevelCamera *c) {
|
||||
call_cutscene_func_in_time_range(CutsceneEndWaving0_1, c, 0, 0);
|
||||
func_80287CFC(c->pos, D_8032E4E4, &D_8033B6E0, &D_8033B6E4);
|
||||
func_80287CFC(c->focus, D_8032E52C, &D_8033B6E0, &D_8033B6E4);
|
||||
func_80299C60(6, 120);
|
||||
move_point_along_spline(c->pos, D_8032E4E4, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
move_point_along_spline(c->focus, D_8032E52C, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
set_cutscene_phase_at_frame(6, 120);
|
||||
}
|
||||
|
||||
CmdRet CutsceneCredits0_1(UNUSED struct LevelCamera *c) {
|
||||
func_8028FABC();
|
||||
}
|
||||
|
||||
extern struct CinematicCameraTable sBobCreditsCameraPositions[5];
|
||||
extern struct CinematicCameraTable sBobCreditsCameraFocus[5];
|
||||
extern struct CinematicCameraTable sWfCreditsCameraPositions[5];
|
||||
extern struct CinematicCameraTable sWfCreditsCameraFocus[5];
|
||||
extern struct CinematicCameraTable sJrbCreditsCameraPositions[5];
|
||||
extern struct CinematicCameraTable sJrbCreditsCameraFocus[5];
|
||||
extern struct CinematicCameraTable sCcmSlideCreditsCameraPositions[5];
|
||||
extern struct CinematicCameraTable sCcmSlideCreditsCameraFocus[5];
|
||||
extern struct CinematicCameraTable sBbhCreditsCameraPositions[4];
|
||||
extern struct CinematicCameraTable sBbhCreditsCameraFocus[4];
|
||||
extern struct CinematicCameraTable sHmcCreditsCameraPositions[5];
|
||||
extern struct CinematicCameraTable sHmcCreditsCameraFocus[5];
|
||||
extern struct CinematicCameraTable sThiWigglerCreditsCameraPositions[3];
|
||||
extern struct CinematicCameraTable sThiWigglerCreditsCameraFocus[3];
|
||||
extern struct CinematicCameraTable sVolcanoCreditsCameraPositions[6];
|
||||
extern struct CinematicCameraTable sVolcanoCreditsCameraFocus[6];
|
||||
extern struct CinematicCameraTable sSslCreditsCameraPositions[6];
|
||||
extern struct CinematicCameraTable sSslCreditsCameraFocus[6];
|
||||
extern struct CinematicCameraTable sDddCreditsCameraPositions[7];
|
||||
extern struct CinematicCameraTable sDddCreditsCameraFocus[7];
|
||||
extern struct CinematicCameraTable sSlCreditsCameraPositions[4];
|
||||
extern struct CinematicCameraTable sSlCreditsCameraFocus[4];
|
||||
extern struct CinematicCameraTable sWdwCreditsCameraPositions[4];
|
||||
extern struct CinematicCameraTable sWdwCreditsCameraFocus[4];
|
||||
extern struct CinematicCameraTable sTtmCreditsCameraPositions[6];
|
||||
extern struct CinematicCameraTable sTtmCreditsCameraFocus[6];
|
||||
extern struct CinematicCameraTable sThiHugeCreditsCameraPositions[7];
|
||||
extern struct CinematicCameraTable sThiHugeCreditsCameraFocus[7];
|
||||
extern struct CinematicCameraTable sTtcCreditsCameraPositions[4];
|
||||
extern struct CinematicCameraTable sTtcCreditsCameraFocus[4];
|
||||
extern struct CinematicCameraTable sRrCreditsCameraPositions[4];
|
||||
extern struct CinematicCameraTable sRrCreditsCameraFocus[4];
|
||||
extern struct CinematicCameraTable sSaCreditsCameraPositions[5];
|
||||
extern struct CinematicCameraTable sSaCreditsCameraFocus[5];
|
||||
extern struct CinematicCameraTable sCotmcCreditsCameraPositions[5];
|
||||
extern struct CinematicCameraTable sCotmcCreditsCameraFocus[5];
|
||||
extern struct CinematicCameraTable sDddSubCreditsCameraPositions[5];
|
||||
extern struct CinematicCameraTable sDddSubCreditsCameraFocus[5];
|
||||
extern struct CinematicCameraTable sCcmOutsideCreditsCameraPositions[4];
|
||||
extern struct CinematicCameraTable sCcmOutsideCreditsCameraFocus[4];
|
||||
extern struct CutsceneSplinePoint sBobCreditsCameraPositions[5];
|
||||
extern struct CutsceneSplinePoint sBobCreditsCameraFocus[5];
|
||||
extern struct CutsceneSplinePoint sWfCreditsCameraPositions[5];
|
||||
extern struct CutsceneSplinePoint sWfCreditsCameraFocus[5];
|
||||
extern struct CutsceneSplinePoint sJrbCreditsCameraPositions[5];
|
||||
extern struct CutsceneSplinePoint sJrbCreditsCameraFocus[5];
|
||||
extern struct CutsceneSplinePoint sCcmSlideCreditsCameraPositions[5];
|
||||
extern struct CutsceneSplinePoint sCcmSlideCreditsCameraFocus[5];
|
||||
extern struct CutsceneSplinePoint sBbhCreditsCameraPositions[4];
|
||||
extern struct CutsceneSplinePoint sBbhCreditsCameraFocus[4];
|
||||
extern struct CutsceneSplinePoint sHmcCreditsCameraPositions[5];
|
||||
extern struct CutsceneSplinePoint sHmcCreditsCameraFocus[5];
|
||||
extern struct CutsceneSplinePoint sThiWigglerCreditsCameraPositions[3];
|
||||
extern struct CutsceneSplinePoint sThiWigglerCreditsCameraFocus[3];
|
||||
extern struct CutsceneSplinePoint sVolcanoCreditsCameraPositions[6];
|
||||
extern struct CutsceneSplinePoint sVolcanoCreditsCameraFocus[6];
|
||||
extern struct CutsceneSplinePoint sSslCreditsCameraPositions[6];
|
||||
extern struct CutsceneSplinePoint sSslCreditsCameraFocus[6];
|
||||
extern struct CutsceneSplinePoint sDddCreditsCameraPositions[7];
|
||||
extern struct CutsceneSplinePoint sDddCreditsCameraFocus[7];
|
||||
extern struct CutsceneSplinePoint sSlCreditsCameraPositions[4];
|
||||
extern struct CutsceneSplinePoint sSlCreditsCameraFocus[4];
|
||||
extern struct CutsceneSplinePoint sWdwCreditsCameraPositions[4];
|
||||
extern struct CutsceneSplinePoint sWdwCreditsCameraFocus[4];
|
||||
extern struct CutsceneSplinePoint sTtmCreditsCameraPositions[6];
|
||||
extern struct CutsceneSplinePoint sTtmCreditsCameraFocus[6];
|
||||
extern struct CutsceneSplinePoint sThiHugeCreditsCameraPositions[7];
|
||||
extern struct CutsceneSplinePoint sThiHugeCreditsCameraFocus[7];
|
||||
extern struct CutsceneSplinePoint sTtcCreditsCameraPositions[4];
|
||||
extern struct CutsceneSplinePoint sTtcCreditsCameraFocus[4];
|
||||
extern struct CutsceneSplinePoint sRrCreditsCameraPositions[4];
|
||||
extern struct CutsceneSplinePoint sRrCreditsCameraFocus[4];
|
||||
extern struct CutsceneSplinePoint sSaCreditsCameraPositions[5];
|
||||
extern struct CutsceneSplinePoint sSaCreditsCameraFocus[5];
|
||||
extern struct CutsceneSplinePoint sCotmcCreditsCameraPositions[5];
|
||||
extern struct CutsceneSplinePoint sCotmcCreditsCameraFocus[5];
|
||||
extern struct CutsceneSplinePoint sDddSubCreditsCameraPositions[5];
|
||||
extern struct CutsceneSplinePoint sDddSubCreditsCameraFocus[5];
|
||||
extern struct CutsceneSplinePoint sCcmOutsideCreditsCameraPositions[4];
|
||||
extern struct CutsceneSplinePoint sCcmOutsideCreditsCameraFocus[4];
|
||||
|
||||
CmdRet CutsceneCredits0(struct LevelCamera *c) {
|
||||
struct CinematicCameraTable *focus, *pos;
|
||||
struct CutsceneSplinePoint *focus, *pos;
|
||||
|
||||
call_cutscene_func_in_time_range(CutsceneCredits0_1, c, 0, 0);
|
||||
|
||||
@@ -7782,8 +7839,8 @@ CmdRet CutsceneCredits0(struct LevelCamera *c) {
|
||||
|
||||
func_8028FBD8(D_8033B4E0, pos);
|
||||
func_8028FBD8(D_8033B5E0, focus);
|
||||
func_80287CFC(c->pos, D_8033B4E0, &D_8033B6E0, &D_8033B6E4);
|
||||
func_80287CFC(c->focus, D_8033B5E0, &D_8033B6E0, &D_8033B6E4);
|
||||
move_point_along_spline(c->pos, D_8033B4E0, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
move_point_along_spline(c->focus, D_8033B5E0, &sCutsceneSplineSegment, &sCutsceneSplineSegmentProgress);
|
||||
move_credits_camera(c, -0x2000, 0x2000, -0x4000, 0x4000);
|
||||
}
|
||||
|
||||
@@ -8317,226 +8374,226 @@ u8 D_8032E8A4[27][4] = {
|
||||
u8 D_8032E910[20] = { 0x00, 0x00, 0x10, 0x00, 0x11, 0x11, 0x30, 0x10, 0x11, 0x10,
|
||||
0x10, 0x01, 0x01, 0x00, 0x10, 0x11, 0x10, 0x01, 0x01, 0x00 };
|
||||
|
||||
struct CinematicCameraTable sBobCreditsCameraPositions[5] = { { 1, 0, { 5984, 3255, 4975 } },
|
||||
struct CutsceneSplinePoint sBobCreditsCameraPositions[5] = { { 1, 0, { 5984, 3255, 4975 } },
|
||||
{ 2, 0, { 4423, 3315, 1888 } },
|
||||
{ 3, 0, { 776, 2740, -1825 } },
|
||||
{ 4, 0, { -146, 3894, -3167 } },
|
||||
{ -1, 0, { 741, 4387, -5474 } } };
|
||||
|
||||
struct CinematicCameraTable sBobCreditsCameraFocus[5] = { { 0, 30, { 5817, 3306, 4507 } },
|
||||
struct CutsceneSplinePoint sBobCreditsCameraFocus[5] = { { 0, 30, { 5817, 3306, 4507 } },
|
||||
{ 0, 40, { 4025, 3378, 1593 } },
|
||||
{ 0, 50, { 1088, 2652, -2205 } },
|
||||
{ 0, 60, { 205, 3959, -3517 } },
|
||||
{ -1, 60, { 1231, 4400, -5649 } } };
|
||||
|
||||
struct CinematicCameraTable sWfCreditsCameraPositions[5] = { { 0, 0, { -301, 1399, 2643 } },
|
||||
struct CutsceneSplinePoint sWfCreditsCameraPositions[5] = { { 0, 0, { -301, 1399, 2643 } },
|
||||
{ 0, 0, { -182, 2374, 4572 } },
|
||||
{ 0, 0, { 4696, 3864, 413 } },
|
||||
{ 0, 0, { 1738, 4891, -1516 } },
|
||||
{ -1, 0, { 1783, 4891, -1516 } } };
|
||||
|
||||
struct CinematicCameraTable sWfCreditsCameraFocus[5] = { { 1, 30, { -249, 1484, 2153 } },
|
||||
struct CutsceneSplinePoint sWfCreditsCameraFocus[5] = { { 1, 30, { -249, 1484, 2153 } },
|
||||
{ 2, 40, { -200, 2470, 4082 } },
|
||||
{ 3, 40, { 4200, 3916, 370 } },
|
||||
{ 4, 40, { 1523, 4976, -1072 } },
|
||||
{ -1, 40, { 1523, 4976, -1072 } } };
|
||||
|
||||
struct CinematicCameraTable sJrbCreditsCameraPositions[5] = { { 0, 0, { 5538, -4272, 2376 } },
|
||||
struct CutsceneSplinePoint sJrbCreditsCameraPositions[5] = { { 0, 0, { 5538, -4272, 2376 } },
|
||||
{ 0, 0, { 5997, -3303, 2261 } },
|
||||
{ 0, 0, { 6345, -3255, 2179 } },
|
||||
{ 0, 0, { 6345, -3255, 2179 } },
|
||||
{ -1, 0, { 6694, -3203, 2116 } } };
|
||||
|
||||
struct CinematicCameraTable sJrbCreditsCameraFocus[5] = { { 0, 50, { 5261, -4683, 2443 } },
|
||||
struct CutsceneSplinePoint sJrbCreditsCameraFocus[5] = { { 0, 50, { 5261, -4683, 2443 } },
|
||||
{ 0, 50, { 5726, -3675, 2456 } },
|
||||
{ 0, 50, { 6268, -2817, 2409 } },
|
||||
{ 0, 50, { 6596, -2866, 2369 } },
|
||||
{ -1, 50, { 7186, -3153, 2041 } } };
|
||||
|
||||
struct CinematicCameraTable sCcmSlideCreditsCameraPositions[5] = { { 0, 0, { -6324, 6745, -5626 } },
|
||||
struct CutsceneSplinePoint sCcmSlideCreditsCameraPositions[5] = { { 0, 0, { -6324, 6745, -5626 } },
|
||||
{ 1, 0, { -6324, 6745, -5626 } },
|
||||
{ 2, 0, { -6108, 6762, -5770 } },
|
||||
{ 3, 0, { -5771, 6787, -5962 } },
|
||||
{ -1, 0, { -5672, 6790, -5979 } } };
|
||||
|
||||
struct CinematicCameraTable sCcmSlideCreditsCameraFocus[5] = { { 0, 50, { -5911, 6758, -5908 } },
|
||||
struct CutsceneSplinePoint sCcmSlideCreditsCameraFocus[5] = { { 0, 50, { -5911, 6758, -5908 } },
|
||||
{ 1, 50, { -5911, 6758, -5908 } },
|
||||
{ 2, 50, { -5652, 6814, -5968 } },
|
||||
{ 3, 50, { -5277, 6801, -6043 } },
|
||||
{ -1, 50, { -5179, 6804, -6060 } } };
|
||||
|
||||
struct CinematicCameraTable sBbhCreditsCameraPositions[4] = { { 1, 0, { 1088, 341, 2447 } },
|
||||
struct CutsceneSplinePoint sBbhCreditsCameraPositions[4] = { { 1, 0, { 1088, 341, 2447 } },
|
||||
{ 2, 0, { 1338, 610, 2808 } },
|
||||
{ 3, 0, { 2267, 1612, 2966 } },
|
||||
{ -1, 0, { 2296, 1913, 2990 } } };
|
||||
|
||||
struct CinematicCameraTable sBbhCreditsCameraFocus[4] = { { 1, 50, { 1160, 263, 1958 } },
|
||||
struct CutsceneSplinePoint sBbhCreditsCameraFocus[4] = { { 1, 50, { 1160, 263, 1958 } },
|
||||
{ 2, 50, { 1034, 472, 2436 } },
|
||||
{ 3, 50, { 1915, 1833, 2688 } },
|
||||
{ -1, 50, { 2134, 2316, 2742 } } };
|
||||
|
||||
struct CinematicCameraTable sHmcCreditsCameraPositions[5] = { { 1, 0, { -5952, 1807, -5882 } },
|
||||
struct CutsceneSplinePoint sHmcCreditsCameraPositions[5] = { { 1, 0, { -5952, 1807, -5882 } },
|
||||
{ 2, 0, { -5623, 1749, -4863 } },
|
||||
{ 3, 0, { -5472, 1955, -2520 } },
|
||||
{ 4, 0, { -5544, 1187, -1085 } },
|
||||
{ -1, 0, { -5547, 391, -721 } } };
|
||||
|
||||
struct CinematicCameraTable sHmcCreditsCameraFocus[5] = { { 1, 210, { -5952, 1884, -6376 } },
|
||||
struct CutsceneSplinePoint sHmcCreditsCameraFocus[5] = { { 1, 210, { -5952, 1884, -6376 } },
|
||||
{ 2, 58, { -5891, 1711, -5283 } },
|
||||
{ 3, 30, { -5595, 1699, -2108 } },
|
||||
{ 4, 31, { -5546, 794, -777 } },
|
||||
{ -1, 31, { -5548, -85, -572 } } };
|
||||
|
||||
struct CinematicCameraTable sThiWigglerCreditsCameraPositions[3] = { { 1, 0, { -1411, 2474, -1276 } },
|
||||
struct CutsceneSplinePoint sThiWigglerCreditsCameraPositions[3] = { { 1, 0, { -1411, 2474, -1276 } },
|
||||
{ 2, 0, { -1606, 2479, -434 } },
|
||||
{ -1, 0, { -1170, 2122, 1337 } } };
|
||||
|
||||
struct CinematicCameraTable sThiWigglerCreditsCameraFocus[3] = { { 1, 50, { -1053, 2512, -928 } },
|
||||
struct CutsceneSplinePoint sThiWigglerCreditsCameraFocus[3] = { { 1, 50, { -1053, 2512, -928 } },
|
||||
{ 2, 50, { -1234, 2377, -114 } },
|
||||
{ -1, 50, { -758, 2147, 1054 } } };
|
||||
|
||||
struct CinematicCameraTable sVolcanoCreditsCameraPositions[6] = {
|
||||
struct CutsceneSplinePoint sVolcanoCreditsCameraPositions[6] = {
|
||||
{ 0, 0, { -1445, 1094, 1617 } }, { 0, 0, { -1509, 649, 871 } }, { 0, 0, { -1133, 420, -248 } },
|
||||
{ 0, 0, { -778, 359, -1052 } }, { 0, 0, { -565, 260, -1730 } }, { -1, 0, { 1274, 473, -275 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sVolcanoCreditsCameraFocus[6] = {
|
||||
struct CutsceneSplinePoint sVolcanoCreditsCameraFocus[6] = {
|
||||
{ 0, 50, { -1500, 757, 1251 } }, { 0, 50, { -1401, 439, 431 } }, { 0, 50, { -749, 270, -532 } },
|
||||
{ 0, 50, { -396, 270, -1363 } }, { 0, 50, { -321, 143, -2151 } }, { -1, 50, { 1002, 460, -694 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sSslCreditsCameraPositions[6] = {
|
||||
struct CutsceneSplinePoint sSslCreditsCameraPositions[6] = {
|
||||
{ 0, 0, { -4262, 4658, -5015 } }, { 0, 0, { -3274, 2963, -4661 } }, { 0, 0, { -2568, 812, -6528 } },
|
||||
{ 0, 0, { -414, 660, -7232 } }, { 0, 0, { 1466, 660, -6898 } }, { -1, 0, { 2724, 660, -6298 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sSslCreditsCameraFocus[6] = {
|
||||
struct CutsceneSplinePoint sSslCreditsCameraFocus[6] = {
|
||||
{ 0, 50, { -4083, 4277, -4745 } }, { 0, 50, { -2975, 2574, -4759 } },
|
||||
{ 0, 50, { -2343, 736, -6088 } }, { 0, 50, { -535, 572, -6755 } },
|
||||
{ 0, 50, { 1311, 597, -6427 } }, { -1, 50, { 2448, 612, -5884 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sDddCreditsCameraPositions[7] = {
|
||||
struct CutsceneSplinePoint sDddCreditsCameraPositions[7] = {
|
||||
{ 0, 0, { -874, -4933, 366 } }, { 0, 0, { -1463, -4782, 963 } }, { 0, 0, { -1893, -4684, 1303 } },
|
||||
{ 0, 0, { -2818, -4503, 1583 } }, { 0, 0, { -4095, -2924, 730 } }, { 0, 0, { -4737, -1594, -63 } },
|
||||
{ -1, 0, { -4681, -1084, -623 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sDddCreditsCameraFocus[7] = {
|
||||
struct CutsceneSplinePoint sDddCreditsCameraFocus[7] = {
|
||||
{ 0, 50, { -1276, -4683, 622 } }, { 0, 50, { -1858, -4407, 1097 } },
|
||||
{ 0, 50, { -2324, -4332, 1318 } }, { 0, 50, { -3138, -4048, 1434 } },
|
||||
{ 0, 50, { -4353, -2444, 533 } }, { 0, 50, { -4807, -1169, -436 } },
|
||||
{ -1, 50, { -4665, -664, -1007 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sSlCreditsCameraPositions[4] = { { 0, 0, { 939, 6654, 6196 } },
|
||||
struct CutsceneSplinePoint sSlCreditsCameraPositions[4] = { { 0, 0, { 939, 6654, 6196 } },
|
||||
{ 0, 0, { 1873, 5160, 3714 } },
|
||||
{ 0, 0, { 3120, 3564, 1314 } },
|
||||
{ -1, 0, { 2881, 4231, 573 } } };
|
||||
|
||||
struct CinematicCameraTable sSlCreditsCameraFocus[4] = { { 0, 50, { 875, 6411, 5763 } },
|
||||
struct CutsceneSplinePoint sSlCreditsCameraFocus[4] = { { 0, 50, { 875, 6411, 5763 } },
|
||||
{ 0, 50, { 1659, 4951, 3313 } },
|
||||
{ 0, 50, { 2630, 3565, 1215 } },
|
||||
{ -1, 50, { 2417, 4056, 639 } } };
|
||||
|
||||
struct CinematicCameraTable sWdwCreditsCameraPositions[4] = { { 0, 0, { 3927, 2573, 3685 } },
|
||||
struct CutsceneSplinePoint sWdwCreditsCameraPositions[4] = { { 0, 0, { 3927, 2573, 3685 } },
|
||||
{ 0, 0, { 2389, 2054, 1210 } },
|
||||
{ 0, 0, { 2309, 2069, 22 } },
|
||||
{ -1, 0, { 2122, 2271, -979 } } };
|
||||
|
||||
struct CinematicCameraTable sWdwCreditsCameraFocus[4] = { { 0, 50, { 3637, 2460, 3294 } },
|
||||
struct CutsceneSplinePoint sWdwCreditsCameraFocus[4] = { { 0, 50, { 3637, 2460, 3294 } },
|
||||
{ 0, 50, { 1984, 2067, 918 } },
|
||||
{ 0, 50, { 1941, 2255, -261 } },
|
||||
{ -1, 50, { 1779, 2587, -1158 } } };
|
||||
|
||||
struct CinematicCameraTable sTtmCreditsCameraPositions[6] = {
|
||||
struct CutsceneSplinePoint sTtmCreditsCameraPositions[6] = {
|
||||
{ 0, 0, { 386, 2535, 644 } }, { 0, 0, { 1105, 2576, 918 } }, { 0, 0, { 3565, 2261, 2098 } },
|
||||
{ 0, 0, { 6715, -2791, 4554 } }, { 0, 0, { 3917, -3130, 3656 } }, { -1, 0, { 3917, -3130, 3656 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sTtmCreditsCameraFocus[6] = {
|
||||
struct CutsceneSplinePoint sTtmCreditsCameraFocus[6] = {
|
||||
{ 1, 50, { 751, 2434, 318 } }, { 2, 50, { 768, 2382, 603 } },
|
||||
{ 3, 60, { 3115, 2086, 1969 } }, { 4, 30, { 6370, -3108, 4727 } },
|
||||
{ 5, 50, { 4172, -3385, 4001 } }, { -1, 50, { 4172, -3385, 4001 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sThiHugeCreditsCameraPositions[7] = {
|
||||
struct CutsceneSplinePoint sThiHugeCreditsCameraPositions[7] = {
|
||||
{ 0, 0, { 6990, -1000, -4858 } }, { 0, 0, { 7886, -1055, 2878 } }, { 0, 0, { 1952, -1481, 10920 } },
|
||||
{ 0, 0, { -1684, -219, 2819 } }, { 0, 0, { -2427, -131, 2755 } }, { 0, 0, { -3246, 416, 3286 } },
|
||||
{ -1, 0, { -3246, 416, 3286 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sThiHugeCreditsCameraFocus[7] = {
|
||||
struct CutsceneSplinePoint sThiHugeCreditsCameraFocus[7] = {
|
||||
{ 1, 70, { 7022, -965, -5356 } }, { 2, 40, { 7799, -915, 2405 } },
|
||||
{ 3, 60, { 1878, -1137, 10568 } }, { 4, 50, { -1931, -308, 2394 } },
|
||||
{ 5, 50, { -2066, -386, 2521 } }, { 6, 50, { -2875, 182, 3045 } },
|
||||
{ -1, 50, { -2875, 182, 3045 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sTtcCreditsCameraPositions[4] = { { 1, 0, { -1724, 277, -994 } },
|
||||
struct CutsceneSplinePoint sTtcCreditsCameraPositions[4] = { { 1, 0, { -1724, 277, -994 } },
|
||||
{ 2, 0, { -1720, 456, -995 } },
|
||||
{ 3, 0, { -1655, 810, -1014 } },
|
||||
{ -1, 0, { -1753, 883, -1009 } } };
|
||||
|
||||
struct CinematicCameraTable sTtcCreditsCameraFocus[4] = { { 1, 50, { -1554, 742, -1063 } },
|
||||
struct CutsceneSplinePoint sTtcCreditsCameraFocus[4] = { { 1, 50, { -1554, 742, -1063 } },
|
||||
{ 2, 50, { -1245, 571, -1102 } },
|
||||
{ 3, 50, { -1220, 603, -1151 } },
|
||||
{ -1, 50, { -1412, 520, -1053 } } };
|
||||
|
||||
struct CinematicCameraTable sRrCreditsCameraPositions[4] = { { 0, 0, { -1818, 4036, 97 } },
|
||||
struct CutsceneSplinePoint sRrCreditsCameraPositions[4] = { { 0, 0, { -1818, 4036, 97 } },
|
||||
{ 0, 0, { -575, 3460, -505 } },
|
||||
{ 0, 0, { 1191, 3611, -1134 } },
|
||||
{ -1, 0, { 2701, 3777, -3686 } } };
|
||||
|
||||
struct CinematicCameraTable sRrCreditsCameraFocus[4] = { { 0, 50, { -1376, 3885, -81 } },
|
||||
struct CutsceneSplinePoint sRrCreditsCameraFocus[4] = { { 0, 50, { -1376, 3885, -81 } },
|
||||
{ 0, 50, { -146, 3343, -734 } },
|
||||
{ 0, 50, { 1570, 3446, -1415 } },
|
||||
{ -1, 50, { 2794, 3627, -3218 } } };
|
||||
|
||||
struct CinematicCameraTable sSaCreditsCameraPositions[5] = { { 0, 0, { -295, -396, -585 } },
|
||||
struct CutsceneSplinePoint sSaCreditsCameraPositions[5] = { { 0, 0, { -295, -396, -585 } },
|
||||
{ 1, 0, { -295, -396, -585 } },
|
||||
{ 2, 0, { -292, -856, -573 } },
|
||||
{ 3, 0, { -312, -856, -541 } },
|
||||
{ -1, 0, { 175, -856, -654 } } };
|
||||
|
||||
struct CinematicCameraTable sSaCreditsCameraFocus[5] = { { 0, 50, { -175, -594, -142 } },
|
||||
struct CutsceneSplinePoint sSaCreditsCameraFocus[5] = { { 0, 50, { -175, -594, -142 } },
|
||||
{ 1, 50, { -175, -594, -142 } },
|
||||
{ 2, 50, { -195, -956, -92 } },
|
||||
{ 3, 50, { -572, -956, -150 } },
|
||||
{ -1, 50, { -307, -956, -537 } } };
|
||||
|
||||
struct CinematicCameraTable sCotmcCreditsCameraPositions[5] = { { 0, 0, { -296, 495, 1607 } },
|
||||
struct CutsceneSplinePoint sCotmcCreditsCameraPositions[5] = { { 0, 0, { -296, 495, 1607 } },
|
||||
{ 0, 0, { -430, 541, 654 } },
|
||||
{ 0, 0, { -466, 601, -359 } },
|
||||
{ 0, 0, { -217, 433, -1549 } },
|
||||
{ -1, 0, { -95, 366, -2922 } } };
|
||||
|
||||
struct CinematicCameraTable sCotmcCreditsCameraFocus[5] = { { 0, 50, { -176, 483, 2092 } },
|
||||
struct CutsceneSplinePoint sCotmcCreditsCameraFocus[5] = { { 0, 50, { -176, 483, 2092 } },
|
||||
{ 0, 50, { -122, 392, 1019 } },
|
||||
{ 0, 50, { -268, 450, -792 } },
|
||||
{ 0, 50, { -172, 399, -2046 } },
|
||||
{ -1, 50, { -51, 355, -3420 } } };
|
||||
|
||||
struct CinematicCameraTable sDddSubCreditsCameraPositions[5] = { { 0, 0, { 4656, 2171, 5028 } },
|
||||
struct CutsceneSplinePoint sDddSubCreditsCameraPositions[5] = { { 0, 0, { 4656, 2171, 5028 } },
|
||||
{ 0, 0, { 4548, 1182, 4596 } },
|
||||
{ 0, 0, { 5007, 813, 3257 } },
|
||||
{ 0, 0, { 5681, 648, 1060 } },
|
||||
{ -1, 0, { 4644, 774, 113 } } };
|
||||
|
||||
struct CinematicCameraTable sDddSubCreditsCameraFocus[5] = { { 0, 50, { 4512, 2183, 4549 } },
|
||||
struct CutsceneSplinePoint sDddSubCreditsCameraFocus[5] = { { 0, 50, { 4512, 2183, 4549 } },
|
||||
{ 0, 50, { 4327, 838, 4308 } },
|
||||
{ 0, 50, { 4774, 749, 2819 } },
|
||||
{ 0, 50, { 5279, 660, 763 } },
|
||||
{ -1, 50, { 4194, 885, -75 } } };
|
||||
|
||||
struct CinematicCameraTable sCcmOutsideCreditsCameraPositions[4] = {
|
||||
struct CutsceneSplinePoint sCcmOutsideCreditsCameraPositions[4] = {
|
||||
{ 1, 0, { 1427, -1387, 5409 } },
|
||||
{ 2, 0, { -1646, -1536, 4526 } },
|
||||
{ 3, 0, { -3852, -1448, 3913 } },
|
||||
{ -1, 0, { -5199, -1366, 1886 } }
|
||||
};
|
||||
|
||||
struct CinematicCameraTable sCcmOutsideCreditsCameraFocus[4] = { { 1, 50, { 958, -1481, 5262 } },
|
||||
struct CutsceneSplinePoint sCcmOutsideCreditsCameraFocus[4] = { { 1, 50, { 958, -1481, 5262 } },
|
||||
{ 2, 50, { -2123, -1600, 4391 } },
|
||||
{ 3, 50, { -3957, -1401, 3426 } },
|
||||
{ -1, 50, { -4730, -1215, 1795 } } };
|
||||
@@ -8639,9 +8696,9 @@ s32 call_cutscene_func_in_time_range(CameraCommandProc func, struct LevelCamera
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 func_80299C60(s32 a, s16 b) {
|
||||
if (b == gCutsceneTimer) {
|
||||
sCutscenePhase = a;
|
||||
s32 set_cutscene_phase_at_frame(s32 phase, s16 frame) {
|
||||
if (frame == gCutsceneTimer) {
|
||||
sCutscenePhase = phase;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -8667,12 +8724,12 @@ void func_80299D00(s16 a, s16 b, s16 c, f32 d, f32 e, f32 f, f32 g) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_80299DB4(struct GraphNodeCamera *a) {
|
||||
void func_80299DB4(struct GraphNodePerspective *a) {
|
||||
if (D_8033B230.unk10 != 0.f) {
|
||||
D_8033B230.unk8 = coss(D_8033B230.unk14) * D_8033B230.unk10 / 256;
|
||||
D_8033B230.unk14 += D_8033B230.unk16;
|
||||
camera_approach_f32_symmetric_bool(&D_8033B230.unk10, 0.f, D_8033B230.unk18);
|
||||
a->from[0] += D_8033B230.unk8;
|
||||
a->fov += D_8033B230.unk8;
|
||||
} else {
|
||||
D_8033B230.unk14 = 0;
|
||||
}
|
||||
@@ -8764,8 +8821,8 @@ void func_8029A288(struct MarioState *m) {
|
||||
D_8033B230.fieldOfView = approach_f32(D_8033B230.fieldOfView, targetFoV, 2.f, 2.f);
|
||||
}
|
||||
|
||||
s32 geo_camera_fov(s32 a, struct GraphNodeCamera *b, UNUSED struct AllocOnlyPool *c) {
|
||||
struct GraphNodeCamera *sp24 = b;
|
||||
Gfx *geo_camera_fov(s32 a, struct GraphNode *b, UNUSED struct AllocOnlyPool *c) {
|
||||
struct GraphNodePerspective *sp24 = (struct GraphNodePerspective *) b;
|
||||
struct MarioState *marioState = &gMarioStates[0];
|
||||
u8 sp1F = D_8033B230.unk0;
|
||||
|
||||
@@ -8807,9 +8864,9 @@ s32 geo_camera_fov(s32 a, struct GraphNodeCamera *b, UNUSED struct AllocOnlyPool
|
||||
}
|
||||
}
|
||||
|
||||
sp24->from[0] = D_8033B230.fieldOfView;
|
||||
sp24->fov = D_8033B230.fieldOfView;
|
||||
func_80299DB4(sp24);
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void set_fov_function(u8 a) {
|
||||
|
||||
+20
-9
@@ -4,6 +4,7 @@
|
||||
#include "types.h"
|
||||
#include "area.h"
|
||||
#include "engine/geo_layout.h"
|
||||
#include "engine/graph_node.h"
|
||||
|
||||
#define ABS(x) ((x) > 0.f ? (x) : -(x))
|
||||
#define ABS2(x) ((x) >= 0.f ? (x) : -(x))
|
||||
@@ -215,8 +216,8 @@ struct Struct8033B2B8
|
||||
// Camera command procedures are marked as returning s32, but none of them
|
||||
// actually return a value. This causes undefined behavior, which we'd rather
|
||||
// avoid on modern GCC. Hence, typedef. Interestingly, the void vs s32
|
||||
// difference doesn't affect -g, only -O2.
|
||||
#ifdef __GNUC__
|
||||
// difference doesn't affect -g codegen, only -O2.
|
||||
#if BUGFIXES_CRITICAL
|
||||
typedef void CmdRet;
|
||||
#else
|
||||
typedef s32 CmdRet;
|
||||
@@ -255,12 +256,19 @@ struct Struct8033B230
|
||||
/*0x18*/ s16 unk18;
|
||||
};
|
||||
|
||||
struct CinematicCameraTable
|
||||
/**
|
||||
* Information for a control point in a spline segment.
|
||||
*/
|
||||
struct CutsceneSplinePoint
|
||||
{
|
||||
/*0x00*/ s8 unk0;
|
||||
/*0x01*/ u8 unk1;
|
||||
/*0x02*/ Vec3s unk2;
|
||||
}; // size = 0x08
|
||||
/* The index of this point in the spline. Ignored except for -1, which ends the spline.
|
||||
An index of -1 should come four points after the start of the last segment. */
|
||||
s8 index;
|
||||
/* Roughly controls the number of frames it takes to progress through the spline segment.
|
||||
See move_point_along_spline() in camera.c */
|
||||
u8 speed;
|
||||
Vec3s point;
|
||||
};
|
||||
|
||||
struct PlayerGeometry
|
||||
{
|
||||
@@ -395,12 +403,13 @@ extern void update_camera(struct LevelCamera *);
|
||||
extern void reset_camera(struct LevelCamera *);
|
||||
extern void init_camera(struct LevelCamera *);
|
||||
extern void select_mario_cam_mode(void);
|
||||
extern Gfx *geo_camera_preset_and_pos(s32 a, struct GraphNode *b, struct AllocOnlyPool *c);
|
||||
extern void dummy_802877D8(struct LevelCamera *);
|
||||
extern void dummy_802877EC(struct LevelCamera *);
|
||||
extern void vec3f_sub(Vec3f, Vec3f);
|
||||
extern void object_pos_to_vec3f(Vec3f, struct Object *);
|
||||
extern void vec3f_to_object_pos(struct Object *, Vec3f); // static (ASM)
|
||||
extern s32 func_80287CFC(Vec3f, struct CinematicCameraTable[], s16 *, f32 *);
|
||||
extern s32 move_point_along_spline(Vec3f, struct CutsceneSplinePoint[], s16 *, f32 *);
|
||||
extern s32 select_or_activate_mario_cam(s32 angle);
|
||||
extern s32 test_or_set_mario_cam_active(s32);
|
||||
extern void set_spline_values(u8);
|
||||
@@ -831,7 +840,7 @@ extern s16 cutscene_object(u8, struct Object *);
|
||||
// extern ? CutsceneDoorAB_2(?);
|
||||
extern void handle_cutscenes(struct LevelCamera *);
|
||||
extern s32 call_cutscene_func_in_time_range(CameraCommandProc, struct LevelCamera *, s16, s16);
|
||||
extern s32 func_80299C60(s32, s16);
|
||||
extern s32 set_cutscene_phase_at_frame(s32 phase, s16 frame);
|
||||
extern void func_80299C98(s16, s16, s16);
|
||||
// extern ? func_80299D00(?);
|
||||
|
||||
@@ -852,4 +861,6 @@ extern void func_8029A7DC(struct Object *, Vec3f, s16, s16, s16, s16);
|
||||
// extern ? func_8029B964(?);
|
||||
// extern ? bhv_intro_scene_loop(?);
|
||||
|
||||
extern Gfx *geo_camera_fov(s32 a, struct GraphNode *b, UNUSED struct AllocOnlyPool *c);
|
||||
|
||||
#endif /* _CAMERA_H */
|
||||
|
||||
+3
-6
@@ -12,6 +12,7 @@
|
||||
#include "debug.h"
|
||||
#include "object_list_processor.h"
|
||||
#include "room.h"
|
||||
#include "behavior_data.h"
|
||||
|
||||
#define DEBUG_INFO_NOFLAGS (0 << 0)
|
||||
#define DEBUG_INFO_FLAG_DPRINT (1 << 0)
|
||||
@@ -30,10 +31,6 @@ enum DebugPrintStateInfo {
|
||||
DEBUG_PSTATE_LINE_Y_OFFSET
|
||||
};
|
||||
|
||||
extern u8 bhvKoopaShell[];
|
||||
extern u8 bhvJumpingBox[];
|
||||
extern u8 bhvKoopaShellUnderwater[];
|
||||
|
||||
// DEBUG_SYS_EFFECTINFO
|
||||
const char *sDebugEffectStringInfo[] = {
|
||||
" a0 %d", " a1 %d", " a2 %d", " a3 %d", " a4 %d", " a5 %d", " a6 %d", " a7 %d",
|
||||
@@ -79,13 +76,13 @@ void Stub802C98C0(void) {
|
||||
* its difference for consecutive calls.
|
||||
*/
|
||||
s64 get_current_clock(void) {
|
||||
u64 wtf = 0;
|
||||
s64 wtf = 0;
|
||||
|
||||
return wtf;
|
||||
}
|
||||
|
||||
s64 get_clock_difference(UNUSED s64 arg0) {
|
||||
u64 wtf = 0;
|
||||
s64 wtf = 0;
|
||||
|
||||
return wtf;
|
||||
}
|
||||
|
||||
@@ -22,5 +22,7 @@ extern void debug_unknown_level_select_check(void);
|
||||
extern void reset_debug_objectinfo(void);
|
||||
extern void stub_802CA5D0(void);
|
||||
extern void try_print_debug_mario_object_info(void);
|
||||
extern void try_do_mario_debug_object_spawn(void);
|
||||
extern void try_print_debug_mario_level_info(void);
|
||||
|
||||
#endif /* _DEBUG_H */
|
||||
|
||||
+16
-15
@@ -1,12 +1,13 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "sm64.h"
|
||||
#include "audio/external.h"
|
||||
#include "buffers/buffers.h"
|
||||
#include "buffers/gfx_output_buffer.h"
|
||||
#include "game.h"
|
||||
#include "main.h"
|
||||
#include "memory.h"
|
||||
#include "profiler.h"
|
||||
#include "buffers/buffers.h"
|
||||
#include "audio/external.h"
|
||||
#include "display.h"
|
||||
|
||||
int unused8032C690 = 0;
|
||||
@@ -25,7 +26,7 @@ void my_rdp_init(void) {
|
||||
gDPPipelineMode(gDisplayListHead++, G_PM_1PRIMITIVE);
|
||||
|
||||
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
gDPSetCombine(gDisplayListHead++, 0xFFFFFF, 0xFFFE793C);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
|
||||
|
||||
gDPSetTextureLOD(gDisplayListHead++, G_TL_TILE);
|
||||
gDPSetTextureLUT(gDisplayListHead++, G_TT_NONE);
|
||||
@@ -50,13 +51,12 @@ void my_rdp_init(void) {
|
||||
*/
|
||||
void my_rsp_init(void) {
|
||||
gSPClearGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH | G_CULL_BOTH | G_FOG
|
||||
| G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR
|
||||
| G_LOD);
|
||||
| G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD);
|
||||
|
||||
gSPSetGeometryMode(gDisplayListHead++, G_SHADE | G_SHADING_SMOOTH | G_CULL_BACK | G_LIGHTING);
|
||||
|
||||
gSPNumLights(gDisplayListHead++, 1);
|
||||
gSPTexture(gDisplayListHead++, 0, 0, 0, 0, 0);
|
||||
gSPTexture(gDisplayListHead++, 0, 0, 0, G_TX_RENDERTILE, G_OFF);
|
||||
|
||||
// @bug Nintendo did not explicitly define the clipping ratio.
|
||||
// For Fast3DEX2, this causes the dreaded warped vertices issue
|
||||
@@ -72,11 +72,11 @@ void clear_z_buffer(void) {
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
|
||||
gDPSetDepthSource(gDisplayListHead++, G_ZS_PIXEL);
|
||||
gDPSetDepthImage(gDisplayListHead++, zBufferPtr);
|
||||
gDPSetDepthImage(gDisplayListHead++, gPhysicalZBuffer);
|
||||
|
||||
gDPSetColorImage(gDisplayListHead++, G_IM_FMT_RGBA, 2, SCREEN_WIDTH, zBufferPtr);
|
||||
gDPSetColorImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, gPhysicalZBuffer);
|
||||
gDPSetFillColor(gDisplayListHead++,
|
||||
GPACK_RGBA5551(255, 255, 240, 0) << 16 | GPACK_RGBA5551(255, 255, 240, 0));
|
||||
GPACK_ZDZ(G_MAXFBZ, 0) << 16 | GPACK_ZDZ(G_MAXFBZ, 0));
|
||||
|
||||
gDPFillRectangle(gDisplayListHead++, 0, BORDER_HEIGHT, SCREEN_WIDTH - 1,
|
||||
SCREEN_HEIGHT - 1 - BORDER_HEIGHT);
|
||||
@@ -87,8 +87,8 @@ void display_frame_buffer(void) {
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE);
|
||||
gDPSetColorImage(gDisplayListHead++, G_IM_FMT_RGBA, 2, SCREEN_WIDTH,
|
||||
gFrameBuffers[frameBufferIndex]);
|
||||
gDPSetColorImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH,
|
||||
gPhysicalFrameBuffers[frameBufferIndex]);
|
||||
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, BORDER_HEIGHT, SCREEN_WIDTH,
|
||||
SCREEN_HEIGHT - BORDER_HEIGHT);
|
||||
}
|
||||
@@ -175,8 +175,9 @@ void create_task_structure(void) {
|
||||
gGfxSPTask->task.t.ucode_data_size = SP_UCODE_DATA_SIZE;
|
||||
gGfxSPTask->task.t.dram_stack = (u64 *) gGfxSPTaskStack;
|
||||
gGfxSPTask->task.t.dram_stack_size = SP_DRAM_STACK_SIZE8;
|
||||
gGfxSPTask->task.t.output_buff = (u64 *) gGfxSPTaskOutputBuffer;
|
||||
gGfxSPTask->task.t.output_buff_size = (u64 *) (gGfxSPTaskOutputBuffer + 0x1F000);
|
||||
gGfxSPTask->task.t.output_buff = gGfxSPTaskOutputBuffer;
|
||||
gGfxSPTask->task.t.output_buff_size =
|
||||
(u64 *)((u8 *) gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer));
|
||||
gGfxSPTask->task.t.data_ptr = (u64 *) &gGfxPool->buffer;
|
||||
gGfxSPTask->task.t.data_size = entries * sizeof(Gfx);
|
||||
gGfxSPTask->task.t.yield_data_ptr = (u64 *) gGfxSPTaskYieldBuffer;
|
||||
@@ -218,7 +219,7 @@ void func_80247D84(void) {
|
||||
fbNum = sCurrFBNum - 1;
|
||||
}
|
||||
|
||||
sp18 = (u64 *) PHYSICAL_TO_VIRTUAL(gFrameBuffers[fbNum]);
|
||||
sp18 = (u64 *) PHYSICAL_TO_VIRTUAL(gPhysicalFrameBuffers[fbNum]);
|
||||
sp18 += D_8032C648++ * (SCREEN_WIDTH / 4);
|
||||
|
||||
for (sp24 = 0; sp24 < ((SCREEN_HEIGHT / 16) + 1); sp24++) {
|
||||
@@ -268,7 +269,7 @@ void display_and_vsync(void) {
|
||||
send_display_list(&gGfxPool->spTask);
|
||||
profiler_log_thread5_time(AFTER_DISPLAY_LISTS);
|
||||
osRecvMesg(&gGameVblankQueue, &D_80339BEC, OS_MESG_BLOCK);
|
||||
osViSwapBuffer((void *) PHYSICAL_TO_VIRTUAL(gFrameBuffers[sCurrFBNum]));
|
||||
osViSwapBuffer((void *) PHYSICAL_TO_VIRTUAL(gPhysicalFrameBuffers[sCurrFBNum]));
|
||||
profiler_log_thread5_time(THREAD5_END);
|
||||
osRecvMesg(&gGameVblankQueue, &D_80339BEC, OS_MESG_BLOCK);
|
||||
if (++sCurrFBNum == 3) {
|
||||
|
||||
@@ -11,7 +11,6 @@ struct GfxPool {
|
||||
};
|
||||
|
||||
extern u16 frameBufferIndex;
|
||||
extern u8 gGfxSPTaskOutputBuffer[];
|
||||
extern u32 gGlobalTimer;
|
||||
|
||||
// extern ? my_rdp_init(?);
|
||||
|
||||
+13
-12
@@ -1,18 +1,19 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "sm64.h"
|
||||
#include "audio/external.h"
|
||||
#include "buffers/framebuffers.h"
|
||||
#include "engine/level_script.h"
|
||||
#include "main.h"
|
||||
#include "memory.h"
|
||||
#include "save_file.h"
|
||||
#include "seq_ids.h"
|
||||
#include "sound_init.h"
|
||||
#include "display.h"
|
||||
#include "engine/level_script.h"
|
||||
#include "profiler.h"
|
||||
#include "print.h"
|
||||
#include "segment2.h"
|
||||
#include "main_entry.h"
|
||||
#include "audio/external.h"
|
||||
#include <prevent_bss_reordering.h>
|
||||
#include "game.h"
|
||||
|
||||
@@ -26,8 +27,8 @@ OSMesgQueue D_80339CB8;
|
||||
OSMesg D_80339CD0;
|
||||
OSMesg D_80339CD4;
|
||||
struct VblankHandler gGameVblankHandler;
|
||||
u32 gFrameBuffers[3];
|
||||
u32 zBufferPtr;
|
||||
uintptr_t gPhysicalFrameBuffers[3];
|
||||
uintptr_t gPhysicalZBuffer;
|
||||
void *D_80339CF0;
|
||||
void *D_80339CF4;
|
||||
struct SPTask *gGfxSPTask;
|
||||
@@ -39,7 +40,7 @@ s8 gEepromProbe;
|
||||
|
||||
struct MarioAnimation D_80339D10;
|
||||
struct MarioAnimation gDemo;
|
||||
UNUSED s8 filler80339D30[0x80339DC0 - 0x80339D30];
|
||||
UNUSED u8 filler80339D30[0x90];
|
||||
|
||||
void (*D_8032C6A0)(void) = NULL;
|
||||
struct Controller *gPlayer1Controller = &gControllers[0];
|
||||
@@ -73,10 +74,10 @@ static void record_demo(void) {
|
||||
// record the distinct input and timer so long as they
|
||||
// are unique. If the timer hits 0xFF, reset the timer
|
||||
// for the next demo input.
|
||||
if (gRecordedDemoInput.timer == 0xFF || buttonMask != gRecordedDemoInput.button
|
||||
if (gRecordedDemoInput.timer == 0xFF || buttonMask != gRecordedDemoInput.buttonMask
|
||||
|| rawStickX != gRecordedDemoInput.rawStickX || rawStickY != gRecordedDemoInput.rawStickY) {
|
||||
gRecordedDemoInput.timer = 0;
|
||||
gRecordedDemoInput.button = buttonMask;
|
||||
gRecordedDemoInput.buttonMask = buttonMask;
|
||||
gRecordedDemoInput.rawStickX = rawStickX;
|
||||
gRecordedDemoInput.rawStickY = rawStickY;
|
||||
}
|
||||
@@ -172,7 +173,7 @@ void run_demo_inputs(void) {
|
||||
lower 4 bits to get the correct button mask.
|
||||
*/
|
||||
gControllers[0].controllerData->button =
|
||||
((gCurrDemoInput->button & 0xF0) << 8) + ((gCurrDemoInput->button & 0xF));
|
||||
((gCurrDemoInput->buttonMask & 0xF0) << 8) + ((gCurrDemoInput->buttonMask & 0xF));
|
||||
|
||||
// if start was pushed, put it into the demo sequence being input to
|
||||
// end the demo.
|
||||
@@ -274,10 +275,10 @@ void setup_game_memory(void) {
|
||||
set_segment_base_addr(0, (void *) 0x80000000);
|
||||
osCreateMesgQueue(&D_80339CB8, &D_80339CD4, 1);
|
||||
osCreateMesgQueue(&gGameVblankQueue, &D_80339CD0, 1);
|
||||
zBufferPtr = VIRTUAL_TO_PHYSICAL(gZBuffer);
|
||||
gFrameBuffers[0] = VIRTUAL_TO_PHYSICAL(gFrameBuffer0);
|
||||
gFrameBuffers[1] = VIRTUAL_TO_PHYSICAL(gFrameBuffer1);
|
||||
gFrameBuffers[2] = VIRTUAL_TO_PHYSICAL(gFrameBuffer2);
|
||||
gPhysicalZBuffer = VIRTUAL_TO_PHYSICAL(gZBuffer);
|
||||
gPhysicalFrameBuffers[0] = VIRTUAL_TO_PHYSICAL(gFrameBuffer0);
|
||||
gPhysicalFrameBuffers[1] = VIRTUAL_TO_PHYSICAL(gFrameBuffer1);
|
||||
gPhysicalFrameBuffers[2] = VIRTUAL_TO_PHYSICAL(gFrameBuffer2);
|
||||
D_80339CF0 = main_pool_alloc(0x4000, MEMORY_POOL_LEFT);
|
||||
set_segment_base_addr(17, (void *) D_80339CF0);
|
||||
func_80278A78(&D_80339D10, gMarioAnims, D_80339CF0);
|
||||
|
||||
+6
-8
@@ -5,11 +5,10 @@
|
||||
|
||||
struct DemoInput
|
||||
{
|
||||
u8 timer; // until next input: if this value is 0 proceeding on the demo
|
||||
// input, it means the demo is over.
|
||||
u8 timer; // time until next input. if this value is 0, it means the demo is over
|
||||
s8 rawStickX;
|
||||
s8 rawStickY;
|
||||
u8 button;
|
||||
u8 buttonMask;
|
||||
};
|
||||
|
||||
extern struct Controller gControllers[3];
|
||||
@@ -20,8 +19,8 @@ extern OSMesgQueue D_80339CB8;
|
||||
extern OSMesg D_80339CD0;
|
||||
extern OSMesg D_80339CD4;
|
||||
extern struct VblankHandler gGameVblankHandler;
|
||||
extern u32 gFrameBuffers[3];
|
||||
extern u32 zBufferPtr;
|
||||
extern uintptr_t gPhysicalFrameBuffers[3];
|
||||
extern uintptr_t gPhysicalZBuffer;
|
||||
extern void *D_80339CF0;
|
||||
extern void *D_80339CF4;
|
||||
extern struct SPTask *gGfxSPTask;
|
||||
@@ -47,11 +46,10 @@ extern u16 func_802495B0(u32);
|
||||
// this area is the demo input + the header. when the demo is loaded in, there is a header the size
|
||||
// of a single word next to the input list. this word is the current ID count.
|
||||
extern struct MarioAnimation D_80339D10;
|
||||
extern struct MarioAnimation gDemo; // gDemo
|
||||
extern struct MarioAnimation gDemo;
|
||||
|
||||
extern u8 gZBuffer[];
|
||||
extern u16 gZBuffer[SCREEN_WIDTH * SCREEN_HEIGHT];
|
||||
extern u8 gMarioAnims[];
|
||||
extern u8 gDemoInputs[];
|
||||
extern u8 D_10000000[];
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,6 +43,8 @@ s8 gFlyingCarpetState;
|
||||
/**
|
||||
* Create a vertex with the given parameters and insert it into `vtx` at
|
||||
* position `n`.
|
||||
*
|
||||
* Texture coordinates are s10.5 fixed-point, which means you should left-shift the actual coordinates by 5.
|
||||
*/
|
||||
void make_vertex(Vtx *vtx, s32 n, s16 x, s16 y, s16 z, s16 tx, s16 ty, u8 r, u8 g, u8 b, u8 a) {
|
||||
vtx[n].v.ob[0] = x;
|
||||
|
||||
@@ -16,5 +16,10 @@ extern void make_vertex(
|
||||
Vtx *vtx, s32 n, s16 x, s16 y, s16 z, s16 tx, s16 ty, u8 r, u8 g, u8 b, u8 a
|
||||
);
|
||||
extern s16 round_float(f32);
|
||||
extern Gfx *geo_exec_inside_castle_light(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
||||
extern Gfx *geo_exec_flying_carpet_timer_update(s32 callContext, struct GraphNode *node,
|
||||
f32 mtx[4][4]);
|
||||
extern Gfx *geo_exec_flying_carpet_create(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
||||
extern Gfx *geo_exec_cake_end_screen(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
||||
|
||||
#endif /* _TRANSPARENT_TEXTURE_H */
|
||||
|
||||
+8
-9
@@ -72,17 +72,15 @@ void render_hud_tex_lut(s32 x, s32 y, u8 *texture) {
|
||||
*/
|
||||
void render_hud_small_tex_lut(s32 x, s32 y, u8 *texture) {
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0,
|
||||
(G_TX_NOMIRROR | G_TX_WRAP), G_TX_NOMASK, G_TX_NOLOD, (G_TX_NOMIRROR | G_TX_WRAP),
|
||||
G_TX_NOMASK, G_TX_NOLOD);
|
||||
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPTileSync(gDisplayListHead++);
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 2, 0, G_TX_RENDERTILE, 0,
|
||||
(G_TX_NOMIRROR | G_TX_CLAMP), 3, G_TX_NOLOD, (G_TX_NOMIRROR | G_TX_CLAMP), 3,
|
||||
G_TX_NOLOD);
|
||||
gDPSetTileSize(gDisplayListHead++, G_TX_RENDERTILE, 0, 0, 28, 28);
|
||||
G_TX_CLAMP, 3, G_TX_NOLOD, G_TX_CLAMP, 3, G_TX_NOLOD);
|
||||
gDPSetTileSize(gDisplayListHead++, G_TX_RENDERTILE, 0, 0, (8 - 1) << G_TEXTURE_IMAGE_FRAC, (8 - 1) << G_TEXTURE_IMAGE_FRAC);
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, texture);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 63, 1024);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_16b_BYTES));
|
||||
gSPTextureRectangle(gDisplayListHead++, x << 2, y << 2, (x + 7) << 2, (y + 7) << 2, G_TX_RENDERTILE,
|
||||
0, 0, 4 << 10, 1 << 10);
|
||||
}
|
||||
@@ -99,7 +97,7 @@ void render_power_meter_health_segment(s16 numHealthWedges) {
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1,
|
||||
(*healthLUT)[numHealthWedges - 1]);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 1023, 256);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES));
|
||||
gSP1Triangle(gDisplayListHead++, 0, 1, 2, 0);
|
||||
gSP1Triangle(gDisplayListHead++, 0, 2, 3, 0);
|
||||
}
|
||||
@@ -120,7 +118,7 @@ void render_dl_power_meter(s16 numHealthWedges) {
|
||||
guTranslate(mtx, (f32) sPowerMeterHUD.x, (f32) sPowerMeterHUD.y, 0);
|
||||
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx++),
|
||||
(G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH));
|
||||
G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH);
|
||||
gSPDisplayList(gDisplayListHead++, &dl_power_meter_base);
|
||||
|
||||
if (numHealthWedges != 0) {
|
||||
@@ -440,7 +438,8 @@ void render_hud(void) {
|
||||
create_dl_identity_matrix();
|
||||
guOrtho(mtx, -16.0f, 336.0f, 0, 240.0f, -10.0f, 10.0f, 1.0f);
|
||||
gMoveWd(gDisplayListHead++, 0xE, 0, 0xFFFF);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), 1);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx),
|
||||
G_MTX_PROJECTION | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
|
||||
#else
|
||||
create_dl_ortho_matrix();
|
||||
|
||||
+46
-44
@@ -145,8 +145,8 @@ void create_dl_identity_matrix(void) {
|
||||
matrix->m[2][3] = 0x00000000;
|
||||
matrix->m[3][3] = 0x00000000;
|
||||
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_LOAD);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||
}
|
||||
|
||||
void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z) {
|
||||
@@ -159,10 +159,10 @@ void create_dl_translation_matrix(s8 pushOp, f32 x, f32 y, f32 z) {
|
||||
guTranslate(matrix, x, y, z);
|
||||
|
||||
if (pushOp == MENU_MTX_PUSH)
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_PUSH);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH);
|
||||
|
||||
if (pushOp == MENU_MTX_NOPUSH)
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_NOPUSH);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
}
|
||||
|
||||
void create_dl_rotation_matrix(s8 pushOp, f32 a, f32 x, f32 y, f32 z) {
|
||||
@@ -175,10 +175,10 @@ void create_dl_rotation_matrix(s8 pushOp, f32 a, f32 x, f32 y, f32 z) {
|
||||
guRotate(matrix, a, x, y, z);
|
||||
|
||||
if (pushOp == MENU_MTX_PUSH)
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_PUSH);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH);
|
||||
|
||||
if (pushOp == MENU_MTX_NOPUSH)
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_NOPUSH);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
}
|
||||
|
||||
void create_dl_scale_matrix(s8 pushOp, f32 x, f32 y, f32 z) {
|
||||
@@ -191,10 +191,10 @@ void create_dl_scale_matrix(s8 pushOp, f32 x, f32 y, f32 z) {
|
||||
guScale(matrix, x, y, z);
|
||||
|
||||
if (pushOp == MENU_MTX_PUSH)
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_PUSH);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH);
|
||||
|
||||
if (pushOp == MENU_MTX_NOPUSH)
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_NOPUSH);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
}
|
||||
|
||||
void create_dl_ortho_matrix(void) {
|
||||
@@ -209,9 +209,9 @@ void create_dl_ortho_matrix(void) {
|
||||
guOrtho(matrix, 0.0f, SCREEN_WIDTH, 0.0f, SCREEN_HEIGHT, -10.0f, 10.0f, 1.0f);
|
||||
|
||||
// Should produce G_RDPHALF_1 in Fast3D
|
||||
gSPPerspNormalize((Gfx *) (gDisplayListHead++), 0x0000FFFF);
|
||||
gSPPerspNormalize((Gfx *) (gDisplayListHead++), 0xFFFF);
|
||||
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_PROJECTION)
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(matrix), G_MTX_PROJECTION | G_MTX_MUL | G_MTX_NOPUSH)
|
||||
}
|
||||
|
||||
static u8 *alloc_ia8_text_from_i1(u16 *in, s16 width, s16 height) {
|
||||
@@ -266,7 +266,7 @@ void render_generic_char(u8 c) {
|
||||
#endif
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, VIRTUAL_TO_PHYSICAL(packedTexture));
|
||||
#endif
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_render_char);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_tex_settings);
|
||||
#ifdef VERSION_EU
|
||||
gSPTextureRectangleFlip(gDisplayListHead++, gDialogX << 2, (gDialogY - 16) << 2,
|
||||
(gDialogX + 8) << 2, gDialogY << 2, G_TX_RENDERTILE, 16 << 5, 8 << 5, 1 << 10, 1 << 10);
|
||||
@@ -313,7 +313,7 @@ void render_generic_char_at_pos(s16 xPos, s16 yPos, u8 c) {
|
||||
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, VIRTUAL_TO_PHYSICAL(unpackedTexture));
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_render_char);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_tex_settings);
|
||||
gSPTextureRectangleFlip(gDisplayListHead++, xPos << 2, (yPos - 16) << 2, (xPos + 8) << 2, yPos << 2,
|
||||
G_TX_RENDERTILE, 16 << 5, 8 << 5, 1 << 10, 1 << 10);
|
||||
}
|
||||
@@ -622,12 +622,12 @@ void print_menu_char_umlaut(s16 x, s16 y, u8 chr) {
|
||||
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, fontLUT[chr]);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, 7, 0, 0, (0x40 - 1), 0x800);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_8b_BYTES));
|
||||
gSPTextureRectangle(gDisplayListHead++, x << 2, y << 2, (x + 8) << 2, (y + 8) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, fontLUT[DIALOG_CHAR_UMLAUT]);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, 7, 0, 0, (0x40 - 1), 0x800);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_8b_BYTES));
|
||||
gSPTextureRectangle(gDisplayListHead++, x << 2, (y - 4) << 2, (x + 8) << 2, (y + 4) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
}
|
||||
#endif
|
||||
@@ -668,7 +668,7 @@ void print_menu_generic_string(s16 x, s16 y, const u8 *str) {
|
||||
default:
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, fontLUT[str[strPos]]);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, 7, 0, 0, (0x40 - 1), 0x800);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_8b_BYTES));
|
||||
gSPTextureRectangle(gDisplayListHead++, curX << 2, curY << 2, (curX + 8) << 2,
|
||||
(curY + 8) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
|
||||
@@ -676,7 +676,7 @@ void print_menu_generic_string(s16 x, s16 y, const u8 *str) {
|
||||
if (mark != DIALOG_MARK_NONE) {
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, fontLUT[mark + 0xEF]);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, 7, 0, 0, (0x40 - 1), 0x800);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_8b_BYTES));
|
||||
gSPTextureRectangle(gDisplayListHead++, (curX + 6) << 2, (curY - 7) << 2,
|
||||
(curX + 14) << 2, (curY + 1) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
|
||||
@@ -699,10 +699,12 @@ void print_credits_string(s16 x, s16 y, const u8 *str) {
|
||||
u32 curX = x;
|
||||
u32 curY = y;
|
||||
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0);
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0,
|
||||
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPTileSync(gDisplayListHead++);
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 2, 0, 0, 0, 2, 3, 0, 2, 3, 0);
|
||||
gDPSetTileSize(gDisplayListHead++, 0, 0, 0, (8 - 1) << 2, (8 - 1) << 2);
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 2, 0, G_TX_RENDERTILE, 0,
|
||||
G_TX_CLAMP, 3, G_TX_NOLOD, G_TX_CLAMP, 3, G_TX_NOLOD);
|
||||
gDPSetTileSize(gDisplayListHead++, G_TX_RENDERTILE, 0, 0, (8 - 1) << G_TEXTURE_IMAGE_FRAC, (8 - 1) << G_TEXTURE_IMAGE_FRAC);
|
||||
|
||||
while (str[strPos] != GLOBAR_CHAR_TERMINATOR) {
|
||||
switch (str[strPos]) {
|
||||
@@ -713,7 +715,7 @@ void print_credits_string(s16 x, s16 y, const u8 *str) {
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, fontLUT[str[strPos]]);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, 7, 0, 0, (0x40 - 1), 0x400);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_16b_BYTES));
|
||||
gSPTextureRectangle(gDisplayListHead++, curX << 2, curY << 2, (curX + 8) << 2,
|
||||
(curY + 8) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
curX += 7;
|
||||
@@ -1036,7 +1038,7 @@ void render_generic_dialog_char_at_pos(struct DialogEntry *dialog, s16 x, s16 y,
|
||||
unpackedTexture = alloc_ia4_tex_from_i1(packedTexture, 8, 8);
|
||||
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, VIRTUAL_TO_PHYSICAL(unpackedTexture));
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_render_char);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_tex_settings);
|
||||
gSPTextureRectangleFlip(gDisplayListHead++, xCoord << 2, (yCoord - height) << 2,
|
||||
(xCoord + width) << 2, yCoord << 2, G_TX_RENDERTILE, 16 << 5, 8 << 5, 1 << 10, 1 << 10);
|
||||
}
|
||||
@@ -1245,7 +1247,7 @@ void handle_dialog_text_and_pages(s8 colorMode, struct DialogEntry *dialog, s8 l
|
||||
totalLines = linesPerBox + 1;
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
strIdx = gDialogTextPos;
|
||||
#ifdef VERSION_EU
|
||||
gDialogX = 0;
|
||||
@@ -1464,7 +1466,7 @@ void handle_dialog_text_and_pages(s8 colorMode, struct DialogEntry *dialog, s8 l
|
||||
|
||||
strIdx++;
|
||||
}
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
|
||||
if (gDialogBoxState == DIALOG_STATE_VERTICAL) {
|
||||
if (pageState == DIALOG_PAGE_STATE_END) {
|
||||
@@ -1929,7 +1931,7 @@ void do_cutscene_handler(void) {
|
||||
|
||||
create_dl_ortho_matrix();
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gCutsceneMsgFade);
|
||||
|
||||
#ifdef VERSION_EU
|
||||
@@ -1954,7 +1956,7 @@ void do_cutscene_handler(void) {
|
||||
print_generic_string(x, 240 - gCutsceneMsgYOffset, gEndCutsceneStringsEn[gCutsceneMsgIndex]);
|
||||
#endif
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
|
||||
// if the timing variable is less than 5, increment
|
||||
// the fade until we are at full opacity.
|
||||
@@ -2032,16 +2034,16 @@ void print_peach_letter_message(void) {
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gCutsceneMsgFade);
|
||||
gSPDisplayList(gDisplayListHead++, castle_grounds_seg7_dl_0700EA58);
|
||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 20, 20, 20, gCutsceneMsgFade);
|
||||
|
||||
print_generic_string(STR_X, STR_Y, str);
|
||||
#ifdef VERSION_JP
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
#endif
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
|
||||
#ifndef VERSION_JP
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
gDPSetEnvColor(gDisplayListHead++, 200, 80, 120, gCutsceneMsgFade);
|
||||
gSPDisplayList(gDisplayListHead++, castle_grounds_seg7_us_dl_0700F2E8);
|
||||
#endif
|
||||
@@ -2240,7 +2242,7 @@ void render_pause_my_score_coins(void) {
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||
|
||||
@@ -2286,7 +2288,7 @@ void render_pause_my_score_coins(void) {
|
||||
#else
|
||||
print_generic_string(117, 157, &levelName[3]);
|
||||
#endif
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
}
|
||||
|
||||
#ifdef VERSION_JP
|
||||
@@ -2322,7 +2324,7 @@ void render_pause_camera_options(s16 x, s16 y, s8 *index, s16 xIndex) {
|
||||
|
||||
handle_menu_scrolling(MENU_SCROLL_HORIZONTAL, index, 1, 2);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||
|
||||
print_generic_string(x + 14, y + 2, textLakituMario);
|
||||
@@ -2330,7 +2332,7 @@ void render_pause_camera_options(s16 x, s16 y, s8 *index, s16 xIndex) {
|
||||
print_generic_string(x + 124, y + 2, textLakituStop);
|
||||
print_generic_string(x + TXT2_X, y - 13, textNormalFixed);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
create_dl_translation_matrix(MENU_MTX_PUSH, ((index[0] - 1) * xIndex) + x, y + Y_VAL7, 0);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||
gSPDisplayList(gDisplayListHead++, dl_draw_triangle);
|
||||
@@ -2382,7 +2384,7 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
|
||||
|
||||
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 3);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||
|
||||
print_generic_string(x + 10, y - 2, textContinue);
|
||||
@@ -2390,7 +2392,7 @@ void render_pause_course_options(s16 x, s16 y, s8 *index, s16 yIndex) {
|
||||
|
||||
if (index[0] != 3) {
|
||||
print_generic_string(x + 10, y - 33, textCameraAngleR);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
|
||||
create_dl_translation_matrix(MENU_MTX_PUSH, x - X_VAL8, (y - ((index[0] - 1) * yIndex)) - Y_VAL8, 0);
|
||||
|
||||
@@ -2552,7 +2554,7 @@ void render_pause_castle_main_strings(s16 x, s16 y) {
|
||||
}
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||
|
||||
if (gDialogLineNum < COURSE_STAGES_COUNT) {
|
||||
@@ -2582,7 +2584,7 @@ void render_pause_castle_main_strings(s16 x, s16 y) {
|
||||
print_generic_string(x - 9, y + 30, levelName);
|
||||
#endif
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
}
|
||||
|
||||
s8 gCourseCompleteCoinsEqual = 0;
|
||||
@@ -2850,7 +2852,7 @@ void render_course_complete_lvl_info_and_hud_str(void) {
|
||||
name = segmented_to_virtual(actNameTbl[(gLastCompletedCourseNum - 1) * 6 + gLastCompletedStarNum - 1]);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
int_to_str(gLastCompletedCourseNum, strCourseNum);
|
||||
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, gDialogTextAlpha);
|
||||
print_generic_string(65, 165, textCourse);
|
||||
@@ -2858,10 +2860,10 @@ void render_course_complete_lvl_info_and_hud_str(void) {
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||
print_generic_string(63, 167, textCourse);
|
||||
print_generic_string(CRS_NUM_X3, 167, strCourseNum);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
} else if (gLastCompletedCourseNum == COURSE_BITDW || gLastCompletedCourseNum == COURSE_BITFS) {
|
||||
name = segmented_to_virtual(levelNameTbl[gLastCompletedCourseNum - 1]);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, gDialogTextAlpha);
|
||||
#ifdef VERSION_EU
|
||||
centerX = get_str_x_pos_from_center(153, name, 12.0f);
|
||||
@@ -2875,7 +2877,7 @@ void render_course_complete_lvl_info_and_hud_str(void) {
|
||||
#ifndef VERSION_EU
|
||||
print_generic_string(TXT_CLEAR_X2, 132, textClear);
|
||||
#endif
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
print_hud_course_complete_string(HUD_PRINT_CONGRATULATIONS);
|
||||
print_hud_course_complete_coins(118, 111);
|
||||
play_star_fanfare_and_flash_hud(2, 0); //! 2 isn't defined, originally for key hud?
|
||||
@@ -2890,7 +2892,7 @@ void render_course_complete_lvl_info_and_hud_str(void) {
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, 55, 77, textSymStar);
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, gDialogTextAlpha);
|
||||
print_generic_string(76, 145, name);
|
||||
#ifdef VERSION_JP
|
||||
@@ -2901,7 +2903,7 @@ void render_course_complete_lvl_info_and_hud_str(void) {
|
||||
#ifdef VERSION_JP
|
||||
print_generic_string(218, 147, textCatch);
|
||||
#endif
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
}
|
||||
|
||||
#ifdef VERSION_JP
|
||||
@@ -2957,14 +2959,14 @@ void render_save_confirmation(s16 x, s16 y, s8 *index, s16 sp6e)
|
||||
|
||||
handle_menu_scrolling(MENU_SCROLL_VERTICAL, index, 1, 3);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_begin);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||
|
||||
print_generic_string(TXT_SAVEOPTIONS_X, y + TXT_SAVECONT_Y, textSaveAndContinue);
|
||||
print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_SAVEQUIT_Y, textSaveAndQuit);
|
||||
print_generic_string(TXT_SAVEOPTIONS_X, y - TXT_CONTNOSAVE_Y, textContinueWithoutSave);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia8_text_end);
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
|
||||
create_dl_translation_matrix(MENU_MTX_PUSH, X_VAL9, y - ((index[0] - 1) * sp6e), 0);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ struct DialogEntry
|
||||
/*0x04*/ s8 linesPerBox;
|
||||
/*0x06*/ s16 leftOffset;
|
||||
/*0x08*/ s16 width;
|
||||
/*0x0C*/ u8 *str;
|
||||
/*0x0C*/ const u8 *str;
|
||||
};
|
||||
|
||||
// EU only
|
||||
|
||||
@@ -486,7 +486,7 @@ void bounce_off_object(struct MarioState *m, struct Object *o, f32 velY) {
|
||||
|
||||
m->flags &= ~MARIO_UNKNOWN_08;
|
||||
|
||||
play_sound(SOUND_ACTION_UNKNOWN459, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_BOUNCE_OFF_OBJECT, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
void hit_object_from_below(struct MarioState *m, UNUSED struct Object *o) {
|
||||
@@ -632,7 +632,7 @@ void bounce_back_from_attack(struct MarioState *m, u32 interaction) {
|
||||
}
|
||||
|
||||
if (interaction & (INT_PUNCH | INT_KICK | INT_TRIP | INT_FAST_ATTACK_OR_SHELL)) {
|
||||
play_sound(SOUND_ACTION_UNKNOWN444_2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_HIT_2, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1655,11 +1655,11 @@ void check_kick_or_punch_wall(struct MarioState *m) {
|
||||
}
|
||||
|
||||
mario_set_forward_vel(m, -48.0f);
|
||||
play_sound(SOUND_ACTION_UNKNOWN444_2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_HIT_2, m->marioObj->header.gfx.cameraToObject);
|
||||
m->particleFlags |= 0x00040000;
|
||||
} else if (m->action & ACT_FLAG_AIR) {
|
||||
mario_set_forward_vel(m, -16.0f);
|
||||
play_sound(SOUND_ACTION_UNKNOWN444_2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_HIT_2, m->marioObj->header.gfx.cameraToObject);
|
||||
m->particleFlags |= 0x00040000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ Gfx *geo_enfvx_main(s32 callContext, struct GraphNode *node, f32 c[4][4]) {
|
||||
|
||||
gfx = alloc_display_list(2 * sizeof(*gfx));
|
||||
mtxf_to_mtx(mtx, c);
|
||||
gSPMatrix(&gfx[0], VIRTUAL_TO_PHYSICAL(mtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPMatrix(&gfx[0], VIRTUAL_TO_PHYSICAL(mtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||
gSPBranchList(&gfx[1], VIRTUAL_TO_PHYSICAL(particleList));
|
||||
execNode->fnNode.node.flags = (execNode->fnNode.node.flags & 0xFF) | 0x400;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ Gfx *geo_skybox_main(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx)
|
||||
struct GraphNodePerspective *camFrustum =
|
||||
(struct GraphNodePerspective *) camNode->fnNode.node.parent;
|
||||
|
||||
gfx = func_802CF414(0, backgroundNode->background, camFrustum->fov, gCameraStatus.pos[0],
|
||||
gfx = create_skybox_facing_camera(0, backgroundNode->background, camFrustum->fov, gCameraStatus.pos[0],
|
||||
gCameraStatus.pos[1], gCameraStatus.pos[2], gCameraStatus.focus[0],
|
||||
gCameraStatus.focus[1], gCameraStatus.focus[2]);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ s16 convert_rotation(s16 inRotation) {
|
||||
* parameters filling up the upper 2 bytes of newObj->oBehParams.
|
||||
* The object will not spawn if 'behavior' is NULL.
|
||||
*/
|
||||
void spawn_macro_abs_yrot_2params(u32 model, u32 *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params) {
|
||||
void spawn_macro_abs_yrot_2params(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params) {
|
||||
if (behavior != NULL) {
|
||||
struct Object *newObj = spawn_object_abs_with_rot(
|
||||
&gMacroObjectDefaultParent, 0, model, behavior, x, y, z, 0, convert_rotation(ry), 0);
|
||||
@@ -56,7 +56,7 @@ void spawn_macro_abs_yrot_2params(u32 model, u32 *behavior, s16 x, s16 y, s16 z,
|
||||
* a single parameter filling up the upper byte of newObj->oBehParams.
|
||||
* The object will not spawn if 'behavior' is NULL.
|
||||
*/
|
||||
void spawn_macro_abs_yrot_param1(u32 model, u32 *behavior, s16 x, s16 y, s16 z, s16 ry, s16 param) {
|
||||
void spawn_macro_abs_yrot_param1(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 param) {
|
||||
if (behavior != NULL) {
|
||||
struct Object *newObj = spawn_object_abs_with_rot(
|
||||
&gMacroObjectDefaultParent, 0, model, behavior, x, y, z, 0, convert_rotation(ry), 0);
|
||||
@@ -68,7 +68,7 @@ void spawn_macro_abs_yrot_param1(u32 model, u32 *behavior, s16 x, s16 y, s16 z,
|
||||
* Spawns an object at an absolute location with currently 3 unknown variables that get converted to
|
||||
* floats. Oddly enough, this function doesn't care if 'behavior' is NULL or not.
|
||||
*/
|
||||
void spawn_macro_abs_special(u32 model, u32 *behavior, s16 x, s16 y, s16 z, s16 unkA, s16 unkB,
|
||||
void spawn_macro_abs_special(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 unkA, s16 unkB,
|
||||
s16 unkC) {
|
||||
struct Object *newObj =
|
||||
spawn_object_abs_with_rot(&gMacroObjectDefaultParent, 0, model, behavior, x, y, z, 0, 0, 0);
|
||||
@@ -79,21 +79,21 @@ void spawn_macro_abs_special(u32 model, u32 *behavior, s16 x, s16 y, s16 z, s16
|
||||
newObj->oMacroUnk110 = (f32) unkC;
|
||||
}
|
||||
|
||||
static void Unknown802E142C(u32 (*a0)[], s16 a1[]) {
|
||||
static void Unknown802E142C(const BehaviorScript *behavior, s16 a1[]) {
|
||||
struct Object *sp3C;
|
||||
s16 model;
|
||||
|
||||
model = &bhvYellowCoin == a0 ? MODEL_YELLOW_COIN : MODEL_NONE;
|
||||
model = bhvYellowCoin == behavior ? MODEL_YELLOW_COIN : MODEL_NONE;
|
||||
|
||||
sp3C = spawn_object_abs_with_rot(&gMacroObjectDefaultParent, 0, model, a0, a1[1], a1[2], a1[3], 0,
|
||||
convert_rotation(a1[0]), 0);
|
||||
sp3C = spawn_object_abs_with_rot(&gMacroObjectDefaultParent, 0, model, behavior,
|
||||
a1[1], a1[2], a1[3], 0, convert_rotation(a1[0]), 0);
|
||||
|
||||
sp3C->oUnk1A8 = a1[4];
|
||||
sp3C->oBehParams = (a1[4] & 0xFF) >> 16;
|
||||
}
|
||||
|
||||
struct LoadedPreset {
|
||||
/*0x00*/ u32 *beh;
|
||||
/*0x00*/ const BehaviorScript *beh;
|
||||
/*0x04*/ s16 param; // huh? why does the below function swap these.. just use the struct..
|
||||
/*0x06*/ s16 model;
|
||||
};
|
||||
@@ -253,7 +253,7 @@ void spawn_special_objects(s16 areaIndex, s16 **specialObjList) {
|
||||
u8 type;
|
||||
u8 presetID;
|
||||
u8 defaultParam;
|
||||
u32 *behavior;
|
||||
const BehaviorScript *behavior;
|
||||
|
||||
numOfSpecialObjects = **specialObjList;
|
||||
(*specialObjList)++;
|
||||
|
||||
@@ -9,9 +9,9 @@ extern struct Object gMacroObjectDefaultParent;
|
||||
/* Functions */
|
||||
extern s16 convert_rotation(s16 inRotation);
|
||||
|
||||
extern void spawn_macro_abs_yrot_2params(u32 model, u32 *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params);
|
||||
extern void spawn_macro_abs_yrot_param1(u32 model, u32 *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params);
|
||||
extern void spawn_macro_abs_special(u32 model, u32 *behavior, s16 x, s16 y, s16 z, s16 unkA, s16 unkB, s16 unkC);
|
||||
extern void spawn_macro_abs_yrot_2params(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params);
|
||||
extern void spawn_macro_abs_yrot_param1(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 ry, s16 params);
|
||||
extern void spawn_macro_abs_special(u32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 unkA, s16 unkB, s16 unkC);
|
||||
|
||||
extern void spawn_macro_objects(s16 areaIndex, s16 * macroObjList);
|
||||
extern void spawn_macro_objects_hardcoded(s16 areaIndex, s16 * macroObjList);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <ultra64.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sm64.h"
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "audio/external.h"
|
||||
#include "game.h"
|
||||
#include "memory.h"
|
||||
|
||||
+3
-3
@@ -183,8 +183,8 @@ s16 find_mario_anim_flags_and_translation(struct Object *obj, s32 yaw, Vec3s tra
|
||||
|
||||
struct Animation *curAnim = (void *) obj->header.gfx.unk38.curAnim;
|
||||
s16 animFrame = geo_update_animation_frame(&obj->header.gfx.unk38, NULL);
|
||||
u16 *animIndex = segmented_to_virtual(curAnim->index);
|
||||
s16 *animValues = segmented_to_virtual(curAnim->values);
|
||||
u16 *animIndex = segmented_to_virtual((void *) curAnim->index);
|
||||
s16 *animValues = segmented_to_virtual((void *) curAnim->values);
|
||||
|
||||
f32 s = (f32) sins(yaw);
|
||||
f32 c = (f32) coss(yaw);
|
||||
@@ -289,7 +289,7 @@ void play_sound_and_spawn_particles(struct MarioState *m, u32 soundBits, u32 wav
|
||||
}
|
||||
}
|
||||
|
||||
if ((m->flags & MARIO_METAL_CAP) || soundBits == SOUND_ACTION_UNKNOWN443
|
||||
if ((m->flags & MARIO_METAL_CAP) || soundBits == SOUND_ACTION_UNSTUCK_FROM_GROUND
|
||||
|| soundBits == SOUND_MARIO_PUNCH_HOO) {
|
||||
play_sound(soundBits, m->marioObj->header.gfx.cameraToObject);
|
||||
} else {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
void play_flip_sounds(struct MarioState *m, s16 frame1, s16 frame2, s16 frame3) {
|
||||
s32 animFrame = m->marioObj->header.gfx.unk38.animFrame;
|
||||
if (animFrame == frame1 || animFrame == frame2 || animFrame == frame3) {
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ u32 common_air_action_step(struct MarioState *m, u32 landAction, s32 animation,
|
||||
set_mario_animation(m, animation);
|
||||
|
||||
if (m->forwardVel > 16.0f) {
|
||||
mario_bonk_reflection(m, 0);
|
||||
mario_bonk_reflection(m, FALSE);
|
||||
m->faceAngle[1] += 0x8000;
|
||||
|
||||
if (m->wall != NULL) {
|
||||
@@ -577,9 +577,9 @@ s32 act_side_flip(struct MarioState *m) {
|
||||
}
|
||||
|
||||
// (this need to be on one line to match on PAL)
|
||||
if (m->marioObj->header.gfx.unk38.animFrame == 6) {
|
||||
play_sound(SOUND_ACTION_UNKNOWN45A, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
// clang-format off
|
||||
if (m->marioObj->header.gfx.unk38.animFrame == 6) play_sound(SOUND_ACTION_SIDE_FLIP_UNK, m->marioObj->header.gfx.cameraToObject);
|
||||
// clang-format on
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ s32 act_twirling(struct MarioState *m) {
|
||||
}
|
||||
|
||||
if (startTwirlYaw > m->twirlYaw) {
|
||||
play_sound(SOUND_ACTION_SWISH2_2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_TWIRL, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
update_lava_boost_or_twirling(m);
|
||||
@@ -670,7 +670,7 @@ s32 act_twirling(struct MarioState *m) {
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_WALL:
|
||||
mario_bonk_reflection(m, 0);
|
||||
mario_bonk_reflection(m, FALSE);
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_LAVA_WALL:
|
||||
@@ -684,7 +684,7 @@ s32 act_twirling(struct MarioState *m) {
|
||||
|
||||
s32 act_dive(struct MarioState *m) {
|
||||
if (m->actionArg == 0) {
|
||||
play_mario_sound(m, SOUND_ACTION_UNKNOWN435, SOUND_MARIO_HOOHOO);
|
||||
play_mario_sound(m, SOUND_ACTION_THROW, SOUND_MARIO_HOOHOO);
|
||||
} else {
|
||||
play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, 0);
|
||||
}
|
||||
@@ -731,7 +731,7 @@ s32 act_dive(struct MarioState *m) {
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_WALL:
|
||||
mario_bonk_reflection(m, 1);
|
||||
mario_bonk_reflection(m, TRUE);
|
||||
m->faceAngle[0] = 0;
|
||||
|
||||
if (m->vel[1] > 0.0f) {
|
||||
@@ -876,7 +876,7 @@ s32 act_ground_pound(struct MarioState *m) {
|
||||
u32 stepResult;
|
||||
f32 yOffset;
|
||||
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_UNKNOWN435, MARIO_ACTION_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED);
|
||||
|
||||
if (m->actionState == 0) {
|
||||
if (m->actionTimer < 10) {
|
||||
@@ -894,7 +894,7 @@ s32 act_ground_pound(struct MarioState *m) {
|
||||
set_mario_animation(m, m->actionArg == 0 ? MARIO_ANIM_START_GROUND_POUND
|
||||
: MARIO_ANIM_TRIPLE_JUMP_GROUND_POUND);
|
||||
if (m->actionTimer == 0) {
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
m->actionTimer += 1;
|
||||
@@ -1027,7 +1027,7 @@ s32 act_crazy_box_bounce(struct MarioState *m) {
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_WALL:
|
||||
mario_bonk_reflection(m, 0);
|
||||
mario_bonk_reflection(m, FALSE);
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_LAVA_WALL:
|
||||
@@ -1067,7 +1067,7 @@ u32 common_air_knockback_step(struct MarioState *m, u32 landAction, u32 hardFall
|
||||
|
||||
case AIR_STEP_HIT_WALL:
|
||||
set_mario_animation(m, MARIO_ANIM_BACKWARD_AIR_KB);
|
||||
mario_bonk_reflection(m, 0);
|
||||
mario_bonk_reflection(m, FALSE);
|
||||
|
||||
if (m->vel[1] > 0.0f) {
|
||||
m->vel[1] = 0.0f;
|
||||
@@ -1233,7 +1233,7 @@ s32 act_getting_blown(struct MarioState *m) {
|
||||
|
||||
case AIR_STEP_HIT_WALL:
|
||||
set_mario_animation(m, MARIO_ANIM_AIR_FORWARD_KB);
|
||||
mario_bonk_reflection(m, 0);
|
||||
mario_bonk_reflection(m, FALSE);
|
||||
|
||||
if (m->vel[1] > 0.0f) {
|
||||
m->vel[1] = 0.0f;
|
||||
@@ -1302,7 +1302,7 @@ s32 act_forward_rollout(struct MarioState *m) {
|
||||
case AIR_STEP_NONE:
|
||||
if (m->actionState == 1) {
|
||||
if (set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING) == 4) {
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
} else {
|
||||
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
|
||||
@@ -1343,7 +1343,7 @@ s32 act_backward_rollout(struct MarioState *m) {
|
||||
case AIR_STEP_NONE:
|
||||
if (m->actionState == 1) {
|
||||
if (set_mario_animation(m, MARIO_ANIM_BACKWARD_SPINNING) == 4) {
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
} else {
|
||||
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
|
||||
@@ -1477,7 +1477,7 @@ s32 act_lava_boost(struct MarioState *m) {
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_WALL:
|
||||
mario_bonk_reflection(m, 0);
|
||||
mario_bonk_reflection(m, FALSE);
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_LAVA_WALL:
|
||||
@@ -1669,7 +1669,7 @@ s32 act_flying(struct MarioState *m) {
|
||||
} else {
|
||||
set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING_FLIP);
|
||||
if (m->marioObj->header.gfx.unk38.animFrame == 1) {
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1712,8 +1712,8 @@ s32 act_flying(struct MarioState *m) {
|
||||
m->vel[1] = 0.0f;
|
||||
}
|
||||
|
||||
play_sound((m->flags & MARIO_METAL_CAP) ? SOUND_ACTION_UNKNOWN442
|
||||
: SOUND_ACTION_UNKNOWN445,
|
||||
play_sound((m->flags & MARIO_METAL_CAP) ? SOUND_ACTION_METAL_BONK
|
||||
: SOUND_ACTION_BONK,
|
||||
m->marioObj->header.gfx.cameraToObject);
|
||||
|
||||
m->particleFlags |= PARTICLE_1;
|
||||
@@ -1721,7 +1721,7 @@ s32 act_flying(struct MarioState *m) {
|
||||
func_80285BD8(m->area->camera, m->area->camera->defPreset, 1);
|
||||
} else {
|
||||
if (m->actionTimer++ == 0) {
|
||||
play_sound(SOUND_ACTION_UNKNOWN444, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_HIT, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
if (m->actionTimer == 30) {
|
||||
@@ -1748,7 +1748,7 @@ s32 act_flying(struct MarioState *m) {
|
||||
}
|
||||
|
||||
if (startPitch <= 0 && m->faceAngle[0] > 0 && m->forwardVel >= 48.0f) {
|
||||
play_sound(SOUND_ACTION_UNKNOWN456, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_FLYING_FAST, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifndef VERSION_JP
|
||||
play_sound(SOUND_MARIO_YAHOO_WAHA_YIPPEE + ((D_80226EB8 % 5) << 16),
|
||||
m->marioObj->header.gfx.cameraToObject);
|
||||
@@ -1816,7 +1816,7 @@ s32 act_flying_triple_jump(struct MarioState *m) {
|
||||
set_mario_animation(m, MARIO_ANIM_TRIPLE_JUMP_FLY);
|
||||
|
||||
if (m->marioObj->header.gfx.unk38.animFrame == 7) {
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
if (is_anim_past_end(m)) {
|
||||
@@ -1826,7 +1826,7 @@ s32 act_flying_triple_jump(struct MarioState *m) {
|
||||
}
|
||||
|
||||
if (m->actionState == 1 && m->marioObj->header.gfx.unk38.animFrame == 1) {
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
if (m->vel[1] < 4.0f) {
|
||||
@@ -1855,7 +1855,7 @@ s32 act_flying_triple_jump(struct MarioState *m) {
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_WALL:
|
||||
mario_bonk_reflection(m, 0);
|
||||
mario_bonk_reflection(m, FALSE);
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_LAVA_WALL:
|
||||
@@ -1880,7 +1880,7 @@ s32 act_vertical_wind(struct MarioState *m) {
|
||||
if (m->actionState == 0) {
|
||||
set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING_FLIP);
|
||||
if (m->marioObj->header.gfx.unk38.animFrame == 1) {
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
if (is_anim_past_end(m)) {
|
||||
@@ -1931,13 +1931,13 @@ s32 act_special_triple_jump(struct MarioState *m) {
|
||||
break;
|
||||
|
||||
case AIR_STEP_HIT_WALL:
|
||||
mario_bonk_reflection(m, 1);
|
||||
mario_bonk_reflection(m, TRUE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (m->actionState == 0 || m->vel[1] > 0.0f) {
|
||||
if (set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING) == 0) {
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
} else {
|
||||
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
|
||||
|
||||
@@ -43,7 +43,7 @@ void play_climbing_sounds(struct MarioState *m, s32 b) {
|
||||
s32 isOnTree = (m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
||||
|
||||
if (b == 1) {
|
||||
if (is_anim_past_frame(m, 1) != 0) {
|
||||
if (is_anim_past_frame(m, 1)) {
|
||||
play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE,
|
||||
m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
@@ -721,7 +721,7 @@ s32 act_in_cannon(struct MarioState *m) {
|
||||
m->pos[1] += 120.0f * sins(m->faceAngle[0]);
|
||||
m->pos[2] += 120.0f * coss(m->faceAngle[0]) * coss(m->faceAngle[1]);
|
||||
|
||||
play_sound(SOUND_ACTION_UNKNOWN456, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_FLYING_FAST, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_OBJ_POUNDING_CANNON, m->marioObj->header.gfx.cameraToObject);
|
||||
|
||||
m->marioObj->header.gfx.node.flags |= 0x0001;
|
||||
@@ -812,7 +812,7 @@ s32 act_tornado_twirling(struct MarioState *m) {
|
||||
|
||||
// Play sound on angle overflow
|
||||
if (prevTwirlYaw > m->twirlYaw) {
|
||||
play_sound(SOUND_ACTION_SWISH2_2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_TWIRL, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
|
||||
|
||||
@@ -288,7 +288,7 @@ void handle_save_menu(struct MarioState *m) {
|
||||
* Spawns object with given behavior and model and copies over Mario's position
|
||||
* and yaw plus relative yaw.
|
||||
*/
|
||||
struct Object *spawn_obj_at_mario_rel_yaw(struct MarioState *m, s32 model, void *behavior, s16 relYaw) {
|
||||
struct Object *spawn_obj_at_mario_rel_yaw(struct MarioState *m, s32 model, const BehaviorScript *behavior, s16 relYaw) {
|
||||
struct Object *o = spawn_object(m->marioObj, model, behavior);
|
||||
|
||||
o->oFaceAngleYaw = m->faceAngle[1] + relYaw;
|
||||
@@ -504,7 +504,7 @@ s32 act_reading_automatic_dialog(struct MarioState *m) {
|
||||
s32 act_reading_sign(struct MarioState *m) {
|
||||
struct Object *marioObj = m->marioObj;
|
||||
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_UNKNOWN45B, MARIO_ACTION_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_READ_SIGN, MARIO_ACTION_SOUND_PLAYED);
|
||||
|
||||
switch (m->actionState) {
|
||||
// start dialog
|
||||
@@ -1028,7 +1028,7 @@ s32 act_spawn_spin_airborne(struct MarioState *m) {
|
||||
// is 300 units above floor, spin and play woosh sounds
|
||||
if (m->actionState == 0 && m->pos[1] - m->floorHeight > 300.0f) {
|
||||
if (set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING) == 0) { // first anim frame
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1121,7 +1121,7 @@ s32 act_exit_land_save_dialog(struct MarioState *m) {
|
||||
-32768);
|
||||
//! fall through
|
||||
case 67:
|
||||
play_sound(SOUND_ACTION_SWISH1, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_KEY_SWISH, m->marioObj->header.gfx.cameraToObject);
|
||||
//! fall through
|
||||
case 83:
|
||||
play_sound(SOUND_ACTION_PAT_BACK, m->marioObj->header.gfx.cameraToObject);
|
||||
@@ -1317,7 +1317,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) {
|
||||
mario_set_forward_vel(m, forwardVel);
|
||||
|
||||
if (set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING) == 0) {
|
||||
play_sound(SOUND_ACTION_SWISH2, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
m->flags &= ~MARIO_UNKNOWN_08;
|
||||
@@ -1342,7 +1342,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) {
|
||||
m->actionState = 3;
|
||||
}
|
||||
} else {
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_UNKNOWN446, MARIO_ACTION_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_SHRINK_INTO_BBH, MARIO_ACTION_SOUND_PLAYED);
|
||||
set_mario_animation(m, MARIO_ANIM_DIVE);
|
||||
m->marioObj->header.gfx.angle[0] = atan2s(m->forwardVel, -m->vel[1]);
|
||||
}
|
||||
@@ -1396,7 +1396,7 @@ s32 act_bbh_enter_jump(struct MarioState *m) {
|
||||
}
|
||||
|
||||
s32 act_teleport_fade_out(struct MarioState *m) {
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_UNKNOWN457, MARIO_ACTION_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_TELEPORT, MARIO_ACTION_SOUND_PLAYED);
|
||||
set_mario_animation(m, m->prevAction == ACT_CROUCHING ? MARIO_ANIM_CROUCHING
|
||||
: MARIO_ANIM_FIRST_PERSON);
|
||||
m->flags |= MARIO_TELEPORTING;
|
||||
@@ -1415,7 +1415,7 @@ s32 act_teleport_fade_out(struct MarioState *m) {
|
||||
}
|
||||
|
||||
s32 act_teleport_fade_in(struct MarioState *m) {
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_UNKNOWN457, MARIO_ACTION_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_TELEPORT, MARIO_ACTION_SOUND_PLAYED);
|
||||
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
|
||||
|
||||
if (m->actionTimer < 32) {
|
||||
@@ -1606,10 +1606,8 @@ void stuck_in_ground_handler(struct MarioState *m, s32 animation, s32 unstuckFra
|
||||
|
||||
if (animFrame == -1) {
|
||||
play_sound_and_spawn_particles(m, SOUND_ACTION_TERRAIN_STUCK_IN_GROUND, 1);
|
||||
|
||||
} else if (animFrame == unstuckFrame) {
|
||||
play_sound_and_spawn_particles(m, SOUND_ACTION_UNKNOWN443, 1);
|
||||
|
||||
play_sound_and_spawn_particles(m, SOUND_ACTION_UNSTUCK_FROM_GROUND, 1);
|
||||
} else if (animFrame == target2 || animFrame == target3) {
|
||||
play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING);
|
||||
}
|
||||
@@ -1686,7 +1684,7 @@ static void intro_cutscene_jump_out_of_pipe(struct MarioState *m) {
|
||||
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_YAHOO, MARIO_MARIO_SOUND_PLAYED);
|
||||
#ifndef VERSION_JP
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_UNKNOWN444_3, MARIO_ACTION_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_HIT_3, MARIO_ACTION_SOUND_PLAYED);
|
||||
#endif
|
||||
|
||||
set_mario_animation(m, MARIO_ANIM_SINGLE_JUMP);
|
||||
|
||||
@@ -1212,7 +1212,7 @@ s32 act_riding_shell_ground(struct MarioState *m) {
|
||||
|
||||
case GROUND_STEP_HIT_WALL:
|
||||
mario_stop_riding_object(m);
|
||||
play_sound(m->flags & MARIO_METAL_CAP ? SOUND_ACTION_UNKNOWN442 : SOUND_ACTION_UNKNOWN445,
|
||||
play_sound(m->flags & MARIO_METAL_CAP ? SOUND_ACTION_METAL_BONK : SOUND_ACTION_BONK,
|
||||
m->marioObj->header.gfx.cameraToObject);
|
||||
m->particleFlags |= PARTICLE_1;
|
||||
set_mario_action(m, ACT_BACKWARD_GROUND_KB, 0);
|
||||
|
||||
@@ -260,7 +260,7 @@ s32 act_throwing(struct MarioState *m) {
|
||||
if (++m->actionTimer == 7) {
|
||||
mario_throw_held_object(m);
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_WAH2, MARIO_MARIO_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_UNKNOWN435, MARIO_ACTION_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED);
|
||||
}
|
||||
|
||||
animated_stationary_ground_step(m, MARIO_ANIM_GROUND_THROW, ACT_IDLE);
|
||||
@@ -279,7 +279,7 @@ s32 act_heavy_throw(struct MarioState *m) {
|
||||
if (++m->actionTimer == 13) {
|
||||
mario_drop_held_object(m);
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_WAH2, MARIO_MARIO_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_UNKNOWN435, MARIO_ACTION_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED);
|
||||
}
|
||||
|
||||
animated_stationary_ground_step(m, MARIO_ANIM_HEAVY_THROW, ACT_IDLE);
|
||||
|
||||
@@ -15,8 +15,11 @@
|
||||
#include "audio/external.h"
|
||||
#include "behavior_data.h"
|
||||
|
||||
#define MIN_SWIM_STRENGTH 160
|
||||
#define MIN_SWIM_SPEED 16.0f
|
||||
|
||||
static s16 sWasAtSurface = FALSE;
|
||||
static s16 D_8032CDD4 = 160;
|
||||
static s16 sSwimStrength = MIN_SWIM_STRENGTH;
|
||||
static s16 sWaterCurrentSpeeds[] = { 28, 12, 8, 4 };
|
||||
|
||||
static s16 D_80339FD0;
|
||||
@@ -302,7 +305,7 @@ static void common_idle_step(struct MarioState *m, s32 animation, s32 arg) {
|
||||
|
||||
update_swimming_yaw(m);
|
||||
update_swimming_pitch(m);
|
||||
update_swimming_speed(m, 16.0f);
|
||||
update_swimming_speed(m, MIN_SWIM_SPEED);
|
||||
perform_water_step(m);
|
||||
func_80270504(m);
|
||||
|
||||
@@ -505,7 +508,7 @@ static s32 check_water_jump(struct MarioState *m) {
|
||||
|
||||
static s32 act_breaststroke(struct MarioState *m) {
|
||||
if (m->actionArg == 0) {
|
||||
D_8032CDD4 = 160;
|
||||
sSwimStrength = MIN_SWIM_STRENGTH;
|
||||
}
|
||||
|
||||
if (m->flags & MARIO_METAL_CAP) {
|
||||
@@ -541,18 +544,18 @@ static s32 act_breaststroke(struct MarioState *m) {
|
||||
set_anim_to_frame(m, 0);
|
||||
m->actionState = 0;
|
||||
m->actionTimer = 1;
|
||||
D_8032CDD4 = 160;
|
||||
sSwimStrength = MIN_SWIM_STRENGTH;
|
||||
}
|
||||
}
|
||||
|
||||
if (m->actionTimer == 1) {
|
||||
play_sound(D_8032CDD4 == 160 ? SOUND_ACTION_UNKNOWN433 : SOUND_ACTION_UNKNOWN447,
|
||||
play_sound(sSwimStrength == MIN_SWIM_STRENGTH ? SOUND_ACTION_SWIM : SOUND_ACTION_SWIM_FAST,
|
||||
m->marioObj->header.gfx.cameraToObject);
|
||||
func_8027107C(m);
|
||||
}
|
||||
|
||||
set_mario_animation(m, MARIO_ANIM_SWIM_PART1);
|
||||
common_swimming_step(m, D_8032CDD4);
|
||||
common_swimming_step(m, sSwimStrength);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -575,21 +578,21 @@ static s32 act_swimming_end(struct MarioState *m) {
|
||||
}
|
||||
|
||||
if ((m->input & INPUT_A_DOWN) && m->actionTimer >= 7) {
|
||||
if (m->actionTimer == 7 && D_8032CDD4 < 280) {
|
||||
D_8032CDD4 += 10;
|
||||
if (m->actionTimer == 7 && sSwimStrength < 280) {
|
||||
sSwimStrength += 10;
|
||||
}
|
||||
return set_mario_action(m, ACT_BREASTSTROKE, 1);
|
||||
}
|
||||
|
||||
if (m->actionTimer >= 7) {
|
||||
D_8032CDD4 = 160;
|
||||
sSwimStrength = MIN_SWIM_STRENGTH;
|
||||
}
|
||||
|
||||
m->actionTimer++;
|
||||
|
||||
m->forwardVel -= 0.25f;
|
||||
set_mario_animation(m, MARIO_ANIM_SWIM_PART2);
|
||||
common_swimming_step(m, D_8032CDD4);
|
||||
common_swimming_step(m, sSwimStrength);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -604,22 +607,22 @@ static s32 act_flutter_kick(struct MarioState *m) {
|
||||
}
|
||||
|
||||
if (!(m->input & INPUT_A_DOWN)) {
|
||||
if (m->actionTimer == 0 && D_8032CDD4 < 280) {
|
||||
D_8032CDD4 += 10;
|
||||
if (m->actionTimer == 0 && sSwimStrength < 280) {
|
||||
sSwimStrength += 10;
|
||||
}
|
||||
return set_mario_action(m, ACT_SWIMMING_END, 0);
|
||||
}
|
||||
|
||||
m->forwardVel = approach_f32(m->forwardVel, 12.0f, 0.1f, 0.15f);
|
||||
m->actionTimer = 1;
|
||||
D_8032CDD4 = 160;
|
||||
sSwimStrength = MIN_SWIM_STRENGTH;
|
||||
|
||||
if (m->forwardVel < 14.0f) {
|
||||
func_802713A8(m);
|
||||
set_mario_animation(m, MARIO_ANIM_FLUTTERKICK);
|
||||
}
|
||||
|
||||
common_swimming_step(m, D_8032CDD4);
|
||||
common_swimming_step(m, sSwimStrength);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -665,7 +668,7 @@ static s32 act_hold_breaststroke(struct MarioState *m) {
|
||||
}
|
||||
|
||||
if (m->actionTimer == 1) {
|
||||
play_sound(SOUND_ACTION_UNKNOWN433, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_SWIM, m->marioObj->header.gfx.cameraToObject);
|
||||
func_8027107C(m);
|
||||
}
|
||||
|
||||
@@ -782,12 +785,12 @@ static s32 check_water_grab(struct MarioState *m) {
|
||||
static s32 act_water_throw(struct MarioState *m) {
|
||||
update_swimming_yaw(m);
|
||||
update_swimming_pitch(m);
|
||||
update_swimming_speed(m, 16.0f);
|
||||
update_swimming_speed(m, MIN_SWIM_SPEED);
|
||||
perform_water_step(m);
|
||||
func_80270504(m);
|
||||
|
||||
set_mario_animation(m, MARIO_ANIM_WATER_THROW_OBJ);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_UNKNOWN433, MARIO_ACTION_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_SWIM, MARIO_ACTION_SOUND_PLAYED);
|
||||
|
||||
m->marioBodyState->unk12[0] = approach_s32(m->marioBodyState->unk12[0], 0, 0x200, 0x200);
|
||||
|
||||
@@ -809,13 +812,13 @@ static s32 act_water_punch(struct MarioState *m) {
|
||||
|
||||
update_swimming_yaw(m);
|
||||
update_swimming_pitch(m);
|
||||
update_swimming_speed(m, 16.0f);
|
||||
update_swimming_speed(m, MIN_SWIM_SPEED);
|
||||
perform_water_step(m);
|
||||
func_80270504(m);
|
||||
|
||||
m->marioBodyState->unk12[0] = approach_s32(m->marioBodyState->unk12[0], 0, 0x200, 0x200);
|
||||
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_UNKNOWN433, MARIO_ACTION_SOUND_PLAYED);
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_SWIM, MARIO_ACTION_SOUND_PLAYED);
|
||||
|
||||
switch (m->actionState) {
|
||||
case 0:
|
||||
@@ -1074,18 +1077,18 @@ static s32 act_caught_in_whirlpool(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void func_80272FA8(struct MarioState *m, u32 arg) {
|
||||
static void play_metal_water_jumping_sound(struct MarioState *m, u32 landing) {
|
||||
if (!(m->flags & MARIO_ACTION_SOUND_PLAYED)) {
|
||||
m->particleFlags |= PARTICLE_16;
|
||||
}
|
||||
|
||||
play_sound_if_no_flag(m, arg ? SOUND_ACTION_UNKNOWN451 : SOUND_ACTION_UNKNOWN450,
|
||||
play_sound_if_no_flag(m, landing ? SOUND_ACTION_METAL_LAND_WATER : SOUND_ACTION_METAL_JUMP_WATER,
|
||||
MARIO_ACTION_SOUND_PLAYED);
|
||||
}
|
||||
|
||||
static void play_metal_water_walking_sound(struct MarioState *m) {
|
||||
if (is_anim_past_frame(m, 10) || is_anim_past_frame(m, 49)) {
|
||||
play_sound(SOUND_ACTION_UNKNOWN452, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_METAL_STEP_WATER, m->marioObj->header.gfx.cameraToObject);
|
||||
m->particleFlags |= PARTICLE_DUST;
|
||||
}
|
||||
}
|
||||
@@ -1295,7 +1298,7 @@ static s32 act_metal_water_jump(struct MarioState *m) {
|
||||
return set_mario_action(m, ACT_WATER_JUMP, 1);
|
||||
}
|
||||
|
||||
func_80272FA8(m, 0);
|
||||
play_metal_water_jumping_sound(m, FALSE);
|
||||
set_mario_animation(m, MARIO_ANIM_SINGLE_JUMP);
|
||||
|
||||
switch (perform_air_step(m, 0)) {
|
||||
@@ -1324,7 +1327,7 @@ static s32 act_hold_metal_water_jump(struct MarioState *m) {
|
||||
return set_mario_action(m, ACT_HOLD_WATER_JUMP, 1);
|
||||
}
|
||||
|
||||
func_80272FA8(m, 0);
|
||||
play_metal_water_jumping_sound(m, FALSE);
|
||||
set_mario_animation(m, MARIO_ANIM_JUMP_WITH_LIGHT_OBJ);
|
||||
|
||||
switch (perform_air_step(m, 0)) {
|
||||
@@ -1383,7 +1386,7 @@ static s32 act_hold_metal_water_falling(struct MarioState *m) {
|
||||
}
|
||||
|
||||
static s32 act_metal_water_jump_land(struct MarioState *m) {
|
||||
func_80272FA8(m, 1);
|
||||
play_metal_water_jumping_sound(m, TRUE);
|
||||
|
||||
if (!(m->flags & MARIO_METAL_CAP)) {
|
||||
return set_mario_action(m, ACT_WATER_IDLE, 0);
|
||||
@@ -1404,7 +1407,7 @@ static s32 act_metal_water_jump_land(struct MarioState *m) {
|
||||
}
|
||||
|
||||
static s32 act_hold_metal_water_jump_land(struct MarioState *m) {
|
||||
func_80272FA8(m, 1);
|
||||
play_metal_water_jumping_sound(m, TRUE);
|
||||
|
||||
if (m->marioObj->oInteractStatus & INT_STATUS_MARIO_DROP_OBJECT) {
|
||||
return drop_and_set_mario_action(m, ACT_METAL_WATER_STANDING, 0);
|
||||
@@ -1429,7 +1432,7 @@ static s32 act_hold_metal_water_jump_land(struct MarioState *m) {
|
||||
}
|
||||
|
||||
static s32 act_metal_water_fall_land(struct MarioState *m) {
|
||||
func_80272FA8(m, 1);
|
||||
play_metal_water_jumping_sound(m, TRUE);
|
||||
|
||||
if (!(m->flags & MARIO_METAL_CAP)) {
|
||||
return set_mario_action(m, ACT_WATER_IDLE, 0);
|
||||
@@ -1450,7 +1453,7 @@ static s32 act_metal_water_fall_land(struct MarioState *m) {
|
||||
}
|
||||
|
||||
static s32 act_hold_metal_water_fall_land(struct MarioState *m) {
|
||||
func_80272FA8(m, 1);
|
||||
play_metal_water_jumping_sound(m, TRUE);
|
||||
|
||||
if (m->marioObj->oInteractStatus & INT_STATUS_MARIO_DROP_OBJECT) {
|
||||
return drop_and_set_mario_action(m, ACT_METAL_WATER_STANDING, 0);
|
||||
|
||||
+18
-18
@@ -285,7 +285,7 @@ Gfx *Geo18_802770A4(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
return sp28;
|
||||
}
|
||||
|
||||
s32 geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) {
|
||||
Gfx *geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) {
|
||||
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
|
||||
struct MarioBodyState *sp0 = &gBodyStates[switchCase->numCases];
|
||||
|
||||
@@ -293,10 +293,10 @@ s32 geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED M
|
||||
// assign result. 0 if moving, 1 if stationary.
|
||||
switchCase->selectedCase = ((sp0->action & ACT_FLAG_STATIONARY) == FALSE);
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s32 geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
|
||||
struct MarioBodyState *sp8 = &gBodyStates[switchCase->numCases];
|
||||
s16 sp6;
|
||||
@@ -313,7 +313,7 @@ s32 geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *
|
||||
switchCase->selectedCase = sp8->eyeState - 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Gfx *Geo18_80277294(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
@@ -359,7 +359,7 @@ Gfx *Geo18_802773A4(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s32 geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
|
||||
struct MarioBodyState *sp0 = &gBodyStates[0];
|
||||
|
||||
@@ -374,7 +374,7 @@ s32 geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Gfx *Geo18_802775CC(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
@@ -396,17 +396,17 @@ Gfx *Geo18_802775CC(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s32 geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
|
||||
struct MarioBodyState *sp0 = &gBodyStates[switchCase->numCases];
|
||||
|
||||
if (callContext == GEO_CONTEXT_RENDER) {
|
||||
switchCase->selectedCase = sp0->modelState >> 8;
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s32 geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
Gfx *geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
struct GraphNode *next = node->next;
|
||||
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
|
||||
struct MarioBodyState *sp4 = &gBodyStates[switchCase->numCases];
|
||||
@@ -424,7 +424,7 @@ s32 geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED
|
||||
next = next->next;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Gfx *Geo18_80277824(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
@@ -449,27 +449,27 @@ Gfx *Geo18_80277824(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
|
||||
}
|
||||
|
||||
Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *c) {
|
||||
struct Struct8027795C *sp2C = (struct Struct8027795C *) b;
|
||||
struct GraphNodeHeldObject *sp2C = (struct GraphNodeHeldObject *) b;
|
||||
Mat4 *sp28 = c;
|
||||
struct MarioState *sp24 = &gMarioStates[sp2C->unk18];
|
||||
struct MarioState *sp24 = &gMarioStates[sp2C->playerIndex];
|
||||
|
||||
if (callContext == GEO_CONTEXT_RENDER) {
|
||||
sp2C->unk1C = 0;
|
||||
sp2C->objNode = NULL;
|
||||
if (sp24->heldObj != NULL) {
|
||||
sp2C->unk1C = sp24->heldObj;
|
||||
sp2C->objNode = sp24->heldObj;
|
||||
switch (sp24->marioBodyState->grabPos) {
|
||||
case GRAB_POS_LIGHT_OBJ:
|
||||
if (sp24->action & ACT_FLAG_THROWING) {
|
||||
vec3s_set(sp2C->unk20, 50, 0, 0);
|
||||
vec3s_set(sp2C->translation, 50, 0, 0);
|
||||
} else {
|
||||
vec3s_set(sp2C->unk20, 50, 0, 110);
|
||||
vec3s_set(sp2C->translation, 50, 0, 110);
|
||||
}
|
||||
break;
|
||||
case GRAB_POS_HEAVY_OBJ:
|
||||
vec3s_set(sp2C->unk20, 145, -173, 180);
|
||||
vec3s_set(sp2C->translation, 145, -173, 180);
|
||||
break;
|
||||
case GRAB_POS_BOWSER:
|
||||
vec3s_set(sp2C->unk20, 80, -270, 1260);
|
||||
vec3s_set(sp2C->translation, 80, -270, 1260);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-95
@@ -31,96 +31,6 @@ enum UnlockDoorStarStates {
|
||||
UNLOCK_DOOR_STAR_DONE
|
||||
};
|
||||
|
||||
struct Struct802763D4_Unknown
|
||||
{
|
||||
u8 filler0[0x1C];
|
||||
f32 unk1C;
|
||||
};
|
||||
|
||||
struct Struct802769E0
|
||||
{
|
||||
u8 filler0[2];
|
||||
s16 unk2;
|
||||
u8 filler4[0x18-0x4];
|
||||
s32 unk18;
|
||||
};
|
||||
|
||||
struct Struct80277150
|
||||
{
|
||||
struct GraphNode node;
|
||||
u8 filler14[0x4];
|
||||
f32 unk18;
|
||||
s16 unk1C;
|
||||
s16 unk1E;
|
||||
};
|
||||
|
||||
struct Struct80277294
|
||||
{
|
||||
struct GraphNode node;
|
||||
u8 filler14[0x4];
|
||||
s32 unk18;
|
||||
};
|
||||
|
||||
struct Struct80277294_2
|
||||
{
|
||||
struct GraphNode node;
|
||||
u8 filler14[4];
|
||||
s16 unk18;
|
||||
s16 unk1A;
|
||||
s16 unk1C;
|
||||
};
|
||||
|
||||
struct Struct802773A4
|
||||
{
|
||||
struct GraphNode node;
|
||||
u8 filler14[0x4];
|
||||
s32 unk18;
|
||||
};
|
||||
|
||||
struct Struct802773A4_2
|
||||
{
|
||||
struct GraphNode node;
|
||||
u8 filler14[0x4];
|
||||
Vec3s unk18;
|
||||
};
|
||||
|
||||
struct Struct802775CC
|
||||
{
|
||||
struct GraphNode node;
|
||||
u8 filler14[4];
|
||||
s32 unk18;
|
||||
};
|
||||
|
||||
struct Struct80277824
|
||||
{
|
||||
struct GraphNode node;
|
||||
u8 filler14[4];
|
||||
u32 unk18;
|
||||
};
|
||||
|
||||
struct Struct80277824_2
|
||||
{
|
||||
struct GraphNode node;
|
||||
u8 filler14[4];
|
||||
s16 unk18;
|
||||
};
|
||||
|
||||
struct Struct8027795C
|
||||
{
|
||||
struct GraphNode node;
|
||||
u8 filler14[4];
|
||||
s32 unk18;
|
||||
struct Object *unk1C;
|
||||
Vec3s unk20;
|
||||
};
|
||||
|
||||
struct Struct80277D6C
|
||||
{
|
||||
struct GraphNode node;
|
||||
u8 filler14[4];
|
||||
s32 unk18;
|
||||
};
|
||||
|
||||
extern struct GraphNodeObject D_80339FE0;
|
||||
extern struct MarioBodyState gBodyStates[2];
|
||||
|
||||
@@ -130,15 +40,16 @@ extern void bhvToadMessage_init(void);
|
||||
extern void bhvUnlockDoorStar_init(void);
|
||||
extern void bhvUnlockDoorStar_loop(void);
|
||||
extern Gfx *Geo18_802770A4(s32 a, struct GraphNode *b, UNUSED Mat4 *c);
|
||||
extern s32 geo_switch_mario_stand_run(s32 run, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern s32 geo_switch_mario_eyes(s32 run, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern Gfx *geo_switch_mario_stand_run(s32 run, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern Gfx *geo_switch_mario_eyes(s32 run, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern Gfx *Geo18_80277294(s32 a, struct GraphNode *b, UNUSED Mat4 *c);
|
||||
extern Gfx *Geo18_802773A4(s32 a, struct GraphNode *b, UNUSED Mat4 *c);
|
||||
extern s32 geo_switch_mario_hand(s32 run, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern Gfx *geo_switch_mario_hand(s32 run, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern Gfx *Geo18_802775CC(s32 a, struct GraphNode *b, UNUSED Mat4 *c);
|
||||
extern s32 geo_switch_mario_cap_effect(s32 run, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern s32 geo_switch_mario_cap_on_off(s32 run, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern Gfx *geo_switch_mario_cap_effect(s32 run, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern Gfx *geo_switch_mario_cap_on_off(s32 run, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern Gfx *Geo18_80277824(s32 a, struct GraphNode *b, UNUSED Mat4 *c);
|
||||
extern Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *c);
|
||||
extern Gfx *Geo1C_8027795C(s32 a, struct GraphNode *b, Mat4 *c);
|
||||
extern Gfx *geo_render_mirror_mario(s32 a, struct GraphNode *b, UNUSED Mat4 *c);
|
||||
extern Gfx *geo_mirror_mario_backface_culling(s32 a, struct GraphNode *b, UNUSED Mat4 *c);
|
||||
|
||||
@@ -91,10 +91,10 @@ void mario_bonk_reflection(struct MarioState *m, u32 negateSpeed) {
|
||||
s16 wallAngle = atan2s(m->wall->normal.z, m->wall->normal.x);
|
||||
m->faceAngle[1] = wallAngle - (s16)(m->faceAngle[1] - wallAngle);
|
||||
|
||||
play_sound((m->flags & MARIO_METAL_CAP) ? SOUND_ACTION_UNKNOWN442 : SOUND_ACTION_UNKNOWN445,
|
||||
play_sound((m->flags & MARIO_METAL_CAP) ? SOUND_ACTION_METAL_BONK : SOUND_ACTION_BONK,
|
||||
m->marioObj->header.gfx.cameraToObject);
|
||||
} else {
|
||||
play_sound(SOUND_ACTION_UNKNOWN444, m->marioObj->header.gfx.cameraToObject);
|
||||
play_sound(SOUND_ACTION_HIT, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
if (negateSpeed) {
|
||||
|
||||
+7
-6
@@ -63,15 +63,15 @@ void *get_segment_base_addr(s32 segment) {
|
||||
return (void *) (sSegmentTable[segment] | 0x80000000);
|
||||
}
|
||||
|
||||
void *segmented_to_virtual(void *addr) {
|
||||
u32 segment = (uintptr_t) addr >> 24;
|
||||
u32 offset = (uintptr_t) addr & 0x00FFFFFF;
|
||||
void *segmented_to_virtual(const void *addr) {
|
||||
size_t segment = (uintptr_t) addr >> 24;
|
||||
size_t offset = (uintptr_t) addr & 0x00FFFFFF;
|
||||
|
||||
return (void *) ((sSegmentTable[segment] + offset) | 0x80000000);
|
||||
}
|
||||
|
||||
void *virtual_to_segmented(s32 segment, void *addr) {
|
||||
uintptr_t offset = ((uintptr_t) addr & 0x1FFFFFFF) - sSegmentTable[segment];
|
||||
void *virtual_to_segmented(u32 segment, const void *addr) {
|
||||
size_t offset = ((uintptr_t) addr & 0x1FFFFFFF) - sSegmentTable[segment];
|
||||
|
||||
return (void *) ((segment << 24) + offset);
|
||||
}
|
||||
@@ -509,7 +509,8 @@ void *alloc_display_list(u32 size) {
|
||||
static struct MarioAnimDmaRelatedThing *func_802789F0(u8 *srcAddr) {
|
||||
struct MarioAnimDmaRelatedThing *sp1C = dynamic_dma_read(srcAddr, srcAddr + sizeof(u32),
|
||||
MEMORY_POOL_LEFT);
|
||||
u32 size = sp1C->count * sizeof(struct MarioAnimSub) + sizeof(u32) + sizeof(u8 *);
|
||||
u32 size = sizeof(u32) + (sizeof(u8 *) - sizeof(u32)) + sizeof(u8 *) +
|
||||
sp1C->count * sizeof(struct OffsetSizePair);
|
||||
main_pool_free(sp1C);
|
||||
|
||||
sp1C = dynamic_dma_read(srcAddr, srcAddr + size, MEMORY_POOL_LEFT);
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@ extern struct MemoryPool *D_8033A124;
|
||||
|
||||
uintptr_t set_segment_base_addr(s32 segment, void *addr);
|
||||
void *get_segment_base_addr(s32 segment);
|
||||
void *segmented_to_virtual(void *addr);
|
||||
void *virtual_to_segmented(s32 segment, void *addr);
|
||||
void *segmented_to_virtual(const void *addr);
|
||||
void *virtual_to_segmented(u32 segment, const void *addr);
|
||||
void move_segment_table_to_dmem(void);
|
||||
|
||||
void main_pool_init(void *start, void *end);
|
||||
|
||||
+10
-22
@@ -392,17 +392,6 @@ struct MovtexQuad {
|
||||
s16 textureId; /// texture id
|
||||
};
|
||||
|
||||
/**
|
||||
* Contains an id and an array of MovtexQuad structs.
|
||||
*/
|
||||
struct MovtexQuadCollection {
|
||||
/// identifier for geo nodes to refer to this MovtexQuad collection
|
||||
s16 id;
|
||||
s16 filler;
|
||||
/// points to a short 'n' followed by an array of n MovtexQuad structs
|
||||
void *quadArraySegmented;
|
||||
};
|
||||
|
||||
/// Variable for a little optimization: only set the texture when it differs from the previous texture
|
||||
s16 gMovetexLastTextureId;
|
||||
|
||||
@@ -461,17 +450,17 @@ Gfx *movtex_gen_from_quad(s16 y, struct MovtexQuad *quad) {
|
||||
}
|
||||
gDPSetTextureImage(gfx++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, gMovtexIdToTexture[textureId]);
|
||||
gDPTileSync(gfx++);
|
||||
gDPSetTile(gfx++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, 7, 0, G_TX_WRAP, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPSetTile(gfx++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0,
|
||||
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPLoadSync(gfx++);
|
||||
gDPLoadBlock(gfx++, 7, 0, 0, 1023, 256);
|
||||
gDPLoadBlock(gfx++, G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES));
|
||||
} else { // any rgba16 texture
|
||||
gDPSetTextureImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gMovtexIdToTexture[textureId]);
|
||||
gDPTileSync(gfx++);
|
||||
gDPSetTile(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, 7, 0, G_TX_WRAP, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPSetTile(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0,
|
||||
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPLoadSync(gfx++);
|
||||
gDPLoadBlock(gfx++, 7, 0, 0, 1023, 256);
|
||||
gDPLoadBlock(gfx++, G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES));
|
||||
if (0) {
|
||||
}
|
||||
}
|
||||
@@ -841,13 +830,12 @@ Gfx *movtex_gen_list(s16 *movtexVerts, struct MovtexObject *movtexList, s8 attrL
|
||||
}
|
||||
|
||||
gSPDisplayList(gfx++, movtexList->beginDl);
|
||||
gDPSetTextureImage(
|
||||
gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gMovtexIdToTexture[movtexList->textureId]);
|
||||
gDPSetTextureImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, gMovtexIdToTexture[movtexList->textureId]);
|
||||
gDPTileSync(gfx++);
|
||||
gDPSetTile(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, 7, 0, G_TX_WRAP,
|
||||
G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPSetTile(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0,
|
||||
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPLoadSync(gfx++);
|
||||
gDPLoadBlock(gfx++, 7, 0, 0, 1023, 256);
|
||||
gDPLoadBlock(gfx++, G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES));
|
||||
gSPVertex(gfx++, VIRTUAL_TO_PHYSICAL2(verts), movtexList->vtx_count, 0);
|
||||
gSPDisplayList(gfx++, movtexList->triDl);
|
||||
gSPDisplayList(gfx++, movtexList->endDl);
|
||||
|
||||
@@ -19,6 +19,16 @@ enum MovtexRectTextureId
|
||||
TEX_YELLOW_TRI_TTC
|
||||
};
|
||||
|
||||
/**
|
||||
* Contains an id and an array of MovtexQuad structs.
|
||||
*/
|
||||
struct MovtexQuadCollection {
|
||||
/// identifier for geo nodes to refer to this MovtexQuad collection
|
||||
s16 id;
|
||||
/// points to a short 'n' followed by an array of n MovtexQuad structs
|
||||
Movtex *quadArraySegmented;
|
||||
};
|
||||
|
||||
extern f32 gPaintingMarioYEntry;
|
||||
|
||||
// Moving texture mesh ids have for bits 8-16 a course identifier.
|
||||
@@ -98,4 +108,15 @@ extern f32 gPaintingMarioYEntry;
|
||||
#define MOVTEX_TREADMILL_BIG (0 | MOVTEX_AREA_TTC)
|
||||
#define MOVTEX_TREADMILL_SMALL (1 | MOVTEX_AREA_TTC)
|
||||
|
||||
extern Gfx *geo_wdw_set_initial_water_level(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
||||
extern Gfx *geo_movtex_pause_control(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
||||
extern Gfx *geo_movtex_draw_water_regions(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
||||
extern Gfx *geo_movtex_draw_nocolor(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
||||
extern Gfx *geo_movtex_draw_colored(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
||||
extern Gfx *geo_movtex_draw_colored_no_update(s32 callContext, struct GraphNode *node,
|
||||
f32 mtx[4][4]);
|
||||
extern Gfx *geo_movtex_draw_colored_2_no_update(s32 callContext, struct GraphNode *node,
|
||||
f32 mtx[4][4]);
|
||||
extern Gfx *geo_movtex_update_horizontal(s32 callContext, struct GraphNode *node, f32 mtx[4][4]);
|
||||
|
||||
#endif /* _MOVING_TEXTURE_H */
|
||||
|
||||
@@ -45,8 +45,6 @@ s8 D_80331508 = 0;
|
||||
s8 D_8033150C = 0;
|
||||
s8 D_80331510 = 0;
|
||||
|
||||
s32 count_objects_with_behavior(void *);
|
||||
|
||||
extern void *ccm_seg7_trajectory_snowman;
|
||||
extern void *inside_castle_seg7_trajectory_mips;
|
||||
|
||||
@@ -69,7 +67,7 @@ Gfx *func_802E2F58(s32 arg0, struct Object *arg1, UNUSED s32 arg2) {
|
||||
sp28 = arg1;
|
||||
sp24 = arg1;
|
||||
if (gCurGraphNodeHeldObject != NULL) {
|
||||
sp2c = (struct Object *) gCurGraphNodeHeldObject->objNode;
|
||||
sp2c = gCurGraphNodeHeldObject->objNode;
|
||||
}
|
||||
|
||||
sp34 = alloc_display_list(3 * sizeof(Gfx));
|
||||
|
||||
@@ -136,7 +136,7 @@ void bhv_bobomb_bully_death_smoke_init(void);
|
||||
void bhv_bobomb_explosion_bubble_init(void);
|
||||
void bhv_bobomb_explosion_bubble_loop(void);
|
||||
void bhv_respawner_loop(void);
|
||||
void create_respawner(s32 arg0, void *behToSpawn, s32 minSpawnDist);
|
||||
void create_respawner(s32 arg0, const BehaviorScript *behToSpawn, s32 minSpawnDist);
|
||||
void bhv_small_bully_init(void);
|
||||
void bhv_big_bully_init(void);
|
||||
void BullyCheckMarioCollision(void);
|
||||
|
||||
+34
-32
@@ -40,7 +40,7 @@ extern void func_8029EA0C(struct Object *);
|
||||
extern void translate_object_local(struct Object *, s16, s16);
|
||||
extern void copy_object_pos(struct Object *, struct Object *);
|
||||
extern void copy_object_angle(struct Object *, struct Object *);
|
||||
extern struct Object *obj_find_nearest_object_with_behavior(void *, f32 *);
|
||||
extern struct Object *obj_find_nearest_object_with_behavior(const BehaviorScript *, f32 *);
|
||||
extern void obj_move_y(f32, f32, f32);
|
||||
static s32 clear_move_flag(u32 *, s32);
|
||||
extern void func_802AA618(s32, s32, f32);
|
||||
@@ -78,8 +78,7 @@ Gfx *Geo18_8029D924(s32 run, struct GraphNode *node, UNUSED s32 sp48) {
|
||||
sp2C = (struct GraphNodeGenerated *) node;
|
||||
|
||||
if (gCurGraphNodeHeldObject) {
|
||||
sp34 = (struct Object *)
|
||||
gCurGraphNodeHeldObject->objNode; // TODO: change this to object pointer?
|
||||
sp34 = gCurGraphNodeHeldObject->objNode;
|
||||
}
|
||||
|
||||
sp28 = sp34->oOpacity;
|
||||
@@ -107,11 +106,11 @@ Gfx *Geo18_8029D924(s32 run, struct GraphNode *node, UNUSED s32 sp48) {
|
||||
#ifdef VERSION_JP
|
||||
if (sp30->parameter == 10) {
|
||||
if (gDebugInfo[DEBUG_PAGE_ENEMYINFO][3]) {
|
||||
gDPSetAlphaCompare(sp38++, 3);
|
||||
gDPSetAlphaCompare(sp38++, G_AC_DITHER);
|
||||
}
|
||||
} else {
|
||||
if (sp34->activeFlags & ACTIVE_FLAG_UNK7) {
|
||||
gDPSetAlphaCompare(sp38++, 3);
|
||||
gDPSetAlphaCompare(sp38++, G_AC_DITHER);
|
||||
}
|
||||
}
|
||||
#else // gDebugInfo accesses were removed in all non-JP versions.
|
||||
@@ -123,7 +122,7 @@ Gfx *Geo18_8029D924(s32 run, struct GraphNode *node, UNUSED s32 sp48) {
|
||||
// one.
|
||||
if (sp30->parameter != 10) {
|
||||
if (sp34->activeFlags & ACTIVE_FLAG_UNK7) {
|
||||
gDPSetAlphaCompare(sp38++, 3);
|
||||
gDPSetAlphaCompare(sp38++, G_AC_DITHER);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -153,8 +152,8 @@ s32 geo_switch_anim_state(s32 run, struct GraphNode *node) {
|
||||
// cast the pointer.
|
||||
switchCase = (struct GraphNodeSwitchCase *) node;
|
||||
|
||||
if (gCurGraphNodeHeldObject != 0) {
|
||||
obj = (struct Object *) gCurGraphNodeHeldObject->objNode;
|
||||
if (gCurGraphNodeHeldObject != NULL) {
|
||||
obj = gCurGraphNodeHeldObject->objNode;
|
||||
}
|
||||
|
||||
// if the case is greater than the number of cases, set to 0 to avoid overflowing
|
||||
@@ -266,7 +265,7 @@ void func_8029D704(Mat4 a0, Mat4 a1, Mat4 a2) {
|
||||
a0[3][3] = 1.0f;
|
||||
}
|
||||
|
||||
void set_object_held_state(struct Object *obj, void *heldBehavior) {
|
||||
void set_object_held_state(struct Object *obj, const BehaviorScript *heldBehavior) {
|
||||
obj->parentObj = o;
|
||||
|
||||
if (obj->oFlags & OBJ_FLAG_HOLDABLE) {
|
||||
@@ -456,7 +455,8 @@ void set_object_angle(struct Object *a0, s16 pitch, s16 yaw, s16 roll) {
|
||||
* Spawns an object at an absolute location with a specified angle.
|
||||
*/
|
||||
struct Object *spawn_object_abs_with_rot(struct Object *parent, s16 uselessArg, u32 model,
|
||||
void *behavior, s16 x, s16 y, s16 z, s16 rx, s16 ry, s16 rz) {
|
||||
const BehaviorScript *behavior,
|
||||
s16 x, s16 y, s16 z, s16 rx, s16 ry, s16 rz) {
|
||||
// 'uselessArg' is unused in the function spawn_object_at_origin()
|
||||
struct Object *newObj = spawn_object_at_origin(parent, uselessArg, model, behavior);
|
||||
set_object_pos(newObj, x, y, z);
|
||||
@@ -470,7 +470,8 @@ struct Object *spawn_object_abs_with_rot(struct Object *parent, s16 uselessArg,
|
||||
* The rz argument is never used, and the z offset is used for z-rotation instead. This is most likely
|
||||
* a copy-paste typo by one of the programmers.
|
||||
*/
|
||||
struct Object *spawn_object_rel_with_rot(struct Object *parent, u32 model, void *behavior, s16 xOff,
|
||||
struct Object *spawn_object_rel_with_rot(struct Object *parent, u32 model,
|
||||
const BehaviorScript *behavior, s16 xOff,
|
||||
s16 yOff, s16 zOff, s16 rx, s16 ry, UNUSED s16 rz) {
|
||||
struct Object *newObj = spawn_object_at_origin(parent, 0, model, behavior);
|
||||
newObj->oFlags |= OBJ_FLAG_TRANSFORM_RELATIVE_TO_PARENT;
|
||||
@@ -480,7 +481,7 @@ struct Object *spawn_object_rel_with_rot(struct Object *parent, u32 model, void
|
||||
return newObj;
|
||||
}
|
||||
|
||||
struct Object *Unknown8029E330(struct Object *sp20, s32 model, void *sp28) {
|
||||
struct Object *Unknown8029E330(struct Object *sp20, s32 model, const BehaviorScript *sp28) {
|
||||
struct Object *sp1C = spawn_object(sp20, model, sp28);
|
||||
sp1C->oFlags |= OBJ_FLAG_0020 | OBJ_FLAG_0800;
|
||||
return sp1C;
|
||||
@@ -526,9 +527,9 @@ struct Object *spawn_water_splash(struct Object *parent, struct WaterSplashParam
|
||||
}
|
||||
|
||||
struct Object *spawn_object_at_origin(struct Object *parent, UNUSED s32 unusedArg, u32 model,
|
||||
void *behavior) {
|
||||
const BehaviorScript *behavior) {
|
||||
struct Object *obj;
|
||||
uintptr_t *behaviorAddr;
|
||||
const BehaviorScript *behaviorAddr;
|
||||
|
||||
behaviorAddr = segmented_to_virtual(behavior);
|
||||
obj = create_object(behaviorAddr);
|
||||
@@ -543,7 +544,7 @@ struct Object *spawn_object_at_origin(struct Object *parent, UNUSED s32 unusedAr
|
||||
return obj;
|
||||
}
|
||||
|
||||
struct Object *spawn_object(struct Object *parent, s32 model, void *behavior) {
|
||||
struct Object *spawn_object(struct Object *parent, s32 model, const BehaviorScript *behavior) {
|
||||
struct Object *obj;
|
||||
|
||||
obj = spawn_object_at_origin(parent, 0, model, behavior);
|
||||
@@ -553,7 +554,7 @@ struct Object *spawn_object(struct Object *parent, s32 model, void *behavior) {
|
||||
}
|
||||
|
||||
struct Object *try_to_spawn_object(s16 offsetY, f32 scale, struct Object *parent, s32 model,
|
||||
void *behavior) {
|
||||
const BehaviorScript *behavior) {
|
||||
struct Object *obj;
|
||||
|
||||
if (gFreeObjectList.next != NULL) {
|
||||
@@ -566,7 +567,7 @@ struct Object *try_to_spawn_object(s16 offsetY, f32 scale, struct Object *parent
|
||||
}
|
||||
}
|
||||
|
||||
struct Object *spawn_object_with_scale(struct Object *parent, s32 model, void *behavior, f32 scale) {
|
||||
struct Object *spawn_object_with_scale(struct Object *parent, s32 model, const BehaviorScript *behavior, f32 scale) {
|
||||
struct Object *obj;
|
||||
|
||||
obj = spawn_object_at_origin(parent, 0, model, behavior);
|
||||
@@ -583,7 +584,7 @@ static void build_relative_object_transform(struct Object *obj) {
|
||||
|
||||
struct Object *spawn_object_relative(s16 behaviorParam, s16 relativePosX, s16 relativePosY,
|
||||
s16 relativePosZ, struct Object *parent, s32 model,
|
||||
void *behavior) {
|
||||
const BehaviorScript *behavior) {
|
||||
struct Object *obj = spawn_object_at_origin(parent, 0, model, behavior);
|
||||
|
||||
copy_object_pos_and_angle(obj, parent);
|
||||
@@ -598,7 +599,7 @@ struct Object *spawn_object_relative(s16 behaviorParam, s16 relativePosX, s16 re
|
||||
|
||||
struct Object *spawn_object_relative_with_scale(s16 behaviorParam, s16 relativePosX, s16 relativePosY,
|
||||
s16 relativePosZ, f32 scale, struct Object *parent,
|
||||
s32 model, void *behavior) {
|
||||
s32 model, const BehaviorScript *behavior) {
|
||||
struct Object *obj;
|
||||
|
||||
obj = spawn_object_relative(behaviorParam, relativePosX, relativePosY, relativePosZ, parent, model,
|
||||
@@ -815,7 +816,7 @@ void obj_set_facing_to_move_angles(struct Object *a0) {
|
||||
a0->oFaceAngleRoll = a0->oMoveAngleRoll;
|
||||
}
|
||||
|
||||
u32 get_object_list_from_behavior(uintptr_t *behavior) {
|
||||
u32 get_object_list_from_behavior(const BehaviorScript *behavior) {
|
||||
u32 objectList;
|
||||
|
||||
// If the first behavior command is "begin", then get the object list header
|
||||
@@ -829,7 +830,7 @@ u32 get_object_list_from_behavior(uintptr_t *behavior) {
|
||||
return objectList;
|
||||
}
|
||||
|
||||
struct Object *obj_nearest_object_with_behavior(void *behavior) {
|
||||
struct Object *obj_nearest_object_with_behavior(const BehaviorScript *behavior) {
|
||||
struct Object *obj;
|
||||
f32 dist;
|
||||
|
||||
@@ -838,7 +839,7 @@ struct Object *obj_nearest_object_with_behavior(void *behavior) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
f32 obj_dist_to_nearest_object_with_behavior(void *behavior) {
|
||||
f32 obj_dist_to_nearest_object_with_behavior(const BehaviorScript *behavior) {
|
||||
struct Object *obj;
|
||||
f32 dist;
|
||||
|
||||
@@ -850,7 +851,7 @@ f32 obj_dist_to_nearest_object_with_behavior(void *behavior) {
|
||||
return dist;
|
||||
}
|
||||
|
||||
struct Object *obj_find_nearest_object_with_behavior(void *behavior, f32 *dist) {
|
||||
struct Object *obj_find_nearest_object_with_behavior(const BehaviorScript *behavior, f32 *dist) {
|
||||
uintptr_t *behaviorAddr = segmented_to_virtual(behavior);
|
||||
struct Object *closestObj = NULL;
|
||||
struct Object *obj;
|
||||
@@ -901,7 +902,7 @@ s32 count_unimportant_objects(void) {
|
||||
return count;
|
||||
}
|
||||
|
||||
s32 count_objects_with_behavior(void *behavior) {
|
||||
s32 count_objects_with_behavior(const BehaviorScript *behavior) {
|
||||
uintptr_t *behaviorAddr = segmented_to_virtual(behavior);
|
||||
struct ObjectNode *listHead = &gObjectLists[get_object_list_from_behavior(behaviorAddr)];
|
||||
struct ObjectNode *obj = listHead->next;
|
||||
@@ -918,8 +919,8 @@ s32 count_objects_with_behavior(void *behavior) {
|
||||
return count;
|
||||
}
|
||||
|
||||
struct Object *obj_find_nearby_held_actor(void *behavior, f32 maxDist) {
|
||||
uintptr_t *behaviorAddr = segmented_to_virtual(behavior);
|
||||
struct Object *obj_find_nearby_held_actor(const BehaviorScript *behavior, f32 maxDist) {
|
||||
const BehaviorScript *behaviorAddr = segmented_to_virtual(behavior);
|
||||
struct ObjectNode *listHead;
|
||||
struct Object *obj;
|
||||
struct Object *foundObj;
|
||||
@@ -1474,15 +1475,15 @@ s32 are_objects_collided(struct Object *obj1, struct Object *obj2) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void obj_set_behavior(void *behavior) {
|
||||
void obj_set_behavior(const BehaviorScript *behavior) {
|
||||
o->behavior = segmented_to_virtual(behavior);
|
||||
}
|
||||
|
||||
void set_object_behavior(struct Object *obj, void *behavior) {
|
||||
void set_object_behavior(struct Object *obj, const BehaviorScript *behavior) {
|
||||
obj->behavior = segmented_to_virtual(behavior);
|
||||
}
|
||||
|
||||
s32 obj_has_behavior(u32 *behavior) {
|
||||
s32 obj_has_behavior(const BehaviorScript *behavior) {
|
||||
if (o->behavior == segmented_to_virtual(behavior)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
@@ -1490,7 +1491,7 @@ s32 obj_has_behavior(u32 *behavior) {
|
||||
}
|
||||
}
|
||||
|
||||
s32 object_has_behavior(struct Object *obj, u32 *behavior) {
|
||||
s32 object_has_behavior(struct Object *obj, const BehaviorScript *behavior) {
|
||||
if (obj->behavior == segmented_to_virtual(behavior)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
@@ -1603,7 +1604,8 @@ void obj_set_hurtbox_radius_and_height(f32 radius, f32 height) {
|
||||
o->hurtboxHeight = height;
|
||||
}
|
||||
|
||||
static void spawn_object_loot_coins(struct Object *obj, s32 numCoins, f32 sp30, void *coinBehavior,
|
||||
static void spawn_object_loot_coins(struct Object *obj, s32 numCoins, f32 sp30,
|
||||
const BehaviorScript *coinBehavior,
|
||||
s16 posJitter, s16 model) {
|
||||
s32 i;
|
||||
f32 spawnHeight;
|
||||
@@ -2486,7 +2488,7 @@ void func_802A3C98(f32 sp18, s32 sp1C) {
|
||||
}
|
||||
}
|
||||
|
||||
void set_object_collision_data(struct Object *obj, void *segAddr) {
|
||||
void set_object_collision_data(struct Object *obj, const void *segAddr) {
|
||||
obj->collisionData = segmented_to_virtual(segAddr);
|
||||
}
|
||||
|
||||
|
||||
+24
-25
@@ -26,7 +26,7 @@ struct WaterSplashParams
|
||||
{
|
||||
s16 flags; // spawn flags, see WATER_SPLASH_FLAG_* defines above
|
||||
s16 model;
|
||||
void *behavior;
|
||||
const BehaviorScript *behavior;
|
||||
s16 moveAngleRange; // only used for flags 0x40 & 0x80
|
||||
s16 moveRange; // only used for flags 0x04 & 0x08
|
||||
f32 randForwardVelOffset;
|
||||
@@ -102,7 +102,6 @@ extern s16 D_8035FEE4;
|
||||
// extern ? D_8032F430;
|
||||
// extern ? D_8032F440;
|
||||
// extern ? D_8032F450;
|
||||
extern u8 wdw_seg7_collision_07018528[];
|
||||
// extern ? sHeaveHoActions;
|
||||
// extern ? D_8032F498;
|
||||
// extern ? sJumpingBoxActions;
|
||||
@@ -165,14 +164,14 @@ extern s8 dddStatus;
|
||||
// extern ? D_80336704;
|
||||
// extern ? D_8033670C;
|
||||
|
||||
// extern ? Geo18_8029D890(?);
|
||||
// extern ? Geo18_8029D924(?);
|
||||
// extern ? geo_switch_anim_state(?);
|
||||
// extern ? geo_switch_area(?);
|
||||
extern Gfx *Geo18_8029D890(s32 run, UNUSED struct GraphNode *node, f32 mtx[4][4]);
|
||||
extern Gfx *Geo18_8029D924(s32 run, struct GraphNode *node, UNUSED s32 sp48);
|
||||
extern s32 geo_switch_anim_state(s32 run, struct GraphNode *node);
|
||||
extern s32 geo_switch_area(s32 run, struct GraphNode *node);
|
||||
extern void func_8029D558(Mat4, struct Object *);
|
||||
void apply_object_scale_to_matrix(struct Object *, Mat4, Mat4);
|
||||
extern void func_8029D704(Mat4,Mat4,Mat4);
|
||||
void set_object_held_state(struct Object *, void *);
|
||||
void set_object_held_state(struct Object *, const BehaviorScript *);
|
||||
extern f32 lateral_dist_between_objects(struct Object *, struct Object *);
|
||||
extern f32 dist_between_objects(struct Object *, struct Object *);
|
||||
extern void obj_forward_vel_approach_upward(f32,f32);
|
||||
@@ -185,17 +184,17 @@ extern s16 obj_turn_toward_object(struct Object *, struct Object *, s16, s16);
|
||||
extern void set_object_parent_relative_pos(struct Object*,s16,s16,s16);
|
||||
extern void set_object_pos(struct Object*,s16,s16,s16);
|
||||
extern void set_object_angle(struct Object*,s16,s16,s16);
|
||||
extern struct Object *spawn_object_abs_with_rot(struct Object *, s16, u32, void *, s16, s16, s16, s16, s16, s16);
|
||||
extern struct Object *spawn_object_rel_with_rot(struct Object *sp20, u32 sp24, void *sp28, s16 sp2E, s16 sp32, s16 sp36, s16 sp3A, s16 sp3E, s16 sp42);
|
||||
extern struct Object *spawn_object_abs_with_rot(struct Object *, s16, u32, const BehaviorScript *, s16, s16, s16, s16, s16, s16);
|
||||
extern struct Object *spawn_object_rel_with_rot(struct Object *sp20, u32 sp24, const BehaviorScript *sp28, s16 sp2E, s16 sp32, s16 sp36, s16 sp3A, s16 sp3E, s16 sp42);
|
||||
// extern ? Unknown8029E330(?);
|
||||
extern struct Object *spawn_water_splash(struct Object *, struct WaterSplashParams *);
|
||||
extern struct Object *spawn_object_at_origin(struct Object *, s32, u32, void *);
|
||||
extern struct Object *spawn_object(struct Object *, s32, void *);
|
||||
extern struct Object* try_to_spawn_object(s16,f32,struct Object*,s32,void*);
|
||||
extern struct Object* spawn_object_with_scale(struct Object*,s32,void*,f32);
|
||||
extern struct Object *spawn_object_at_origin(struct Object *, s32, u32, const BehaviorScript *);
|
||||
extern struct Object *spawn_object(struct Object *, s32, const BehaviorScript *);
|
||||
extern struct Object* try_to_spawn_object(s16,f32,struct Object*,s32,const BehaviorScript *);
|
||||
extern struct Object* spawn_object_with_scale(struct Object*,s32,const BehaviorScript *,f32);
|
||||
// extern ? build_relative_object_transform(?);
|
||||
extern struct Object* spawn_object_relative(s16, s16, s16, s16, struct Object *, s32, void *);
|
||||
extern struct Object* spawn_object_relative_with_scale(s16,s16,s16,s16,f32,struct Object*,s32,void*);
|
||||
extern struct Object* spawn_object_relative(s16, s16, s16, s16, struct Object *, s32, const BehaviorScript *);
|
||||
extern struct Object* spawn_object_relative_with_scale(s16,s16,s16,s16,f32,struct Object *,s32,const BehaviorScript *);
|
||||
// extern ? obj_move_using_vel(?);
|
||||
extern void copy_object_graph_y_offset(struct Object*,struct Object*);
|
||||
extern void copy_object_pos_and_angle(struct Object *, struct Object *);
|
||||
@@ -225,14 +224,14 @@ extern void obj_set_pos_relative(struct Object *MarioObj, f32, f32, f32);
|
||||
extern void obj_enable_rendering_2(void);
|
||||
// extern ? obj_unused_init_on_floor(?);
|
||||
extern void obj_set_facing_to_move_angles(struct Object *);
|
||||
u32 get_object_list_from_behavior(uintptr_t *behavior);
|
||||
extern struct Object *obj_nearest_object_with_behavior(void *);
|
||||
f32 obj_dist_to_nearest_object_with_behavior(void*);
|
||||
extern struct Object *obj_find_nearest_object_with_behavior(void *, f32 *);
|
||||
u32 get_object_list_from_behavior(const BehaviorScript *behavior);
|
||||
extern struct Object *obj_nearest_object_with_behavior(const BehaviorScript *);
|
||||
f32 obj_dist_to_nearest_object_with_behavior(const BehaviorScript*);
|
||||
extern struct Object *obj_find_nearest_object_with_behavior(const BehaviorScript *, f32 *);
|
||||
extern struct Object *find_unimportant_object(void);
|
||||
// extern ? count_unimportant_objects(?);
|
||||
// extern ? count_objects_with_behavior(?);
|
||||
struct Object* obj_find_nearby_held_actor(void*,f32);
|
||||
extern s32 count_objects_with_behavior(const BehaviorScript *behavior);
|
||||
struct Object* obj_find_nearby_held_actor(const BehaviorScript *,f32);
|
||||
// extern ? obj_reset_timer_and_subaction(?);
|
||||
void obj_change_action(s32);
|
||||
void func_8029F684(f32,f32);
|
||||
@@ -275,10 +274,10 @@ extern void obj_move_y_with_terminal_vel(void);
|
||||
void obj_compute_vel_xz(void);
|
||||
f32 func_802A0BF4(f32,f32,f32,f32);
|
||||
extern s32 are_objects_collided(struct Object *, struct Object *);
|
||||
void obj_set_behavior(void*);
|
||||
void set_object_behavior(struct Object*,void*);
|
||||
extern s32 obj_has_behavior(u32 *);
|
||||
s32 object_has_behavior(struct Object*,u32*);
|
||||
void obj_set_behavior(const BehaviorScript *);
|
||||
void set_object_behavior(struct Object *, const BehaviorScript *);
|
||||
extern s32 obj_has_behavior(const BehaviorScript *);
|
||||
s32 object_has_behavior(struct Object *, const BehaviorScript *);
|
||||
f32 obj_lateral_dist_from_mario_to_home(void);
|
||||
extern f32 obj_lateral_dist_to_home(void);
|
||||
// extern ? obj_outside_home_square(?);
|
||||
|
||||
@@ -52,10 +52,10 @@ extern void bhv_init_room(void); // 802A3978
|
||||
extern void obj_enable_rendering_if_mario_in_room(void);
|
||||
s32 obj_set_hitbox_and_die_if_attacked(struct ObjectHitbox*,s32,s32);
|
||||
void func_802A3C98(f32 sp18, s32 sp1C);
|
||||
void set_object_collision_data(struct Object*,void*);
|
||||
void set_object_collision_data(struct Object*, const void*);
|
||||
void obj_if_hit_wall_bounce_away(void);
|
||||
s32 obj_hide_if_mario_far_away_y(f32);
|
||||
// extern ? Geo18_802A45E4(?);
|
||||
extern Gfx *Geo18_802A45E4(s32 run, struct GraphNode *node, UNUSED f32 mtx[4][4]);
|
||||
// extern ? Unknown802A3E84(?);
|
||||
s32 obj_is_hidden(struct Object*);
|
||||
extern void enable_time_stop(void);
|
||||
|
||||
@@ -112,7 +112,7 @@ struct Object *gCurrentObject;
|
||||
/**
|
||||
* The next object behavior command to be executed.
|
||||
*/
|
||||
uintptr_t *gBehCommand;
|
||||
const BehaviorScript *gBehCommand;
|
||||
|
||||
/**
|
||||
* The number of objects that were processed last frame, which may miss some
|
||||
@@ -171,7 +171,7 @@ struct ParticleProperties {
|
||||
u32 particleFlag;
|
||||
u32 activeParticleFlag;
|
||||
u8 model;
|
||||
void *behavior;
|
||||
const BehaviorScript *behavior;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -234,7 +234,7 @@ void copy_mario_state_to_object(void) {
|
||||
/**
|
||||
* Spawn a particle at gCurrentObject's location.
|
||||
*/
|
||||
void spawn_particle(u32 activeParticleFlag, s16 model, void *behavior) {
|
||||
void spawn_particle(u32 activeParticleFlag, s16 model, const BehaviorScript *behavior) {
|
||||
if (!(gCurrentObject->oActiveParticleFlags & activeParticleFlag)) {
|
||||
struct Object *particle;
|
||||
gCurrentObject->oActiveParticleFlags |= activeParticleFlag;
|
||||
@@ -453,7 +453,7 @@ void spawn_objects_from_info(UNUSED s32 unused, struct SpawnInfo *spawnInfo) {
|
||||
while (spawnInfo != NULL) {
|
||||
struct Object *object;
|
||||
UNUSED s32 unused;
|
||||
void *script;
|
||||
const BehaviorScript *script;
|
||||
UNUSED s16 arg16 = (s16)(spawnInfo->behaviorArg & 0xFFFF);
|
||||
|
||||
script = segmented_to_virtual(spawnInfo->behaviorScript);
|
||||
@@ -482,7 +482,7 @@ void spawn_objects_from_info(UNUSED s32 unused, struct SpawnInfo *spawnInfo) {
|
||||
geo_make_first_child(&object->header.gfx.node);
|
||||
}
|
||||
|
||||
geo_obj_init_spawninfo((struct GraphNodeObject *) object, spawnInfo);
|
||||
geo_obj_init_spawninfo(&object->header.gfx, spawnInfo);
|
||||
|
||||
object->oPosX = spawnInfo->startPos[0];
|
||||
object->oPosY = spawnInfo->startPos[1];
|
||||
|
||||
@@ -86,7 +86,7 @@ extern struct Object *gMarioObject;
|
||||
extern struct Object *gLuigiObject;
|
||||
extern struct Object *gCurrentObject;
|
||||
|
||||
extern uintptr_t *gBehCommand;
|
||||
extern const BehaviorScript *gBehCommand;
|
||||
extern s16 gPrevFrameObjectCount;
|
||||
|
||||
extern s32 gSurfaceNodesAllocated;
|
||||
|
||||
+62
-63
@@ -9,7 +9,6 @@
|
||||
#include "engine/graph_node.h"
|
||||
#include "geo_misc.h"
|
||||
#include "area.h"
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "segment2.h"
|
||||
#include "paintings.h"
|
||||
|
||||
@@ -17,26 +16,26 @@ s16 gPaintingMarioFloorType;
|
||||
float gPaintingMarioXPos, gPaintingMarioYPos, gPaintingMarioZPos;
|
||||
struct Thing *D_8035FFA0;
|
||||
float (*D_8035FFA4)[3]; // TODO: Use struct
|
||||
struct PaintingData *ripplingPainting;
|
||||
struct Painting *ripplingPainting;
|
||||
s8 dddStatus;
|
||||
|
||||
struct PaintingData *hmcPaintings[] = {
|
||||
cotmc_painting,
|
||||
struct Painting *hmcPaintings[] = {
|
||||
&cotmc_painting,
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct PaintingData *insideCastlePaintings[] = {
|
||||
bob_painting, ccm_painting, wf_painting, jrb_painting, lll_painting,
|
||||
ssl_painting, hmc_painting, ddd_painting, wdw_painting, thi_tiny_painting,
|
||||
ttm_painting, ttc_painting, sl_painting, thi_huge_painting, NULL,
|
||||
struct Painting *insideCastlePaintings[] = {
|
||||
&bob_painting, &ccm_painting, &wf_painting, &jrb_painting, &lll_painting,
|
||||
&ssl_painting, &hmc_painting, &ddd_painting, &wdw_painting, &thi_tiny_painting,
|
||||
&ttm_painting, &ttc_painting, &sl_painting, &thi_huge_painting, NULL,
|
||||
};
|
||||
|
||||
struct PaintingData *ttmPaintings[] = {
|
||||
ttm_slide_painting,
|
||||
struct Painting *ttmPaintings[] = {
|
||||
&ttm_slide_painting,
|
||||
NULL,
|
||||
};
|
||||
|
||||
struct PaintingData **paintingGroups[] = {
|
||||
struct Painting **paintingGroups[] = {
|
||||
hmcPaintings,
|
||||
insideCastlePaintings,
|
||||
ttmPaintings,
|
||||
@@ -45,14 +44,14 @@ struct PaintingData **paintingGroups[] = {
|
||||
s16 gPaintingUpdateCounter = 1;
|
||||
s16 gLastPaintingUpdateCounter = 0;
|
||||
|
||||
void stopAllRippleExcept(s16 *idptr, struct PaintingData *paintingGroup[]) {
|
||||
void stopAllRippleExcept(s16 *idptr, struct Painting *paintingGroup[]) {
|
||||
s16 index;
|
||||
s16 id = *idptr;
|
||||
|
||||
index = 0;
|
||||
while (paintingGroup[index] != NULL) // for each painting
|
||||
{
|
||||
struct PaintingData *painting = segmented_to_virtual(paintingGroup[index]);
|
||||
struct Painting *painting = segmented_to_virtual(paintingGroup[index]);
|
||||
if (painting->id != id) {
|
||||
painting->rippleStatus = 0; // stop all rippling except for the selected painting
|
||||
}
|
||||
@@ -60,7 +59,7 @@ void stopAllRippleExcept(s16 *idptr, struct PaintingData *paintingGroup[]) {
|
||||
}
|
||||
}
|
||||
|
||||
float find_mario_y_position_on_painting(struct PaintingData *painting) {
|
||||
float find_mario_y_position_on_painting(struct Painting *painting) {
|
||||
//! unnecessary use of double constants
|
||||
float marioYOffsetFromPainting = gPaintingMarioYPos - painting->vYPos + 50.0;
|
||||
|
||||
@@ -73,7 +72,7 @@ float find_mario_y_position_on_painting(struct PaintingData *painting) {
|
||||
return marioYOffsetFromPainting;
|
||||
}
|
||||
|
||||
float find_mario_z_position_on_painting(struct PaintingData *painting) {
|
||||
float find_mario_z_position_on_painting(struct Painting *painting) {
|
||||
float marioZOffsetFromPainting = painting->vZPos - gPaintingMarioZPos;
|
||||
|
||||
if (marioZOffsetFromPainting < 0.0) {
|
||||
@@ -85,7 +84,7 @@ float find_mario_z_position_on_painting(struct PaintingData *painting) {
|
||||
return marioZOffsetFromPainting;
|
||||
}
|
||||
|
||||
float painting_find_vertical_ripple_location(struct PaintingData *painting, s8 rippleSpot) {
|
||||
float painting_find_vertical_ripple_location(struct Painting *painting, s8 rippleSpot) {
|
||||
switch (rippleSpot) {
|
||||
case MARIO_Y:
|
||||
return find_mario_y_position_on_painting(painting); // normal vertical paintings
|
||||
@@ -99,7 +98,7 @@ float painting_find_vertical_ripple_location(struct PaintingData *painting, s8 r
|
||||
}
|
||||
}
|
||||
|
||||
float find_part_of_painting_near_mario(struct PaintingData *painting) {
|
||||
float find_part_of_painting_near_mario(struct Painting *painting) {
|
||||
float firstQuarter = painting->vSize / 4.0; // 1/4 of the way across the painting
|
||||
float secondQuarter = painting->vSize / 2.0; // 1/2 of the way across the painting
|
||||
float thirdQuarter = painting->vSize * 3.0 / 4.0; // 3/4 of the way across the painting
|
||||
@@ -119,7 +118,7 @@ float find_part_of_painting_near_mario(struct PaintingData *painting) {
|
||||
}
|
||||
}
|
||||
|
||||
float find_mario_x_position_on_painting(struct PaintingData *painting) {
|
||||
float find_mario_x_position_on_painting(struct Painting *painting) {
|
||||
float mario_x_offset_from_painting = gPaintingMarioXPos - painting->vXPos;
|
||||
|
||||
if (mario_x_offset_from_painting < 0.0) {
|
||||
@@ -131,7 +130,7 @@ float find_mario_x_position_on_painting(struct PaintingData *painting) {
|
||||
return mario_x_offset_from_painting;
|
||||
}
|
||||
|
||||
float painting_find_horizontal_ripple_location(struct PaintingData *painting, s8 rippleSpot) {
|
||||
float painting_find_horizontal_ripple_location(struct Painting *painting, s8 rippleSpot) {
|
||||
switch (rippleSpot) {
|
||||
case NEAR_MARIO_LATERALLY: // normal vertical paintings
|
||||
return find_part_of_painting_near_mario(painting);
|
||||
@@ -145,8 +144,8 @@ float painting_find_horizontal_ripple_location(struct PaintingData *painting, s8
|
||||
}
|
||||
}
|
||||
|
||||
void painting_set_ripple_type(s8 intendedStatus, struct PaintingData *painting,
|
||||
struct PaintingData *paintingGroup[], s8 hRippleSpot, s8 vRippleSpot,
|
||||
void painting_set_ripple_type(s8 intendedStatus, struct Painting *painting,
|
||||
struct Painting *paintingGroup[], s8 hRippleSpot, s8 vRippleSpot,
|
||||
s8 resetTimer) {
|
||||
stopAllRippleExcept(&painting->id, paintingGroup); // make sure no other paintings are rippling
|
||||
switch (intendedStatus) // set the variables necessary for the given ripple status
|
||||
@@ -176,8 +175,8 @@ void painting_set_ripple_type(s8 intendedStatus, struct PaintingData *painting,
|
||||
}
|
||||
|
||||
void vertical_proximity_ripple_painting_ripple(
|
||||
struct PaintingData *painting,
|
||||
struct PaintingData
|
||||
struct Painting *painting,
|
||||
struct Painting
|
||||
*paintingGroup[]) // For paintings aligned vertically that follow RIPPLE_TRIGGER_PROXIMITY, set
|
||||
// some flags depending on where Mario is
|
||||
{
|
||||
@@ -203,8 +202,8 @@ void vertical_proximity_ripple_painting_ripple(
|
||||
}
|
||||
|
||||
void vertical_proximity_ripple_painting_ripple_if_mario_enters(
|
||||
struct PaintingData *painting,
|
||||
struct PaintingData *paintingGroup[]) // For paintings aligned vertically that follow
|
||||
struct Painting *painting,
|
||||
struct Painting *paintingGroup[]) // For paintings aligned vertically that follow
|
||||
// RIPPLE_TRIGGER_PROXIMITY, set some flags if Mario enters
|
||||
{
|
||||
if (painting->floorEntered & ENTER_LEFT) {
|
||||
@@ -220,8 +219,8 @@ void vertical_proximity_ripple_painting_ripple_if_mario_enters(
|
||||
}
|
||||
|
||||
void vertical_continuous_ripple_painting_ripple(
|
||||
struct PaintingData *painting,
|
||||
struct PaintingData
|
||||
struct Painting *painting,
|
||||
struct Painting
|
||||
*paintingGroup[]) // For paintings aligned vertically that follow RIPPLE_TRIGGER_CONTINUOUS (DDD
|
||||
// only), set some flags depending on where Mario is
|
||||
{
|
||||
@@ -247,8 +246,8 @@ void vertical_continuous_ripple_painting_ripple(
|
||||
}
|
||||
|
||||
void vertical_continuous_ripple_painting_ripple_if_mario_enters(
|
||||
struct PaintingData *painting,
|
||||
struct PaintingData
|
||||
struct Painting *painting,
|
||||
struct Painting
|
||||
*paintingGroup[]) // For paintings aligned vertically that follow RIPPLE_TRIGGER_CONTINUOUS (DDD
|
||||
// only), set some flags if Mario enters
|
||||
{
|
||||
@@ -265,8 +264,8 @@ void vertical_continuous_ripple_painting_ripple_if_mario_enters(
|
||||
}
|
||||
|
||||
void horizontal_proximity_ripple_painting_ripple(
|
||||
struct PaintingData *painting,
|
||||
struct PaintingData
|
||||
struct Painting *painting,
|
||||
struct Painting
|
||||
*paintingGroup[]) // For paintings aligned horizontally that follow RIPPLE_TRIGGER_PROXIMITY
|
||||
// (these are not found in-game), set some flags depending on where Mario is
|
||||
{
|
||||
@@ -294,8 +293,8 @@ void horizontal_proximity_ripple_painting_ripple(
|
||||
}
|
||||
|
||||
void horizontal_proximity_ripple_painting_ripple_if_mario_enters(
|
||||
struct PaintingData *painting,
|
||||
struct PaintingData
|
||||
struct Painting *painting,
|
||||
struct Painting
|
||||
*paintingGroup[]) // For paintings aligned horizontally that follow RIPPLE_TRIGGER_PROXIMITY
|
||||
// (these are not found in-game), set some flags if Mario enters
|
||||
{
|
||||
@@ -314,8 +313,8 @@ void horizontal_proximity_ripple_painting_ripple_if_mario_enters(
|
||||
}
|
||||
|
||||
void horizontal_continuous_ripple_painting_ripple(
|
||||
struct PaintingData *painting,
|
||||
struct PaintingData
|
||||
struct Painting *painting,
|
||||
struct Painting
|
||||
*paintingGroup[]) // For paintings aligned horizontally that follow RIPPLE_TRIGGER_CONTINUOUS
|
||||
// (HMC and CotMC), set some flags depending on where Mario is
|
||||
{
|
||||
@@ -341,8 +340,8 @@ void horizontal_continuous_ripple_painting_ripple(
|
||||
}
|
||||
|
||||
void horizontal_continuous_ripple_painting_ripple_if_mario_enters(
|
||||
struct PaintingData *painting,
|
||||
struct PaintingData
|
||||
struct Painting *painting,
|
||||
struct Painting
|
||||
*paintingGroup[]) // For paintings aligned horizontally that follow RIPPLE_TRIGGER_CONTINUOUS
|
||||
// (HMC and CotMC), set some flags if Mario enters
|
||||
{
|
||||
@@ -360,7 +359,7 @@ void horizontal_continuous_ripple_painting_ripple_if_mario_enters(
|
||||
}
|
||||
}
|
||||
|
||||
void painting_update_floors(struct PaintingData *painting) {
|
||||
void painting_update_floors(struct Painting *painting) {
|
||||
s16 paintingId = painting->id;
|
||||
s8 leftSideStand = 0;
|
||||
s8 middleStand = 0;
|
||||
@@ -415,7 +414,7 @@ void painting_update_floors(struct PaintingData *painting) {
|
||||
// this frame but wasn't last frame.
|
||||
}
|
||||
|
||||
void painting_update_ripple_status(struct PaintingData *painting) {
|
||||
void painting_update_ripple_status(struct Painting *painting) {
|
||||
if (gPaintingUpdateCounter != gLastPaintingUpdateCounter) {
|
||||
painting->currRippleMag *= painting->rippleMagMultiplier;
|
||||
painting->rippleTimer +=
|
||||
@@ -447,7 +446,7 @@ void painting_update_ripple_status(struct PaintingData *painting) {
|
||||
}
|
||||
}
|
||||
|
||||
s16 painting_calculate_point_ripple(struct PaintingData *painting, float xpos,
|
||||
s16 painting_calculate_point_ripple(struct Painting *painting, float xpos,
|
||||
float ypos) // note that xpos and ypos correspond to a point on the
|
||||
// face of the painting, not actual axes
|
||||
{
|
||||
@@ -483,7 +482,7 @@ s16 painting_calculate_point_ripple(struct PaintingData *painting, float xpos,
|
||||
}
|
||||
}
|
||||
|
||||
s16 painting_conditionally_calculate_point_ripple(struct PaintingData *painting, s16 condition,
|
||||
s16 painting_conditionally_calculate_point_ripple(struct Painting *painting, s16 condition,
|
||||
s16 xpos, s16 ypos) {
|
||||
s16 rippleHeight = 0;
|
||||
|
||||
@@ -493,7 +492,7 @@ s16 painting_conditionally_calculate_point_ripple(struct PaintingData *painting,
|
||||
return rippleHeight;
|
||||
}
|
||||
|
||||
void Print1(struct PaintingData *painting, s16 *b, s16 c) {
|
||||
void Print1(struct Painting *painting, s16 *b, s16 c) {
|
||||
s16 sp1E;
|
||||
|
||||
D_8035FFA0 = mem_pool_alloc(D_8033A124, c * sizeof(struct Thing));
|
||||
@@ -587,7 +586,7 @@ void func_802D39DC(s16 *a, s16 b) {
|
||||
}
|
||||
}
|
||||
|
||||
void *func_802D3CF0(u8 *img, s16 b, s16 c, s16 *d, s16 e, s16 f, u8 g) {
|
||||
void *func_802D3CF0(u8 *img, s16 tWidth, s16 tHeight, s16 *d, s16 e, s16 f, u8 g) {
|
||||
s16 sp9E;
|
||||
s16 sp9C;
|
||||
s16 sp9A;
|
||||
@@ -608,10 +607,10 @@ void *func_802D3CF0(u8 *img, s16 b, s16 c, s16 *d, s16 e, s16 f, u8 g) {
|
||||
|
||||
gDPSetTextureImage(sp7C++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, img);
|
||||
gDPTileSync(sp7C++);
|
||||
gDPSetTile(sp7C++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, 7, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
|
||||
G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPSetTile(sp7C++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0,
|
||||
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPLoadSync(sp7C++);
|
||||
gDPLoadBlock(sp7C++, 7, 0, 0, b * c - 1, (MAX(1, b * 2 / 8) + 2047) / MAX(1, b * 2 / 8));
|
||||
gDPLoadBlock(sp7C++, G_TX_LOADTILE, 0, 0, tWidth * tHeight - 1, CALC_DXT(tWidth, G_IM_SIZ_16b_BYTES))
|
||||
|
||||
for (sp9E = 0; sp9E < sp90; sp9E++) {
|
||||
sp9A = e * 3 + sp9E * 15 + 2;
|
||||
@@ -645,7 +644,7 @@ void *func_802D3CF0(u8 *img, s16 b, s16 c, s16 *d, s16 e, s16 f, u8 g) {
|
||||
return sp80;
|
||||
}
|
||||
|
||||
Gfx *func_802D43FC(struct PaintingData *painting) {
|
||||
Gfx *func_802D43FC(struct Painting *painting) {
|
||||
float sp4C = painting->vSize / DEFAULT_HEIGHT;
|
||||
Mtx *sp48 = alloc_display_list(sizeof(Mtx));
|
||||
Mtx *sp44 = alloc_display_list(sizeof(Mtx));
|
||||
@@ -662,16 +661,16 @@ Gfx *func_802D43FC(struct PaintingData *painting) {
|
||||
guRotate(sp44, painting->vYRotation, 0.0f, 1.0f, 0.0f);
|
||||
guScale(sp3C, sp4C, sp4C, sp4C);
|
||||
|
||||
gSPMatrix(sp34++, sp40, G_MTX_MODELVIEW | G_MTX_PUSH);
|
||||
gSPMatrix(sp34++, sp48, G_MTX_MODELVIEW | G_MTX_MUL);
|
||||
gSPMatrix(sp34++, sp44, G_MTX_MODELVIEW | G_MTX_MUL);
|
||||
gSPMatrix(sp34++, sp3C, G_MTX_MODELVIEW | G_MTX_MUL);
|
||||
gSPMatrix(sp34++, sp40, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH);
|
||||
gSPMatrix(sp34++, sp48, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
gSPMatrix(sp34++, sp44, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
gSPMatrix(sp34++, sp3C, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
gSPEndDisplayList(sp34);
|
||||
|
||||
return sp38;
|
||||
}
|
||||
|
||||
Gfx *func_802D45FC(struct PaintingData *painting) {
|
||||
Gfx *func_802D45FC(struct Painting *painting) {
|
||||
s16 sp66;
|
||||
s16 sp64;
|
||||
s16 sp62;
|
||||
@@ -706,7 +705,7 @@ Gfx *func_802D45FC(struct PaintingData *painting) {
|
||||
return sp48;
|
||||
}
|
||||
|
||||
Gfx *func_802D4874(struct PaintingData *painting) {
|
||||
Gfx *func_802D4874(struct Painting *painting) {
|
||||
s16 sp5E;
|
||||
s16 sp5C;
|
||||
s16 *sp58;
|
||||
@@ -736,7 +735,7 @@ Gfx *func_802D4874(struct PaintingData *painting) {
|
||||
return sp48;
|
||||
}
|
||||
|
||||
Gfx *display_painting_rippling(struct PaintingData *painting) {
|
||||
Gfx *display_painting_rippling(struct Painting *painting) {
|
||||
s16 *sp34 = segmented_to_virtual(seg2_triangle_mesh);
|
||||
s16 *sp30 = segmented_to_virtual(seg2_mesh_order);
|
||||
s16 sp2E = sp34[0];
|
||||
@@ -759,7 +758,7 @@ Gfx *display_painting_rippling(struct PaintingData *painting) {
|
||||
return sp28;
|
||||
}
|
||||
|
||||
Gfx *display_painting_not_rippling(struct PaintingData *painting) {
|
||||
Gfx *display_painting_not_rippling(struct Painting *painting) {
|
||||
Gfx *sp2C = alloc_display_list(4 * sizeof(Gfx));
|
||||
Gfx *sp28 = sp2C;
|
||||
|
||||
@@ -773,7 +772,7 @@ Gfx *display_painting_not_rippling(struct PaintingData *painting) {
|
||||
return sp2C;
|
||||
}
|
||||
|
||||
void reset_painting(struct PaintingData *painting) {
|
||||
void reset_painting(struct Painting *painting) {
|
||||
painting->lastFloor = 0;
|
||||
painting->currFloor = 0;
|
||||
painting->floorEntered = 0;
|
||||
@@ -783,7 +782,7 @@ void reset_painting(struct PaintingData *painting) {
|
||||
ripplingPainting = NULL;
|
||||
}
|
||||
|
||||
void update_ddd_painting(struct PaintingData *painting, float frontPos, float backPos,
|
||||
void update_ddd_painting(struct Painting *painting, float frontPos, float backPos,
|
||||
float speed) // Tells the DDD painting whether to move back
|
||||
{
|
||||
u32 dddFlags = save_file_get_star_flags(gCurrSaveFileNum - 1,
|
||||
@@ -822,7 +821,7 @@ struct Struct802D4E04 {
|
||||
u32 unk18; // the upper half is the painting's id
|
||||
};
|
||||
|
||||
void func_802D4E04(struct GraphNodeGenerated *a, struct PaintingData *b) {
|
||||
void func_802D4E04(struct GraphNodeGenerated *a, struct Painting *b) {
|
||||
switch (b->brightness) {
|
||||
case 0xFF: // brightest
|
||||
a->fnNode.node.flags = (a->fnNode.node.flags & 0xFF) | 0x100;
|
||||
@@ -833,7 +832,7 @@ void func_802D4E04(struct GraphNodeGenerated *a, struct PaintingData *b) {
|
||||
}
|
||||
}
|
||||
|
||||
Gfx *display_painting(struct PaintingData *painting) {
|
||||
Gfx *display_painting(struct Painting *painting) {
|
||||
switch (painting->rippleStatus) {
|
||||
case RIPPLE_STATE_NONE:
|
||||
return display_painting_not_rippling(painting);
|
||||
@@ -844,7 +843,7 @@ Gfx *display_painting(struct PaintingData *painting) {
|
||||
}
|
||||
}
|
||||
|
||||
void vertical_painting_ripple(struct PaintingData *painting, struct PaintingData *paintingGroup[]) {
|
||||
void vertical_painting_ripple(struct Painting *painting, struct Painting *paintingGroup[]) {
|
||||
if (painting->rippleTrigger
|
||||
== RIPPLE_TRIGGER_PROXIMITY) // make the painting ripple using a different function based on its
|
||||
// ripple trigger and status
|
||||
@@ -869,7 +868,7 @@ void vertical_painting_ripple(struct PaintingData *painting, struct PaintingData
|
||||
}
|
||||
}
|
||||
|
||||
void horizontal_painting_ripple(struct PaintingData *painting, struct PaintingData *paintingGroup[]) {
|
||||
void horizontal_painting_ripple(struct Painting *painting, struct Painting *paintingGroup[]) {
|
||||
if (painting->rippleTrigger
|
||||
== RIPPLE_TRIGGER_PROXIMITY) // make the painting ripple using a different function based on its
|
||||
// ripple trigger and status
|
||||
@@ -900,8 +899,8 @@ Gfx *Geo18_802D5B98(s32 run, struct GraphNode *node, UNUSED s32 c) {
|
||||
s32 sp28 = (sp2C->parameter >> 8) & 0xFF;
|
||||
s32 id = sp2C->parameter & 0xFF;
|
||||
Gfx *sp20 = NULL;
|
||||
struct PaintingData **paintingGroup = paintingGroups[sp28];
|
||||
struct PaintingData *painting = segmented_to_virtual(paintingGroup[id]);
|
||||
struct Painting **paintingGroup = paintingGroups[sp28];
|
||||
struct Painting *painting = segmented_to_virtual(paintingGroup[id]);
|
||||
|
||||
if (run != TRUE) {
|
||||
reset_painting(painting);
|
||||
|
||||
+36
-25
@@ -1,8 +1,6 @@
|
||||
#ifndef PAINTINGS_H
|
||||
#define PAINTINGS_H
|
||||
|
||||
#include "prevent_bss_reordering.h"
|
||||
|
||||
#define DEFAULT_HEIGHT 614.0
|
||||
|
||||
#define PAINTING_ID_DDD 7
|
||||
@@ -42,70 +40,80 @@
|
||||
#define DONT_RESET_TIMER -56
|
||||
#define RESET_TIMER 100
|
||||
|
||||
struct PaintingData
|
||||
struct Painting
|
||||
{
|
||||
s16 id;
|
||||
s8 faceCount;
|
||||
s8 rippleShape;
|
||||
|
||||
s8 lastFloor;
|
||||
s8 currFloor;
|
||||
s8 floorEntered;
|
||||
|
||||
s8 rippleStatus;
|
||||
|
||||
float vXRotation;
|
||||
float vYRotation;
|
||||
|
||||
float vXPos;
|
||||
float vYPos;
|
||||
float vZPos;
|
||||
|
||||
float currRippleMag;
|
||||
float passiveRippleMag;
|
||||
float entryRippleMag;
|
||||
|
||||
float rippleMagMultiplier;
|
||||
float passiveRippleMagMultiplier;
|
||||
float entryRippleMagMultiplier;
|
||||
|
||||
float currRippleRate;
|
||||
float passiveRippleRate;
|
||||
float entryRippleRate;
|
||||
|
||||
float dispersionFactor; // the rate at which the magnitude of the ripple decreases as you move farther from the central point of the ripple
|
||||
float passiveDispersionFactor;
|
||||
float entryDispersionFactor;
|
||||
|
||||
float rippleTimer;
|
||||
|
||||
float horizontalRippleSpot;
|
||||
float verticalRippleSpot;
|
||||
Gfx *displayList58;
|
||||
u16 **meshData;
|
||||
u8 **textureArray;
|
||||
|
||||
const Gfx *displayList58;
|
||||
const s16 *const *meshData;
|
||||
const u8 *const *textureArray;
|
||||
s16 textureWidth;
|
||||
s16 textureHeight;
|
||||
Gfx *displayList68;
|
||||
const Gfx *displayList68;
|
||||
s8 rippleTrigger;
|
||||
u8 brightness;
|
||||
s8 lastMarioUnderPainting;
|
||||
s8 currMarioUnderPainting;
|
||||
s8 marioNewlyUnderPainting;
|
||||
u8 filler71[3];
|
||||
float vSize;
|
||||
};
|
||||
|
||||
extern struct MemoryPool *D_8033A124;
|
||||
|
||||
extern struct PaintingData cotmc_painting[];
|
||||
extern struct Painting cotmc_painting;
|
||||
|
||||
extern struct PaintingData bob_painting[];
|
||||
extern struct PaintingData ccm_painting[];
|
||||
extern struct PaintingData wf_painting[];
|
||||
extern struct PaintingData jrb_painting[];
|
||||
extern struct PaintingData lll_painting[];
|
||||
extern struct PaintingData ssl_painting[];
|
||||
extern struct PaintingData hmc_painting[];
|
||||
extern struct PaintingData ddd_painting[];
|
||||
extern struct PaintingData wdw_painting[];
|
||||
extern struct PaintingData thi_tiny_painting[];
|
||||
extern struct PaintingData ttm_painting[];
|
||||
extern struct PaintingData ttc_painting[];
|
||||
extern struct PaintingData sl_painting[];
|
||||
extern struct PaintingData thi_huge_painting[];
|
||||
extern struct Painting bob_painting;
|
||||
extern struct Painting ccm_painting;
|
||||
extern struct Painting wf_painting;
|
||||
extern struct Painting jrb_painting;
|
||||
extern struct Painting lll_painting;
|
||||
extern struct Painting ssl_painting;
|
||||
extern struct Painting hmc_painting;
|
||||
extern struct Painting ddd_painting;
|
||||
extern struct Painting wdw_painting;
|
||||
extern struct Painting thi_tiny_painting;
|
||||
extern struct Painting ttm_painting;
|
||||
extern struct Painting ttc_painting;
|
||||
extern struct Painting sl_painting;
|
||||
extern struct Painting thi_huge_painting;
|
||||
|
||||
extern struct PaintingData ttm_slide_painting[];
|
||||
extern struct Painting ttm_slide_painting;
|
||||
|
||||
extern u16 gAreaUpdateCounter;
|
||||
extern float gPaintingMarioYEntry;
|
||||
@@ -121,7 +129,10 @@ struct Thing { //TODO: Give me a better name
|
||||
|
||||
extern struct Thing *D_8035FFA0;
|
||||
extern float (*D_8035FFA4)[3];
|
||||
extern struct PaintingData *ripplingPainting;
|
||||
extern struct Painting *ripplingPainting;
|
||||
extern s8 dddStatus;
|
||||
|
||||
extern Gfx *Geo18_802D5B98(s32 run, struct GraphNode *node, s32 c);
|
||||
extern Gfx *Geo18_802D5D0C(s32 run, struct GraphNode *node, f32 c[4][4]);
|
||||
|
||||
#endif /* PAINTINGS_H */
|
||||
|
||||
+3
-3
@@ -359,7 +359,7 @@ s8 char_to_glyph_index(char c) {
|
||||
* Adds an individual glyph to be rendered.
|
||||
*/
|
||||
void add_glyph_texture(s8 glyphIndex) {
|
||||
u32 *glyphs = segmented_to_virtual(main_hud_lut);
|
||||
const u8 *const *glyphs = segmented_to_virtual(main_hud_lut);
|
||||
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, glyphs[glyphIndex]);
|
||||
@@ -425,8 +425,8 @@ void render_text_labels(void) {
|
||||
}
|
||||
|
||||
guOrtho(mtx, 0.0f, SCREEN_WIDTH, 0.0f, SCREEN_HEIGHT, -10.0f, 10.0f, 1.0f);
|
||||
gSPPerspNormalize((Gfx *) (gDisplayListHead++), 0x0000FFFF);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD);
|
||||
gSPPerspNormalize((Gfx *) (gDisplayListHead++), 0xFFFF);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||
gSPDisplayList(gDisplayListHead++, dl_hud_img_begin);
|
||||
|
||||
for (i = 0; i < sTextLabelsCount; i++) {
|
||||
|
||||
+2
-2
@@ -57,7 +57,7 @@ void profiler_log_vblank_time(void) {
|
||||
}
|
||||
|
||||
// draw the specified profiler given the information passed.
|
||||
void draw_profiler_bar(s64 clock_base, s64 clock_start, s64 clock_end, s16 pos_y, u16 color) {
|
||||
void draw_profiler_bar(OSTime clock_base, OSTime clock_start, OSTime clock_end, s16 pos_y, u16 color) {
|
||||
s64 duration_start, duration_end;
|
||||
s32 rect_x1, rect_x2;
|
||||
|
||||
@@ -137,7 +137,7 @@ void draw_reference_profiler_bars(void) {
|
||||
void draw_profiler_mode_1(void) {
|
||||
s32 i;
|
||||
struct ProfilerFrameData *profiler;
|
||||
u64 clock_base;
|
||||
OSTime clock_base;
|
||||
|
||||
// the profiler logs 2 frames of data: last frame and current frame. Indexes are used
|
||||
// to keep track of the current frame, so the index is xor'd to retrieve the last frame's
|
||||
|
||||
@@ -71,51 +71,51 @@ struct RenderModeContainer {
|
||||
u32 modes[8];
|
||||
};
|
||||
|
||||
/* Rendermode settings for cycles 1 and 2 for layers 0-3. */
|
||||
/* Rendermode settings for cycle 1 for all 8 layers. */
|
||||
struct RenderModeContainer renderModeTable_1Cycle[2] = { { {
|
||||
G_RM_OPA_SURF,
|
||||
G_RM_AA_OPA_SURF,
|
||||
G_RM_AA_OPA_SURF,
|
||||
G_RM_AA_OPA_SURF,
|
||||
G_RM_AA_TEX_EDGE,
|
||||
G_RM_AA_XLU_SURF,
|
||||
G_RM_AA_XLU_SURF,
|
||||
G_RM_AA_XLU_SURF,
|
||||
} },
|
||||
{ {
|
||||
/* z-buffered */
|
||||
G_RM_ZB_OPA_SURF,
|
||||
G_RM_AA_ZB_OPA_SURF,
|
||||
G_RM_AA_ZB_OPA_DECAL,
|
||||
G_RM_AA_ZB_OPA_INTER,
|
||||
G_RM_AA_ZB_TEX_EDGE,
|
||||
G_RM_AA_ZB_XLU_SURF,
|
||||
G_RM_AA_ZB_XLU_DECAL,
|
||||
G_RM_AA_ZB_XLU_INTER,
|
||||
} } };
|
||||
G_RM_OPA_SURF,
|
||||
G_RM_AA_OPA_SURF,
|
||||
G_RM_AA_OPA_SURF,
|
||||
G_RM_AA_OPA_SURF,
|
||||
G_RM_AA_TEX_EDGE,
|
||||
G_RM_AA_XLU_SURF,
|
||||
G_RM_AA_XLU_SURF,
|
||||
G_RM_AA_XLU_SURF,
|
||||
} },
|
||||
{ {
|
||||
/* z-buffered */
|
||||
G_RM_ZB_OPA_SURF,
|
||||
G_RM_AA_ZB_OPA_SURF,
|
||||
G_RM_AA_ZB_OPA_DECAL,
|
||||
G_RM_AA_ZB_OPA_INTER,
|
||||
G_RM_AA_ZB_TEX_EDGE,
|
||||
G_RM_AA_ZB_XLU_SURF,
|
||||
G_RM_AA_ZB_XLU_DECAL,
|
||||
G_RM_AA_ZB_XLU_INTER,
|
||||
} } };
|
||||
|
||||
/* Rendermode settings for cycles 1 and 2 for layers 4-7. */
|
||||
/* Rendermode settings for cycle 2 for all 8 layers. */
|
||||
struct RenderModeContainer renderModeTable_2Cycle[2] = { { {
|
||||
G_RM_OPA_SURF2,
|
||||
G_RM_AA_OPA_SURF2,
|
||||
G_RM_AA_OPA_SURF2,
|
||||
G_RM_AA_OPA_SURF2,
|
||||
G_RM_AA_TEX_EDGE2,
|
||||
G_RM_AA_XLU_SURF2,
|
||||
G_RM_AA_XLU_SURF2,
|
||||
G_RM_AA_XLU_SURF2,
|
||||
} },
|
||||
{ {
|
||||
/* z-buffered */
|
||||
G_RM_ZB_OPA_SURF2,
|
||||
G_RM_AA_ZB_OPA_SURF2,
|
||||
G_RM_AA_ZB_OPA_DECAL2,
|
||||
G_RM_AA_ZB_OPA_INTER2,
|
||||
G_RM_AA_ZB_TEX_EDGE2,
|
||||
G_RM_AA_ZB_XLU_SURF2,
|
||||
G_RM_AA_ZB_XLU_DECAL2,
|
||||
G_RM_AA_ZB_XLU_INTER2,
|
||||
} } };
|
||||
G_RM_OPA_SURF2,
|
||||
G_RM_AA_OPA_SURF2,
|
||||
G_RM_AA_OPA_SURF2,
|
||||
G_RM_AA_OPA_SURF2,
|
||||
G_RM_AA_TEX_EDGE2,
|
||||
G_RM_AA_XLU_SURF2,
|
||||
G_RM_AA_XLU_SURF2,
|
||||
G_RM_AA_XLU_SURF2,
|
||||
} },
|
||||
{ {
|
||||
/* z-buffered */
|
||||
G_RM_ZB_OPA_SURF2,
|
||||
G_RM_AA_ZB_OPA_SURF2,
|
||||
G_RM_AA_ZB_OPA_DECAL2,
|
||||
G_RM_AA_ZB_OPA_INTER2,
|
||||
G_RM_AA_ZB_TEX_EDGE2,
|
||||
G_RM_AA_ZB_XLU_SURF2,
|
||||
G_RM_AA_ZB_XLU_DECAL2,
|
||||
G_RM_AA_ZB_XLU_INTER2,
|
||||
} } };
|
||||
|
||||
struct GraphNodeRoot *gCurGraphNodeRoot = NULL;
|
||||
struct GraphNodeMasterList *gCurGraphNodeMasterList = NULL;
|
||||
@@ -226,7 +226,7 @@ static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node)
|
||||
|
||||
guOrtho(mtx, left, right, bottom, top, -2.0f, 2.0f, 1.0f);
|
||||
gSPPerspNormalize(gDisplayListHead++, 0xFFFF);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||
|
||||
geo_process_node_and_siblings(node->node.children);
|
||||
}
|
||||
@@ -252,7 +252,7 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
|
||||
guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f);
|
||||
gSPPerspNormalize(gDisplayListHead++, perspNorm);
|
||||
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||
|
||||
gCurGraphNodeCamFrustum = node;
|
||||
geo_process_node_and_siblings(node->fnNode.node.children);
|
||||
@@ -312,7 +312,7 @@ static void geo_process_camera(struct GraphNodeCamera *node) {
|
||||
}
|
||||
mtxf_rotate_xy(rollMtx, node->rollScreen);
|
||||
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(rollMtx), G_MTX_PROJECTION);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(rollMtx), G_MTX_PROJECTION | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
|
||||
mtxf_lookat(cameraTransform, node->from, node->to, node->roll);
|
||||
mtxf_mul(gMatStack[gMatStackIndex + 1], cameraTransform, gMatStack[gMatStackIndex]);
|
||||
@@ -442,7 +442,7 @@ static void geo_process_billboard(struct GraphNodeBillboard *node) {
|
||||
gCurGraphNodeCamera->roll);
|
||||
if (gCurGraphNodeHeldObject != NULL) {
|
||||
mtxf_scale_vec3f(gMatStack[gMatStackIndex], gMatStack[gMatStackIndex],
|
||||
gCurGraphNodeHeldObject->objNode->scale);
|
||||
gCurGraphNodeHeldObject->objNode->header.gfx.scale);
|
||||
} else if (gCurGraphNodeObject != NULL) {
|
||||
mtxf_scale_vec3f(gMatStack[gMatStackIndex], gMatStack[gMatStackIndex],
|
||||
gCurGraphNodeObject->scale);
|
||||
@@ -479,7 +479,7 @@ static void geo_process_display_list(struct GraphNodeDisplayList *node) {
|
||||
*/
|
||||
static void geo_process_generated_list(struct GraphNodeGenerated *node) {
|
||||
if (node->fnNode.func != NULL) {
|
||||
s32 list = node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node,
|
||||
Gfx *list = node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node,
|
||||
(struct AllocOnlyPool *) gMatStack[gMatStackIndex]);
|
||||
|
||||
if (list != 0) {
|
||||
@@ -497,7 +497,7 @@ static void geo_process_generated_list(struct GraphNodeGenerated *node) {
|
||||
* rectangle is drawn instead.
|
||||
*/
|
||||
static void geo_process_background(struct GraphNodeBackground *node) {
|
||||
s32 list = 0;
|
||||
Gfx *list = NULL;
|
||||
|
||||
if (node->fnNode.func != NULL) {
|
||||
list = node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node,
|
||||
@@ -512,7 +512,7 @@ static void geo_process_background(struct GraphNodeBackground *node) {
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetCycleType(gfx++, G_CYC_FILL);
|
||||
gDPSetFillColor(gfx++, node->background);
|
||||
gDPFillRectangle(gfx++, 0, BORDER_HEIGHT, 319, 239 - BORDER_HEIGHT);
|
||||
gDPFillRectangle(gfx++, 0, BORDER_HEIGHT, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1 - BORDER_HEIGHT);
|
||||
gDPPipeSync(gfx++);
|
||||
gDPSetCycleType(gfx++, G_CYC_1CYCLE);
|
||||
gSPEndDisplayList(gfx++);
|
||||
@@ -611,8 +611,8 @@ void geo_set_animation_globals(struct GraphNodeObject_sub *node, s32 hasAnimatio
|
||||
|
||||
gCurrAnimFrame = node->animFrame;
|
||||
gCurAnimEnabled = (anim->flags & ANIM_FLAG_5) == 0;
|
||||
gCurrAnimAttribute = segmented_to_virtual(anim->index);
|
||||
gCurAnimData = segmented_to_virtual(anim->values);
|
||||
gCurrAnimAttribute = segmented_to_virtual((void *) anim->index);
|
||||
gCurAnimData = segmented_to_virtual((void *) anim->values);
|
||||
|
||||
if (anim->unk02 == 0) {
|
||||
gCurAnimTranslationMultiplier = 1.0f;
|
||||
@@ -866,8 +866,8 @@ void geo_process_held_object(struct GraphNodeHeldObject *node) {
|
||||
if (node->fnNode.func != NULL) {
|
||||
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
|
||||
}
|
||||
if (node->objNode != NULL && node->objNode->sharedChild != NULL) {
|
||||
s32 hasAnimation = (node->objNode->node.flags & GRAPH_RENDER_HAS_ANIMATION) != 0;
|
||||
if (node->objNode != NULL && node->objNode->header.gfx.sharedChild != NULL) {
|
||||
s32 hasAnimation = (node->objNode->header.gfx.node.flags & GRAPH_RENDER_HAS_ANIMATION) != 0;
|
||||
|
||||
translation[0] = node->translation[0] / 4.0f;
|
||||
translation[1] = node->translation[1] / 4.0f;
|
||||
@@ -880,7 +880,7 @@ void geo_process_held_object(struct GraphNodeHeldObject *node) {
|
||||
gMatStack[gMatStackIndex + 1][3][2] = gMatStack[gMatStackIndex][3][2];
|
||||
mtxf_mul(gMatStack[gMatStackIndex + 1], mat, gMatStack[gMatStackIndex + 1]);
|
||||
mtxf_scale_vec3f(gMatStack[gMatStackIndex + 1], gMatStack[gMatStackIndex + 1],
|
||||
node->objNode->scale);
|
||||
node->objNode->header.gfx.scale);
|
||||
if (node->fnNode.func != NULL) {
|
||||
node->fnNode.func(GEO_CONTEXT_HELD_OBJ, &node->fnNode.node,
|
||||
(struct AllocOnlyPool *) gMatStack[gMatStackIndex + 1]);
|
||||
@@ -896,11 +896,11 @@ void geo_process_held_object(struct GraphNodeHeldObject *node) {
|
||||
gGeoTempState.data = gCurAnimData;
|
||||
gCurAnimType = 0;
|
||||
gCurGraphNodeHeldObject = (void *) node;
|
||||
if (node->objNode->unk38.curAnim != NULL) {
|
||||
geo_set_animation_globals(&node->objNode->unk38, hasAnimation);
|
||||
if (node->objNode->header.gfx.unk38.curAnim != NULL) {
|
||||
geo_set_animation_globals(&node->objNode->header.gfx.unk38, hasAnimation);
|
||||
}
|
||||
|
||||
geo_process_node_and_siblings(node->objNode->sharedChild);
|
||||
geo_process_node_and_siblings(node->objNode->header.gfx.sharedChild);
|
||||
gCurGraphNodeHeldObject = NULL;
|
||||
gCurAnimType = gGeoTempState.type;
|
||||
gCurAnimEnabled = gGeoTempState.enabled;
|
||||
@@ -1053,7 +1053,7 @@ void geo_process_root(struct GraphNodeRoot *node, Vp *b, Vp *c, s32 clearColor)
|
||||
gMatStackFixed[gMatStackIndex] = initialMatrix;
|
||||
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(viewport));
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(gMatStackFixed[gMatStackIndex]),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||
gCurGraphNodeRoot = node;
|
||||
if (node->node.children != NULL) {
|
||||
geo_process_node_and_siblings(node->node.children);
|
||||
|
||||
@@ -60,12 +60,12 @@ s32 func_802CAF38(s8 a0, u8 a1, struct WarpTransitionData *transData, u8 alpha)
|
||||
Vtx *verts = func_802CADB4(transData, alpha);
|
||||
|
||||
if (verts != NULL) {
|
||||
gSPDisplayList(gDisplayListHead++, dl_proj_mtx_fullscreen)
|
||||
gDPSetCombine(gDisplayListHead++, 0xFFFFFF, 0xFFFE793C)
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2)
|
||||
gSPVertex(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(verts), 4, 0)
|
||||
gSPDisplayList(gDisplayListHead++, dl_draw_quad_verts_0123)
|
||||
gSPDisplayList(gDisplayListHead++, dl_screen_transition_end)
|
||||
gSPDisplayList(gDisplayListHead++, dl_proj_mtx_fullscreen);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
|
||||
gSPVertex(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(verts), 4, 0);
|
||||
gSPDisplayList(gDisplayListHead++, dl_draw_quad_verts_0123);
|
||||
gSPDisplayList(gDisplayListHead++, dl_screen_transition_end);
|
||||
}
|
||||
return func_802CAAE0(a0, a1);
|
||||
}
|
||||
@@ -173,43 +173,31 @@ s32 func_802CB9F8(s8 spBB, s8 spBF, struct WarpTransitionData *transData, s8 spC
|
||||
|
||||
if (spA8 != NULL) {
|
||||
func_802CB6A0(spA8, spBB, transData, spB0, spAE, spAC, spCB); // TODO types
|
||||
gSPDisplayList(gDisplayListHead++, dl_proj_mtx_fullscreen) gDPSetCombine(gDisplayListHead++,
|
||||
0xFFFFFF, 0xFFFE793C)
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2)
|
||||
gSPVertex(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(spA8), 8, 0)
|
||||
gSPDisplayList(gDisplayListHead++, dl_transition_draw_filled_region) gDPPipeSync(
|
||||
gDisplayListHead++) gDPSetCombine(gDisplayListHead++, 0x127E24, 0xFFFFF3F9)
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2)
|
||||
gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP) switch (spCB) {
|
||||
case 0:
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, D_8032FF68[spC7])
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, 7, 0, G_TX_MIRROR,
|
||||
6, G_TX_NOLOD, G_TX_MIRROR, 5, G_TX_NOLOD)
|
||||
gDPLoadSync(gDisplayListHead++)
|
||||
gDPLoadBlock(gDisplayListHead++, 7, 0, 0, 1023, 512)
|
||||
gDPPipeSync(gDisplayListHead++)
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 4, 0, 0, 0,
|
||||
G_TX_MIRROR, 6, G_TX_NOLOD, G_TX_MIRROR, 5, G_TX_NOLOD)
|
||||
gDPSetTileSize(gDisplayListHead++, 0, 0, 0, 124, 252) break;
|
||||
case 1:
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, D_8032FF68[spC7])
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, 7, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, 6, G_TX_NOLOD,
|
||||
G_TX_NOMIRROR | G_TX_WRAP | G_TX_CLAMP, 6, G_TX_NOLOD)
|
||||
gDPLoadSync(gDisplayListHead++)
|
||||
gDPLoadBlock(gDisplayListHead++, 7, 0, 0, 2047, 256)
|
||||
gDPPipeSync(gDisplayListHead++)
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 0, 0, 0,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, 6, G_TX_NOLOD,
|
||||
G_TX_NOMIRROR | G_TX_WRAP | G_TX_CLAMP, 6, G_TX_NOLOD)
|
||||
gDPSetTileSize(gDisplayListHead++, 0, 0, 0, 252, 252) break;
|
||||
gSPDisplayList(gDisplayListHead++, dl_proj_mtx_fullscreen);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_OPA_SURF, G_RM_AA_OPA_SURF2);
|
||||
gSPVertex(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(spA8), 8, 0);
|
||||
gSPDisplayList(gDisplayListHead++, dl_transition_draw_filled_region);
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2);
|
||||
gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP);
|
||||
switch (spCB) {
|
||||
case 0:
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_8032FF68[spC7], G_IM_FMT_IA, G_IM_SIZ_8b, 32, 64, 0,
|
||||
G_TX_WRAP | G_TX_MIRROR, G_TX_WRAP | G_TX_MIRROR, 5, 6, G_TX_NOLOD, G_TX_NOLOD);
|
||||
break;
|
||||
case 1:
|
||||
gDPLoadTextureBlock(gDisplayListHead++, D_8032FF68[spC7], G_IM_FMT_IA, G_IM_SIZ_8b, 64, 64, 0,
|
||||
G_TX_CLAMP, G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD);
|
||||
break;
|
||||
}
|
||||
gSPTexture(gDisplayListHead++, -1, -1, 0, 0, G_ON)
|
||||
gSPVertex(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(spA8), 4, 0)
|
||||
gSPDisplayList(gDisplayListHead++, dl_draw_quad_verts_0123)
|
||||
gSPTexture(gDisplayListHead++, -1, -1, 0, 0, G_OFF)
|
||||
gSPDisplayList(gDisplayListHead++, dl_screen_transition_end) D_8032FF64[spBB] +=
|
||||
transData->unk10;
|
||||
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||
gSPVertex(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(spA8), 4, 0);
|
||||
gSPDisplayList(gDisplayListHead++, dl_draw_quad_verts_0123);
|
||||
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
|
||||
gSPDisplayList(gDisplayListHead++, dl_screen_transition_end);
|
||||
D_8032FF64[spBB] += transData->unk10;
|
||||
} else {
|
||||
}
|
||||
return func_802CAAE0(spBB, spBF);
|
||||
@@ -261,20 +249,17 @@ Gfx *func_802CC2E8(void) {
|
||||
make_vertex(verts, 2, 320, 240, -1, 1152, 192, 0, 0, 0, 255);
|
||||
make_vertex(verts, 3, 0, 240, -1, -1152, 192, 0, 0, 0, 255);
|
||||
|
||||
gSPDisplayList(g++, dl_proj_mtx_fullscreen) gDPSetCombine(g++, 0x127E24, 0xFFFFF3F9)
|
||||
gDPSetTextureFilter(g++, G_TF_BILERP) gDPSetTextureImage(g++, G_IM_FMT_IA, G_IM_SIZ_16b, 1,
|
||||
D_8032FF68[1])
|
||||
gDPSetTile(g++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, 7, 0, G_TX_MIRROR | G_TX_WRAP, 6,
|
||||
G_TX_NOLOD, G_TX_MIRROR | G_TX_WRAP, 5, G_TX_NOLOD) gDPLoadSync(g++)
|
||||
gDPLoadBlock(g++, 7, 0, 0, 1023, 512) gDPPipeSync(g++)
|
||||
gDPSetTile(g++, G_IM_FMT_IA, G_IM_SIZ_8b, 4, 0, 0, 0, G_TX_MIRROR | G_TX_WRAP,
|
||||
6, G_TX_NOLOD, G_TX_MIRROR | G_TX_WRAP, 5, G_TX_NOLOD)
|
||||
gDPSetTileSize(g++, 0, 0, 0, 124, 252) gSPTexture(g++, -1, -1, 0, 0, G_ON)
|
||||
gSPVertex(g++, VIRTUAL_TO_PHYSICAL(verts), 4, 0)
|
||||
gSPDisplayList(g++, dl_draw_quad_verts_0123)
|
||||
gSPTexture(g++, -1, -1, 0, 0, G_OFF)
|
||||
gSPDisplayList(g++, dl_screen_transition_end)
|
||||
gSPEndDisplayList(g)
|
||||
gSPDisplayList(g++, dl_proj_mtx_fullscreen)
|
||||
gDPSetCombineMode(g++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
|
||||
gDPSetTextureFilter(g++, G_TF_BILERP);
|
||||
gDPLoadTextureBlock(g++, D_8032FF68[1], G_IM_FMT_IA, G_IM_SIZ_8b, 32, 64, 0,
|
||||
G_TX_WRAP | G_TX_MIRROR, G_TX_WRAP | G_TX_MIRROR, 5, 6, G_TX_NOLOD, G_TX_NOLOD);
|
||||
gSPTexture(g++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||
gSPVertex(g++, VIRTUAL_TO_PHYSICAL(verts), 4, 0);
|
||||
gSPDisplayList(g++, dl_draw_quad_verts_0123);
|
||||
gSPTexture(g++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
|
||||
gSPDisplayList(g++, dl_screen_transition_end);
|
||||
gSPEndDisplayList(g);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// extern ? func_802CB508(?);
|
||||
// extern ? func_802CB6A0(?);
|
||||
// extern ? func_802CB9F8(?);
|
||||
extern u32 func_802CC108();
|
||||
int func_802CC108(s8 sp23, s8 sp27, u8 sp2B, struct WarpTransitionData *sp2C);
|
||||
// extern ? func_802CC2E8(?);
|
||||
// extern ? Geo18_802CD1E8(?);
|
||||
extern Gfx *Geo18_802CD1E8(s32 run, struct GraphNode *node, UNUSED f32 mtx[4][4]);
|
||||
|
||||
#endif /* _SCREEN_TRANSITION_H */
|
||||
|
||||
+33
-23
@@ -8,10 +8,10 @@ extern u8 _segment2_mio0SegmentRomEnd[];
|
||||
|
||||
extern u8 seg2_level_name_table[];
|
||||
extern u8 seg2_act_name_table[];
|
||||
extern u8 dl_rgba16_text_begin[];
|
||||
extern u8 dl_rgba16_text_end[];
|
||||
extern u8 dl_ia8_text_begin[];
|
||||
extern u8 dl_ia8_text_end[];
|
||||
extern Gfx dl_rgba16_text_begin[];
|
||||
extern Gfx dl_rgba16_text_end[];
|
||||
extern Gfx dl_ia_text_begin[];
|
||||
extern Gfx dl_ia_text_end[];
|
||||
extern u8 texture_transition_star_half[];
|
||||
extern u8 texture_transition_circle_half[];
|
||||
extern u8 texture_transition_mario[];
|
||||
@@ -22,38 +22,48 @@ extern u8 texture_waterbox_jrb_water[];
|
||||
extern u8 texture_waterbox_unknown_water[];
|
||||
extern u8 texture_waterbox_lava[];
|
||||
extern Gfx dl_proj_mtx_fullscreen[];
|
||||
extern u8 dl_draw_quad_verts_0123[];
|
||||
extern Gfx dl_draw_quad_verts_0123[];
|
||||
extern Gfx dl_screen_transition_end[];
|
||||
extern Gfx dl_transition_draw_filled_region[];
|
||||
extern u8 dl_shadow_circle[];
|
||||
extern u8 dl_shadow_square[];
|
||||
extern u8 dl_shadow_9_verts[];
|
||||
extern u8 dl_shadow_4_verts[];
|
||||
extern u8 dl_shadow_end[];
|
||||
extern u8 dl_skybox_begin[];
|
||||
extern u8 dl_skybox_tex_settings[];
|
||||
extern u8 dl_skybox_end[];
|
||||
extern u8 dl_waterbox_ia16_begin[];
|
||||
extern Gfx dl_shadow_circle[];
|
||||
extern Gfx dl_shadow_square[];
|
||||
extern Gfx dl_shadow_9_verts[];
|
||||
extern Gfx dl_shadow_4_verts[];
|
||||
extern Gfx dl_shadow_end[];
|
||||
extern Gfx dl_skybox_begin[];
|
||||
extern Gfx dl_skybox_tile_tex_settings[];
|
||||
extern Gfx dl_skybox_end[];
|
||||
extern Gfx dl_waterbox_ia16_begin[];
|
||||
extern Gfx dl_waterbox_rgba16_begin[];
|
||||
extern Gfx dl_waterbox_end[];
|
||||
extern u8 dl_paintings_draw_ripples[];
|
||||
extern u8 dl_paintings_rippling_begin[];
|
||||
extern u8 dl_paintings_rippling_end[];
|
||||
extern u8 dl_paintings_env_mapped_begin[];
|
||||
extern u8 dl_paintings_env_mapped_end[];
|
||||
extern Gfx dl_paintings_draw_ripples[];
|
||||
extern Gfx dl_paintings_rippling_begin[];
|
||||
extern Gfx dl_paintings_rippling_end[];
|
||||
extern Gfx dl_paintings_env_mapped_begin[];
|
||||
extern Gfx dl_paintings_env_mapped_end[];
|
||||
extern u8 seg2_triangle_mesh[];
|
||||
extern u8 seg2_mesh_order[];
|
||||
extern u8* main_hud_lut[58];
|
||||
extern u8 dl_hud_img_load_tex_block[];
|
||||
extern u8 dl_hud_img_begin[];
|
||||
extern u8 dl_hud_img_end[];
|
||||
extern Gfx dl_hud_img_load_tex_block[];
|
||||
extern Gfx dl_hud_img_begin[];
|
||||
extern Gfx dl_hud_img_end[];
|
||||
extern void *main_font_lut[];
|
||||
extern Gfx dl_ia8_render_char[];
|
||||
extern Gfx dl_ia_text_tex_settings[];
|
||||
extern Gfx dl_rgba16_load_tex_block[];
|
||||
extern void *main_credits_font_lut[];
|
||||
extern u8* main_hud_camera_lut[6];
|
||||
extern Gfx dl_draw_text_bg_box[];
|
||||
extern Gfx dl_draw_triangle[];
|
||||
extern void *seg2_dialog_table[];
|
||||
extern Gfx dl_billboard_num_0[];
|
||||
extern Gfx dl_billboard_num_1[];
|
||||
extern Gfx dl_billboard_num_2[];
|
||||
extern Gfx dl_billboard_num_3[];
|
||||
extern Gfx dl_billboard_num_4[];
|
||||
extern Gfx dl_billboard_num_5[];
|
||||
extern Gfx dl_billboard_num_6[];
|
||||
extern Gfx dl_billboard_num_7[];
|
||||
extern Gfx dl_billboard_num_8[];
|
||||
extern Gfx dl_billboard_num_9[];
|
||||
|
||||
#endif /* SEGMENT2_H */
|
||||
|
||||
+239
-119
@@ -9,140 +9,241 @@
|
||||
#include "level_update.h"
|
||||
#include "geo_misc.h"
|
||||
|
||||
struct Struct8035FF50 {
|
||||
u16 unk0;
|
||||
s16 unk2;
|
||||
s32 unk4;
|
||||
s32 unk8;
|
||||
s32 unkC;
|
||||
|
||||
/**
|
||||
* @file skybox.c
|
||||
*
|
||||
* Implements the skybox background.
|
||||
*
|
||||
* It's not exactly a sky"box": it's more of a sky tilemap. It renders a 3x3 grid of 32x32 pieces of the
|
||||
* whole skybox image, starting from the top left based on the camera's rotation. A skybox image has 64
|
||||
* unique 32x32 tiles, with the first two columns duplicated for a total of 80.
|
||||
*
|
||||
* The tiles are mapped to world space such that 2 full tiles fit on the screen, for a total of
|
||||
* 8 tiles around the full 360 degrees. Each tile takes up 45 degrees of the camera's field of view, and
|
||||
* the code draws 3 tiles or 135 degrees of the skybox in a frame. But only 2 tiles, or 90 degrees, can
|
||||
* fit on-screen at a time.
|
||||
*
|
||||
* @bug FOV is handled strangely by the code. It is used to scale and rotate the skybox, when really it
|
||||
* should probably only be used to calculate the distance drawn from the center of the looked-at tile.
|
||||
* But since the game always sets it to 90 degrees, the skybox always scales and rotates the same,
|
||||
* regardless of the camera's actual FOV. So even if the camera's FOV is 10 degrees the game draws a
|
||||
* full 90 degrees of the skybox, which makes the sky look really far away.
|
||||
*
|
||||
* @bug Skyboxes unnecessarily repeat the first 2 columns when they could just wrap the col index.
|
||||
* Although, the wasted space is only about 128 bytes for each image.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes the position, tiles, and orientation of the skybox image.
|
||||
*
|
||||
* Describes the scaled x and y offset into the tilemap, based on the yaw and pitch. Computes the
|
||||
* upperLeftTile index into the skybox's tile list using scaledX and scaledY. See get_top_left_tile_idx.
|
||||
*
|
||||
* The skybox is always drawn behind everything, because in the level's geo script, the skybox is drawn
|
||||
* first, in a display list with the Z buffer disabled
|
||||
*/
|
||||
struct Skybox {
|
||||
/// The camera's yaw, from 0 to 65536, which maps to 0 to 360 degrees
|
||||
u16 yaw;
|
||||
/// The camera's pitch, which is bounded by +-16384, which maps to -90 to 90 degrees
|
||||
s16 pitch;
|
||||
/// The skybox's X position in world space
|
||||
s32 scaledX;
|
||||
/// The skybox's Y position in world space
|
||||
s32 scaledY;
|
||||
|
||||
/// The index of the upper-left tile in the 3x3 grid that gets drawn
|
||||
s32 upperLeftTile;
|
||||
};
|
||||
|
||||
struct Struct8032FFC8 {
|
||||
u8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 filler3[1];
|
||||
struct Skybox sSkyBoxInfo[2];
|
||||
|
||||
typedef const u8 *const SkyboxTexture[80];
|
||||
|
||||
extern SkyboxTexture bbh_skybox_ptrlist;
|
||||
extern SkyboxTexture bidw_skybox_ptrlist;
|
||||
extern SkyboxTexture bitfs_skybox_ptrlist;
|
||||
extern SkyboxTexture bits_skybox_ptrlist;
|
||||
extern SkyboxTexture ccm_skybox_ptrlist;
|
||||
extern SkyboxTexture cloud_floor_skybox_ptrlist;
|
||||
extern SkyboxTexture clouds_skybox_ptrlist;
|
||||
extern SkyboxTexture ssl_skybox_ptrlist;
|
||||
extern SkyboxTexture water_skybox_ptrlist;
|
||||
extern SkyboxTexture wdw_skybox_ptrlist;
|
||||
|
||||
SkyboxTexture *sSkyboxTextures[10] = {
|
||||
&water_skybox_ptrlist,
|
||||
&bitfs_skybox_ptrlist,
|
||||
&wdw_skybox_ptrlist,
|
||||
&cloud_floor_skybox_ptrlist,
|
||||
&ccm_skybox_ptrlist,
|
||||
&ssl_skybox_ptrlist,
|
||||
&bbh_skybox_ptrlist,
|
||||
&bidw_skybox_ptrlist,
|
||||
&clouds_skybox_ptrlist,
|
||||
&bits_skybox_ptrlist,
|
||||
};
|
||||
|
||||
struct SkyboxList {
|
||||
struct Gfx *ptr[50];
|
||||
};
|
||||
|
||||
extern struct SkyboxList water_skybox_ptrlist_0A020000;
|
||||
extern struct SkyboxList bitfs_skybox_ptrlist_0A018800;
|
||||
extern struct SkyboxList wdw_skybox_ptrlist_0A020000;
|
||||
extern struct SkyboxList cloud_floor_skybox_ptrlist_0A020000;
|
||||
extern struct SkyboxList ccm_skybox_ptrlist_0A020000;
|
||||
extern struct SkyboxList ssl_skybox_ptrlist_0A020000;
|
||||
extern struct SkyboxList bbh_skybox_ptrlist_0A014800;
|
||||
extern struct SkyboxList bidw_skybox_ptrlist_0A020000;
|
||||
extern struct SkyboxList clouds_skybox_ptrlist_0A014800;
|
||||
extern struct SkyboxList bits_skybox_ptrlist_0A020000;
|
||||
|
||||
// TODO: These should be defined here
|
||||
struct Struct8035FF50 D_8035FF50[2];
|
||||
|
||||
struct SkyboxList *gSkyboxLists[10] = {
|
||||
&water_skybox_ptrlist_0A020000, // water_skybox
|
||||
&bitfs_skybox_ptrlist_0A018800, // bitfs_skybox
|
||||
&wdw_skybox_ptrlist_0A020000, // wdw_skybox
|
||||
&cloud_floor_skybox_ptrlist_0A020000, // cloud_floor_skybox
|
||||
&ccm_skybox_ptrlist_0A020000, // ccm_skybox
|
||||
&ssl_skybox_ptrlist_0A020000, // ssl_skybox
|
||||
&bbh_skybox_ptrlist_0A014800, // bbh_skybox
|
||||
&bidw_skybox_ptrlist_0A020000, // bidw_skybox
|
||||
&clouds_skybox_ptrlist_0A014800, // clouds_skybox
|
||||
&bits_skybox_ptrlist_0A020000, // bits_skybox
|
||||
};
|
||||
u8 gSkyboxColors[][3] = {
|
||||
/**
|
||||
* The skybox color mask.
|
||||
* The final color of each pixel is computed from the bitwise AND of the color and the texture.
|
||||
*/
|
||||
u8 sSkyboxColors[][3] = {
|
||||
{ 0x50, 0x64, 0x5A },
|
||||
{ 0xFF, 0xFF, 0xFF },
|
||||
};
|
||||
|
||||
//! double literals are used instead of floats
|
||||
/**
|
||||
* Constant used to scale the skybox horizontally to a multiple of the screen's width
|
||||
*/
|
||||
#define SKYBOX_WIDTH (4 * SCREEN_WIDTH)
|
||||
/**
|
||||
* Constant used to scale the skybox vertically to a multiple of the screen's height
|
||||
*/
|
||||
#define SKYBOX_HEIGHT (4 * SCREEN_HEIGHT)
|
||||
|
||||
int func_802CEAD0(s8 a, f32 b) {
|
||||
f32 spC = D_8035FF50[a].unk0;
|
||||
f32 sp8 = (115200.0 * spC) / (b * 65536.0);
|
||||
s32 sp4 = sp8 + 0.5;
|
||||
/**
|
||||
* The tile's width in world space.
|
||||
* By default, two full tiles can fit in the screen.
|
||||
*/
|
||||
#define SKYBOX_TILE_WIDTH (SCREEN_WIDTH / 2)
|
||||
/**
|
||||
* The tile's height in world space.
|
||||
* By default, two full tiles can fit in the screen.
|
||||
*/
|
||||
#define SKYBOX_TILE_HEIGHT (SCREEN_HEIGHT / 2)
|
||||
|
||||
if (sp4 > 1280) {
|
||||
sp4 -= sp4 / 1280 * 1280;
|
||||
/**
|
||||
* The horizontal length of the skybox tilemap in tiles.
|
||||
*/
|
||||
#define SKYBOX_COLS (10)
|
||||
/**
|
||||
* The vertical length of the skybox tilemap in tiles.
|
||||
*/
|
||||
#define SKYBOX_ROWS (8)
|
||||
|
||||
|
||||
/**
|
||||
* Convert the camera's yaw into an x position into the scaled skybox image.
|
||||
*
|
||||
* fov is always 90 degrees, set in draw_skybox_facing_camera.
|
||||
*
|
||||
* The calculation performed is equivalent to (360 / fov) * (yaw / 65536) * SCREEN_WIDTH
|
||||
* in other words: (the number of fov-sized parts of the circle there are) *
|
||||
* (how far is the camera rotated from 0, scaled 0 to 1) *
|
||||
* (the screen width)
|
||||
*/
|
||||
int calculate_skybox_scaled_x(s8 player, f32 fov) {
|
||||
f32 yaw = sSkyBoxInfo[player].yaw;
|
||||
|
||||
//! double literals are used instead of floats
|
||||
f32 yawScaled = SCREEN_WIDTH * 360.0 * yaw / (fov * 65536.0);
|
||||
// Round the scaled yaw. Since yaw is a u16, it doesn't need to check for < 0
|
||||
s32 scaledX = yawScaled + 0.5;
|
||||
|
||||
if (scaledX > SKYBOX_WIDTH) {
|
||||
scaledX -= scaledX / SKYBOX_WIDTH * SKYBOX_WIDTH;
|
||||
}
|
||||
return 1280 - sp4;
|
||||
return SKYBOX_WIDTH - scaledX;
|
||||
}
|
||||
|
||||
int func_802CEBBC(s8 a, UNUSED f32 b) {
|
||||
f32 sp24 = (f32) D_8035FF50[a].unk2 * 360.0 / 65535.0;
|
||||
f32 sp20 = 360.0f * sp24 / 90.0;
|
||||
s32 sp1C = round_float(sp20);
|
||||
s32 sp18 = sp1C + 0x258;
|
||||
/**
|
||||
* Convert the camera's pitch into a y position in the scaled skybox image.
|
||||
*
|
||||
* fov may have been used in an earlier version, but the developers changed the function to always use
|
||||
* 90 degrees.
|
||||
*/
|
||||
int calculate_skybox_scaled_y(s8 player, UNUSED f32 fov) {
|
||||
// Convert pitch to degrees. Pitch is bounded between -90 (looking down) and 90 (looking up).
|
||||
f32 pitchInDegrees = (f32) sSkyBoxInfo[player].pitch * 360.0 / 65535.0;
|
||||
|
||||
if (sp18 > 960) {
|
||||
sp18 = 960;
|
||||
// Scale by 360 / fov
|
||||
f32 degreesToScale = 360.0f * pitchInDegrees / 90.0;
|
||||
s32 roundedY = round_float(degreesToScale);
|
||||
|
||||
// Since pitch can be negative, and the tile grid starts 1 octant above the camera's focus, add
|
||||
// 5 octants to the y position
|
||||
s32 scaledY = roundedY + 5 * SKYBOX_TILE_HEIGHT;
|
||||
|
||||
if (scaledY > SKYBOX_HEIGHT) {
|
||||
scaledY = SKYBOX_HEIGHT;
|
||||
}
|
||||
if (sp18 < 240) {
|
||||
sp18 = 240;
|
||||
if (scaledY < SCREEN_HEIGHT) {
|
||||
scaledY = SCREEN_HEIGHT;
|
||||
}
|
||||
return sp18;
|
||||
return scaledY;
|
||||
}
|
||||
|
||||
int func_802CEC9C(s8 a) {
|
||||
s32 sp4 = D_8035FF50[a].unk4 / 160;
|
||||
s32 sp0 = (960 - D_8035FF50[a].unk8) / 120;
|
||||
/**
|
||||
* Converts the upper left xPos and yPos to the index of the upper left tile in the skybox.
|
||||
*/
|
||||
static int get_top_left_tile_idx(s8 player) {
|
||||
s32 tileCol = sSkyBoxInfo[player].scaledX / SKYBOX_TILE_WIDTH;
|
||||
s32 tileRow = (SKYBOX_HEIGHT - sSkyBoxInfo[player].scaledY) / SKYBOX_TILE_HEIGHT;
|
||||
|
||||
return sp0 * 10 + sp4;
|
||||
return tileRow * SKYBOX_COLS + tileCol;
|
||||
}
|
||||
|
||||
// generates vertices for some rectangle
|
||||
Vtx *make_skybox_rect(s32 a, s8 b) {
|
||||
/**
|
||||
* Generates vertices for the skybox tile.
|
||||
*
|
||||
* @param tileIndex The index into the 32x32 sections of the whole skybox image. The index is converted
|
||||
* into an x and y by modulus and division by SKYBOX_COLS. x and y are then scaled by
|
||||
* SKYBOX_TILE_WIDTH to get a point in world space.
|
||||
*/
|
||||
Vtx *make_skybox_rect(s32 tileIndex, s8 colorIndex) {
|
||||
Vtx *verts = alloc_display_list(4 * sizeof(*verts));
|
||||
s16 x = a % 10 * 160;
|
||||
s16 y = 960 - a / 10 * 120;
|
||||
s16 x = tileIndex % SKYBOX_COLS * SKYBOX_TILE_WIDTH;
|
||||
s16 y = SKYBOX_HEIGHT - tileIndex / SKYBOX_COLS * SKYBOX_TILE_HEIGHT;
|
||||
|
||||
if (verts != NULL) {
|
||||
make_vertex(verts, 0, x, y, -1, 0, 0, gSkyboxColors[b][0], gSkyboxColors[b][1],
|
||||
gSkyboxColors[b][2], 255);
|
||||
make_vertex(verts, 1, x, y - 0x78, -1, 0, 992, gSkyboxColors[b][0], gSkyboxColors[b][1],
|
||||
gSkyboxColors[b][2], 255);
|
||||
make_vertex(verts, 2, x + 160, y - 0x78, -1, 992, 992, gSkyboxColors[b][0], gSkyboxColors[b][1],
|
||||
gSkyboxColors[b][2], 255);
|
||||
make_vertex(verts, 3, x + 160, y, -1, 992, 0, gSkyboxColors[b][0], gSkyboxColors[b][1],
|
||||
gSkyboxColors[b][2], 255);
|
||||
make_vertex(verts, 0, x, y, -1, 0, 0, sSkyboxColors[colorIndex][0], sSkyboxColors[colorIndex][1],
|
||||
sSkyboxColors[colorIndex][2], 255);
|
||||
make_vertex(verts, 1, x, y - SKYBOX_TILE_HEIGHT, -1, 0, 31 << 5, sSkyboxColors[colorIndex][0], sSkyboxColors[colorIndex][1],
|
||||
sSkyboxColors[colorIndex][2], 255);
|
||||
make_vertex(verts, 2, x + SKYBOX_TILE_WIDTH, y - SKYBOX_TILE_HEIGHT, -1, 31 << 5, 31 << 5, sSkyboxColors[colorIndex][0],
|
||||
sSkyboxColors[colorIndex][1], sSkyboxColors[colorIndex][2], 255);
|
||||
make_vertex(verts, 3, x + SKYBOX_TILE_WIDTH, y, -1, 31 << 5, 0, sSkyboxColors[colorIndex][0], sSkyboxColors[colorIndex][1],
|
||||
sSkyboxColors[colorIndex][2], 255);
|
||||
} else {
|
||||
}
|
||||
return verts;
|
||||
}
|
||||
|
||||
void func_802CEF4C(Gfx **dlist, s8 b, s8 c, s8 d) {
|
||||
s32 sp54;
|
||||
s32 sp50;
|
||||
/**
|
||||
* Draws a 3x3 grid of 32x32 sections of the original skybox image.
|
||||
* The row and column are converted into an index into the skybox's tile list, which is then drawn in
|
||||
* world space so that the tiles will rotate with the camera.
|
||||
*/
|
||||
void draw_skybox_tile_grid(Gfx **dlist, s8 background, s8 player, s8 colorIndex) {
|
||||
s32 row;
|
||||
s32 col;
|
||||
|
||||
for (sp54 = 0; sp54 < 3; sp54++) {
|
||||
for (sp50 = 0; sp50 < 3; sp50++) {
|
||||
s32 sp4C = D_8035FF50[c].unkC + sp54 * 10 + sp50;
|
||||
struct Gfx *sp48 =
|
||||
((struct SkyboxList *) segmented_to_virtual((void *) gSkyboxLists[b]))->ptr[sp4C];
|
||||
Vtx *vertices = make_skybox_rect(sp4C, d);
|
||||
for (row = 0; row < 3; row++) {
|
||||
for (col = 0; col < 3; col++) {
|
||||
s32 tileIndex = sSkyBoxInfo[player].upperLeftTile + row * SKYBOX_COLS + col;
|
||||
const u8 *const texture =
|
||||
(*(SkyboxTexture *) segmented_to_virtual(sSkyboxTextures[background]))[tileIndex];
|
||||
Vtx *vertices = make_skybox_rect(tileIndex, colorIndex);
|
||||
|
||||
// Why is the width 1 here?
|
||||
gDPSetTextureImage((*dlist)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, sp48);
|
||||
gDPSetTextureImage((*dlist)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, texture);
|
||||
gDPTileSync((*dlist)++);
|
||||
gDPSetTile((*dlist)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, 7, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPSetTile((*dlist)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0,
|
||||
G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPLoadSync((*dlist)++);
|
||||
gDPLoadBlock((*dlist)++, 7, 0, 0, 1023, 256);
|
||||
gDPLoadBlock((*dlist)++, G_TX_LOADTILE, 0, 0, 32 * 32 - 1, CALC_DXT(32, G_IM_SIZ_16b_BYTES));
|
||||
gSPVertex((*dlist)++, VIRTUAL_TO_PHYSICAL(vertices), 4, 0);
|
||||
gSPDisplayList((*dlist)++, dl_draw_quad_verts_0123);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void *func_802CF188(s8 a) {
|
||||
f32 left = D_8035FF50[a].unk4;
|
||||
f32 right = D_8035FF50[a].unk4 + 0x140;
|
||||
f32 bottom = D_8035FF50[a].unk8 - 0xF0;
|
||||
f32 top = D_8035FF50[a].unk8;
|
||||
void *create_skybox_ortho_matrix(s8 player) {
|
||||
f32 left = sSkyBoxInfo[player].scaledX;
|
||||
f32 right = sSkyBoxInfo[player].scaledX + SCREEN_WIDTH;
|
||||
f32 bottom = sSkyBoxInfo[player].scaledY - SCREEN_HEIGHT;
|
||||
f32 top = sSkyBoxInfo[player].scaledY;
|
||||
Mtx *mtx = alloc_display_list(sizeof(*mtx));
|
||||
|
||||
if (mtx != NULL) {
|
||||
@@ -153,42 +254,61 @@ void *func_802CF188(s8 a) {
|
||||
return mtx;
|
||||
}
|
||||
|
||||
Gfx *func_802CF2A8(s8 a, s8 b, s8 c) {
|
||||
s32 sp3C = 5 + 3*3*7;
|
||||
void *sp38 = alloc_display_list(sp3C * sizeof(Gfx));
|
||||
Gfx *dlist = sp38;
|
||||
/**
|
||||
* Creates the skybox's display list, then draws the 3x3 grid of tiles.
|
||||
*/
|
||||
Gfx *init_skybox_display_list(s8 player, s8 background, s8 colorIndex) {
|
||||
s32 dlCommandCount = 5 + 9 * 7; // 5 for the start and end, plus 9 skybox tiles
|
||||
void *skybox = alloc_display_list(dlCommandCount * sizeof(Gfx));
|
||||
Gfx *dlist = skybox;
|
||||
|
||||
if (sp38 == NULL) {
|
||||
if (skybox == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
Mtx *mtx = func_802CF188(a);
|
||||
Mtx *ortho = create_skybox_ortho_matrix(player);
|
||||
|
||||
gSPDisplayList(dlist++, dl_skybox_begin);
|
||||
gSPMatrix(dlist++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_MUL);
|
||||
gSPDisplayList(dlist++, dl_skybox_tex_settings);
|
||||
func_802CEF4C(&dlist, b, a, c);
|
||||
gSPMatrix(dlist++, VIRTUAL_TO_PHYSICAL(ortho), G_MTX_PROJECTION | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
gSPDisplayList(dlist++, dl_skybox_tile_tex_settings);
|
||||
draw_skybox_tile_grid(&dlist, background, player, colorIndex);
|
||||
gSPDisplayList(dlist++, dl_skybox_end);
|
||||
gSPEndDisplayList(dlist);
|
||||
}
|
||||
return sp38;
|
||||
return skybox;
|
||||
}
|
||||
|
||||
Gfx *func_802CF414(s8 a, s8 b, f32 c, f32 d, f32 e, f32 f, f32 g, f32 h, f32 i) {
|
||||
f32 sp34 = g - d;
|
||||
f32 sp30 = h - e;
|
||||
f32 sp2C = i - f;
|
||||
s8 sp2B = 1;
|
||||
/**
|
||||
* Draw a skybox facing the direction from pos to foc.
|
||||
*
|
||||
* @param player Unused, determines which orientation info struct to update
|
||||
* @param background The skybox image to use
|
||||
* @param fov Unused. It SHOULD control how much the skybox is scaled, but the way it's coded it just
|
||||
* controls how fast the skybox rotates. The given value is replaced with 90 right before the
|
||||
* dl is created
|
||||
* @param posX,posY,posZ The camera's position
|
||||
* @param focX,focY,focZ The camera's focus.
|
||||
*/
|
||||
Gfx *create_skybox_facing_camera(s8 player, s8 background, f32 fov,
|
||||
f32 posX, f32 posY, f32 posZ,
|
||||
f32 focX, f32 focY, f32 focZ) {
|
||||
f32 cameraFaceX = focX - posX;
|
||||
f32 cameraFaceY = focY - posY;
|
||||
f32 cameraFaceZ = focZ - posZ;
|
||||
s8 colorIndex = 1;
|
||||
|
||||
if (b == 8 && !(save_file_get_star_flags(gCurrSaveFileNum - 1, 2) & 1)) {
|
||||
sp2B = 0;
|
||||
// If the first star is collected in JRB, make the sky darker and slightly green
|
||||
if (background == 8 && !(save_file_get_star_flags(gCurrSaveFileNum - 1, COURSE_JRB - 1) & 1)) {
|
||||
colorIndex = 0;
|
||||
}
|
||||
|
||||
c = 90.0f;
|
||||
D_8035FF50[a].unk0 = atan2s(sp2C, sp34);
|
||||
D_8035FF50[a].unk2 = atan2s(sqrtf(sp34 * sp34 + sp2C * sp2C), sp30);
|
||||
D_8035FF50[a].unk4 = func_802CEAD0(a, c);
|
||||
D_8035FF50[a].unk8 = func_802CEBBC(a, c);
|
||||
D_8035FF50[a].unkC = func_802CEC9C(a);
|
||||
//! fov is always set to 90.0f. If this line is removed, then the game crashes because fov is 0 on
|
||||
//! the first frame, which causes a floating point divide by 0
|
||||
fov = 90.0f;
|
||||
sSkyBoxInfo[player].yaw = atan2s(cameraFaceZ, cameraFaceX);
|
||||
sSkyBoxInfo[player].pitch = atan2s(sqrtf(cameraFaceX * cameraFaceX + cameraFaceZ * cameraFaceZ), cameraFaceY);
|
||||
sSkyBoxInfo[player].scaledX = calculate_skybox_scaled_x(player, fov);
|
||||
sSkyBoxInfo[player].scaledY = calculate_skybox_scaled_y(player, fov);
|
||||
sSkyBoxInfo[player].upperLeftTile = get_top_left_tile_idx(player);
|
||||
|
||||
return func_802CF2A8(a, b, sp2B);
|
||||
return init_skybox_display_list(player, background, colorIndex);
|
||||
}
|
||||
|
||||
+2
-9
@@ -3,14 +3,7 @@
|
||||
|
||||
#include "types.h"
|
||||
|
||||
// extern ? func_802CEAD0(?);
|
||||
// extern ? func_802CEBBC(?);
|
||||
// extern ? func_802CEC9C(?);
|
||||
// extern ? make_skybox_rect(?);
|
||||
// extern ? func_802CEF4C(?);
|
||||
// extern ? func_802CF188(?);
|
||||
// extern ? func_802CF2A8(?);
|
||||
extern Gfx *func_802CF414(s8 a, s8 b, f32 c, f32 d, f32 e, f32 f, f32 g,
|
||||
f32 h, f32 i);
|
||||
extern Gfx *create_skybox_facing_camera(s8 a, s8 background, f32 fov, f32 posX, f32 posY, f32 posZ,
|
||||
f32 focX, f32 focY, f32 focZ);
|
||||
|
||||
#endif /* _SKYBOX_H */
|
||||
|
||||
@@ -245,6 +245,9 @@ static struct Object *allocate_object(struct ObjectNode *objList) {
|
||||
|
||||
for (i = 0; i < 0x50; i++) {
|
||||
obj->rawData.asU32[i] = 0;
|
||||
#if IS_64_BIT
|
||||
obj->ptrData.asVoidPtr[i] = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
obj->unused1 = 0;
|
||||
@@ -307,11 +310,11 @@ static void snap_object_to_floor(struct Object *obj) {
|
||||
* Spawn an object at the origin with the behavior script at virtual address
|
||||
* behScript.
|
||||
*/
|
||||
struct Object *create_object(uintptr_t *behScript) {
|
||||
struct Object *create_object(const BehaviorScript *behScript) {
|
||||
s32 objListIndex;
|
||||
struct Object *obj;
|
||||
struct ObjectNode *objList;
|
||||
void *behavior = (void *) behScript;
|
||||
const BehaviorScript *behavior = behScript;
|
||||
|
||||
// If the first behavior script command is "begin <object list>", then
|
||||
// extract the object list from it
|
||||
|
||||
@@ -7,7 +7,7 @@ struct Object;
|
||||
void init_free_object_list(void);
|
||||
void clear_object_lists(struct ObjectNode *objLists);
|
||||
void unload_object(struct Object *obj);
|
||||
struct Object *create_object(uintptr_t *behScript);
|
||||
struct Object *create_object(const BehaviorScript *behScript);
|
||||
void mark_obj_for_deletion(struct Object *obj);
|
||||
|
||||
#endif /* _SPAWN_OBJECT_H */
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
#include "audio/external.h"
|
||||
#include "spawn_sound.h"
|
||||
#include "object_list_processor.h"
|
||||
|
||||
extern void *bhvSoundSpawner;
|
||||
#include "behavior_data.h"
|
||||
|
||||
/*
|
||||
* execute an object's current sound state with a provided array
|
||||
@@ -48,7 +47,7 @@ void exec_anim_sound_state(struct SoundState *soundStates) {
|
||||
* (Breakable walls, King Bobomb exploding, etc)
|
||||
*/
|
||||
void create_sound_spawner(s32 soundMagic) {
|
||||
struct Object *obj = spawn_object(gCurrentObject, 0, &bhvSoundSpawner);
|
||||
struct Object *obj = spawn_object(gCurrentObject, 0, bhvSoundSpawner);
|
||||
|
||||
obj->oSoundEffectUnkF4 = soundMagic;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include <ultra64.h>
|
||||
#include <macros.h>
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gd_types.h"
|
||||
#include "gd_macros.h"
|
||||
#include "gd_main.h"
|
||||
@@ -355,7 +357,7 @@ void check_face_bad_vtx(struct ObjFace *face) {
|
||||
return;
|
||||
}
|
||||
if ((uintptr_t) vtx->gbiVerts == 0x3F800000) {
|
||||
fatal_printf("bad2 %x,%d,%d,%d\n", (u32) (uintptr_t) vtx, vtx->unk3C, vtx->id, vtx->header.type);
|
||||
fatal_printf("bad2 %x,%d,%d,%d\n", (u32) (uintptr_t) vtx, vtx->scaleFactor, vtx->id, vtx->header.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <ultra64.h>
|
||||
#include <macros.h>
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include "gd_types.h"
|
||||
#include "bad_declarations.h"
|
||||
#include "prevent_bss_reordering.h"
|
||||
@@ -201,7 +202,7 @@ struct GdObj *proc_dynlist(struct DynList *dylist) {
|
||||
break;
|
||||
case 50:
|
||||
d_add_valptr(Dyn1AsID(dylist), (u32) DynVecY(dylist), Dyn2AsInt(dylist),
|
||||
(u32) DynVecX(dylist));
|
||||
(size_t) DynVecX(dylist));
|
||||
break;
|
||||
case 29:
|
||||
d_link_with_ptr(Dyn1AsPtr(dylist));
|
||||
@@ -2318,7 +2319,7 @@ void d_set_shape_offset(f32 x, f32 y, f32 z) {
|
||||
*
|
||||
* @param type `::ValPtrType`
|
||||
*/
|
||||
void d_add_valptr(DynId objId, u32 vflags, s32 type, u32 offset) {
|
||||
void d_add_valptr(DynId objId, u32 vflags, s32 type, size_t offset) {
|
||||
struct GdObj *dynobj; // sp2C
|
||||
struct ObjValPtrs *valptr; // sp28
|
||||
struct DynObjInfo *info; // sp24
|
||||
@@ -2984,7 +2985,7 @@ void d_set_rot_mtx(Mat4f *src) {
|
||||
cpy_mat4(src, &((struct ObjJoint *) sDynListCurObj)->mat128);
|
||||
break;
|
||||
case OBJ_TYPE_NETS:
|
||||
cpy_mat4(src, &((struct ObjJoint *) sDynListCurObj)->mat168);
|
||||
cpy_mat4(src, &((struct ObjNet *) sDynListCurObj)->mat168);
|
||||
break;
|
||||
default:
|
||||
fatal_printf("%s: Object '%s'(%x) does not support this function.", "dSetRMatrix()",
|
||||
@@ -3004,7 +3005,7 @@ Mat4f *d_get_rot_mtx_ptr(void) {
|
||||
case OBJ_TYPE_JOINTS:
|
||||
return &((struct ObjJoint *) sDynListCurObj)->mat128;
|
||||
case OBJ_TYPE_NETS:
|
||||
return &((struct ObjJoint *) sDynListCurObj)->mat168;
|
||||
return &((struct ObjNet *) sDynListCurObj)->mat168;
|
||||
default:
|
||||
fatal_printf("%s: Object '%s'(%x) does not support this function.", "dGetRMatrixPtr()",
|
||||
sDynListCurInfo->name, sDynListCurObj->type);
|
||||
@@ -3028,7 +3029,7 @@ void d_set_idn_mtx(Mat4f *src) {
|
||||
cpy_mat4(src, &((struct ObjNet *) dynobj)->matE8);
|
||||
break;
|
||||
case OBJ_TYPE_JOINTS:
|
||||
cpy_mat4(src, &((struct ObjNet *) dynobj)->mat168);
|
||||
cpy_mat4(src, &((struct ObjJoint *) dynobj)->mat168);
|
||||
break;
|
||||
case OBJ_TYPE_LIGHTS:
|
||||
((struct ObjLight *) dynobj)->position.x = (*src)[3][0];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user