Reformat to something more readable for me :3
Build libsm64 / Build libsm64 for linux (push) Failing after 28s
Build libsm64 / Build libsm64 for web (push) Failing after 29s
Build libsm64 / Build libsm64 for windows (push) Failing after 23s

This commit is contained in:
2026-05-24 11:31:35 -05:00
parent 4328104536
commit 9ff6947911
141 changed files with 29706 additions and 20450 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
#include "debug_print.h"
SM64DebugPrintFunctionPtr g_debug_print_func = NULL;
SM64DebugPrintFunctionPtr g_debug_print_func = nullptr;
@@ -86,10 +86,10 @@ struct Instrument **instOut = _instOut;\
_instId--; \
} \
inst = gCtlEntries[(*seqChannel).bankId].instruments[_instId]; \
if (inst == NULL) { \
if (inst == nullptr) { \
while (_instId != 0xff) { \
inst = gCtlEntries[(*seqChannel).bankId].instruments[_instId]; \
if (inst != NULL) { \
if (inst != nullptr) { \
goto gi ## l; \
} \
_instId--; \
@@ -109,13 +109,14 @@ struct Instrument **instOut = _instOut;\
goto ret ## l; \
} \
gAudioErrorFlags = _instId + 0x20000; \
*instOut = NULL; \
*instOut = nullptr; \
ret ## l: ; \
}
#endif
void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
struct SequencePlayer *seqPlayer; // sp5C, t4
void seq_channel_layer_process_script(struct SequenceChannelLayer *layer)
{
struct SequencePlayer *seqPlayer; // sp5C, t4
struct SequenceChannel *seqChannel; // sp58, t5
struct M64ScriptState *state;
struct Portamento *portamento;
@@ -124,51 +125,57 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
struct Drum *drum;
s32 temp_a0_5;
u8 sameSound;
u8 cmd; // a0 sp3E, EU s2
u8 cmdSemitone; // sp3D, t0
u16 sp3A; // t2, a0, a1
f32 tuning; // f0
s32 vel; // sp30, t3
s32 usedSemitone; // a1
f32 freqScale; // sp28, f0
u8 cmd; // a0 sp3E, EU s2
u8 cmdSemitone; // sp3D, t0
u16 sp3A; // t2, a0, a1
f32 tuning; // f0
s32 vel; // sp30, t3
s32 usedSemitone; // a1
f32 freqScale; // sp28, f0
f32 sp24;
f32 temp_f12;
f32 temp_f2;
//! Copt: manually inline these functions in the scope of this routine
#ifdef __sgi
#pragma inline routine(m64_read_u8)
#pragma inline routine(m64_read_compressed_u16)
#pragma inline routine(m64_read_s16)
#pragma inline routine(get_instrument)
#endif
//! Copt: manually inline these functions in the scope of this routine
#ifdef __sgi
#pragma inline routine(m64_read_u8)
#pragma inline routine(m64_read_compressed_u16)
#pragma inline routine(m64_read_s16)
#pragma inline routine(get_instrument)
#endif
sameSound = TRUE;
if ((*layer).enabled == FALSE) {
if ((*layer).enabled == FALSE)
{
return;
}
if ((*layer).delay > 1) {
if ((*layer).delay > 1)
{
(*layer).delay--;
if (!layer->stopSomething && layer->delay <= layer->duration) {
if (!layer->stopSomething && layer->delay <= layer->duration)
{
seq_channel_layer_note_decay(layer);
layer->stopSomething = TRUE;
}
return;
}
if (!layer->continuousNotes) {
if (!layer->continuousNotes)
{
seq_channel_layer_note_decay(layer);
}
if (PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_1 ||
PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_2) {
PORTAMENTO_MODE(layer->portamento) == PORTAMENTO_MODE_2)
{
layer->portamento.mode = 0;
}
seqChannel = (*layer).seqChannel;
seqPlayer = (*seqChannel).seqPlayer;
for (;;) {
for (;;)
{
state = &layer->scriptState;
//M64_READ_U8(state, cmd);
{
@@ -177,13 +184,16 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
cmd = *_ptr_pc;
}
if (cmd <= 0xc0) {
if (cmd <= 0xc0)
{
break;
}
switch (cmd) {
switch (cmd)
{
case 0xff: // layer_end; function return or end of script
if (state->depth == 0) {
if (state->depth == 0)
{
// N.B. this function call is *not* inlined even though it's
// within the same file, unlike in the rest of this function.
seq_channel_layer_disable(layer);
@@ -204,9 +214,12 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
break;
case 0xf7: // layer_loopend
if (--state->remLoopIters[state->depth - 1] != 0) {
if (--state->remLoopIters[state->depth - 1] != 0)
{
state->pc = state->stack[state->depth - 1];
} else {
}
else
{
state->depth--;
}
break;
@@ -219,19 +232,25 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
case 0xc1: // layer_setshortnotevelocity
case 0xca: // layer_setpan
temp_a0_5 = *(state->pc++);
if (cmd == 0xc1) {
if (cmd == 0xc1)
{
layer->velocitySquare = (f32)(temp_a0_5 * temp_a0_5);
} else {
layer->pan = (f32) temp_a0_5 / US_FLOAT(128.0);
}
else
{
layer->pan = (f32)temp_a0_5 / US_FLOAT(128.0);
}
break;
case 0xc2: // layer_transpose; set transposition in semitones
case 0xc9: // layer_setshortnoteduration
temp_a0_5 = *(state->pc++);
if (cmd == 0xc9) {
if (cmd == 0xc9)
{
layer->noteDuration = temp_a0_5;
} else {
}
else
{
layer->transposition = temp_a0_5;
}
break;
@@ -240,17 +259,20 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
case 0xc5: // layer_somethingoff
//! copt needs a ternary:
//layer->continuousNotes = (cmd == 0xc4) ? TRUE : FALSE;
{
u8 setting;
if (cmd == 0xc4)
{
u8 setting;
if (cmd == 0xc4) {
setting = TRUE;
} else {
setting = FALSE;
}
layer->continuousNotes = setting;
seq_channel_layer_note_decay(layer);
setting = TRUE;
}
break;
else
{
setting = FALSE;
}
layer->continuousNotes = setting;
seq_channel_layer_note_decay(layer);
}
break;
case 0xc3: // layer_setshortnotedefaultplaypercentage
M64_READ_COMPRESSED_U16(state, sp3A);
@@ -260,7 +282,8 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
case 0xc6: // layer_setinstr
M64_READ_U8(state, cmdSemitone);
if (cmdSemitone < 127) {
if (cmdSemitone < 127)
{
GET_INSTRUMENT(seqChannel, cmdSemitone, &(*layer).instrument, &(*layer).adsr, cmdSemitone, 1);
}
break;
@@ -273,13 +296,15 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
cmdSemitone += (*layer).transposition;
cmdSemitone += (*seqPlayer).transposition;
if (cmdSemitone >= 0x80) {
if (cmdSemitone >= 0x80)
{
cmdSemitone = 0;
}
layer->portamentoTargetNote = cmdSemitone;
// If special, the next param is u8 instead of var
if (PORTAMENTO_IS_SPECIAL((*layer).portamento)) {
if (PORTAMENTO_IS_SPECIAL((*layer).portamento))
{
layer->portamentoTime = *((state)->pc++);
break;
}
@@ -293,7 +318,8 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
break;
default:
switch (cmd & 0xf0) {
switch (cmd & 0xf0)
{
case 0xd0: // layer_setshortnotevelocityfromtable
sp3A = seqPlayer->shortNoteVelocityTable[cmd & 0xf];
(*layer).velocitySquare = (f32)(sp3A * sp3A);
@@ -305,14 +331,19 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
}
}
if (cmd == 0xc0) { // layer_delay
if (cmd == 0xc0)
{ // layer_delay
M64_READ_COMPRESSED_U16(state, layer->delay);
layer->stopSomething = TRUE;
} else {
}
else
{
layer->stopSomething = FALSE;
if (seqChannel->largeNotes == TRUE) {
switch (cmd & 0xc0) {
if (seqChannel->largeNotes == TRUE)
{
switch (cmd & 0xc0)
{
case 0x00: // layer_note0 (play percentage, velocity, duration)
M64_READ_COMPRESSED_U16(state, sp3A);
vel = *((*state).pc++);
@@ -333,11 +364,13 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
layer->noteDuration = *((*state).pc++);
goto l1090;
}
l1090:
cmdSemitone = cmd - (cmd & 0xc0);
l1090: cmdSemitone = cmd - (cmd & 0xc0);
layer->velocitySquare = vel * vel;
} else {
switch (cmd & 0xc0) {
}
else
{
switch (cmd & 0xc0)
{
case 0x00: // play note, type 0 (play percentage)
M64_READ_COMPRESSED_U16(state, sp3A);
layer->playPercentage = sp3A;
@@ -351,9 +384,7 @@ l1090:
sp3A = layer->playPercentage;
goto l1138;
}
l1138:
cmdSemitone = cmd - (cmd & 0xc0);
l1138: cmdSemitone = cmd - (cmd & 0xc0);
}
layer->delay = sp3A;
@@ -361,14 +392,20 @@ l1138:
if ((seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_STOP_NOTES) != 0)
|| seqChannel->stopSomething2
|| !seqChannel->hasInstrument
) {
)
{
layer->stopSomething = TRUE;
} else {
if (seqChannel->instOrWave == 0) { // drum
}
else
{
if (seqChannel->instOrWave == 0)
{ // drum
cmdSemitone += (*seqChannel).transposition + (*layer).transposition;
if (cmdSemitone >= gCtlEntries[seqChannel->bankId].numDrums) {
if (cmdSemitone >= gCtlEntries[seqChannel->bankId].numDrums)
{
cmdSemitone = gCtlEntries[seqChannel->bankId].numDrums;
if (cmdSemitone == 0) {
if (cmdSemitone == 0)
{
// this goto looks a bit like a function return...
layer->stopSomething = TRUE;
goto skip;
@@ -378,9 +415,12 @@ l1138:
}
drum = gCtlEntries[seqChannel->bankId].drums[cmdSemitone];
if (drum == NULL) {
if (drum == nullptr)
{
layer->stopSomething = TRUE;
} else {
}
else
{
layer->adsr.envelope = drum->envelope;
layer->adsr.releaseRate = drum->releaseRate;
layer->pan = FLOAT_CAST(drum->pan) / US_FLOAT(128.0);
@@ -389,35 +429,50 @@ l1138:
}
skip:;
} else { // instrument
}
else
{ // instrument
cmdSemitone += (*seqPlayer).transposition + (*seqChannel).transposition + (*layer).transposition;
if (cmdSemitone >= 0x80) {
if (cmdSemitone >= 0x80)
{
layer->stopSomething = TRUE;
} else {
}
else
{
instrument = layer->instrument;
if (instrument == NULL) {
if (instrument == nullptr)
{
instrument = seqChannel->instrument;
}
if (layer->portamento.mode != 0) {
if (layer->portamento.mode != 0)
{
//! copt needs a ternary:
//usedSemitone = (layer->portamentoTargetNote < cmdSemitone) ? cmdSemitone : layer->portamentoTargetNote;
if (layer->portamentoTargetNote < cmdSemitone) {
if (layer->portamentoTargetNote < cmdSemitone)
{
usedSemitone = cmdSemitone;
} else {
}
else
{
usedSemitone = layer->portamentoTargetNote;
}
if (instrument != NULL) {
sound = (u8) usedSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound
: (u8) usedSemitone <= instrument->normalRangeHi ?
&instrument->normalNotesSound : &instrument->highNotesSound;
if (instrument != nullptr)
{
sound = (u8)usedSemitone < instrument->normalRangeLo
? &instrument->lowNotesSound
: (u8)usedSemitone <= instrument->normalRangeHi
? &instrument->normalNotesSound
: &instrument->highNotesSound;
sameSound = (sound == (*layer).sound);
layer->sound = sound;
tuning = (*sound).tuning;
} else {
layer->sound = NULL;
}
else
{
layer->sound = nullptr;
tuning = 1.0f;
}
@@ -425,7 +480,8 @@ l1138:
temp_f12 = gNoteFrequencies[layer->portamentoTargetNote] * tuning;
portamento = &layer->portamento;
switch (PORTAMENTO_MODE(layer->portamento)) {
switch (PORTAMENTO_MODE(layer->portamento))
{
case PORTAMENTO_MODE_1:
case PORTAMENTO_MODE_3:
case PORTAMENTO_MODE_5:
@@ -439,30 +495,35 @@ l1138:
sp24 = temp_f12;
goto l13cc;
}
l13cc:
portamento->extent = sp24 / freqScale - US_FLOAT(1.0);
if (PORTAMENTO_IS_SPECIAL((*layer).portamento)) {
l13cc: portamento->extent = sp24 / freqScale - US_FLOAT(1.0);
if (PORTAMENTO_IS_SPECIAL((*layer).portamento))
{
portamento->speed = US_FLOAT(32512.0) * FLOAT_CAST((*seqPlayer).tempo)
/ ((f32)(*layer).delay * (f32) gTempoInternalToExternal
/ ((f32)(*layer).delay * (f32)gTempoInternalToExternal
* FLOAT_CAST((*layer).portamentoTime));
} else {
}
else
{
portamento->speed = US_FLOAT(127.0) / FLOAT_CAST((*layer).portamentoTime);
}
portamento->cur = 0.0f;
layer->freqScale = freqScale;
if (PORTAMENTO_MODE((*layer).portamento) == PORTAMENTO_MODE_5) {
if (PORTAMENTO_MODE((*layer).portamento) == PORTAMENTO_MODE_5)
{
layer->portamentoTargetNote = cmdSemitone;
}
} else if (instrument != NULL) {
sound = cmdSemitone < instrument->normalRangeLo ?
&instrument->lowNotesSound : cmdSemitone <= instrument->normalRangeHi ?
&instrument->normalNotesSound : &instrument->highNotesSound;
}
else if (instrument != nullptr)
{
sound = cmdSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound : cmdSemitone <= instrument->normalRangeHi ? &instrument->normalNotesSound : &instrument->highNotesSound;
sameSound = (sound == (*layer).sound);
layer->sound = sound;
layer->freqScale = gNoteFrequencies[cmdSemitone] * (*sound).tuning;
} else {
layer->sound = NULL;
}
else
{
layer->sound = nullptr;
layer->freqScale = gNoteFrequencies[cmdSemitone];
}
}
@@ -471,30 +532,41 @@ l13cc:
}
}
if (layer->stopSomething == TRUE) {
if (layer->note != NULL || layer->continuousNotes) {
if (layer->stopSomething == TRUE)
{
if (layer->note != nullptr || layer->continuousNotes)
{
seq_channel_layer_note_decay(layer);
}
return;
}
cmdSemitone = FALSE;
if (!layer->continuousNotes) {
if (!layer->continuousNotes)
{
cmdSemitone = TRUE;
} else if (layer->note == NULL || layer->status == SOUND_LOAD_STATUS_NOT_LOADED) {
}
else if (layer->note == nullptr || layer->status == SOUND_LOAD_STATUS_NOT_LOADED)
{
cmdSemitone = TRUE;
} else if (sameSound == FALSE) {
}
else if (sameSound == FALSE)
{
seq_channel_layer_note_decay(layer);
cmdSemitone = TRUE;
} else if (layer->sound == NULL) {
}
else if (layer->sound == nullptr)
{
init_synthetic_wave(layer->note, layer);
}
if (cmdSemitone != FALSE) {
if (cmdSemitone != FALSE)
{
(*layer).note = alloc_note(layer);
}
if (layer->note != NULL && layer->note->parentLayer == layer) {
if (layer->note != nullptr && layer->note->parentLayer == layer)
{
note_vibrato_init(layer->note);
}
}
+249 -233
View File
@@ -10,30 +10,46 @@ extern struct OSMesgQueue OSMesgQueue3;
#ifdef VERSION_EU
struct ReverbSettingsEU sReverbSettings[] = {
{ 0x04, 0x0c, 0x2fff },
{ 0x04, 0x0a, 0x47ff },
{ 0x04, 0x10, 0x2fff },
{ 0x04, 0x0e, 0x3fff },
{ 0x04, 0x0c, 0x4fff },
{ 0x04, 0x0a, 0x37ff }
{0x04, 0x0c, 0x2fff},
{0x04, 0x0a, 0x47ff},
{0x04, 0x10, 0x2fff},
{0x04, 0x0e, 0x3fff},
{0x04, 0x0c, 0x4fff},
{0x04, 0x0a, 0x37ff}
};
struct AudioSessionSettingsEU gAudioSessionPresets[] = {
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[2], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[3], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[4], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00004000, 0x00006e00,
0x00003f00, 0x00002a00 },
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00004100, 0x00006e00,
0x00004400, 0x00002a80 },
{ 0x00007d00, 0x01, 0x14, 0x01, 0x00, &sReverbSettings[5], 0x7fff, 0x0000, 0x00003500, 0x00006280,
0x00004000, 0x00001b00 }
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[2], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[3], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[4], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
0x00004400, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00004000, 0x00006e00,
0x00003f00, 0x00002a00
},
{
0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00004100, 0x00006e00,
0x00004400, 0x00002a80
},
{
0x00007d00, 0x01, 0x14, 0x01, 0x00, &sReverbSettings[5], 0x7fff, 0x0000, 0x00003500, 0x00006280,
0x00004000, 0x00001b00
}
};
#endif
@@ -51,7 +67,7 @@ struct AudioSessionSettingsEU gAudioSessionPresets[] = {
#if defined(VERSION_JP) || defined(VERSION_US)
struct AudioSessionSettings gAudioSessionPresets[18] = {
#ifdef VERSION_JP
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
{ 32000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
{ 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
{ 32000, 16, 1, 0x1000, 0x2FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
{ 32000, 16, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x3900, 0x6000, 0x4400, 0x2A00 },
@@ -60,7 +76,7 @@ struct AudioSessionSettings gAudioSessionPresets[18] = {
{ 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x3F00, 0x6200, 0x4400, 0x2A80 },
{ 32000, 20, 1, 0x0800, 0x37FF, 0x7FFF, 0x3300, 0x5500, 0x4000, 0x1B00 },
#else
{ 32000, 16, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x3A00, 0x6D00, 0x4400, 0x2A00 },
{ 32000, 16, 1, 0x0C00, 0x2FFF, 0x7FFF, 0x3A00, 0x6D00, 0x4400, 0x2A00 },
{ 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x3A00, 0x6D00, 0x4400, 0x2A00 },
{ 32000, 16, 1, 0x1000, 0x2FFF, 0x7FFF, 0x3A00, 0x6D00, 0x4400, 0x2A00 },
{ 32000, 16, 1, 0x0E00, 0x3FFF, 0x7FFF, 0x3A00, 0x6D00, 0x4400, 0x2A00 },
@@ -69,7 +85,7 @@ struct AudioSessionSettings gAudioSessionPresets[18] = {
{ 32000, 16, 1, 0x0A00, 0x47FF, 0x7FFF, 0x4100, 0x6E00, 0x4400, 0x2A80 },
{ 32000, 20, 1, 0x0800, 0x37FF, 0x7FFF, 0x34C0, 0x6280, 0x4000, 0x1B00 },
#endif
{ 27000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x2500, 0x5500, 0x7400, 0x2400 },
{ 27000, 16, 1, 0x0800, 0x2FFF, 0x7FFF, 0x2500, 0x5500, 0x7400, 0x2400 },
{ 27000, 16, 1, 0x0800, 0x3FFF, 0x7FFF, 0x2500, 0x5500, 0x7400, 0x2400 },
{ 27000, 16, 1, 0x1000, 0x2FFF, 0x7FFF, 0x2500, 0x5500, 0x7400, 0x2400 },
{ 27000, 16, 1, 0x1000, 0x3FFF, 0x7FFF, 0x2500, 0x5500, 0x7400, 0x2400 },
@@ -85,15 +101,15 @@ struct AudioSessionSettings gAudioSessionPresets[18] = {
#if defined(VERSION_JP) || defined(VERSION_US)
u16 gAudioCosineTable[128] = {
0x7FFF, 32764, 32757, 32744, 32727, 32704, 32677, 32644, 32607, 32564, 32517, 32464, 32407,
32344, 32277, 32205, 32127, 32045, 31958, 31866, 31770, 31668, 31561, 31450, 31334, 31213,
31087, 30957, 30822, 30682, 30537, 30388, 30234, 30075, 29912, 29744, 29572, 29395, 29214,
29028, 28838, 28643, 28444, 28241, 28033, 27821, 27605, 27385, 27160, 26931, 26698, 26461,
26220, 25975, 25726, 25473, 25216, 24956, 24691, 24423, 24151, 23875, 23596, 23313, 23026,
22736, 22442, 22145, 21845, 21541, 21234, 20924, 20610, 20294, 19974, 19651, 19325, 18997,
18665, 18331, 17993, 17653, 17310, 16965, 16617, 16266, 15913, 15558, 15200, 14840, 14477,
14113, 13746, 13377, 13006, 12633, 12258, 11881, 11503, 11122, 10740, 10357, 9971, 9584,
9196, 8806, 8415, 8023, 7630, 7235, 6839, 6442, 6044, 5646, 5246, 4845, 4444,
4042, 3640, 3237, 2833, 2429, 2025, 1620, 1216, 810, 405, 0,
32344, 32277, 32205, 32127, 32045, 31958, 31866, 31770, 31668, 31561, 31450, 31334, 31213,
31087, 30957, 30822, 30682, 30537, 30388, 30234, 30075, 29912, 29744, 29572, 29395, 29214,
29028, 28838, 28643, 28444, 28241, 28033, 27821, 27605, 27385, 27160, 26931, 26698, 26461,
26220, 25975, 25726, 25473, 25216, 24956, 24691, 24423, 24151, 23875, 23596, 23313, 23026,
22736, 22442, 22145, 21845, 21541, 21234, 20924, 20610, 20294, 19974, 19651, 19325, 18997,
18665, 18331, 17993, 17653, 17310, 16965, 16617, 16266, 15913, 15558, 15200, 14840, 14477,
14113, 13746, 13377, 13006, 12633, 12258, 11881, 11503, 11122, 10740, 10357, 9971, 9584,
9196, 8806, 8415, 8023, 7630, 7235, 6839, 6442, 6044, 5646, 5246, 4845, 4444,
4042, 3640, 3237, 2833, 2429, 2025, 1620, 1216, 810, 405, 0,
};
#endif
@@ -106,8 +122,8 @@ f32 gPitchBendFrequencyScale[256] = {
0.5f,
#else
f32 gPitchBendFrequencyScale[255] = {
#endif
0.5f, 0.502736f, 0.505488f, 0.508254f, 0.511036f, 0.513833f, 0.516645f, 0.519472f, 0.522315f,
#endif
0.5f, 0.502736f, 0.505488f, 0.508254f, 0.511036f, 0.513833f, 0.516645f, 0.519472f, 0.522315f,
0.525174f, 0.528048f, 0.530938f, 0.533843f, 0.536765f, 0.539702f, 0.542656f, 0.545626f, 0.548612f,
0.551614f, 0.554633f, 0.557669f, 0.560721f, 0.563789f, 0.566875f, 0.569977f, 0.573097f, 0.576233f,
0.579387f, 0.582558f, 0.585746f, 0.588951f, 0.592175f, 0.595415f, 0.598674f, 0.601950f, 0.605245f,
@@ -121,7 +137,7 @@ f32 gPitchBendFrequencyScale[255] = {
0.858284f, 0.862982f, 0.867704f, 0.872453f, 0.877228f, 0.882029f, 0.886856f, 0.891709f, 0.896590f,
0.901496f, 0.906430f, 0.911391f, 0.916379f, 0.921394f, 0.926436f, 0.931507f, 0.936604f, 0.941730f,
0.946884f, 0.952066f, 0.957277f, 0.962516f, 0.967783f, 0.973080f, 0.978405f, 0.983760f, 0.989144f,
0.994557f, 1.0f, 1.005473f, 1.010975f, 1.016508f, 1.022071f, 1.027665f, 1.033289f, 1.038944f,
0.994557f, 1.0f, 1.005473f, 1.010975f, 1.016508f, 1.022071f, 1.027665f, 1.033289f, 1.038944f,
1.044630f, 1.050347f, 1.056095f, 1.061875f, 1.067687f, 1.073530f, 1.079405f, 1.085312f, 1.091252f,
1.097224f, 1.103229f, 1.109267f, 1.115337f, 1.121441f, 1.127579f, 1.133750f, 1.139955f, 1.146193f,
1.152466f, 1.158773f, 1.165115f, 1.171491f, 1.177903f, 1.184349f, 1.190831f, 1.197348f, 1.203901f,
@@ -171,30 +187,30 @@ u8 gDefaultShortNoteDurationTable[16] = {
#if defined(VERSION_JP) || defined(VERSION_US)
// gVibratoCurve[k] = k*8
s8 gVibratoCurve[16] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120 };
s8 gVibratoCurve[16] = {0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120};
#endif
struct AdsrEnvelope gDefaultEnvelope[] = {
{ BSWAP16(4), BSWAP16(32000) }, // go from 0 to 32000 over the course of 16ms
{ BSWAP16(1000), BSWAP16(32000) }, // stay there for 4.16 seconds
{ BSWAP16(ADSR_HANG), 0 } // then continue staying there
{BSWAP16(4), BSWAP16(32000)}, // go from 0 to 32000 over the course of 16ms
{BSWAP16(1000), BSWAP16(32000)}, // stay there for 4.16 seconds
{BSWAP16(ADSR_HANG), 0} // then continue staying there
};
#endif
#ifdef VERSION_EU
struct NoteSubEu gZeroNoteSub = { 0 };
struct NoteSubEu gDefaultNoteSub = { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { NULL } };
struct NoteSubEu gZeroNoteSub = {0};
struct NoteSubEu gDefaultNoteSub = {1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {nullptr}};
#endif
#if defined(VERSION_EU) || defined(VERSION_SH)
s16 sSawtoothWaves[256] = {
0, 1023, 2047, 3071, 4095, 5119, 6143, 7167, 8191, 9215, 10239,
11263, 0x2FFF, 13311, 0x37FF, 15359, 0x3FFF, 17407, 0x47FF, 19455, 0x4FFF, 21503,
22527, 23551, 24575, 25599, 26623, 27647, 28671, 29695, 30719, 31743, -0x7FFF,
-31743, -30719, -29695, -28671, -27647, -26623, -25599, -24575, -23551, -22527, -21503,
0, 1023, 2047, 3071, 4095, 5119, 6143, 7167, 8191, 9215, 10239,
11263, 0x2FFF, 13311, 0x37FF, 15359, 0x3FFF, 17407, 0x47FF, 19455, 0x4FFF, 21503,
22527, 23551, 24575, 25599, 26623, 27647, 28671, 29695, 30719, 31743, -0x7FFF,
-31743, -30719, -29695, -28671, -27647, -26623, -25599, -24575, -23551, -22527, -21503,
-0x4FFF, -19455, -0x47FF, -17407, -0x3FFF, -15359, -0x37FF, -13311, -0x2FFF, -11263, -10239,
-9215, -8191, -7167, -6143, -5119, -4095, -3071, -2047, -1023,
0, 0x7FF, 0xFFF, 0x17FF, 0x1FFF, 0x27FF, 0x2FFF, 0x37FF, 0x3FFF, 0x47FF, 0x4FFF,
-9215, -8191, -7167, -6143, -5119, -4095, -3071, -2047, -1023,
0, 0x7FF, 0xFFF, 0x17FF, 0x1FFF, 0x27FF, 0x2FFF, 0x37FF, 0x3FFF, 0x47FF, 0x4FFF,
0x57FF, 0x5FFF, 0x67FF, 0x6FFF, 0x77FF, 0x8001, 0x8801, 0x9001, 0x9801, 0xa001, 0xa801,
0xb001, 0xb801, 0xc001, 0xc801, 0xd001, 0xd801, 0xe001, 0xe801, 0xf001, 0xf801, 0x0000,
0x07ff, 0x0fff, 0x17ff, 0x1fff, 0x27ff, 0x2fff, 0x37ff, 0x3fff, 0x47ff, 0x4fff, 0x57ff,
@@ -337,52 +353,52 @@ s16 gEuUnknownWave7[256] = {
0x0000, 0x8d2e, 0x4e20, 0xe14e, 0x0000, 0x1eb2, 0xb1e0, 0x72d2, 0x0000, 0x8d2e, 0x4e20, 0xe14e,
0x0000, 0x1eb2, 0xb1e0, 0x72d2,
};
s16 *gWaveSamples[6] = { sSawtoothWaves, sTriangleWaves, sSineWaves, sSquareWaves, sEuUnknownWave6, gEuUnknownWave7 };
s16 *gWaveSamples[6] = {sSawtoothWaves, sTriangleWaves, sSineWaves, sSquareWaves, sEuUnknownWave6, gEuUnknownWave7};
#else
// !VERSION_EU
s16 sSineWave[0x40] = {
0, 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, 25329, 27244,
28897, 30272, 31356, 32137, 32609, 0x7FFF, 32609, 32137, 31356, 30272, 28897,
27244, 25329, 23169, 20787, 18204, 15446, 12539, 9511, 6392, 3211, 0,
-3211, -6392, -9511, -12539, -15446, -18204, -20787, -23169, -25329, -27244, -28897,
0, 3211, 6392, 9511, 12539, 15446, 18204, 20787, 23169, 25329, 27244,
28897, 30272, 31356, 32137, 32609, 0x7FFF, 32609, 32137, 31356, 30272, 28897,
27244, 25329, 23169, 20787, 18204, 15446, 12539, 9511, 6392, 3211, 0,
-3211, -6392, -9511, -12539, -15446, -18204, -20787, -23169, -25329, -27244, -28897,
-30272, -31356, -32137, -32609, -0x7FFF, -32609, -32137, -31356, -30272, -28897, -27244,
-25329, -23169, -20787, -18204, -15446, -12539, -9511, -6392, -3211,
-25329, -23169, -20787, -18204, -15446, -12539, -9511, -6392, -3211,
};
s16 sSquareWave[0x40] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF,
0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF,
0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF,
-0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF, -0x7FFF,
};
s16 sTriangleWave[0x40] = {
0, 0x7FF, 0xFFF, 0x17FF, 0x1FFF, 0x27FF, 0x2FFF, 0x37FF, 0x3FFF, 0x47FF, 0x4FFF,
0x57FF, 0x5FFF, 0x67FF, 0x6FFF, 0x77FF, 0x7FFF, 0x77FF, 0x6FFF, 0x67FF, 0x5FFF, 0x57FF,
0x4FFF, 0x47FF, 0x3FFF, 0x37FF, 0x2FFF, 0x27FF, 0x1FFF, 0x17FF, 0xFFF, 0x7FF, 0,
-0x7FF, -0xFFF, -0x17FF, -0x1FFF, -10239, -0x2FFF, -0x37FF, -0x3FFF, -0x47FF, -0x4FFF, -22527,
-24575, -26623, -28671, -30719, -0x7FFF, -30719, -28671, -26623, -24575, -22527, -0x4FFF,
-0x47FF, -0x3FFF, -0x37FF, -0x2FFF, -0x27FF, -0x1FFF, -0x17FF, -0xFFF, -0x7FF,
0, 0x7FF, 0xFFF, 0x17FF, 0x1FFF, 0x27FF, 0x2FFF, 0x37FF, 0x3FFF, 0x47FF, 0x4FFF,
0x57FF, 0x5FFF, 0x67FF, 0x6FFF, 0x77FF, 0x7FFF, 0x77FF, 0x6FFF, 0x67FF, 0x5FFF, 0x57FF,
0x4FFF, 0x47FF, 0x3FFF, 0x37FF, 0x2FFF, 0x27FF, 0x1FFF, 0x17FF, 0xFFF, 0x7FF, 0,
-0x7FF, -0xFFF, -0x17FF, -0x1FFF, -10239, -0x2FFF, -0x37FF, -0x3FFF, -0x47FF, -0x4FFF, -22527,
-24575, -26623, -28671, -30719, -0x7FFF, -30719, -28671, -26623, -24575, -22527, -0x4FFF,
-0x47FF, -0x3FFF, -0x37FF, -0x2FFF, -0x27FF, -0x1FFF, -0x17FF, -0xFFF, -0x7FF,
};
s16 sSawtoothWave[0x40] = {
0, 1023, 2047, 3071, 4095, 5119, 6143, 7167, 8191, 9215, 10239,
11263, 0x2FFF, 13311, 0x37FF, 15359, 0x3FFF, 17407, 0x47FF, 19455, 0x4FFF, 21503,
22527, 23551, 24575, 25599, 26623, 27647, 28671, 29695, 30719, 31743, -0x7FFF,
-31743, -30719, -29695, -28671, -27647, -26623, -25599, -24575, -23551, -22527, -21503,
0, 1023, 2047, 3071, 4095, 5119, 6143, 7167, 8191, 9215, 10239,
11263, 0x2FFF, 13311, 0x37FF, 15359, 0x3FFF, 17407, 0x47FF, 19455, 0x4FFF, 21503,
22527, 23551, 24575, 25599, 26623, 27647, 28671, 29695, 30719, 31743, -0x7FFF,
-31743, -30719, -29695, -28671, -27647, -26623, -25599, -24575, -23551, -22527, -21503,
-0x4FFF, -19455, -0x47FF, -17407, -0x3FFF, -15359, -0x37FF, -13311, -0x2FFF, -11263, -10239,
-9215, -8191, -7167, -6143, -5119, -4095, -3071, -2047, -1023,
-9215, -8191, -7167, -6143, -5119, -4095, -3071, -2047, -1023,
};
s16 *gWaveSamples[4] = { sSawtoothWave, sTriangleWave, sSineWave, sSquareWave };
s16 *gWaveSamples[4] = {sSawtoothWave, sTriangleWave, sSineWave, sSquareWave};
#endif
#ifdef VERSION_SH
s32 unk_sh_data_0[2] = {0, 0};
f32 gPitchBendFrequencyScale[256] = {
0.5f, 0.5f, 0.502736f, 0.505488f, 0.508254f, 0.511036f, 0.513833f, 0.516645f, 0.519472f,
0.5f, 0.5f, 0.502736f, 0.505488f, 0.508254f, 0.511036f, 0.513833f, 0.516645f, 0.519472f,
0.522315f, 0.525174f, 0.528048f, 0.530938f, 0.533843f, 0.536765f, 0.539702f, 0.542656f, 0.545626f,
0.548612f, 0.551614f, 0.554633f, 0.557669f, 0.560721f, 0.563789f, 0.566875f, 0.569977f, 0.573097f,
0.576233f, 0.579387f, 0.582558f, 0.585746f, 0.588951f, 0.592175f, 0.595415f, 0.598674f, 0.601950f,
@@ -396,7 +412,7 @@ f32 gPitchBendFrequencyScale[256] = {
0.853613f, 0.858284f, 0.862982f, 0.867704f, 0.872453f, 0.877228f, 0.882029f, 0.886856f, 0.891709f,
0.896590f, 0.901496f, 0.906430f, 0.911391f, 0.916379f, 0.921394f, 0.926436f, 0.931507f, 0.936604f,
0.941730f, 0.946884f, 0.952066f, 0.957277f, 0.962516f, 0.967783f, 0.973080f, 0.978405f, 0.983760f,
0.989144f, 0.994557f, 1.0f, 1.005473f, 1.010975f, 1.016508f, 1.022071f, 1.027665f, 1.033289f,
0.989144f, 0.994557f, 1.0f, 1.005473f, 1.010975f, 1.016508f, 1.022071f, 1.027665f, 1.033289f,
1.038944f, 1.044630f, 1.050347f, 1.056095f, 1.061875f, 1.067687f, 1.073530f, 1.079405f, 1.085312f,
1.091252f, 1.097224f, 1.103229f, 1.109267f, 1.115337f, 1.121441f, 1.127579f, 1.133750f, 1.139955f,
1.146193f, 1.152466f, 1.158773f, 1.165115f, 1.171491f, 1.177903f, 1.184349f, 1.190831f, 1.197348f,
@@ -416,38 +432,38 @@ f32 gPitchBendFrequencyScale[256] = {
#ifdef VERSION_SH
f32 unk_sh_data_1[] = {
0.890899f, 0.890899f, 0.89171f, 0.892521f, 0.893333f, 0.894146f, 0.89496f, 0.895774f,
0.89659f, 0.897406f, 0.898222f, 0.89904f, 0.899858f, 0.900677f, 0.901496f, 0.902317f,
0.903138f, 0.90396f, 0.904783f, 0.905606f, 0.90643f, 0.907255f, 0.908081f, 0.908907f,
0.909734f, 0.910562f, 0.911391f, 0.91222f, 0.91305f, 0.913881f, 0.914713f, 0.915545f,
0.916379f, 0.917213f, 0.918047f, 0.918883f, 0.919719f, 0.920556f, 0.921394f, 0.922232f,
0.923072f, 0.923912f, 0.924752f, 0.925594f, 0.926436f, 0.927279f, 0.928123f, 0.928968f,
0.929813f, 0.93066f, 0.931507f, 0.932354f, 0.933203f, 0.934052f, 0.934902f, 0.935753f,
0.936604f, 0.937457f, 0.93831f, 0.939164f, 0.940019f, 0.940874f, 0.94173f, 0.942587f,
0.943445f, 0.944304f, 0.945163f, 0.946023f, 0.946884f, 0.947746f, 0.948608f, 0.949472f,
0.950336f, 0.951201f, 0.952066f, 0.952933f, 0.9538f, 0.954668f, 0.955537f, 0.956406f,
0.957277f, 0.958148f, 0.95902f, 0.959893f, 0.960766f, 0.961641f, 0.962516f, 0.963392f,
0.964268f, 0.965146f, 0.966024f, 0.966903f, 0.967783f, 0.968664f, 0.969546f, 0.970428f,
0.971311f, 0.972195f, 0.97308f, 0.973965f, 0.974852f, 0.975739f, 0.976627f, 0.977516f,
0.978405f, 0.979296f, 0.980187f, 0.981079f, 0.981972f, 0.982865f, 0.98376f, 0.984655f,
0.985551f, 0.986448f, 0.987346f, 0.988244f, 0.989144f, 0.990044f, 0.990945f, 0.991847f,
0.992749f, 0.993653f, 0.994557f, 0.995462f, 0.996368f, 0.997275f, 0.998182f, 0.999091f,
1.0f, 1.00091f, 1.001821f, 1.002733f, 1.003645f, 1.004559f, 1.005473f, 1.006388f,
1.007304f, 1.00822f, 1.009138f, 1.010056f, 1.010975f, 1.011896f, 1.012816f, 1.013738f,
1.014661f, 1.015584f, 1.016508f, 1.017433f, 1.018359f, 1.019286f, 1.020214f, 1.021142f,
1.022071f, 1.023002f, 1.023933f, 1.024864f, 1.025797f, 1.026731f, 1.027665f, 1.0286f,
1.029536f, 1.030473f, 1.031411f, 1.03235f, 1.033289f, 1.03423f, 1.035171f, 1.036113f,
1.037056f, 1.038f, 1.038944f, 1.03989f, 1.040836f, 1.041783f, 1.042731f, 1.04368f,
1.04463f, 1.045581f, 1.046532f, 1.047485f, 1.048438f, 1.049392f, 1.050347f, 1.051303f,
1.05226f, 1.053217f, 1.054176f, 1.055135f, 1.056095f, 1.057056f, 1.058018f, 1.058981f,
1.059945f, 1.06091f, 1.061875f, 1.062842f, 1.063809f, 1.064777f, 1.065746f, 1.066716f,
1.067687f, 1.068658f, 1.069631f, 1.070604f, 1.071578f, 1.072554f, 1.07353f, 1.074507f,
1.075485f, 1.076463f, 1.077443f, 1.078424f, 1.079405f, 1.080387f, 1.08137f, 1.082355f,
1.08334f, 1.084325f, 1.085312f, 1.0863f, 1.087289f, 1.088278f, 1.089268f, 1.09026f,
1.091252f, 1.092245f, 1.093239f, 1.094234f, 1.09523f, 1.096226f, 1.097224f, 1.098223f,
1.099222f, 1.100222f, 1.101224f, 1.102226f, 1.103229f, 1.104233f, 1.105238f, 1.106244f,
1.10725f, 1.108258f, 1.109267f, 1.110276f, 1.111287f, 1.112298f, 1.11331f, 1.114323f,
1.115337f, 1.116352f, 1.117368f, 1.118385f, 1.119403f, 1.120422f, 1.121441f, 1.122462f,
0.890899f, 0.890899f, 0.89171f, 0.892521f, 0.893333f, 0.894146f, 0.89496f, 0.895774f,
0.89659f, 0.897406f, 0.898222f, 0.89904f, 0.899858f, 0.900677f, 0.901496f, 0.902317f,
0.903138f, 0.90396f, 0.904783f, 0.905606f, 0.90643f, 0.907255f, 0.908081f, 0.908907f,
0.909734f, 0.910562f, 0.911391f, 0.91222f, 0.91305f, 0.913881f, 0.914713f, 0.915545f,
0.916379f, 0.917213f, 0.918047f, 0.918883f, 0.919719f, 0.920556f, 0.921394f, 0.922232f,
0.923072f, 0.923912f, 0.924752f, 0.925594f, 0.926436f, 0.927279f, 0.928123f, 0.928968f,
0.929813f, 0.93066f, 0.931507f, 0.932354f, 0.933203f, 0.934052f, 0.934902f, 0.935753f,
0.936604f, 0.937457f, 0.93831f, 0.939164f, 0.940019f, 0.940874f, 0.94173f, 0.942587f,
0.943445f, 0.944304f, 0.945163f, 0.946023f, 0.946884f, 0.947746f, 0.948608f, 0.949472f,
0.950336f, 0.951201f, 0.952066f, 0.952933f, 0.9538f, 0.954668f, 0.955537f, 0.956406f,
0.957277f, 0.958148f, 0.95902f, 0.959893f, 0.960766f, 0.961641f, 0.962516f, 0.963392f,
0.964268f, 0.965146f, 0.966024f, 0.966903f, 0.967783f, 0.968664f, 0.969546f, 0.970428f,
0.971311f, 0.972195f, 0.97308f, 0.973965f, 0.974852f, 0.975739f, 0.976627f, 0.977516f,
0.978405f, 0.979296f, 0.980187f, 0.981079f, 0.981972f, 0.982865f, 0.98376f, 0.984655f,
0.985551f, 0.986448f, 0.987346f, 0.988244f, 0.989144f, 0.990044f, 0.990945f, 0.991847f,
0.992749f, 0.993653f, 0.994557f, 0.995462f, 0.996368f, 0.997275f, 0.998182f, 0.999091f,
1.0f, 1.00091f, 1.001821f, 1.002733f, 1.003645f, 1.004559f, 1.005473f, 1.006388f,
1.007304f, 1.00822f, 1.009138f, 1.010056f, 1.010975f, 1.011896f, 1.012816f, 1.013738f,
1.014661f, 1.015584f, 1.016508f, 1.017433f, 1.018359f, 1.019286f, 1.020214f, 1.021142f,
1.022071f, 1.023002f, 1.023933f, 1.024864f, 1.025797f, 1.026731f, 1.027665f, 1.0286f,
1.029536f, 1.030473f, 1.031411f, 1.03235f, 1.033289f, 1.03423f, 1.035171f, 1.036113f,
1.037056f, 1.038f, 1.038944f, 1.03989f, 1.040836f, 1.041783f, 1.042731f, 1.04368f,
1.04463f, 1.045581f, 1.046532f, 1.047485f, 1.048438f, 1.049392f, 1.050347f, 1.051303f,
1.05226f, 1.053217f, 1.054176f, 1.055135f, 1.056095f, 1.057056f, 1.058018f, 1.058981f,
1.059945f, 1.06091f, 1.061875f, 1.062842f, 1.063809f, 1.064777f, 1.065746f, 1.066716f,
1.067687f, 1.068658f, 1.069631f, 1.070604f, 1.071578f, 1.072554f, 1.07353f, 1.074507f,
1.075485f, 1.076463f, 1.077443f, 1.078424f, 1.079405f, 1.080387f, 1.08137f, 1.082355f,
1.08334f, 1.084325f, 1.085312f, 1.0863f, 1.087289f, 1.088278f, 1.089268f, 1.09026f,
1.091252f, 1.092245f, 1.093239f, 1.094234f, 1.09523f, 1.096226f, 1.097224f, 1.098223f,
1.099222f, 1.100222f, 1.101224f, 1.102226f, 1.103229f, 1.104233f, 1.105238f, 1.106244f,
1.10725f, 1.108258f, 1.109267f, 1.110276f, 1.111287f, 1.112298f, 1.11331f, 1.114323f,
1.115337f, 1.116352f, 1.117368f, 1.118385f, 1.119403f, 1.120422f, 1.121441f, 1.122462f,
};
// Shindou moved these variables down here. :/
@@ -476,43 +492,43 @@ u8 gDefaultShortNoteDurationTable[16] = {
};
struct AdsrEnvelope gDefaultEnvelope[] = {
{ BSWAP16(4), BSWAP16(32000) }, // go from 0 to 32000 over the course of 16ms
{ BSWAP16(1000), BSWAP16(32000) }, // stay there for 4.16 seconds
{ BSWAP16(ADSR_HANG), 0 } // then continue staying there
{BSWAP16(4), BSWAP16(32000)}, // go from 0 to 32000 over the course of 16ms
{BSWAP16(1000), BSWAP16(32000)}, // stay there for 4.16 seconds
{BSWAP16(ADSR_HANG), 0} // then continue staying there
};
u8 unk_sh_data2[4] = { 0, 0, 0, 0 };
u8 unk_sh_data2[4] = {0, 0, 0, 0};
struct NoteSubEu gZeroNoteSub = { 0 };
struct NoteSubEu gZeroNoteSub = {0};
struct NoteSubEu gDefaultNoteSub = {
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { NULL },
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {nullptr},
#ifdef VERSION_SH
0
0
#endif
};
u16 gHeadsetPanQuantization[0x40] = {
0x3C, 0x3A, 0x38, 0x36, 0x34, 0x32, 0x30, 0x2E,
0x2C, 0x2A, 0x28, 0x26, 0x24, 0x22, 0x20, 0x1E,
0x1C, 0x1A, 0x18, 0x16, 0x14, 0x12, 0x10, 0x0E,
0x0C, 0x0A, 0x08, 0x06, 0x04, 0x02,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0x3C, 0x3A, 0x38, 0x36, 0x34, 0x32, 0x30, 0x2E,
0x2C, 0x2A, 0x28, 0x26, 0x24, 0x22, 0x20, 0x1E,
0x1C, 0x1A, 0x18, 0x16, 0x14, 0x12, 0x10, 0x0E,
0x0C, 0x0A, 0x08, 0x06, 0x04, 0x02,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
#endif
#ifdef VERSION_EU
u8 euUnknownData_8030194c[4] = { 0x40, 0x20, 0x10, 0x08 };
u8 euUnknownData_8030194c[4] = {0x40, 0x20, 0x10, 0x08};
u16 gHeadsetPanQuantization[0x10] = {
0x40, 0x40, 0x30, 0x30, 0x20, 0x20, 0x10, 0, 0, 0,
};
#elif !defined(VERSION_SH)
u16 gHeadsetPanQuantization[10] = { 0x40, 0x30, 0x20, 0x10, 0, 0, 0, 0, 0, 0 };
u16 gHeadsetPanQuantization[10] = {0x40, 0x30, 0x20, 0x10, 0, 0, 0, 0, 0, 0};
#endif
#if defined(VERSION_EU) || defined(VERSION_SH)
s16 euUnknownData_80301950[64] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 500, 0, 0, 0, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0, 0, 0, 500, 0, 0, 0, 0,
};
#endif
@@ -522,21 +538,21 @@ s16 euUnknownData_80301950[64] = {
// f(1/2 * 127) = 1/sqrt(2)
// f(2/2 * 127) = 0
f32 gHeadsetPanVolume[128] = {
1.0f, 0.995386f, 0.990772f, 0.986157f, 0.981543f, 0.976929f, 0.972315f, 0.967701f, 0.963087f,
0.958472f, 0.953858f, 0.949244f, 0.94463f, 0.940016f, 0.935402f, 0.930787f, 0.926173f, 0.921559f,
0.916945f, 0.912331f, 0.907717f, 0.903102f, 0.898488f, 0.893874f, 0.88926f, 0.884646f, 0.880031f,
1.0f, 0.995386f, 0.990772f, 0.986157f, 0.981543f, 0.976929f, 0.972315f, 0.967701f, 0.963087f,
0.958472f, 0.953858f, 0.949244f, 0.94463f, 0.940016f, 0.935402f, 0.930787f, 0.926173f, 0.921559f,
0.916945f, 0.912331f, 0.907717f, 0.903102f, 0.898488f, 0.893874f, 0.88926f, 0.884646f, 0.880031f,
0.875417f, 0.870803f, 0.866189f, 0.861575f, 0.856961f, 0.852346f, 0.847732f, 0.843118f, 0.838504f,
0.83389f, 0.829276f, 0.824661f, 0.820047f, 0.815433f, 0.810819f, 0.806205f, 0.801591f, 0.796976f,
0.792362f, 0.787748f, 0.783134f, 0.77852f, 0.773906f, 0.769291f, 0.764677f, 0.760063f, 0.755449f,
0.750835f, 0.74622f, 0.741606f, 0.736992f, 0.732378f, 0.727764f, 0.72315f, 0.718535f, 0.713921f,
0.709307f, 0.70537f, 0.70211f, 0.69885f, 0.695591f, 0.692331f, 0.689071f, 0.685811f, 0.682551f,
0.83389f, 0.829276f, 0.824661f, 0.820047f, 0.815433f, 0.810819f, 0.806205f, 0.801591f, 0.796976f,
0.792362f, 0.787748f, 0.783134f, 0.77852f, 0.773906f, 0.769291f, 0.764677f, 0.760063f, 0.755449f,
0.750835f, 0.74622f, 0.741606f, 0.736992f, 0.732378f, 0.727764f, 0.72315f, 0.718535f, 0.713921f,
0.709307f, 0.70537f, 0.70211f, 0.69885f, 0.695591f, 0.692331f, 0.689071f, 0.685811f, 0.682551f,
0.679291f, 0.676031f, 0.672772f, 0.669512f, 0.666252f, 0.662992f, 0.659732f, 0.656472f, 0.653213f,
0.649953f, 0.646693f, 0.643433f, 0.640173f, 0.636913f, 0.633654f, 0.630394f, 0.627134f, 0.623874f,
0.620614f, 0.617354f, 0.614094f, 0.610835f, 0.607575f, 0.604315f, 0.601055f, 0.597795f, 0.594535f,
0.591276f, 0.588016f, 0.584756f, 0.581496f, 0.578236f, 0.574976f, 0.571717f, 0.568457f, 0.565197f,
0.561937f, 0.558677f, 0.555417f, 0.552157f, 0.548898f, 0.545638f, 0.542378f, 0.539118f, 0.535858f,
0.532598f, 0.529339f, 0.526079f, 0.522819f, 0.519559f, 0.516299f, 0.513039f, 0.50978f, 0.50652f,
0.50326f, 0.5f
0.532598f, 0.529339f, 0.526079f, 0.522819f, 0.519559f, 0.516299f, 0.513039f, 0.50978f, 0.50652f,
0.50326f, 0.5f
};
// Linearly interpolated between
@@ -546,165 +562,165 @@ f32 gHeadsetPanVolume[128] = {
// f(3/4 * 127) = 0
// f(4/4 * 127) = 1/sqrt(8)
f32 gStereoPanVolume[128] = {
0.707f, 0.716228f, 0.725457f, 0.734685f, 0.743913f, 0.753142f, 0.76237f, 0.771598f, 0.780827f,
0.790055f, 0.799283f, 0.808512f, 0.81774f, 0.826968f, 0.836197f, 0.845425f, 0.854654f, 0.863882f,
0.87311f, 0.882339f, 0.891567f, 0.900795f, 0.910024f, 0.919252f, 0.92848f, 0.937709f, 0.946937f,
0.956165f, 0.965394f, 0.974622f, 0.98385f, 0.993079f, 0.997693f, 0.988465f, 0.979236f, 0.970008f,
0.707f, 0.716228f, 0.725457f, 0.734685f, 0.743913f, 0.753142f, 0.76237f, 0.771598f, 0.780827f,
0.790055f, 0.799283f, 0.808512f, 0.81774f, 0.826968f, 0.836197f, 0.845425f, 0.854654f, 0.863882f,
0.87311f, 0.882339f, 0.891567f, 0.900795f, 0.910024f, 0.919252f, 0.92848f, 0.937709f, 0.946937f,
0.956165f, 0.965394f, 0.974622f, 0.98385f, 0.993079f, 0.997693f, 0.988465f, 0.979236f, 0.970008f,
0.960779f, 0.951551f, 0.942323f, 0.933095f, 0.923866f, 0.914638f, 0.905409f, 0.896181f, 0.886953f,
0.877724f, 0.868496f, 0.859268f, 0.850039f, 0.840811f, 0.831583f, 0.822354f, 0.813126f, 0.803898f,
0.794669f, 0.785441f, 0.776213f, 0.766984f, 0.757756f, 0.748528f, 0.739299f, 0.730071f, 0.720843f,
0.711614f, 0.695866f, 0.673598f, 0.651331f, 0.629063f, 0.606795f, 0.584528f, 0.56226f, 0.539992f,
0.517724f, 0.495457f, 0.473189f, 0.450921f, 0.428654f, 0.406386f, 0.384118f, 0.36185f, 0.339583f,
0.317315f, 0.295047f, 0.27278f, 0.250512f, 0.228244f, 0.205976f, 0.183709f, 0.161441f, 0.139173f,
0.116905f, 0.094638f, 0.07237f, 0.050102f, 0.027835f, 0.005567f, 0.00835f, 0.019484f, 0.030618f,
0.041752f, 0.052886f, 0.06402f, 0.075154f, 0.086287f, 0.097421f, 0.108555f, 0.119689f, 0.130823f,
0.141957f, 0.153091f, 0.164224f, 0.175358f, 0.186492f, 0.197626f, 0.20876f, 0.219894f, 0.231028f,
0.711614f, 0.695866f, 0.673598f, 0.651331f, 0.629063f, 0.606795f, 0.584528f, 0.56226f, 0.539992f,
0.517724f, 0.495457f, 0.473189f, 0.450921f, 0.428654f, 0.406386f, 0.384118f, 0.36185f, 0.339583f,
0.317315f, 0.295047f, 0.27278f, 0.250512f, 0.228244f, 0.205976f, 0.183709f, 0.161441f, 0.139173f,
0.116905f, 0.094638f, 0.07237f, 0.050102f, 0.027835f, 0.005567f, 0.00835f, 0.019484f, 0.030618f,
0.041752f, 0.052886f, 0.06402f, 0.075154f, 0.086287f, 0.097421f, 0.108555f, 0.119689f, 0.130823f,
0.141957f, 0.153091f, 0.164224f, 0.175358f, 0.186492f, 0.197626f, 0.20876f, 0.219894f, 0.231028f,
0.242161f, 0.253295f, 0.264429f, 0.275563f, 0.286697f, 0.297831f, 0.308965f, 0.320098f, 0.331232f,
0.342366f, 0.3535f
};
// gDefaultVolume[k] = cos(pi/2 * k / 127)
f32 gDefaultPanVolume[128] = {
1.0f, 0.999924f, 0.999694f, 0.999312f, 0.998776f, 0.998088f, 0.997248f, 0.996254f, 0.995109f,
1.0f, 0.999924f, 0.999694f, 0.999312f, 0.998776f, 0.998088f, 0.997248f, 0.996254f, 0.995109f,
0.993811f, 0.992361f, 0.990759f, 0.989006f, 0.987101f, 0.985045f, 0.982839f, 0.980482f, 0.977976f,
0.97532f, 0.972514f, 0.96956f, 0.966457f, 0.963207f, 0.959809f, 0.956265f, 0.952574f, 0.948737f,
0.944755f, 0.940629f, 0.936359f, 0.931946f, 0.92739f, 0.922692f, 0.917853f, 0.912873f, 0.907754f,
0.97532f, 0.972514f, 0.96956f, 0.966457f, 0.963207f, 0.959809f, 0.956265f, 0.952574f, 0.948737f,
0.944755f, 0.940629f, 0.936359f, 0.931946f, 0.92739f, 0.922692f, 0.917853f, 0.912873f, 0.907754f,
0.902497f, 0.897101f, 0.891567f, 0.885898f, 0.880093f, 0.874153f, 0.868079f, 0.861873f, 0.855535f,
0.849066f, 0.842467f, 0.835739f, 0.828884f, 0.821901f, 0.814793f, 0.807561f, 0.800204f, 0.792725f,
0.785125f, 0.777405f, 0.769566f, 0.76161f, 0.753536f, 0.745348f, 0.737045f, 0.72863f, 0.720103f,
0.711466f, 0.70272f, 0.693867f, 0.684908f, 0.675843f, 0.666676f, 0.657406f, 0.648036f, 0.638567f,
0.629f, 0.619337f, 0.609579f, 0.599728f, 0.589785f, 0.579752f, 0.56963f, 0.559421f, 0.549126f,
0.538748f, 0.528287f, 0.517745f, 0.507124f, 0.496425f, 0.485651f, 0.474802f, 0.46388f, 0.452888f,
0.785125f, 0.777405f, 0.769566f, 0.76161f, 0.753536f, 0.745348f, 0.737045f, 0.72863f, 0.720103f,
0.711466f, 0.70272f, 0.693867f, 0.684908f, 0.675843f, 0.666676f, 0.657406f, 0.648036f, 0.638567f,
0.629f, 0.619337f, 0.609579f, 0.599728f, 0.589785f, 0.579752f, 0.56963f, 0.559421f, 0.549126f,
0.538748f, 0.528287f, 0.517745f, 0.507124f, 0.496425f, 0.485651f, 0.474802f, 0.46388f, 0.452888f,
0.441826f, 0.430697f, 0.419502f, 0.408243f, 0.396921f, 0.385538f, 0.374097f, 0.362598f, 0.351044f,
0.339436f, 0.327776f, 0.316066f, 0.304308f, 0.292503f, 0.280653f, 0.268761f, 0.256827f, 0.244854f,
0.232844f, 0.220798f, 0.208718f, 0.196606f, 0.184465f, 0.172295f, 0.160098f, 0.147877f, 0.135634f,
0.12337f, 0.111087f, 0.098786f, 0.086471f, 0.074143f, 0.061803f, 0.049454f, 0.037097f, 0.024734f,
0.12337f, 0.111087f, 0.098786f, 0.086471f, 0.074143f, 0.061803f, 0.049454f, 0.037097f, 0.024734f,
0.012368f, 0.0f
};
#if defined(VERSION_JP) || defined(VERSION_US)
// gVolRampingLhs136[k] = 2^16 * max(1, (256*k)^(1/17)
f32 gVolRampingLhs136[128] = {
65536.0f, 90811.555f, 94590.766f, 96873.96f, 98527.26f, 99829.06f, 100905.47f,
101824.61f, 102627.57f, 103341.086f, 103983.55f, 104568.164f, 105104.75f, 105600.8f,
106062.14f, 106493.46f, 106898.52f, 107280.414f, 107641.73f, 107984.62f, 108310.93f,
108622.23f, 108919.875f, 109205.055f, 109478.8f, 109742.0f, 109995.48f, 110239.94f,
110476.02f, 110704.305f, 110925.3f, 111139.45f, 111347.21f, 111548.945f, 111745.0f,
111935.7f, 112121.35f, 112302.2f, 112478.51f, 112650.51f, 112818.4f, 112982.38f,
113142.66f, 113299.37f, 113452.69f, 113602.766f, 113749.734f, 113893.73f, 114034.87f,
114173.26f, 114309.02f, 114442.26f, 114573.055f, 114701.5f, 114827.69f, 114951.695f,
115073.6f, 115193.47f, 115311.375f, 115427.39f, 115541.56f, 115653.96f, 115764.63f,
115873.64f, 115981.04f, 116086.86f, 116191.164f, 116293.99f, 116395.38f, 116495.38f,
116594.02f, 116691.34f, 116787.39f, 116882.19f, 116975.77f, 117068.17f, 117159.414f,
117249.54f, 117338.57f, 117426.53f, 117513.45f, 117599.35f, 117684.266f, 117768.2f,
117851.195f, 117933.266f, 118014.44f, 118094.72f, 118174.14f, 118252.71f, 118330.46f,
118407.4f, 118483.55f, 118558.914f, 118633.53f, 118707.4f, 118780.54f, 118852.97f,
118924.695f, 118995.74f, 119066.11f, 119135.82f, 119204.88f, 119273.31f, 119341.125f,
119408.32f, 119474.92f, 119540.93f, 119606.36f, 119671.22f, 119735.52f, 119799.28f,
119862.5f, 119925.195f, 119987.36f, 120049.02f, 120110.18f, 120170.84f, 120231.016f,
120290.71f, 120349.945f, 120408.7f, 120467.016f, 120524.875f, 120582.3f, 120639.28f,
120695.84f, 120751.984f
65536.0f, 90811.555f, 94590.766f, 96873.96f, 98527.26f, 99829.06f, 100905.47f,
101824.61f, 102627.57f, 103341.086f, 103983.55f, 104568.164f, 105104.75f, 105600.8f,
106062.14f, 106493.46f, 106898.52f, 107280.414f, 107641.73f, 107984.62f, 108310.93f,
108622.23f, 108919.875f, 109205.055f, 109478.8f, 109742.0f, 109995.48f, 110239.94f,
110476.02f, 110704.305f, 110925.3f, 111139.45f, 111347.21f, 111548.945f, 111745.0f,
111935.7f, 112121.35f, 112302.2f, 112478.51f, 112650.51f, 112818.4f, 112982.38f,
113142.66f, 113299.37f, 113452.69f, 113602.766f, 113749.734f, 113893.73f, 114034.87f,
114173.26f, 114309.02f, 114442.26f, 114573.055f, 114701.5f, 114827.69f, 114951.695f,
115073.6f, 115193.47f, 115311.375f, 115427.39f, 115541.56f, 115653.96f, 115764.63f,
115873.64f, 115981.04f, 116086.86f, 116191.164f, 116293.99f, 116395.38f, 116495.38f,
116594.02f, 116691.34f, 116787.39f, 116882.19f, 116975.77f, 117068.17f, 117159.414f,
117249.54f, 117338.57f, 117426.53f, 117513.45f, 117599.35f, 117684.266f, 117768.2f,
117851.195f, 117933.266f, 118014.44f, 118094.72f, 118174.14f, 118252.71f, 118330.46f,
118407.4f, 118483.55f, 118558.914f, 118633.53f, 118707.4f, 118780.54f, 118852.97f,
118924.695f, 118995.74f, 119066.11f, 119135.82f, 119204.88f, 119273.31f, 119341.125f,
119408.32f, 119474.92f, 119540.93f, 119606.36f, 119671.22f, 119735.52f, 119799.28f,
119862.5f, 119925.195f, 119987.36f, 120049.02f, 120110.18f, 120170.84f, 120231.016f,
120290.71f, 120349.945f, 120408.7f, 120467.016f, 120524.875f, 120582.3f, 120639.28f,
120695.84f, 120751.984f
};
// gVolRampingRhs136[k] = 1 / max(1, (256*k)^(1/17))
f32 gVolRampingRhs136[128] = {
1.0f, 0.72167f, 0.692837f, 0.676508f, 0.665156f, 0.656482f, 0.649479f, 0.643616f, 0.638581f,
0.634172f, 0.630254f, 0.62673f, 0.62353f, 0.620601f, 0.617902f, 0.615399f, 0.613067f, 0.610885f,
0.608835f, 0.606901f, 0.605073f, 0.603339f, 0.60169f, 0.600119f, 0.598618f, 0.597183f, 0.595806f,
1.0f, 0.72167f, 0.692837f, 0.676508f, 0.665156f, 0.656482f, 0.649479f, 0.643616f, 0.638581f,
0.634172f, 0.630254f, 0.62673f, 0.62353f, 0.620601f, 0.617902f, 0.615399f, 0.613067f, 0.610885f,
0.608835f, 0.606901f, 0.605073f, 0.603339f, 0.60169f, 0.600119f, 0.598618f, 0.597183f, 0.595806f,
0.594485f, 0.593215f, 0.591991f, 0.590812f, 0.589674f, 0.588573f, 0.587509f, 0.586478f, 0.585479f,
0.58451f, 0.583568f, 0.582654f, 0.581764f, 0.580898f, 0.580055f, 0.579233f, 0.578432f, 0.57765f,
0.58451f, 0.583568f, 0.582654f, 0.581764f, 0.580898f, 0.580055f, 0.579233f, 0.578432f, 0.57765f,
0.576887f, 0.576142f, 0.575414f, 0.574701f, 0.574005f, 0.573323f, 0.572656f, 0.572002f, 0.571361f,
0.570733f, 0.570118f, 0.569514f, 0.568921f, 0.568339f, 0.567768f, 0.567207f, 0.566656f, 0.566114f,
0.565582f, 0.565058f, 0.564543f, 0.564036f, 0.563537f, 0.563046f, 0.562563f, 0.562087f, 0.561618f,
0.561156f, 0.560701f, 0.560253f, 0.559811f, 0.559375f, 0.558945f, 0.558521f, 0.558102f, 0.557689f,
0.557282f, 0.55688f, 0.556483f, 0.556091f, 0.555704f, 0.555322f, 0.554944f, 0.554571f, 0.554203f,
0.553839f, 0.553479f, 0.553123f, 0.552772f, 0.552424f, 0.55208f, 0.55174f, 0.551404f, 0.551071f,
0.557282f, 0.55688f, 0.556483f, 0.556091f, 0.555704f, 0.555322f, 0.554944f, 0.554571f, 0.554203f,
0.553839f, 0.553479f, 0.553123f, 0.552772f, 0.552424f, 0.55208f, 0.55174f, 0.551404f, 0.551071f,
0.550742f, 0.550417f, 0.550095f, 0.549776f, 0.549461f, 0.549148f, 0.548839f, 0.548534f, 0.548231f,
0.547931f, 0.547634f, 0.54734f, 0.547048f, 0.54676f, 0.546474f, 0.546191f, 0.54591f, 0.545632f,
0.545357f, 0.545084f, 0.544813f, 0.544545f, 0.54428f, 0.544016f, 0.543755f, 0.543496f, 0.543239f,
0.547931f, 0.547634f, 0.54734f, 0.547048f, 0.54676f, 0.546474f, 0.546191f, 0.54591f, 0.545632f,
0.545357f, 0.545084f, 0.544813f, 0.544545f, 0.54428f, 0.544016f, 0.543755f, 0.543496f, 0.543239f,
0.542985f, 0.542732f
};
// gVolRampingLhs144[k] = 2^16 * max(1, (256*k)^(1/18))
f32 gVolRampingLhs144[128] = {
65536.0f, 89180.734f, 92681.9f, 94793.33f, 96320.52f, 97522.02f, 98514.84f,
99362.14f, 100101.99f, 100759.16f, 101350.664f, 101888.74f, 102382.46f, 102838.75f,
103263.016f, 103659.58f, 104031.914f, 104382.89f, 104714.88f, 105029.89f, 105329.61f,
105615.5f, 105888.81f, 106150.63f, 106401.914f, 106643.49f, 106876.12f, 107100.44f,
107317.05f, 107526.47f, 107729.17f, 107925.6f, 108116.125f, 108301.12f, 108480.88f,
108655.72f, 108825.91f, 108991.68f, 109153.28f, 109310.914f, 109464.77f, 109615.04f,
109761.88f, 109905.46f, 110045.92f, 110183.41f, 110318.02f, 110449.91f, 110579.17f,
110705.914f, 110830.234f, 110952.234f, 111071.99f, 111189.59f, 111305.12f, 111418.64f,
111530.23f, 111639.95f, 111747.875f, 111854.05f, 111958.54f, 112061.4f, 112162.67f,
112262.42f, 112360.68f, 112457.51f, 112552.93f, 112647.0f, 112739.76f, 112831.23f,
112921.46f, 113010.484f, 113098.33f, 113185.02f, 113270.61f, 113355.11f, 113438.555f,
113520.97f, 113602.375f, 113682.805f, 113762.27f, 113840.81f, 113918.44f, 113995.18f,
114071.055f, 114146.08f, 114220.266f, 114293.65f, 114366.24f, 114438.06f, 114509.12f,
114579.44f, 114649.02f, 114717.91f, 114786.086f, 114853.586f, 114920.42f, 114986.6f,
115052.14f, 115117.055f, 115181.34f, 115245.04f, 115308.13f, 115370.65f, 115432.59f,
115493.98f, 115554.81f, 115615.11f, 115674.875f, 115734.12f, 115792.85f, 115851.08f,
115908.82f, 115966.07f, 116022.85f, 116079.16f, 116135.01f, 116190.4f, 116245.35f,
116299.87f, 116353.945f, 116407.6f, 116460.84f, 116513.67f, 116566.09f, 116618.125f,
116669.76f, 116721.01f
65536.0f, 89180.734f, 92681.9f, 94793.33f, 96320.52f, 97522.02f, 98514.84f,
99362.14f, 100101.99f, 100759.16f, 101350.664f, 101888.74f, 102382.46f, 102838.75f,
103263.016f, 103659.58f, 104031.914f, 104382.89f, 104714.88f, 105029.89f, 105329.61f,
105615.5f, 105888.81f, 106150.63f, 106401.914f, 106643.49f, 106876.12f, 107100.44f,
107317.05f, 107526.47f, 107729.17f, 107925.6f, 108116.125f, 108301.12f, 108480.88f,
108655.72f, 108825.91f, 108991.68f, 109153.28f, 109310.914f, 109464.77f, 109615.04f,
109761.88f, 109905.46f, 110045.92f, 110183.41f, 110318.02f, 110449.91f, 110579.17f,
110705.914f, 110830.234f, 110952.234f, 111071.99f, 111189.59f, 111305.12f, 111418.64f,
111530.23f, 111639.95f, 111747.875f, 111854.05f, 111958.54f, 112061.4f, 112162.67f,
112262.42f, 112360.68f, 112457.51f, 112552.93f, 112647.0f, 112739.76f, 112831.23f,
112921.46f, 113010.484f, 113098.33f, 113185.02f, 113270.61f, 113355.11f, 113438.555f,
113520.97f, 113602.375f, 113682.805f, 113762.27f, 113840.81f, 113918.44f, 113995.18f,
114071.055f, 114146.08f, 114220.266f, 114293.65f, 114366.24f, 114438.06f, 114509.12f,
114579.44f, 114649.02f, 114717.91f, 114786.086f, 114853.586f, 114920.42f, 114986.6f,
115052.14f, 115117.055f, 115181.34f, 115245.04f, 115308.13f, 115370.65f, 115432.59f,
115493.98f, 115554.81f, 115615.11f, 115674.875f, 115734.12f, 115792.85f, 115851.08f,
115908.82f, 115966.07f, 116022.85f, 116079.16f, 116135.01f, 116190.4f, 116245.35f,
116299.87f, 116353.945f, 116407.6f, 116460.84f, 116513.67f, 116566.09f, 116618.125f,
116669.76f, 116721.01f
};
// gVolRampingRhs144[k] = 1 / max(1, (256*k)^(1/18))
f32 gVolRampingRhs144[128] = {
1.0f, 0.734867f, 0.707107f, 0.691357f, 0.680395f, 0.672012f, 0.66524f, 0.659567f, 0.654692f,
0.650422f, 0.646626f, 0.643211f, 0.64011f, 0.637269f, 0.634651f, 0.632223f, 0.629961f, 0.627842f,
1.0f, 0.734867f, 0.707107f, 0.691357f, 0.680395f, 0.672012f, 0.66524f, 0.659567f, 0.654692f,
0.650422f, 0.646626f, 0.643211f, 0.64011f, 0.637269f, 0.634651f, 0.632223f, 0.629961f, 0.627842f,
0.625852f, 0.623975f, 0.622199f, 0.620515f, 0.618913f, 0.617387f, 0.615929f, 0.614533f, 0.613196f,
0.611912f, 0.610677f, 0.609487f, 0.60834f, 0.607233f, 0.606163f, 0.605128f, 0.604125f, 0.603153f,
0.60221f, 0.601294f, 0.600403f, 0.599538f, 0.598695f, 0.597874f, 0.597074f, 0.596294f, 0.595533f,
0.59479f, 0.594064f, 0.593355f, 0.592661f, 0.591983f, 0.591319f, 0.590669f, 0.590032f, 0.589408f,
0.588796f, 0.588196f, 0.587608f, 0.58703f, 0.586463f, 0.585906f, 0.58536f, 0.584822f, 0.584294f,
0.611912f, 0.610677f, 0.609487f, 0.60834f, 0.607233f, 0.606163f, 0.605128f, 0.604125f, 0.603153f,
0.60221f, 0.601294f, 0.600403f, 0.599538f, 0.598695f, 0.597874f, 0.597074f, 0.596294f, 0.595533f,
0.59479f, 0.594064f, 0.593355f, 0.592661f, 0.591983f, 0.591319f, 0.590669f, 0.590032f, 0.589408f,
0.588796f, 0.588196f, 0.587608f, 0.58703f, 0.586463f, 0.585906f, 0.58536f, 0.584822f, 0.584294f,
0.583775f, 0.583265f, 0.582762f, 0.582268f, 0.581782f, 0.581303f, 0.580832f, 0.580368f, 0.579911f,
0.57946f, 0.579017f, 0.578579f, 0.578148f, 0.577722f, 0.577303f, 0.576889f, 0.576481f, 0.576078f,
0.575681f, 0.575289f, 0.574902f, 0.574519f, 0.574142f, 0.573769f, 0.5734f, 0.573036f, 0.572677f,
0.572321f, 0.57197f, 0.571623f, 0.57128f, 0.57094f, 0.570605f, 0.570273f, 0.569945f, 0.56962f,
0.57946f, 0.579017f, 0.578579f, 0.578148f, 0.577722f, 0.577303f, 0.576889f, 0.576481f, 0.576078f,
0.575681f, 0.575289f, 0.574902f, 0.574519f, 0.574142f, 0.573769f, 0.5734f, 0.573036f, 0.572677f,
0.572321f, 0.57197f, 0.571623f, 0.57128f, 0.57094f, 0.570605f, 0.570273f, 0.569945f, 0.56962f,
0.569299f, 0.568981f, 0.568667f, 0.568355f, 0.568047f, 0.567743f, 0.567441f, 0.567142f, 0.566846f,
0.566553f, 0.566263f, 0.565976f, 0.565692f, 0.56541f, 0.565131f, 0.564854f, 0.56458f, 0.564309f,
0.56404f, 0.563773f, 0.563509f, 0.563247f, 0.562987f, 0.56273f, 0.562475f, 0.562222f, 0.561971f,
0.566553f, 0.566263f, 0.565976f, 0.565692f, 0.56541f, 0.565131f, 0.564854f, 0.56458f, 0.564309f,
0.56404f, 0.563773f, 0.563509f, 0.563247f, 0.562987f, 0.56273f, 0.562475f, 0.562222f, 0.561971f,
0.561722f, 0.561476f
};
// gVolRampingLhs128[k] = 2^16 * max(1, (256*k)^(1/16))
f32 gVolRampingLhs128[128] = {
65536.0f, 92681.9f, 96785.28f, 99269.31f, 101070.33f, 102489.78f, 103664.336f,
104667.914f, 105545.09f, 106324.92f, 107027.39f, 107666.84f, 108253.95f, 108796.87f,
109301.95f, 109774.29f, 110217.98f, 110636.39f, 111032.33f, 111408.164f, 111765.9f,
112107.234f, 112433.66f, 112746.46f, 113046.766f, 113335.555f, 113613.72f, 113882.02f,
114141.164f, 114391.77f, 114634.414f, 114869.58f, 115097.74f, 115319.31f, 115534.68f,
115744.19f, 115948.16f, 116146.875f, 116340.625f, 116529.66f, 116714.195f, 116894.46f,
117070.64f, 117242.945f, 117411.52f, 117576.55f, 117738.17f, 117896.54f, 118051.77f,
118204.0f, 118353.35f, 118499.92f, 118643.83f, 118785.16f, 118924.01f, 119060.47f,
119194.625f, 119326.555f, 119456.336f, 119584.03f, 119709.71f, 119833.445f, 119955.29f,
120075.31f, 120193.555f, 120310.08f, 120424.94f, 120538.17f, 120649.836f, 120759.97f,
120868.62f, 120975.82f, 121081.62f, 121186.05f, 121289.14f, 121390.94f, 121491.47f,
121590.766f, 121688.87f, 121785.79f, 121881.57f, 121976.24f, 122069.82f, 122162.33f,
122253.805f, 122344.266f, 122433.73f, 122522.23f, 122609.77f, 122696.4f, 122782.11f,
122866.93f, 122950.89f, 123033.99f, 123116.26f, 123197.72f, 123278.37f, 123358.24f,
123437.34f, 123515.69f, 123593.3f, 123670.19f, 123746.36f, 123821.84f, 123896.63f,
123970.76f, 124044.23f, 124117.04f, 124189.23f, 124260.78f, 124331.73f, 124402.07f,
124471.83f, 124540.99f, 124609.59f, 124677.63f, 124745.12f, 124812.055f, 124878.47f,
124944.34f, 125009.71f, 125074.57f, 125138.92f, 125202.79f, 125266.164f, 125329.06f,
125391.5f, 125453.47f
65536.0f, 92681.9f, 96785.28f, 99269.31f, 101070.33f, 102489.78f, 103664.336f,
104667.914f, 105545.09f, 106324.92f, 107027.39f, 107666.84f, 108253.95f, 108796.87f,
109301.95f, 109774.29f, 110217.98f, 110636.39f, 111032.33f, 111408.164f, 111765.9f,
112107.234f, 112433.66f, 112746.46f, 113046.766f, 113335.555f, 113613.72f, 113882.02f,
114141.164f, 114391.77f, 114634.414f, 114869.58f, 115097.74f, 115319.31f, 115534.68f,
115744.19f, 115948.16f, 116146.875f, 116340.625f, 116529.66f, 116714.195f, 116894.46f,
117070.64f, 117242.945f, 117411.52f, 117576.55f, 117738.17f, 117896.54f, 118051.77f,
118204.0f, 118353.35f, 118499.92f, 118643.83f, 118785.16f, 118924.01f, 119060.47f,
119194.625f, 119326.555f, 119456.336f, 119584.03f, 119709.71f, 119833.445f, 119955.29f,
120075.31f, 120193.555f, 120310.08f, 120424.94f, 120538.17f, 120649.836f, 120759.97f,
120868.62f, 120975.82f, 121081.62f, 121186.05f, 121289.14f, 121390.94f, 121491.47f,
121590.766f, 121688.87f, 121785.79f, 121881.57f, 121976.24f, 122069.82f, 122162.33f,
122253.805f, 122344.266f, 122433.73f, 122522.23f, 122609.77f, 122696.4f, 122782.11f,
122866.93f, 122950.89f, 123033.99f, 123116.26f, 123197.72f, 123278.37f, 123358.24f,
123437.34f, 123515.69f, 123593.3f, 123670.19f, 123746.36f, 123821.84f, 123896.63f,
123970.76f, 124044.23f, 124117.04f, 124189.23f, 124260.78f, 124331.73f, 124402.07f,
124471.83f, 124540.99f, 124609.59f, 124677.63f, 124745.12f, 124812.055f, 124878.47f,
124944.34f, 125009.71f, 125074.57f, 125138.92f, 125202.79f, 125266.164f, 125329.06f,
125391.5f, 125453.47f
};
// gVolRampingRhs128[k] = 1 / max(1, (256*k)^(1/16))
f32 gVolRampingRhs128[128] = {
1.0f, 0.707107f, 0.677128f, 0.660184f, 0.64842f, 0.639439f, 0.632194f, 0.626133f, 0.620929f,
0.616375f, 0.612329f, 0.608693f, 0.605391f, 0.60237f, 0.599587f, 0.597007f, 0.594604f, 0.592355f,
1.0f, 0.707107f, 0.677128f, 0.660184f, 0.64842f, 0.639439f, 0.632194f, 0.626133f, 0.620929f,
0.616375f, 0.612329f, 0.608693f, 0.605391f, 0.60237f, 0.599587f, 0.597007f, 0.594604f, 0.592355f,
0.590243f, 0.588251f, 0.586369f, 0.584583f, 0.582886f, 0.581269f, 0.579725f, 0.578247f, 0.576832f,
0.575473f, 0.574166f, 0.572908f, 0.571696f, 0.570525f, 0.569394f, 0.5683f, 0.567241f, 0.566214f,
0.575473f, 0.574166f, 0.572908f, 0.571696f, 0.570525f, 0.569394f, 0.5683f, 0.567241f, 0.566214f,
0.565218f, 0.564251f, 0.563311f, 0.562398f, 0.561508f, 0.560642f, 0.559799f, 0.558976f, 0.558173f,
0.55739f, 0.556625f, 0.555877f, 0.555146f, 0.554431f, 0.553732f, 0.553047f, 0.552376f, 0.551719f,
0.55739f, 0.556625f, 0.555877f, 0.555146f, 0.554431f, 0.553732f, 0.553047f, 0.552376f, 0.551719f,
0.551075f, 0.550443f, 0.549823f, 0.549216f, 0.548619f, 0.548033f, 0.547458f, 0.546892f, 0.546337f,
0.545791f, 0.545254f, 0.544726f, 0.544206f, 0.543695f, 0.543192f, 0.542696f, 0.542209f, 0.541728f,
0.541255f, 0.540788f, 0.540329f, 0.539876f, 0.539429f, 0.538988f, 0.538554f, 0.538125f, 0.537702f,
0.537285f, 0.536873f, 0.536467f, 0.536065f, 0.535669f, 0.535277f, 0.534891f, 0.534509f, 0.534131f,
0.533759f, 0.53339f, 0.533026f, 0.532666f, 0.53231f, 0.531958f, 0.53161f, 0.531266f, 0.530925f,
0.533759f, 0.53339f, 0.533026f, 0.532666f, 0.53231f, 0.531958f, 0.53161f, 0.531266f, 0.530925f,
0.530588f, 0.530255f, 0.529926f, 0.529599f, 0.529277f, 0.528957f, 0.528641f, 0.528328f, 0.528018f,
0.527711f, 0.527407f, 0.527106f, 0.526808f, 0.526513f, 0.52622f, 0.525931f, 0.525644f, 0.525359f,
0.527711f, 0.527407f, 0.527106f, 0.526808f, 0.526513f, 0.52622f, 0.525931f, 0.525644f, 0.525359f,
0.525077f, 0.524798f, 0.524522f, 0.524247f, 0.523975f, 0.523706f, 0.523439f, 0.523174f, 0.522911f,
0.522651f, 0.522393f
};
@@ -888,11 +904,11 @@ volatile s32 gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
#endif
#if defined(VERSION_EU)
u8 bufferDelete2[12] = { 0 };
u8 bufferDelete2[12] = {0};
u8 D_EU_80302010 = 0;
u8 D_EU_80302014 = 0;
struct OSMesgQueue *OSMesgQueues[4] = { &OSMesgQueue0, &OSMesgQueue1, &OSMesgQueue2, &OSMesgQueue3 };
struct OSMesgQueue *OSMesgQueues[4] = {&OSMesgQueue0, &OSMesgQueue1, &OSMesgQueue2, &OSMesgQueue3};
#elif defined(VERSION_JP) || defined(VERSION_US)
s8 sUnused8033EF8 = 24;
#endif
+254 -172
View File
@@ -14,29 +14,32 @@
f32 gTrackVolume = 1.0f;
#if defined(VERSION_EU) || defined(VERSION_SH)
void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 recalculateVolume) {
void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 recalculateVolume)
{
f32 channelVolume;
s32 i;
if (seqChannel->changes.as_bitfields.volume || recalculateVolume) {
if (seqChannel->changes.as_bitfields.volume || recalculateVolume)
{
channelVolume = seqChannel->volume * seqChannel->volumeScale * seqChannel->seqPlayer->appliedFadeVolume;
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) {
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0)
{
channelVolume = seqChannel->seqPlayer->muteVolumeScale * channelVolume;
}
#ifdef VERSION_SH
seqChannel->appliedVolume = channelVolume * channelVolume;
seqChannel->appliedVolume= channelVolume* channelVolume;
#else
seqChannel->appliedVolume = channelVolume;
seqChannel->appliedVolume= channelVolume;
#endif
}
}
if (seqChannel->changes.as_bitfields.pan) {
seqChannel->pan = seqChannel->newPan * seqChannel->panChannelWeight;
}
for (i = 0; i < 4; ++i) {
for (i =0; i<4;++i) {
struct SequenceChannelLayer *layer = seqChannel->layers[i];
if (layer != NULL && layer->enabled && layer->note != NULL) {
if (layer != nullptr && layer->enabled && layer->note != nullptr) {
if (layer->notePropertiesNeedInit) {
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
layer->noteVelocity = layer->velocitySquare * seqChannel->appliedVolume;
@@ -55,26 +58,30 @@ void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 reca
}
}
}
seqChannel->changes.as_u8 = 0;
seqChannel->changes.as_u8=0;
}
#else
static void sequence_channel_process_sound(struct SequenceChannel *seqChannel) {
static void sequence_channel_process_sound(struct SequenceChannel *seqChannel)
{
f32 channelVolume;
f32 panLayerWeight;
f32 panFromChannel;
s32 i;
channelVolume = seqChannel->volume * seqChannel->volumeScale * seqChannel->seqPlayer->fadeVolume;
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) {
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0)
{
channelVolume *= seqChannel->seqPlayer->muteVolumeScale;
}
panFromChannel = seqChannel->pan * seqChannel->panChannelWeight;
panLayerWeight = US_FLOAT(1.0) - seqChannel->panChannelWeight;
for (i = 0; i < 4; i++) {
for (i = 0; i < 4; i++)
{
struct SequenceChannelLayer *layer = seqChannel->layers[i];
if (layer != NULL && layer->enabled && layer->note != NULL) {
if (layer != nullptr && layer->enabled && layer->note != nullptr)
{
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
layer->noteVelocity = layer->velocitySquare * (channelVolume * gTrackVolume);
layer->notePan = (layer->pan * panLayerWeight) + panFromChannel;
@@ -83,30 +90,37 @@ static void sequence_channel_process_sound(struct SequenceChannel *seqChannel) {
}
#endif
void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
void sequence_player_process_sound(struct SequencePlayer *seqPlayer)
{
s32 i;
if (seqPlayer->fadeRemainingFrames != 0) {
if (seqPlayer->fadeRemainingFrames != 0)
{
seqPlayer->fadeVolume += seqPlayer->fadeVelocity;
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
seqPlayer->recalculateVolume = TRUE;
#endif
#endif
if (seqPlayer->fadeVolume > US_FLOAT2(1)) {
if (seqPlayer->fadeVolume > US_FLOAT2(1))
{
seqPlayer->fadeVolume = US_FLOAT2(1);
}
if (seqPlayer->fadeVolume < 0) {
if (seqPlayer->fadeVolume < 0)
{
seqPlayer->fadeVolume = 0;
}
if (--seqPlayer->fadeRemainingFrames == 0) {
#if defined(VERSION_EU) || defined(VERSION_SH)
if (seqPlayer->state == 2) {
if (--seqPlayer->fadeRemainingFrames == 0)
{
#if defined(VERSION_EU) || defined(VERSION_SH)
if (seqPlayer->state == 2)
{
sequence_player_disable(seqPlayer);
return;
}
#else
switch (seqPlayer->state) {
#else
switch (seqPlayer->state)
{
case SEQUENCE_PLAYER_STATE_FADE_OUT:
sequence_player_disable(seqPlayer);
return;
@@ -119,77 +133,85 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
case SEQUENCE_PLAYER_STATE_4:
break;
}
#endif
#endif
}
}
#if defined(VERSION_EU) || defined(VERSION_SH)
if (seqPlayer->recalculateVolume) {
#if defined(VERSION_EU) || defined(VERSION_SH)
if (seqPlayer->recalculateVolume)
{
seqPlayer->appliedFadeVolume = seqPlayer->fadeVolume * seqPlayer->fadeVolumeScale;
}
#endif
#endif
// Process channels
for (i = 0; i < CHANNELS_MAX; i++) {
for (i = 0; i < CHANNELS_MAX; i++)
{
if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[i]) == TRUE
&& seqPlayer->channels[i]->enabled == TRUE) {
#if defined(VERSION_EU) || defined(VERSION_SH)
&& seqPlayer->channels[i]->enabled == TRUE)
{
#if defined(VERSION_EU) || defined(VERSION_SH)
sequence_channel_process_sound(seqPlayer->channels[i], seqPlayer->recalculateVolume);
#else
#else
sequence_channel_process_sound(seqPlayer->channels[i]);
#endif
#endif
}
}
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
seqPlayer->recalculateVolume = FALSE;
#endif
#endif
}
f32 get_portamento_freq_scale(struct Portamento *p) {
f32 get_portamento_freq_scale(struct Portamento *p)
{
u32 v0;
f32 result;
#if defined(VERSION_JP) || defined(VERSION_US)
if (p->mode == 0) {
#if defined(VERSION_JP) || defined(VERSION_US)
if (p->mode == 0)
{
return 1.0f;
}
#endif
#endif
p->cur += p->speed;
v0 = (u32) p->cur;
v0 = (u32)p->cur;
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
if (v0 > 127)
#else
#else
if (v0 >= 127)
#endif
#endif
{
v0 = 127;
}
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
result = US_FLOAT(1.0) + p->extent * (gPitchBendFrequencyScale[v0 + 128] - US_FLOAT(1.0));
#else
#else
result = US_FLOAT(1.0) + p->extent * (gPitchBendFrequencyScale[v0 + 127] - US_FLOAT(1.0));
#endif
#endif
return result;
}
#if defined(VERSION_EU) || defined(VERSION_SH)
s16 get_vibrato_pitch_change(struct VibratoState *vib) {
s16 get_vibrato_pitch_change(struct VibratoState *vib)
{
s32 index;
vib->time += (s32) vib->rate;
vib->time += (s32)vib->rate;
index = (vib->time >> 10) & 0x3F;
return vib->curve[index] >> 8;
}
#else
s8 get_vibrato_pitch_change(struct VibratoState *vib) {
s8 get_vibrato_pitch_change(struct VibratoState *vib)
{
s32 index;
vib->time += vib->rate;
index = (vib->time >> 10) & 0x3F;
switch (index & 0x30) {
switch (index & 0x30)
{
case 0x10:
index = 31 - index;
@@ -209,181 +231,225 @@ s8 get_vibrato_pitch_change(struct VibratoState *vib) {
}
#endif
f32 get_vibrato_freq_scale(struct VibratoState *vib) {
f32 get_vibrato_freq_scale(struct VibratoState *vib)
{
s32 pitchChange;
f32 extent;
f32 result;
if (vib->delay != 0) {
if (vib->delay != 0)
{
vib->delay--;
return 1;
}
if (vib->extentChangeTimer) {
if (vib->extentChangeTimer == 1) {
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
} else {
if (vib->extentChangeTimer)
{
if (vib->extentChangeTimer == 1)
{
vib->extent = (s32)vib->seqChannel->vibratoExtentTarget;
}
else
{
vib->extent +=
((s32) vib->seqChannel->vibratoExtentTarget - vib->extent) / (s32) vib->extentChangeTimer;
((s32)vib->seqChannel->vibratoExtentTarget - vib->extent) / (s32)vib->extentChangeTimer;
}
vib->extentChangeTimer--;
} else if (vib->seqChannel->vibratoExtentTarget != (s32) vib->extent) {
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0) {
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
}
else if (vib->seqChannel->vibratoExtentTarget != (s32)vib->extent)
{
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0)
{
vib->extent = (s32)vib->seqChannel->vibratoExtentTarget;
}
}
if (vib->rateChangeTimer) {
if (vib->rateChangeTimer == 1) {
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
} else {
vib->rate += ((s32) vib->seqChannel->vibratoRateTarget - vib->rate) / (s32) vib->rateChangeTimer;
if (vib->rateChangeTimer)
{
if (vib->rateChangeTimer == 1)
{
vib->rate = (s32)vib->seqChannel->vibratoRateTarget;
}
else
{
vib->rate += ((s32)vib->seqChannel->vibratoRateTarget - vib->rate) / (s32)vib->rateChangeTimer;
}
vib->rateChangeTimer--;
} else if (vib->seqChannel->vibratoRateTarget != (s32) vib->rate) {
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0) {
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
}
else if (vib->seqChannel->vibratoRateTarget != (s32)vib->rate)
{
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0)
{
vib->rate = (s32)vib->seqChannel->vibratoRateTarget;
}
}
if (vib->extent == 0) {
if (vib->extent == 0)
{
return 1.0f;
}
pitchChange = get_vibrato_pitch_change(vib);
extent = (f32) vib->extent / US_FLOAT(4096.0);
extent = (f32)vib->extent / US_FLOAT(4096.0);
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
result = US_FLOAT(1.0) + extent * (gPitchBendFrequencyScale[pitchChange + 128] - US_FLOAT(1.0));
#else
#else
result = US_FLOAT(1.0) + extent * (gPitchBendFrequencyScale[pitchChange + 127] - US_FLOAT(1.0));
#endif
#endif
return result;
}
void note_vibrato_update(struct Note *note) {
#if defined(VERSION_EU) || defined(VERSION_SH)
if (note->portamento.mode != 0) {
void note_vibrato_update(struct Note *note)
{
#if defined(VERSION_EU) || defined(VERSION_SH)
if (note->portamento.mode != 0)
{
note->portamentoFreqScale = get_portamento_freq_scale(&note->portamento);
}
if (note->vibratoState.active && note->parentLayer != NO_LAYER) {
if (note->vibratoState.active && note->parentLayer != NO_LAYER)
{
note->vibratoFreqScale = get_vibrato_freq_scale(&note->vibratoState);
}
#else
if (note->vibratoState.active) {
#else
if (note->vibratoState.active)
{
note->portamentoFreqScale = get_portamento_freq_scale(&note->portamento);
if (note->parentLayer != NO_LAYER) {
if (note->parentLayer != NO_LAYER)
{
note->vibratoFreqScale = get_vibrato_freq_scale(&note->vibratoState);
}
}
#endif
#endif
}
void note_vibrato_init(struct Note *note) {
void note_vibrato_init(struct Note *note)
{
struct VibratoState *vib;
UNUSED struct SequenceChannel *seqChannel;
#if defined(VERSION_EU) || defined(VERSION_SH)
struct NotePlaybackState *seqPlayerState = (struct NotePlaybackState *) &note->priority;
#endif
UNUSED
struct SequenceChannel *seqChannel;
#if defined(VERSION_EU) || defined(VERSION_SH)
struct NotePlaybackState *seqPlayerState = (struct NotePlaybackState *)&note->priority;
#endif
note->vibratoFreqScale = 1.0f;
note->portamentoFreqScale = 1.0f;
vib = &note->vibratoState;
#if defined(VERSION_JP) || defined(VERSION_US)
#if defined(VERSION_JP) || defined(VERSION_US)
if (note->parentLayer->seqChannel->vibratoExtentStart == 0
&& note->parentLayer->seqChannel->vibratoExtentTarget == 0
&& note->parentLayer->portamento.mode == 0) {
&& note->parentLayer->portamento.mode == 0)
{
vib->active = FALSE;
return;
}
#endif
#endif
vib->active = TRUE;
vib->time = 0;
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
vib->curve = gWaveSamples[2];
vib->seqChannel = note->parentLayer->seqChannel;
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0) {
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0)
{
vib->extent = FLOAT_CAST(vib->seqChannel->vibratoExtentTarget);
} else {
}
else
{
vib->extent = FLOAT_CAST(vib->seqChannel->vibratoExtentStart);
}
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0) {
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0)
{
vib->rate = FLOAT_CAST(vib->seqChannel->vibratoRateTarget);
} else {
}
else
{
vib->rate = FLOAT_CAST(vib->seqChannel->vibratoRateStart);
}
vib->delay = vib->seqChannel->vibratoDelay;
seqPlayerState->portamento = seqPlayerState->parentLayer->portamento;
#else
#else
vib->curve = gVibratoCurve;
vib->seqChannel = note->parentLayer->seqChannel;
seqChannel = vib->seqChannel;
if ((vib->extentChangeTimer = seqChannel->vibratoExtentChangeDelay) == 0) {
if ((vib->extentChangeTimer = seqChannel->vibratoExtentChangeDelay) == 0)
{
vib->extent = seqChannel->vibratoExtentTarget;
} else {
}
else
{
vib->extent = seqChannel->vibratoExtentStart;
}
if ((vib->rateChangeTimer = seqChannel->vibratoRateChangeDelay) == 0) {
if ((vib->rateChangeTimer = seqChannel->vibratoRateChangeDelay) == 0)
{
vib->rate = seqChannel->vibratoRateTarget;
} else {
}
else
{
vib->rate = seqChannel->vibratoRateStart;
}
vib->delay = seqChannel->vibratoDelay;
note->portamento = note->parentLayer->portamento;
#endif
#endif
}
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16 *volOut) {
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16 *volOut)
{
adsr->action = 0;
adsr->state = ADSR_STATE_DISABLED;
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
adsr->delay = 0;
adsr->envelope = envelope;
#ifdef VERSION_SH
#ifdef VERSION_SH
adsr->sustain = 0.0f;
#endif
#endif
adsr->current = 0.0f;
#else
#else
adsr->initial = 0;
adsr->delay = 0;
adsr->velocity = 0;
adsr->envelope = envelope;
adsr->volOut = volOut;
#endif
#endif
}
#if defined(VERSION_EU) || defined(VERSION_SH)
f32 adsr_update(struct AdsrState *adsr) {
f32 adsr_update(struct AdsrState *adsr)
{
#else
s32 adsr_update(struct AdsrState *adsr) {
#endif
s32 adsr_update(struct AdsrState *adsr)
{
#endif
u8 action = adsr->action;
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
u8 state = adsr->state;
switch (state) {
#else
switch (adsr->state) {
#endif
#else
switch (adsr->state)
{
#endif
case ADSR_STATE_DISABLED:
return 0;
case ADSR_STATE_INITIAL: {
#if defined(VERSION_JP) || defined(VERSION_US)
case ADSR_STATE_INITIAL:
{
#if defined(VERSION_JP) || defined(VERSION_US)
adsr->current = adsr->initial;
adsr->target = adsr->initial;
#endif
if (action & ADSR_ACTION_HANG) {
#endif
if (action & ADSR_ACTION_HANG)
{
adsr->state = ADSR_STATE_HANG;
break;
}
@@ -392,18 +458,19 @@ s32 adsr_update(struct AdsrState *adsr) {
case ADSR_STATE_START_LOOP:
adsr->envIndex = 0;
#if defined(VERSION_JP) || defined(VERSION_US)
#if defined(VERSION_JP) || defined(VERSION_US)
adsr->currentHiRes = adsr->current << 0x10;
#endif
#endif
adsr->state = ADSR_STATE_LOOP;
// fallthrough
#ifdef VERSION_SH
restart:
#endif
#ifdef VERSION_SH
restart:
#endif
case ADSR_STATE_LOOP:
adsr->delay = BSWAP16(adsr->envelope[adsr->envIndex].delay);
switch (adsr->delay) {
switch (adsr->delay)
{
case ADSR_DISABLE:
adsr->state = ADSR_STATE_DISABLED;
break;
@@ -412,134 +479,149 @@ s32 adsr_update(struct AdsrState *adsr) {
break;
case ADSR_GOTO:
adsr->envIndex = BSWAP16(adsr->envelope[adsr->envIndex].arg);
#ifdef VERSION_SH
#ifdef VERSION_SH
goto restart;
#else
#else
break;
#endif
#endif
case ADSR_RESTART:
adsr->state = ADSR_STATE_INITIAL;
break;
default:
#if defined(VERSION_EU) || defined(VERSION_SH)
if (adsr->delay >= 4) {
#if defined(VERSION_EU) || defined(VERSION_SH)
if (adsr->delay >= 4)
{
adsr->delay = adsr->delay * gAudioBufferParameters.updatesPerFrame
#ifdef VERSION_SH
#ifdef VERSION_SH
/ gAudioBufferParameters.presetUnk4
#endif
#endif
/ 4;
}
#if defined(VERSION_SH)
if (adsr->delay == 0) {
#if defined(VERSION_SH)
if (adsr->delay == 0)
{
adsr->delay = 1;
}
adsr->target = (f32) BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
#elif defined(VERSION_EU)
adsr->target = (f32) BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0;
#endif
adsr->target = (f32)BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
#elif defined(VERSION_EU)
adsr->target = (f32)BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0;
#endif
adsr->target = adsr->target * adsr->target;
adsr->velocity = (adsr->target - adsr->current) / adsr->delay;
#else
#else
adsr->target = BSWAP16(adsr->envelope[adsr->envIndex].arg);
adsr->velocity = ((adsr->target - adsr->current) << 0x10) / adsr->delay;
#endif
#endif
adsr->state = ADSR_STATE_FADE;
adsr->envIndex++;
break;
}
if (adsr->state != ADSR_STATE_FADE) {
if (adsr->state != ADSR_STATE_FADE)
{
break;
}
// fallthrough
// fallthrough
case ADSR_STATE_FADE:
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
adsr->current += adsr->velocity;
#else
#else
adsr->currentHiRes += adsr->velocity;
adsr->current = adsr->currentHiRes >> 0x10;
#endif
if (--adsr->delay <= 0) {
#endif
if (--adsr->delay <= 0)
{
adsr->state = ADSR_STATE_LOOP;
}
// fallthrough
// fallthrough
case ADSR_STATE_HANG:
break;
case ADSR_STATE_DECAY:
case ADSR_STATE_RELEASE: {
case ADSR_STATE_RELEASE:
{
adsr->current -= adsr->fadeOutVel;
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
if (adsr->sustain != 0.0f && state == ADSR_STATE_DECAY) {
#else
if (adsr->sustain != 0 && adsr->state == ADSR_STATE_DECAY) {
#endif
if (adsr->current < adsr->sustain) {
#else
if (adsr->sustain != 0 && adsr->state == ADSR_STATE_DECAY)
{
#endif
if (adsr->current < adsr->sustain)
{
adsr->current = adsr->sustain;
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
adsr->delay = 128;
#else
#else
adsr->delay = adsr->sustain / 16;
#endif
#endif
adsr->state = ADSR_STATE_SUSTAIN;
}
break;
}
#if defined(VERSION_SH)
if (adsr->current < 0.00001f) {
#if defined(VERSION_SH)
if (adsr->current < 0.00001f)
{
adsr->current = 0.0f;
adsr->state = ADSR_STATE_DISABLED;
}
#elif defined(VERSION_EU)
if (adsr->current < 0) {
#elif defined(VERSION_EU)
if (adsr->current < 0)
{
adsr->current = 0.0f;
adsr->state = ADSR_STATE_DISABLED;
}
#else
if (adsr->current < 100) {
#else
if (adsr->current < 100)
{
adsr->current = 0;
adsr->state = ADSR_STATE_DISABLED;
}
#endif
#endif
break;
}
case ADSR_STATE_SUSTAIN:
adsr->delay -= 1;
if (adsr->delay == 0) {
if (adsr->delay == 0)
{
adsr->state = ADSR_STATE_RELEASE;
}
break;
}
if ((action & ADSR_ACTION_DECAY)) {
if ((action & ADSR_ACTION_DECAY))
{
adsr->state = ADSR_STATE_DECAY;
adsr->action = action & ~ADSR_ACTION_DECAY;
}
if ((action & ADSR_ACTION_RELEASE)) {
if ((action & ADSR_ACTION_RELEASE))
{
adsr->state = ADSR_STATE_RELEASE;
#if defined(VERSION_EU) || defined(VERSION_SH)
#if defined(VERSION_EU) || defined(VERSION_SH)
adsr->action = action & ~ADSR_ACTION_RELEASE;
#else
#else
adsr->action = action & ~(ADSR_ACTION_RELEASE | ADSR_ACTION_DECAY);
#endif
#endif
}
#if defined(VERSION_EU) || defined(VERSION_SH)
if (adsr->current < 0.0f) {
#if defined(VERSION_EU) || defined(VERSION_SH)
if (adsr->current < 0.0f)
{
return 0.0f;
}
if (adsr->current > 1.0f) {
if (adsr->current > 1.0f)
{
eu_stubbed_printf_1("Audio:Envp: overflow %f\n", adsr->current);
return 1.0f;
}
return adsr->current;
#else
#else
*adsr->volOut = adsr->current;
return 0;
#endif
#endif
}
+3
View File
@@ -36,8 +36,11 @@
extern f32 gTrackVolume;
void sequence_player_process_sound(struct SequencePlayer *seqPlayer);
void note_vibrato_update(struct Note *note);
void note_vibrato_init(struct Note *note);
void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, s16 *volOut);
#if defined(VERSION_EU) || defined(VERSION_SH)
f32 adsr_update(struct AdsrState *adsr);
+1005 -653
View File
File diff suppressed because it is too large Load Diff
+37 -2
View File
@@ -24,7 +24,8 @@ extern u32 gAudioRandom;
extern f32 gAudioVolume;
extern u8 gAudioReverb;
struct Sound {
struct Sound
{
s32 soundBits;
f32 *position;
}; // size = 0x8
@@ -35,39 +36,73 @@ extern u8 sSoundRequestCount;
extern u8 gAudioSPTaskYieldBuffer[]; // ucode yield data ptr; only used in JP
struct SPTask *create_next_audio_frame_task(void);
void create_next_audio_buffer(s16 *samples, u32 num_samples);
void audio_signal_game_loop_tick(void);
void update_game_sound(void);
void seq_player_fade_out(u8 player, u16 fadeDuration);
void fade_volume_scale(u8 player, u8 targetScale, u16 fadeDuration);
void seq_player_lower_volume(u8 player, u16 fadeDuration, u8 percentage);
void seq_player_unlower_volume(u8 player, u16 fadeDuration);
void set_audio_muted(u8 muted);
void sound_init(void);
void get_currently_playing_sound(u8 bank, u8 *numPlayingSounds, u8 *numSoundsInBank, u8 *soundId);
void stop_sound(u32 soundBits, f32 *pos);
void stop_sounds_from_source(f32 *pos);
void stop_sounds_from_source(f32 * pos);
void stop_sounds_in_continuous_banks(void);
void sound_banks_disable(u8 player, u16 bankMask);
void sound_banks_enable(u8 player, u16 bankMask);
void set_sound_moving_speed(u8 bank, u8 speed);
void play_dialog_sound(u8 dialogID);
void play_music(u8 player, u16 seqArgs, u16 fadeTimer);
void stop_background_music(u16 seqId);
void fadeout_background_music(u16 arg0, u16 fadeOut);
void drop_queued_background_music(void);
u16 get_current_background_music(void);
void play_secondary_music(u8 seqId, u8 bgMusicVolume, u8 volume, u16 fadeTimer);
void func_80321080(u16 fadeTimer);
void func_803210D4(u16 fadeOutTime);
void play_course_clear(void);
void play_peachs_jingle(void);
void play_puzzle_jingle(void);
void play_star_fanfare(void);
void play_power_star_jingle(u8 arg0);
void play_race_fanfare(void);
void play_toads_jingle(void);
void sound_reset(u8 presetId);
void audio_set_sound_mode(u8 arg0);
void audio_init(void); // in load.c
+838 -545
View File
File diff suppressed because it is too large Load Diff
+35 -17
View File
@@ -23,34 +23,41 @@ struct SoundAllocPool
s32 numAllocatedEntries;
}; // size = 0x10
struct SeqOrBankEntry {
struct SeqOrBankEntry
{
u8 *ptr;
u32 size;
#ifdef VERSION_SH
#ifdef VERSION_SH
s16 poolIndex;
s16 id;
#else
#else
s32 id; // seqId or bankId
#endif
#endif
}; // size = 0xC
struct PersistentPool
{
/*0x00*/ u32 numEntries;
/*0x04*/ struct SoundAllocPool pool;
/*0x14*/ struct SeqOrBankEntry entries[32];
/*0x00*/
u32 numEntries;
/*0x04*/
struct SoundAllocPool pool;
/*0x14*/
struct SeqOrBankEntry entries[32];
}; // size = 0x194
struct TemporaryPool
{
/*EU, SH*/
/*0x00, 0x00*/ u32 nextSide;
/*0x04, */ struct SoundAllocPool pool;
/*0x00, 0x00*/
u32 nextSide;
/*0x04, */
struct SoundAllocPool pool;
/*0x04, pool.start */
/*0x08, pool.cur */
/*0x0C, 0x0C pool.size */
/*0x10, 0x10 pool.numAllocatedEntries */
/*0x14, */ struct SeqOrBankEntry entries[2];
/*0x14, */
struct SeqOrBankEntry entries[2];
/*0x14, 0x14 entries[0].ptr */
/*0x18, entries[0].size*/
/*0x1C, 0x1E entries[0].id */
@@ -61,9 +68,12 @@ struct TemporaryPool
struct SoundMultiPool
{
/*0x000*/ struct PersistentPool persistent;
/*0x194*/ struct TemporaryPool temporary;
/* */ u32 pad2[4];
/*0x000*/
struct PersistentPool persistent;
/*0x194*/
struct TemporaryPool temporary;
/* */
u32 pad2[4];
}; // size = 0x1D0
struct Unk1Pool
@@ -85,10 +95,14 @@ struct UnkEntry
struct UnkPool
{
/*0x00*/ struct SoundAllocPool pool;
/*0x10*/ struct UnkEntry entries[64];
/*0x510*/ s32 numEntries;
/*0x514*/ u32 unk514;
/*0x00*/
struct SoundAllocPool pool;
/*0x10*/
struct UnkEntry entries[64];
/*0x510*/
s32 numEntries;
/*0x514*/
u32 unk514;
};
extern u8 gAudioHeap[];
@@ -115,14 +129,18 @@ extern volatile u8 gAudioResetStatus;
#endif
void *soundAlloc(struct SoundAllocPool *pool, u32 size);
void *sound_alloc_uninitialized(struct SoundAllocPool *pool, u32 size);
void sound_init_main_pools(s32 sizeForAudioInitPool);
void sound_alloc_pool_init(struct SoundAllocPool *pool, void *memAddr, u32 size);
#ifdef VERSION_SH
void *alloc_bank_or_seq(s32 poolIdx, s32 size, s32 arg3, s32 id);
void *get_bank_or_seq(s32 poolIdx, s32 arg1, s32 id);
#else
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 id);
#endif
#if defined(VERSION_EU) || defined(VERSION_SH)
File diff suppressed because it is too large Load Diff
+454 -334
View File
File diff suppressed because it is too large Load Diff
+7 -4
View File
@@ -56,7 +56,8 @@ extern s8 gSoundMode;
#ifdef VERSION_SH
extern OSMesgQueue gUnkQueue1;
struct UnkStructSH8034EC88 {
struct UnkStructSH8034EC88
{
u8 *endAndMediumIdentification;
struct AudioBankSample *sample;
u8 *ramAddr;
@@ -64,7 +65,8 @@ struct UnkStructSH8034EC88 {
s32 isFree;
};
struct PatchStruct {
struct PatchStruct
{
s32 bankId1;
s32 bankId2;
void *baseAddr1;
@@ -78,7 +80,8 @@ extern struct UnkStructSH8034EC88 D_SH_8034EC88[0x80];
struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1);
void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remaining, OSMesgQueue *queue, OSIoMesg *mesg);
void audio_dma_partial_copy_async(uintptr_t * devAddr, u8 * *vAddr, ssize_t * remaining, OSMesgQueue * queue, OSIoMesg * mesg);
void decrease_sample_dma_ttls(void);
#ifdef VERSION_SH
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef, s32 medium);
@@ -105,7 +108,7 @@ struct AudioBankSample *func_sh_802f4978(s32 bankId, s32 idx);
s32 func_sh_802f47c8(s32 bankId, u8 idx, s8 *io);
void *func_sh_802f3f08(s32 poolIdx, s32 arg1, s32 arg2, s32 arg3, OSMesgQueue *retQueue);
void func_sh_802f41e4(s32 audioResetStatus);
BAD_RETURN(s32) func_sh_802f3368(s32 bankId);
BAD_RETURN (s32) func_sh_802f3368(s32 bankId);
void *func_sh_802f3764(s32 arg0, s32 idx, s32 *arg2);
s32 func_sh_802f3024(s32 bankId, s32 instId, s32 arg2);
void func_sh_802f30f4(s32 arg0, s32 arg1, s32 arg2, OSMesgQueue *arg3);
+1 -1
View File
@@ -7,5 +7,5 @@ struct seqFile *gSoundDataRaw;
struct seqFile *gMusicData;
#ifndef VERSION_SH
unsigned char* gBankSetsData;
unsigned char *gBankSetsData;
#endif
+679 -412
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+12
View File
@@ -17,17 +17,29 @@
#define NOTE_ALLOC_GLOBAL_FREELIST 8
void process_notes(void);
void seq_channel_layer_note_decay(struct SequenceChannelLayer *seqLayer);
void seq_channel_layer_note_release(struct SequenceChannelLayer *seqLayer);
void init_synthetic_wave(struct Note *note, struct SequenceChannelLayer *seqLayer);
void init_note_lists(struct NotePool *pool);
void init_note_free_list(void);
void note_pool_clear(struct NotePool *pool);
void note_pool_fill(struct NotePool *pool, s32 count);
void audio_list_push_front(struct AudioListItem *list, struct AudioListItem *item);
void audio_list_remove(struct AudioListItem *item);
struct Note *alloc_note(struct SequenceChannelLayer *seqLayer);
void reclaim_notes(void);
void note_init_all(void);
#if defined(VERSION_SH)
+175 -131
View File
@@ -34,7 +34,8 @@ s32 audio_shut_down_and_reset_step(void);
void func_802ad7ec(u32);
#ifdef TARGET_N64
struct SPTask *create_next_audio_frame_task(void) {
struct SPTask *create_next_audio_frame_task(void)
{
u32 samplesRemainingInAI;
s32 writtenCmds;
s32 index;
@@ -46,12 +47,13 @@ struct SPTask *create_next_audio_frame_task(void) {
OSMesg sp2C;
gAudioFrameCount++;
if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0) {
if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0)
{
stubbed_printf("DAC:Lost 1 Frame.\n");
return NULL;
return nullptr;
}
osSendMesg(OSMesgQueues[0], (OSMesg) gAudioFrameCount, 0);
osSendMesg(OSMesgQueues[0], (OSMesg)gAudioFrameCount, 0);
gAudioTaskIndex ^= 1;
gCurrAiBufferIndex++;
@@ -59,28 +61,35 @@ struct SPTask *create_next_audio_frame_task(void) {
index = (gCurrAiBufferIndex - 2 + NUMAIBUFFERS) % NUMAIBUFFERS;
samplesRemainingInAI = osAiGetLength() / 4;
if (gAiBufferLengths[index] != 0) {
if (gAiBufferLengths[index] != 0)
{
osAiSetNextBuffer(gAiBuffers[index], gAiBufferLengths[index] * 4);
}
oldDmaCount = gCurrAudioFrameDmaCount;
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE) {
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE)
{
stubbed_printf("DMA: Request queue over.( %d )\n", oldDmaCount);
}
gCurrAudioFrameDmaCount = 0;
decrease_sample_dma_ttls();
if (osRecvMesg(OSMesgQueues[2], &sp30, 0) != -1) {
gAudioResetPresetIdToLoad = (u8) (s32) sp30;
if (osRecvMesg(OSMesgQueues[2], &sp30, 0) != -1)
{
gAudioResetPresetIdToLoad = (u8)(s32)
sp30;
gAudioResetStatus = 5;
}
if (gAudioResetStatus != 0) {
if (audio_shut_down_and_reset_step() == 0) {
if (gAudioResetStatus == 0) {
osSendMesg(OSMesgQueues[3], (OSMesg) (s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
if (gAudioResetStatus != 0)
{
if (audio_shut_down_and_reset_step() == 0)
{
if (gAudioResetStatus == 0)
{
osSendMesg(OSMesgQueues[3], (OSMesg)(s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
}
return NULL;
return nullptr;
}
}
@@ -90,16 +99,19 @@ struct SPTask *create_next_audio_frame_task(void) {
currAiBuffer = gAiBuffers[index];
gAiBufferLengths[index] = ((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI +
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE;
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE;
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength)
{
gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength;
}
if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength) {
if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength)
{
gAiBufferLengths[index] = gAudioBufferParameters.maxAiBufferLength;
}
if (osRecvMesg(OSMesgQueues[1], &sp2C, OS_MESG_NOBLOCK) != -1) {
func_802ad7ec((u32) sp2C);
if (osRecvMesg(OSMesgQueues[1], &sp2C, OS_MESG_NOBLOCK) != -1)
{
func_802ad7ec((u32)sp2C);
}
flags = 0;
@@ -108,48 +120,54 @@ struct SPTask *create_next_audio_frame_task(void) {
gAudioRandom = gAudioRandom + writtenCmds / 8;
index = gAudioTaskIndex;
gAudioTask->msgqueue = NULL;
gAudioTask->msg = NULL;
gAudioTask->msgqueue = nullptr;
gAudioTask->msg = nullptr;
task = &gAudioTask->task.t;
task->type = M_AUDTASK;
task->flags = flags;
task->ucode_boot = rspF3DBootStart;
task->ucode_boot_size = (u8 *) rspF3DBootEnd - (u8 *) rspF3DBootStart;
task->ucode_boot_size = (u8 *)rspF3DBootEnd - (u8 *)rspF3DBootStart;
task->ucode = rspAspMainStart;
task->ucode_data = rspAspMainDataStart;
task->ucode_size = 0x800; // (this size is ignored)
task->ucode_data_size = (rspAspMainDataEnd - rspAspMainDataStart) * sizeof(u64);
task->dram_stack = NULL;
task->dram_stack = nullptr;
task->dram_stack_size = 0;
task->output_buff = NULL;
task->output_buff_size = NULL;
task->output_buff = nullptr;
task->output_buff_size = nullptr;
task->data_ptr = gAudioCmdBuffers[index];
task->data_size = writtenCmds * sizeof(u64);
task->yield_data_ptr = NULL;
task->yield_data_ptr = nullptr;
task->yield_data_size = 0;
return gAudioTask;
}
#else
struct SPTask *create_next_audio_frame_task(void) {
return NULL;
struct SPTask *create_next_audio_frame_task(void)
{
return nullptr;
}
void create_next_audio_buffer(s16 *samples, u32 num_samples) {
void create_next_audio_buffer(s16 *samples, u32 num_samples)
{
s32 writtenCmds;
OSMesg msg;
gAudioFrameCount++;
decrease_sample_dma_ttls();
if (osRecvMesg(OSMesgQueues[2], &msg, 0) != -1) {
gAudioResetPresetIdToLoad = (u8) (intptr_t) msg;
if (osRecvMesg(OSMesgQueues[2], &msg, 0) != -1)
{
gAudioResetPresetIdToLoad = (u8)(intptr_t)
msg;
gAudioResetStatus = 5;
}
if (gAudioResetStatus != 0) {
if (gAudioResetStatus != 0)
{
audio_reset_session();
gAudioResetStatus = 0;
}
if (osRecvMesg(OSMesgQueues[1], &msg, OS_MESG_NOBLOCK) != -1) {
func_802ad7ec((u32) msg);
if (osRecvMesg(OSMesgQueues[1], &msg, OS_MESG_NOBLOCK) != -1)
{
func_802ad7ec((u32)msg);
}
synthesis_execute(gAudioCmdBuffers[0], &writtenCmds, samples, num_samples);
gAudioRandom = ((gAudioRandom + gAudioFrameCount) * gAudioFrameCount);
@@ -157,48 +175,55 @@ void create_next_audio_buffer(s16 *samples, u32 num_samples) {
}
#endif
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
void eu_process_audio_cmd(struct EuAudioCmd *cmd)
{
s32 i;
switch (cmd->u.s.op) {
case 0x81:
preload_sequence(cmd->u.s.arg2, 3);
break;
switch (cmd->u.s.op)
{
case 0x81:
preload_sequence(cmd->u.s.arg2, 3);
break;
case 0x82:
case 0x88:
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
break;
case 0x82:
case 0x88:
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
break;
case 0x83:
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
if (cmd->u2.as_s32 == 0) {
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
case 0x83:
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE)
{
if (cmd->u2.as_s32 == 0)
{
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
}
else
{
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
}
}
else {
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
break;
case 0xf0:
gSoundMode = cmd->u2.as_s32;
break;
case 0xf1:
for (i = 0; i < 4; i++)
{
gSequencePlayers[i].muted = TRUE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
}
break;
break;
case 0xf0:
gSoundMode = cmd->u2.as_s32;
break;
case 0xf1:
for (i = 0; i < 4; i++) {
gSequencePlayers[i].muted = TRUE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
break;
case 0xf2:
for (i = 0; i < 4; i++) {
gSequencePlayers[i].muted = FALSE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
break;
case 0xf2:
for (i = 0; i < 4; i++)
{
gSequencePlayers[i].muted = FALSE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
break;
}
}
@@ -212,18 +237,21 @@ extern OSMesg OSMesg1;
extern OSMesg OSMesg2;
extern OSMesg OSMesg3;
void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime) {
if (fadeOutTime == 0) {
void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime)
{
if (fadeOutTime == 0)
{
fadeOutTime = 1;
}
gSequencePlayers[player].fadeVelocity = -(gSequencePlayers[player].fadeVolume / fadeOutTime);
gSequencePlayers[player].state = 2;
gSequencePlayers[player].fadeRemainingFrames = fadeOutTime;
}
void func_8031D690(s32 player, FadeT fadeInTime) {
if (fadeInTime != 0) {
void func_8031D690(s32 player, FadeT fadeInTime)
{
if (fadeInTime != 0)
{
gSequencePlayers[player].state = 1;
gSequencePlayers[player].fadeTimerUnkEu = fadeInTime;
gSequencePlayers[player].fadeRemainingFrames = fadeInTime;
@@ -232,7 +260,8 @@ void func_8031D690(s32 player, FadeT fadeInTime) {
}
}
void port_eu_init_queues(void) {
void port_eu_init_queues(void)
{
D_EU_80302010 = 0;
D_EU_80302014 = 0;
osCreateMesgQueue(OSMesgQueues[0], &OSMesg0, 1);
@@ -241,100 +270,114 @@ void port_eu_init_queues(void) {
osCreateMesgQueue(OSMesgQueues[3], &OSMesg3, 1);
}
void func_802ad6f0(s32 arg0, s32 *arg1) {
void func_802ad6f0(s32 arg0, s32 *arg1)
{
struct EuAudioCmd *cmd = &sAudioCmd[D_EU_80302010 & 0xff];
cmd->u.first = arg0;
cmd->u2.as_u32 = *arg1;
D_EU_80302010++;
}
void func_802ad728(u32 arg0, f32 arg1) {
func_802ad6f0(arg0, (s32*) &arg1);
void func_802ad728(u32 arg0, f32 arg1)
{
func_802ad6f0(arg0, (s32 *)&arg1);
}
void func_802ad74c(u32 arg0, u32 arg1) {
func_802ad6f0(arg0, (s32*) &arg1);
void func_802ad74c(u32 arg0, u32 arg1)
{
func_802ad6f0(arg0, (s32 *)&arg1);
}
void func_802ad770(u32 arg0, s8 arg1) {
void func_802ad770(u32 arg0, s8 arg1)
{
s32 sp1C = arg1 << 24;
func_802ad6f0(arg0, &sp1C);
}
void func_802ad7a0(void) {
void func_802ad7a0(void)
{
osSendMesg(OSMesgQueues[1],
(OSMesg)(u32)((D_EU_80302014 & 0xff) << 8 | (D_EU_80302010 & 0xff)),
OS_MESG_NOBLOCK);
(OSMesg)(u32)((D_EU_80302014 & 0xff) << 8 | (D_EU_80302010 & 0xff)),
OS_MESG_NOBLOCK);
D_EU_80302014 = D_EU_80302010;
}
void func_802ad7ec(u32 arg0) {
void func_802ad7ec(u32 arg0)
{
struct EuAudioCmd *cmd;
struct SequencePlayer *seqPlayer;
struct SequenceChannel *chan;
u8 end = arg0 & 0xff;
u8 i = (arg0 >> 8) & 0xff;
for (;;) {
for (;;)
{
if (i == end) break;
cmd = &sAudioCmd[i++ & 0xff];
if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
if (cmd->u.s.arg1 < SEQUENCE_PLAYERS)
{
seqPlayer = &gSequencePlayers[cmd->u.s.arg1];
if ((cmd->u.s.op & 0x80) != 0) {
if ((cmd->u.s.op & 0x80) != 0)
{
eu_process_audio_cmd(cmd);
}
else if ((cmd->u.s.op & 0x40) != 0) {
switch (cmd->u.s.op) {
case 0x41:
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
seqPlayer->recalculateVolume = TRUE;
break;
else if ((cmd->u.s.op & 0x40) != 0)
{
switch (cmd->u.s.op)
{
case 0x41:
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
seqPlayer->recalculateVolume = TRUE;
break;
case 0x47:
seqPlayer->tempo = cmd->u2.as_s32 * TATUMS_PER_BEAT;
break;
case 0x47:
seqPlayer->tempo = cmd->u2.as_s32 * TATUMS_PER_BEAT;
break;
case 0x48:
seqPlayer->transposition = cmd->u2.as_s8;
break;
case 0x48:
seqPlayer->transposition = cmd->u2.as_s8;
break;
case 0x46:
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
break;
case 0x46:
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
break;
}
}
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10)
{
chan = seqPlayer->channels[cmd->u.s.arg2];
if (IS_SEQUENCE_CHANNEL_VALID(chan))
{
switch (cmd->u.s.op) {
case 1:
chan->volumeScale = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
break;
case 2:
chan->volume = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
break;
case 3:
chan->newPan = cmd->u2.as_s8;
chan->changes.as_bitfields.pan = TRUE;
break;
case 4:
chan->freqScale = cmd->u2.as_f32;
chan->changes.as_bitfields.freqScale = TRUE;
break;
case 5:
chan->reverbVol = cmd->u2.as_s8;
break;
case 6:
if (cmd->u.s.arg3 < 8) {
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
}
break;
case 8:
chan->stopSomething2 = cmd->u2.as_s8;
switch (cmd->u.s.op)
{
case 1:
chan->volumeScale = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
break;
case 2:
chan->volume = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
break;
case 3:
chan->newPan = cmd->u2.as_s8;
chan->changes.as_bitfields.pan = TRUE;
break;
case 4:
chan->freqScale = cmd->u2.as_f32;
chan->changes.as_bitfields.freqScale = TRUE;
break;
case 5:
chan->reverbVol = cmd->u2.as_s8;
break;
case 6:
if (cmd->u.s.arg3 < 8)
{
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
}
break;
case 8:
chan->stopSomething2 = cmd->u2.as_s8;
}
}
}
@@ -344,7 +387,8 @@ void func_802ad7ec(u32 arg0) {
}
}
void port_eu_init(void) {
void port_eu_init(void)
{
port_eu_init_queues();
}
+304 -215
View File
@@ -24,7 +24,8 @@ void seq_player_fade_to_zero_volume(s32 arg0, s32 numFrames);
void func_802ad7ec(u32 arg0);
#ifdef TARGET_N64
struct SPTask *create_next_audio_frame_task(void) {
struct SPTask *create_next_audio_frame_task(void)
{
u32 samplesRemainingInAI;
s32 writtenCmds;
s32 index;
@@ -37,13 +38,15 @@ struct SPTask *create_next_audio_frame_task(void) {
s32 writtenCmdsCopy;
gAudioFrameCount++;
if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0) {
if ((gAudioFrameCount % gAudioBufferParameters.presetUnk4) + 1 == gAudioBufferParameters.presetUnk4) {
if (gAudioFrameCount % gAudioBufferParameters.presetUnk4 != 0)
{
if ((gAudioFrameCount % gAudioBufferParameters.presetUnk4) + 1 == gAudioBufferParameters.presetUnk4)
{
return D_SH_80314FCC;
}
return NULL;
return nullptr;
}
osSendMesg(D_SH_80350F38, (OSMesg) gAudioFrameCount, OS_MESG_NOBLOCK);
osSendMesg(D_SH_80350F38, (OSMesg)gAudioFrameCount, OS_MESG_NOBLOCK);
gAudioTaskIndex ^= 1;
gCurrAiBufferIndex++;
@@ -51,123 +54,149 @@ struct SPTask *create_next_audio_frame_task(void) {
index = (gCurrAiBufferIndex - 2 + NUMAIBUFFERS) % NUMAIBUFFERS;
samplesRemainingInAI = osAiGetLength() / 4;
if (gAudioLoadLockSH < 0x10U) {
if (gAiBufferLengths[index] != 0) {
if (gAudioLoadLockSH < 0x10U)
{
if (gAiBufferLengths[index] != 0)
{
osAiSetNextBuffer(gAiBuffers[index], gAiBufferLengths[index] * 4);
}
}
oldDmaCount = gCurrAudioFrameDmaCount;
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE) {
if (oldDmaCount > AUDIO_FRAME_DMA_QUEUE_SIZE)
{
}
gCurrAudioFrameDmaCount = 0;
decrease_sample_dma_ttls();
func_sh_802f41e4(gAudioResetStatus);
if (osRecvMesg(D_SH_80350F88, (OSMesg *) &sp38, OS_MESG_NOBLOCK) != -1) {
if (gAudioResetStatus == 0) {
if (osRecvMesg(D_SH_80350F88, (OSMesg *)&sp38, OS_MESG_NOBLOCK) != -1)
{
if (gAudioResetStatus == 0)
{
gAudioResetStatus = 5;
}
gAudioResetPresetIdToLoad = (u8) sp38;
gAudioResetPresetIdToLoad = (u8)sp38;
}
if (gAudioResetStatus != 0) {
if (audio_shut_down_and_reset_step() == 0) {
if (gAudioResetStatus == 0) {
osSendMesg(D_SH_80350FA8, (OSMesg) (s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
if (gAudioResetStatus != 0)
{
if (audio_shut_down_and_reset_step() == 0)
{
if (gAudioResetStatus == 0)
{
osSendMesg(D_SH_80350FA8, (OSMesg)(s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
}
D_SH_80314FCC = 0;
return NULL;
return nullptr;
}
}
if (gAudioLoadLockSH >= 0x11U) {
return NULL;
if (gAudioLoadLockSH >= 0x11U)
{
return nullptr;
}
if (gAudioLoadLockSH != 0) {
if (gAudioLoadLockSH != 0)
{
gAudioLoadLockSH++;
}
gAudioTask = &gAudioTasks[gAudioTaskIndex];
gAudioCmd = (u64 *) gAudioCmdBuffers[gAudioTaskIndex];
gAudioCmd = (u64 *)gAudioCmdBuffers[gAudioTaskIndex];
index = gCurrAiBufferIndex;
currAiBuffer = gAiBuffers[index];
gAiBufferLengths[index] = (s16) ((((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI) +
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE);
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
gAiBufferLengths[index] = (s16)((((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI) +
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE);
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength)
{
gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength;
}
if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength) {
if (gAiBufferLengths[index] > gAudioBufferParameters.maxAiBufferLength)
{
gAiBufferLengths[index] = gAudioBufferParameters.maxAiBufferLength;
}
if (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1) {
do {
if (osRecvMesg(D_SH_80350F68, (OSMesg *)&sp34, 0) != -1)
{
do
{
func_802ad7ec(sp34);
} while (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1);
}
while (osRecvMesg(D_SH_80350F68, (OSMesg *)&sp34, 0) != -1);
}
flags = 0;
gAudioCmd = synthesis_execute(gAudioCmd, &writtenCmds, currAiBuffer, gAiBufferLengths[index]);
gAudioRandom = (u32) (osGetCount() * (gAudioRandom + gAudioFrameCount));
gAudioRandom = (u32) (gAiBuffers[index][gAudioFrameCount & 0xFF] + gAudioRandom);
gAudioRandom = (u32)(osGetCount() * (gAudioRandom + gAudioFrameCount));
gAudioRandom = (u32)(gAiBuffers[index][gAudioFrameCount & 0xFF] + gAudioRandom);
index = gAudioTaskIndex;
gAudioTask->msgqueue = NULL;
gAudioTask->msg = NULL;
gAudioTask->msgqueue = nullptr;
gAudioTask->msg = nullptr;
task = &gAudioTask->task.t;
task->type = M_AUDTASK;
task->flags = flags;
task->ucode_boot = rspF3DBootStart;
task->ucode_boot_size = (u8 *) rspF3DStart - (u8 *) rspF3DBootStart;
task->ucode_boot_size = (u8 *)rspF3DStart - (u8 *)rspF3DBootStart;
task->ucode = rspAspMainStart;
task->ucode_data = rspAspMainDataStart;
task->ucode_size = 0x1000;
task->ucode_data_size = (rspAspMainDataEnd - rspAspMainDataStart) * sizeof(u64);
task->dram_stack = NULL;
task->dram_stack = nullptr;
task->dram_stack_size = 0;
task->output_buff = NULL;
task->output_buff_size = NULL;
task->output_buff = nullptr;
task->output_buff_size = nullptr;
task->data_ptr = gAudioCmdBuffers[index];
task->data_size = writtenCmds * sizeof(u64);
task->yield_data_ptr = NULL;
task->yield_data_ptr = nullptr;
task->yield_data_size = 0;
writtenCmdsCopy = writtenCmds;
if (D_SH_80314FC8 < writtenCmdsCopy) {
if (D_SH_80314FC8 < writtenCmdsCopy)
{
D_SH_80314FC8 = writtenCmdsCopy;
}
if (gAudioBufferParameters.presetUnk4 == 1) {
if (gAudioBufferParameters.presetUnk4 == 1)
{
return gAudioTask;
} else {
}
else
{
D_SH_80314FCC = gAudioTask;
return NULL;
return nullptr;
}
}
#else
struct SPTask *create_next_audio_frame_task(void) {
return NULL;
struct SPTask *create_next_audio_frame_task(void)
{
return nullptr;
}
void create_next_audio_buffer(s16 *samples, u32 num_samples) {
void create_next_audio_buffer(s16 *samples, u32 num_samples)
{
s32 writtenCmds;
OSMesg msg;
gAudioFrameCount++;
decrease_sample_dma_ttls();
if (osRecvMesg(D_SH_80350F88, &msg, 0) != -1) {
gAudioResetPresetIdToLoad = (u8) (intptr_t) msg;
if (gAudioResetStatus == 0) {
if (osRecvMesg(D_SH_80350F88, &msg, 0) != -1)
{
gAudioResetPresetIdToLoad = (u8)(intptr_t)
msg;
if (gAudioResetStatus == 0)
{
gAudioResetStatus = 5;
}
}
if (gAudioResetStatus != 0) {
if (gAudioResetStatus != 0)
{
audio_reset_session();
gAudioResetStatus = 0;
}
while (osRecvMesg(D_SH_80350F68, &msg, OS_MESG_NOBLOCK) != -1) {
func_802ad7ec((u32) msg);
while (osRecvMesg(D_SH_80350F68, &msg, OS_MESG_NOBLOCK) != -1)
{
func_802ad7ec((u32)msg);
}
synthesis_execute(gAudioCmdBuffers[0], &writtenCmds, samples, num_samples);
gAudioRandom = ((gAudioRandom + gAudioFrameCount) * gAudioFrameCount);
@@ -176,99 +205,114 @@ void create_next_audio_buffer(s16 *samples, u32 num_samples) {
}
#endif
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
void eu_process_audio_cmd(struct EuAudioCmd *cmd)
{
s32 i;
struct Note *note;
struct NoteSubEu *sub;
switch (cmd->u.s.op) {
case 0x81:
preload_sequence(cmd->u.s.arg2, 3);
break;
switch (cmd->u.s.op)
{
case 0x81:
preload_sequence(cmd->u.s.arg2, 3);
break;
case 0x82:
case 0x88:
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
break;
case 0x82:
case 0x88:
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
break;
case 0x83:
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
if (cmd->u2.as_s32 == 0) {
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
case 0x83:
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE)
{
if (cmd->u2.as_s32 == 0)
{
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
}
else
{
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
}
}
else {
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
break;
case 0x84:
break;
case 0xf0:
gSoundMode = cmd->u2.as_s32;
break;
case 0xf1:
for (i = 0; i < 4; i++)
{
gSequencePlayers[i].muted = TRUE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
}
break;
break;
case 0x84:
break;
case 0xf0:
gSoundMode = cmd->u2.as_s32;
break;
case 0xf1:
for (i = 0; i < 4; i++) {
gSequencePlayers[i].muted = TRUE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
break;
case 0xf2:
if (cmd->u2.as_s32 == 1) {
for (i = 0; i < gMaxSimultaneousNotes; i++) {
note = &gNotes[i];
sub = &note->noteSubEu;
if (note->noteSubEu.enabled && note->unkSH34 == 0) {
if ((note->parentLayer->seqChannel->muteBehavior & 8) != 0) {
sub->finished = TRUE;
case 0xf2:
if (cmd->u2.as_s32 == 1)
{
for (i = 0; i < gMaxSimultaneousNotes; i++)
{
note = &gNotes[i];
sub = &note->noteSubEu;
if (note->noteSubEu.enabled && note->unkSH34 == 0)
{
if ((note->parentLayer->seqChannel->muteBehavior & 8) != 0)
{
sub->finished = TRUE;
}
}
}
}
}
for (i = 0; i < 4; i++) {
gSequencePlayers[i].muted = FALSE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
break;
for (i = 0; i < 4; i++)
{
gSequencePlayers[i].muted = FALSE;
gSequencePlayers[i].recalculateVolume = TRUE;
}
break;
case 0xf3:
func_sh_802f3024(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
break;
case 0xf3:
func_sh_802f3024(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
break;
case 0xf4:
func_sh_802f30f4(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3, &gUnkQueue1);
break;
case 0xf4:
func_sh_802f30f4(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3, &gUnkQueue1);
break;
case 0xf5:
func_sh_802f3158(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3, &gUnkQueue1);
break;
case 0xf5:
func_sh_802f3158(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3, &gUnkQueue1);
break;
case 0xf6:
func_sh_802f3288(cmd->u.s.arg2);
break;
case 0xf6:
func_sh_802f3288(cmd->u.s.arg2);
break;
}
}
void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime) {
void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime)
{
struct SequencePlayer *player;
if (fadeOutTime == 0) {
if (fadeOutTime == 0)
{
fadeOutTime = 1;
}
player = &gSequencePlayers[arg0];
player->state = 2;
player->fadeRemainingFrames = fadeOutTime;
player->fadeVelocity = -(player->fadeVolume / (f32) fadeOutTime);
player->fadeVelocity = -(player->fadeVolume / (f32)fadeOutTime);
}
void func_8031D690(s32 playerIndex, s32 fadeInTime) {
void func_8031D690(s32 playerIndex, s32 fadeInTime)
{
struct SequencePlayer *player;
if (fadeInTime != 0) {
if (fadeInTime != 0)
{
player = &gSequencePlayers[playerIndex];
player->state = 1;
player->fadeTimerUnkEu = fadeInTime;
@@ -278,7 +322,8 @@ void func_8031D690(s32 playerIndex, s32 fadeInTime) {
}
}
void port_eu_init_queues(void) {
void port_eu_init_queues(void)
{
D_SH_80350F18 = 0;
D_SH_80350F19 = 0;
D_SH_80350F38 = &D_SH_80350F20;
@@ -292,36 +337,43 @@ void port_eu_init_queues(void) {
}
extern struct EuAudioCmd sAudioCmd[0x100];
void func_802ad6f0(s32 arg0, s32 *arg1) {
void func_802ad6f0(s32 arg0, s32 *arg1)
{
struct EuAudioCmd *cmd = &sAudioCmd[D_SH_80350F18 & 0xff];
cmd->u.first = arg0;
cmd->u2.as_u32 = *arg1;
D_SH_80350F18++;
if (D_SH_80350F18 == D_SH_80350F19) {
if (D_SH_80350F18 == D_SH_80350F19)
{
D_SH_80350F18--;
}
}
void func_802ad728(u32 arg0, f32 arg1) {
func_802ad6f0(arg0, (s32 *) &arg1);
void func_802ad728(u32 arg0, f32 arg1)
{
func_802ad6f0(arg0, (s32 *)&arg1);
}
void func_802ad74c(u32 arg0, u32 arg1) {
func_802ad6f0(arg0, (s32 *) &arg1);
void func_802ad74c(u32 arg0, u32 arg1)
{
func_802ad6f0(arg0, (s32 *)&arg1);
}
void func_802ad770(u32 arg0, s8 arg1) {
void func_802ad770(u32 arg0, s8 arg1)
{
s32 sp1C = arg1 << 24;
func_802ad6f0(arg0, &sp1C);
}
char shindouDebugPrint133[] = "AudioSend: %d -> %d (%d)\n";
void func_sh_802F64C8(void) {
void func_sh_802F64C8(void)
{
static s32 D_SH_8031503C = 0;
s32 mesg;
if (((D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff) > D_SH_8031503C) {
if (((D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff) > D_SH_8031503C)
{
D_SH_8031503C = (D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff;
}
mesg = ((D_SH_80350F19 & 0xff) << 8) | (D_SH_80350F18 & 0xff);
@@ -329,11 +381,13 @@ void func_sh_802F64C8(void) {
D_SH_80350F19 = D_SH_80350F18;
}
void func_sh_802f6540(void) {
void func_sh_802f6540(void)
{
D_SH_80350F19 = D_SH_80350F18;
}
void func_802ad7ec(u32 arg0) {
void func_802ad7ec(u32 arg0)
{
struct EuAudioCmd *cmd;
struct SequencePlayer *seqPlayer;
struct SequenceChannel *chan;
@@ -347,102 +401,120 @@ void func_802ad7ec(u32 arg0) {
static u8 D_SH_80315098 = 0;
static u8 D_SH_8031509C = 0;
if (D_SH_8031509C == 0) {
if (D_SH_8031509C == 0)
{
D_SH_80315098 = (arg0 >> 8) & 0xff;
}
end = arg0 & 0xff;
for (;;) {
if (D_SH_80315098 == end) {
for (;;)
{
if (D_SH_80315098 == end)
{
D_SH_8031509C = 0;
break;
}
cmd = &sAudioCmd[D_SH_80315098 & 0xff];
D_SH_80315098++;
if (cmd->u.s.op == 0xf8) {
if (cmd->u.s.op == 0xf8)
{
D_SH_8031509C = 1;
break;
}
else if ((cmd->u.s.op & 0xf0) == 0xf0) {
else if ((cmd->u.s.op & 0xf0) == 0xf0)
{
eu_process_audio_cmd(cmd);
}
else if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
else if (cmd->u.s.arg1 < SEQUENCE_PLAYERS)
{
seqPlayer = &gSequencePlayers[cmd->u.s.arg1];
if ((cmd->u.s.op & 0x80) != 0) {
if ((cmd->u.s.op & 0x80) != 0)
{
eu_process_audio_cmd(cmd);
}
else if ((cmd->u.s.op & 0x40) != 0) {
switch (cmd->u.s.op) {
case 0x41:
if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32) {
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
seqPlayer->recalculateVolume = TRUE;
}
break;
else if ((cmd->u.s.op & 0x40) != 0)
{
switch (cmd->u.s.op)
{
case 0x41:
if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32)
{
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
seqPlayer->recalculateVolume = TRUE;
}
break;
case 0x47:
seqPlayer->tempo = cmd->u2.as_s32 * TATUMS_PER_BEAT;
break;
case 0x47:
seqPlayer->tempo = cmd->u2.as_s32 * TATUMS_PER_BEAT;
break;
case 0x49:
seqPlayer->tempoAdd = cmd->u2.as_s32 * TEMPO_SCALE;
break;
case 0x49:
seqPlayer->tempoAdd = cmd->u2.as_s32 * TEMPO_SCALE;
break;
case 0x48:
seqPlayer->transposition = cmd->u2.as_s8;
break;
case 0x48:
seqPlayer->transposition = cmd->u2.as_s8;
break;
case 0x46:
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
break;
case 0x46:
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
break;
}
}
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10)
{
chan = seqPlayer->channels[cmd->u.s.arg2];
if (IS_SEQUENCE_CHANNEL_VALID(chan))
{
switch (cmd->u.s.op) {
case 1:
if (chan->volumeScale != cmd->u2.as_f32) {
chan->volumeScale = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
}
break;
case 2:
if (chan->volume != cmd->u2.as_f32) {
chan->volume = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
}
break;
case 3:
if (chan->newPan != cmd->u2.as_s8) {
chan->newPan = cmd->u2.as_s8;
chan->changes.as_bitfields.pan = TRUE;
}
break;
case 4:
if (chan->freqScale != cmd->u2.as_f32) {
chan->freqScale = cmd->u2.as_f32;
chan->changes.as_bitfields.freqScale = TRUE;
}
break;
case 5:
//! @bug u8 s8 comparison (but harmless)
if (chan->reverbVol != cmd->u2.as_s8) {
chan->reverbVol = cmd->u2.as_s8;
}
break;
case 6:
if (cmd->u.s.arg3 < 8) {
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
}
break;
case 8:
chan->stopSomething2 = cmd->u2.as_s8;
break;
case 9:
chan->muteBehavior = cmd->u2.as_s8;
switch (cmd->u.s.op)
{
case 1:
if (chan->volumeScale != cmd->u2.as_f32)
{
chan->volumeScale = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
}
break;
case 2:
if (chan->volume != cmd->u2.as_f32)
{
chan->volume = cmd->u2.as_f32;
chan->changes.as_bitfields.volume = TRUE;
}
break;
case 3:
if (chan->newPan != cmd->u2.as_s8)
{
chan->newPan = cmd->u2.as_s8;
chan->changes.as_bitfields.pan = TRUE;
}
break;
case 4:
if (chan->freqScale != cmd->u2.as_f32)
{
chan->freqScale = cmd->u2.as_f32;
chan->changes.as_bitfields.freqScale = TRUE;
}
break;
case 5:
//! @bug u8 s8 comparison (but harmless)
if (chan->reverbVol != cmd->u2.as_s8)
{
chan->reverbVol = cmd->u2.as_s8;
}
break;
case 6:
if (cmd->u.s.arg3 < 8)
{
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
}
break;
case 8:
chan->stopSomething2 = cmd->u2.as_s8;
break;
case 9:
chan->muteBehavior = cmd->u2.as_s8;
}
}
}
@@ -452,74 +524,91 @@ void func_802ad7ec(u32 arg0) {
}
}
u32 func_sh_802f6878(s32 *arg0) {
u32 func_sh_802f6878(s32 *arg0)
{
u32 sp1C;
if (osRecvMesg(&gUnkQueue1, (OSMesg *) &sp1C, 0) == -1) {
if (osRecvMesg(&gUnkQueue1, (OSMesg *)&sp1C, 0) == -1)
{
*arg0 = 0;
return 0U;
}
*arg0 = (s32) (sp1C & 0xFFFFFF);
*arg0 = (s32)(sp1C & 0xFFFFFF);
return sp1C >> 0x18;
}
u8 *func_sh_802f68e0(u32 index, u32 *a1) {
u8 *func_sh_802f68e0(u32 index, u32 *a1)
{
return func_sh_802f3220(index, a1);
}
s32 func_sh_802f6900(void) {
s32 func_sh_802f6900(void)
{
s32 ret;
s32 sp18;
ret = osRecvMesg(D_SH_80350FA8, (OSMesg *) &sp18, 0);
ret = osRecvMesg(D_SH_80350FA8, (OSMesg *)&sp18, 0);
if (ret == -1) {
if (ret == -1)
{
return 0;
}
if (sp18 != gAudioResetPresetIdToLoad) {
if (sp18 != gAudioResetPresetIdToLoad)
{
return 0;
} else {
}
else
{
return 1;
}
}
// TODO: (Scrub C)
void func_sh_802f6958(OSMesg mesg) {
void func_sh_802f6958(OSMesg mesg)
{
s32 a;
OSMesg recvMesg;
do {
do
{
a = -1;
} while (osRecvMesg(D_SH_80350FA8, &recvMesg, OS_MESG_NOBLOCK) != a);
}
while (osRecvMesg(D_SH_80350FA8, &recvMesg, OS_MESG_NOBLOCK) != a);
func_sh_802f6540();
osSendMesg(D_SH_80350F88, mesg, OS_MESG_NOBLOCK);
}
void func_sh_802f69cc(void) {
void func_sh_802f69cc(void)
{
gAudioLoadLockSH = 1;
func_sh_802f6958(0);
gAudioResetStatus = 0;
}
s32 func_sh_802f6a08(s32 playerIndex, s32 channelIndex, s32 soundScriptIOIndex) {
s32 func_sh_802f6a08(s32 playerIndex, s32 channelIndex, s32 soundScriptIOIndex)
{
struct SequenceChannel *seqChannel;
struct SequencePlayer *player;
player = &gSequencePlayers[playerIndex];
if (player->enabled) {
if (player->enabled)
{
seqChannel = player->channels[channelIndex];
if (IS_SEQUENCE_CHANNEL_VALID(seqChannel)) {
if (IS_SEQUENCE_CHANNEL_VALID(seqChannel))
{
return seqChannel->soundScriptIO[soundScriptIOIndex];
}
}
return -1;
}
s8 func_sh_802f6a6c(s32 playerIndex, s32 index) {
s8 func_sh_802f6a6c(s32 playerIndex, s32 index)
{
return gSequencePlayers[playerIndex].seqVariationEu[index];
}
void port_eu_init(void) {
void port_eu_init(void)
{
port_eu_init_queues();
}
@@ -540,17 +629,17 @@ char shindouDebugPrint151[] = "Audio: voiceman: progNo. undefined %d,%d\n";
char shindouDebugPrint152[] = "Audio: voiceman: No bank error %d\n";
char shindouDebugPrint153[] = "Audio: voiceman: Percussion Overflow %d,%d\n";
char shindouDebugPrint154[] = "Audio: voiceman: Percussion table pointer (bank %d) is irregular %x.\n";
char shindouDebugPrint155[] = "Audio: voiceman: Percpointer NULL %d,%d\n";
char shindouDebugPrint155[] = "Audio: voiceman: Percpointer nullptr %d,%d\n";
char shindouDebugPrint156[] = "--4 %x\n";
char shindouDebugPrint157[] = "NoteOff Comes during wait release %x (note %x)\n";
char shindouDebugPrint158[] = "Slow Release Batting\n";
u8 euUnknownData_8030194c[4] = { 0x40, 0x20, 0x10, 0x08 };
u8 euUnknownData_8030194c[4] = {0x40, 0x20, 0x10, 0x08};
char shindouDebugPrint159[] = "Audio:Wavemem: Bad voiceno (%d)\n";
char shindouDebugPrint160[] = "Audio: C-Alloc : Dealloc voice is NULL\n";
char shindouDebugPrint160[] = "Audio: C-Alloc : Dealloc voice is nullptr\n";
char shindouDebugPrint161[] = "Alloc Error:Dim voice-Alloc %d";
char shindouDebugPrint162[] = "Error:Same List Add\n";
char shindouDebugPrint163[] = "Already Cut\n";
char shindouDebugPrint164[] = "Audio: C-Alloc : lowerPrio is NULL\n";
char shindouDebugPrint164[] = "Audio: C-Alloc : lowerPrio is nullptr\n";
char shindouDebugPrint165[] = "Intterupt UseStop %d (Kill %d)\n";
char shindouDebugPrint166[] = "Intterupt RelWait %d (Kill %d)\n";
char shindouDebugPrint167[] = "Drop Voice (Prio %x)\n";
+1092 -789
View File
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -7,12 +7,19 @@
#include "playback.h"
void seq_channel_layer_disable(struct SequenceChannelLayer *seqPlayer);
void sequence_channel_disable(struct SequenceChannel *seqPlayer);
void sequence_player_disable(struct SequencePlayer* seqPlayer);
void sequence_player_disable(struct SequencePlayer *seqPlayer);
void audio_list_push_back(struct AudioListItem *list, struct AudioListItem *item);
void *audio_list_pop_back(struct AudioListItem *list);
void process_sequences(s32 iterationsRemaining);
void init_sequence_player(u32 player);
void init_sequence_players(void);
#endif // AUDIO_SEQPLAYER_H
+3 -3
View File
@@ -6,7 +6,7 @@ char shindouDebugPrint1[] = "Terminate-Canceled Channel %d,Phase %d\n";
char shindouDebugPrint2[] = "S->W\n";
char shindouDebugPrint3[] = "W->S\n";
char shindouDebugPrint4[] = "S-Resample Pitch %x (old %d -> delay %d)\n";
s32 shindouDebugPrintPadding1[] = {0,0,0};
s32 shindouDebugPrintPadding1[] = {0, 0, 0};
// heap.c
char shindouDebugPrint5[] = "Warning:Kill Note %x \n";
@@ -60,7 +60,7 @@ char shindouDebugPrint52[] = "Try Kill %d \n";
char shindouDebugPrint53[] = "Try Kill %x %x\n";
char shindouDebugPrint54[] = "Try Kill %x %x %x\n";
char shindouDebugPrint55[] = "Rom back %x %x \n";
char shindouDebugPrint56[] = "Error sw NULL \n";
char shindouDebugPrint56[] = "Error sw nullptr \n";
char shindouDebugPrint57[] = "Request--------Single-Stay, %d\n";
char shindouDebugPrint58[] = "Try Kill %d \n";
char shindouDebugPrint59[] = "Try Kill %x %x\n";
@@ -140,7 +140,7 @@ char shindouDebugPrint127[] = "Spec Change Override. %d -> %d\n";
char shindouDebugPrint128[] = "Audio:now-max tasklen is %d / %d\n";
char shindouDebugPrint129[] = "Audio:Warning:ABI Tasklist length over (%d)\n";
s32 D_SH_80314FC8 = 0x80;
struct SPTask *D_SH_80314FCC = NULL;
struct SPTask *D_SH_80314FCC = nullptr;
char shindouDebugPrint130[] = "BGLOAD Start %d\n";
char shindouDebugPrint131[] = "Error: OverFlow Your Request\n";
char shindouDebugPrint132[] = "---AudioSending (%d->%d) \n";
File diff suppressed because it is too large Load Diff
+40 -24
View File
@@ -30,46 +30,62 @@ struct ReverbRingBufferItem
struct SynthesisReverb
{
/*0x00, 0x00, 0x00*/ u8 resampleFlags;
/*0x01, 0x01, 0x01*/ u8 useReverb;
/*0x02, 0x02, 0x02*/ u8 framesLeftToIgnore;
/*0x03, 0x03, 0x03*/ u8 curFrame;
#if defined(VERSION_EU) || defined(VERSION_SH)
/*0x00, 0x00, 0x00*/
u8 resampleFlags;
/*0x01, 0x01, 0x01*/
u8 useReverb;
/*0x02, 0x02, 0x02*/
u8 framesLeftToIgnore;
/*0x03, 0x03, 0x03*/
u8 curFrame;
#if defined(VERSION_EU) || defined(VERSION_SH)
/* 0x04, 0x04*/ u8 downsampleRate;
#ifdef VERSION_SH
#ifdef VERSION_SH
/* 0x05*/ s8 unk5;
#endif
#endif
/* 0x06, 0x06*/ u16 windowSize; // same as bufSizePerChannel
#endif
#ifdef VERSION_SH
#endif
#ifdef VERSION_SH
/* 0x08*/ u16 unk08;
#endif
/*0x04, 0x08, 0x0A*/ u16 reverbGain;
/*0x06, 0x0A, 0x0C*/ u16 resampleRate;
#ifdef VERSION_SH
#endif
/*0x04, 0x08, 0x0A*/
u16 reverbGain;
/*0x06, 0x0A, 0x0C*/
u16 resampleRate;
#ifdef VERSION_SH
/* 0x0E*/ u16 panRight;
/* 0x10*/ u16 panLeft;
#endif
/*0x08, 0x0C, 0x14*/ s32 nextRingBufferPos;
/*0x0C, 0x10, 0x18*/ s32 unkC; // never read
/*0x10, 0x14, 0x1C*/ s32 bufSizePerChannel;
#endif
/*0x08, 0x0C, 0x14*/
s32 nextRingBufferPos;
/*0x0C, 0x10, 0x18*/
s32 unkC; // never read
/*0x10, 0x14, 0x1C*/
s32 bufSizePerChannel;
struct
{
s16 *left;
s16 *right;
} ringBuffer;
/*0x1C, 0x20, 0x28*/ s16 *resampleStateLeft;
/*0x20, 0x24, 0x2C*/ s16 *resampleStateRight;
/*0x24, 0x28, 0x30*/ s16 *unk24; // never read
/*0x28, 0x2C, 0x34*/ s16 *unk28; // never read
/*0x2C, 0x30, 0x38*/ struct ReverbRingBufferItem items[2][MAX_UPDATES_PER_FRAME];
#if defined(VERSION_EU) || defined(VERSION_SH)
/*0x1C, 0x20, 0x28*/
s16 *resampleStateLeft;
/*0x20, 0x24, 0x2C*/
s16 *resampleStateRight;
/*0x24, 0x28, 0x30*/
s16 *unk24; // never read
/*0x28, 0x2C, 0x34*/
s16 *unk28; // never read
/*0x2C, 0x30, 0x38*/
struct ReverbRingBufferItem items[2][MAX_UPDATES_PER_FRAME];
#if defined(VERSION_EU) || defined(VERSION_SH)
// Only used in sh:
/* 0x100*/ s16 *unk100;
/* 0x104*/ s16 *unk104;
/* 0x108*/ s16 *unk108;
/* 0x10C*/ s16 *unk10C;
#endif
#endif
}; // 0xCC <= size <= 0x100
#if defined(VERSION_EU) || defined(VERSION_SH)
extern struct SynthesisReverb gSynthesisReverbs[4];
File diff suppressed because it is too large Load Diff
+165 -115
View File
@@ -6,7 +6,7 @@
#include "graph_node.h"
#include "../shim.h"
static Vec3s gVec3sZero = { 0, 0, 0 };
static Vec3s gVec3sZero = {0, 0, 0};
typedef void (*GeoLayoutCommandProc)(void);
@@ -102,53 +102,60 @@ UNUSED s16 D_8038BD7C;
s16 gGeoLayoutReturnIndex; // similar to RA register in MIPS
u8 *gGeoLayoutCommand;
u32 unused_8038B894[3] = { 0 };
u32 unused_8038B894[3] = {0};
/*
0x00: Branch and store return address
cmd+0x04: void *branchTarget
*/
void geo_layout_cmd_branch_and_link(void) {
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
void geo_layout_cmd_branch_and_link(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));
}
// 0x01: Terminate geo layout
void geo_layout_cmd_end(void) {
void geo_layout_cmd_end(void)
{
gGeoLayoutStackIndex = gGeoLayoutReturnIndex;
gGeoLayoutReturnIndex = gGeoLayoutStack[--gGeoLayoutStackIndex] & 0xFFFF;
gCurGraphNodeIndex = gGeoLayoutStack[gGeoLayoutStackIndex] >> 16;
gGeoLayoutCommand = (u8 *) gGeoLayoutStack[--gGeoLayoutStackIndex];
gGeoLayoutCommand = (u8 *)gGeoLayoutStack[--gGeoLayoutStackIndex];
}
/*
0x02: Branch
cmd+0x04: void *branchTarget
*/
void geo_layout_cmd_branch(void) {
if (cur_geo_cmd_u8(0x01) == 1) {
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
void geo_layout_cmd_branch(void)
{
if (cur_geo_cmd_u8(0x01) == 1)
{
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t)(gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
}
gGeoLayoutCommand = segmented_to_virtual(cur_geo_cmd_ptr(0x04));
}
// 0x03: Return from branch
void geo_layout_cmd_return(void) {
gGeoLayoutCommand = (u8 *) gGeoLayoutStack[--gGeoLayoutStackIndex];
void geo_layout_cmd_return(void)
{
gGeoLayoutCommand = (u8 *)gGeoLayoutStack[--gGeoLayoutStackIndex];
}
// 0x04: Open node
void geo_layout_cmd_open_node(void) {
void geo_layout_cmd_open_node(void)
{
gCurGraphNodeList[gCurGraphNodeIndex + 1] = gCurGraphNodeList[gCurGraphNodeIndex];
gCurGraphNodeIndex++;
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
}
// 0x05: Close node
void geo_layout_cmd_close_node(void) {
void geo_layout_cmd_close_node(void)
{
gCurGraphNodeIndex--;
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
}
@@ -159,10 +166,12 @@ void geo_layout_cmd_close_node(void) {
Register the current node in the gGeoViews array at the given index
*/
void geo_layout_cmd_assign_as_view(void) {
void geo_layout_cmd_assign_as_view(void)
{
u16 index = cur_geo_cmd_s16(0x02);
if (index < gGeoNumViews) {
if (index < gGeoNumViews)
{
gGeoViews[index] = gCurGraphNodeList[gCurGraphNodeIndex];
}
@@ -174,11 +183,13 @@ void geo_layout_cmd_assign_as_view(void) {
cmd+0x01: u8 operation (0 = reset, 1 = set, 2 = clear)
cmd+0x02: s16 bits
*/
void geo_layout_cmd_update_node_flags(void) {
void geo_layout_cmd_update_node_flags(void)
{
u16 operation = cur_geo_cmd_u8(0x01);
u16 flagBits = cur_geo_cmd_s16(0x02);
switch (operation) {
switch (operation)
{
case GEO_CMD_FLAGS_RESET:
gCurGraphNodeList[gCurGraphNodeIndex]->flags = flagBits;
break;
@@ -201,7 +212,8 @@ void geo_layout_cmd_update_node_flags(void) {
cmd+0x08: s16 width
cmd+0x0A: s16 height
*/
void geo_layout_cmd_node_root(void) {
void geo_layout_cmd_node_root(void)
{
s32 i;
struct GraphNodeRoot *graphNode;
@@ -215,16 +227,17 @@ void geo_layout_cmd_node_root(void) {
// cmd+0x02 = 0x00: Mario face, 0x0A: all other levels
gGeoNumViews = cur_geo_cmd_s16(0x02) + 2;
graphNode = init_graph_node_root(gGraphNodePool, NULL, 0, x, y, width, height);
graphNode = init_graph_node_root(gGraphNodePool, nullptr, 0, x, y, width, height);
// gGeoViews is unused in libsm64
gGeoViews = NULL; // alloc_only_pool_alloc(gGraphNodePool, gGeoNumViews * sizeof(struct GraphNode *));
gGeoViews = nullptr; // alloc_only_pool_alloc(gGraphNodePool, gGeoNumViews * sizeof(struct GraphNode *));
graphNode->views = gGeoViews;
graphNode->numViews = gGeoNumViews;
for (i = 0; i < gGeoNumViews; i++) {
gGeoViews[i] = NULL;
for (i = 0; i < gGeoNumViews; i++)
{
gGeoViews[i] = nullptr;
}
register_scene_graph_node(&graphNode->node);
@@ -236,11 +249,12 @@ void geo_layout_cmd_node_root(void) {
0x09: Create orthographic projection scene graph node
cmd+0x02: s16 scale as a percentage (usually it's 100)
*/
void geo_layout_cmd_node_ortho_projection(void) {
void geo_layout_cmd_node_ortho_projection(void)
{
struct GraphNodeOrthoProjection *graphNode;
f32 scale = (f32) cur_geo_cmd_s16(0x02) / 100.0f;
f32 scale = (f32)cur_geo_cmd_s16(0x02) / 100.0f;
graphNode = init_graph_node_ortho_projection(gGraphNodePool, NULL, scale);
graphNode = init_graph_node_ortho_projection(gGraphNodePool, nullptr, scale);
register_scene_graph_node(&graphNode->node);
@@ -255,20 +269,22 @@ void geo_layout_cmd_node_ortho_projection(void) {
cmd+0x06: s16 far
[cmd+0x08: GraphNodeFunc frustumFunc]
*/
void geo_layout_cmd_node_perspective(void) {
void geo_layout_cmd_node_perspective(void)
{
struct GraphNodePerspective *graphNode;
GraphNodeFunc frustumFunc = NULL;
GraphNodeFunc frustumFunc = nullptr;
s16 fov = cur_geo_cmd_s16(0x02);
s16 near = cur_geo_cmd_s16(0x04);
s16 far = cur_geo_cmd_s16(0x06);
if (cur_geo_cmd_u8(0x01) != 0) {
if (cur_geo_cmd_u8(0x01) != 0)
{
// optional asm function
frustumFunc = (GraphNodeFunc) cur_geo_cmd_ptr(0x08);
frustumFunc = (GraphNodeFunc)cur_geo_cmd_ptr(0x08);
gGeoLayoutCommand += 4 << CMD_SIZE_SHIFT;
}
graphNode = init_graph_node_perspective(gGraphNodePool, NULL, (f32) fov, near, far, frustumFunc, 0);
graphNode = init_graph_node_perspective(gGraphNodePool, nullptr, (f32)fov, near, far, frustumFunc, 0);
register_scene_graph_node(&graphNode->fnNode.node);
@@ -279,10 +295,11 @@ void geo_layout_cmd_node_perspective(void) {
0x0B: Create a scene graph node that groups other nodes without any
additional functionality
*/
void geo_layout_cmd_node_start(void) {
void geo_layout_cmd_node_start(void)
{
struct GraphNodeStart *graphNode;
graphNode = init_graph_node_start(gGraphNodePool, NULL);
graphNode = init_graph_node_start(gGraphNodePool, nullptr);
register_scene_graph_node(&graphNode->node);
@@ -290,7 +307,8 @@ void geo_layout_cmd_node_start(void) {
}
// 0x1F: No operation
void geo_layout_cmd_nop3(void) {
void geo_layout_cmd_nop3(void)
{
gGeoLayoutCommand += 0x10 << CMD_SIZE_SHIFT;
}
@@ -298,10 +316,11 @@ void geo_layout_cmd_nop3(void) {
0x0C: Create zbuffer-toggling scene graph node
cmd+0x01: u8 enableZBuffer (1 = on, 0 = off)
*/
void geo_layout_cmd_node_master_list(void) {
void geo_layout_cmd_node_master_list(void)
{
struct GraphNodeMasterList *graphNode;
graphNode = init_graph_node_master_list(gGraphNodePool, NULL, cur_geo_cmd_u8(0x01));
graphNode = init_graph_node_master_list(gGraphNodePool, nullptr, cur_geo_cmd_u8(0x01));
register_scene_graph_node(&graphNode->node);
@@ -314,12 +333,13 @@ void geo_layout_cmd_node_master_list(void) {
cmd+0x04: s16 minDistance
cmd+0x06: s16 maxDistance
*/
void geo_layout_cmd_node_level_of_detail(void) {
void geo_layout_cmd_node_level_of_detail(void)
{
struct GraphNodeLevelOfDetail *graphNode;
s16 minDistance = cur_geo_cmd_s16(0x04);
s16 maxDistance = cur_geo_cmd_s16(0x06);
graphNode = init_graph_node_render_range(gGraphNodePool, NULL, minDistance, maxDistance);
graphNode = init_graph_node_render_range(gGraphNodePool, nullptr, minDistance, maxDistance);
register_scene_graph_node(&graphNode->node);
@@ -334,15 +354,16 @@ void geo_layout_cmd_node_level_of_detail(void) {
caseSelectorFunc returns an index which is used to select the child node to render.
Used for animating coins, blinking, color selection, etc.
*/
void geo_layout_cmd_node_switch_case(void) {
void geo_layout_cmd_node_switch_case(void)
{
struct GraphNodeSwitchCase *graphNode;
graphNode =
init_graph_node_switch_case(gGraphNodePool, NULL,
cur_geo_cmd_s16(0x02), // case which is initially selected
0,
(GraphNodeFunc) cur_geo_cmd_ptr(0x04), // case update function
0);
init_graph_node_switch_case(gGraphNodePool, nullptr,
cur_geo_cmd_s16(0x02), // case which is initially selected
0,
(GraphNodeFunc)cur_geo_cmd_ptr(0x04), // case update function
0);
register_scene_graph_node(&graphNode->fnNode.node);
@@ -360,17 +381,18 @@ void geo_layout_cmd_node_switch_case(void) {
cmd+0x0E: s16 focusZ
cmd+0x10: GraphNodeFunc func
*/
void geo_layout_cmd_node_camera(void) {
void geo_layout_cmd_node_camera(void)
{
struct GraphNodeCamera *graphNode;
s16 *cmdPos = (s16 *) &gGeoLayoutCommand[4];
s16 *cmdPos = (s16 *)&gGeoLayoutCommand[4];
Vec3f pos, focus;
cmdPos = read_vec3s_to_vec3f(pos, cmdPos);
cmdPos = read_vec3s_to_vec3f(focus, cmdPos);
graphNode = init_graph_node_camera(gGraphNodePool, NULL, pos, focus,
(GraphNodeFunc) cur_geo_cmd_ptr(0x10), cur_geo_cmd_s16(0x02));
graphNode = init_graph_node_camera(gGraphNodePool, nullptr, pos, focus,
(GraphNodeFunc)cur_geo_cmd_ptr(0x10), cur_geo_cmd_s16(0x02));
register_scene_graph_node(&graphNode->fnNode.node);
@@ -413,18 +435,20 @@ void geo_layout_cmd_node_camera(void) {
[cmd+var: void *displayList]
*/
void geo_layout_cmd_node_translation_rotation(void) {
void geo_layout_cmd_node_translation_rotation(void)
{
struct GraphNodeTranslationRotation *graphNode;
Vec3s translation, rotation;
void *displayList = NULL;
void *displayList = nullptr;
s16 drawingLayer = 0;
s16 params = cur_geo_cmd_u8(0x01);
s16 *cmdPos = (s16 *) gGeoLayoutCommand;
s16 *cmdPos = (s16 *)gGeoLayoutCommand;
switch ((params & 0x70) >> 4) {
switch ((params & 0x70) >> 4)
{
case 0:
cmdPos = read_vec3s(translation, &cmdPos[2]);
cmdPos = read_vec3s_angle(rotation, cmdPos);
@@ -444,17 +468,18 @@ void geo_layout_cmd_node_translation_rotation(void) {
break;
}
if (params & 0x80) {
displayList = *(void **) &cmdPos[0];
if (params & 0x80)
{
displayList = *(void **)&cmdPos[0];
drawingLayer = params & 0x0F;
cmdPos += 2 << CMD_SIZE_SHIFT;
}
graphNode = init_graph_node_translation_rotation(gGraphNodePool, NULL, drawingLayer, displayList,
graphNode = init_graph_node_translation_rotation(gGraphNodePool, nullptr, drawingLayer, displayList,
translation, rotation);
register_scene_graph_node(&graphNode->node);
gGeoLayoutCommand = (u8 *) cmdPos;
gGeoLayoutCommand = (u8 *)cmdPos;
}
/*
@@ -467,30 +492,32 @@ void geo_layout_cmd_node_translation_rotation(void) {
cmd+0x06: s16 zTranslation
[cmd+0x08: void *displayList]
*/
void geo_layout_cmd_node_translation(void) {
void geo_layout_cmd_node_translation(void)
{
struct GraphNodeTranslation *graphNode;
Vec3s translation;
s16 drawingLayer = 0;
s16 params = cur_geo_cmd_u8(0x01);
s16 *cmdPos = (s16 *) gGeoLayoutCommand;
void *displayList = NULL;
s16 *cmdPos = (s16 *)gGeoLayoutCommand;
void *displayList = nullptr;
cmdPos = read_vec3s(translation, &cmdPos[1]);
if (params & 0x80) {
displayList = *(void **) &cmdPos[0];
if (params & 0x80)
{
displayList = *(void **)&cmdPos[0];
drawingLayer = params & 0x0F;
cmdPos += 2 << CMD_SIZE_SHIFT;
}
graphNode =
init_graph_node_translation(gGraphNodePool, NULL, drawingLayer, displayList, translation);
init_graph_node_translation(gGraphNodePool, nullptr, drawingLayer, displayList, translation);
register_scene_graph_node(&graphNode->node);
gGeoLayoutCommand = (u8 *) cmdPos;
gGeoLayoutCommand = (u8 *)cmdPos;
}
/*
@@ -503,29 +530,31 @@ void geo_layout_cmd_node_translation(void) {
cmd+0x06: s16 unkZ
[cmd+0x08: void *displayList]
*/
void geo_layout_cmd_node_rotation(void) {
void geo_layout_cmd_node_rotation(void)
{
struct GraphNodeRotation *graphNode;
Vec3s sp2c;
s16 drawingLayer = 0;
s16 params = cur_geo_cmd_u8(0x01);
s16 *cmdPos = (s16 *) gGeoLayoutCommand;
void *displayList = NULL;
s16 *cmdPos = (s16 *)gGeoLayoutCommand;
void *displayList = nullptr;
cmdPos = read_vec3s_angle(sp2c, &cmdPos[1]);
if (params & 0x80) {
displayList = *(void **) &cmdPos[0];
if (params & 0x80)
{
displayList = *(void **)&cmdPos[0];
drawingLayer = params & 0x0F;
cmdPos += 2 << CMD_SIZE_SHIFT;
}
graphNode = init_graph_node_rotation(gGraphNodePool, NULL, drawingLayer, displayList, sp2c);
graphNode = init_graph_node_rotation(gGraphNodePool, nullptr, drawingLayer, displayList, sp2c);
register_scene_graph_node(&graphNode->node);
gGeoLayoutCommand = (u8 *) cmdPos;
gGeoLayoutCommand = (u8 *)cmdPos;
}
/*
@@ -536,21 +565,23 @@ void geo_layout_cmd_node_rotation(void) {
cmd+0x04: u32 scale (0x10000 = 1.0)
[cmd+0x08: void *displayList]
*/
void geo_layout_cmd_node_scale(void) {
void geo_layout_cmd_node_scale(void)
{
struct GraphNodeScale *graphNode;
s16 drawingLayer = 0;
s16 params = cur_geo_cmd_u8(0x01);
f32 scale = cur_geo_cmd_u32(0x04) / 65536.0f;
void *displayList = NULL;
void *displayList = nullptr;
if (params & 0x80) {
if (params & 0x80)
{
displayList = cur_geo_cmd_ptr(0x08);
drawingLayer = params & 0x0F;
gGeoLayoutCommand += 4 << CMD_SIZE_SHIFT;
}
graphNode = init_graph_node_scale(gGraphNodePool, NULL, drawingLayer, displayList, scale);
graphNode = init_graph_node_scale(gGraphNodePool, nullptr, drawingLayer, displayList, scale);
register_scene_graph_node(&graphNode->node);
@@ -558,7 +589,8 @@ void geo_layout_cmd_node_scale(void) {
}
// 0x1E: No operation
void geo_layout_cmd_nop2(void) {
void geo_layout_cmd_nop2(void)
{
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
}
@@ -570,17 +602,18 @@ void geo_layout_cmd_nop2(void) {
cmd+0x06: s16 zTranslation
cmd+0x08: void *displayList
*/
void geo_layout_cmd_node_animated_part(void) {
void geo_layout_cmd_node_animated_part(void)
{
struct GraphNodeAnimatedPart *graphNode;
Vec3s translation;
s32 drawingLayer = cur_geo_cmd_u8(0x01);
void *displayList = cur_geo_cmd_ptr(0x08);
s16 *cmdPos = (s16 *) gGeoLayoutCommand;
s16 *cmdPos = (s16 *)gGeoLayoutCommand;
read_vec3s(translation, &cmdPos[1]);
graphNode =
init_graph_node_animated_part(gGraphNodePool, NULL, drawingLayer, displayList, translation);
init_graph_node_animated_part(gGraphNodePool, nullptr, drawingLayer, displayList, translation);
register_scene_graph_node(&graphNode->node);
@@ -597,27 +630,29 @@ void geo_layout_cmd_node_animated_part(void) {
cmd+0x06: s16 zTranslation
[cmd+0x08: void *displayList]
*/
void geo_layout_cmd_node_billboard(void) {
void geo_layout_cmd_node_billboard(void)
{
struct GraphNodeBillboard *graphNode;
Vec3s translation;
s16 drawingLayer = 0;
s16 params = cur_geo_cmd_u8(0x01);
s16 *cmdPos = (s16 *) gGeoLayoutCommand;
void *displayList = NULL;
s16 *cmdPos = (s16 *)gGeoLayoutCommand;
void *displayList = nullptr;
cmdPos = read_vec3s(translation, &cmdPos[1]);
if (params & 0x80) {
displayList = *(void **) &cmdPos[0];
if (params & 0x80)
{
displayList = *(void **)&cmdPos[0];
drawingLayer = params & 0x0F;
cmdPos += 2 << CMD_SIZE_SHIFT;
}
graphNode = init_graph_node_billboard(gGraphNodePool, NULL, drawingLayer, displayList, translation);
graphNode = init_graph_node_billboard(gGraphNodePool, nullptr, drawingLayer, displayList, translation);
register_scene_graph_node(&graphNode->node);
gGeoLayoutCommand = (u8 *) cmdPos;
gGeoLayoutCommand = (u8 *)cmdPos;
}
/*
@@ -625,12 +660,13 @@ void geo_layout_cmd_node_billboard(void) {
cmd+0x01: u8 drawingLayer
cmd+0x04: void *displayList
*/
void geo_layout_cmd_node_display_list(void) {
void geo_layout_cmd_node_display_list(void)
{
struct GraphNodeDisplayList *graphNode;
s32 drawingLayer = cur_geo_cmd_u8(0x01);
void *displayList = cur_geo_cmd_ptr(0x04);
graphNode = init_graph_node_display_list(gGraphNodePool, NULL, drawingLayer, displayList);
graphNode = init_graph_node_display_list(gGraphNodePool, nullptr, drawingLayer, displayList);
register_scene_graph_node(&graphNode->node);
@@ -643,13 +679,14 @@ void geo_layout_cmd_node_display_list(void) {
cmd+0x04: s16 shadowSolidity
cmd+0x06: s16 shadowScale
*/
void geo_layout_cmd_node_shadow(void) {
void geo_layout_cmd_node_shadow(void)
{
struct GraphNodeShadow *graphNode;
u8 shadowType = cur_geo_cmd_s16(0x02);
u8 shadowSolidity = cur_geo_cmd_s16(0x04);
s16 shadowScale = cur_geo_cmd_s16(0x06);
graphNode = init_graph_node_shadow(gGraphNodePool, NULL, shadowScale, shadowSolidity, shadowType);
graphNode = init_graph_node_shadow(gGraphNodePool, nullptr, shadowScale, shadowSolidity, shadowType);
register_scene_graph_node(&graphNode->node);
@@ -657,10 +694,11 @@ void geo_layout_cmd_node_shadow(void) {
}
// 0x17: Create scene graph node that manages the group of all object nodes
void geo_layout_cmd_node_object_parent(void) {
void geo_layout_cmd_node_object_parent(void)
{
struct GraphNodeObjectParent *graphNode;
graphNode = init_graph_node_object_parent(gGraphNodePool, NULL, &gObjParentGraphNode);
graphNode = init_graph_node_object_parent(gGraphNodePool, nullptr, &gObjParentGraphNode);
register_scene_graph_node(&graphNode->node);
@@ -672,12 +710,13 @@ void geo_layout_cmd_node_object_parent(void) {
cmd+0x02: s16 parameter
cmd+0x04: GraphNodeFunc func
*/
void geo_layout_cmd_node_generated(void) {
void geo_layout_cmd_node_generated(void)
{
struct GraphNodeGenerated *graphNode;
graphNode = init_graph_node_generated(gGraphNodePool, NULL,
(GraphNodeFunc) cur_geo_cmd_ptr(0x04), // asm function
cur_geo_cmd_s16(0x02)); // parameter
graphNode = init_graph_node_generated(gGraphNodePool, nullptr,
(GraphNodeFunc)cur_geo_cmd_ptr(0x04), // asm function
cur_geo_cmd_s16(0x02)); // parameter
register_scene_graph_node(&graphNode->fnNode.node);
@@ -689,13 +728,14 @@ void geo_layout_cmd_node_generated(void) {
cmd+0x02: s16 background // background ID, or RGBA5551 color if backgroundFunc is null
cmd+0x04: GraphNodeFunc backgroundFunc
*/
void geo_layout_cmd_node_background(void) {
void geo_layout_cmd_node_background(void)
{
struct GraphNodeBackground *graphNode;
graphNode = init_graph_node_background(
gGraphNodePool, NULL,
gGraphNodePool, nullptr,
cur_geo_cmd_s16(0x02), // background ID, or RGBA5551 color if asm function is null
(GraphNodeFunc) cur_geo_cmd_ptr(0x04), // asm function
(GraphNodeFunc)cur_geo_cmd_ptr(0x04), // asm function
0);
register_scene_graph_node(&graphNode->fnNode.node);
@@ -704,7 +744,8 @@ void geo_layout_cmd_node_background(void) {
}
// 0x1A: No operation
void geo_layout_cmd_nop(void) {
void geo_layout_cmd_nop(void)
{
gGeoLayoutCommand += 0x08 << CMD_SIZE_SHIFT;
}
@@ -713,22 +754,27 @@ void geo_layout_cmd_nop(void) {
to a newly created object parent node.
cmd+0x02: s16 index (of gGeoViews)
*/
void geo_layout_cmd_copy_view(void) {
void geo_layout_cmd_copy_view(void)
{
struct GraphNodeObjectParent *graphNode;
struct GraphNode *node = NULL;
struct GraphNode *node = nullptr;
s16 index = cur_geo_cmd_s16(0x02);
if (index >= 0) {
if (index >= 0)
{
node = gGeoViews[index];
if (node->type == GRAPH_NODE_TYPE_OBJECT_PARENT) {
node = ((struct GraphNodeObjectParent *) node)->sharedChild;
} else {
node = NULL;
if (node->type == GRAPH_NODE_TYPE_OBJECT_PARENT)
{
node = ((struct GraphNodeObjectParent *)node)->sharedChild;
}
else
{
node = nullptr;
}
}
graphNode = init_graph_node_object_parent(gGraphNodePool, NULL, node);
graphNode = init_graph_node_object_parent(gGraphNodePool, nullptr, node);
register_scene_graph_node(&graphNode->node);
@@ -743,14 +789,15 @@ void geo_layout_cmd_copy_view(void) {
cmd+0x06: s16 offsetZ
cmd+0x08: GraphNodeFunc nodeFunc
*/
void geo_layout_cmd_node_held_obj(void) {
void geo_layout_cmd_node_held_obj(void)
{
struct GraphNodeHeldObject *graphNode;
Vec3s offset;
read_vec3s(offset, (s16 *) &gGeoLayoutCommand[0x02]);
read_vec3s(offset, (s16 *)&gGeoLayoutCommand[0x02]);
graphNode = init_graph_node_held_object(
gGraphNodePool, NULL, NULL, offset, (GraphNodeFunc) cur_geo_cmd_ptr(0x08), cur_geo_cmd_u8(0x01));
gGraphNodePool, nullptr, nullptr, offset, (GraphNodeFunc)cur_geo_cmd_ptr(0x08), cur_geo_cmd_u8(0x01));
register_scene_graph_node(&graphNode->fnNode.node);
@@ -762,17 +809,19 @@ void geo_layout_cmd_node_held_obj(void) {
is used for frustum culling.
cmd+0x02: s16 cullingRadius
*/
void geo_layout_cmd_node_culling_radius(void) {
void geo_layout_cmd_node_culling_radius(void)
{
struct GraphNodeCullingRadius *graphNode;
graphNode = init_graph_node_culling_radius(gGraphNodePool, NULL, cur_geo_cmd_s16(0x02));
graphNode = init_graph_node_culling_radius(gGraphNodePool, nullptr, cur_geo_cmd_s16(0x02));
register_scene_graph_node(&graphNode->node);
gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT;
}
struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr) {
struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr)
{
// set by register_scene_graph_node when gCurGraphNodeIndex is 0
// and gCurRootGraphNode is NULL
gCurRootGraphNode = NULL;
// and gCurRootGraphNode is nullptr
gCurRootGraphNode = nullptr;
gGeoNumViews = 0; // number of entries in gGeoViews
@@ -789,7 +838,8 @@ struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr) {
gGeoLayoutStack[0] = 0;
gGeoLayoutStack[1] = 0;
while (gGeoLayoutCommand != NULL) {
while (gGeoLayoutCommand != nullptr)
{
GeoLayoutJumpTable[gGeoLayoutCommand[0x00]]();
}
+32
View File
@@ -49,37 +49,69 @@ extern s16 D_8038BD78;
extern struct GraphNode *D_8038BCF8[];
void geo_layout_cmd_branch_and_link(void);
void geo_layout_cmd_end(void);
void geo_layout_cmd_branch(void);
void geo_layout_cmd_return(void);
void geo_layout_cmd_open_node(void);
void geo_layout_cmd_close_node(void);
void geo_layout_cmd_assign_as_view(void);
void geo_layout_cmd_update_node_flags(void);
void geo_layout_cmd_node_root(void);
void geo_layout_cmd_node_ortho_projection(void);
void geo_layout_cmd_node_perspective(void);
void geo_layout_cmd_node_start(void);
void geo_layout_cmd_nop3(void);
void geo_layout_cmd_node_master_list(void);
void geo_layout_cmd_node_level_of_detail(void);
void geo_layout_cmd_node_switch_case(void);
void geo_layout_cmd_node_camera(void);
void geo_layout_cmd_node_translation_rotation(void);
void geo_layout_cmd_node_translation(void);
void geo_layout_cmd_node_rotation(void);
void geo_layout_cmd_node_scale(void);
void geo_layout_cmd_nop2(void);
void geo_layout_cmd_node_animated_part(void);
void geo_layout_cmd_node_billboard(void);
void geo_layout_cmd_node_display_list(void);
void geo_layout_cmd_node_shadow(void);
void geo_layout_cmd_node_object_parent(void);
void geo_layout_cmd_node_generated(void);
void geo_layout_cmd_node_background(void);
void geo_layout_cmd_nop(void);
void geo_layout_cmd_copy_view(void);
void geo_layout_cmd_node_held_obj(void);
void geo_layout_cmd_node_culling_radius(void);
struct GraphNode *process_geo_layout(struct AllocOnlyPool *a0, void *segptr);
File diff suppressed because it is too large Load Diff
+241 -113
View File
@@ -18,7 +18,7 @@
#define GRAPH_NODE_TYPE_FUNCTIONAL 0x100
// Type used for Bowser and an unused geo function in obj_behaviors.c
#define GRAPH_NODE_TYPE_400 0x400
#define GRAPH_NODE_TYPE_400 0x400
// The discriminant for different types of geo nodes
#define GRAPH_NODE_TYPE_ROOT 0x001
@@ -70,23 +70,34 @@ typedef Gfx *(*GraphNodeFunc)(s32 callContext, struct GraphNode *node, void *con
*/
struct FnGraphNode
{
/*0x00*/ struct GraphNode node;
/*0x14*/ GraphNodeFunc func;
/*0x00*/
struct GraphNode node;
/*0x14*/
GraphNodeFunc func;
};
/** The very root of the geo tree. Specifies the viewport.
*/
struct GraphNodeRoot
{
/*0x00*/ struct GraphNode node;
/*0x14*/ u8 areaIndex;
/*0x15*/ s8 unk15; // ?
/*0x16*/ s16 x;
/*0x18*/ s16 y;
/*0x1A*/ s16 width; // half width, 160
/*0x1C*/ s16 height; // half height
/*0x1E*/ s16 numViews; // number of entries in mystery array
/*0x20*/ struct GraphNode **views;
/*0x00*/
struct GraphNode node;
/*0x14*/
u8 areaIndex;
/*0x15*/
s8 unk15; // ?
/*0x16*/
s16 x;
/*0x18*/
s16 y;
/*0x1A*/
s16 width; // half width, 160
/*0x1C*/
s16 height; // half height
/*0x1E*/
s16 numViews; // number of entries in mystery array
/*0x20*/
struct GraphNode **views;
};
/** A node that sets up an orthographic projection based on the global
@@ -94,8 +105,10 @@ struct GraphNodeRoot
*/
struct GraphNodeOrthoProjection
{
/*0x00*/ struct GraphNode node;
/*0x14*/ f32 scale;
/*0x00*/
struct GraphNode node;
/*0x14*/
f32 scale;
};
/** A node that sets up a perspective projection. Used for drawing the
@@ -104,11 +117,16 @@ struct GraphNodeOrthoProjection
*/
struct GraphNodePerspective
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ s32 unused;
/*0x1C*/ f32 fov; // horizontal field of view in degrees
/*0x20*/ s16 near; // near clipping plane
/*0x22*/ s16 far; // far clipping plane
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
s32 unused;
/*0x1C*/
f32 fov; // horizontal field of view in degrees
/*0x20*/
s16 near; // near clipping plane
/*0x22*/
s16 far; // far clipping plane
};
/** An entry in the master list. It is a linked list of display lists
@@ -128,9 +146,12 @@ struct DisplayListNode
*/
struct GraphNodeMasterList
{
/*0x00*/ struct GraphNode node;
/*0x14*/ struct DisplayListNode *listHeads[GFX_NUM_MASTER_LISTS];
/*0x34*/ struct DisplayListNode *listTails[GFX_NUM_MASTER_LISTS];
/*0x00*/
struct GraphNode node;
/*0x14*/
struct DisplayListNode *listHeads[GFX_NUM_MASTER_LISTS];
/*0x34*/
struct DisplayListNode *listTails[GFX_NUM_MASTER_LISTS];
};
/** Simply used as a parent to group multiple children.
@@ -138,7 +159,8 @@ struct GraphNodeMasterList
*/
struct GraphNodeStart
{
/*0x00*/ struct GraphNode node;
/*0x00*/
struct GraphNode node;
};
/** GraphNode that only renders its children if the current transformation matrix
@@ -149,9 +171,12 @@ struct GraphNodeStart
*/
struct GraphNodeLevelOfDetail
{
/*0x00*/ struct GraphNode node;
/*0x14*/ s16 minDistance;
/*0x16*/ s16 maxDistance;
/*0x00*/
struct GraphNode node;
/*0x14*/
s16 minDistance;
/*0x16*/
s16 maxDistance;
};
/** GraphNode that renders exactly one of its children.
@@ -161,10 +186,14 @@ struct GraphNodeLevelOfDetail
*/
struct GraphNodeSwitchCase
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ s32 unused;
/*0x1C*/ s16 numCases;
/*0x1E*/ s16 selectedCase;
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
s32 unused;
/*0x1C*/
s16 numCases;
/*0x1E*/
s16 selectedCase;
};
/**
@@ -173,8 +202,12 @@ struct GraphNodeSwitchCase
*/
struct GraphNodeCamera
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ union {
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
union
{
// When the node is created, a mode is assigned to the node.
// Later in geo_camera_main a Camera is allocated,
// the mode is passed to the struct, and the field is overridden
@@ -182,11 +215,17 @@ struct GraphNodeCamera
s32 mode;
struct Camera *camera;
} config;
/*0x1C*/ Vec3f pos;
/*0x28*/ Vec3f focus;
/*0x34*/ Mat4 *matrixPtr; // pointer to look-at matrix of this camera as a Mat4
/*0x38*/ s16 roll; // roll in look at matrix. Doesn't account for light direction unlike rollScreen.
/*0x3A*/ s16 rollScreen; // rolls screen while keeping the light direction consistent
/*0x1C*/
Vec3f pos;
/*0x28*/
Vec3f focus;
/*0x34*/
Mat4 *matrixPtr; // pointer to look-at matrix of this camera as a Mat4
/*0x38*/
s16 roll; // roll in look at matrix. Doesn't account for light direction unlike rollScreen.
/*0x3A*/
s16 rollScreen; // rolls screen while keeping the light direction consistent
};
/** GraphNode that translates and rotates its children.
@@ -197,10 +236,14 @@ struct GraphNodeCamera
*/
struct GraphNodeTranslationRotation
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ Vec3s translation;
/*0x1E*/ Vec3s rotation;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
Vec3s translation;
/*0x1E*/
Vec3s rotation;
};
/** GraphNode that translates itself and its children.
@@ -209,9 +252,12 @@ struct GraphNodeTranslationRotation
*/
struct GraphNodeTranslation
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ Vec3s translation;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
Vec3s translation;
u8 pad1E[2];
};
@@ -222,9 +268,12 @@ struct GraphNodeTranslation
*/
struct GraphNodeRotation
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ Vec3s rotation;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
Vec3s rotation;
u8 pad1E[2];
};
@@ -237,9 +286,12 @@ struct GraphNodeRotation
*/
struct GraphNodeAnimatedPart
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ Vec3s translation;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
Vec3s translation;
};
/** A GraphNode that draws a display list rotated in a way to always face the
@@ -249,9 +301,12 @@ struct GraphNodeAnimatedPart
*/
struct GraphNodeBillboard
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ Vec3s translation;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
Vec3s translation;
};
/** A GraphNode that simply draws a display list without doing any
@@ -259,8 +314,10 @@ struct GraphNodeBillboard
*/
struct GraphNodeDisplayList
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
};
/** GraphNode part that scales itself and its children.
@@ -273,9 +330,12 @@ struct GraphNodeDisplayList
*/
struct GraphNodeScale
{
/*0x00*/ struct GraphNode node;
/*0x14*/ void *displayList;
/*0x18*/ f32 scale;
/*0x00*/
struct GraphNode node;
/*0x14*/
void *displayList;
/*0x18*/
f32 scale;
};
/** GraphNode that draws a shadow under an object.
@@ -285,10 +345,14 @@ struct GraphNodeScale
*/
struct GraphNodeShadow
{
/*0x00*/ struct GraphNode node;
/*0x14*/ s16 shadowScale; // diameter (when a circle) or side (when a square) of shadow
/*0x16*/ u8 shadowSolidity; // opacity of shadow, 255 = opaque
/*0x17*/ u8 shadowType; // see ShadowType enum in shadow.h
/*0x00*/
struct GraphNode node;
/*0x14*/
s16 shadowScale; // diameter (when a circle) or side (when a square) of shadow
/*0x16*/
u8 shadowSolidity; // opacity of shadow, 255 = opaque
/*0x17*/
u8 shadowType; // see ShadowType enum in shadow.h
};
/** GraphNode that contains as its sharedChild a group node containing all
@@ -296,8 +360,10 @@ struct GraphNodeShadow
*/
struct GraphNodeObjectParent
{
/*0x00*/ struct GraphNode node;
/*0x14*/ struct GraphNode *sharedChild;
/*0x00*/
struct GraphNode node;
/*0x14*/
struct GraphNode *sharedChild;
};
/** GraphNode that draws display lists not directly in memory but generated by
@@ -310,8 +376,10 @@ struct GraphNodeObjectParent
*/
struct GraphNodeGenerated
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ u32 parameter; // extra context for the function
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
u32 parameter; // extra context for the function
};
/** GraphNode that draws a background image or a rectangle of a color.
@@ -319,19 +387,26 @@ struct GraphNodeGenerated
*/
struct GraphNodeBackground
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ s32 unused;
/*0x1C*/ s32 background; // background ID, or rgba5551 color if fnNode.func is null
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
s32 unused;
/*0x1C*/
s32 background; // background ID, or rgba5551 color if fnNode.func is null
};
/** Renders the object that Mario is holding.
*/
struct GraphNodeHeldObject
{
/*0x00*/ struct FnGraphNode fnNode;
/*0x18*/ s32 playerIndex;
/*0x1C*/ struct Object *objNode;
/*0x20*/ Vec3s translation;
/*0x00*/
struct FnGraphNode fnNode;
/*0x18*/
s32 playerIndex;
/*0x1C*/
struct Object *objNode;
/*0x20*/
Vec3s translation;
};
/** A node that allows an object to specify a different culling radius than the
@@ -341,8 +416,10 @@ struct GraphNodeHeldObject
*/
struct GraphNodeCullingRadius
{
/*0x00*/ struct GraphNode node;
/*0x14*/ s16 cullingRadius; // specifies the 'sphere radius' for purposes of frustum culling
/*0x00*/
struct GraphNode node;
/*0x14*/
s16 cullingRadius; // specifies the 'sphere radius' for purposes of frustum culling
u8 pad1E[2];
};
@@ -363,71 +440,122 @@ extern s16 gCurGraphNodeIndex;
void init_scene_graph_node_links(struct GraphNode *graphNode, s32 type);
struct GraphNodeRoot *init_graph_node_root(struct AllocOnlyPool *pool, struct GraphNodeRoot *graphNode,
s16 areaIndex, s16 x, s16 y, s16 width, s16 height);
struct GraphNodeRoot *init_graph_node_root(
struct AllocOnlyPool *pool, struct GraphNodeRoot *graphNode,
s16 areaIndex, s16 x, s16 y, s16 width, s16 height);
struct GraphNodeOrthoProjection *init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrthoProjection *graphNode, f32 scale);
struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *pool, struct GraphNodePerspective *graphNode,
f32 fov, s16 near, s16 far, GraphNodeFunc nodeFunc, s32 unused);
struct GraphNodePerspective *init_graph_node_perspective(
struct AllocOnlyPool *pool, struct GraphNodePerspective *graphNode,
f32 fov, s16 near, s16 far, GraphNodeFunc nodeFunc, s32 unused);
struct GraphNodeStart *init_graph_node_start(struct AllocOnlyPool *pool, struct GraphNodeStart *graphNode);
struct GraphNodeMasterList *init_graph_node_master_list(struct AllocOnlyPool *pool, struct GraphNodeMasterList *graphNode, s16 on);
struct GraphNodeLevelOfDetail *init_graph_node_render_range(struct AllocOnlyPool *pool, struct GraphNodeLevelOfDetail *graphNode,
s16 minDistance, s16 maxDistance);
struct GraphNodeSwitchCase *init_graph_node_switch_case(struct AllocOnlyPool *pool, struct GraphNodeSwitchCase *graphNode,
s16 numCases, s16 selectedCase, GraphNodeFunc nodeFunc, s32 unused);
struct GraphNodeCamera *init_graph_node_camera(struct AllocOnlyPool *pool, struct GraphNodeCamera *graphNode,
f32 *pos, f32 *focus, GraphNodeFunc func, s32 mode);
struct GraphNodeTranslationRotation *init_graph_node_translation_rotation(struct AllocOnlyPool *pool, struct GraphNodeTranslationRotation *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation, Vec3s rotation);
struct GraphNodeTranslation *init_graph_node_translation(struct AllocOnlyPool *pool, struct GraphNodeTranslation *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation);
struct GraphNodeRotation *init_graph_node_rotation(struct AllocOnlyPool *pool, struct GraphNodeRotation *graphNode,
s32 drawingLayer, void *displayList, Vec3s rotation);
struct GraphNodeScale *init_graph_node_scale(struct AllocOnlyPool *pool, struct GraphNodeScale *graphNode,
s32 drawingLayer, void *displayList, f32 scale);
struct GraphNodeObject *init_graph_node_object(struct AllocOnlyPool *pool, struct GraphNodeObject *graphNode,
struct GraphNode *sharedChild, Vec3f pos, Vec3s angle, Vec3f scale);
struct GraphNodeLevelOfDetail *init_graph_node_render_range(
struct AllocOnlyPool *pool, struct GraphNodeLevelOfDetail *graphNode,
s16 minDistance, s16 maxDistance);
struct GraphNodeSwitchCase *init_graph_node_switch_case(
struct AllocOnlyPool *pool, struct GraphNodeSwitchCase *graphNode,
s16 numCases, s16 selectedCase, GraphNodeFunc nodeFunc, s32 unused);
struct GraphNodeCamera *init_graph_node_camera(
struct AllocOnlyPool *pool, struct GraphNodeCamera *graphNode,
f32 *pos, f32 *focus, GraphNodeFunc func, s32 mode);
struct GraphNodeTranslationRotation *init_graph_node_translation_rotation(
struct AllocOnlyPool *pool, struct GraphNodeTranslationRotation *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation, Vec3s rotation);
struct GraphNodeTranslation *init_graph_node_translation(
struct AllocOnlyPool *pool, struct GraphNodeTranslation *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation);
struct GraphNodeRotation *init_graph_node_rotation(
struct AllocOnlyPool *pool, struct GraphNodeRotation *graphNode,
s32 drawingLayer, void *displayList, Vec3s rotation);
struct GraphNodeScale *init_graph_node_scale(
struct AllocOnlyPool *pool, struct GraphNodeScale *graphNode,
s32 drawingLayer, void *displayList, f32 scale);
struct GraphNodeObject *init_graph_node_object(
struct AllocOnlyPool *pool, struct GraphNodeObject *graphNode,
struct GraphNode *sharedChild, Vec3f pos, Vec3s angle, Vec3f scale);
struct GraphNodeCullingRadius *init_graph_node_culling_radius(struct AllocOnlyPool *pool, struct GraphNodeCullingRadius *graphNode, s16 radius);
struct GraphNodeAnimatedPart *init_graph_node_animated_part(struct AllocOnlyPool *pool, struct GraphNodeAnimatedPart *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation);
struct GraphNodeBillboard *init_graph_node_billboard(struct AllocOnlyPool *pool, struct GraphNodeBillboard *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation);
struct GraphNodeDisplayList *init_graph_node_display_list(struct AllocOnlyPool *pool, struct GraphNodeDisplayList *graphNode,
s32 drawingLayer, void *displayList);
struct GraphNodeShadow *init_graph_node_shadow(struct AllocOnlyPool *pool, struct GraphNodeShadow *graphNode,
s16 shadowScale, u8 shadowSolidity, u8 shadowType);
struct GraphNodeObjectParent *init_graph_node_object_parent(struct AllocOnlyPool *pool, struct GraphNodeObjectParent *sp1c,
struct GraphNode *sharedChild);
struct GraphNodeGenerated *init_graph_node_generated(struct AllocOnlyPool *pool, struct GraphNodeGenerated *sp1c,
GraphNodeFunc gfxFunc, s32 parameter);
struct GraphNodeBackground *init_graph_node_background(struct AllocOnlyPool *pool, struct GraphNodeBackground *sp1c,
u16 background, GraphNodeFunc backgroundFunc, s32 zero);
struct GraphNodeHeldObject *init_graph_node_held_object(struct AllocOnlyPool *pool, struct GraphNodeHeldObject *sp1c,
struct Object *objNode, Vec3s translation,
GraphNodeFunc nodeFunc, s32 playerIndex);
struct GraphNodeAnimatedPart *init_graph_node_animated_part(
struct AllocOnlyPool *pool, struct GraphNodeAnimatedPart *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation);
struct GraphNodeBillboard *init_graph_node_billboard(
struct AllocOnlyPool *pool, struct GraphNodeBillboard *graphNode,
s32 drawingLayer, void *displayList, Vec3s translation);
struct GraphNodeDisplayList *init_graph_node_display_list(
struct AllocOnlyPool *pool, struct GraphNodeDisplayList *graphNode,
s32 drawingLayer, void *displayList);
struct GraphNodeShadow *init_graph_node_shadow(
struct AllocOnlyPool *pool, struct GraphNodeShadow *graphNode,
s16 shadowScale, u8 shadowSolidity, u8 shadowType);
struct GraphNodeObjectParent *init_graph_node_object_parent(
struct AllocOnlyPool *pool, struct GraphNodeObjectParent *sp1c,
struct GraphNode *sharedChild);
struct GraphNodeGenerated *init_graph_node_generated(
struct AllocOnlyPool *pool, struct GraphNodeGenerated *sp1c,
GraphNodeFunc gfxFunc, s32 parameter);
struct GraphNodeBackground *init_graph_node_background(
struct AllocOnlyPool *pool, struct GraphNodeBackground *sp1c,
u16 background, GraphNodeFunc backgroundFunc, s32 zero);
struct GraphNodeHeldObject *init_graph_node_held_object(
struct AllocOnlyPool *pool, struct GraphNodeHeldObject *sp1c,
struct Object *objNode, Vec3s translation,
GraphNodeFunc nodeFunc, s32 playerIndex);
struct GraphNode *geo_add_child(struct GraphNode *parent, struct GraphNode *childNode);
struct GraphNode *geo_remove_child(struct GraphNode *graphNode);
struct GraphNode *geo_make_first_child(struct GraphNode *newFirstChild);
void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 callContext);
void geo_call_global_function_nodes(struct GraphNode *graphNode, s32 callContext);
void geo_reset_object_node(struct GraphNodeObject *graphNode);
void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle);
void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo *spawn);
void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr);
void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr, u32 animAccel);
s32 retrieve_animation_index(s32 frame, u16 **attributes);
s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist);
void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f position);
struct GraphNodeRoot *geo_find_root(struct GraphNode *graphNode);
// graph_node_manager
s16 *read_vec3s_to_vec3f(Vec3f, s16 *src);
s16 *read_vec3s_to_vec3f(Vec3f, s16 * src);
s16 *read_vec3s(Vec3s dst, s16 *src);
s16 *read_vec3s_angle(Vec3s dst, s16 *src);
void register_scene_graph_node(struct GraphNode *graphNode);
#endif // GRAPH_NODE_H
+32 -17
View File
@@ -6,14 +6,17 @@
#include "graph_node.h"
#if IS_64_BIT
static s16 next_s16_in_geo_script(s16 **src) {
static s16 next_s16_in_geo_script(s16 **src)
{
s16 ret;
if (((uintptr_t)(*src) & 7) == 4) {
*src += 2; // skip 32 bits
if (((uintptr_t)(*src) & 7) == 4)
{
*src += 2; // skip 32 bits
}
ret = *(*src)++;
if (((uintptr_t)(*src) & 7) == 4) {
*src += 2; // skip 32 bits
if (((uintptr_t)(*src) & 7) == 4)
{
*src += 2; // skip 32 bits
}
return ret;
}
@@ -25,7 +28,8 @@ static s16 next_s16_in_geo_script(s16 **src) {
* 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) {
s16 *read_vec3s_to_vec3f(Vec3f dst, s16 *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);
@@ -37,7 +41,8 @@ s16 *read_vec3s_to_vec3f(Vec3f dst, s16 *src) {
* copies it to the destination vector. It's essentially a memcpy but consistent
* with the other two 'geo-script vector to internal vector' functions.
*/
s16 *read_vec3s(Vec3s dst, s16 *src) {
s16 *read_vec3s(Vec3s dst, s16 *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);
@@ -49,7 +54,8 @@ s16 *read_vec3s(Vec3s dst, s16 *src) {
* and converts it to a vector of three in-game angle units in [-32768, 32767]
* range.
*/
s16 *read_vec3s_angle(Vec3s dst, s16 *src) {
s16 *read_vec3s_angle(Vec3s dst, s16 *src)
{
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;
@@ -61,19 +67,28 @@ s16 *read_vec3s_angle(Vec3s dst, s16 *src) {
* 'gCurGraphNodeList'. This is called from geo_layout commands to add nodes
* to the scene graph.
*/
void register_scene_graph_node(struct GraphNode *graphNode) {
if (graphNode != NULL) {
void register_scene_graph_node(struct GraphNode *graphNode)
{
if (graphNode != nullptr)
{
gCurGraphNodeList[gCurGraphNodeIndex] = graphNode;
if (gCurGraphNodeIndex == 0) {
if (gCurRootGraphNode == NULL) {
if (gCurGraphNodeIndex == 0)
{
if (gCurRootGraphNode == nullptr)
{
gCurRootGraphNode = graphNode;
}
} else {
if (gCurGraphNodeList[gCurGraphNodeIndex - 1]->type == GRAPH_NODE_TYPE_OBJECT_PARENT) {
((struct GraphNodeObjectParent *) gCurGraphNodeList[gCurGraphNodeIndex - 1])
->sharedChild = graphNode;
} else {
}
else
{
if (gCurGraphNodeList[gCurGraphNodeIndex - 1]->type == GRAPH_NODE_TYPE_OBJECT_PARENT)
{
((struct GraphNodeObjectParent *)gCurGraphNodeList[gCurGraphNodeIndex - 1])
->sharedChild = graphNode;
}
else
{
geo_add_child(gCurGraphNodeList[gCurGraphNodeIndex - 1], graphNode);
}
}
+38 -21
View File
@@ -5,14 +5,17 @@
#endif
#ifndef GBI_FLOATS
void guMtxF2L(float mf[4][4], Mtx *m) {
void guMtxF2L(float mf[4][4], Mtx *m)
{
int r, c;
s32 tmp1;
s32 tmp2;
s32 *m1 = &m->m[0][0];
s32 *m2 = &m->m[2][0];
for (r = 0; r < 4; r++) {
for (c = 0; c < 2; c++) {
for (r = 0; r < 4; r++)
{
for (c = 0; c < 2; c++)
{
tmp1 = mf[r][2 * c] * 65536.0f;
tmp2 = mf[r][2 * c + 1] * 65536.0f;
*m1++ = (tmp1 & 0xffff0000) | ((tmp2 >> 0x10) & 0xffff);
@@ -20,53 +23,67 @@ void guMtxF2L(float mf[4][4], Mtx *m) {
}
}
}
void guMtxL2F(float mf[4][4], Mtx *m) {
void guMtxL2F(float mf[4][4], Mtx *m)
{
int r, c;
u32 tmp1;
u32 tmp2;
u32 *m1;
u32 *m2;
s32 stmp1, stmp2;
m1 = (u32 *) &m->m[0][0];
m2 = (u32 *) &m->m[2][0];
for (r = 0; r < 4; r++) {
for (c = 0; c < 2; c++) {
m1 = (u32 *)&m->m[0][0];
m2 = (u32 *)&m->m[2][0];
for (r = 0; r < 4; r++)
{
for (c = 0; c < 2; c++)
{
tmp1 = (*m1 & 0xffff0000) | ((*m2 >> 0x10) & 0xffff);
tmp2 = ((*m1++ << 0x10) & 0xffff0000) | (*m2++ & 0xffff);
stmp1 = *(s32 *) &tmp1;
stmp2 = *(s32 *) &tmp2;
stmp1 = *(s32 *)&tmp1;
stmp2 = *(s32 *)&tmp2;
mf[r][c * 2 + 0] = stmp1 / 65536.0f;
mf[r][c * 2 + 1] = stmp2 / 65536.0f;
}
}
}
#else
void guMtxF2L(float mf[4][4], Mtx *m) {
void guMtxF2L(float mf[4][4], Mtx *m)
{
memcpy(m, mf, sizeof(Mtx));
}
void guMtxL2F(float mf[4][4], Mtx *m) {
void guMtxL2F(float mf[4][4], Mtx *m)
{
memcpy(mf, m, sizeof(Mtx));
}
#endif
void guMtxIdentF(float mf[4][4]) {
void guMtxIdentF(float mf[4][4])
{
int r, c;
for (r = 0; r < 4; r++) {
for (c = 0; c < 4; c++) {
if (r == c) {
for (r = 0; r < 4; r++)
{
for (c = 0; c < 4; c++)
{
if (r == c)
{
mf[r][c] = 1.0f;
} else {
}
else
{
mf[r][c] = 0.0f;
}
}
}
}
void guMtxIdent(Mtx *m) {
#ifndef GBI_FLOATS
void guMtxIdent(Mtx *m)
{
#ifndef GBI_FLOATS
float mf[4][4];
guMtxIdentF(mf);
guMtxF2L(mf, m);
#else
#else
guMtxIdentF(m->m);
#endif
#endif
}
+1
View File
@@ -4,6 +4,7 @@
#include "../include/PR/gbi.h"
extern void guMtxF2L(float mf[4][4], Mtx *m);
extern void guMtxL2F(float mf[4][4], Mtx *m);
#endif//GUMTXF2L_H
+199 -111
View File
@@ -8,13 +8,13 @@
#include "graph_node.h"
#include "surface_collision.h"
static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f };
static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
// Inlined tables
f32 gSineTable[] = {
0.000000000f, 0.0015339801f,0.0030679568f,0.004601926f,
0.0061358847f,0.007669829f, 0.009203754f, 0.010737659f,
0.012271538f, 0.0138053885f,0.015339206f, 0.016872987f,
0.000000000f, 0.0015339801f, 0.0030679568f, 0.004601926f,
0.0061358847f, 0.007669829f, 0.009203754f, 0.010737659f,
0.012271538f, 0.0138053885f, 0.015339206f, 0.016872987f,
0.018406730f, 0.019940428f, 0.021474080f, 0.023007682f,
0.024541229f, 0.026074719f, 0.027608145f, 0.029141508f,
0.030674804f, 0.032208025f, 0.033741172f, 0.035274237f,
@@ -268,11 +268,11 @@ f32 gSineTable[] = {
0.999830604f, 0.999857664f, 0.999882340f, 0.999904692f,
0.999924719f, 0.999942362f, 0.999957621f, 0.999970615f,
0.999981165f, 0.999989390f, 0.999995291f, 0.999998808f,
#ifndef AVOID_UB
#ifndef AVOID_UB
};
f32 gCosineTable[0x1000] = {
#endif
#endif
// cosine
1.000000000f, 0.999998808f, 0.999995291f, 0.999989390f,
0.999981165f, 0.999970615f, 0.999957621f, 0.999942362f,
@@ -529,12 +529,12 @@ f32 gCosineTable[0x1000] = {
0.024541229f, 0.023007682f, 0.021474080f, 0.019940428f,
0.018406730f, 0.016872987f, 0.015339206f, 0.0138053885f,
0.012271538f, 0.010737659f, 0.009203754f, 0.007669829f,
0.0061358847f,0.004601926f, 0.0030679568f,0.0015339801f,
0.0061358847f, 0.004601926f, 0.0030679568f, 0.0015339801f,
// negative sine
0.000000000f, -0.0015339801f,-0.0030679568f,-0.004601926f,
-0.0061358847f,-0.007669829f, -0.009203754f, -0.010737659f,
-0.012271538f, -0.0138053885f,-0.015339206f, -0.016872987f,
0.000000000f, -0.0015339801f, -0.0030679568f, -0.004601926f,
-0.0061358847f, -0.007669829f, -0.009203754f, -0.010737659f,
-0.012271538f, -0.0138053885f, -0.015339206f, -0.016872987f,
-0.018406730f, -0.019940428f, -0.021474080f, -0.023007682f,
-0.024541229f, -0.026074719f, -0.027608145f, -0.029141508f,
-0.030674804f, -0.032208025f, -0.033741172f, -0.035274237f,
@@ -1045,12 +1045,12 @@ f32 gCosineTable[0x1000] = {
-0.024541229f, -0.023007682f, -0.021474080f, -0.019940428f,
-0.018406730f, -0.016872987f, -0.015339206f, -0.0138053885f,
-0.012271538f, -0.010737659f, -0.009203754f, -0.007669829f,
-0.0061358847f,-0.004601926f, -0.0030679568f,-0.0015339801f,
-0.0061358847f, -0.004601926f, -0.0030679568f, -0.0015339801f,
// sine
0.000000000f, 0.0015339801f,0.0030679568f,0.004601926f,
0.0061358847f,0.007669829f, 0.009203754f, 0.010737659f,
0.012271538f, 0.0138053885f,0.015339206f, 0.016872987f,
0.000000000f, 0.0015339801f, 0.0030679568f, 0.004601926f,
0.0061358847f, 0.007669829f, 0.009203754f, 0.010737659f,
0.012271538f, 0.0138053885f, 0.015339206f, 0.016872987f,
0.018406730f, 0.019940428f, 0.021474080f, 0.023007682f,
0.024541229f, 0.026074719f, 0.027608145f, 0.029141508f,
0.030674804f, 0.032208025f, 0.033741172f, 0.035274237f,
@@ -1450,7 +1450,8 @@ int gSplineState;
#pragma GCC diagnostic ignored "-Wreturn-local-addr"
/// Copy vector 'src' to 'dest'
void *vec3f_copy(Vec3f dest, Vec3f src) {
void *vec3f_copy(Vec3f dest, Vec3f src)
{
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
@@ -1458,7 +1459,8 @@ void *vec3f_copy(Vec3f dest, Vec3f src) {
}
/// Set vector 'dest' to (x, y, z)
void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z) {
void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z)
{
dest[0] = x;
dest[1] = y;
dest[2] = z;
@@ -1466,7 +1468,8 @@ void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z) {
}
/// Add vector 'a' to 'dest'
void *vec3f_add(Vec3f dest, Vec3f a) {
void *vec3f_add(Vec3f dest, Vec3f a)
{
dest[0] += a[0];
dest[1] += a[1];
dest[2] += a[2];
@@ -1474,7 +1477,8 @@ void *vec3f_add(Vec3f dest, Vec3f a) {
}
/// Make 'dest' the sum of vectors a and b.
void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b) {
void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b)
{
dest[0] = a[0] + b[0];
dest[1] = a[1] + b[1];
dest[2] = a[2] + b[2];
@@ -1482,7 +1486,8 @@ void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b) {
}
/// Copy vector src to dest
void *vec3s_copy(Vec3s dest, Vec3s src) {
void *vec3s_copy(Vec3s dest, Vec3s src)
{
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2];
@@ -1490,7 +1495,8 @@ void *vec3s_copy(Vec3s dest, Vec3s src) {
}
/// Set vector 'dest' to (x, y, z)
void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z) {
void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z)
{
dest[0] = x;
dest[1] = y;
dest[2] = z;
@@ -1498,7 +1504,8 @@ void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z) {
}
/// Add vector a to 'dest'
void *vec3s_add(Vec3s dest, Vec3s a) {
void *vec3s_add(Vec3s dest, Vec3s a)
{
dest[0] += a[0];
dest[1] += a[1];
dest[2] += a[2];
@@ -1506,7 +1513,8 @@ void *vec3s_add(Vec3s dest, Vec3s a) {
}
/// Make 'dest' the sum of vectors a and b.
void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b) {
void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b)
{
dest[0] = a[0] + b[0];
dest[1] = a[1] + b[1];
dest[2] = a[2] + b[2];
@@ -1514,7 +1522,8 @@ void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b) {
}
/// Subtract vector a from 'dest'
void *vec3s_sub(Vec3s dest, Vec3s a) {
void *vec3s_sub(Vec3s dest, Vec3s a)
{
dest[0] -= a[0];
dest[1] -= a[1];
dest[2] -= a[2];
@@ -1522,7 +1531,8 @@ void *vec3s_sub(Vec3s dest, Vec3s a) {
}
/// Convert short vector a to float vector 'dest'
void *vec3s_to_vec3f(Vec3f dest, Vec3s a) {
void *vec3s_to_vec3f(Vec3f dest, Vec3s a)
{
dest[0] = a[0];
dest[1] = a[1];
dest[2] = a[2];
@@ -1533,7 +1543,8 @@ void *vec3s_to_vec3f(Vec3f dest, Vec3s a) {
* Convert float vector a to a short vector 'dest' by rounding the components
* to the nearest integer.
*/
void *vec3f_to_vec3s(Vec3s dest, Vec3f a) {
void *vec3f_to_vec3s(Vec3s dest, Vec3f a)
{
// add/subtract 0.5 in order to round to the nearest s32 instead of truncating
dest[0] = a[0] + ((a[0] > 0) ? 0.5f : -0.5f);
dest[1] = a[1] + ((a[1] > 0) ? 0.5f : -0.5f);
@@ -1546,7 +1557,8 @@ void *vec3f_to_vec3s(Vec3s dest, Vec3f a) {
* It is similar to vec3f_cross, but it calculates the vectors (c-b) and (b-a)
* at the same time.
*/
void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c) {
void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c)
{
dest[0] = (b[1] - a[1]) * (c[2] - b[2]) - (c[1] - b[1]) * (b[2] - a[2]);
dest[1] = (b[2] - a[2]) * (c[0] - b[0]) - (c[2] - b[2]) * (b[0] - a[0]);
dest[2] = (b[0] - a[0]) * (c[1] - b[1]) - (c[0] - b[0]) * (b[1] - a[1]);
@@ -1554,7 +1566,8 @@ void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c)
}
/// Make vector 'dest' the cross product of vectors a and b.
void *vec3f_cross(Vec3f dest, Vec3f a, Vec3f b) {
void *vec3f_cross(Vec3f dest, Vec3f a, Vec3f b)
{
dest[0] = a[1] * b[2] - b[1] * a[2];
dest[1] = a[2] * b[0] - b[2] * a[0];
dest[2] = a[0] * b[1] - b[0] * a[1];
@@ -1562,7 +1575,8 @@ void *vec3f_cross(Vec3f dest, Vec3f a, Vec3f b) {
}
/// Scale vector 'dest' so it has length 1
void *vec3f_normalize(Vec3f dest) {
void *vec3f_normalize(Vec3f dest)
{
//! Possible division by zero
f32 invsqrt = 1.0f / sqrtf(dest[0] * dest[0] + dest[1] * dest[1] + dest[2] * dest[2]);
@@ -1575,12 +1589,14 @@ void *vec3f_normalize(Vec3f dest) {
#pragma GCC diagnostic pop
/// Copy matrix 'src' to 'dest'
void mtxf_copy(Mat4 dest, Mat4 src) {
void mtxf_copy(Mat4 dest, Mat4 src)
{
register s32 i;
register u32 *d = (u32 *) dest;
register u32 *s = (u32 *) src;
register u32 *d = (u32 *)dest;
register u32 *s = (u32 *)src;
for (i = 0; i < 16; i++) {
for (i = 0; i < 16; i++)
{
*d++ = *s++;
}
}
@@ -1588,22 +1604,24 @@ void mtxf_copy(Mat4 dest, Mat4 src) {
/**
* Set mtx to the identity matrix
*/
void mtxf_identity(Mat4 mtx) {
void mtxf_identity(Mat4 mtx)
{
register s32 i;
register f32 *dest;
// These loops must be one line to match on -O2
// initialize everything except the first and last cells to 0
for (dest = (f32 *) mtx + 1, i = 0; i < 14; dest++, i++) *dest = 0;
for (dest = (f32 *)mtx + 1, i = 0; i < 14; dest++, i++) *dest = 0;
// initialize the diagonal cells to 1
for (dest = (f32 *) mtx, i = 0; i < 4; dest += 5, i++) *dest = 1;
for (dest = (f32 *)mtx, i = 0; i < 4; dest += 5, i++) *dest = 1;
}
/**
* Set dest to a translation matrix of vector b
*/
void mtxf_translate(Mat4 dest, Vec3f b) {
void mtxf_translate(Mat4 dest, Vec3f b)
{
mtxf_identity(dest);
dest[3][0] = b[0];
dest[3][1] = b[1];
@@ -1616,7 +1634,8 @@ void mtxf_translate(Mat4 dest, Vec3f b) {
* at the position 'to'. The up-vector is assumed to be (0, 1, 0), but the 'roll'
* angle allows a bank rotation of the camera.
*/
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll)
{
register f32 invLength;
f32 dx;
f32 dz;
@@ -1694,7 +1713,8 @@ void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll) {
* Build a matrix that rotates around the z axis, then the x axis, then the y
* axis, and then translates.
*/
void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f translate, Vec3s rotate) {
void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f translate, Vec3s rotate)
{
register f32 sx = sins(rotate[0]);
register f32 cx = coss(rotate[0]);
@@ -1727,7 +1747,8 @@ void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f translate, Vec3s rotate) {
* Build a matrix that rotates around the x axis, then the y axis, then the z
* axis, and then translates.
*/
void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f b, Vec3s c) {
void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f b, Vec3s c)
{
register f32 sx = sins(c[0]);
register f32 cx = coss(c[0]);
@@ -1764,7 +1785,8 @@ void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f b, Vec3s c) {
* 'position' is the position of the object in the world
* 'angle' rotates the object while still facing the camera.
*/
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) {
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle)
{
dest[0][0] = coss(angle);
dest[0][1] = sins(angle);
dest[0][2] = 0;
@@ -1781,11 +1803,11 @@ void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) {
dest[2][3] = 0;
dest[3][0] =
mtx[0][0] * position[0] + mtx[1][0] * position[1] + mtx[2][0] * position[2] + mtx[3][0];
mtx[0][0] * position[0] + mtx[1][0] * position[1] + mtx[2][0] * position[2] + mtx[3][0];
dest[3][1] =
mtx[0][1] * position[0] + mtx[1][1] * position[1] + mtx[2][1] * position[2] + mtx[3][1];
mtx[0][1] * position[0] + mtx[1][1] * position[1] + mtx[2][1] * position[2] + mtx[3][1];
dest[3][2] =
mtx[0][2] * position[0] + mtx[1][2] * position[1] + mtx[2][2] * position[2] + mtx[3][2];
mtx[0][2] * position[0] + mtx[1][2] * position[1] + mtx[2][2] * position[2] + mtx[3][2];
dest[3][3] = 1;
}
@@ -1796,7 +1818,8 @@ void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle) {
* 'yaw' is the angle which it should face
* 'pos' is the object's position in the world
*/
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw) {
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw)
{
Vec3f lateralDir;
Vec3f leftDir;
Vec3f forwardDir;
@@ -1839,7 +1862,8 @@ void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw) {
* 'pos' is the object's position in the world
* 'radius' is the distance from each triangle vertex to the center
*/
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius)
{
struct SM64SurfaceCollisionData *sp74;
Vec3f point0;
Vec3f point1;
@@ -1862,15 +1886,18 @@ void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
point1[1] = find_floor(point1[0], pos[1] + 150, point1[2], &sp74);
point2[1] = find_floor(point2[0], pos[1] + 150, point2[2], &sp74);
if (point0[1] - pos[1] < minY) {
if (point0[1] - pos[1] < minY)
{
point0[1] = pos[1];
}
if (point1[1] - pos[1] < minY) {
if (point1[1] - pos[1] < minY)
{
point1[1] = pos[1];
}
if (point2[1] - pos[1] < minY) {
if (point2[1] - pos[1] < minY)
{
point2[1] = pos[1];
}
@@ -1913,7 +1940,8 @@ void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
* The resulting matrix represents first applying transformation b and
* then a.
*/
void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b) {
void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b)
{
Mat4 temp;
register f32 entry0;
register f32 entry1;
@@ -1960,10 +1988,12 @@ void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b) {
/**
* Set matrix 'dest' to 'mtx' scaled by vector s
*/
void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s) {
void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s)
{
register s32 i;
for (i = 0; i < 4; i++) {
for (i = 0; i < 4; i++)
{
dest[0][i] = mtx[0][i] * s[0];
dest[1][i] = mtx[1][i] * s[1];
dest[2][i] = mtx[2][i] * s[2];
@@ -1976,7 +2006,8 @@ void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s) {
* to the point. Note that the bottom row is assumed to be [0, 0, 0, 1], which is
* true for transformation matrices if the translation has a w component of 1.
*/
void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
void mtxf_mul_vec3s(Mat4 mtx, Vec3s b)
{
register f32 x = b[0];
register f32 y = b[1];
register f32 z = b[2];
@@ -1986,7 +2017,8 @@ void mtxf_mul_vec3s(Mat4 mtx, Vec3s b) {
b[2] = x * mtx[0][2] + y * mtx[1][2] + z * mtx[2][2] + mtx[3][2];
}
void mtxf_mul_vec3f(Mat4 mtx, Vec3f b) {
void mtxf_mul_vec3f(Mat4 mtx, Vec3f b)
{
register f32 x = b[0];
register f32 y = b[1];
register f32 z = b[2];
@@ -1994,7 +2026,8 @@ void mtxf_mul_vec3f(Mat4 mtx, Vec3f b) {
b[0] = x * mtx[0][0] + y * mtx[1][0] + z * mtx[2][0] + mtx[3][0];
b[1] = x * mtx[0][1] + y * mtx[1][1] + z * mtx[2][1] + mtx[3][1];
b[2] = x * mtx[0][2] + y * mtx[1][2] + z * mtx[2][2] + mtx[3][2];
}
}
/**
* Convert float matrix 'src' to fixed point matrix 'dest'.
* The float matrix may not contain entries larger than 65536 or the console
@@ -2004,30 +2037,33 @@ void mtxf_mul_vec3f(Mat4 mtx, Vec3f b) {
* exception. On Wii and Wii U Virtual Console the value will simply be clamped
* and no crashes occur.
*/
void mtxf_to_mtx(Mtx *dest, Mat4 src) {
#ifdef AVOID_UB
void mtxf_to_mtx(Mtx *dest, Mat4 src)
{
#ifdef AVOID_UB
// Avoid type-casting which is technically UB by calling the equivalent
// guMtxF2L function. This helps little-endian systems, as well.
guMtxF2L(src, dest);
#else
#else
s32 asFixedPoint;
register s32 i;
register s16 *a3 = (s16 *) dest; // all integer parts stored in first 16 bytes
register s16 *t0 = (s16 *) dest + 16; // all fraction parts stored in last 16 bytes
register f32 *t1 = (f32 *) src;
register s16 *a3 = (s16 *)dest; // all integer parts stored in first 16 bytes
register s16 *t0 = (s16 *)dest + 16; // all fraction parts stored in last 16 bytes
register f32 *t1 = (f32 *)src;
for (i = 0; i < 16; i++) {
for (i = 0; i < 16; i++)
{
asFixedPoint = *t1++ * (1 << 16); //! float-to-integer conversion responsible for PU crashes
*a3++ = GET_HIGH_S16_OF_32(asFixedPoint); // integer part
*t0++ = GET_LOW_S16_OF_32(asFixedPoint); // fraction part
*t0++ = GET_LOW_S16_OF_32(asFixedPoint); // fraction part
}
#endif
#endif
}
/**
* Set 'mtx' to a transformation matrix that rotates around the z axis.
*/
void mtxf_rotate_xy(Mtx *mtx, s16 angle) {
void mtxf_rotate_xy(Mtx *mtx, s16 angle)
{
Mat4 temp;
mtxf_identity(temp);
@@ -2046,17 +2082,18 @@ void mtxf_rotate_xy(Mtx *mtx, s16 angle) {
* objMtx back from screen orientation to world orientation, and then subtracting
* the camera position.
*/
void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx) {
void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx)
{
f32 camX = camMtx[3][0] * camMtx[0][0] + camMtx[3][1] * camMtx[0][1] + camMtx[3][2] * camMtx[0][2];
f32 camY = camMtx[3][0] * camMtx[1][0] + camMtx[3][1] * camMtx[1][1] + camMtx[3][2] * camMtx[1][2];
f32 camZ = camMtx[3][0] * camMtx[2][0] + camMtx[3][1] * camMtx[2][1] + camMtx[3][2] * camMtx[2][2];
dest[0] =
objMtx[3][0] * camMtx[0][0] + objMtx[3][1] * camMtx[0][1] + objMtx[3][2] * camMtx[0][2] - camX;
objMtx[3][0] * camMtx[0][0] + objMtx[3][1] * camMtx[0][1] + objMtx[3][2] * camMtx[0][2] - camX;
dest[1] =
objMtx[3][0] * camMtx[1][0] + objMtx[3][1] * camMtx[1][1] + objMtx[3][2] * camMtx[1][2] - camY;
objMtx[3][0] * camMtx[1][0] + objMtx[3][1] * camMtx[1][1] + objMtx[3][2] * camMtx[1][2] - camY;
dest[2] =
objMtx[3][0] * camMtx[2][0] + objMtx[3][1] * camMtx[2][1] + objMtx[3][2] * camMtx[2][2] - camZ;
objMtx[3][0] * camMtx[2][0] + objMtx[3][1] * camMtx[2][1] + objMtx[3][2] * camMtx[2][2] - camZ;
}
/**
@@ -2064,7 +2101,8 @@ void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx) {
* of that vector, as well as the yaw and pitch angles.
* Basically it converts the direction to spherical coordinates.
*/
void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw) {
void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw)
{
register f32 x = to[0] - from[0];
register f32 y = to[1] - from[1];
register f32 z = to[2] - from[2];
@@ -2078,7 +2116,8 @@ void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *
* Construct the 'to' point which is distance 'dist' away from the 'from' position,
* and has the angles pitch and yaw.
*/
void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw) {
void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw)
{
to[0] = from[0] + dist * coss(pitch) * sins(yaw);
to[1] = from[1] + dist * sins(pitch);
to[2] = from[2] + dist * coss(pitch) * coss(yaw);
@@ -2088,18 +2127,24 @@ void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw
* Return the value 'current' after it tries to approach target, going up at
* most 'inc' and going down at most 'dec'.
*/
s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec) {
s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec)
{
//! If target is close to the max or min s32, then it's possible to overflow
// past it without stopping.
if (current < target) {
if (current < target)
{
current += inc;
if (current > target) {
if (current > target)
{
current = target;
}
} else {
}
else
{
current -= dec;
if (current < target) {
if (current < target)
{
current = target;
}
}
@@ -2110,15 +2155,21 @@ s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec) {
* Return the value 'current' after it tries to approach target, going up at
* most 'inc' and going down at most 'dec'.
*/
f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec) {
if (current < target) {
f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec)
{
if (current < target)
{
current += inc;
if (current > target) {
if (current > target)
{
current = target;
}
} else {
}
else
{
current -= dec;
if (current < target) {
if (current < target)
{
current = target;
}
}
@@ -2129,12 +2180,16 @@ f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec) {
* Helper function for atan2s. Does a look up of the arctangent of y/x assuming
* the resulting angle is in range [0, 0x2000] (1/8 of a circle).
*/
static u16 atan2_lookup(f32 y, f32 x) {
static u16 atan2_lookup(f32 y, f32 x)
{
u16 ret;
if (x == 0) {
if (x == 0)
{
ret = gArctanTable[0];
} else {
}
else
{
ret = gArctanTable[(s32)(y / x * 1024 + 0.5f)];
}
return ret;
@@ -2144,37 +2199,59 @@ static u16 atan2_lookup(f32 y, f32 x) {
* Compute the angle from (0, 0) to (x, y) as a s16. Given that terrain is in
* the xz-plane, this is commonly called with (z, x) to get a yaw angle.
*/
s16 atan2s(f32 y, f32 x) {
s16 atan2s(f32 y, f32 x)
{
u16 ret;
if (x >= 0) {
if (y >= 0) {
if (y >= x) {
if (x >= 0)
{
if (y >= 0)
{
if (y >= x)
{
ret = atan2_lookup(x, y);
} else {
}
else
{
ret = 0x4000 - atan2_lookup(y, x);
}
} else {
}
else
{
y = -y;
if (y < x) {
if (y < x)
{
ret = 0x4000 + atan2_lookup(y, x);
} else {
}
else
{
ret = 0x8000 - atan2_lookup(x, y);
}
}
} else {
}
else
{
x = -x;
if (y < 0) {
if (y < 0)
{
y = -y;
if (y >= x) {
if (y >= x)
{
ret = 0x8000 + atan2_lookup(x, y);
} else {
}
else
{
ret = 0xC000 - atan2_lookup(y, x);
}
} else {
if (y < x) {
}
else
{
if (y < x)
{
ret = 0xC000 + atan2_lookup(y, x);
} else {
}
else
{
ret = -atan2_lookup(x, y);
}
}
@@ -2220,14 +2297,16 @@ s16 atan2s(f32 y, f32 x) {
* [0, 0, 0, 0, 1, 2, ... n-1, n, n, n, n]
* TODO: verify the classification of the spline / figure out how polynomials were computed
*/
void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c) {
void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c)
{
f32 tinv = 1 - t;
f32 tinv2 = tinv * tinv;
f32 tinv3 = tinv2 * tinv;
f32 t2 = t * t;
f32 t3 = t2 * t;
switch (gSplineState) {
switch (gSplineState)
{
case CURVE_BEGIN_1:
result[0] = tinv3;
result[1] = t3 * 1.75f - t2 * 4.5f + t * 3.0f;
@@ -2269,7 +2348,8 @@ void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c) {
* The array should end with three entries with s=0 (infinite keyframe duration).
* That's because the spline has a 3rd degree polynomial, so it looks 3 points ahead.
*/
void anim_spline_init(Vec4s *keyFrames) {
void anim_spline_init(Vec4s *keyFrames)
{
gSplineKeyframe = keyFrames;
gSplineKeyframeFraction = 0;
gSplineState = 1;
@@ -2280,28 +2360,33 @@ void anim_spline_init(Vec4s *keyFrames) {
* anim_spline_init should be called before polling for vectors.
* Returns TRUE when the last point is reached, FALSE otherwise.
*/
s32 anim_spline_poll(Vec3f result) {
s32 anim_spline_poll(Vec3f result)
{
Vec4f weights;
s32 i;
s32 hasEnded = FALSE;
vec3f_copy(result, gVec3fZero);
spline_get_weights(weights, gSplineKeyframeFraction, gSplineState);
for (i = 0; i < 4; i++) {
for (i = 0; i < 4; i++)
{
result[0] += weights[i] * gSplineKeyframe[i][1];
result[1] += weights[i] * gSplineKeyframe[i][2];
result[2] += weights[i] * gSplineKeyframe[i][3];
}
if ((gSplineKeyframeFraction += gSplineKeyframe[0][0] / 1000.0f) >= 1) {
if ((gSplineKeyframeFraction += gSplineKeyframe[0][0] / 1000.0f) >= 1)
{
gSplineKeyframe++;
gSplineKeyframeFraction--;
switch (gSplineState) {
switch (gSplineState)
{
case CURVE_END_2:
hasEnded = TRUE;
break;
case CURVE_MIDDLE:
if (gSplineKeyframe[2][0] == 0) {
if (gSplineKeyframe[2][0] == 0)
{
gSplineState = CURVE_END_1;
}
break;
@@ -2315,7 +2400,6 @@ s32 anim_spline_poll(Vec3f result) {
}
// From object_helpers.c
/**
@@ -2326,9 +2410,11 @@ s32 anim_spline_poll(Vec3f result) {
* | 0 0 0 1 |
* i.e. a matrix representing a linear transformation over 3 space.
*/
void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v)
{
s32 i;
for (i = 0; i < 3; i++) {
for (i = 0; i < 3; i++)
{
dst[i] = m[0][i] * v[0] + m[1][i] * v[1] + m[2][i] * v[2];
}
}
@@ -2341,9 +2427,11 @@ void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
* | 0 0 0 1 |
* i.e. a matrix representing a linear transformation over 3 space.
*/
void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v) {
void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v)
{
s32 i;
for (i = 0; i < 3; i++) {
for (i = 0; i < 3; i++)
{
dst[i] = m[i][0] * v[0] + m[i][1] * v[1] + m[i][2] * v[2];
}
}
+40 -2
View File
@@ -34,49 +34,87 @@ extern f32 gCosineTable[];
#define sqr(x) ((x) * (x))
void *vec3f_copy(Vec3f dest, Vec3f src);
void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z);
void *vec3f_add(Vec3f dest, Vec3f a);
void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b);
void *vec3s_copy(Vec3s dest, Vec3s src);
void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z);
void *vec3s_add(Vec3s dest, Vec3s a);
void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b);
void *vec3s_sub(Vec3s dest, Vec3s a);
void *vec3s_to_vec3f(Vec3f dest, Vec3s a);
void *vec3f_to_vec3s(Vec3s dest, Vec3f a);
void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c);
void *vec3f_cross(Vec3f dest, Vec3f a, Vec3f b);
void *vec3f_normalize(Vec3f dest);
void mtxf_copy(Mat4 dest, Mat4 src);
void mtxf_identity(Mat4 mtx);
void mtxf_translate(Mat4 dest, Vec3f b);
void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll);
void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f translate, Vec3s rotate);
void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f b, Vec3s c);
void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle);
void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw);
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius);
void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b);
void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s);
void mtxf_mul_vec3s(Mat4 mtx, Vec3s b);
void mtxf_mul_vec3f(Mat4 mtx, Vec3f b);
void mtxf_to_mtx(Mtx *dest, Mat4 src);
void mtxf_rotate_xy(Mtx *mtx, s16 angle);
void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx);
void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw);
void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw);
void vec3f_set_dist_and_angle(Vec3f from, Vec3f to, f32 dist, s16 pitch, s16 yaw);
s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec);
f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec);
s16 atan2s(f32 y, f32 x);
// libsm64: `atan2f()` is not used anywhere and collides with `math.h`'s definition of the function, better to remove it entirely.
// f32 atan2f(f32 a, f32 b);
void spline_get_weights(Vec4f result, f32 t, UNUSED s32 c);
void anim_spline_init(Vec4s *keyFrames);
void anim_spline_init(Vec4s * keyFrames);
s32 anim_spline_poll(Vec3f result);
// From object_helpers.c
void linear_mtxf_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v);
void linear_mtxf_transpose_mul_vec3f(Mat4 m, Vec3f dst, Vec3f v);
+279 -218
View File
@@ -8,149 +8,168 @@
/**
* Iterate through the list of ceilings and find the first ceiling over a given point.
*/
static struct SM64SurfaceCollisionData *find_ceil_from_list( f32 x, f32 y, f32 z, f32 *pheight) {
static struct SM64SurfaceCollisionData *find_ceil_from_list(f32 x, f32 y, f32 z, f32 *pheight)
{
register struct SM64SurfaceCollisionData *surf;
register f32 x1, z1, x2, z2, x3, z3;
struct SM64SurfaceCollisionData *ceil = NULL;
struct SM64SurfaceCollisionData *ceil = nullptr;
ceil = NULL;
ceil = nullptr;
uint32_t groupCount = loaded_surface_iter_group_count();
for( int i = 0; i < groupCount; ++i ) {
uint32_t surfCount = loaded_surface_iter_group_size( i );
for( int j = 0; j < surfCount; ++j ) {
surf = loaded_surface_iter_get_at_index( i, j );
// libsm64: Weed out surfaces whose triangles are actually line segs. TODO do this at surface load time
if( !surf->isValid ) continue;
// Do the check normally done in add_surface_to_cell
if( surf->normal.y >= -0.01f ) continue;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
z2 = surf->vertex2[2];
x2 = surf->vertex2[0];
// Checking if point is in bounds of the triangle laterally.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) > 0) {
continue;
}
// Slight optimization by checking these later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) > 0) {
continue;
}
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) > 0) {
continue;
}
for (int i = 0; i < groupCount; ++i)
{
uint32_t surfCount = loaded_surface_iter_group_size(i);
for (int j = 0; j < surfCount; ++j)
{
f32 nx = surf->normal.x;
f32 ny = surf->normal.y;
f32 nz = surf->normal.z;
f32 oo = surf->originOffset;
f32 height;
surf = loaded_surface_iter_get_at_index(i, j);
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
}
// libsm64: Weed out surfaces whose triangles are actually line segs. TODO do this at surface load time
if (!surf->isValid) continue;
// Find the ceil height at the specific point.
height = -(x * nx + nz * z + oo) / ny;
// Do the check normally done in add_surface_to_cell
if (surf->normal.y >= -0.01f) continue;
// Checks for ceiling interaction with a 78 unit buffer.
//! (Exposed Ceilings) Because any point above a ceiling counts
// as interacting with a ceiling, ceilings far below can cause
// "invisible walls" that are really just exposed ceilings.
if (y - (height - -78.0f) > 0.0f) {
continue;
}
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
z2 = surf->vertex2[2];
x2 = surf->vertex2[0];
if( height < *pheight )
// Checking if point is in bounds of the triangle laterally.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) > 0)
{
*pheight = height;
ceil = surf;
continue;
}
// Slight optimization by checking these later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) > 0)
{
continue;
}
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) > 0)
{
continue;
}
{
f32 nx = surf->normal.x;
f32 ny = surf->normal.y;
f32 nz = surf->normal.z;
f32 oo = surf->originOffset;
f32 height;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f)
{
continue;
}
// Find the ceil height at the specific point.
height = -(x * nx + nz * z + oo) / ny;
// Checks for ceiling interaction with a 78 unit buffer.
//! (Exposed Ceilings) Because any point above a ceiling counts
// as interacting with a ceiling, ceilings far below can cause
// "invisible walls" that are really just exposed ceilings.
if (y - (height - -78.0f) > 0.0f)
{
continue;
}
if (height < *pheight)
{
*pheight = height;
ceil = surf;
}
}
}
}}
}
return ceil;
}
/**
* Iterate through the list of floors and find the first floor under a given point.
*/
static struct SM64SurfaceCollisionData *find_floor_from_list( f32 x, f32 y, f32 z, f32 *pheight) {
static struct SM64SurfaceCollisionData *find_floor_from_list(f32 x, f32 y, f32 z, f32 *pheight)
{
register struct SM64SurfaceCollisionData *surf;
register f32 x1, z1, x2, z2, x3, z3;
f32 nx, ny, nz;
f32 oo;
f32 height;
struct SM64SurfaceCollisionData *floor = NULL;
struct SM64SurfaceCollisionData *floor = nullptr;
uint32_t groupCount = loaded_surface_iter_group_count();
for( int i = 0; i < groupCount; ++i ) {
uint32_t surfCount = loaded_surface_iter_group_size( i );
for( int j = 0; j < surfCount; ++j ) {
surf = loaded_surface_iter_get_at_index( i, j );
// libsm64: Weed out surfaces whose triangles are actually line segs. TODO do this at surface load time
if( !surf->isValid ) continue;
// Do the check normally done in add_surface_to_cell
if( surf->normal.y <= 0.01f ) continue;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
x2 = surf->vertex2[0];
z2 = surf->vertex2[2];
// Check that the point is within the triangle bounds.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0) {
continue;
}
// To slightly save on computation time, set this later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0) {
continue;
}
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) < 0) {
continue;
}
nx = surf->normal.x;
ny = surf->normal.y;
nz = surf->normal.z;
oo = surf->originOffset;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f) {
continue;
}
// Find the height of the floor at a given location.
height = -(x * nx + nz * z + oo) / ny;
// Checks for floor interaction with a 78 unit buffer.
if (y - (height + -78.0f) < 0.0f) {
continue;
}
if( height > *pheight )
for (int i = 0; i < groupCount; ++i)
{
uint32_t surfCount = loaded_surface_iter_group_size(i);
for (int j = 0; j < surfCount; ++j)
{
*pheight = height;
floor = surf;
surf = loaded_surface_iter_get_at_index(i, j);
// libsm64: Weed out surfaces whose triangles are actually line segs. TODO do this at surface load time
if (!surf->isValid) continue;
// Do the check normally done in add_surface_to_cell
if (surf->normal.y <= 0.01f) continue;
x1 = surf->vertex1[0];
z1 = surf->vertex1[2];
x2 = surf->vertex2[0];
z2 = surf->vertex2[2];
// Check that the point is within the triangle bounds.
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0)
{
continue;
}
// To slightly save on computation time, set this later.
x3 = surf->vertex3[0];
z3 = surf->vertex3[2];
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0)
{
continue;
}
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) < 0)
{
continue;
}
nx = surf->normal.x;
ny = surf->normal.y;
nz = surf->normal.z;
oo = surf->originOffset;
// If a wall, ignore it. Likely a remnant, should never occur.
if (ny == 0.0f)
{
continue;
}
// Find the height of the floor at a given location.
height = -(x * nx + nz * z + oo) / ny;
// Checks for floor interaction with a 78 unit buffer.
if (y - (height + -78.0f) < 0.0f)
{
continue;
}
if (height > *pheight)
{
*pheight = height;
floor = surf;
}
}
}}
}
return floor;
}
static s32 find_wall_collisions_from_list( struct SM64WallCollisionData *data) {
static s32 find_wall_collisions_from_list(struct SM64WallCollisionData *data)
{
register struct SM64SurfaceCollisionData *surf;
register f32 offset;
register f32 radius = data->radius;
@@ -163,129 +182,170 @@ static s32 find_wall_collisions_from_list( struct SM64WallCollisionData *data) {
s32 numCols = 0;
// Max collision radius = 200
if (radius > 200.0f) {
if (radius > 200.0f)
{
radius = 200.0f;
}
uint32_t groupCount = loaded_surface_iter_group_count();
for( int i = 0; i < groupCount; ++i ) {
uint32_t surfCount = loaded_surface_iter_group_size( i );
for( int j = 0; j < surfCount; ++j ) {
surf = loaded_surface_iter_get_at_index( i, j );
for (int i = 0; i < groupCount; ++i)
{
uint32_t surfCount = loaded_surface_iter_group_size(i);
for (int j = 0; j < surfCount; ++j)
{
surf = loaded_surface_iter_get_at_index(i, j);
// libsm64: Weed out surfaces whose triangles are actually line segs. TODO do this at surface load time
if( !surf->isValid ) continue;
// libsm64: Weed out surfaces whose triangles are actually line segs. TODO do this at surface load time
if (!surf->isValid) continue;
// Do the check normally done in add_surface_to_cell
if( surf->normal.y < -0.01f || surf->normal.y > 0.01f ) continue;
// Do the check normally done in add_surface_to_cell
if (surf->normal.y < -0.01f || surf->normal.y > 0.01f) continue;
if( surf->normal.x < -0.707f || surf->normal.x > 0.707f ) {
surf->flags |= SURFACE_FLAG_X_PROJECTION;
}
if (surf->normal.x < -0.707f || surf->normal.x > 0.707f)
{
surf->flags |= SURFACE_FLAG_X_PROJECTION;
}
// Exclude a large number of walls immediately to optimize.
if (y < surf->lowerY || y > surf->upperY) {
continue;
}
// Exclude a large number of walls immediately to optimize.
if (y < surf->lowerY || y > surf->upperY)
{
continue;
}
offset = surf->normal.x * x + surf->normal.y * y + surf->normal.z * z + surf->originOffset;
offset = surf->normal.x * x + surf->normal.y * y + surf->normal.z * z + surf->originOffset;
if (offset < -radius || offset > radius) {
continue;
}
if (offset < -radius || offset > radius)
{
continue;
}
px = x;
pz = z;
px = x;
pz = z;
//! (Quantum Tunneling) Due to issues with the vertices walls choose and
// the fact they are floating point, certain floating point positions
// along the seam of two walls may collide with neither wall or both walls.
if (surf->flags & SURFACE_FLAG_X_PROJECTION) {
w1 = -surf->vertex1[2]; w2 = -surf->vertex2[2]; w3 = -surf->vertex3[2];
y1 = surf->vertex1[1]; y2 = surf->vertex2[1]; y3 = surf->vertex3[1];
//! (Quantum Tunneling) Due to issues with the vertices walls choose and
// the fact they are floating point, certain floating point positions
// along the seam of two walls may collide with neither wall or both walls.
if (surf->flags & SURFACE_FLAG_X_PROJECTION)
{
w1 = -surf->vertex1[2];
w2 = -surf->vertex2[2];
w3 = -surf->vertex3[2];
y1 = surf->vertex1[1];
y2 = surf->vertex2[1];
y3 = surf->vertex3[1];
if (surf->normal.x > 0.0f) {
if ((y1 - y) * (w2 - w1) - (w1 - -pz) * (y2 - y1) > 0.0f) {
continue;
if (surf->normal.x > 0.0f)
{
if ((y1 - y) * (w2 - w1) - (w1 - -pz) * (y2 - y1) > 0.0f)
{
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - -pz) * (y3 - y2) > 0.0f)
{
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - -pz) * (y1 - y3) > 0.0f)
{
continue;
}
}
if ((y2 - y) * (w3 - w2) - (w2 - -pz) * (y3 - y2) > 0.0f) {
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - -pz) * (y1 - y3) > 0.0f) {
continue;
}
} else {
if ((y1 - y) * (w2 - w1) - (w1 - -pz) * (y2 - y1) < 0.0f) {
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - -pz) * (y3 - y2) < 0.0f) {
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - -pz) * (y1 - y3) < 0.0f) {
continue;
else
{
if ((y1 - y) * (w2 - w1) - (w1 - -pz) * (y2 - y1) < 0.0f)
{
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - -pz) * (y3 - y2) < 0.0f)
{
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - -pz) * (y1 - y3) < 0.0f)
{
continue;
}
}
}
} else {
w1 = surf->vertex1[0]; w2 = surf->vertex2[0]; w3 = surf->vertex3[0];
y1 = surf->vertex1[1]; y2 = surf->vertex2[1]; y3 = surf->vertex3[1];
else
{
w1 = surf->vertex1[0];
w2 = surf->vertex2[0];
w3 = surf->vertex3[0];
y1 = surf->vertex1[1];
y2 = surf->vertex2[1];
y3 = surf->vertex3[1];
if (surf->normal.z > 0.0f) {
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) > 0.0f) {
continue;
if (surf->normal.z > 0.0f)
{
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) > 0.0f)
{
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) > 0.0f)
{
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) > 0.0f)
{
continue;
}
}
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) > 0.0f) {
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) > 0.0f) {
continue;
}
} else {
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) < 0.0f) {
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) < 0.0f) {
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) < 0.0f) {
continue;
else
{
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) < 0.0f)
{
continue;
}
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) < 0.0f)
{
continue;
}
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) < 0.0f)
{
continue;
}
}
}
}
// Ignore camera only surfaces.
if (surf->type == SURFACE_CAMERA_BOUNDARY) {
continue;
}
// Ignore camera only surfaces.
if (surf->type == SURFACE_CAMERA_BOUNDARY)
{
continue;
}
// If an object can pass through a vanish cap wall, pass through.
if (surf->type == SURFACE_VANISH_CAP_WALLS) {
// If an object can pass through a vanish cap wall, pass through.
if (gCurrentObject != NULL
&& (gCurrentObject->activeFlags & ACTIVE_FLAG_MOVE_THROUGH_GRATE)) {
continue;
if (surf->type == SURFACE_VANISH_CAP_WALLS)
{
// If an object can pass through a vanish cap wall, pass through.
if (gCurrentObject != nullptr
&& (gCurrentObject->activeFlags & ACTIVE_FLAG_MOVE_THROUGH_GRATE))
{
continue;
}
// If Mario has a vanish cap, pass through the vanish cap wall.
if (gCurrentObject != nullptr && gCurrentObject == gMarioObject
&& (gMarioState->flags & MARIO_VANISH_CAP))
{
continue;
}
}
// If Mario has a vanish cap, pass through the vanish cap wall.
if (gCurrentObject != NULL && gCurrentObject == gMarioObject
&& (gMarioState->flags & MARIO_VANISH_CAP)) {
continue;
//! (Wall Overlaps) Because this doesn't update the x and z local variables,
// multiple walls can push mario more than is required.
data->x += surf->normal.x * (radius - offset);
data->z += surf->normal.z * (radius - offset);
//! (Unreferenced Walls) Since this only returns the first four walls,
// this can lead to wall interaction being missed. Typically unreferenced walls
// come from only using one wall, however.
if (data->numWalls < 4)
{
data->walls[data->numWalls++] = surf;
}
numCols++;
}
//! (Wall Overlaps) Because this doesn't update the x and z local variables,
// multiple walls can push mario more than is required.
data->x += surf->normal.x * (radius - offset);
data->z += surf->normal.z * (radius - offset);
//! (Unreferenced Walls) Since this only returns the first four walls,
// this can lead to wall interaction being missed. Typically unreferenced walls
// come from only using one wall, however.
if (data->numWalls < 4) {
data->walls[data->numWalls++] = surf;
}
numCols++;
}}
}
return numCols;
}
@@ -335,8 +395,8 @@ s32 find_wall_collisions(struct SM64WallCollisionData *colData)
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct SM64SurfaceCollisionData **pceil)
{
f32 height = CELL_HEIGHT_LIMIT;
*pceil = find_ceil_from_list( posX, posY, posZ, &height );
return height;
*pceil = find_ceil_from_list(posX, posY, posZ, &height);
return height;
}
struct SM64FloorCollisionData sFloorGeo;
@@ -346,9 +406,10 @@ f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct SM64FloorCol
struct SM64SurfaceCollisionData *floor;
f32 floorHeight = find_floor(xPos, yPos, zPos, &floor);
*floorGeo = NULL;
*floorGeo = nullptr;
if (floor != NULL) {
if (floor != nullptr)
{
sFloorGeo.normalX = floor->normal.x;
sFloorGeo.normalY = floor->normal.y;
sFloorGeo.normalZ = floor->normal.z;
@@ -362,23 +423,23 @@ f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct SM64FloorCol
f32 find_floor_height(f32 x, f32 y, f32 z)
{
f32 height = FLOOR_LOWER_LIMIT;
find_floor_from_list( x, y, z, &height );
return height;
find_floor_from_list(x, y, z, &height);
return height;
}
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct SM64SurfaceCollisionData **pfloor)
{
f32 height = FLOOR_LOWER_LIMIT;
*pfloor = find_floor_from_list( xPos, yPos, zPos, &height );
return height;
*pfloor = find_floor_from_list(xPos, yPos, zPos, &height);
return height;
}
f32 find_water_level(f32 x, f32 z)
{
return -10000.0f;
return -10000.0f;
}
f32 find_poison_gas_level(f32 x, f32 z)
{
return -10000.0f;
return -10000.0f;
}
+8 -1
View File
@@ -7,18 +7,25 @@
#include "../include/types.h"
#define LEVEL_BOUNDARY_MAX 0x2000
#define CELL_SIZE 0x400
#define CELL_SIZE 0x400
#define CELL_HEIGHT_LIMIT 100000.f
#define FLOOR_LOWER_LIMIT -110000.f
s32 f32_find_wall_collision(f32 *xPtr, f32 *yPtr, f32 *zPtr, f32 offsetY, f32 radius);
s32 find_wall_collisions(struct SM64WallCollisionData *colData);
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct SM64SurfaceCollisionData **pceil);
f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct SM64FloorCollisionData **floorGeo);
f32 find_floor_height(f32 x, f32 y, f32 z);
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct SM64SurfaceCollisionData **pfloor);
f32 find_water_level(f32 x, f32 z);
f32 find_poison_gas_level(f32 x, f32 z);
#endif // SURFACE_COLLISION_H
+113 -57
View File
@@ -9,17 +9,24 @@
struct WarpNode
{
/*00*/ u8 id;
/*01*/ u8 destLevel;
/*02*/ u8 destArea;
/*03*/ u8 destNode;
/*00*/
u8 id;
/*01*/
u8 destLevel;
/*02*/
u8 destArea;
/*03*/
u8 destNode;
};
struct ObjectWarpNode
{
/*0x00*/ struct WarpNode node;
/*0x04*/ struct Object *object;
/*0x08*/ struct ObjectWarpNode *next;
/*0x00*/
struct WarpNode node;
/*0x04*/
struct Object *object;
/*0x08*/
struct ObjectWarpNode *next;
};
// From Surface 0x1B to 0x1E
@@ -28,74 +35,118 @@ struct ObjectWarpNode
struct InstantWarp
{
/*0x00*/ u8 id; // 0 = 0x1B / 1 = 0x1C / 2 = 0x1D / 3 = 0x1E
/*0x01*/ u8 area;
/*0x02*/ Vec3s displacement;
/*0x00*/
u8 id; // 0 = 0x1B / 1 = 0x1C / 2 = 0x1D / 3 = 0x1E
/*0x01*/
u8 area;
/*0x02*/
Vec3s displacement;
};
struct SpawnInfo
{
/*0x00*/ Vec3f startPos;
/*0x06*/ Vec3s startAngle;
/*0x0C*/ s8 areaIndex;
/*0x0D*/ s8 activeAreaIndex;
/*0x10*/ u32 behaviorArg;
/*0x14*/ void *behaviorScript;
/*0x18*/ struct GraphNode *unk18;
/*0x1C*/ struct SpawnInfo *next;
/*0x00*/
Vec3f startPos;
/*0x06*/
Vec3s startAngle;
/*0x0C*/
s8 areaIndex;
/*0x0D*/
s8 activeAreaIndex;
/*0x10*/
u32 behaviorArg;
/*0x14*/
void *behaviorScript;
/*0x18*/
struct GraphNode *unk18;
/*0x1C*/
struct SpawnInfo *next;
};
struct UnusedArea28
{
/*0x00*/ s16 unk00;
/*0x02*/ s16 unk02;
/*0x04*/ s16 unk04;
/*0x06*/ s16 unk06;
/*0x08*/ s16 unk08;
/*0x00*/
s16 unk00;
/*0x02*/
s16 unk02;
/*0x04*/
s16 unk04;
/*0x06*/
s16 unk06;
/*0x08*/
s16 unk08;
};
struct Whirlpool
{
/*0x00*/ Vec3s pos;
/*0x03*/ s16 strength;
/*0x00*/
Vec3s pos;
/*0x03*/
s16 strength;
};
struct Area
{
/*0x00*/ s8 index;
/*0x01*/ s8 flags; // Only has 1 flag: 0x01 = Is this the active area?
// /*0x02*/ u16 terrainType; // default terrain of the level (set from level script cmd 0x31) ; in libsm64 terrain is defined in the Surface struct
/*0x04*/ struct GraphNodeRoot *unk04; // geometry layout data
/*0x08*/ s16 *terrainData; // collision data (set from level script cmd 0x2E)
/*0x0C*/ s8 *surfaceRooms; // (set from level script cmd 0x2F)
/*0x10*/ s16 *macroObjects; // Macro Objects Ptr (set from level script cmd 0x39)
/*0x14*/ struct ObjectWarpNode *warpNodes;
/*0x18*/ struct WarpNode *paintingWarpNodes;
/*0x1C*/ struct InstantWarp *instantWarps;
/*0x20*/ struct SpawnInfo *objectSpawnInfos;
/*0x24*/ struct Camera *camera;
/*0x28*/ struct UnusedArea28 *unused28; // Filled by level script 0x3A, but is unused.
/*0x2C*/ struct Whirlpool *whirlpools[2];
/*0x34*/ u8 dialog[2]; // Level start dialog number (set by level script cmd 0x30)
/*0x36*/ u16 musicParam;
/*0x38*/ u16 musicParam2;
/*0x00*/
s8 index;
/*0x01*/
s8 flags; // Only has 1 flag: 0x01 = Is this the active area?
// /*0x02*/ u16 terrainType; // default terrain of the level (set from level script cmd 0x31) ; in libsm64 terrain is defined in the Surface struct
/*0x04*/
struct GraphNodeRoot *unk04; // geometry layout data
/*0x08*/
s16 *terrainData; // collision data (set from level script cmd 0x2E)
/*0x0C*/
s8 *surfaceRooms; // (set from level script cmd 0x2F)
/*0x10*/
s16 *macroObjects; // Macro Objects Ptr (set from level script cmd 0x39)
/*0x14*/
struct ObjectWarpNode *warpNodes;
/*0x18*/
struct WarpNode *paintingWarpNodes;
/*0x1C*/
struct InstantWarp *instantWarps;
/*0x20*/
struct SpawnInfo *objectSpawnInfos;
/*0x24*/
struct Camera *camera;
/*0x28*/
struct UnusedArea28 *unused28; // Filled by level script 0x3A, but is unused.
/*0x2C*/
struct Whirlpool *whirlpools[2];
/*0x34*/
u8 dialog[2]; // Level start dialog number (set by level script cmd 0x30)
/*0x36*/
u16 musicParam;
/*0x38*/
u16 musicParam2;
};
// All the transition data to be used in screen_transition.c
struct WarpTransitionData
{
/*0x00*/ u8 red;
/*0x01*/ u8 green;
/*0x02*/ u8 blue;
/*0x00*/
u8 red;
/*0x01*/
u8 green;
/*0x02*/
u8 blue;
/*0x04*/ s16 startTexRadius;
/*0x06*/ s16 endTexRadius;
/*0x08*/ s16 startTexX;
/*0x0A*/ s16 startTexY;
/*0x0C*/ s16 endTexX;
/*0x0E*/ s16 endTexY;
/*0x04*/
s16 startTexRadius;
/*0x06*/
s16 endTexRadius;
/*0x08*/
s16 startTexX;
/*0x0A*/
s16 startTexY;
/*0x0C*/
s16 endTexX;
/*0x0E*/
s16 endTexY;
/*0x10*/ s16 texTimer; // always 0, does seems to affect transition when disabled
/*0x10*/
s16 texTimer; // always 0, does seems to affect transition when disabled
};
#define WARP_TRANSITION_FADE_FROM_COLOR 0x00
@@ -111,11 +162,16 @@ struct WarpTransitionData
struct WarpTransition
{
/*0x00*/ u8 isActive; // Is the transition active. (either TRUE or FALSE)
/*0x01*/ u8 type; // Determines the type of transition to use (circle, star, etc.)
/*0x02*/ u8 time; // Amount of time to complete the transition (in frames)
/*0x03*/ u8 pauseRendering; // Should the game stop rendering. (either TRUE or FALSE)
/*0x04*/ struct WarpTransitionData data;
/*0x00*/
u8 isActive; // Is the transition active. (either TRUE or FALSE)
/*0x01*/
u8 type; // Determines the type of transition to use (circle, star, etc.)
/*0x02*/
u8 time; // Amount of time to complete the transition (in frames)
/*0x03*/
u8 pauseRendering; // Should the game stop rendering. (either TRUE or FALSE)
/*0x04*/
struct WarpTransitionData data;
};
// extern struct GraphNode **gLoadedGraphNodes;
+8 -5
View File
@@ -4,17 +4,20 @@
#include "../shim.h"
// not sure what this is doing here. not in a behavior file.
Gfx *geo_move_mario_part_from_parent(s32 run, UNUSED struct GraphNode *node, Mat4 mtx) {
Gfx *geo_move_mario_part_from_parent(s32 run, UNUSED struct GraphNode *node, Mat4 mtx)
{
Mat4 sp20;
struct Object *sp1C;
if (run == TRUE) {
sp1C = (struct Object *) gCurGraphNodeObject;
if (sp1C == gMarioObject && sp1C->prevObj != NULL) {
if (run == TRUE)
{
sp1C = (struct Object *)gCurGraphNodeObject;
if (sp1C == gMarioObject && sp1C->prevObj != nullptr)
{
create_transformation_from_matrices(sp20, mtx, *gCurGraphNodeCamera->matrixPtr);
obj_update_pos_from_parent_transformation(sp20, sp1C->prevObj);
obj_set_gfx_pos_from_pos(sp1C->prevObj);
}
}
return NULL;
return nullptr;
}
+193 -97
View File
@@ -32,7 +32,7 @@
* Because a mask is used by two levels, the pattern will repeat when more than 4 areas are used by a level.
*/
#define ZOOMOUT_AREA_MASK(level1Area1, level1Area2, level1Area3, level1Area4, \
level2Area1, level2Area2, level2Area3, level2Area4) \
level2Area1, level2Area2, level2Area3, level2Area4) \
((level2Area4) << 7 | \
(level2Area3) << 6 | \
(level2Area2) << 5 | \
@@ -300,17 +300,24 @@ struct PlayerCameraState
/**
* Mario's action on this frame.
*/
/*0x00*/ u32 action;
/*0x04*/ Vec3f pos;
/*0x10*/ Vec3s faceAngle;
/*0x16*/ Vec3s headRotation;
/*0x1C*/ s16 unused;
/*0x00*/
u32 action;
/*0x04*/
Vec3f pos;
/*0x10*/
Vec3s faceAngle;
/*0x16*/
Vec3s headRotation;
/*0x1C*/
s16 unused;
/**
* Set to nonzero when an event, such as entering a door, starting the credits, or throwing bowser,
* has happened on this frame.
*/
/*0x1E*/ s16 cameraEvent;
/*0x20*/ struct Object *usedObj;
/*0x1E*/
s16 cameraEvent;
/*0x20*/
struct Object *usedObj;
};
/**
@@ -319,15 +326,24 @@ struct PlayerCameraState
*/
struct TransitionInfo
{
/*0x00*/ s16 posPitch;
/*0x02*/ s16 posYaw;
/*0x04*/ f32 posDist;
/*0x08*/ s16 focPitch;
/*0x0A*/ s16 focYaw;
/*0x0C*/ f32 focDist;
/*0x10*/ s32 framesLeft;
/*0x14*/ Vec3f marioPos;
/*0x20*/ u8 pad; // for the structs to align, there has to be an extra unused variable here. type is unknown.
/*0x00*/
s16 posPitch;
/*0x02*/
s16 posYaw;
/*0x04*/
f32 posDist;
/*0x08*/
s16 focPitch;
/*0x0A*/
s16 focYaw;
/*0x0C*/
f32 focDist;
/*0x10*/
s32 framesLeft;
/*0x14*/
Vec3f marioPos;
/*0x20*/
u8 pad; // for the structs to align, there has to be an extra unused variable here. type is unknown.
};
/**
@@ -336,9 +352,12 @@ struct TransitionInfo
*/
struct HandheldShakePoint
{
/*0x00*/ s8 index; // only set to -1
/*0x04 (aligned)*/ u32 pad;
/*0x08*/ Vec3s point;
/*0x00*/
s8 index; // only set to -1
/*0x04 (aligned)*/
u32 pad;
/*0x08*/
Vec3s point;
}; // size = 0x10
struct Camera;
@@ -347,7 +366,8 @@ struct Camera;
* A function that is called by CameraTriggers and cutscene shots.
* These are concurrent: multiple CameraEvents can occur on the same frame.
*/
typedef BAD_RETURN(s32) (*CameraEvent)(struct Camera *c);
typedef BAD_RETURN (s32)(*CameraEvent)(struct Camera *c);
/**
* The same type as a CameraEvent, but because these are generally longer, and happen in sequential
* order, they're are called "shots," a term taken from cinematography.
@@ -403,24 +423,32 @@ struct Cutscene
struct CameraFOVStatus
{
/// The current function being used to set the camera's field of view (before any fov shake is applied).
/*0x00*/ u8 fovFunc;
/*0x00*/
u8 fovFunc;
/// The current field of view in degrees
/*0x04*/ f32 fov;
/*0x04*/
f32 fov;
// Fields used by shake_camera_fov()
/// The amount to change the current fov by in the fov shake effect.
/*0x08*/ f32 fovOffset;
/*0x08*/
f32 fovOffset;
/// A bool set in fov_default() but unused otherwise
/*0x0C*/ u32 unusedIsSleeping;
/*0x0C*/
u32 unusedIsSleeping;
/// The range in degrees to shake fov
/*0x10*/ f32 shakeAmplitude;
/*0x10*/
f32 shakeAmplitude;
/// Used to calculate fovOffset, the phase through the shake's period.
/*0x14*/ s16 shakePhase;
/*0x14*/
s16 shakePhase;
/// How much to progress through the shake period
/*0x16*/ s16 shakeSpeed;
/*0x16*/
s16 shakeSpeed;
/// How much to decrease shakeAmplitude each frame.
/*0x18*/ s16 decay;
/*0x18*/
s16 decay;
};
/**
@@ -443,20 +471,33 @@ struct CutsceneSplinePoint
*/
struct PlayerGeometry
{
/*0x00*/ struct SM64SurfaceCollisionData *currFloor;
/*0x04*/ f32 currFloorHeight;
/*0x08*/ s16 currFloorType;
/*0x0C*/ struct SM64SurfaceCollisionData *currCeil;
/*0x10*/ s16 currCeilType;
/*0x14*/ f32 currCeilHeight;
/*0x18*/ struct SM64SurfaceCollisionData *prevFloor;
/*0x1C*/ f32 prevFloorHeight;
/*0x20*/ s16 prevFloorType;
/*0x24*/ struct SM64SurfaceCollisionData *prevCeil;
/*0x28*/ f32 prevCeilHeight;
/*0x2C*/ s16 prevCeilType;
/*0x00*/
struct SM64SurfaceCollisionData *currFloor;
/*0x04*/
f32 currFloorHeight;
/*0x08*/
s16 currFloorType;
/*0x0C*/
struct SM64SurfaceCollisionData *currCeil;
/*0x10*/
s16 currCeilType;
/*0x14*/
f32 currCeilHeight;
/*0x18*/
struct SM64SurfaceCollisionData *prevFloor;
/*0x1C*/
f32 prevFloorHeight;
/*0x20*/
s16 prevFloorType;
/*0x24*/
struct SM64SurfaceCollisionData *prevCeil;
/*0x28*/
f32 prevCeilHeight;
/*0x2C*/
s16 prevCeilType;
/// Unused, but recalculated every frame
/*0x30*/ f32 waterHeight;
/*0x30*/
f32 waterHeight;
};
/**
@@ -504,10 +545,14 @@ struct ParallelTrackingPoint
*/
struct CameraStoredInfo
{
/*0x00*/ Vec3f pos;
/*0x0C*/ Vec3f focus;
/*0x18*/ f32 panDist;
/*0x1C*/ f32 cannonYOffset;
/*0x00*/
Vec3f pos;
/*0x0C*/
Vec3f focus;
/*0x18*/
f32 panDist;
/*0x1C*/
f32 cannonYOffset;
};
/**
@@ -533,8 +578,10 @@ struct CutsceneVariable
*/
struct Camera
{
/*0x00*/ u8 mode; // What type of mode the camera uses (see defines above)
/*0x01*/ u8 defMode;
/*0x00*/
u8 mode; // What type of mode the camera uses (see defines above)
/*0x01*/
u8 defMode;
/**
* Determines what direction Mario moves in when the analog stick is moved.
*
@@ -543,24 +590,36 @@ struct Camera
* be. It's effectively the opposite of the camera's actual yaw. Use
* vec3f_get_dist_and_angle() if you need the camera's yaw.
*/
/*0x02*/ s16 yaw;
/*0x04*/ Vec3f focus;
/*0x10*/ Vec3f pos;
/*0x1C*/ Vec3f unusedVec1;
/*0x02*/
s16 yaw;
/*0x04*/
Vec3f focus;
/*0x10*/
Vec3f pos;
/*0x1C*/
Vec3f unusedVec1;
/// The x coordinate of the "center" of the area. The camera will rotate around this point.
/// For example, this is what makes the camera rotate around the hill in BoB
/*0x28*/ f32 areaCenX;
/*0x28*/
f32 areaCenX;
/// The z coordinate of the "center" of the area. The camera will rotate around this point.
/// For example, this is what makes the camera rotate around the hill in BoB
/*0x2C*/ f32 areaCenZ;
/*0x30*/ u8 cutscene;
/*0x31*/ u8 filler31[0x8];
/*0x3A*/ s16 nextYaw;
/*0x3C*/ u8 filler3C[0x28];
/*0x64*/ u8 doorStatus;
/*0x2C*/
f32 areaCenZ;
/*0x30*/
u8 cutscene;
/*0x31*/
u8 filler31[0x8];
/*0x3A*/
s16 nextYaw;
/*0x3C*/
u8 filler3C[0x28];
/*0x64*/
u8 doorStatus;
/// The y coordinate of the "center" of the area. Unlike areaCenX and areaCenZ, this is only used
/// when paused. See zoom_out_if_paused_and_outside
/*0x68*/ f32 areaCenY;
/*0x68*/
f32 areaCenY;
};
/**
@@ -576,85 +635,122 @@ struct LakituState
/**
* Lakitu's position, which (when CAM_FLAG_SMOOTH_MOVEMENT is set), approaches his goalPos every frame.
*/
/*0x00*/ Vec3f curFocus;
/*0x00*/
Vec3f curFocus;
/**
* Lakitu's focus, which (when CAM_FLAG_SMOOTH_MOVEMENT is set), approaches his goalFocus every frame.
*/
/*0x0C*/ Vec3f curPos;
/*0x0C*/
Vec3f curPos;
/**
* The focus point that lakitu turns towards every frame.
* If CAM_FLAG_SMOOTH_MOVEMENT is unset, this is the same as curFocus.
*/
/*0x18*/ Vec3f goalFocus;
/*0x18*/
Vec3f goalFocus;
/**
* The point that lakitu flies towards every frame.
* If CAM_FLAG_SMOOTH_MOVEMENT is unset, this is the same as curPos.
*/
/*0x24*/ Vec3f goalPos;
/*0x24*/
Vec3f goalPos;
/*0x30*/ u8 filler30[12]; // extra unused Vec3f?
/*0x30*/
u8 filler30[12]; // extra unused Vec3f?
/// Copy of the active camera mode
/*0x3C*/ u8 mode;
/*0x3C*/
u8 mode;
/// Copy of the default camera mode
/*0x3D*/ u8 defMode;
/*0x3D*/
u8 defMode;
/*0x3E*/ u8 filler3E[10];
/*0x3E*/
u8 filler3E[10];
/*0x48*/ f32 focusDistance; // unused
/*0x4C*/ s16 oldPitch; // unused
/*0x4E*/ s16 oldYaw; // unused
/*0x50*/ s16 oldRoll; // unused
/*0x48*/
f32 focusDistance; // unused
/*0x4C*/
s16 oldPitch; // unused
/*0x4E*/
s16 oldYaw; // unused
/*0x50*/
s16 oldRoll; // unused
/// The angular offsets added to lakitu's pitch, yaw, and roll
/*0x52*/ Vec3s shakeMagnitude;
/*0x52*/
Vec3s shakeMagnitude;
// shake pitch, yaw, and roll phase: The progression through the camera shake (a cosine wave).
// shake pitch, yaw, and roll vel: The speed of the camera shake.
// shake pitch, yaw, and roll decay: The shake's deceleration.
/*0x58*/ s16 shakePitchPhase;
/*0x5A*/ s16 shakePitchVel;
/*0x5C*/ s16 shakePitchDecay;
/*0x58*/
s16 shakePitchPhase;
/*0x5A*/
s16 shakePitchVel;
/*0x5C*/
s16 shakePitchDecay;
/*0x60*/ Vec3f unusedVec1;
/*0x6C*/ Vec3s unusedVec2;
/*0x72*/ u8 filler72[8];
/*0x60*/
Vec3f unusedVec1;
/*0x6C*/
Vec3s unusedVec2;
/*0x72*/
u8 filler72[8];
/// Used to rotate the screen when rendering.
/*0x7A*/ s16 roll;
/*0x7A*/
s16 roll;
/// Copy of the camera's yaw.
/*0x7C*/ s16 yaw;
/*0x7C*/
s16 yaw;
/// Copy of the camera's next yaw.
/*0x7E*/ s16 nextYaw;
/*0x7E*/
s16 nextYaw;
/// The actual focus point the game uses to render.
/*0x80*/ Vec3f focus;
/*0x80*/
Vec3f focus;
/// The actual position the game is rendered from.
/*0x8C*/ Vec3f pos;
/*0x8C*/
Vec3f pos;
// Shake variables: See above description
/*0x98*/ s16 shakeRollPhase;
/*0x9A*/ s16 shakeRollVel;
/*0x9C*/ s16 shakeRollDecay;
/*0x9E*/ s16 shakeYawPhase;
/*0xA0*/ s16 shakeYawVel;
/*0xA2*/ s16 shakeYawDecay;
/*0x98*/
s16 shakeRollPhase;
/*0x9A*/
s16 shakeRollVel;
/*0x9C*/
s16 shakeRollDecay;
/*0x9E*/
s16 shakeYawPhase;
/*0xA0*/
s16 shakeYawVel;
/*0xA2*/
s16 shakeYawDecay;
// focH,Vspeed: how fast lakitu turns towards his goalFocus.
/// By default HSpeed is 0.8, so lakitu turns 80% of the horz distance to his goal each frame.
/*0xA4*/ f32 focHSpeed;
/*0xA4*/
f32 focHSpeed;
/// By default VSpeed is 0.3, so lakitu turns 30% of the vert distance to his goal each frame.
/*0xA8*/ f32 focVSpeed;
/*0xA8*/
f32 focVSpeed;
// posH,Vspeed: How fast lakitu flies towards his goalPos.
/// By default they are 0.3, so lakitu will fly 30% of the way towards his goal each frame.
/*0xAC*/ f32 posHSpeed;
/*0xB0*/ f32 posVSpeed;
/*0xAC*/
f32 posHSpeed;
/*0xB0*/
f32 posVSpeed;
/// The roll offset applied during part of the key dance cutscene
/*0xB4*/ s16 keyDanceRoll;
/*0xB4*/
s16 keyDanceRoll;
/// Mario's action from the previous frame. Only used to determine if Mario just finished a dive.
/*0xB8*/ u32 lastFrameAction;
/*0xBC*/ s16 unused;
/*0xB8*/
u32 lastFrameAction;
/*0xBC*/
s16 unused;
};
File diff suppressed because it is too large Load Diff
+14
View File
@@ -99,19 +99,33 @@
s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o);
void mario_stop_riding_object(struct MarioState *m);
void mario_grab_used_object(struct MarioState *m);
void mario_drop_held_object(struct MarioState *m);
void mario_throw_held_object(struct MarioState *m);
void mario_stop_riding_and_holding(struct MarioState *m);
u32 does_mario_have_normal_cap_on_head(struct MarioState *m);
void mario_blow_off_cap(struct MarioState *m, f32 capSpeed);
u32 mario_lose_cap_to_enemy(u32 arg);
void mario_retrieve_cap(void);
struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType);
u32 mario_check_object_grab(struct MarioState *m);
u32 get_door_save_file_flag(struct Object *door);
void mario_process_interactions(struct MarioState *m);
void mario_handle_special_floors(struct MarioState *m);
#endif // INTERACTION_H
+21 -12
View File
@@ -88,21 +88,30 @@
// extern s32 sDelayedWarpArg;
// extern u8 unused4[2];
// extern s8 sTimerRunning;
struct HudDisplay {
/*0x00*/ s16 lives;
/*0x02*/ s16 coins;
/*0x04*/ s16 stars;
/*0x06*/ s16 wedges;
/*0x08*/ s16 keys;
/*0x0A*/ s16 flags;
/*0x0C*/ u16 timer;
struct HudDisplay
{
/*0x00*/
s16 lives;
/*0x02*/
s16 coins;
/*0x04*/
s16 stars;
/*0x06*/
s16 wedges;
/*0x08*/
s16 keys;
/*0x0A*/
s16 flags;
/*0x0C*/
u16 timer;
};
// extern struct HudDisplay gHudDisplay;
// extern s8 gNeverEnteredCastle;
enum HUDDisplayFlag {
enum HUDDisplayFlag
{
HUD_DISPLAY_FLAG_LIVES = 0x0001,
HUD_DISPLAY_FLAG_COIN_COUNT = 0x0002,
HUD_DISPLAY_FLAG_STAR_COUNT = 0x0004,
@@ -111,10 +120,10 @@ enum HUDDisplayFlag {
HUD_DISPLAY_FLAG_UNKNOWN_0020 = 0x0020,
HUD_DISPLAY_FLAG_TIMER = 0x0040,
HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000,
HUD_DISPLAY_NONE = 0x0000,
HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020
};
//
//
// u16 level_control_timer(s32 timerOp);
+658 -336
View File
File diff suppressed because it is too large Load Diff
+44 -1
View File
@@ -7,48 +7,91 @@
#include "../include/types.h"
s32 is_anim_at_end(struct MarioState *m);
s32 is_anim_past_end(struct MarioState *m);
s16 set_mario_animation(struct MarioState *m, s32 targetAnimID);
s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel);
void set_anim_to_frame(struct MarioState *m, s16 animFrame);
s32 is_anim_past_frame(struct MarioState *m, s16 animFrame);
s16 find_mario_anim_flags_and_translation(struct Object *o, s32 yaw, Vec3s translation);
void update_mario_pos_for_anim(struct MarioState *m);
s16 return_mario_anim_y_translation(struct MarioState *m);
void play_sound_if_no_flag(struct MarioState *m, u32 soundBits, u32 flags);
void play_mario_jump_sound(struct MarioState *m);
void adjust_sound_for_speed(struct MarioState *m);
void play_sound_and_spawn_particles(struct MarioState *m, u32 soundBits, u32 waveParticleType);
void play_mario_action_sound(struct MarioState *m, u32 soundBits, u32 waveParticleType);
void play_mario_landing_sound(struct MarioState *m, u32 soundBits);
void play_mario_landing_sound_once(struct MarioState *m, u32 soundBits);
void play_mario_heavy_landing_sound(struct MarioState *m, u32 soundBits);
void play_mario_heavy_landing_sound_once(struct MarioState *m, u32 soundBits);
void play_mario_sound(struct MarioState *m, s32 primarySoundBits, s32 scondarySoundBits);
void mario_set_forward_vel(struct MarioState *m, f32 speed);
s32 mario_get_floor_class(struct MarioState *m);
u32 mario_get_terrain_sound_addend(struct MarioState *m);
struct SM64SurfaceCollisionData *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 radius);
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct SM64SurfaceCollisionData **ceil);
s32 mario_facing_downhill(struct MarioState *m, s32 turnYaw);
u32 mario_floor_is_slippery(struct MarioState *m);
s32 mario_floor_is_slope(struct MarioState *m);
s32 mario_floor_is_steep(struct MarioState *m);
f32 find_floor_height_relative_polar(struct MarioState *m, s16 angleFromMario, f32 distFromMario);
s16 find_floor_slope(struct MarioState *m, s16 yawOffset);
void update_mario_sound_and_camera(struct MarioState *m);
void set_steep_jump_action(struct MarioState *m);
u32 set_mario_action(struct MarioState *, u32 action, u32 actionArg);
s32 set_jump_from_landing(struct MarioState *m);
s32 set_jumping_action(struct MarioState *m, u32 action, u32 actionArg);
s32 drop_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg);
s32 hurt_and_set_mario_action(struct MarioState *m, u32 action, u32 actionArg, s16 hurtCounter);
s32 check_common_action_exits(struct MarioState *m);
s32 check_common_hold_action_exits(struct MarioState *m);
s32 transition_submerged_to_walking(struct MarioState *m);
s32 set_water_plunge_action(struct MarioState *m);
s32 execute_mario_action(UNUSED struct Object *o);
s32 execute_mario_action(UNUSEDstruct Object * o);
int init_mario(void);
void init_mario_from_save_file(void);
#endif // MARIO_H
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+6
View File
@@ -7,11 +7,17 @@
#include "../include/types.h"
void print_displaying_credits_entry(void);
void bhv_end_peach_loop(void);
void bhv_end_toad_loop(void);
s32 geo_switch_peach_eyes(s32 run, struct GraphNode *node, UNUSED s32 a2);
s32 mario_ready_to_speak(void);
s32 set_mario_npc_dialog(s32 actionArg);
s32 mario_execute_cutscene_action(struct MarioState *m);
#endif // MARIO_ACTIONS_CUTSCENE_H
File diff suppressed because it is too large Load Diff
+1
View File
@@ -6,6 +6,7 @@
#include "../include/types.h"
void play_step_sound(struct MarioState *m, s16 frame1, s16 frame2);
s32 mario_execute_moving_action(struct MarioState *m);
#endif // MARIO_ACTIONS_MOVING
+222 -116
View File
@@ -21,47 +21,60 @@
* Used by act_punching() to determine Mario's forward velocity during each
* animation frame.
*/
s8 sPunchingForwardVelocities[8] = { 0, 1, 1, 2, 3, 5, 7, 10 };
s8 sPunchingForwardVelocities[8] = {0, 1, 1, 2, 3, 5, 7, 10};
void animated_stationary_ground_step(struct MarioState *m, s32 animation, u32 endAction) {
void animated_stationary_ground_step(struct MarioState *m, s32 animation, u32 endAction)
{
stationary_ground_step(m);
set_mario_animation(m, animation);
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, endAction, 0);
}
}
s32 mario_update_punch_sequence(struct MarioState *m) {
s32 mario_update_punch_sequence(struct MarioState *m)
{
u32 endAction, crouchEndAction;
s32 animFrame;
if (m->action & ACT_FLAG_MOVING) {
if (m->action & ACT_FLAG_MOVING)
{
endAction = ACT_WALKING, crouchEndAction = ACT_CROUCH_SLIDE;
} else {
}
else
{
endAction = ACT_IDLE, crouchEndAction = ACT_CROUCHING;
}
switch (m->actionArg) {
switch (m->actionArg)
{
case 0:
play_sound(SOUND_MARIO_PUNCH_YAH, m->marioObj->header.gfx.cameraToObject);
// Fall-through:
// Fall-through:
case 1:
set_mario_animation(m, MARIO_ANIM_FIRST_PUNCH);
if (is_anim_past_end(m)) {
if (is_anim_past_end(m))
{
m->actionArg = 2;
} else {
}
else
{
m->actionArg = 1;
}
if (m->marioObj->header.gfx.animInfo.animFrame >= 2) {
if (mario_check_object_grab(m)) {
if (m->marioObj->header.gfx.animInfo.animFrame >= 2)
{
if (mario_check_object_grab(m))
{
return TRUE;
}
m->flags |= MARIO_PUNCHING;
}
if (m->actionArg == 2) {
if (m->actionArg == 2)
{
m->marioBodyState->punchState = (0 << 6) | 4;
}
break;
@@ -69,50 +82,61 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
case 2:
set_mario_animation(m, MARIO_ANIM_FIRST_PUNCH_FAST);
if (m->marioObj->header.gfx.animInfo.animFrame <= 0) {
if (m->marioObj->header.gfx.animInfo.animFrame <= 0)
{
m->flags |= MARIO_PUNCHING;
}
if (m->input & INPUT_B_PRESSED) {
if (m->input & INPUT_B_PRESSED)
{
m->actionArg = 3;
}
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, endAction, 0);
}
break;
case 3:
play_sound(SOUND_MARIO_PUNCH_WAH, m->marioObj->header.gfx.cameraToObject);
// Fall-through:
// Fall-through:
case 4:
set_mario_animation(m, MARIO_ANIM_SECOND_PUNCH);
if (is_anim_past_end(m)) {
if (is_anim_past_end(m))
{
m->actionArg = 5;
} else {
}
else
{
m->actionArg = 4;
}
if (m->marioObj->header.gfx.animInfo.animFrame > 0) {
if (m->marioObj->header.gfx.animInfo.animFrame > 0)
{
m->flags |= MARIO_PUNCHING;
}
if (m->actionArg == 5) {
if (m->actionArg == 5)
{
m->marioBodyState->punchState = (1 << 6) | 4;
}
break;
case 5:
set_mario_animation(m, MARIO_ANIM_SECOND_PUNCH_FAST);
if (m->marioObj->header.gfx.animInfo.animFrame <= 0) {
if (m->marioObj->header.gfx.animInfo.animFrame <= 0)
{
m->flags |= MARIO_PUNCHING;
}
if (m->input & INPUT_B_PRESSED) {
if (m->input & INPUT_B_PRESSED)
{
m->actionArg = 6;
}
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, endAction, 0);
}
break;
@@ -120,15 +144,18 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
case 6:
play_mario_action_sound(m, SOUND_MARIO_PUNCH_HOO, 1);
animFrame = set_mario_animation(m, MARIO_ANIM_GROUND_KICK);
if (animFrame == 0) {
if (animFrame == 0)
{
m->marioBodyState->punchState = (2 << 6) | 6;
}
if (animFrame >= 0 && animFrame < 8) {
if (animFrame >= 0 && animFrame < 8)
{
m->flags |= MARIO_KICKING;
}
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, endAction, 0);
}
break;
@@ -138,11 +165,13 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
set_mario_animation(m, MARIO_ANIM_BREAKDANCE);
animFrame = m->marioObj->header.gfx.animInfo.animFrame;
if (animFrame >= 2 && animFrame < 8) {
if (animFrame >= 2 && animFrame < 8)
{
m->flags |= MARIO_TRIPPING;
}
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, crouchEndAction, 0);
}
break;
@@ -151,26 +180,32 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
return FALSE;
}
s32 act_punching(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_punching(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE)) {
if (m->input & (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE))
{
return check_common_action_exits(m);
}
if (m->actionState == 0 && (m->input & INPUT_A_DOWN)) {
if (m->actionState == 0 && (m->input & INPUT_A_DOWN))
{
return set_mario_action(m, ACT_JUMP_KICK, 0);
}
m->actionState = 1;
if (m->actionArg == 0) {
if (m->actionArg == 0)
{
m->actionTimer = 7;
}
mario_set_forward_vel(m, sPunchingForwardVelocities[m->actionTimer]);
if (m->actionTimer > 0) {
if (m->actionTimer > 0)
{
m->actionTimer--;
}
@@ -179,16 +214,20 @@ s32 act_punching(struct MarioState *m) {
return FALSE;
}
s32 act_picking_up(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_picking_up(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return drop_and_set_mario_action(m, ACT_FREEFALL, 0);
}
if (m->actionState == 0 && is_anim_at_end(m)) {
if (m->actionState == 0 && is_anim_at_end(m))
{
//! While the animation is playing, it is possible for the used object
// to unload. This allows you to pick up a vacant or newly loaded object
// slot (cloning via fake object).
@@ -197,17 +236,23 @@ s32 act_picking_up(struct MarioState *m) {
m->actionState = 1;
}
if (m->actionState == 1) {
if (m->heldObj->oInteractionSubtype & INT_SUBTYPE_GRABS_MARIO) {
if (m->actionState == 1)
{
if (m->heldObj->oInteractionSubtype & INT_SUBTYPE_GRABS_MARIO)
{
m->marioBodyState->grabPos = GRAB_POS_HEAVY_OBJ;
set_mario_animation(m, MARIO_ANIM_GRAB_HEAVY_OBJECT);
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, ACT_HOLD_HEAVY_IDLE, 0);
}
} else {
}
else
{
m->marioBodyState->grabPos = GRAB_POS_LIGHT_OBJ;
set_mario_animation(m, MARIO_ANIM_PICK_UP_LIGHT_OBJ);
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, ACT_HOLD_IDLE, 0);
}
}
@@ -217,19 +262,23 @@ s32 act_picking_up(struct MarioState *m) {
return FALSE;
}
s32 act_dive_picking_up(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_dive_picking_up(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
//! Hands-free holding. Landing on a slope or being pushed off a ledge while
// landing from a dive grab sets Mario's action to a non-holding action
// without dropping the object, causing the hands-free holding glitch.
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return set_mario_action(m, ACT_FREEFALL, 0);
}
if (m->input & INPUT_ABOVE_SLIDE) {
if (m->input & INPUT_ABOVE_SLIDE)
{
return set_mario_action(m, ACT_BEGIN_SLIDING, 0);
}
@@ -237,16 +286,20 @@ s32 act_dive_picking_up(struct MarioState *m) {
return FALSE;
}
s32 act_placing_down(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_placing_down(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return drop_and_set_mario_action(m, ACT_FREEFALL, 0);
}
if (++m->actionTimer == 8) {
if (++m->actionTimer == 8)
{
mario_drop_held_object(m);
}
@@ -254,64 +307,77 @@ s32 act_placing_down(struct MarioState *m) {
return FALSE;
}
s32 act_throwing(struct MarioState *m) {
if (m->heldObj && (m->heldObj->oInteractionSubtype & INT_SUBTYPE_HOLDABLE_NPC)) {
s32 act_throwing(struct MarioState *m)
{
if (m->heldObj && (m->heldObj->oInteractionSubtype & INT_SUBTYPE_HOLDABLE_NPC))
{
return set_mario_action(m, ACT_PLACING_DOWN, 0);
}
if (m->input & INPUT_UNKNOWN_10) {
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return drop_and_set_mario_action(m, ACT_FREEFALL, 0);
}
if (++m->actionTimer == 7) {
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_THROW, MARIO_ACTION_SOUND_PLAYED);
#ifdef VERSION_SH
#ifdef VERSION_SH
queue_rumble_data(3, 50);
#endif
#endif
}
animated_stationary_ground_step(m, MARIO_ANIM_GROUND_THROW, ACT_IDLE);
return FALSE;
}
s32 act_heavy_throw(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_heavy_throw(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return drop_and_set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return drop_and_set_mario_action(m, ACT_FREEFALL, 0);
}
if (++m->actionTimer == 13) {
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_THROW, MARIO_ACTION_SOUND_PLAYED);
#ifdef VERSION_SH
#ifdef VERSION_SH
queue_rumble_data(3, 50);
#endif
#endif
}
animated_stationary_ground_step(m, MARIO_ANIM_HEAVY_THROW, ACT_IDLE);
return FALSE;
}
s32 act_stomach_slide_stop(struct MarioState *m) {
if (m->input & INPUT_UNKNOWN_10) {
s32 act_stomach_slide_stop(struct MarioState *m)
{
if (m->input & INPUT_UNKNOWN_10)
{
return set_mario_action(m, ACT_SHOCKWAVE_BOUNCE, 0);
}
if (m->input & INPUT_OFF_FLOOR) {
if (m->input & INPUT_OFF_FLOOR)
{
return set_mario_action(m, ACT_FREEFALL, 0);
}
if (m->input & INPUT_ABOVE_SLIDE) {
if (m->input & INPUT_ABOVE_SLIDE)
{
return set_mario_action(m, ACT_BEGIN_SLIDING, 0);
}
@@ -319,20 +385,23 @@ s32 act_stomach_slide_stop(struct MarioState *m) {
return FALSE;
}
s32 act_picking_up_bowser(struct MarioState *m) {
if (m->actionState == 0) {
s32 act_picking_up_bowser(struct MarioState *m)
{
if (m->actionState == 0)
{
m->actionState = 1;
m->angleVel[1] = 0;
m->marioBodyState->grabPos = GRAB_POS_BOWSER;
mario_grab_used_object(m);
#ifdef VERSION_SH
#ifdef VERSION_SH
queue_rumble_data(5, 80);
#endif
#endif
play_sound(SOUND_MARIO_HRMM, m->marioObj->header.gfx.cameraToObject);
}
set_mario_animation(m, MARIO_ANIM_GRAB_BOWSER);
if (is_anim_at_end(m)) {
if (is_anim_at_end(m))
{
set_mario_action(m, ACT_HOLDING_BOWSER, 0);
}
@@ -340,59 +409,78 @@ s32 act_picking_up_bowser(struct MarioState *m) {
return FALSE;
}
s32 act_holding_bowser(struct MarioState *m) {
s32 act_holding_bowser(struct MarioState *m)
{
s16 spin;
if (m->input & INPUT_B_PRESSED) {
#ifndef VERSION_JP
if (m->angleVel[1] <= -0xE00 || m->angleVel[1] >= 0xE00) {
if (m->input & INPUT_B_PRESSED)
{
#ifndef VERSION_JP
if (m->angleVel[1] <= -0xE00 || m->angleVel[1] >= 0xE00)
{
play_sound(SOUND_MARIO_SO_LONGA_BOWSER, m->marioObj->header.gfx.cameraToObject);
} else {
}
else
{
play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject);
}
#else
#else
play_sound(SOUND_MARIO_HERE_WE_GO, m->marioObj->header.gfx.cameraToObject);
#endif
#endif
return set_mario_action(m, ACT_RELEASING_BOWSER, 0);
}
if (m->angleVel[1] == 0) {
if (m->actionTimer++ > 120) {
if (m->angleVel[1] == 0)
{
if (m->actionTimer++ > 120)
{
return set_mario_action(m, ACT_RELEASING_BOWSER, 1);
}
set_mario_animation(m, MARIO_ANIM_HOLDING_BOWSER);
} else {
}
else
{
m->actionTimer = 0;
set_mario_animation(m, MARIO_ANIM_SWINGING_BOWSER);
}
if (m->intendedMag > 20.0f) {
if (m->actionArg == 0) {
if (m->intendedMag > 20.0f)
{
if (m->actionArg == 0)
{
m->actionArg = 1;
m->twirlYaw = m->intendedYaw;
} else {
}
else
{
// spin = acceleration
spin = (s16)(m->intendedYaw - m->twirlYaw) / 0x80;
if (spin < -0x80) {
if (spin < -0x80)
{
spin = -0x80;
}
if (spin > 0x80) {
if (spin > 0x80)
{
spin = 0x80;
}
m->twirlYaw = m->intendedYaw;
m->angleVel[1] += spin;
if (m->angleVel[1] > 0x1000) {
if (m->angleVel[1] > 0x1000)
{
m->angleVel[1] = 0x1000;
}
if (m->angleVel[1] < -0x1000) {
if (m->angleVel[1] < -0x1000)
{
m->angleVel[1] = -0x1000;
}
}
} else {
}
else
{
m->actionArg = 0;
m->angleVel[1] = approach_s32(m->angleVel[1], 0, 64, 64);
}
@@ -402,40 +490,50 @@ s32 act_holding_bowser(struct MarioState *m) {
m->faceAngle[1] += m->angleVel[1];
// play sound on overflow
if (m->angleVel[1] <= -0x100 && spin < m->faceAngle[1]) {
#ifdef VERSION_SH
if (m->angleVel[1] <= -0x100 && spin < m->faceAngle[1])
{
#ifdef VERSION_SH
queue_rumble_data(4, 20);
#endif
#endif
play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject);
}
if (m->angleVel[1] >= 0x100 && spin > m->faceAngle[1]) {
#ifdef VERSION_SH
if (m->angleVel[1] >= 0x100 && spin > m->faceAngle[1])
{
#ifdef VERSION_SH
queue_rumble_data(4, 20);
#endif
#endif
play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject);
}
stationary_ground_step(m);
if (m->angleVel[1] >= 0) {
if (m->angleVel[1] >= 0)
{
m->marioObj->header.gfx.angle[0] = -m->angleVel[1];
} else {
}
else
{
m->marioObj->header.gfx.angle[0] = m->angleVel[1];
}
return FALSE;
}
s32 act_releasing_bowser(struct MarioState *m) {
if (++m->actionTimer == 1) {
if (m->actionArg == 0) {
#ifdef VERSION_SH
s32 act_releasing_bowser(struct MarioState *m)
{
if (++m->actionTimer == 1)
{
if (m->actionArg == 0)
{
#ifdef VERSION_SH
queue_rumble_data(4, 50);
#endif
#endif
mario_throw_held_object(m);
} else {
#ifdef VERSION_SH
}
else
{
#ifdef VERSION_SH
queue_rumble_data(4, 50);
#endif
#endif
mario_drop_held_object(m);
}
}
@@ -445,31 +543,38 @@ s32 act_releasing_bowser(struct MarioState *m) {
return FALSE;
}
s32 check_common_object_cancels(struct MarioState *m) {
s32 check_common_object_cancels(struct MarioState *m)
{
f32 waterSurface = m->waterLevel - 100;
if (m->pos[1] < waterSurface) {
if (m->pos[1] < waterSurface)
{
return set_water_plunge_action(m);
}
if (m->input & INPUT_SQUISHED) {
if (m->input & INPUT_SQUISHED)
{
return drop_and_set_mario_action(m, ACT_SQUISHED, 0);
}
if (m->health < 0x100) {
if (m->health < 0x100)
{
return drop_and_set_mario_action(m, ACT_STANDING_DEATH, 0);
}
return FALSE;
}
s32 mario_execute_object_action(struct MarioState *m) {
s32 mario_execute_object_action(struct MarioState *m)
{
s32 cancel;
if (check_common_object_cancels(m)) {
if (check_common_object_cancels(m))
{
return TRUE;
}
if (mario_update_quicksand(m, 0.5f)) {
if (mario_update_quicksand(m, 0.5f))
{
return TRUE;
}
@@ -488,7 +593,8 @@ s32 mario_execute_object_action(struct MarioState *m) {
}
/* clang-format on */
if (!cancel && (m->input & INPUT_IN_WATER)) {
if (!cancel && (m->input & INPUT_IN_WATER))
{
m->particleFlags |= PARTICLE_IDLE_WATER_WAVE;
}
+1
View File
@@ -6,6 +6,7 @@
#include "../include/types.h"
s32 mario_update_punch_sequence(struct MarioState *m);
s32 mario_execute_object_action(struct MarioState *m);
#endif // MARIO_ACTIONS_OBJECT_H
File diff suppressed because it is too large Load Diff
@@ -6,45 +6,85 @@
#include "../include/types.h"
s32 check_common_idle_cancels(struct MarioState *m);
s32 check_common_hold_idle_cancels(struct MarioState *m);
s32 act_idle(struct MarioState *m);
void play_anim_sound(struct MarioState *m, u32 actionState, s32 animFrame, u32 sound);
s32 act_start_sleeping(struct MarioState *m);
s32 act_sleeping(struct MarioState *m);
s32 act_waking_up(struct MarioState *m);
s32 act_shivering(struct MarioState *m);
s32 act_coughing(struct MarioState *m);
s32 act_standing_against_wall(struct MarioState *m);
s32 act_in_quicksand(struct MarioState *m);
s32 act_crouching(struct MarioState *m);
s32 act_panting(struct MarioState *m);
void stopping_step(struct MarioState *m, s32 animID, u32 action);
s32 act_braking_stop(struct MarioState *m);
s32 act_butt_slide_stop(struct MarioState *m);
s32 act_hold_butt_slide_stop(struct MarioState *m);
s32 act_slide_kick_slide_stop(struct MarioState *m);
s32 act_start_crouching(struct MarioState *m);
s32 act_stop_crouching(struct MarioState *m);
s32 act_start_crawling(struct MarioState *m);
s32 act_stop_crawling(struct MarioState *m);
s32 act_shockwave_bounce(struct MarioState *m);
s32 landing_step(struct MarioState *m, s32 arg1, u32 action);
s32 check_common_landing_cancels(struct MarioState *m, u32 action);
s32 act_jump_land_stop(struct MarioState *m);
s32 act_double_jump_land_stop(struct MarioState *m);
s32 act_side_flip_land_stop(struct MarioState *m);
s32 act_freefall_land_stop(struct MarioState *m);
s32 act_triple_jump_land_stop(struct MarioState *m);
s32 act_backflip_land_stop(struct MarioState *m);
s32 act_lava_boost_land(struct MarioState *m);
s32 act_long_jump_land_stop(struct MarioState *m);
s32 act_hold_jump_land_stop(struct MarioState *m);
s32 act_hold_freefall_land_stop(struct MarioState *m);
s32 act_air_throw_land(struct MarioState *m);
s32 act_twirl_land(struct MarioState *m);
s32 act_ground_pound_land(struct MarioState *m);
s32 act_first_person(struct MarioState *m);
s32 check_common_stationary_cancels(struct MarioState *m);
s32 mario_execute_stationary_action(struct MarioState *m);
#endif // MARIO_ACTIONS_STATIONARY
File diff suppressed because it is too large Load Diff
+376 -297
View File
@@ -28,7 +28,7 @@
#include "../include/object_fields.h"
#include "../include/mario_geo_switch_case_ids.h"
static Vec3s gVec3sZero = {0,0,0};
static Vec3s gVec3sZero = {0, 0, 0};
#define TOAD_STAR_1_REQUIREMENT 12
#define TOAD_STAR_2_REQUIREMENT 25
@@ -42,7 +42,8 @@ static Vec3s gVec3sZero = {0,0,0};
#define TOAD_STAR_2_DIALOG_AFTER 91 // DIALOG_155
#define TOAD_STAR_3_DIALOG_AFTER 92 // DIALOG_156
enum ToadMessageStates {
enum ToadMessageStates
{
TOAD_MESSAGE_FADED,
TOAD_MESSAGE_OPAQUE,
TOAD_MESSAGE_OPACIFYING,
@@ -50,7 +51,8 @@ enum ToadMessageStates {
TOAD_MESSAGE_TALKING
};
enum UnlockDoorStarStates {
enum UnlockDoorStarStates
{
UNLOCK_DOOR_STAR_RISING,
UNLOCK_DOOR_STAR_WAITING,
UNLOCK_DOOR_STAR_SPAWNING_PARTICLES,
@@ -61,7 +63,7 @@ enum UnlockDoorStarStates {
* The eye texture on succesive frames of Mario's blink animation.
* He intentionally blinks twice each time.
*/
static s8 gMarioBlinkAnimation[7] = { 1, 2, 1, 0, 1, 2, 1 };
static s8 gMarioBlinkAnimation[7] = {1, 2, 1, 0, 1, 2, 1};
/**
* The scale values per frame for Mario's foot/hand for his attack animation
@@ -89,13 +91,13 @@ static s8 gMarioAttackScaleAnimation[3 * 6] = {
* Geo node script that draws Mario's head on the title screen.
*/
// Gfx *geo_draw_mario_head_goddard(s32 callContext, struct GraphNode *node, Mat4 *c) {
// Gfx *gfx = NULL;
// Gfx *gfx = nullptr;
// s16 sfx = 0;
// struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
// UNUSED Mat4 *transform = c;
//
//
// if (callContext == GEO_CONTEXT_RENDER) {
// if (gPlayerController->controllerData != NULL && !gWarpTransition.isActive) {
// if (gPlayerController->controllerData != nullptr && !gWarpTransition.isActive) {
// gd_copy_p1_contpad(gPlayer1Controller->controllerData);
// }
// gfx = (Gfx *) PHYSICAL_TO_VIRTUAL(gdm_gettestdl(asGenerated->parameter));
@@ -106,66 +108,76 @@ static s8 gMarioAttackScaleAnimation[3 * 6] = {
// return gfx;
// }
static void toad_message_faded(void) {
// if (gCurrentObject->oDistanceToMario > 700.0f) {
// gCurrentObject->oToadMessageRecentlyTalked = FALSE;
// }
// if (!gCurrentObject->oToadMessageRecentlyTalked && gCurrentObject->oDistanceToMario < 600.0f) {
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_OPACIFYING;
// }
static void toad_message_faded(void)
{
// if (gCurrentObject->oDistanceToMario > 700.0f) {
// gCurrentObject->oToadMessageRecentlyTalked = FALSE;
// }
// if (!gCurrentObject->oToadMessageRecentlyTalked && gCurrentObject->oDistanceToMario < 600.0f) {
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_OPACIFYING;
// }
}
static void toad_message_opaque(void) {
// if (gCurrentObject->oDistanceToMario > 700.0f) {
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADING;
// } else if (!gCurrentObject->oToadMessageRecentlyTalked) {
// gCurrentObject->oInteractionSubtype = INT_SUBTYPE_NPC;
// if (gCurrentObject->oInteractStatus & INT_STATUS_INTERACTED) {
// gCurrentObject->oInteractStatus = 0;
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_TALKING;
// play_toads_jingle();
// }
// }
static void toad_message_opaque(void)
{
// if (gCurrentObject->oDistanceToMario > 700.0f) {
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADING;
// } else if (!gCurrentObject->oToadMessageRecentlyTalked) {
// gCurrentObject->oInteractionSubtype = INT_SUBTYPE_NPC;
// if (gCurrentObject->oInteractStatus & INT_STATUS_INTERACTED) {
// gCurrentObject->oInteractStatus = 0;
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_TALKING;
// play_toads_jingle();
// }
// }
}
static void toad_message_talking(void) {
// if (cur_obj_update_dialog_with_cutscene(3, 1, CUTSCENE_DIALOG, gCurrentObject->oToadMessageDialogId)
// != 0) {
// gCurrentObject->oToadMessageRecentlyTalked = TRUE;
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADING;
// switch (gCurrentObject->oToadMessageDialogId) {
// case TOAD_STAR_1_DIALOG:
// gCurrentObject->oToadMessageDialogId = TOAD_STAR_1_DIALOG_AFTER;
// bhv_spawn_star_no_level_exit(0);
// break;
// case TOAD_STAR_2_DIALOG:
// gCurrentObject->oToadMessageDialogId = TOAD_STAR_2_DIALOG_AFTER;
// bhv_spawn_star_no_level_exit(1);
// break;
// case TOAD_STAR_3_DIALOG:
// gCurrentObject->oToadMessageDialogId = TOAD_STAR_3_DIALOG_AFTER;
// bhv_spawn_star_no_level_exit(2);
// break;
// }
// }
static void toad_message_talking(void)
{
// if (cur_obj_update_dialog_with_cutscene(3, 1, CUTSCENE_DIALOG, gCurrentObject->oToadMessageDialogId)
// != 0) {
// gCurrentObject->oToadMessageRecentlyTalked = TRUE;
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADING;
// switch (gCurrentObject->oToadMessageDialogId) {
// case TOAD_STAR_1_DIALOG:
// gCurrentObject->oToadMessageDialogId = TOAD_STAR_1_DIALOG_AFTER;
// bhv_spawn_star_no_level_exit(0);
// break;
// case TOAD_STAR_2_DIALOG:
// gCurrentObject->oToadMessageDialogId = TOAD_STAR_2_DIALOG_AFTER;
// bhv_spawn_star_no_level_exit(1);
// break;
// case TOAD_STAR_3_DIALOG:
// gCurrentObject->oToadMessageDialogId = TOAD_STAR_3_DIALOG_AFTER;
// bhv_spawn_star_no_level_exit(2);
// break;
// }
// }
}
static void toad_message_opacifying(void) {
if ((gCurrentObject->oOpacity += 6) == 255) {
static void toad_message_opacifying(void)
{
if ((gCurrentObject->oOpacity += 6) == 255)
{
gCurrentObject->oToadMessageState = TOAD_MESSAGE_OPAQUE;
}
}
static void toad_message_fading(void) {
if ((gCurrentObject->oOpacity -= 6) == 81) {
static void toad_message_fading(void)
{
if ((gCurrentObject->oOpacity -= 6) == 81)
{
gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADED;
}
}
void bhv_toad_message_loop(void) {
if (gCurrentObject->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) {
void bhv_toad_message_loop(void)
{
if (gCurrentObject->header.gfx.node.flags & GRAPH_RENDER_ACTIVE)
{
gCurrentObject->oInteractionSubtype = 0;
switch (gCurrentObject->oToadMessageState) {
switch (gCurrentObject->oToadMessageState)
{
case TOAD_MESSAGE_FADED:
toad_message_faded();
break;
@@ -185,40 +197,41 @@ void bhv_toad_message_loop(void) {
}
}
void bhv_toad_message_init(void) {
// s32 saveFlags = save_file_get_flags();
// s32 starCount = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1);
// s32 dialogId = (gCurrentObject->oBehParams >> 24) & 0xFF;
// s32 enoughStars = TRUE;
//
// switch (dialogId) {
// case TOAD_STAR_1_DIALOG:
// enoughStars = (starCount >= TOAD_STAR_1_REQUIREMENT);
// if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_1) {
// dialogId = TOAD_STAR_1_DIALOG_AFTER;
// }
// break;
// case TOAD_STAR_2_DIALOG:
// enoughStars = (starCount >= TOAD_STAR_2_REQUIREMENT);
// if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_2) {
// dialogId = TOAD_STAR_2_DIALOG_AFTER;
// }
// break;
// case TOAD_STAR_3_DIALOG:
// enoughStars = (starCount >= TOAD_STAR_3_REQUIREMENT);
// if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_3) {
// dialogId = TOAD_STAR_3_DIALOG_AFTER;
// }
// break;
// }
// if (enoughStars) {
// gCurrentObject->oToadMessageDialogId = dialogId;
// gCurrentObject->oToadMessageRecentlyTalked = FALSE;
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADED;
// gCurrentObject->oOpacity = 81;
// } else {
// obj_mark_for_deletion(gCurrentObject);
// }
void bhv_toad_message_init(void)
{
// s32 saveFlags = save_file_get_flags();
// s32 starCount = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1);
// s32 dialogId = (gCurrentObject->oBehParams >> 24) & 0xFF;
// s32 enoughStars = TRUE;
//
// switch (dialogId) {
// case TOAD_STAR_1_DIALOG:
// enoughStars = (starCount >= TOAD_STAR_1_REQUIREMENT);
// if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_1) {
// dialogId = TOAD_STAR_1_DIALOG_AFTER;
// }
// break;
// case TOAD_STAR_2_DIALOG:
// enoughStars = (starCount >= TOAD_STAR_2_REQUIREMENT);
// if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_2) {
// dialogId = TOAD_STAR_2_DIALOG_AFTER;
// }
// break;
// case TOAD_STAR_3_DIALOG:
// enoughStars = (starCount >= TOAD_STAR_3_REQUIREMENT);
// if (saveFlags & SAVE_FLAG_COLLECTED_TOAD_STAR_3) {
// dialogId = TOAD_STAR_3_DIALOG_AFTER;
// }
// break;
// }
// if (enoughStars) {
// gCurrentObject->oToadMessageDialogId = dialogId;
// gCurrentObject->oToadMessageRecentlyTalked = FALSE;
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADED;
// gCurrentObject->oOpacity = 81;
// } else {
// obj_mark_for_deletion(gCurrentObject);
// }
}
//static void star_door_unlock_spawn_particles(s16 angleOffset) {
@@ -232,87 +245,93 @@ void bhv_toad_message_init(void) {
// sparkleParticle->oPosY -= gCurrentObject->oUnlockDoorStarTimer * 10.0f;
//}
void bhv_unlock_door_star_init(void) {
// gCurrentObject->oUnlockDoorStarState = UNLOCK_DOOR_STAR_RISING;
// gCurrentObject->oUnlockDoorStarTimer = 0;
// gCurrentObject->oUnlockDoorStarYawVel = 0x1000;
// gCurrentObject->oPosX += 30.0f * sins(gMarioState->faceAngle[1] - 0x4000);
// gCurrentObject->oPosY += 160.0f;
// gCurrentObject->oPosZ += 30.0f * coss(gMarioState->faceAngle[1] - 0x4000);
// gCurrentObject->oMoveAngleYaw = 0x7800;
// obj_scale(gCurrentObject, 0.5f);
void bhv_unlock_door_star_init(void)
{
// gCurrentObject->oUnlockDoorStarState = UNLOCK_DOOR_STAR_RISING;
// gCurrentObject->oUnlockDoorStarTimer = 0;
// gCurrentObject->oUnlockDoorStarYawVel = 0x1000;
// gCurrentObject->oPosX += 30.0f * sins(gMarioState->faceAngle[1] - 0x4000);
// gCurrentObject->oPosY += 160.0f;
// gCurrentObject->oPosZ += 30.0f * coss(gMarioState->faceAngle[1] - 0x4000);
// gCurrentObject->oMoveAngleYaw = 0x7800;
// obj_scale(gCurrentObject, 0.5f);
}
void bhv_unlock_door_star_loop(void) {
// UNUSED u8 unused1[4];
// s16 prevYaw = gCurrentObject->oMoveAngleYaw;
// UNUSED u8 unused2[4];
//
// // Speed up the star every frame
// if (gCurrentObject->oUnlockDoorStarYawVel < 0x2400) {
// gCurrentObject->oUnlockDoorStarYawVel += 0x60;
// }
// switch (gCurrentObject->oUnlockDoorStarState) {
// case UNLOCK_DOOR_STAR_RISING:
// gCurrentObject->oPosY += 3.4f; // Raise the star up in the air
// gCurrentObject->oMoveAngleYaw +=
// gCurrentObject->oUnlockDoorStarYawVel; // Apply yaw velocity
// obj_scale(gCurrentObject, gCurrentObject->oUnlockDoorStarTimer / 50.0f
// + 0.5f); // Scale the star to be bigger
// if (++gCurrentObject->oUnlockDoorStarTimer == 30) {
// gCurrentObject->oUnlockDoorStarTimer = 0;
// gCurrentObject->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_WAITING
// }
// break;
// case UNLOCK_DOOR_STAR_WAITING:
// gCurrentObject->oMoveAngleYaw +=
// gCurrentObject->oUnlockDoorStarYawVel; // Apply yaw velocity
// if (++gCurrentObject->oUnlockDoorStarTimer == 30) {
// play_sound(SOUND_MENU_STAR_SOUND,
// gCurrentObject->header.gfx.cameraToObject); // Play final sound
// cur_obj_hide(); // Hide the object
// gCurrentObject->oUnlockDoorStarTimer = 0;
// gCurrentObject
// ->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_SPAWNING_PARTICLES
// }
// break;
// case UNLOCK_DOOR_STAR_SPAWNING_PARTICLES:
// // Spawn two particles, opposite sides of the star.
// star_door_unlock_spawn_particles(0);
// star_door_unlock_spawn_particles(0x8000);
// if (gCurrentObject->oUnlockDoorStarTimer++ == 20) {
// gCurrentObject->oUnlockDoorStarTimer = 0;
// gCurrentObject->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_DONE
// }
// break;
// case UNLOCK_DOOR_STAR_DONE: // The object stays loaded for an additional 50 frames so that the
// // sound doesn't immediately stop.
// if (gCurrentObject->oUnlockDoorStarTimer++ == 50) {
// obj_mark_for_deletion(gCurrentObject);
// }
// break;
// }
// // Checks if the angle has cycled back to 0.
// // This means that the code will execute when the star completes a full revolution.
// if (prevYaw > (s16) gCurrentObject->oMoveAngleYaw) {
// play_sound(
// SOUND_GENERAL_SHORT_STAR,
// gCurrentObject->header.gfx.cameraToObject); // Play a sound every time the star spins once
// }
void bhv_unlock_door_star_loop(void)
{
// UNUSED u8 unused1[4];
// s16 prevYaw = gCurrentObject->oMoveAngleYaw;
// UNUSED u8 unused2[4];
//
// // Speed up the star every frame
// if (gCurrentObject->oUnlockDoorStarYawVel < 0x2400) {
// gCurrentObject->oUnlockDoorStarYawVel += 0x60;
// }
// switch (gCurrentObject->oUnlockDoorStarState) {
// case UNLOCK_DOOR_STAR_RISING:
// gCurrentObject->oPosY += 3.4f; // Raise the star up in the air
// gCurrentObject->oMoveAngleYaw +=
// gCurrentObject->oUnlockDoorStarYawVel; // Apply yaw velocity
// obj_scale(gCurrentObject, gCurrentObject->oUnlockDoorStarTimer / 50.0f
// + 0.5f); // Scale the star to be bigger
// if (++gCurrentObject->oUnlockDoorStarTimer == 30) {
// gCurrentObject->oUnlockDoorStarTimer = 0;
// gCurrentObject->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_WAITING
// }
// break;
// case UNLOCK_DOOR_STAR_WAITING:
// gCurrentObject->oMoveAngleYaw +=
// gCurrentObject->oUnlockDoorStarYawVel; // Apply yaw velocity
// if (++gCurrentObject->oUnlockDoorStarTimer == 30) {
// play_sound(SOUND_MENU_STAR_SOUND,
// gCurrentObject->header.gfx.cameraToObject); // Play final sound
// cur_obj_hide(); // Hide the object
// gCurrentObject->oUnlockDoorStarTimer = 0;
// gCurrentObject
// ->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_SPAWNING_PARTICLES
// }
// break;
// case UNLOCK_DOOR_STAR_SPAWNING_PARTICLES:
// // Spawn two particles, opposite sides of the star.
// star_door_unlock_spawn_particles(0);
// star_door_unlock_spawn_particles(0x8000);
// if (gCurrentObject->oUnlockDoorStarTimer++ == 20) {
// gCurrentObject->oUnlockDoorStarTimer = 0;
// gCurrentObject->oUnlockDoorStarState++; // Sets state to UNLOCK_DOOR_STAR_DONE
// }
// break;
// case UNLOCK_DOOR_STAR_DONE: // The object stays loaded for an additional 50 frames so that the
// // sound doesn't immediately stop.
// if (gCurrentObject->oUnlockDoorStarTimer++ == 50) {
// obj_mark_for_deletion(gCurrentObject);
// }
// break;
// }
// // Checks if the angle has cycled back to 0.
// // This means that the code will execute when the star completes a full revolution.
// if (prevYaw > (s16) gCurrentObject->oMoveAngleYaw) {
// play_sound(
// SOUND_GENERAL_SHORT_STAR,
// gCurrentObject->header.gfx.cameraToObject); // Play a sound every time the star spins once
// }
}
/**
* Generate a display list that sets the correct blend mode and color for mirror Mario.
*/
static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha) {
static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha)
{
Gfx *gfx;
Gfx *gfxHead = NULL;
Gfx *gfxHead = nullptr;
if (alpha == 255) {
if (alpha == 255)
{
node->fnNode.node.flags = (node->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8);
gfxHead = alloc_display_list(2 * sizeof(*gfxHead));
gfx = gfxHead;
} else {
}
else
{
node->fnNode.node.flags = (node->fnNode.node.flags & 0xFF) | (LAYER_TRANSPARENT << 8);
gfxHead = alloc_display_list(3 * sizeof(*gfxHead));
gfx = gfxHead;
@@ -326,15 +345,17 @@ static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha) {
/**
* Sets the correct blend mode and color for mirror Mario.
*/
Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
UNUSED u8 unused1[4];
Gfx *gfx = NULL;
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
Gfx *gfx = nullptr;
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *)node;
struct MarioBodyState *bodyState = &gBodyStates[asGenerated->parameter];
s16 alpha;
UNUSED u8 unused2[4];
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
alpha = (bodyState->modelState & 0x100) ? (bodyState->modelState & 0xFF) : 255;
gfx = make_gfx_mario_alpha(asGenerated, alpha);
}
@@ -346,112 +367,135 @@ Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED
* If Mario is standing still, he is always high poly. If he is running,
* his level of detail depends on the distance to the camera.
*/
Gfx *geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx) {
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
Gfx *geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx)
{
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *)node;
struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases];
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
// assign result. 0 if moving, 1 if stationary.
switchCase->selectedCase = ((bodyState->action & ACT_FLAG_STATIONARY) == 0);
}
return NULL;
return nullptr;
}
/**
* Geo node script that makes Mario blink
*/
Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *)node;
struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases];
s16 blinkFrame;
if (callContext == GEO_CONTEXT_RENDER) {
if (bodyState->eyeState == 0) {
if (callContext == GEO_CONTEXT_RENDER)
{
if (bodyState->eyeState == 0)
{
blinkFrame = ((switchCase->numCases * 32 + gAreaUpdateCounter) >> 1) & 0x1F;
if (blinkFrame < 7) {
if (blinkFrame < 7)
{
switchCase->selectedCase = gMarioBlinkAnimation[blinkFrame];
} else {
}
else
{
switchCase->selectedCase = 0;
}
} else {
}
else
{
switchCase->selectedCase = bodyState->eyeState - 1;
}
}
return NULL;
return nullptr;
}
/**
* Makes Mario's upper body tilt depending on the rotation stored in his bodyState
*/
Gfx *geo_mario_tilt_torso(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
Gfx *geo_mario_tilt_torso(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *)node;
struct MarioBodyState *bodyState = &gBodyStates[asGenerated->parameter];
s32 action = bodyState->action;
if (callContext == GEO_CONTEXT_RENDER) {
struct GraphNodeRotation *rotNode = (struct GraphNodeRotation *) node->next;
if (callContext == GEO_CONTEXT_RENDER)
{
struct GraphNodeRotation *rotNode = (struct GraphNodeRotation *)node->next;
if (action != ACT_BUTT_SLIDE && action != ACT_HOLD_BUTT_SLIDE && action != ACT_WALKING
&& action != ACT_RIDING_SHELL_GROUND) {
&& action != ACT_RIDING_SHELL_GROUND)
{
vec3s_copy(bodyState->torsoAngle, gVec3sZero);
}
rotNode->rotation[0] = bodyState->torsoAngle[1];
rotNode->rotation[1] = bodyState->torsoAngle[2];
rotNode->rotation[2] = bodyState->torsoAngle[0];
}
return NULL;
return nullptr;
}
/**
* Makes Mario's head rotate with the camera angle when in C-up mode
*/
Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *)node;
struct MarioBodyState *bodyState = &gBodyStates[asGenerated->parameter];
// s32 action = bodyState->action;
if (callContext == GEO_CONTEXT_RENDER) {
struct GraphNodeRotation *rotNode = (struct GraphNodeRotation *) node->next;
// struct Camera *camera = gCurGraphNodeCamera->config.camera;
if (callContext == GEO_CONTEXT_RENDER)
{
struct GraphNodeRotation *rotNode = (struct GraphNodeRotation *)node->next;
// struct Camera *camera = gCurGraphNodeCamera->config.camera;
// if (camera->mode == CAMERA_MODE_C_UP) {
// rotNode->rotation[0] = 0; // gPlayerCameraState->headRotation[1]; // PATCH
// rotNode->rotation[2] = 0; // gPlayerCameraState->headRotation[0];
// } else if (action & ACT_FLAG_WATER_OR_TEXT) {
// rotNode->rotation[0] = bodyState->headAngle[1];
// rotNode->rotation[1] = bodyState->headAngle[2];
// rotNode->rotation[2] = bodyState->headAngle[0];
// } else {
vec3s_set(bodyState->headAngle, 0, 0, 0);
vec3s_set(rotNode->rotation, 0, 0, 0);
// }
// if (camera->mode == CAMERA_MODE_C_UP) {
// rotNode->rotation[0] = 0; // gPlayerCameraState->headRotation[1]; // PATCH
// rotNode->rotation[2] = 0; // gPlayerCameraState->headRotation[0];
// } else if (action & ACT_FLAG_WATER_OR_TEXT) {
// rotNode->rotation[0] = bodyState->headAngle[1];
// rotNode->rotation[1] = bodyState->headAngle[2];
// rotNode->rotation[2] = bodyState->headAngle[0];
// } else {
vec3s_set(bodyState->headAngle, 0, 0, 0);
vec3s_set(rotNode->rotation, 0, 0, 0);
// }
}
return NULL;
return nullptr;
}
/**
* Switch between hand models.
* Possible options are described in the MarioHandGSCId enum.
*/
Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *)node;
struct MarioBodyState *bodyState = &gBodyStates[0];
if (callContext == GEO_CONTEXT_RENDER) {
if (bodyState->handState == MARIO_HAND_FISTS) {
if (callContext == GEO_CONTEXT_RENDER)
{
if (bodyState->handState == MARIO_HAND_FISTS)
{
// switch between fists (0) and open (1)
switchCase->selectedCase = ((bodyState->action & ACT_FLAG_SWIMMING_OR_FLYING) != 0);
} else {
if (switchCase->numCases == 0) {
}
else
{
if (switchCase->numCases == 0)
{
switchCase->selectedCase =
(bodyState->handState < 5) ? bodyState->handState : MARIO_HAND_OPEN;
} else {
(bodyState->handState < 5) ? bodyState->handState : MARIO_HAND_OPEN;
}
else
{
switchCase->selectedCase =
(bodyState->handState < 2) ? bodyState->handState : MARIO_HAND_FISTS;
(bodyState->handState < 2) ? bodyState->handState : MARIO_HAND_FISTS;
}
}
}
return NULL;
return nullptr;
}
/**
@@ -462,111 +506,142 @@ Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4
* ! Since the animation gets updated in GEO_CONTEXT_RENDER, drawing Mario multiple times
* (such as in the mirror room) results in a faster and desynced punch / kick animation.
*/
Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
struct GraphNodeScale *scaleNode = (struct GraphNodeScale *) node->next;
Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *)node;
struct GraphNodeScale *scaleNode = (struct GraphNodeScale *)node->next;
struct MarioBodyState *bodyState = &gBodyStates[0];
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
scaleNode->scale = 1.0f;
if (asGenerated->parameter == bodyState->punchState >> 6) {
if (g_state->msMarioAttackAnimCounter != gAreaUpdateCounter && (bodyState->punchState & 0x3F) > 0) {
if (asGenerated->parameter == bodyState->punchState >> 6)
{
if (g_state->msMarioAttackAnimCounter != gAreaUpdateCounter && (bodyState->punchState & 0x3F) > 0)
{
bodyState->punchState -= 1;
g_state->msMarioAttackAnimCounter = gAreaUpdateCounter;
}
scaleNode->scale =
gMarioAttackScaleAnimation[asGenerated->parameter * 6 + (bodyState->punchState & 0x3F)]
/ 10.0f;
gMarioAttackScaleAnimation[asGenerated->parameter * 6 + (bodyState->punchState & 0x3F)]
/ 10.0f;
}
}
return NULL;
return nullptr;
}
/**
* Switch between normal cap, wing cap, vanish cap and metal cap.
*/
Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node;
Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *)node;
struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases];
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
// switchCase->selectedCase = bodyState->modelState >> 8;
if (bodyState->modelState >> 8 >= 2){ // temporarily disables metal cap
if (bodyState->modelState >> 8 >= 2)
{ // temporarily disables metal cap
switchCase->selectedCase = 0;
} else {
}
else
{
switchCase->selectedCase = bodyState->modelState >> 8;
}
}
return NULL;
return nullptr;
}
/**
* Determine whether Mario's head is drawn with or without a cap on.
* Also sets the visibility of the wing cap wings on or off.
*/
Gfx *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 GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *)node;
struct MarioBodyState *bodyState = &gBodyStates[switchCase->numCases];
if (callContext == GEO_CONTEXT_RENDER) {
if (callContext == GEO_CONTEXT_RENDER)
{
switchCase->selectedCase = bodyState->capState & 1;
while (next != node) {
if (next->type == GRAPH_NODE_TYPE_TRANSLATION_ROTATION) {
if (bodyState->capState & 2) {
while (next != node)
{
if (next->type == GRAPH_NODE_TYPE_TRANSLATION_ROTATION)
{
if (bodyState->capState & 2)
{
next->flags |= GRAPH_RENDER_ACTIVE;
} else {
}
else
{
next->flags &= ~GRAPH_RENDER_ACTIVE;
}
}
next = next->next;
}
}
return NULL;
return nullptr;
}
/**
* Geo node script that makes the wings on Mario's wing cap flap.
* Should be placed before a rotation node.
*/
Gfx *geo_mario_rotate_wing_cap_wings(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
Gfx *geo_mario_rotate_wing_cap_wings(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
s16 rotX;
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *)node;
if (callContext == GEO_CONTEXT_RENDER) {
struct GraphNodeRotation *rotNode = (struct GraphNodeRotation *) node->next;
if (callContext == GEO_CONTEXT_RENDER)
{
struct GraphNodeRotation *rotNode = (struct GraphNodeRotation *)node->next;
if (!gBodyStates[asGenerated->parameter >> 1].wingFlutter) {
if (!gBodyStates[asGenerated->parameter >> 1].wingFlutter)
{
rotX = (coss((gAreaUpdateCounter & 0xF) << 12) + 1.0f) * 4096.0f;
} else {
}
else
{
rotX = (coss((gAreaUpdateCounter & 7) << 13) + 1.0f) * 6144.0f;
}
if (!(asGenerated->parameter & 1)) {
if (!(asGenerated->parameter & 1))
{
rotNode->rotation[0] = -rotX;
} else {
}
else
{
rotNode->rotation[0] = rotX;
}
}
return NULL;
return nullptr;
}
/**
* Geo node that updates the held object node and the HOLP.
*/
Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *mtx) {
struct GraphNodeHeldObject *asHeldObj = (struct GraphNodeHeldObject *) b;
Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *mtx)
{
struct GraphNodeHeldObject *asHeldObj = (struct GraphNodeHeldObject *)b;
Mat4 *curTransform = mtx;
struct MarioState *marioState = gMarioState; // &gMarioStates[asHeldObj->playerIndex]; // PATCH
if (callContext == GEO_CONTEXT_RENDER) {
asHeldObj->objNode = NULL;
if (marioState->heldObj != NULL) {
if (callContext == GEO_CONTEXT_RENDER)
{
asHeldObj->objNode = nullptr;
if (marioState->heldObj != nullptr)
{
asHeldObj->objNode = marioState->heldObj;
switch (marioState->marioBodyState->grabPos) {
switch (marioState->marioBodyState->grabPos)
{
case GRAB_POS_LIGHT_OBJ:
if (marioState->action & ACT_FLAG_THROWING) {
if (marioState->action & ACT_FLAG_THROWING)
{
vec3s_set(asHeldObj->translation, 50, 0, 0);
} else {
}
else
{
vec3s_set(asHeldObj->translation, 50, 0, 110);
}
break;
@@ -578,14 +653,16 @@ Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *
break;
}
}
} else if (callContext == GEO_CONTEXT_HELD_OBJ) {
}
else if (callContext == GEO_CONTEXT_HELD_OBJ)
{
// ! The HOLP is set here, which is why it only updates when the held object is drawn.
// This is why it won't update during a pause buffered hitstun or when the camera is very far
// away.
get_pos_from_transform_mtx(marioState->marioBodyState->heldObjLastPosition, *curTransform,
*gCurGraphNodeCamera->matrixPtr);
}
return NULL;
return nullptr;
}
// X position of the mirror
@@ -595,65 +672,67 @@ Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *
* Geo node that creates a clone of Mario's geo node and updates it to becomes
* a mirror image of the player.
*/
Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
// f32 mirroredX;
// struct Object *mario = gMarioState->marioObj; // PATCH gMarioStates[0].marioObj;
Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
// f32 mirroredX;
// struct Object *mario = gMarioState->marioObj; // PATCH gMarioStates[0].marioObj;
// switch (callContext) {
// case GEO_CONTEXT_CREATE:
// init_graph_node_object(NULL, &gMirrorMario, NULL, gVec3fZero, gVec3sZero, gVec3fOne);
// break;
// case GEO_CONTEXT_AREA_LOAD:
// geo_add_child(node, &gMirrorMario.node);
// break;
// case GEO_CONTEXT_AREA_UNLOAD:
// geo_remove_child(&gMirrorMario.node);
// break;
// case GEO_CONTEXT_RENDER:
// if (mario->header.gfx.pos[0] > 1700.0f) {
// // TODO: Is this a geo layout copy or a graph node copy?
// gMirrorMario.sharedChild = mario->header.gfx.sharedChild;
// gMirrorMario.areaIndex = mario->header.gfx.areaIndex;
// vec3s_copy(gMirrorMario.angle, mario->header.gfx.angle);
// vec3f_copy(gMirrorMario.pos, mario->header.gfx.pos);
// vec3f_copy(gMirrorMario.scale, mario->header.gfx.scale);
// switch (callContext) {
// case GEO_CONTEXT_CREATE:
// init_graph_node_object(nullptr, &gMirrorMario, nullptr, gVec3fZero, gVec3sZero, gVec3fOne);
// break;
// case GEO_CONTEXT_AREA_LOAD:
// geo_add_child(node, &gMirrorMario.node);
// break;
// case GEO_CONTEXT_AREA_UNLOAD:
// geo_remove_child(&gMirrorMario.node);
// break;
// case GEO_CONTEXT_RENDER:
// if (mario->header.gfx.pos[0] > 1700.0f) {
// // TODO: Is this a geo layout copy or a graph node copy?
// gMirrorMario.sharedChild = mario->header.gfx.sharedChild;
// gMirrorMario.areaIndex = mario->header.gfx.areaIndex;
// vec3s_copy(gMirrorMario.angle, mario->header.gfx.angle);
// vec3f_copy(gMirrorMario.pos, mario->header.gfx.pos);
// vec3f_copy(gMirrorMario.scale, mario->header.gfx.scale);
// gMirrorMario.animInfo = mario->header.gfx.animInfo;
// mirroredX = MIRROR_X - gMirrorMario.pos[0];
// gMirrorMario.pos[0] = mirroredX + MIRROR_X;
// gMirrorMario.angle[1] = -gMirrorMario.angle[1];
// gMirrorMario.scale[0] *= -1.0f;
// ((struct GraphNode *) &gMirrorMario)->flags |= 1;
// } else {
// ((struct GraphNode *) &gMirrorMario)->flags &= ~1;
// }
// break;
// }
return NULL;
// gMirrorMario.animInfo = mario->header.gfx.animInfo;
// mirroredX = MIRROR_X - gMirrorMario.pos[0];
// gMirrorMario.pos[0] = mirroredX + MIRROR_X;
// gMirrorMario.angle[1] = -gMirrorMario.angle[1];
// gMirrorMario.scale[0] *= -1.0f;
// ((struct GraphNode *) &gMirrorMario)->flags |= 1;
// } else {
// ((struct GraphNode *) &gMirrorMario)->flags &= ~1;
// }
// break;
// }
return nullptr;
}
/**
* Since Mirror Mario has an x scale of -1, the mesh becomes inside out.
* This node corrects that by changing the culling mode accordingly.
*/
Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
// struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
// Gfx *gfx = NULL;
Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
{
// struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
// Gfx *gfx = nullptr;
// if (callContext == GEO_CONTEXT_RENDER && gCurGraphNodeObject == &gMirrorMario) {
// gfx = alloc_display_list(3 * sizeof(*gfx));
// if (callContext == GEO_CONTEXT_RENDER && gCurGraphNodeObject == &gMirrorMario) {
// gfx = alloc_display_list(3 * sizeof(*gfx));
// if (asGenerated->parameter == 0) {
// gSPClearGeometryMode(&gfx[0], G_CULL_BACK);
// gSPSetGeometryMode(&gfx[1], G_CULL_FRONT);
// gSPEndDisplayList(&gfx[2]);
// } else {
// gSPClearGeometryMode(&gfx[0], G_CULL_FRONT);
// gSPSetGeometryMode(&gfx[1], G_CULL_BACK);
// gSPEndDisplayList(&gfx[2]);
// }
// asGenerated->fnNode.node.flags = (asGenerated->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8);
// }
// return gfx;
return NULL;
// if (asGenerated->parameter == 0) {
// gSPClearGeometryMode(&gfx[0], G_CULL_BACK);
// gSPSetGeometryMode(&gfx[1], G_CULL_FRONT);
// gSPEndDisplayList(&gfx[2]);
// } else {
// gSPClearGeometryMode(&gfx[0], G_CULL_FRONT);
// gSPSetGeometryMode(&gfx[1], G_CULL_BACK);
// gSPEndDisplayList(&gfx[2]);
// }
// asGenerated->fnNode.node.flags = (asGenerated->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8);
// }
// return gfx;
return nullptr;
}
+16
View File
@@ -8,21 +8,37 @@
// Gfx *geo_draw_mario_head_goddard(s32 callContext, struct GraphNode *node, Mat4 *c);
void bhv_toad_message_loop(void);
void bhv_toad_message_init(void);
void bhv_unlock_door_star_init(void);
void bhv_unlock_door_star_loop(void);
Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_switch_mario_stand_run(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx);
Gfx *geo_switch_mario_eyes(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_mario_tilt_torso(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_switch_mario_hand(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_switch_mario_cap_effect(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_switch_mario_cap_on_off(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_mario_rotate_wing_cap_wings(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *mtx);
Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
#endif // MARIO_MISC_H
+243 -120
View File
@@ -8,11 +8,11 @@
#include "interaction.h"
#include "mario_step.h"
static s16 sMovingSandSpeeds[] = { 12, 8, 4, 0 };
static s16 sMovingSandSpeeds[] = {12, 8, 4, 0};
struct SM64SurfaceCollisionData gWaterSurfacePseudoFloor = {
SURFACE_VERY_SLIPPERY, 0, 0, 0, 0, 0, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0.0f, 1.0f, 0.0f }, 0.0f, 0, NULL, 0
SURFACE_VERY_SLIPPERY, 0, 0, 0, 0, 0, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
{0.0f, 1.0f, 0.0f}, 0.0f, 0, nullptr, 0
};
/**
@@ -25,7 +25,8 @@ struct SM64SurfaceCollisionData gWaterSurfacePseudoFloor = {
* known through stub_mario_step_2 and whether Mario was on it,
* and if so return a higher value than 0.
*/
f32 get_additive_y_vel_for_jumps(void) {
f32 get_additive_y_vel_for_jumps(void)
{
return 0.0f;
}
@@ -38,7 +39,8 @@ f32 get_additive_y_vel_for_jumps(void) {
* this could be used for checking if Mario was on the trampoline.
* It could, for example, make him bounce.
*/
void stub_mario_step_1(UNUSED struct MarioState *x) {
void stub_mario_step_1(UNUSEDstruct MarioState * x)
{
}
/**
@@ -48,10 +50,12 @@ void stub_mario_step_1(UNUSED struct MarioState *x) {
* by the trampoline to make itself known to get_additive_y_vel_for_jumps,
* or to set a variable with its intended additive Y vel.
*/
void stub_mario_step_2(void) {
void stub_mario_step_2(void)
{
}
void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollisionData *obj2) {
void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollisionData *obj2)
{
f32 rx = obj2->posX - obj1->posX;
f32 rz = obj2->posZ - obj1->posZ;
@@ -70,9 +74,12 @@ void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollision
//! Bully battery
}
BAD_RETURN(s32) init_bully_collision_data(struct BullyCollisionData *data, f32 posX, f32 posZ,
f32 forwardVel, s16 yaw, f32 conversionRatio, f32 radius) {
if (forwardVel < 0.0f) {
BAD_RETURN (s32) init_bully_collision_data(
struct BullyCollisionData *data, f32 posX, f32 posZ,
f32 forwardVel, s16 yaw, f32 conversionRatio, f32 radius)
{
if (forwardVel < 0.0f)
{
forwardVel *= -1.0f;
yaw += 0x8000;
}
@@ -85,55 +92,72 @@ BAD_RETURN(s32) init_bully_collision_data(struct BullyCollisionData *data, f32 p
data->velZ = forwardVel * coss(yaw);
}
void mario_bonk_reflection(struct MarioState *m, u32 negateSpeed) {
if (m->wall != NULL) {
void mario_bonk_reflection(struct MarioState *m, u32 negateSpeed)
{
if (m->wall != nullptr)
{
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_METAL_BONK : SOUND_ACTION_BONK,
m->marioObj->header.gfx.cameraToObject);
} else {
}
else
{
play_sound(SOUND_ACTION_HIT, m->marioObj->header.gfx.cameraToObject);
}
if (negateSpeed) {
if (negateSpeed)
{
mario_set_forward_vel(m, -m->forwardVel);
} else {
}
else
{
m->faceAngle[1] += 0x8000;
}
}
u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed) {
if (m->action & ACT_FLAG_RIDING_SHELL) {
u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed)
{
if (m->action & ACT_FLAG_RIDING_SHELL)
{
m->quicksandDepth = 0.0f;
} else {
if (m->quicksandDepth < 1.1f) {
}
else
{
if (m->quicksandDepth < 1.1f)
{
m->quicksandDepth = 1.1f;
}
switch (m->floor->type) {
switch (m->floor->type)
{
case SURFACE_SHALLOW_QUICKSAND:
if ((m->quicksandDepth += sinkingSpeed) >= 10.0f) {
if ((m->quicksandDepth += sinkingSpeed) >= 10.0f)
{
m->quicksandDepth = 10.0f;
}
break;
case SURFACE_SHALLOW_MOVING_QUICKSAND:
if ((m->quicksandDepth += sinkingSpeed) >= 25.0f) {
if ((m->quicksandDepth += sinkingSpeed) >= 25.0f)
{
m->quicksandDepth = 25.0f;
}
break;
case SURFACE_QUICKSAND:
case SURFACE_MOVING_QUICKSAND:
if ((m->quicksandDepth += sinkingSpeed) >= 60.0f) {
if ((m->quicksandDepth += sinkingSpeed) >= 60.0f)
{
m->quicksandDepth = 60.0f;
}
break;
case SURFACE_DEEP_QUICKSAND:
case SURFACE_DEEP_MOVING_QUICKSAND:
if ((m->quicksandDepth += sinkingSpeed) >= 160.0f) {
if ((m->quicksandDepth += sinkingSpeed) >= 160.0f)
{
update_mario_sound_and_camera(m);
return drop_and_set_mario_action(m, ACT_QUICKSAND_DEATH, 0);
}
@@ -154,13 +178,17 @@ u32 mario_update_quicksand(struct MarioState *m, f32 sinkingSpeed) {
return FALSE;
}
u32 mario_push_off_steep_floor(struct MarioState *m, u32 action, u32 actionArg) {
u32 mario_push_off_steep_floor(struct MarioState *m, u32 action, u32 actionArg)
{
s16 floorDYaw = m->floorAngle - m->faceAngle[1];
if (floorDYaw > -0x4000 && floorDYaw < 0x4000) {
if (floorDYaw > -0x4000 && floorDYaw < 0x4000)
{
m->forwardVel = 16.0f;
m->faceAngle[1] = m->floorAngle;
} else {
}
else
{
m->forwardVel = -16.0f;
m->faceAngle[1] = m->floorAngle + 0x8000;
}
@@ -168,12 +196,14 @@ u32 mario_push_off_steep_floor(struct MarioState *m, u32 action, u32 actionArg)
return set_mario_action(m, action, actionArg);
}
u32 mario_update_moving_sand(struct MarioState *m) {
u32 mario_update_moving_sand(struct MarioState *m)
{
struct SM64SurfaceCollisionData *floor = m->floor;
s32 floorType = floor->type;
if (floorType == SURFACE_DEEP_MOVING_QUICKSAND || floorType == SURFACE_SHALLOW_MOVING_QUICKSAND
|| floorType == SURFACE_MOVING_QUICKSAND || floorType == SURFACE_INSTANT_MOVING_QUICKSAND) {
|| floorType == SURFACE_MOVING_QUICKSAND || floorType == SURFACE_INSTANT_MOVING_QUICKSAND)
{
s16 pushAngle = floor->force << 8;
f32 pushSpeed = sMovingSandSpeeds[floor->force >> 8];
@@ -186,40 +216,47 @@ u32 mario_update_moving_sand(struct MarioState *m) {
return FALSE;
}
u32 mario_update_windy_ground(struct MarioState *m) {
u32 mario_update_windy_ground(struct MarioState *m)
{
struct SM64SurfaceCollisionData *floor = m->floor;
if (floor->type == SURFACE_HORIZONTAL_WIND) {
if (floor->type == SURFACE_HORIZONTAL_WIND)
{
f32 pushSpeed;
s16 pushAngle = floor->force << 8;
if (m->action & ACT_FLAG_MOVING) {
if (m->action & ACT_FLAG_MOVING)
{
s16 pushDYaw = m->faceAngle[1] - pushAngle;
pushSpeed = m->forwardVel > 0.0f ? -m->forwardVel * 0.5f : -8.0f;
if (pushDYaw > -0x4000 && pushDYaw < 0x4000) {
if (pushDYaw > -0x4000 && pushDYaw < 0x4000)
{
pushSpeed *= -1.0f;
}
pushSpeed *= coss(pushDYaw);
} else {
}
else
{
pushSpeed = 3.2f + (gGlobalTimer % 4);
}
m->vel[0] += pushSpeed * sins(pushAngle);
m->vel[2] += pushSpeed * coss(pushAngle);
#if VERSION_JP
#if VERSION_JP
play_sound(SOUND_ENV_WIND2, m->marioObj->header.gfx.cameraToObject);
#endif
#endif
return TRUE;
}
return FALSE;
}
void stop_and_set_height_to_floor(struct MarioState *m) {
void stop_and_set_height_to_floor(struct MarioState *m)
{
struct Object *marioObj = m->marioObj;
mario_set_forward_vel(m, 0.0f);
@@ -232,7 +269,8 @@ void stop_and_set_height_to_floor(struct MarioState *m) {
vec3s_set(marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
}
s32 stationary_ground_step(struct MarioState *m) {
s32 stationary_ground_step(struct MarioState *m)
{
u32 takeStep;
struct Object *marioObj = m->marioObj;
u32 stepResult = GROUND_STEP_NONE;
@@ -241,9 +279,12 @@ s32 stationary_ground_step(struct MarioState *m) {
takeStep = mario_update_moving_sand(m);
takeStep |= mario_update_windy_ground(m);
if (takeStep) {
if (takeStep)
{
stepResult = perform_ground_step(m);
} else {
}
else
{
//! This is responsible for several stationary downwarps.
m->pos[1] = m->floorHeight;
@@ -254,8 +295,10 @@ s32 stationary_ground_step(struct MarioState *m) {
return stepResult;
}
static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
UNUSED struct SM64SurfaceCollisionData *lowerWall;
static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos)
{
UNUSED
struct SM64SurfaceCollisionData *lowerWall;
struct SM64SurfaceCollisionData *upperWall;
struct SM64SurfaceCollisionData *ceil;
struct SM64SurfaceCollisionData *floor;
@@ -274,18 +317,22 @@ static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
m->wall = upperWall;
if (floor == NULL) {
if (floor == nullptr)
{
return GROUND_STEP_HIT_WALL_STOP_QSTEPS;
}
if ((m->action & ACT_FLAG_RIDING_SHELL) && floorHeight < waterLevel) {
if ((m->action & ACT_FLAG_RIDING_SHELL) && floorHeight < waterLevel)
{
floorHeight = waterLevel;
floor = &gWaterSurfacePseudoFloor;
floor->originOffset = floorHeight; //! Wrong origin offset (no effect)
}
if (nextPos[1] > floorHeight + 100.0f) {
if (nextPos[1] + 160.0f >= ceilHeight) {
if (nextPos[1] > floorHeight + 100.0f)
{
if (nextPos[1] + 160.0f >= ceilHeight)
{
return GROUND_STEP_HIT_WALL_STOP_QSTEPS;
}
@@ -295,7 +342,8 @@ static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
return GROUND_STEP_LEFT_GROUND;
}
if (floorHeight + 160.0f >= ceilHeight) {
if (floorHeight + 160.0f >= ceilHeight)
{
return GROUND_STEP_HIT_WALL_STOP_QSTEPS;
}
@@ -303,13 +351,16 @@ static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
m->floor = floor;
m->floorHeight = floorHeight;
if (upperWall != NULL) {
if (upperWall != nullptr)
{
s16 wallDYaw = atan2s(upperWall->normal.z, upperWall->normal.x) - m->faceAngle[1];
if (wallDYaw >= 0x2AAA && wallDYaw <= 0x5555) {
if (wallDYaw >= 0x2AAA && wallDYaw <= 0x5555)
{
return GROUND_STEP_NONE;
}
if (wallDYaw <= -0x2AAA && wallDYaw >= -0x5555) {
if (wallDYaw <= -0x2AAA && wallDYaw >= -0x5555)
{
return GROUND_STEP_NONE;
}
@@ -319,18 +370,21 @@ static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
return GROUND_STEP_NONE;
}
s32 perform_ground_step(struct MarioState *m) {
s32 perform_ground_step(struct MarioState *m)
{
s32 i;
u32 stepResult;
Vec3f intendedPos;
for (i = 0; i < 4; i++) {
for (i = 0; i < 4; i++)
{
intendedPos[0] = m->pos[0] + m->floor->normal.y * (m->vel[0] / 4.0f);
intendedPos[2] = m->pos[2] + m->floor->normal.y * (m->vel[2] / 4.0f);
intendedPos[1] = m->pos[1];
stepResult = perform_ground_quarter_step(m, intendedPos);
if (stepResult == GROUND_STEP_LEFT_GROUND || stepResult == GROUND_STEP_HIT_WALL_STOP_QSTEPS) {
if (stepResult == GROUND_STEP_LEFT_GROUND || stepResult == GROUND_STEP_HIT_WALL_STOP_QSTEPS)
{
break;
}
}
@@ -339,19 +393,22 @@ s32 perform_ground_step(struct MarioState *m) {
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
if (stepResult == GROUND_STEP_HIT_WALL_CONTINUE_QSTEPS) {
if (stepResult == GROUND_STEP_HIT_WALL_CONTINUE_QSTEPS)
{
stepResult = GROUND_STEP_HIT_WALL;
}
return stepResult;
}
u32 check_ledge_grab(struct MarioState *m, struct SM64SurfaceCollisionData *wall, Vec3f intendedPos, Vec3f nextPos) {
u32 check_ledge_grab(struct MarioState *m, struct SM64SurfaceCollisionData *wall, Vec3f intendedPos, Vec3f nextPos)
{
struct SM64SurfaceCollisionData *ledgeFloor;
Vec3f ledgePos;
f32 displacementX;
f32 displacementZ;
if (m->vel[1] > 0) {
if (m->vel[1] > 0)
{
return FALSE;
}
@@ -360,7 +417,8 @@ u32 check_ledge_grab(struct MarioState *m, struct SM64SurfaceCollisionData *wall
// Only ledge grab if the wall displaced Mario in the opposite direction of
// his velocity.
if (displacementX * m->vel[0] + displacementZ * m->vel[2] > 0.0f) {
if (displacementX * m->vel[0] + displacementZ * m->vel[2] > 0.0f)
{
return FALSE;
}
@@ -370,7 +428,8 @@ u32 check_ledge_grab(struct MarioState *m, struct SM64SurfaceCollisionData *wall
ledgePos[2] = nextPos[2] - wall->normal.z * 60.0f;
ledgePos[1] = find_floor(ledgePos[0], nextPos[1] + 160.0f, ledgePos[2], &ledgeFloor);
if (ledgePos[1] - nextPos[1] <= 100.0f) {
if (ledgePos[1] - nextPos[1] <= 100.0f)
{
return FALSE;
}
@@ -385,7 +444,8 @@ u32 check_ledge_grab(struct MarioState *m, struct SM64SurfaceCollisionData *wall
return TRUE;
}
s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepArg) {
s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepArg)
{
s16 wallDYaw;
Vec3f nextPos;
struct SM64SurfaceCollisionData *upperWall;
@@ -407,13 +467,15 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
//waterLevel = find_water_level(nextPos[0], nextPos[2]);
waterLevel = m->waterLevel;
m->wall = NULL;
m->wall = nullptr;
//! The water pseudo floor is not referenced when your intended qstep is
// out of bounds, so it won't detect you as landing.
if (floor == NULL) {
if (nextPos[1] <= m->floorHeight) {
if (floor == nullptr)
{
if (nextPos[1] <= m->floorHeight)
{
m->pos[1] = m->floorHeight;
return AIR_STEP_LANDED;
}
@@ -422,15 +484,18 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
return AIR_STEP_HIT_WALL;
}
if ((m->action & ACT_FLAG_RIDING_SHELL) && floorHeight < waterLevel) {
if ((m->action & ACT_FLAG_RIDING_SHELL) && floorHeight < waterLevel)
{
floorHeight = waterLevel;
floor = &gWaterSurfacePseudoFloor;
floor->originOffset = floorHeight; //! Incorrect origin offset (no effect)
}
//! This check uses f32, but findFloor uses short (overflow jumps)
if (nextPos[1] <= floorHeight) {
if (ceilHeight - floorHeight > 160.0f) {
if (nextPos[1] <= floorHeight)
{
if (ceilHeight - floorHeight > 160.0f)
{
m->pos[0] = nextPos[0];
m->pos[2] = nextPos[2];
m->floor = floor;
@@ -444,13 +509,16 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
return AIR_STEP_LANDED;
}
if (nextPos[1] + 160.0f > ceilHeight) {
if (m->vel[1] >= 0.0f) {
if (nextPos[1] + 160.0f > ceilHeight)
{
if (m->vel[1] >= 0.0f)
{
m->vel[1] = 0.0f;
//! Uses referenced ceiling instead of ceil (ceiling hang upwarp)
if ((stepArg & AIR_STEP_CHECK_HANG) && m->ceil != NULL
&& m->ceil->type == SURFACE_HANGABLE) {
if ((stepArg & AIR_STEP_CHECK_HANG) && m->ceil != nullptr
&& m->ceil->type == SURFACE_HANGABLE)
{
return AIR_STEP_GRABBED_CEILING;
}
@@ -458,7 +526,8 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
}
//! Potential subframe downwarp->upwarp?
if (nextPos[1] <= m->floorHeight) {
if (nextPos[1] <= m->floorHeight)
{
m->pos[1] = m->floorHeight;
return AIR_STEP_LANDED;
}
@@ -469,8 +538,10 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
//! When the wall is not completely vertical or there is a slight wall
// misalignment, you can activate these conditions in unexpected situations
if ((stepArg & AIR_STEP_CHECK_LEDGE_GRAB) && upperWall == NULL && lowerWall != NULL) {
if (check_ledge_grab(m, lowerWall, intendedPos, nextPos)) {
if ((stepArg & AIR_STEP_CHECK_LEDGE_GRAB) && upperWall == nullptr && lowerWall != nullptr)
{
if (check_ledge_grab(m, lowerWall, intendedPos, nextPos))
{
return AIR_STEP_GRABBED_LEDGE;
}
@@ -484,15 +555,18 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
m->floor = floor;
m->floorHeight = floorHeight;
if (upperWall != NULL || lowerWall != NULL) {
m->wall = upperWall != NULL ? upperWall : lowerWall;
if (upperWall != nullptr || lowerWall != nullptr)
{
m->wall = upperWall != nullptr ? upperWall : lowerWall;
wallDYaw = atan2s(m->wall->normal.z, m->wall->normal.x) - m->faceAngle[1];
if (m->wall->type == SURFACE_BURNING) {
if (m->wall->type == SURFACE_BURNING)
{
return AIR_STEP_HIT_LAVA_WALL;
}
if (wallDYaw < -0x6000 || wallDYaw > 0x6000) {
if (wallDYaw < -0x6000 || wallDYaw > 0x6000)
{
m->flags |= MARIO_UNKNOWN_30;
return AIR_STEP_HIT_WALL;
}
@@ -501,122 +575,165 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr
return AIR_STEP_NONE;
}
void apply_twirl_gravity(struct MarioState *m) {
void apply_twirl_gravity(struct MarioState *m)
{
f32 terminalVelocity;
f32 heaviness = 1.0f;
if (m->angleVel[1] > 1024) {
if (m->angleVel[1] > 1024)
{
heaviness = 1024.0f / m->angleVel[1];
}
terminalVelocity = -75.0f * heaviness;
m->vel[1] -= 4.0f * heaviness;
if (m->vel[1] < terminalVelocity) {
if (m->vel[1] < terminalVelocity)
{
m->vel[1] = terminalVelocity;
}
}
u32 should_strengthen_gravity_for_jump_ascent(struct MarioState *m) {
if (!(m->flags & MARIO_UNKNOWN_08)) {
u32 should_strengthen_gravity_for_jump_ascent(struct MarioState *m)
{
if (!(m->flags & MARIO_UNKNOWN_08))
{
return FALSE;
}
if (m->action & (ACT_FLAG_INTANGIBLE | ACT_FLAG_INVULNERABLE)) {
if (m->action & (ACT_FLAG_INTANGIBLE | ACT_FLAG_INVULNERABLE))
{
return FALSE;
}
if (!(m->input & INPUT_A_DOWN) && m->vel[1] > 20.0f) {
if (!(m->input & INPUT_A_DOWN) && m->vel[1] > 20.0f)
{
return (m->action & ACT_FLAG_CONTROL_JUMP_HEIGHT) != 0;
}
return FALSE;
}
void apply_gravity(struct MarioState *m) {
if (m->action == ACT_TWIRLING && m->vel[1] < 0.0f) {
void apply_gravity(struct MarioState *m)
{
if (m->action == ACT_TWIRLING && m->vel[1] < 0.0f)
{
apply_twirl_gravity(m);
} else if (m->action == ACT_SHOT_FROM_CANNON) {
}
else if (m->action == ACT_SHOT_FROM_CANNON)
{
m->vel[1] -= 1.0f;
if (m->vel[1] < -75.0f) {
if (m->vel[1] < -75.0f)
{
m->vel[1] = -75.0f;
}
} else if (m->action == ACT_LONG_JUMP || m->action == ACT_SLIDE_KICK
|| m->action == ACT_BBH_ENTER_SPIN) {
}
else if (m->action == ACT_LONG_JUMP || m->action == ACT_SLIDE_KICK
|| m->action == ACT_BBH_ENTER_SPIN)
{
m->vel[1] -= 2.0f;
if (m->vel[1] < -75.0f) {
if (m->vel[1] < -75.0f)
{
m->vel[1] = -75.0f;
}
} else if (m->action == ACT_LAVA_BOOST || m->action == ACT_FALL_AFTER_STAR_GRAB) {
}
else if (m->action == ACT_LAVA_BOOST || m->action == ACT_FALL_AFTER_STAR_GRAB)
{
m->vel[1] -= 3.2f;
if (m->vel[1] < -65.0f) {
if (m->vel[1] < -65.0f)
{
m->vel[1] = -65.0f;
}
} else if (m->action == ACT_GETTING_BLOWN) {
}
else if (m->action == ACT_GETTING_BLOWN)
{
m->vel[1] -= m->unkC4;
if (m->vel[1] < -75.0f) {
if (m->vel[1] < -75.0f)
{
m->vel[1] = -75.0f;
}
} else if (should_strengthen_gravity_for_jump_ascent(m)) {
}
else if (should_strengthen_gravity_for_jump_ascent(m))
{
m->vel[1] /= 4.0f;
} else if (m->action & ACT_FLAG_METAL_WATER) {
}
else if (m->action & ACT_FLAG_METAL_WATER)
{
m->vel[1] -= 1.6f;
if (m->vel[1] < -16.0f) {
if (m->vel[1] < -16.0f)
{
m->vel[1] = -16.0f;
}
} else if ((m->flags & MARIO_WING_CAP) && m->vel[1] < 0.0f && (m->input & INPUT_A_DOWN)) {
}
else if ((m->flags & MARIO_WING_CAP) && m->vel[1] < 0.0f && (m->input & INPUT_A_DOWN))
{
m->marioBodyState->wingFlutter = TRUE;
m->vel[1] -= 2.0f;
if (m->vel[1] < -37.5f) {
if ((m->vel[1] += 4.0f) > -37.5f) {
if (m->vel[1] < -37.5f)
{
if ((m->vel[1] += 4.0f) > -37.5f)
{
m->vel[1] = -37.5f;
}
}
} else {
}
else
{
m->vel[1] -= 4.0f;
if (m->vel[1] < -75.0f) {
if (m->vel[1] < -75.0f)
{
m->vel[1] = -75.0f;
}
}
}
void apply_vertical_wind(struct MarioState *m) {
void apply_vertical_wind(struct MarioState *m)
{
f32 maxVelY;
f32 offsetY;
if (m->action != ACT_GROUND_POUND) {
if (m->action != ACT_GROUND_POUND)
{
offsetY = m->pos[1] - -1500.0f;
if (m->floor->type == SURFACE_VERTICAL_WIND && -3000.0f < offsetY && offsetY < 2000.0f) {
if (offsetY >= 0.0f) {
if (m->floor->type == SURFACE_VERTICAL_WIND && -3000.0f < offsetY && offsetY < 2000.0f)
{
if (offsetY >= 0.0f)
{
maxVelY = 10000.0f / (offsetY + 200.0f);
} else {
}
else
{
maxVelY = 50.0f;
}
if (m->vel[1] < maxVelY) {
if ((m->vel[1] += maxVelY / 8.0f) > maxVelY) {
if (m->vel[1] < maxVelY)
{
if ((m->vel[1] += maxVelY / 8.0f) > maxVelY)
{
m->vel[1] = maxVelY;
}
}
#ifdef VERSION_JP
#ifdef VERSION_JP
play_sound(SOUND_ENV_WIND2, m->marioObj->header.gfx.cameraToObject);
#endif
#endif
}
}
}
s32 perform_air_step(struct MarioState *m, u32 stepArg) {
s32 perform_air_step(struct MarioState *m, u32 stepArg)
{
Vec3f intendedPos;
s32 i;
s32 quarterStepResult;
s32 stepResult = AIR_STEP_NONE;
m->wall = NULL;
m->wall = nullptr;
for (i = 0; i < 4; i++) {
for (i = 0; i < 4; i++)
{
intendedPos[0] = m->pos[0] + m->vel[0] / 4.0f;
intendedPos[1] = m->pos[1] + m->vel[1] / 4.0f;
intendedPos[2] = m->pos[2] + m->vel[2] / 4.0f;
@@ -627,24 +744,28 @@ s32 perform_air_step(struct MarioState *m, u32 stepArg) {
// getting 0s until your last qf. Graze a wall on your last qf, and it will
// return the stored 2 with a sharply angled reference wall. (some gwks)
if (quarterStepResult != AIR_STEP_NONE) {
if (quarterStepResult != AIR_STEP_NONE)
{
stepResult = quarterStepResult;
}
if (quarterStepResult == AIR_STEP_LANDED || quarterStepResult == AIR_STEP_GRABBED_LEDGE
|| quarterStepResult == AIR_STEP_GRABBED_CEILING
|| quarterStepResult == AIR_STEP_HIT_LAVA_WALL) {
|| quarterStepResult == AIR_STEP_HIT_LAVA_WALL)
{
break;
}
}
if (m->vel[1] >= 0.0f) {
if (m->vel[1] >= 0.0f)
{
m->peakHeight = m->pos[1];
}
m->terrainSoundAddend = mario_get_terrain_sound_addend(m);
if (m->action != ACT_FLYING) {
if (m->action != ACT_FLYING)
{
apply_gravity(m);
}
apply_vertical_wind(m);
@@ -657,13 +778,15 @@ s32 perform_air_step(struct MarioState *m, u32 stepArg) {
// They had these functions the whole time and never used them? Lol
void set_vel_from_pitch_and_yaw(struct MarioState *m) {
void set_vel_from_pitch_and_yaw(struct MarioState *m)
{
m->vel[0] = m->forwardVel * coss(m->faceAngle[0]) * sins(m->faceAngle[1]);
m->vel[1] = m->forwardVel * sins(m->faceAngle[0]);
m->vel[2] = m->forwardVel * coss(m->faceAngle[0]) * coss(m->faceAngle[1]);
}
void set_vel_from_yaw(struct MarioState *m) {
void set_vel_from_yaw(struct MarioState *m)
{
m->vel[0] = m->slideVelX = m->forwardVel * sins(m->faceAngle[1]);
m->vel[1] = 0.0f;
m->vel[2] = m->slideVelZ = m->forwardVel * coss(m->faceAngle[1]);
+29 -9
View File
@@ -5,32 +5,52 @@
#include "../include/types.h"
struct BullyCollisionData {
/*0x00*/ f32 conversionRatio;
/*0x04*/ f32 radius;
/*0x08*/ f32 posX;
/*0x0C*/ f32 posZ;
/*0x10*/ f32 velX;
/*0x14*/ f32 velZ;
struct BullyCollisionData
{
/*0x00*/
f32 conversionRatio;
/*0x04*/
f32 radius;
/*0x08*/
f32 posX;
/*0x0C*/
f32 posZ;
/*0x10*/
f32 velX;
/*0x14*/
f32 velZ;
};
extern struct SM64SurfaceCollisionData gWaterSurfacePseudoFloor;
f32 get_additive_y_vel_for_jumps(void);
void stub_mario_step_1(struct MarioState *);
void stub_mario_step_2(void);
void mario_bonk_reflection(struct MarioState *, u32);
void transfer_bully_speed(struct BullyCollisionData *obj1, struct BullyCollisionData *obj2);
BAD_RETURN(s32) init_bully_collision_data(struct BullyCollisionData *data, f32 posX, f32 posZ,
f32 forwardVel, s16 yaw, f32 conversionRatio, f32 radius);
BAD_RETURN (s32) init_bully_collision_data(
struct BullyCollisionData *data, f32 posX, f32 posZ,
f32 forwardVel, s16 yaw, f32 conversionRatio, f32 radius);
u32 mario_update_quicksand(struct MarioState *, f32);
u32 mario_push_off_steep_floor(struct MarioState *, u32, u32);
u32 mario_update_moving_sand(struct MarioState *);
u32 mario_update_windy_ground(struct MarioState *);
void stop_and_set_height_to_floor(struct MarioState *);
s32 stationary_ground_step(struct MarioState *);
s32 perform_ground_step(struct MarioState *);
s32 perform_air_step(struct MarioState *, u32);
#endif // MARIO_STEP_H
+65 -48
View File
@@ -8,18 +8,20 @@
#include "../engine/math_util.h"
#include "../include/object_fields.h"
static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f };
static Vec3s gVec3sZero = { 0, 0, 0 };
static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
static Vec3s gVec3sZero = {0, 0, 0};
static struct Object *try_allocate_object(void) {
static struct Object *try_allocate_object(void)
{
struct ObjectNode *nextObj;
nextObj = (struct ObjectNode *) malloc(sizeof(struct Object));
nextObj->prev = NULL;
nextObj->next = NULL;
return (struct Object *) nextObj;
nextObj = (struct ObjectNode *)malloc(sizeof(struct Object));
nextObj->prev = nullptr;
nextObj->next = nullptr;
return (struct Object *)nextObj;
}
static struct Object *allocate_object(void) {
static struct Object *allocate_object(void)
{
s32 i;
struct Object *obj = try_allocate_object();
@@ -27,47 +29,51 @@ static struct Object *allocate_object(void) {
obj->activeFlags = ACTIVE_FLAG_ACTIVE | ACTIVE_FLAG_UNK8;
obj->parentObj = obj;
obj->prevObj = NULL;
obj->prevObj = nullptr;
obj->collidedObjInteractTypes = 0;
obj->numCollidedObjs = 0;
for (i = 0; i < 0x50; i++) {
#ifdef _WIN32
for (i = 0; i < 0x50; i++)
{
#ifdef _WIN32
obj->rawData.asS32[i] = 0;
#endif
#ifdef _WIN64
obj->ptrData.asVoidPtr[i] = NULL;
#endif
#endif
#ifdef _WIN64
obj->ptrData.asVoidPtr[i] = nullptr;
#endif
}
obj->unused1 = 0;
obj->bhvStackIndex = 0;
obj->bhvDelayTimer = 0;
obj->hitboxRadius = 37.0f; // Override directly for Mario
obj->hitboxHeight = 160.0f; //
obj->hitboxRadius = 37.0f; // Override directly for Mario
obj->hitboxHeight = 160.0f; //
obj->hurtboxRadius = 0.0f;
obj->hurtboxHeight = 0.0f;
obj->hitboxDownOffset = 0.0f;
obj->unused2 = 0;
obj->platform = NULL;
obj->collisionData = NULL;
obj->platform = nullptr;
obj->collisionData = nullptr;
obj->oIntangibleTimer = -1;
obj->oDamageOrCoinValue = 0;
obj->oHealth = 2048;
obj->oCollisionDistance = 1000.0f;
if (gCurrLevelNum == LEVEL_TTC) {
if (gCurrLevelNum == LEVEL_TTC)
{
obj->oDrawingDistance = 2000.0f;
} else {
}
else
{
obj->oDrawingDistance = 4000.0f;
}
mtxf_identity(obj->transform);
obj->respawnInfoType = RESPAWN_INFO_TYPE_NULL;
obj->respawnInfo = NULL;
obj->respawnInfo = nullptr;
obj->oDistanceToMario = 19000.0f;
obj->oRoom = -1;
@@ -76,28 +82,30 @@ static struct Object *allocate_object(void) {
obj->header.gfx.pos[0] = -10000.0f;
obj->header.gfx.pos[1] = -10000.0f;
obj->header.gfx.pos[2] = -10000.0f;
obj->header.gfx.throwMatrix = NULL;
obj->header.gfx.throwMatrix = nullptr;
return obj;
}
static struct Object *create_object(void) {
static struct Object *create_object(void)
{
struct Object *obj;
obj = allocate_object();
obj->curBhvCommand = NULL;
obj->behavior = NULL;
obj->curBhvCommand = nullptr;
obj->behavior = nullptr;
return obj;
}
static void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle) {
static void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle)
{
vec3f_set(graphNode->scale, 1.0f, 1.0f, 1.0f);
vec3f_copy(graphNode->pos, pos);
vec3s_copy(graphNode->angle, angle);
graphNode->sharedChild = sharedChild;
graphNode->unk4C = 0;
graphNode->throwMatrix = NULL;
graphNode->animInfo.curAnim = NULL;
graphNode->throwMatrix = nullptr;
graphNode->animInfo.curAnim = nullptr;
graphNode->node.flags |= GRAPH_RENDER_ACTIVE;
graphNode->node.flags &= ~GRAPH_RENDER_INVISIBLE;
@@ -105,14 +113,15 @@ static void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, V
graphNode->node.flags &= ~GRAPH_RENDER_BILLBOARD;
}
static struct Object *spawn_object_at_origin(void) {
static struct Object *spawn_object_at_origin(void)
{
struct Object *obj;
obj = create_object();
obj->parentObj = NULL;
obj->parentObj = nullptr;
obj->header.gfx.areaIndex = 0;
obj->header.gfx.activeAreaIndex = 0;
geo_obj_init((struct GraphNodeObject *) &obj->header.gfx, NULL, gVec3fZero, gVec3sZero);
geo_obj_init((struct GraphNodeObject *)&obj->header.gfx, nullptr, gVec3fZero, gVec3sZero);
return obj;
}
@@ -121,10 +130,12 @@ static struct Object *spawn_object_at_origin(void) {
* Copy position, velocity, and angle variables from MarioState to the Mario
* object.
*/
static void copy_mario_state_to_object(void) {
static void copy_mario_state_to_object(void)
{
s32 i = 0;
// L is real
if (gCurrentObject != gMarioObject) {
if (gCurrentObject != gMarioObject)
{
i += 1;
}
@@ -157,11 +168,12 @@ struct Object *hack_allocate_mario(void)
/**
* Mario's primary behavior update function.
*/
void bhv_mario_update(void) {
void bhv_mario_update(void)
{
u32 particleFlags = 0;
// s32 i;
// s32 i;
gCurrentObject = gMarioObject;
gCurrentObject = gMarioObject;
particleFlags = execute_mario_action(gCurrentObject);
gCurrentObject->oMarioParticleFlags = particleFlags;
@@ -169,18 +181,19 @@ void bhv_mario_update(void) {
// to sync it with the Mario object
copy_mario_state_to_object();
// i = 0;
// while (sParticleTypes[i].particleFlag != 0) {
// if (particleFlags & sParticleTypes[i].particleFlag) {
// spawn_particle(sParticleTypes[i].activeParticleFlag, sParticleTypes[i].model,
// sParticleTypes[i].behavior);
// }
// i = 0;
// while (sParticleTypes[i].particleFlag != 0) {
// if (particleFlags & sParticleTypes[i].particleFlag) {
// spawn_particle(sParticleTypes[i].activeParticleFlag, sParticleTypes[i].model,
// sParticleTypes[i].behavior);
// }
// i++;
// }
// i++;
// }
}
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2) {
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2)
{
f32 spC, sp8, sp4;
spC = a2[3][0] * a2[0][0] + a2[3][1] * a2[0][1] + a2[3][2] * a2[0][2];
@@ -208,7 +221,9 @@ void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2) {
a0[2][3] = 0;
a0[3][3] = 1.0f;
}
void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1) {
void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1)
{
f32 spC = a1->oParentRelativePosX;
f32 sp8 = a1->oParentRelativePosY;
f32 sp4 = a1->oParentRelativePosZ;
@@ -217,7 +232,9 @@ void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1) {
a1->oPosY = spC * a0[0][1] + sp8 * a0[1][1] + sp4 * a0[2][1] + a0[3][1];
a1->oPosZ = spC * a0[0][2] + sp8 * a0[1][2] + sp4 * a0[2][2] + a0[3][2];
}
void obj_set_gfx_pos_from_pos(struct Object *obj) {
void obj_set_gfx_pos_from_pos(struct Object *obj)
{
obj->header.gfx.pos[0] = obj->oPosX;
obj->header.gfx.pos[1] = obj->oPosY;
obj->header.gfx.pos[2] = obj->oPosZ;
+4
View File
@@ -53,7 +53,11 @@
#define GRAPH_RENDER_HAS_ANIMATION (1 << 5)
struct Object *hack_allocate_mario(void);
void bhv_mario_update(void);
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2);
void obj_update_pos_from_parent_transformation(Mat4 a0, struct Object *a1);
void obj_set_gfx_pos_from_pos(struct Object *obj);
+47 -31
View File
@@ -16,7 +16,8 @@
* Determine if Mario is standing on a platform object, meaning that he is
* within 4 units of the floor. Set his referenced platform object accordingly.
*/
void update_mario_platform(void) {
void update_mario_platform(void)
{
struct SM64SurfaceCollisionData *floor;
UNUSED u32 unused;
f32 marioX;
@@ -25,7 +26,8 @@ void update_mario_platform(void) {
f32 floorHeight;
u32 awayFromFloor;
if (gMarioObject == NULL) {
if (gMarioObject == nullptr)
{
return;
}
@@ -39,22 +41,29 @@ void update_mario_platform(void) {
marioZ = gMarioObject->oPosZ;
floorHeight = find_floor(marioX, marioY, marioZ, &floor);
if (absfx(marioY - floorHeight) < 4.0f) {
if (absfx(marioY - floorHeight) < 4.0f)
{
awayFromFloor = 0;
} else {
}
else
{
awayFromFloor = 1;
}
switch (awayFromFloor) {
switch (awayFromFloor)
{
case 1:
gMarioObject->platform = NULL;
gMarioObject->platform = nullptr;
break;
case 0:
if (floor != NULL && floor->transform != NULL) {
if (floor != nullptr && floor->transform != nullptr)
{
gMarioObject->platform = floor->transform;
} else {
gMarioObject->platform = NULL;
}
else
{
gMarioObject->platform = nullptr;
}
break;
}
@@ -63,7 +72,8 @@ void update_mario_platform(void) {
/**
* Get Mario's position and store it in x, y, and z.
*/
static void get_mario_pos(f32 *x, f32 *y, f32 *z) {
static void get_mario_pos(f32 *x, f32 *y, f32 *z)
{
*x = gMarioState->pos[0];
*y = gMarioState->pos[1];
*z = gMarioState->pos[2];
@@ -72,7 +82,8 @@ static void get_mario_pos(f32 *x, f32 *y, f32 *z) {
/**
* Set Mario's position.
*/
static void set_mario_pos(f32 x, f32 y, f32 z) {
static void set_mario_pos(f32 x, f32 y, f32 z)
{
gMarioState->pos[0] = x;
gMarioState->pos[1] = y;
gMarioState->pos[2] = z;
@@ -82,7 +93,8 @@ static void set_mario_pos(f32 x, f32 y, f32 z) {
* Apply one frame of platform rotation to Mario or an object using the given
* platform. If isMario is false, use gCurrentObject.
*/
void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform *platform) {
void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform *platform)
{
f32 x;
f32 y;
f32 z;
@@ -102,24 +114,26 @@ void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform
rotation[1] = platform->aAngleVelYaw;
rotation[2] = platform->aAngleVelRoll;
// if (isMario) {
// D_8032FEC0 = 0;
get_mario_pos(&x, &y, &z);
// } else {
// x = gCurrentObject->aPosX;
// y = gCurrentObject->aPosY;
// z = gCurrentObject->aPosZ;
// }
// if (isMario) {
// D_8032FEC0 = 0;
get_mario_pos(&x, &y, &z);
// } else {
// x = gCurrentObject->aPosX;
// y = gCurrentObject->aPosY;
// z = gCurrentObject->aPosZ;
// }
x += platform->aVelX;
z += platform->aVelZ;
if (rotation[0] != 0 || rotation[1] != 0 || rotation[2] != 0) {
if (rotation[0] != 0 || rotation[1] != 0 || rotation[2] != 0)
{
unused1 = rotation[0];
unused2 = rotation[2];
unused3 = platform->aFaceAngleYaw;
if (isMario) {
if (isMario)
{
gMarioState->faceAngle[1] += rotation[1];
}
@@ -150,20 +164,22 @@ void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform
z = platformPosZ + newObjectOffset[2];
}
// if (isMario) {
set_mario_pos(x, y, z);
// } else {
// gCurrentObject->oPosX = x;
// gCurrentObject->oPosY = y;
// gCurrentObject->oPosZ = z;
// }
// if (isMario) {
set_mario_pos(x, y, z);
// } else {
// gCurrentObject->oPosX = x;
// gCurrentObject->oPosY = y;
// gCurrentObject->oPosZ = z;
// }
}
/**
* If Mario's platform is not null, apply platform displacement.
*/
void apply_mario_platform_displacement(void) {
if (gMarioObject != NULL && gMarioObject->platform != NULL) {
void apply_mario_platform_displacement(void)
{
if (gMarioObject != nullptr && gMarioObject->platform != nullptr)
{
apply_platform_displacement(TRUE, gMarioObject->platform);
}
}
+1
View File
@@ -5,6 +5,7 @@
#include "../include/types.h"
void update_mario_platform(void);
void apply_mario_platform_displacement(void);
#endif // PLATFORM_DISPLACEMENT_H
File diff suppressed because it is too large Load Diff
+1
View File
@@ -27,6 +27,7 @@ extern struct GraphNodeHeldObject *gCurGraphNodeHeldObject;
#define ANIM_TYPE_ROTATION 5
void geo_process_node_and_siblings(struct GraphNode *firstNode);
//void geo_process_root(struct GraphNodeRoot *node, Vp *b, Vp *c, s32 clearColor);
void geo_process_root_hack_single_node(struct GraphNode *node);
+45 -19
View File
@@ -42,7 +42,8 @@ struct SaveFile
struct SaveBlockSignature signature;
};
enum SaveFileIndex {
enum SaveFileIndex
{
SAVE_FILE_A,
SAVE_FILE_B,
SAVE_FILE_C,
@@ -57,15 +58,15 @@ struct MainMenuSaveData
u32 coinScoreAges[NUM_SAVE_FILES];
u16 soundMode;
#ifdef VERSION_EU
#ifdef VERSION_EU
u16 language;
#define SUBTRAHEND 8
#else
#define SUBTRAHEND 6
#endif
#define SUBTRAHEND 8
#else
#define SUBTRAHEND 6
#endif
// Pad to match the EEPROM size of 0x200 (10 bytes on JP/US, 8 bytes on EU)
u8 filler[ 128 ]; // EEPROM_SIZE / 2 - SUBTRAHEND - NUM_SAVE_FILES * (4 + sizeof(struct SaveFile))];
u8 filler[128]; // EEPROM_SIZE / 2 - SUBTRAHEND - NUM_SAVE_FILES * (4 + sizeof(struct SaveFile))];
struct SaveBlockSignature signature;
};
@@ -75,7 +76,7 @@ struct SaveBuffer
// Each of the four save files has two copies. If one is bad, the other is used as a backup.
struct SaveFile files[NUM_SAVE_FILES][2];
// The main menu data has two copies. If one is bad, the other is used as a backup.
// struct MainMenuSaveData menuData[0];
// struct MainMenuSaveData menuData[0];
};
extern u8 gLastCompletedCourseNum;
@@ -120,12 +121,18 @@ extern s8 gLevelToCourseNumTable[];
// Variable for setting a warp checkpoint.
// possibly a WarpDest struct where arg is a union. TODO: Check?
struct WarpCheckpoint {
/*0x00*/ u8 actNum;
/*0x01*/ u8 courseNum;
/*0x02*/ u8 levelID;
/*0x03*/ u8 areaNum;
/*0x04*/ u8 warpNode;
struct WarpCheckpoint
{
/*0x00*/
u8 actNum;
/*0x01*/
u8 courseNum;
/*0x02*/
u8 levelID;
/*0x03*/
u8 areaNum;
/*0x04*/
u8 warpNode;
};
extern struct WarpCheckpoint gWarpCheckpoint;
@@ -134,38 +141,57 @@ extern s8 gMainMenuDataModified;
extern s8 gSaveFileModified;
void save_file_do_save(s32 fileIndex);
void save_file_erase(s32 fileIndex);
BAD_RETURN(s32) save_file_copy(s32 srcFileIndex, s32 destFileIndex);
BAD_RETURN (s32) save_file_copy(s32 srcFileIndex, s32 destFileIndex);
void save_file_load_all(void);
void save_file_reload(void);
void save_file_collect_star_or_key(s16 coinScore, s16 starIndex);
s32 save_file_exists(s32 fileIndex);
u32 save_file_get_max_coin_score(s32 courseIndex);
s32 save_file_get_course_star_count(s32 fileIndex, s32 courseIndex);
//s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse);
//void save_file_set_flags(u32 flags);
//void save_file_clear_flags(u32 flags);
//u32 save_file_get_flags(void);
u32 save_file_get_star_flags(s32 fileIndex, s32 courseIndex);
void save_file_set_star_flags(s32 fileIndex, s32 courseIndex, u32 starFlags);
s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex);
s32 save_file_is_cannon_unlocked(void);
void save_file_set_cannon_unlocked(void);
void save_file_set_cap_pos(s16 x, s16 y, s16 z);
s32 save_file_get_cap_pos(Vec3s capPos);
void save_file_set_sound_mode(u16 mode);
u16 save_file_get_sound_mode(void);
void save_file_move_cap_to_default_location(void);
void disable_warp_checkpoint(void);
void check_if_should_set_warp_checkpoint(struct WarpNode *warpNode);
s32 check_warp_checkpoint(struct WarpNode *warpNode);
#ifdef VERSION_EU
enum EuLanguages {
LANGUAGE_ENGLISH,
LANGUAGE_FRENCH,
LANGUAGE_GERMAN
enum EuLanguages
{
LANGUAGE_ENGLISH, LANGUAGE_FRENCH, LANGUAGE_GERMAN
};
void eu_set_language(u16 language);
+86 -44
View File
@@ -34,8 +34,8 @@ static u16 sCurrentMusic = MUSIC_NONE;
static u16 sCurrentShellMusic = MUSIC_NONE;
static u16 sCurrentCapMusic = MUSIC_NONE;
static u8 sPlayingInfiniteStairs = FALSE;
UNUSED static u8 unused8032C6D8[16] = { 0 };
static s16 sSoundMenuModeToSoundMode[] = { SOUND_MODE_STEREO, SOUND_MODE_MONO, SOUND_MODE_HEADSET };
UNUSED static u8 unused8032C6D8[16] = {0};
static s16 sSoundMenuModeToSoundMode[] = {SOUND_MODE_STEREO, SOUND_MODE_MONO, SOUND_MODE_HEADSET};
// Only the 20th array element is used.
static u32 sMenuSoundsExtra[] = {
SOUND_MOVING_TERRAIN_SLIDE + (0 << 16),
@@ -82,15 +82,18 @@ void play_menu_sounds_extra(s32 a, void *b);
/**
* Called from threads: thread5_game_loop
*/
void reset_volume(void) {
void reset_volume(void)
{
sMusicVolume = 0;
}
/**
* Called from threads: thread5_game_loop
*/
void lower_background_noise(s32 a) {
switch (a) {
void lower_background_noise(s32 a)
{
switch (a)
{
case 1:
set_audio_muted(TRUE);
break;
@@ -104,8 +107,10 @@ void lower_background_noise(s32 a) {
/**
* Called from threads: thread5_game_loop
*/
void raise_background_noise(s32 a) {
switch (a) {
void raise_background_noise(s32 a)
{
switch (a)
{
case 1:
set_audio_muted(FALSE);
break;
@@ -119,8 +124,10 @@ void raise_background_noise(s32 a) {
/**
* Called from threads: thread5_game_loop
*/
void disable_background_sound(void) {
if (sBgMusicDisabled == FALSE) {
void disable_background_sound(void)
{
if (sBgMusicDisabled == FALSE)
{
sBgMusicDisabled = TRUE;
sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND);
}
@@ -129,8 +136,10 @@ void disable_background_sound(void) {
/**
* Called from threads: thread5_game_loop
*/
void enable_background_sound(void) {
if (sBgMusicDisabled == TRUE) {
void enable_background_sound(void)
{
if (sBgMusicDisabled == TRUE)
{
sBgMusicDisabled = FALSE;
sound_banks_enable(SEQ_PLAYER_SFX, SOUND_BANKS_BACKGROUND);
}
@@ -141,8 +150,10 @@ void enable_background_sound(void) {
*
* Called from threads: thread5_game_loop
*/
void set_sound_mode(u16 soundMode) {
if (soundMode < 3) {
void set_sound_mode(u16 soundMode)
{
if (soundMode < 3)
{
audio_set_sound_mode(sSoundMenuModeToSoundMode[soundMode]);
}
}
@@ -152,33 +163,51 @@ void set_sound_mode(u16 soundMode) {
*
* Called from threads: thread5_game_loop
*/
void play_menu_sounds(s16 soundMenuFlags) {
if (soundMenuFlags & SOUND_MENU_FLAG_HANDAPPEAR) {
void play_menu_sounds(s16 soundMenuFlags)
{
if (soundMenuFlags & SOUND_MENU_FLAG_HANDAPPEAR)
{
play_sound(SOUND_MENU_HAND_APPEAR, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_HANDISAPPEAR) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_HANDISAPPEAR)
{
play_sound(SOUND_MENU_HAND_DISAPPEAR, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_UNKNOWN1) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_UNKNOWN1)
{
play_sound(SOUND_MENU_UNK0C, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_PINCHMARIOFACE) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_PINCHMARIOFACE)
{
play_sound(SOUND_MENU_PINCH_MARIO_FACE, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_PINCHMARIOFACE2) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_PINCHMARIOFACE2)
{
play_sound(SOUND_MENU_PINCH_MARIO_FACE, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE)
{
play_sound(SOUND_MENU_LET_GO_MARIO_FACE, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_CAMERAZOOMIN) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_CAMERAZOOMIN)
{
play_sound(SOUND_MENU_CAMERA_ZOOM_IN, gGlobalSoundSource);
} else if (soundMenuFlags & SOUND_MENU_FLAG_CAMERAZOOMOUT) {
}
else if (soundMenuFlags & SOUND_MENU_FLAG_CAMERAZOOMOUT)
{
play_sound(SOUND_MENU_CAMERA_ZOOM_OUT, gGlobalSoundSource);
}
if (soundMenuFlags & 0x100) {
play_menu_sounds_extra(20, NULL);
if (soundMenuFlags & 0x100)
{
play_menu_sounds_extra(20, nullptr);
}
#if ENABLE_RUMBLE
if (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE) {
#if ENABLE_RUMBLE
if (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE)
{
queue_rumble_data(10, 60);
}
#endif
#endif
}
/**
@@ -187,7 +216,7 @@ void play_menu_sounds(s16 soundMenuFlags) {
* Called from threads: thread5_game_loop
*/
//void play_painting_eject_sound(void) {
// if (gRipplingPainting != NULL && gRipplingPainting->state == PAINTING_ENTERED) {
// if (gRipplingPainting != nullptr && gRipplingPainting->state == PAINTING_ENTERED) {
// // ripple when Mario enters painting
// if (!sPaintingEjectSoundPlayed) {
// play_sound(SOUND_GENERAL_PAINTING_EJECT,
@@ -207,7 +236,7 @@ void play_menu_sounds(s16 soundMenuFlags) {
//
// /* Infinite stairs? */
// if (gCurrLevelNum == LEVEL_CASTLE && gCurrAreaIndex == 2 && gMarioState->numStars < 70) {
// if (gMarioState->floor != NULL && gMarioState->floor->room == 6) {
// if (gMarioState->floor != nullptr && gMarioState->floor->room == 6) {
// if (gMarioState->pos[2] < 2540.0f) {
// shouldPlay = TRUE;
// }
@@ -229,7 +258,7 @@ void play_menu_sounds(s16 soundMenuFlags) {
*/
//void set_background_music(u16 a, u16 seqArgs, s16 fadeTimer) {
// if (gResetTimer == 0 && seqArgs != sCurrentMusic) {
// if (gCurrCreditsEntry != NULL) {
// if (gCurrCreditsEntry != nullptr) {
// sound_reset(7);
// } else {
// sound_reset(a);
@@ -245,7 +274,8 @@ void play_menu_sounds(s16 soundMenuFlags) {
/**
* Called from threads: thread3_main, thread5_game_loop
*/
void fadeout_music(s16 fadeOutTime) {
void fadeout_music(s16 fadeOutTime)
{
func_803210D4(fadeOutTime);
sCurrentMusic = MUSIC_NONE;
sCurrentShellMusic = MUSIC_NONE;
@@ -255,7 +285,8 @@ void fadeout_music(s16 fadeOutTime) {
/**
* Called from threads: thread5_game_loop
*/
void fadeout_level_music(s16 fadeTimer) {
void fadeout_level_music(s16 fadeTimer)
{
seq_player_fade_out(SEQ_PLAYER_LEVEL, fadeTimer);
sCurrentMusic = MUSIC_NONE;
sCurrentShellMusic = MUSIC_NONE;
@@ -265,7 +296,8 @@ void fadeout_level_music(s16 fadeTimer) {
/**
* Called from threads: thread5_game_loop
*/
void play_cutscene_music(u16 seqArgs) {
void play_cutscene_music(u16 seqArgs)
{
play_music(SEQ_PLAYER_LEVEL, seqArgs, 0);
sCurrentMusic = seqArgs;
}
@@ -273,7 +305,8 @@ void play_cutscene_music(u16 seqArgs) {
/**
* Called from threads: thread5_game_loop
*/
void play_shell_music(void) {
void play_shell_music(void)
{
play_music(SEQ_PLAYER_LEVEL, SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP | SEQ_VARIATION), 0);
sCurrentShellMusic = SEQUENCE_ARGS(4, SEQ_EVENT_POWERUP | SEQ_VARIATION);
}
@@ -281,8 +314,10 @@ void play_shell_music(void) {
/**
* Called from threads: thread5_game_loop
*/
void stop_shell_music(void) {
if (sCurrentShellMusic != MUSIC_NONE) {
void stop_shell_music(void)
{
if (sCurrentShellMusic != MUSIC_NONE)
{
stop_background_music(sCurrentShellMusic);
sCurrentShellMusic = MUSIC_NONE;
}
@@ -291,9 +326,11 @@ void stop_shell_music(void) {
/**
* Called from threads: thread5_game_loop
*/
void play_cap_music(u16 seqArgs) {
void play_cap_music(u16 seqArgs)
{
play_music(SEQ_PLAYER_LEVEL, seqArgs, 0);
if (sCurrentCapMusic != MUSIC_NONE && sCurrentCapMusic != seqArgs) {
if (sCurrentCapMusic != MUSIC_NONE && sCurrentCapMusic != seqArgs)
{
stop_background_music(sCurrentCapMusic);
}
sCurrentCapMusic = seqArgs;
@@ -302,8 +339,10 @@ void play_cap_music(u16 seqArgs) {
/**
* Called from threads: thread5_game_loop
*/
void fadeout_cap_music(void) {
if (sCurrentCapMusic != MUSIC_NONE) {
void fadeout_cap_music(void)
{
if (sCurrentCapMusic != MUSIC_NONE)
{
fadeout_background_music(sCurrentCapMusic, 600);
}
}
@@ -311,8 +350,10 @@ void fadeout_cap_music(void) {
/**
* Called from threads: thread5_game_loop
*/
void stop_cap_music(void) {
if (sCurrentCapMusic != MUSIC_NONE) {
void stop_cap_music(void)
{
if (sCurrentCapMusic != MUSIC_NONE)
{
stop_background_music(sCurrentCapMusic);
sCurrentCapMusic = MUSIC_NONE;
}
@@ -321,7 +362,8 @@ void stop_cap_music(void) {
/**
* Called from threads: thread5_game_loop
*/
void play_menu_sounds_extra(s32 a, void *b) {
void play_menu_sounds_extra(s32 a, void *b)
{
play_sound(sMenuSoundsExtra[a], b);
}
@@ -353,7 +395,7 @@ void play_menu_sounds_extra(s32 a, void *b) {
// struct SPTask *spTask;
// profiler_log_thread4_time();
// spTask = create_next_audio_frame_task();
// if (spTask != NULL) {
// if (spTask != nullptr) {
// dispatch_audio_sptask(spTask);
// }
// profiler_log_thread4_time();
+15
View File
@@ -19,23 +19,38 @@
#define SOUND_MENU_MODE_HEADSET 2
void reset_volume(void);
void raise_background_noise(s32 a);
void lower_background_noise(s32 a);
void disable_background_sound(void);
void enable_background_sound(void);
void set_sound_mode(u16 soundMode);
void play_menu_sounds(s16 soundMenuFlags);
//void play_painting_eject_sound(void);
//void play_infinite_stairs_music(void);
//void set_background_music(u16 a, u16 seqArgs, s16 fadeTimer);
void fadeout_music(s16 fadeOutTime);
void fadeout_level_music(s16 fadeTimer);
void play_cutscene_music(u16 seqArgs);
void play_shell_music(void);
void stop_shell_music(void);
void play_cap_music(u16 seqArgs);
void fadeout_cap_music(void);
void stop_cap_music(void);
//void audio_game_loop_tick(void);
//void thread4_sound(UNUSED void *arg);
+6 -6
View File
@@ -7,18 +7,18 @@ struct GlobalState *g_state = 0;
struct GlobalState *global_state_create(void)
{
struct GlobalState *state = malloc( sizeof( struct GlobalState ));
memset( state, 0, sizeof( struct GlobalState ));
state->msSwimStrength = MIN_SWIM_STRENGTH;
return state;
struct GlobalState *state = malloc(sizeof(struct GlobalState));
memset(state, 0, sizeof(struct GlobalState));
state->msSwimStrength = MIN_SWIM_STRENGTH;
return state;
}
void global_state_bind(struct GlobalState *state)
{
g_state = state;
g_state = state;
}
void global_state_delete(struct GlobalState *state)
{
free( state );
free(state);
}
+2
View File
@@ -50,5 +50,7 @@ struct GlobalState
extern struct GlobalState *g_state;
extern struct GlobalState *global_state_create(void);
extern void global_state_bind(struct GlobalState *state);
extern void global_state_delete(struct GlobalState *state);
+136 -116
View File
@@ -98,168 +98,188 @@
* Data Structures.
*/
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int gain: 16;
unsigned int addr;
} Aadpcm;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int gain: 16;
unsigned int addr;
} Apolef;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int pad1: 16;
unsigned int addr;
} Aenvelope;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int dmem:16;
unsigned int pad2:16;
unsigned int count:16;
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 8;
unsigned int dmem: 16;
unsigned int pad2: 16;
unsigned int count: 16;
} Aclearbuff;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int pad2:16;
unsigned int inL:16;
unsigned int inR:16;
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 8;
unsigned int pad2: 16;
unsigned int inL: 16;
unsigned int inR: 16;
} Ainterleave;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 24;
unsigned int addr;
} Aloadbuff;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int pad1: 16;
unsigned int addr;
} Aenvmixer;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int gain:16;
unsigned int dmemi:16;
unsigned int dmemo:16;
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int gain: 16;
unsigned int dmemi: 16;
unsigned int dmemo: 16;
} Amixer;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int dmem2:16;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int dmem2: 16;
unsigned int addr;
} Apan;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pitch:16;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int pitch: 16;
unsigned int addr;
} Aresample;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int pad1:16;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int pad1: 16;
unsigned int addr;
} Areverb;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 24;
unsigned int addr;
} Asavebuff;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:24;
unsigned int pad2:2;
unsigned int number:4;
unsigned int base:24;
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 24;
unsigned int pad2: 2;
unsigned int number: 4;
unsigned int base: 24;
} Asegment;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int dmemin:16;
unsigned int dmemout:16;
unsigned int count:16;
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int dmemin: 16;
unsigned int dmemout: 16;
unsigned int count: 16;
} Asetbuff;
typedef struct {
unsigned int cmd:8;
unsigned int flags:8;
unsigned int vol:16;
unsigned int voltgt:16;
unsigned int volrate:16;
typedef struct
{
unsigned int cmd: 8;
unsigned int flags: 8;
unsigned int vol: 16;
unsigned int voltgt: 16;
unsigned int volrate: 16;
} Asetvol;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int dmemin:16;
unsigned int dmemout:16;
unsigned int count:16;
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 8;
unsigned int dmemin: 16;
unsigned int dmemout: 16;
unsigned int count: 16;
} Admemmove;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int count:16;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 8;
unsigned int count: 16;
unsigned int addr;
} Aloadadpcm;
typedef struct {
unsigned int cmd:8;
unsigned int pad1:8;
unsigned int pad2:16;
unsigned int addr;
typedef struct
{
unsigned int cmd: 8;
unsigned int pad1: 8;
unsigned int pad2: 16;
unsigned int addr;
} Asetloop;
/*
* Generic Acmd Packet
*/
typedef struct {
typedef struct
{
uintptr_t w0;
uintptr_t w1;
} Awords;
typedef union {
Awords words;
typedef union
{
Awords words;
#if IS_BIG_ENDIAN && !IS_64_BIT
Aadpcm adpcm;
Apolef polef;
Aclearbuff clearbuff;
Aenvelope envelope;
Ainterleave interleave;
Aloadbuff loadbuff;
Aenvmixer envmixer;
Aresample resample;
Areverb reverb;
Asavebuff savebuff;
Asegment segment;
Asetbuff setbuff;
Asetvol setvol;
Admemmove dmemmove;
Aloadadpcm loadadpcm;
Amixer mixer;
Asetloop setloop;
Aadpcm adpcm;
Apolef polef;
Aclearbuff clearbuff;
Aenvelope envelope;
Ainterleave interleave;
Aloadbuff loadbuff;
Aenvmixer envmixer;
Aresample resample;
Areverb reverb;
Asavebuff savebuff;
Asegment segment;
Asetbuff setbuff;
Asetvol setvol;
Admemmove dmemmove;
Aloadadpcm loadadpcm;
Amixer mixer;
Asetloop setloop;
#endif
long long int force_union_align; /* dummy, force alignment */
long long int force_union_align; /* dummy, force alignment */
} Acmd;
/*
File diff suppressed because it is too large Load Diff
+18 -7
View File
@@ -6,18 +6,29 @@
typedef struct
{
u8 *offset __attribute__((aligned (8)));
s32 len __attribute__((aligned (8)));
u8 *offset __attribute__((aligned (8)
)
);
s32 len __attribute__((aligned (8)
)
);
} ALSeqData;
typedef struct
{
unsigned short revision;
unsigned short seqCount;
unsigned int pad;
unsigned short revision;
unsigned short seqCount;
unsigned int pad;
ALSeqData seqArray[1];
} __attribute__((aligned (16))) ALSeqFile;
} __attribute__((aligned (16)
void alSeqFileNew(ALSeqFile *f, u8 *base);
)
)
ALSeqFile;
void alSeqFileNew(ALSeqFile * f, u8 * base);
#endif
+207 -199
View File
@@ -32,7 +32,9 @@
#define _OS_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -49,15 +51,17 @@ extern "C" {
/*
* Structure for device manager block
*/
typedef struct {
s32 active; /* Status flag */
OSThread *thread; /* Calling thread */
OSMesgQueue *cmdQueue; /* Command queue */
OSMesgQueue *evtQueue; /* Event queue */
OSMesgQueue *acsQueue; /* Access queue */
/* Raw DMA routine */
s32 (*dma)(s32, u32, void *, u32);
s32 (*edma)(OSPiHandle *, s32, u32, void *, u32);
typedef struct
{
s32 active; /* Status flag */
OSThread *thread; /* Calling thread */
OSMesgQueue *cmdQueue; /* Command queue */
OSMesgQueue *evtQueue; /* Event queue */
OSMesgQueue *acsQueue; /* Access queue */
/* Raw DMA routine */
s32 (*dma)(s32, u32, void *, u32);
s32 (*edma)(OSPiHandle *, s32, u32, void *, u32);
} OSDevMgr;
/*
@@ -65,40 +69,42 @@ typedef struct {
*/
typedef struct {
int status;
OSMesgQueue *queue;
int channel;
u8 id[32];
u8 label[32];
int version;
int dir_size;
int inode_table; /* block location */
int minode_table; /* mirrioring inode_table */
int dir_table; /* block location */
int inode_start_page; /* page # */
u8 banks;
u8 activebank;
typedef struct
{
int status;
OSMesgQueue *queue;
int channel;
u8 id[32];
u8 label[32];
int version;
int dir_size;
int inode_table; /* block location */
int minode_table; /* mirrioring inode_table */
int dir_table; /* block location */
int inode_start_page; /* page # */
u8 banks;
u8 activebank;
} OSPfs;
typedef struct {
u32 file_size; /* bytes */
u32 game_code;
u16 company_code;
char ext_name[4];
char game_name[16];
typedef struct
{
u32 file_size; /* bytes */
u32 game_code;
u16 company_code;
char ext_name[4];
char game_name[16];
} OSPfsState;
/*
* Structure for Profiler
* Structure for Profiler
*/
typedef struct {
u16 *histo_base; /* histogram base */
u32 histo_size; /* histogram size */
u32 *text_start; /* start of text segment */
u32 *text_end; /* end of text segment */
typedef struct
{
u16 *histo_base; /* histogram base */
u32 histo_size; /* histogram size */
u32 *text_start; /* start of text segment */
u32 *text_end; /* end of text segment */
} OSProf;
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
@@ -239,7 +245,7 @@ typedef struct {
#define OS_MIN_STACKSIZE 72
/*
* Values for osTvType
* Values for osTvType
*/
#define OS_TV_PAL 0
#define OS_TV_NTSC 1
@@ -321,8 +327,8 @@ typedef struct {
#define OS_VI_BIT_NTSC 0x0400
#define OS_VI_BIT_PAL 0x0800
/*
* Leo Disk
/*
* Leo Disk
*/
/* transfer mode */
@@ -347,7 +353,7 @@ typedef struct {
#ifdef _HW_VERSION_1
#define CONT_FRAME_ERROR 0x2
#define CONT_COLLISION_ERROR 0x1
#endif
#endif
/* Controller type */
@@ -431,9 +437,9 @@ typedef struct {
#define PFS_ERR_NOPACK 1 /* no memory card is plugged or */
#define PFS_ERR_NEW_PACK 2 /* ram pack has been changed to a */
/* different one */
/* different one */
#define PFS_ERR_INCONSISTENT 3 /* need to run Pfschecker */
#define PFS_ERR_CONTRFAIL CONT_OVERRUN_ERROR
#define PFS_ERR_CONTRFAIL CONT_OVERRUN_ERROR
#define PFS_ERR_INVALID 5 /* invalid parameter or file not exist*/
#define PFS_ERR_BAD_DATA 6 /* the data read from pack are bad*/
#define PFS_DATA_FULL 7 /* no free pages on ram pack */
@@ -514,66 +520,65 @@ extern u64 osClockRate;
* Extern variables
*
*/
extern OSViMode osViModeTable[]; /* Global VI mode table */
extern OSViMode osViModeTable[]; /* Global VI mode table */
extern OSViMode osViModeNtscLpn1; /* Individual VI NTSC modes */
extern OSViMode osViModeNtscLpf1;
extern OSViMode osViModeNtscLan1;
extern OSViMode osViModeNtscLaf1;
extern OSViMode osViModeNtscLpn2;
extern OSViMode osViModeNtscLpf2;
extern OSViMode osViModeNtscLan2;
extern OSViMode osViModeNtscLaf2;
extern OSViMode osViModeNtscHpn1;
extern OSViMode osViModeNtscHpf1;
extern OSViMode osViModeNtscHan1;
extern OSViMode osViModeNtscHaf1;
extern OSViMode osViModeNtscHpn2;
extern OSViMode osViModeNtscHpf2;
extern OSViMode osViModeNtscLpn1; /* Individual VI NTSC modes */
extern OSViMode osViModeNtscLpf1;
extern OSViMode osViModeNtscLan1;
extern OSViMode osViModeNtscLaf1;
extern OSViMode osViModeNtscLpn2;
extern OSViMode osViModeNtscLpf2;
extern OSViMode osViModeNtscLan2;
extern OSViMode osViModeNtscLaf2;
extern OSViMode osViModeNtscHpn1;
extern OSViMode osViModeNtscHpf1;
extern OSViMode osViModeNtscHan1;
extern OSViMode osViModeNtscHaf1;
extern OSViMode osViModeNtscHpn2;
extern OSViMode osViModeNtscHpf2;
extern OSViMode osViModePalLpn1; /* Individual VI PAL modes */
extern OSViMode osViModePalLpf1;
extern OSViMode osViModePalLan1;
extern OSViMode osViModePalLaf1;
extern OSViMode osViModePalLpn2;
extern OSViMode osViModePalLpf2;
extern OSViMode osViModePalLan2;
extern OSViMode osViModePalLaf2;
extern OSViMode osViModePalHpn1;
extern OSViMode osViModePalHpf1;
extern OSViMode osViModePalHan1;
extern OSViMode osViModePalHaf1;
extern OSViMode osViModePalHpn2;
extern OSViMode osViModePalHpf2;
extern OSViMode osViModePalLpn1; /* Individual VI PAL modes */
extern OSViMode osViModePalLpf1;
extern OSViMode osViModePalLan1;
extern OSViMode osViModePalLaf1;
extern OSViMode osViModePalLpn2;
extern OSViMode osViModePalLpf2;
extern OSViMode osViModePalLan2;
extern OSViMode osViModePalLaf2;
extern OSViMode osViModePalHpn1;
extern OSViMode osViModePalHpf1;
extern OSViMode osViModePalHan1;
extern OSViMode osViModePalHaf1;
extern OSViMode osViModePalHpn2;
extern OSViMode osViModePalHpf2;
extern OSViMode osViModeMpalLpn1; /* Individual VI MPAL modes */
extern OSViMode osViModeMpalLpf1;
extern OSViMode osViModeMpalLan1;
extern OSViMode osViModeMpalLaf1;
extern OSViMode osViModeMpalLpn2;
extern OSViMode osViModeMpalLpf2;
extern OSViMode osViModeMpalLan2;
extern OSViMode osViModeMpalLaf2;
extern OSViMode osViModeMpalHpn1;
extern OSViMode osViModeMpalHpf1;
extern OSViMode osViModeMpalHan1;
extern OSViMode osViModeMpalHaf1;
extern OSViMode osViModeMpalHpn2;
extern OSViMode osViModeMpalHpf2;
extern OSViMode osViModeMpalLpn1; /* Individual VI MPAL modes */
extern OSViMode osViModeMpalLpf1;
extern OSViMode osViModeMpalLan1;
extern OSViMode osViModeMpalLaf1;
extern OSViMode osViModeMpalLpn2;
extern OSViMode osViModeMpalLpf2;
extern OSViMode osViModeMpalLan2;
extern OSViMode osViModeMpalLaf2;
extern OSViMode osViModeMpalHpn1;
extern OSViMode osViModeMpalHpf1;
extern OSViMode osViModeMpalHan1;
extern OSViMode osViModeMpalHaf1;
extern OSViMode osViModeMpalHpn2;
extern OSViMode osViModeMpalHpf2;
extern s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */
extern u32 osRomBase; /* Rom base address of the game image */
extern u32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */
extern u32 osResetType; /* 0 = cold reset, 1 = NMI */
extern s32 osCicId;
extern s32 osVersion;
extern u32 osMemSize; /* Memory Size */
extern s32 osAppNMIBuffer[];
extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */
extern OSPiHandle *__osPiTable; /* The head of OSPiHandle link list */
extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/
extern s32 osRomType; /* Bulk or cartridge ROM. 0=cartridge 1=bulk */
extern u32 osRomBase; /* Rom base address of the game image */
extern u32 osTvType; /* 0 = PAL, 1 = NTSC, 2 = MPAL */
extern u32 osResetType; /* 0 = cold reset, 1 = NMI */
extern s32 osCicId;
extern s32 osVersion;
extern u32 osMemSize; /* Memory Size */
extern s32 osAppNMIBuffer[];
extern OSIntMask __OSGlobalIntMask; /* global interrupt mask */
extern OSPiHandle *__osPiTable; /* The head of OSPiHandle link list */
extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/
/**************************************************************************
@@ -584,58 +589,59 @@ extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/
/* Thread operations */
extern void osCreateThread(OSThread *, OSId, void (*)(void *),
void *, void *, OSPri);
extern void osDestroyThread(OSThread *);
extern void osYieldThread(void);
extern void osStartThread(OSThread *);
extern void osStopThread(OSThread *);
extern OSId osGetThreadId(OSThread *);
extern void osSetThreadPri(OSThread *, OSPri);
extern OSPri osGetThreadPri(OSThread *);
extern void osCreateThread(
OSThread *, OSId, void (*)(void *),
void *, void *, OSPri);
extern void osDestroyThread(OSThread *);
extern void osYieldThread(void);
extern void osStartThread(OSThread *);
extern void osStopThread(OSThread *);
extern OSId osGetThreadId(OSThread *);
extern void osSetThreadPri(OSThread *, OSPri);
extern OSPri osGetThreadPri(OSThread *);
/* Message operations */
extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
/* Event operations */
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
/* Interrupt operations */
extern OSIntMask osGetIntMask(void);
extern OSIntMask osSetIntMask(OSIntMask);
extern OSIntMask osGetIntMask(void);
extern OSIntMask osSetIntMask(OSIntMask);
/* RDB port operations */
extern void osInitRdb(u8 *sendBuf, u32 sendSize);
extern void osInitRdb(u8 *sendBuf, u32 sendSize);
/* Cache operations and macros */
extern void osInvalDCache(void *, size_t);
extern void osInvalICache(void *, size_t);
extern void osWritebackDCache(void *, size_t);
extern void osWritebackDCacheAll(void);
extern void osInvalDCache(void *, size_t);
extern void osInvalICache(void *, size_t);
extern void osWritebackDCache(void *, size_t);
extern void osWritebackDCacheAll(void);
#define OS_DCACHE_ROUNDUP_ADDR(x) (void *)(((((u32)(x)+0xf)/0x10)*0x10))
#define OS_DCACHE_ROUNDUP_SIZE(x) (u32)(((((u32)(x)+0xf)/0x10)*0x10))
/* TLB management routines */
extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32);
extern void osMapTLBRdb(void);
extern void osUnmapTLB(s32);
extern void osUnmapTLBAll(void);
extern void osSetTLBASID(s32);
extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32);
extern void osMapTLBRdb(void);
extern void osUnmapTLB(s32);
extern void osUnmapTLBAll(void);
extern void osSetTLBASID(s32);
/* Address translation routines and macros */
extern u32 osVirtualToPhysical(void *);
extern void * osPhysicalToVirtual(u32);
extern u32 osVirtualToPhysical(void *);
extern void *osPhysicalToVirtual(u32);
#define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000))
#define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000))
@@ -646,66 +652,68 @@ extern void * osPhysicalToVirtual(u32);
/* I/O operations */
/* Audio interface (Ai) */
extern u32 osAiGetStatus(void);
extern u32 osAiGetLength(void);
extern s32 osAiSetFrequency(u32);
extern s32 osAiSetNextBuffer(void *, u32);
extern u32 osAiGetStatus(void);
extern u32 osAiGetLength(void);
extern s32 osAiSetFrequency(u32);
extern s32 osAiSetNextBuffer(void *, u32);
/* Display processor interface (Dp) */
extern u32 osDpGetStatus(void);
extern void osDpSetStatus(u32);
extern void osDpGetCounters(u32 *);
extern s32 osDpSetNextBuffer(void *, u64);
extern u32 osDpGetStatus(void);
extern void osDpSetStatus(u32);
extern void osDpGetCounters(u32 *);
extern s32 osDpSetNextBuffer(void *, u64);
/* Peripheral interface (Pi) */
extern u32 osPiGetStatus(void);
extern s32 osPiGetDeviceType(void);
extern s32 osPiRawWriteIo(u32, u32);
extern s32 osPiRawReadIo(u32, u32 *);
extern s32 osPiRawStartDma(s32, u32, void *, u32);
extern s32 osPiWriteIo(u32, u32);
extern s32 osPiReadIo(u32, u32 *);
extern s32 osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32,
OSMesgQueue *);
extern void osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32);
extern u32 osPiGetStatus(void);
extern s32 osPiGetDeviceType(void);
extern s32 osPiRawWriteIo(u32, u32);
extern s32 osPiRawReadIo(u32, u32 *);
extern s32 osPiRawStartDma(s32, u32, void *, u32);
extern s32 osPiWriteIo(u32, u32);
extern s32 osPiReadIo(u32, u32 *);
extern s32 osPiStartDma(
OSIoMesg *, s32, s32, u32, void *, u32,
OSMesgQueue *);
extern void osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32);
/* Video interface (Vi) */
extern u32 osViGetStatus(void);
extern u32 osViGetCurrentMode(void);
extern u32 osViGetCurrentLine(void);
extern u32 osViGetCurrentField(void);
extern void *osViGetCurrentFramebuffer(void);
extern void *osViGetNextFramebuffer(void);
extern void osViSetXScale(f32);
extern void osViSetYScale(f32);
extern void osViSetSpecialFeatures(u32);
extern void osViSetMode(OSViMode *);
extern void osViSetEvent(OSMesgQueue *, OSMesg, u32);
extern void osViSwapBuffer(void *);
extern void osViBlack(u8);
extern void osViFade(u8, u16);
extern void osViRepeatLine(u8);
extern void osCreateViManager(OSPri);
extern u32 osViGetStatus(void);
extern u32 osViGetCurrentMode(void);
extern u32 osViGetCurrentLine(void);
extern u32 osViGetCurrentField(void);
extern void *osViGetCurrentFramebuffer(void);
extern void *osViGetNextFramebuffer(void);
extern void osViSetXScale(f32);
extern void osViSetYScale(f32);
extern void osViSetSpecialFeatures(u32);
extern void osViSetMode(OSViMode *);
extern void osViSetEvent(OSMesgQueue *, OSMesg, u32);
extern void osViSwapBuffer(void *);
extern void osViBlack(u8);
extern void osViFade(u8, u16);
extern void osViRepeatLine(u8);
extern void osCreateViManager(OSPri);
/* Timer interface */
extern OSTime osGetTime(void);
extern void osSetTime(OSTime);
extern u32 osSetTimer(OSTimer *, OSTime, OSTime,
OSMesgQueue *, OSMesg);
extern int osStopTimer(OSTimer *);
extern OSTime osGetTime(void);
extern void osSetTime(OSTime);
extern u32 osSetTimer(
OSTimer *, OSTime, OSTime,
OSMesgQueue *, OSMesg);
extern int osStopTimer(OSTimer *);
/* Controller interface */
extern s32 osContInit(OSMesgQueue *, u8 *, OSContStatus *);
extern s32 osContReset(OSMesgQueue *, OSContStatus *);
extern s32 osContStartQuery(OSMesgQueue *);
extern s32 osContStartReadData(OSMesgQueue *);
extern s32 osContInit(OSMesgQueue *, u8 *, OSContStatus *);
extern s32 osContReset(OSMesgQueue *, OSContStatus *);
extern s32 osContStartQuery(OSMesgQueue *);
extern s32 osContStartReadData(OSMesgQueue *);
#ifndef _HW_VERSION_1
extern s32 osContSetCh(u8);
extern s32 osContSetCh(u8);
#endif
extern void osContGetQuery(OSContStatus *);
extern void osContGetReadData(OSContPad *);
extern void osContGetQuery(OSContStatus *);
extern void osContGetReadData(OSContPad *);
/* file system interface */
@@ -746,50 +754,50 @@ extern OSPiHandle *osLeoDiskInit(void);
extern OSPiHandle *osDriveRomInit(void);
extern s32 osEPiDeviceType(OSPiHandle *, OSPiInfo *);
extern s32 osEPiRawWriteIo(OSPiHandle *, u32 , u32);
extern s32 osEPiRawReadIo(OSPiHandle *, u32 , u32 *);
extern s32 osEPiRawStartDma(OSPiHandle *, s32 , u32 , void *, u32 );
extern s32 osEPiWriteIo(OSPiHandle *, u32 , u32 );
extern s32 osEPiReadIo(OSPiHandle *, u32 , u32 *);
extern s32 osEPiRawWriteIo(OSPiHandle *, u32, u32);
extern s32 osEPiRawReadIo(OSPiHandle *, u32, u32 *);
extern s32 osEPiRawStartDma(OSPiHandle *, s32, u32, void *, u32);
extern s32 osEPiWriteIo(OSPiHandle *, u32, u32);
extern s32 osEPiReadIo(OSPiHandle *, u32, u32 *);
extern s32 osEPiStartDma(OSPiHandle *, OSIoMesg *, s32);
extern s32 osEPiLinkHandle(OSPiHandle *);
/* Profiler Interface */
extern void osProfileInit(OSProf *, u32 profcnt);
extern void osProfileStart(u32);
extern void osProfileFlush(void);
extern void osProfileStop(void);
extern void osProfileInit(OSProf *, u32 profcnt);
extern void osProfileStart(u32);
extern void osProfileFlush(void);
extern void osProfileStop(void);
/* Game <> Host data transfer functions */
extern s32 osTestHost(void);
extern void osReadHost(void *, u32);
extern void osWriteHost(void *, u32);
extern void osAckRamromRead(void);
extern void osAckRamromWrite(void);
extern s32 osTestHost(void);
extern void osReadHost(void *, u32);
extern void osWriteHost(void *, u32);
extern void osAckRamromRead(void);
extern void osAckRamromWrite(void);
/* byte string operations */
extern void bcopy(const void *, void *, size_t);
extern int bcmp(const void *, const void *, int);
extern void bzero(void *, size_t);
extern void bcopy(const void *, void *, size_t);
extern int bcmp(const void *, const void *, int);
extern void bzero(void *, size_t);
/* Miscellaneous operations */
extern void osInitialize(void);
extern u32 osGetCount(void);
extern void osExit(void);
extern u32 osGetMemSize(void);
extern void osInitialize(void);
extern u32 osGetCount(void);
extern void osExit(void);
extern u32 osGetMemSize(void);
/* Printf */
extern int sprintf(char *s, const char *fmt, ...);
extern void osSyncPrintf(const char *fmt, ...);
extern void osAsyncPrintf(const char *fmt, ...);
extern int osSyncGetChars(char *buf);
extern int osAsyncGetChars(char *buf);
extern int sprintf(char *s, const char *fmt, ...);
extern void osSyncPrintf(const char *fmt, ...);
extern void osAsyncPrintf(const char *fmt, ...);
extern int osSyncGetChars(char *buf);
extern int osAsyncGetChars(char *buf);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+7 -5
View File
@@ -31,7 +31,9 @@
#define _OS_AI_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -77,10 +79,10 @@ extern "C" {
*/
/* Audio interface (Ai) */
extern u32 osAiGetStatus(void);
extern u32 osAiGetLength(void);
extern s32 osAiSetFrequency(u32);
extern s32 osAiSetNextBuffer(void *, u32);
extern u32 osAiGetStatus(void);
extern u32 osAiGetLength(void);
extern s32 osAiSetFrequency(u32);
extern s32 osAiSetNextBuffer(void *, u32);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+7 -5
View File
@@ -31,7 +31,9 @@
#define _OS_CACHE_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -81,10 +83,10 @@ extern "C" {
/* Cache operations and macros */
extern void osInvalDCache(void *, size_t);
extern void osInvalICache(void *, size_t);
extern void osWritebackDCache(void *, size_t);
extern void osWritebackDCacheAll(void);
extern void osInvalDCache(void *, size_t);
extern void osInvalICache(void *, size_t);
extern void osWritebackDCache(void *, size_t);
extern void osWritebackDCacheAll(void);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+24 -19
View File
@@ -31,7 +31,9 @@
#define _OS_CONT_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -47,28 +49,31 @@ extern "C" {
*/
/*
* Structure for controllers
* Structure for controllers
*/
typedef struct {
u16 type; /* Controller Type */
u8 status; /* Controller status */
u8 errnum;
}OSContStatus;
typedef struct
{
u16 type; /* Controller Type */
u8 status; /* Controller status */
u8 errnum;
} OSContStatus;
typedef struct {
u16 button;
s8 stick_x; /* -80 <= stick_x <= 80 */
s8 stick_y; /* -80 <= stick_y <= 80 */
u8 errnum;
typedef struct
{
u16 button;
s8 stick_x; /* -80 <= stick_x <= 80 */
s8 stick_y; /* -80 <= stick_y <= 80 */
u8 errnum;
} OSContPad;
typedef struct {
void *address; /* Ram pad Address: 11 bits */
u8 databuffer[32]; /* address of the data buffer */
u8 addressCrc; /* CRC code for address */
u8 dataCrc; /* CRC code for data */
u8 errnum;
typedef struct
{
void *address; /* Ram pad Address: 11 bits */
u8 databuffer[32]; /* address of the data buffer */
u8 addressCrc; /* CRC code for address */
u8 dataCrc; /* CRC code for data */
u8 errnum;
} OSContRamIo;
@@ -96,7 +101,7 @@ typedef struct {
#ifdef _HW_VERSION_1
#define CONT_FRAME_ERROR 0x2
#define CONT_COLLISION_ERROR 0x1
#endif
#endif
/* Controller type */
+3 -1
View File
@@ -31,7 +31,9 @@
#define _OS_EEPROM_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
+5 -3
View File
@@ -31,7 +31,9 @@
#define _OS_EXCEPTION_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -106,8 +108,8 @@ typedef u32 OSHWIntr;
/* Interrupt operations */
extern OSIntMask osGetIntMask(void);
extern OSIntMask osSetIntMask(OSIntMask);
extern OSIntMask osGetIntMask(void);
extern OSIntMask osSetIntMask(OSIntMask);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+1
View File
@@ -8,6 +8,7 @@
// Old deprecated functions from strings.h, replaced by memcpy/memset.
extern void bcopy(const void *, void *, size_t);
extern void bzero(void *, size_t);
#endif
+17 -14
View File
@@ -31,7 +31,9 @@
#define _OS_MESSAGE_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -50,20 +52,21 @@ typedef u32 OSEvent;
/*
* Structure for message
*/
typedef void * OSMesg;
typedef void *OSMesg;
/*
* Structure for message queue
*/
typedef struct OSMesgQueue_s {
OSThread *mtqueue; /* Queue to store threads blocked
typedef struct OSMesgQueue_s
{
OSThread *mtqueue; /* Queue to store threads blocked
on empty mailboxes (receive) */
OSThread *fullqueue; /* Queue to store threads blocked
OSThread *fullqueue; /* Queue to store threads blocked
on full mailboxes (send) */
s32 validCount; /* Contains number of valid message */
s32 first; /* Points to first valid message */
s32 msgCount; /* Contains total # of messages */
OSMesg *msg; /* Points to message buffer array */
s32 validCount; /* Contains number of valid message */
s32 first; /* Points to first valid message */
s32 msgCount; /* Contains total # of messages */
OSMesg *msg; /* Points to message buffer array */
} OSMesgQueue;
@@ -145,14 +148,14 @@ typedef struct OSMesgQueue_s {
/* Message operations */
extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
extern void osCreateMesgQueue(OSMesgQueue *, OSMesg *, s32);
extern s32 osSendMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osJamMesg(OSMesgQueue *, OSMesg, s32);
extern s32 osRecvMesg(OSMesgQueue *, OSMesg *, s32);
/* Event operations */
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
extern void osSetEventMesg(OSEvent, OSMesgQueue *, OSMesg);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+1
View File
@@ -4,6 +4,7 @@
/* Miscellaneous OS functions */
void osInitialize(void);
u32 osGetCount(void);
uintptr_t osVirtualToPhysical(void *);
+40 -24
View File
@@ -6,10 +6,11 @@
/* Types */
typedef struct {
#if !defined(VERSION_EU)
typedef struct
{
#if !defined(VERSION_EU)
u32 errStatus;
#endif
#endif
void *dramAddr;
void *C2Addr;
u32 sectorSize;
@@ -17,21 +18,23 @@ typedef struct {
u32 C1ErrSector[4];
} __OSBlockInfo;
typedef struct {
u32 cmdType; // 0
u16 transferMode; // 4
u16 blockNum; // 6
s32 sectorNum; // 8
typedef struct
{
u32 cmdType; // 0
u16 transferMode; // 4
u16 blockNum; // 6
s32 sectorNum; // 8
uintptr_t devAddr; // c
#if defined(VERSION_EU)
#if defined(VERSION_EU)
u32 errStatus; //error status added moved to blockinfo
#endif
u32 bmCtlShadow; // 10
u32 seqCtlShadow; // 14
#endif
u32 bmCtlShadow; // 10
u32 seqCtlShadow; // 14
__OSBlockInfo block[2]; // 18
} __OSTranxInfo;
typedef struct OSPiHandle_s {
typedef struct OSPiHandle_s
{
struct OSPiHandle_s *next;
u8 type;
u8 latency;
@@ -44,26 +47,33 @@ typedef struct OSPiHandle_s {
__OSTranxInfo transferInfo;
} OSPiHandle;
typedef struct {
typedef struct
{
u8 type;
uintptr_t address;
} OSPiInfo;
typedef struct {
typedef struct
{
u16 type;
u8 pri;
u8 status;
OSMesgQueue *retQueue;
} OSIoMesgHdr;
typedef struct {
/*0x00*/ OSIoMesgHdr hdr;
/*0x08*/ void *dramAddr;
/*0x0C*/ uintptr_t devAddr;
/*0x10*/ size_t size;
#if defined(VERSION_EU) || defined(VERSION_SH)
typedef struct
{
/*0x00*/
OSIoMesgHdr hdr;
/*0x08*/
void *dramAddr;
/*0x0C*/
uintptr_t devAddr;
/*0x10*/
size_t size;
#if defined(VERSION_EU) || defined(VERSION_SH)
OSPiHandle *piHandle; // from the official definition
#endif
#endif
} OSIoMesg;
/* Definitions */
@@ -76,13 +86,19 @@ typedef struct {
/* Functions */
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr,
size_t nbytes, OSMesgQueue *mq);
s32 osPiStartDma(
OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr,
size_t nbytes, OSMesgQueue *mq);
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt);
OSMesgQueue *osPiGetCmdQueue(void);
s32 osPiWriteIo(uintptr_t devAddr, u32 data);
s32 osPiReadIo(uintptr_t devAddr, u32 *data);
s32 osPiRawStartDma(s32 dir, u32 cart_addr, void *dram_addr, size_t size);
s32 osEPiRawStartDma(OSPiHandle *piHandle, s32 dir, u32 cart_addr, void *dram_addr, size_t size);
#endif
+7 -5
View File
@@ -31,7 +31,9 @@
#define _OS_RDP_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -77,10 +79,10 @@ extern "C" {
*/
/* Display processor interface (Dp) */
extern u32 osDpGetStatus(void);
extern void osDpSetStatus(u32);
extern void osDpGetCounters(u32 *);
extern s32 osDpSetNextBuffer(void *, u64);
extern u32 osDpGetStatus(void);
extern void osDpSetStatus(u32);
extern void osDpGetCounters(u32 *);
extern s32 osDpSetNextBuffer(void *, u64);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+47 -20
View File
@@ -23,20 +23,31 @@ typedef s32 OSId;
typedef union
{
struct {f32 f_odd; f32 f_even;} f;
struct
{
f32 f_odd;
f32 f_even;
} f;
} __OSfp;
typedef struct
{
/* registers */
/*0x20*/ u64 at, v0, v1, a0, a1, a2, a3;
/*0x58*/ u64 t0, t1, t2, t3, t4, t5, t6, t7;
/*0x98*/ u64 s0, s1, s2, s3, s4, s5, s6, s7;
/*0xD8*/ u64 t8, t9, gp, sp, s8, ra;
/*0x108*/ u64 lo, hi;
/*0x118*/ u32 sr, pc, cause, badvaddr, rcp;
/*0x12C*/ u32 fpcsr;
__OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
/*0x20*/
u64 at, v0, v1, a0, a1, a2, a3;
/*0x58*/
u64 t0, t1, t2, t3, t4, t5, t6, t7;
/*0x98*/
u64 s0, s1, s2, s3, s4, s5, s6, s7;
/*0xD8*/
u64 t8, t9, gp, sp, s8, ra;
/*0x108*/
u64 lo, hi;
/*0x118*/
u32 sr, pc, cause, badvaddr, rcp;
/*0x12C*/
u32 fpcsr;
__OSfp fp0, fp2, fp4, fp6, fp8, fp10, fp12, fp14;
__OSfp fp16, fp18, fp20, fp22, fp24, fp26, fp28, fp30;
} __OSThreadContext;
@@ -49,27 +60,43 @@ typedef struct
typedef struct OSThread_s
{
/*0x00*/ struct OSThread_s *next;
/*0x04*/ OSPri priority;
/*0x08*/ struct OSThread_s **queue;
/*0x0C*/ struct OSThread_s *tlnext;
/*0x10*/ u16 state;
/*0x12*/ u16 flags;
/*0x14*/ OSId id;
/*0x18*/ int fp;
/*0x1C*/ __OSThreadprofile_s *thprof;
/*0x20*/ __OSThreadContext context;
/*0x00*/
struct OSThread_s *next;
/*0x04*/
OSPri priority;
/*0x08*/
struct OSThread_s **queue;
/*0x0C*/
struct OSThread_s *tlnext;
/*0x10*/
u16 state;
/*0x12*/
u16 flags;
/*0x14*/
OSId id;
/*0x18*/
int fp;
/*0x1C*/
__OSThreadprofile_s *thprof;
/*0x20*/
__OSThreadContext context;
} OSThread;
/* Functions */
void osCreateThread(OSThread *thread, OSId id, void (*entry)(void *),
void osCreateThread(
OSThread *thread, OSId id, void (*entry)(void *),
void *arg, void *sp, OSPri pri);
OSId osGetThreadId(OSThread *thread);
OSPri osGetThreadPri(OSThread *thread);
void osSetThreadPri(OSThread *thread, OSPri pri);
void osStartThread(OSThread *thread);
void osStopThread(OSThread *thread);
#endif
+2
View File
@@ -21,7 +21,9 @@ typedef u64 OSTime;
/* Functions */
OSTime osGetTime(void);
void osSetTime(OSTime time);
u32 osSetTimer(OSTimer *, OSTime, OSTime, OSMesgQueue *, OSMesg);
#endif
+8 -6
View File
@@ -31,7 +31,9 @@
#define _OS_TLB_H_
#ifdef _LANGUAGE_C_PLUS_PLUS
extern "C" {
extern "C"
{
#endif
#include "ultratypes.h"
@@ -91,11 +93,11 @@ typedef u32 OSPageMask;
/* TLB management routines */
extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32);
extern void osMapTLBRdb(void);
extern void osUnmapTLB(s32);
extern void osUnmapTLBAll(void);
extern void osSetTLBASID(s32);
extern void osMapTLB(s32, OSPageMask, void *, u32, u32, s32);
extern void osMapTLBRdb(void);
extern void osUnmapTLB(s32);
extern void osUnmapTLBAll(void);
extern void osSetTLBASID(s32);
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
+32 -14
View File
@@ -58,26 +58,44 @@ typedef struct
typedef struct
{
/* 0x00 */ u16 unk00; //some kind of flags. swap buffer sets to 0x10
/* 0x02 */ u16 retraceCount;
/* 0x04 */ void* buffer;
/* 0x08 */ OSViMode *modep;
/* 0x0c */ u32 features;
/* 0x10 */ OSMesgQueue *mq;
/* 0x14 */ OSMesg *msg;
/* 0x18 */ u32 unk18;
/* 0x1c */ u32 unk1c;
/* 0x20 */ u32 unk20;
/* 0x24 */ f32 unk24;
/* 0x28 */ u16 unk28;
/* 0x2c */ u32 unk2c;
/* 0x00 */
u16 unk00; //some kind of flags. swap buffer sets to 0x10
/* 0x02 */
u16 retraceCount;
/* 0x04 */
void *buffer;
/* 0x08 */
OSViMode *modep;
/* 0x0c */
u32 features;
/* 0x10 */
OSMesgQueue *mq;
/* 0x14 */
OSMesg *msg;
/* 0x18 */
u32 unk18;
/* 0x1c */
u32 unk1c;
/* 0x20 */
u32 unk20;
/* 0x24 */
f32 unk24;
/* 0x28 */
u16 unk28;
/* 0x2c */
u32 unk2c;
} OSViContext;
void osCreateViManager(OSPri pri);
void osViSetMode(OSViMode *mode);
void osViSetEvent(OSMesgQueue *mq, OSMesg msg, u32 retraceCount);
void osViBlack(u8 active);
void osViSetSpecialFeatures(u32 func);
void osViSwapBuffer(void *vaddr);
@@ -111,7 +129,7 @@ void osViSwapBuffer(void *vaddr);
#define OS_VI_PAL_HPN2 26
#define OS_VI_PAL_HPF2 27
extern OSViMode osViModeTable[]; /* Global VI mode table */
extern OSViMode osViModeTable[]; /* Global VI mode table */
#endif
+37 -17
View File
@@ -70,32 +70,49 @@
typedef struct
{
/*0x00*/ u32 type;
/*0x04*/ u32 flags;
/*0x00*/
u32 type;
/*0x04*/
u32 flags;
/*0x08*/ u64 *ucode_boot;
/*0x0C*/ u32 ucode_boot_size;
/*0x08*/
u64 *ucode_boot;
/*0x0C*/
u32 ucode_boot_size;
/*0x10*/ u64 *ucode;
/*0x14*/ u32 ucode_size;
/*0x10*/
u64 *ucode;
/*0x14*/
u32 ucode_size;
/*0x18*/ u64 *ucode_data;
/*0x1C*/ u32 ucode_data_size;
/*0x18*/
u64 *ucode_data;
/*0x1C*/
u32 ucode_data_size;
/*0x20*/ u64 *dram_stack;
/*0x24*/ u32 dram_stack_size;
/*0x20*/
u64 *dram_stack;
/*0x24*/
u32 dram_stack_size;
/*0x28*/ u64 *output_buff;
/*0x2C*/ u64 *output_buff_size;
/*0x28*/
u64 *output_buff;
/*0x2C*/
u64 *output_buff_size;
/*0x30*/ u64 *data_ptr;
/*0x34*/ u32 data_size;
/*0x30*/
u64 *data_ptr;
/*0x34*/
u32 data_size;
/*0x38*/ u64 *yield_data_ptr;
/*0x3C*/ u32 yield_data_size;
/*0x38*/
u64 *yield_data_ptr;
/*0x3C*/
u32 yield_data_size;
} OSTask_t; // size = 0x40
typedef union {
typedef union
{
OSTask_t t;
long long int force_structure_alignment;
} OSTask;
@@ -109,8 +126,11 @@ typedef u32 OSYieldResult;
osSpTaskStartGo(p);
void osSpTaskLoad(OSTask *task);
void osSpTaskStartGo(OSTask *task);
void osSpTaskYield(void);
OSYieldResult osSpTaskYielded(OSTask *task);
#endif
+12 -12
View File
@@ -1,32 +1,32 @@
#ifndef _ULTRA64_TYPES_H_
#define _ULTRA64_TYPES_H_
#ifndef NULL
#define NULL (void *)0
#ifndef nullptr
#define nullptr (void *)0
#endif
#define TRUE 1
#define FALSE 0
typedef signed char s8;
typedef unsigned char u8;
typedef signed short int s16;
typedef unsigned short int u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long long int s64;
typedef signed char s8;
typedef unsigned char u8;
typedef signed short int s16;
typedef unsigned short int u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long long int s64;
typedef unsigned long long int u64;
typedef volatile u8 vu8;
typedef volatile u8 vu8;
typedef volatile u16 vu16;
typedef volatile u32 vu32;
typedef volatile u64 vu64;
typedef volatile s8 vs8;
typedef volatile s8 vs8;
typedef volatile s16 vs16;
typedef volatile s32 vs32;
typedef volatile s64 vs64;
typedef float f32;
typedef float f32;
typedef double f64;
#ifdef TARGET_N64
+426 -213
View File
@@ -117,47 +117,72 @@
#define SOUND_ACTION_HANGING_STEP SOUND_ARG_LOAD(0, 4, 0x2D, 0xA0, 8)
#define SOUND_ACTION_QUICKSAND_STEP SOUND_ARG_LOAD(0, 4, 0x2E, 0x00, 8)
#define SOUND_ACTION_METAL_STEP_TIPTOE SOUND_ARG_LOAD(0, 4, 0x2F, 0x90, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN430 SOUND_ARG_LOAD(0, 4, 0x30, 0xC0, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN431 SOUND_ARG_LOAD(0, 4, 0x31, 0x60, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN432 SOUND_ARG_LOAD(0, 4, 0x32, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN430 SOUND_ARG_LOAD(0, 4, 0x30, 0xC0, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN431 SOUND_ARG_LOAD(0, 4, 0x31, 0x60, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN432 SOUND_ARG_LOAD(0, 4, 0x32, 0x80, 8)
#define SOUND_ACTION_SWIM SOUND_ARG_LOAD(0, 4, 0x33, 0x80, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN434 SOUND_ARG_LOAD(0, 4, 0x34, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN434 SOUND_ARG_LOAD(0, 4, 0x34, 0x80, 8)
#define SOUND_ACTION_THROW SOUND_ARG_LOAD(0, 4, 0x35, 0x80, 8)
#define SOUND_ACTION_KEY_SWISH SOUND_ARG_LOAD(0, 4, 0x36, 0x80, 8)
#define SOUND_ACTION_SPIN SOUND_ARG_LOAD(0, 4, 0x37, 0x80, 8)
#define SOUND_ACTION_TWIRL SOUND_ARG_LOAD(0, 4, 0x38, 0x80, 8) // same sound as spin
/* not verified */ #define SOUND_ACTION_CLIMB_UP_TREE SOUND_ARG_LOAD(0, 4, 0x3A, 0x80, 8)
/* not verified */ #define SOUND_ACTION_CLIMB_DOWN_TREE 0x003B
/* not verified */ #define SOUND_ACTION_UNK3C 0x003C
/* not verified */ #define SOUND_ACTION_UNKNOWN43D SOUND_ARG_LOAD(0, 4, 0x3D, 0x80, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN43E SOUND_ARG_LOAD(0, 4, 0x3E, 0x80, 8)
/* not verified */ #define SOUND_ACTION_PAT_BACK SOUND_ARG_LOAD(0, 4, 0x3F, 0x80, 8)
/* not verified */
#define SOUND_ACTION_CLIMB_UP_TREE SOUND_ARG_LOAD(0, 4, 0x3A, 0x80, 8)
/* not verified */
#define SOUND_ACTION_CLIMB_DOWN_TREE 0x003B
/* not verified */
#define SOUND_ACTION_UNK3C 0x003C
/* not verified */
#define SOUND_ACTION_UNKNOWN43D SOUND_ARG_LOAD(0, 4, 0x3D, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN43E SOUND_ARG_LOAD(0, 4, 0x3E, 0x80, 8)
/* not verified */
#define SOUND_ACTION_PAT_BACK SOUND_ARG_LOAD(0, 4, 0x3F, 0x80, 8)
#define SOUND_ACTION_BRUSH_HAIR SOUND_ARG_LOAD(0, 4, 0x40, 0x80, 8)
/* not verified */ #define SOUND_ACTION_CLIMB_UP_POLE SOUND_ARG_LOAD(0, 4, 0x41, 0x80, 8)
/* not verified */
#define SOUND_ACTION_CLIMB_UP_POLE SOUND_ARG_LOAD(0, 4, 0x41, 0x80, 8)
#define SOUND_ACTION_METAL_BONK SOUND_ARG_LOAD(0, 4, 0x42, 0x80, 8)
#define SOUND_ACTION_UNSTUCK_FROM_GROUND SOUND_ARG_LOAD(0, 4, 0x43, 0x80, 8)
/* not verified */ #define SOUND_ACTION_HIT SOUND_ARG_LOAD(0, 4, 0x44, 0xC0, 8)
/* not verified */ #define SOUND_ACTION_HIT_2 SOUND_ARG_LOAD(0, 4, 0x44, 0xB0, 8)
/* not verified */ #define SOUND_ACTION_HIT_3 SOUND_ARG_LOAD(0, 4, 0x44, 0xA0, 8)
/* not verified */
#define SOUND_ACTION_HIT SOUND_ARG_LOAD(0, 4, 0x44, 0xC0, 8)
/* not verified */
#define SOUND_ACTION_HIT_2 SOUND_ARG_LOAD(0, 4, 0x44, 0xB0, 8)
/* not verified */
#define SOUND_ACTION_HIT_3 SOUND_ARG_LOAD(0, 4, 0x44, 0xA0, 8)
#define SOUND_ACTION_BONK SOUND_ARG_LOAD(0, 4, 0x45, 0xA0, 8)
#define SOUND_ACTION_SHRINK_INTO_BBH SOUND_ARG_LOAD(0, 4, 0x46, 0xA0, 8)
#define SOUND_ACTION_SWIM_FAST SOUND_ARG_LOAD(0, 4, 0x47, 0xA0, 8)
#define SOUND_ACTION_METAL_JUMP_WATER SOUND_ARG_LOAD(0, 4, 0x50, 0x90, 8)
#define SOUND_ACTION_METAL_LAND_WATER SOUND_ARG_LOAD(0, 4, 0x51, 0x90, 8)
#define SOUND_ACTION_METAL_STEP_WATER SOUND_ARG_LOAD(0, 4, 0x52, 0x90, 8)
/* not verified */ #define SOUND_ACTION_UNK53 0x0053
/* not verified */ #define SOUND_ACTION_UNK54 0x0054
/* not verified */ #define SOUND_ACTION_UNK55 0x0055
/* not verified */ #define SOUND_ACTION_FLYING_FAST SOUND_ARG_LOAD(0, 4, 0x56, 0x80, 8) // "swoop"?
/* not verified */
#define SOUND_ACTION_UNK53 0x0053
/* not verified */
#define SOUND_ACTION_UNK54 0x0054
/* not verified */
#define SOUND_ACTION_UNK55 0x0055
/* not verified */
#define SOUND_ACTION_FLYING_FAST SOUND_ARG_LOAD(0, 4, 0x56, 0x80, 8) // "swoop"?
#define SOUND_ACTION_TELEPORT SOUND_ARG_LOAD(0, 4, 0x57, 0xC0, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN458 SOUND_ARG_LOAD(0, 4, 0x58, 0xA0, 8)
/* not verified */ #define SOUND_ACTION_BOUNCE_OFF_OBJECT SOUND_ARG_LOAD(0, 4, 0x59, 0xB0, 8)
/* not verified */ #define SOUND_ACTION_SIDE_FLIP_UNK SOUND_ARG_LOAD(0, 4, 0x5A, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN458 SOUND_ARG_LOAD(0, 4, 0x58, 0xA0, 8)
/* not verified */
#define SOUND_ACTION_BOUNCE_OFF_OBJECT SOUND_ARG_LOAD(0, 4, 0x59, 0xB0, 8)
/* not verified */
#define SOUND_ACTION_SIDE_FLIP_UNK SOUND_ARG_LOAD(0, 4, 0x5A, 0x80, 8)
#define SOUND_ACTION_READ_SIGN SOUND_ARG_LOAD(0, 4, 0x5B, 0xFF, 8)
/* not verified */ #define SOUND_ACTION_UNKNOWN45C SOUND_ARG_LOAD(0, 4, 0x5C, 0x80, 8)
/* not verified */ #define SOUND_ACTION_UNK5D 0x005D
/* not verified */ #define SOUND_ACTION_INTRO_UNK45E SOUND_ARG_LOAD(0, 4, 0x5E, 0x80, 8)
/* not verified */ #define SOUND_ACTION_INTRO_UNK45F SOUND_ARG_LOAD(0, 4, 0x5F, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNKNOWN45C SOUND_ARG_LOAD(0, 4, 0x5C, 0x80, 8)
/* not verified */
#define SOUND_ACTION_UNK5D 0x005D
/* not verified */
#define SOUND_ACTION_INTRO_UNK45E SOUND_ARG_LOAD(0, 4, 0x5E, 0x80, 8)
/* not verified */
#define SOUND_ACTION_INTRO_UNK45F SOUND_ARG_LOAD(0, 4, 0x5F, 0x80, 8)
/* Moving Sound Effects */
@@ -180,27 +205,45 @@
/* Mario Sound Effects */
// A random number 0-2 is added to the sound ID before playing, producing Yah/Wah/Hoo
#define SOUND_MARIO_YAH_WAH_HOO SOUND_ARG_LOAD(2, 4, 0x00, 0x80, 8)
/* not verified */ #define SOUND_MARIO_HOOHOO SOUND_ARG_LOAD(2, 4, 0x03, 0x80, 8)
/* not verified */ #define SOUND_MARIO_YAHOO SOUND_ARG_LOAD(2, 4, 0x04, 0x80, 8)
/* not verified */ #define SOUND_MARIO_UH SOUND_ARG_LOAD(2, 4, 0x05, 0x80, 8)
/* not verified */ #define SOUND_MARIO_HRMM SOUND_ARG_LOAD(2, 4, 0x06, 0x80, 8)
/* not verified */ #define SOUND_MARIO_WAH2 SOUND_ARG_LOAD(2, 4, 0x07, 0x80, 8)
/* not verified */ #define SOUND_MARIO_WHOA SOUND_ARG_LOAD(2, 4, 0x08, 0xC0, 8)
/* not verified */ #define SOUND_MARIO_EEUH SOUND_ARG_LOAD(2, 4, 0x09, 0x80, 8)
/* not verified */ #define SOUND_MARIO_ATTACKED SOUND_ARG_LOAD(2, 4, 0x0A, 0xFF, 8)
/* not verified */ #define SOUND_MARIO_OOOF SOUND_ARG_LOAD(2, 4, 0x0B, 0x80, 8)
/* not verified */ #define SOUND_MARIO_OOOF2 SOUND_ARG_LOAD(2, 4, 0x0B, 0xD0, 8)
/* not verified */
#define SOUND_MARIO_HOOHOO SOUND_ARG_LOAD(2, 4, 0x03, 0x80, 8)
/* not verified */
#define SOUND_MARIO_YAHOO SOUND_ARG_LOAD(2, 4, 0x04, 0x80, 8)
/* not verified */
#define SOUND_MARIO_UH SOUND_ARG_LOAD(2, 4, 0x05, 0x80, 8)
/* not verified */
#define SOUND_MARIO_HRMM SOUND_ARG_LOAD(2, 4, 0x06, 0x80, 8)
/* not verified */
#define SOUND_MARIO_WAH2 SOUND_ARG_LOAD(2, 4, 0x07, 0x80, 8)
/* not verified */
#define SOUND_MARIO_WHOA SOUND_ARG_LOAD(2, 4, 0x08, 0xC0, 8)
/* not verified */
#define SOUND_MARIO_EEUH SOUND_ARG_LOAD(2, 4, 0x09, 0x80, 8)
/* not verified */
#define SOUND_MARIO_ATTACKED SOUND_ARG_LOAD(2, 4, 0x0A, 0xFF, 8)
/* not verified */
#define SOUND_MARIO_OOOF SOUND_ARG_LOAD(2, 4, 0x0B, 0x80, 8)
/* not verified */
#define SOUND_MARIO_OOOF2 SOUND_ARG_LOAD(2, 4, 0x0B, 0xD0, 8)
#define SOUND_MARIO_HERE_WE_GO SOUND_ARG_LOAD(2, 4, 0x0C, 0x80, 8)
/* not verified */ #define SOUND_MARIO_YAWNING SOUND_ARG_LOAD(2, 4, 0x0D, 0x80, 8)
/* not verified */
#define SOUND_MARIO_YAWNING SOUND_ARG_LOAD(2, 4, 0x0D, 0x80, 8)
#define SOUND_MARIO_SNORING1 SOUND_ARG_LOAD(2, 4, 0x0E, 0x80, 8)
#define SOUND_MARIO_SNORING2 SOUND_ARG_LOAD(2, 4, 0x0F, 0x80, 8)
/* not verified */ #define SOUND_MARIO_WAAAOOOW SOUND_ARG_LOAD(2, 4, 0x10, 0xC0, 8)
/* not verified */ #define SOUND_MARIO_HAHA SOUND_ARG_LOAD(2, 4, 0x11, 0x80, 8)
/* not verified */ #define SOUND_MARIO_HAHA_2 SOUND_ARG_LOAD(2, 4, 0x11, 0xF0, 8)
/* not verified */ #define SOUND_MARIO_UH2 SOUND_ARG_LOAD(2, 4, 0x13, 0xD0, 8)
/* not verified */ #define SOUND_MARIO_UH2_2 SOUND_ARG_LOAD(2, 4, 0x13, 0x80, 8)
/* not verified */ #define SOUND_MARIO_ON_FIRE SOUND_ARG_LOAD(2, 4, 0x14, 0xA0, 8)
/* not verified */ #define SOUND_MARIO_DYING SOUND_ARG_LOAD(2, 4, 0x15, 0xFF, 8)
/* not verified */
#define SOUND_MARIO_WAAAOOOW SOUND_ARG_LOAD(2, 4, 0x10, 0xC0, 8)
/* not verified */
#define SOUND_MARIO_HAHA SOUND_ARG_LOAD(2, 4, 0x11, 0x80, 8)
/* not verified */
#define SOUND_MARIO_HAHA_2 SOUND_ARG_LOAD(2, 4, 0x11, 0xF0, 8)
/* not verified */
#define SOUND_MARIO_UH2 SOUND_ARG_LOAD(2, 4, 0x13, 0xD0, 8)
/* not verified */
#define SOUND_MARIO_UH2_2 SOUND_ARG_LOAD(2, 4, 0x13, 0x80, 8)
/* not verified */
#define SOUND_MARIO_ON_FIRE SOUND_ARG_LOAD(2, 4, 0x14, 0xA0, 8)
/* not verified */
#define SOUND_MARIO_DYING SOUND_ARG_LOAD(2, 4, 0x15, 0xFF, 8)
#define SOUND_MARIO_PANTING_COLD SOUND_ARG_LOAD(2, 4, 0x16, 0x80, 8)
// A random number 0-2 is added to the sound ID before playing
@@ -245,147 +288,268 @@
/* General Sound Effects */
#define SOUND_GENERAL_ACTIVATE_CAP_SWITCH SOUND_ARG_LOAD(3, 0, 0x00, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_FLAME_OUT SOUND_ARG_LOAD(3, 0, 0x03, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_OPEN_WOOD_DOOR SOUND_ARG_LOAD(3, 0, 0x04, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_CLOSE_WOOD_DOOR SOUND_ARG_LOAD(3, 0, 0x05, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_OPEN_IRON_DOOR SOUND_ARG_LOAD(3, 0, 0x06, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_CLOSE_IRON_DOOR SOUND_ARG_LOAD(3, 0, 0x07, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_BUBBLES 0x3008
/* not verified */ #define SOUND_GENERAL_MOVING_WATER SOUND_ARG_LOAD(3, 0, 0x09, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_SWISH_WATER SOUND_ARG_LOAD(3, 0, 0x0A, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_QUIET_BUBBLE SOUND_ARG_LOAD(3, 0, 0x0B, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_FLAME_OUT SOUND_ARG_LOAD(3, 0, 0x03, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_OPEN_WOOD_DOOR SOUND_ARG_LOAD(3, 0, 0x04, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_CLOSE_WOOD_DOOR SOUND_ARG_LOAD(3, 0, 0x05, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_OPEN_IRON_DOOR SOUND_ARG_LOAD(3, 0, 0x06, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_CLOSE_IRON_DOOR SOUND_ARG_LOAD(3, 0, 0x07, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_BUBBLES 0x3008
/* not verified */
#define SOUND_GENERAL_MOVING_WATER SOUND_ARG_LOAD(3, 0, 0x09, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_SWISH_WATER SOUND_ARG_LOAD(3, 0, 0x0A, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_QUIET_BUBBLE SOUND_ARG_LOAD(3, 0, 0x0B, 0x00, 8)
#define SOUND_GENERAL_VOLCANO_EXPLOSION SOUND_ARG_LOAD(3, 0, 0x0C, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_QUIET_BUBBLE2 SOUND_ARG_LOAD(3, 0, 0x0D, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_QUIET_BUBBLE2 SOUND_ARG_LOAD(3, 0, 0x0D, 0x00, 8)
#define SOUND_GENERAL_CASTLE_TRAP_OPEN SOUND_ARG_LOAD(3, 0, 0x0E, 0x80, 8)
#define SOUND_GENERAL_WALL_EXPLOSION SOUND_ARG_LOAD(3, 0, 0x0F, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_COIN SOUND_ARG_LOAD(3, 8, 0x11, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_COIN_WATER SOUND_ARG_LOAD(3, 8, 0x12, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_SHORT_STAR SOUND_ARG_LOAD(3, 0, 0x16, 0x00, 9)
/* not verified */ #define SOUND_GENERAL_BIG_CLOCK SOUND_ARG_LOAD(3, 0, 0x17, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_LOUD_POUND 0x3018 // _TERRAIN?
/* not verified */ #define SOUND_GENERAL_LOUD_POUND2 0x3019
/* not verified */ #define SOUND_GENERAL_SHORT_POUND1 0x301A
/* not verified */ #define SOUND_GENERAL_SHORT_POUND2 0x301B
/* not verified */ #define SOUND_GENERAL_SHORT_POUND3 0x301C
/* not verified */ #define SOUND_GENERAL_SHORT_POUND4 0x301D
/* not verified */ #define SOUND_GENERAL_SHORT_POUND5 0x301E
/* not verified */ #define SOUND_GENERAL_SHORT_POUND6 0x301F
/* not verified */
#define SOUND_GENERAL_COIN SOUND_ARG_LOAD(3, 8, 0x11, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_COIN_WATER SOUND_ARG_LOAD(3, 8, 0x12, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_SHORT_STAR SOUND_ARG_LOAD(3, 0, 0x16, 0x00, 9)
/* not verified */
#define SOUND_GENERAL_BIG_CLOCK SOUND_ARG_LOAD(3, 0, 0x17, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_LOUD_POUND 0x3018 // _TERRAIN?
/* not verified */
#define SOUND_GENERAL_LOUD_POUND2 0x3019
/* not verified */
#define SOUND_GENERAL_SHORT_POUND1 0x301A
/* not verified */
#define SOUND_GENERAL_SHORT_POUND2 0x301B
/* not verified */
#define SOUND_GENERAL_SHORT_POUND3 0x301C
/* not verified */
#define SOUND_GENERAL_SHORT_POUND4 0x301D
/* not verified */
#define SOUND_GENERAL_SHORT_POUND5 0x301E
/* not verified */
#define SOUND_GENERAL_SHORT_POUND6 0x301F
#define SOUND_GENERAL_OPEN_CHEST SOUND_ARG_LOAD(3, 1, 0x20, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_CLAM_SHELL1 SOUND_ARG_LOAD(3, 1, 0x22, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_BOX_LANDING SOUND_ARG_LOAD(3, 0, 0x24, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BOX_LANDING_2 SOUND_ARG_LOAD(3, 2, 0x24, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN1 SOUND_ARG_LOAD(3, 0, 0x25, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN1_2 SOUND_ARG_LOAD(3, 2, 0x25, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_CLAM_SHELL2 SOUND_ARG_LOAD(3, 0, 0x26, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_CLAM_SHELL3 SOUND_ARG_LOAD(3, 0, 0x27, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_CLAM_SHELL1 SOUND_ARG_LOAD(3, 1, 0x22, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_BOX_LANDING SOUND_ARG_LOAD(3, 0, 0x24, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BOX_LANDING_2 SOUND_ARG_LOAD(3, 2, 0x24, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN1 SOUND_ARG_LOAD(3, 0, 0x25, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN1_2 SOUND_ARG_LOAD(3, 2, 0x25, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_CLAM_SHELL2 SOUND_ARG_LOAD(3, 0, 0x26, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_CLAM_SHELL3 SOUND_ARG_LOAD(3, 0, 0x27, 0x40, 8)
#ifdef VERSION_JP
#define SOUND_GENERAL_PAINTING_EJECT SOUND_ARG_LOAD(3, 8, 0x28, 0x00, 8)
#else
#define SOUND_GENERAL_PAINTING_EJECT SOUND_ARG_LOAD(3, 9, 0x28, 0x00, 8)
#endif
#define SOUND_GENERAL_LEVEL_SELECT_CHANGE SOUND_ARG_LOAD(3, 0, 0x2B, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_PLATFORM SOUND_ARG_LOAD(3, 0, 0x2D, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_PLATFORM SOUND_ARG_LOAD(3, 0, 0x2D, 0x80, 8)
#define SOUND_GENERAL_DONUT_PLATFORM_EXPLOSION SOUND_ARG_LOAD(3, 0, 0x2E, 0x20, 8)
#define SOUND_GENERAL_BOWSER_BOMB_EXPLOSION SOUND_ARG_LOAD(3, 1, 0x2F, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_COIN_SPURT SOUND_ARG_LOAD(3, 0, 0x30, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_COIN_SPURT_2 SOUND_ARG_LOAD(3, 8, 0x30, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_COIN_SPURT_EU SOUND_ARG_LOAD(3, 8, 0x30, 0x20, 8)
/* not verified */
#define SOUND_GENERAL_COIN_SPURT SOUND_ARG_LOAD(3, 0, 0x30, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_COIN_SPURT_2 SOUND_ARG_LOAD(3, 8, 0x30, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_COIN_SPURT_EU SOUND_ARG_LOAD(3, 8, 0x30, 0x20, 8)
/* not verified */ #define SOUND_GENERAL_EXPLOSION6 0x3031
/* not verified */ #define SOUND_GENERAL_UNK32 0x3032
/* not verified */ #define SOUND_GENERAL_BOAT_TILT1 SOUND_ARG_LOAD(3, 0, 0x34, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_BOAT_TILT2 SOUND_ARG_LOAD(3, 0, 0x35, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_COIN_DROP SOUND_ARG_LOAD(3, 0, 0x36, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN3_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x37, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN3 SOUND_ARG_LOAD(3, 0, 0x37, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN3_2 SOUND_ARG_LOAD(3, 8, 0x37, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_EXPLOSION6 0x3031
/* not verified */
#define SOUND_GENERAL_UNK32 0x3032
/* not verified */
#define SOUND_GENERAL_BOAT_TILT1 SOUND_ARG_LOAD(3, 0, 0x34, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_BOAT_TILT2 SOUND_ARG_LOAD(3, 0, 0x35, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_COIN_DROP SOUND_ARG_LOAD(3, 0, 0x36, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN3_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x37, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN3 SOUND_ARG_LOAD(3, 0, 0x37, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN3_2 SOUND_ARG_LOAD(3, 8, 0x37, 0x80, 8)
#define SOUND_GENERAL_PENDULUM_SWING SOUND_ARG_LOAD(3, 0, 0x38, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_CHAIN_CHOMP1 SOUND_ARG_LOAD(3, 0, 0x39, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_CHAIN_CHOMP2 SOUND_ARG_LOAD(3, 0, 0x3A, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_CHAIN_CHOMP1 SOUND_ARG_LOAD(3, 0, 0x39, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_CHAIN_CHOMP2 SOUND_ARG_LOAD(3, 0, 0x3A, 0x00, 8)
#define SOUND_GENERAL_DOOR_TURN_KEY SOUND_ARG_LOAD(3, 0, 0x3B, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_MOVING_IN_SAND SOUND_ARG_LOAD(3, 0, 0x3C, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN4_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x3D, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNKNOWN4 SOUND_ARG_LOAD(3, 0, 0x3D, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_MOVING_IN_SAND SOUND_ARG_LOAD(3, 0, 0x3C, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN4_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x3D, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNKNOWN4 SOUND_ARG_LOAD(3, 0, 0x3D, 0x80, 8)
#define SOUND_GENERAL_MOVING_PLATFORM_SWITCH SOUND_ARG_LOAD(3, 0, 0x3E, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_CAGE_OPEN SOUND_ARG_LOAD(3, 0, 0x3F, 0xA0, 8)
/* not verified */ #define SOUND_GENERAL_QUIET_POUND1_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x40, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_QUIET_POUND1 SOUND_ARG_LOAD(3, 0, 0x40, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_BREAK_BOX SOUND_ARG_LOAD(3, 0, 0x41, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_CAGE_OPEN SOUND_ARG_LOAD(3, 0, 0x3F, 0xA0, 8)
/* not verified */
#define SOUND_GENERAL_QUIET_POUND1_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x40, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_QUIET_POUND1 SOUND_ARG_LOAD(3, 0, 0x40, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_BREAK_BOX SOUND_ARG_LOAD(3, 0, 0x41, 0xC0, 8)
#define SOUND_GENERAL_DOOR_INSERT_KEY SOUND_ARG_LOAD(3, 0, 0x42, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_QUIET_POUND2 SOUND_ARG_LOAD(3, 0, 0x43, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BIG_POUND SOUND_ARG_LOAD(3, 0, 0x44, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNK45 SOUND_ARG_LOAD(3, 0, 0x45, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNK46_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x46, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_UNK46 SOUND_ARG_LOAD(3, 0, 0x46, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_CANNON_UP SOUND_ARG_LOAD(3, 0, 0x47, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_GRINDEL_ROLL SOUND_ARG_LOAD(3, 0, 0x48, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_EXPLOSION7 0x3049
/* not verified */ #define SOUND_GENERAL_SHAKE_COFFIN 0x304A
/* not verified */ #define SOUND_GENERAL_RACE_GUN_SHOT SOUND_ARG_LOAD(3, 1, 0x4D, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_STAR_DOOR_OPEN SOUND_ARG_LOAD(3, 0, 0x4E, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_STAR_DOOR_CLOSE SOUND_ARG_LOAD(3, 0, 0x4F, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_POUND_ROCK SOUND_ARG_LOAD(3, 0, 0x56, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_STAR_APPEARS SOUND_ARG_LOAD(3, 0, 0x57, 0xFF, 9)
/* not verified */
#define SOUND_GENERAL_QUIET_POUND2 SOUND_ARG_LOAD(3, 0, 0x43, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BIG_POUND SOUND_ARG_LOAD(3, 0, 0x44, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNK45 SOUND_ARG_LOAD(3, 0, 0x45, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNK46_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x46, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_UNK46 SOUND_ARG_LOAD(3, 0, 0x46, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_CANNON_UP SOUND_ARG_LOAD(3, 0, 0x47, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_GRINDEL_ROLL SOUND_ARG_LOAD(3, 0, 0x48, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_EXPLOSION7 0x3049
/* not verified */
#define SOUND_GENERAL_SHAKE_COFFIN 0x304A
/* not verified */
#define SOUND_GENERAL_RACE_GUN_SHOT SOUND_ARG_LOAD(3, 1, 0x4D, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_STAR_DOOR_OPEN SOUND_ARG_LOAD(3, 0, 0x4E, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_STAR_DOOR_CLOSE SOUND_ARG_LOAD(3, 0, 0x4F, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_POUND_ROCK SOUND_ARG_LOAD(3, 0, 0x56, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_STAR_APPEARS SOUND_ARG_LOAD(3, 0, 0x57, 0xFF, 9)
#define SOUND_GENERAL_COLLECT_1UP SOUND_ARG_LOAD(3, 0, 0x58, 0xFF, 8)
/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x5A, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS SOUND_ARG_LOAD(3, 0, 0x5A, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO SOUND_ARG_LOAD(3, 1, 0x5A, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BUTTON_PRESS_2 SOUND_ARG_LOAD(3, 1, 0x5A, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_ELEVATOR_MOVE SOUND_ARG_LOAD(3, 0, 0x5B, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_ELEVATOR_MOVE_2 SOUND_ARG_LOAD(3, 1, 0x5B, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_SWISH_AIR SOUND_ARG_LOAD(3, 0, 0x5C, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_SWISH_AIR_2 SOUND_ARG_LOAD(3, 1, 0x5C, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_HAUNTED_CHAIR SOUND_ARG_LOAD(3, 0, 0x5D, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_SOFT_LANDING SOUND_ARG_LOAD(3, 0, 0x5E, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_HAUNTED_CHAIR_MOVE SOUND_ARG_LOAD(3, 0, 0x5F, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BOWSER_PLATFORM SOUND_ARG_LOAD(3, 0, 0x62, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_BOWSER_PLATFORM_2 SOUND_ARG_LOAD(3, 1, 0x62, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_HEART_SPIN SOUND_ARG_LOAD(3, 0, 0x64, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_POUND_WOOD_POST SOUND_ARG_LOAD(3, 0, 0x65, 0xC0, 8)
/* not verified */ #define SOUND_GENERAL_WATER_LEVEL_TRIG SOUND_ARG_LOAD(3, 0, 0x66, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_SWITCH_DOOR_OPEN SOUND_ARG_LOAD(3, 0, 0x67, 0xA0, 8)
/* not verified */ #define SOUND_GENERAL_RED_COIN SOUND_ARG_LOAD(3, 0, 0x68, 0x90, 8)
/* not verified */ #define SOUND_GENERAL_BIRDS_FLY_AWAY SOUND_ARG_LOAD(3, 0, 0x69, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_METAL_POUND SOUND_ARG_LOAD(3, 0, 0x6B, 0x80, 8)
/* not verified */ #define SOUND_GENERAL_BOING1 SOUND_ARG_LOAD(3, 0, 0x6C, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_BOING2_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x6D, 0x20, 8)
/* not verified */ #define SOUND_GENERAL_BOING2 SOUND_ARG_LOAD(3, 0, 0x6D, 0x40, 8)
/* not verified */ #define SOUND_GENERAL_YOSHI_WALK SOUND_ARG_LOAD(3, 0, 0x6E, 0x20, 8)
/* not verified */ #define SOUND_GENERAL_ENEMY_ALERT1 SOUND_ARG_LOAD(3, 0, 0x6F, 0x30, 8)
/* not verified */ #define SOUND_GENERAL_YOSHI_TALK SOUND_ARG_LOAD(3, 0, 0x70, 0x30, 8)
/* not verified */ #define SOUND_GENERAL_SPLATTERING SOUND_ARG_LOAD(3, 0, 0x71, 0x30, 8)
/* not verified */ #define SOUND_GENERAL_BOING3 0x3072
/* not verified */ #define SOUND_GENERAL_GRAND_STAR SOUND_ARG_LOAD(3, 0, 0x73, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_GRAND_STAR_JUMP SOUND_ARG_LOAD(3, 0, 0x74, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_BOAT_ROCK SOUND_ARG_LOAD(3, 0, 0x75, 0x00, 8)
/* not verified */ #define SOUND_GENERAL_VANISH_SFX SOUND_ARG_LOAD(3, 0, 0x76, 0x20, 8)
/* not verified */
#define SOUND_GENERAL_BUTTON_PRESS_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x5A, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BUTTON_PRESS SOUND_ARG_LOAD(3, 0, 0x5A, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO SOUND_ARG_LOAD(3, 1, 0x5A, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BUTTON_PRESS_2 SOUND_ARG_LOAD(3, 1, 0x5A, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_ELEVATOR_MOVE SOUND_ARG_LOAD(3, 0, 0x5B, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_ELEVATOR_MOVE_2 SOUND_ARG_LOAD(3, 1, 0x5B, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_SWISH_AIR SOUND_ARG_LOAD(3, 0, 0x5C, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_SWISH_AIR_2 SOUND_ARG_LOAD(3, 1, 0x5C, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_HAUNTED_CHAIR SOUND_ARG_LOAD(3, 0, 0x5D, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_SOFT_LANDING SOUND_ARG_LOAD(3, 0, 0x5E, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_HAUNTED_CHAIR_MOVE SOUND_ARG_LOAD(3, 0, 0x5F, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BOWSER_PLATFORM SOUND_ARG_LOAD(3, 0, 0x62, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_BOWSER_PLATFORM_2 SOUND_ARG_LOAD(3, 1, 0x62, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_HEART_SPIN SOUND_ARG_LOAD(3, 0, 0x64, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_POUND_WOOD_POST SOUND_ARG_LOAD(3, 0, 0x65, 0xC0, 8)
/* not verified */
#define SOUND_GENERAL_WATER_LEVEL_TRIG SOUND_ARG_LOAD(3, 0, 0x66, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_SWITCH_DOOR_OPEN SOUND_ARG_LOAD(3, 0, 0x67, 0xA0, 8)
/* not verified */
#define SOUND_GENERAL_RED_COIN SOUND_ARG_LOAD(3, 0, 0x68, 0x90, 8)
/* not verified */
#define SOUND_GENERAL_BIRDS_FLY_AWAY SOUND_ARG_LOAD(3, 0, 0x69, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_METAL_POUND SOUND_ARG_LOAD(3, 0, 0x6B, 0x80, 8)
/* not verified */
#define SOUND_GENERAL_BOING1 SOUND_ARG_LOAD(3, 0, 0x6C, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_BOING2_LOWPRIO SOUND_ARG_LOAD(3, 0, 0x6D, 0x20, 8)
/* not verified */
#define SOUND_GENERAL_BOING2 SOUND_ARG_LOAD(3, 0, 0x6D, 0x40, 8)
/* not verified */
#define SOUND_GENERAL_YOSHI_WALK SOUND_ARG_LOAD(3, 0, 0x6E, 0x20, 8)
/* not verified */
#define SOUND_GENERAL_ENEMY_ALERT1 SOUND_ARG_LOAD(3, 0, 0x6F, 0x30, 8)
/* not verified */
#define SOUND_GENERAL_YOSHI_TALK SOUND_ARG_LOAD(3, 0, 0x70, 0x30, 8)
/* not verified */
#define SOUND_GENERAL_SPLATTERING SOUND_ARG_LOAD(3, 0, 0x71, 0x30, 8)
/* not verified */
#define SOUND_GENERAL_BOING3 0x3072
/* not verified */
#define SOUND_GENERAL_GRAND_STAR SOUND_ARG_LOAD(3, 0, 0x73, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_GRAND_STAR_JUMP SOUND_ARG_LOAD(3, 0, 0x74, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_BOAT_ROCK SOUND_ARG_LOAD(3, 0, 0x75, 0x00, 8)
/* not verified */
#define SOUND_GENERAL_VANISH_SFX SOUND_ARG_LOAD(3, 0, 0x76, 0x20, 8)
/* Environment Sound Effects */
/* not verified */ #define SOUND_ENV_WATERFALL1 SOUND_ARG_LOAD(4, 0, 0x00, 0x00, 0)
/* not verified */ #define SOUND_ENV_WATERFALL2 SOUND_ARG_LOAD(4, 0, 0x01, 0x00, 0)
/* not verified */ #define SOUND_ENV_ELEVATOR1 SOUND_ARG_LOAD(4, 0, 0x02, 0x00, 0)
/* not verified */ #define SOUND_ENV_DRONING1 SOUND_ARG_LOAD(4, 1, 0x03, 0x00, 0)
/* not verified */ #define SOUND_ENV_DRONING2 SOUND_ARG_LOAD(4, 0, 0x04, 0x00, 0)
/* not verified */ #define SOUND_ENV_WIND1 SOUND_ARG_LOAD(4, 0, 0x05, 0x00, 0)
/* not verified */ #define SOUND_ENV_MOVING_SAND_SNOW 0x4006
/* not verified */ #define SOUND_ENV_UNK07 0x4007
/* not verified */ #define SOUND_ENV_ELEVATOR2 SOUND_ARG_LOAD(4, 0, 0x08, 0x00, 0)
/* not verified */ #define SOUND_ENV_WATER SOUND_ARG_LOAD(4, 0, 0x09, 0x00, 0)
/* not verified */ #define SOUND_ENV_UNKNOWN2 SOUND_ARG_LOAD(4, 0, 0x0A, 0x00, 0)
/* not verified */ #define SOUND_ENV_BOAT_ROCKING1 SOUND_ARG_LOAD(4, 0, 0x0B, 0x00, 0)
/* not verified */ #define SOUND_ENV_ELEVATOR3 SOUND_ARG_LOAD(4, 0, 0x0C, 0x00, 0)
/* not verified */ #define SOUND_ENV_ELEVATOR4 SOUND_ARG_LOAD(4, 0, 0x0D, 0x00, 0)
/* not verified */ #define SOUND_ENV_ELEVATOR4_2 SOUND_ARG_LOAD(4, 1, 0x0D, 0x00, 0)
/* not verified */ #define SOUND_ENV_MOVINGSAND SOUND_ARG_LOAD(4, 0, 0x0E, 0x00, 0)
/* not verified */ #define SOUND_ENV_MERRY_GO_ROUND_CREAKING SOUND_ARG_LOAD(4, 0, 0x0F, 0x40, 0)
/* not verified */ #define SOUND_ENV_WIND2 SOUND_ARG_LOAD(4, 0, 0x10, 0x80, 0)
/* not verified */ #define SOUND_ENV_UNK12 0x4012
/* not verified */ #define SOUND_ENV_SLIDING SOUND_ARG_LOAD(4, 0, 0x13, 0x00, 0)
/* not verified */ #define SOUND_ENV_STAR SOUND_ARG_LOAD(4, 0, 0x14, 0x00, 1)
/* not verified */ #define SOUND_ENV_UNKNOWN4 SOUND_ARG_LOAD(4, 1, 0x15, 0x00, 0)
/* not verified */ #define SOUND_ENV_WATER_DRAIN SOUND_ARG_LOAD(4, 1, 0x16, 0x00, 0)
/* not verified */ #define SOUND_ENV_METAL_BOX_PUSH SOUND_ARG_LOAD(4, 0, 0x17, 0x80, 0)
/* not verified */ #define SOUND_ENV_SINK_QUICKSAND SOUND_ARG_LOAD(4, 0, 0x18, 0x80, 0)
/* not verified */
#define SOUND_ENV_WATERFALL1 SOUND_ARG_LOAD(4, 0, 0x00, 0x00, 0)
/* not verified */
#define SOUND_ENV_WATERFALL2 SOUND_ARG_LOAD(4, 0, 0x01, 0x00, 0)
/* not verified */
#define SOUND_ENV_ELEVATOR1 SOUND_ARG_LOAD(4, 0, 0x02, 0x00, 0)
/* not verified */
#define SOUND_ENV_DRONING1 SOUND_ARG_LOAD(4, 1, 0x03, 0x00, 0)
/* not verified */
#define SOUND_ENV_DRONING2 SOUND_ARG_LOAD(4, 0, 0x04, 0x00, 0)
/* not verified */
#define SOUND_ENV_WIND1 SOUND_ARG_LOAD(4, 0, 0x05, 0x00, 0)
/* not verified */
#define SOUND_ENV_MOVING_SAND_SNOW 0x4006
/* not verified */
#define SOUND_ENV_UNK07 0x4007
/* not verified */
#define SOUND_ENV_ELEVATOR2 SOUND_ARG_LOAD(4, 0, 0x08, 0x00, 0)
/* not verified */
#define SOUND_ENV_WATER SOUND_ARG_LOAD(4, 0, 0x09, 0x00, 0)
/* not verified */
#define SOUND_ENV_UNKNOWN2 SOUND_ARG_LOAD(4, 0, 0x0A, 0x00, 0)
/* not verified */
#define SOUND_ENV_BOAT_ROCKING1 SOUND_ARG_LOAD(4, 0, 0x0B, 0x00, 0)
/* not verified */
#define SOUND_ENV_ELEVATOR3 SOUND_ARG_LOAD(4, 0, 0x0C, 0x00, 0)
/* not verified */
#define SOUND_ENV_ELEVATOR4 SOUND_ARG_LOAD(4, 0, 0x0D, 0x00, 0)
/* not verified */
#define SOUND_ENV_ELEVATOR4_2 SOUND_ARG_LOAD(4, 1, 0x0D, 0x00, 0)
/* not verified */
#define SOUND_ENV_MOVINGSAND SOUND_ARG_LOAD(4, 0, 0x0E, 0x00, 0)
/* not verified */
#define SOUND_ENV_MERRY_GO_ROUND_CREAKING SOUND_ARG_LOAD(4, 0, 0x0F, 0x40, 0)
/* not verified */
#define SOUND_ENV_WIND2 SOUND_ARG_LOAD(4, 0, 0x10, 0x80, 0)
/* not verified */
#define SOUND_ENV_UNK12 0x4012
/* not verified */
#define SOUND_ENV_SLIDING SOUND_ARG_LOAD(4, 0, 0x13, 0x00, 0)
/* not verified */
#define SOUND_ENV_STAR SOUND_ARG_LOAD(4, 0, 0x14, 0x00, 1)
/* not verified */
#define SOUND_ENV_UNKNOWN4 SOUND_ARG_LOAD(4, 1, 0x15, 0x00, 0)
/* not verified */
#define SOUND_ENV_WATER_DRAIN SOUND_ARG_LOAD(4, 1, 0x16, 0x00, 0)
/* not verified */
#define SOUND_ENV_METAL_BOX_PUSH SOUND_ARG_LOAD(4, 0, 0x17, 0x80, 0)
/* not verified */
#define SOUND_ENV_SINK_QUICKSAND SOUND_ARG_LOAD(4, 0, 0x18, 0x80, 0)
/* Object Sound Effects */
#define SOUND_OBJ_SUSHI_SHARK_WATER_SOUND SOUND_ARG_LOAD(5, 0, 0x00, 0x80, 8)
@@ -400,45 +564,69 @@
#define SOUND_OBJ_BOO_BOUNCE_TOP SOUND_ARG_LOAD(5, 0, 0x0A, 0x00, 8)
#define SOUND_OBJ_BOO_LAUGH_SHORT SOUND_ARG_LOAD(5, 0, 0x0B, 0x00, 8)
#define SOUND_OBJ_THWOMP SOUND_ARG_LOAD(5, 0, 0x0C, 0xA0, 8)
/* not verified */ #define SOUND_OBJ_CANNON1 SOUND_ARG_LOAD(5, 0, 0x0D, 0xF0, 8)
/* not verified */ #define SOUND_OBJ_CANNON2 SOUND_ARG_LOAD(5, 0, 0x0E, 0xF0, 8)
/* not verified */ #define SOUND_OBJ_CANNON3 SOUND_ARG_LOAD(5, 0, 0x0F, 0xF0, 8)
/* not verified */ #define SOUND_OBJ_JUMP_WALK_WATER 0x5012
/* not verified */ #define SOUND_OBJ_UNKNOWN2 SOUND_ARG_LOAD(5, 0, 0x13, 0x00, 8)
/* not verified */
#define SOUND_OBJ_CANNON1 SOUND_ARG_LOAD(5, 0, 0x0D, 0xF0, 8)
/* not verified */
#define SOUND_OBJ_CANNON2 SOUND_ARG_LOAD(5, 0, 0x0E, 0xF0, 8)
/* not verified */
#define SOUND_OBJ_CANNON3 SOUND_ARG_LOAD(5, 0, 0x0F, 0xF0, 8)
/* not verified */
#define SOUND_OBJ_JUMP_WALK_WATER 0x5012
/* not verified */
#define SOUND_OBJ_UNKNOWN2 SOUND_ARG_LOAD(5, 0, 0x13, 0x00, 8)
#define SOUND_OBJ_MRI_DEATH SOUND_ARG_LOAD(5, 0, 0x14, 0x00, 8)
/* not verified */ #define SOUND_OBJ_POUNDING1 SOUND_ARG_LOAD(5, 0, 0x15, 0x50, 8)
/* not verified */ #define SOUND_OBJ_POUNDING1_HIGHPRIO SOUND_ARG_LOAD(5, 0, 0x15, 0x80, 8)
/* not verified */
#define SOUND_OBJ_POUNDING1 SOUND_ARG_LOAD(5, 0, 0x15, 0x50, 8)
/* not verified */
#define SOUND_OBJ_POUNDING1_HIGHPRIO SOUND_ARG_LOAD(5, 0, 0x15, 0x80, 8)
#define SOUND_OBJ_WHOMP_LOWPRIO SOUND_ARG_LOAD(5, 0, 0x16, 0x60, 8)
#define SOUND_OBJ_KING_BOBOMB SOUND_ARG_LOAD(5, 0, 0x16, 0x80, 8)
/* not verified */ #define SOUND_OBJ_BULLY_METAL SOUND_ARG_LOAD(5, 0, 0x17, 0x80, 8)
/* not verified */ #define SOUND_OBJ_BULLY_EXPLODE SOUND_ARG_LOAD(5, 0, 0x18, 0xA0, 8)
/* not verified */ #define SOUND_OBJ_BULLY_EXPLODE_2 SOUND_ARG_LOAD(5, 1, 0x18, 0xA0, 8)
/* not verified */ #define SOUND_OBJ_POUNDING_CANNON SOUND_ARG_LOAD(5, 0, 0x1A, 0x50, 8)
/* not verified */ #define SOUND_OBJ_BULLY_WALK SOUND_ARG_LOAD(5, 0, 0x1B, 0x30, 8)
/* not verified */ #define SOUND_OBJ_UNKNOWN3 SOUND_ARG_LOAD(5, 0, 0x1D, 0x80, 8)
/* not verified */ #define SOUND_OBJ_UNKNOWN4 SOUND_ARG_LOAD(5, 0, 0x1E, 0xA0, 8)
/* not verified */
#define SOUND_OBJ_BULLY_METAL SOUND_ARG_LOAD(5, 0, 0x17, 0x80, 8)
/* not verified */
#define SOUND_OBJ_BULLY_EXPLODE SOUND_ARG_LOAD(5, 0, 0x18, 0xA0, 8)
/* not verified */
#define SOUND_OBJ_BULLY_EXPLODE_2 SOUND_ARG_LOAD(5, 1, 0x18, 0xA0, 8)
/* not verified */
#define SOUND_OBJ_POUNDING_CANNON SOUND_ARG_LOAD(5, 0, 0x1A, 0x50, 8)
/* not verified */
#define SOUND_OBJ_BULLY_WALK SOUND_ARG_LOAD(5, 0, 0x1B, 0x30, 8)
/* not verified */
#define SOUND_OBJ_UNKNOWN3 SOUND_ARG_LOAD(5, 0, 0x1D, 0x80, 8)
/* not verified */
#define SOUND_OBJ_UNKNOWN4 SOUND_ARG_LOAD(5, 0, 0x1E, 0xA0, 8)
#define SOUND_OBJ_BABY_PENGUIN_DIVE SOUND_ARG_LOAD(5, 0, 0x1F, 0x40, 8)
#define SOUND_OBJ_GOOMBA_WALK SOUND_ARG_LOAD(5, 0, 0x20, 0x00, 8)
#define SOUND_OBJ_UKIKI_CHATTER_LONG SOUND_ARG_LOAD(5, 0, 0x21, 0x00, 8)
#define SOUND_OBJ_MONTY_MOLE_ATTACK SOUND_ARG_LOAD(5, 0, 0x22, 0x00, 8)
#define SOUND_OBJ_EVIL_LAKITU_THROW SOUND_ARG_LOAD(5, 0, 0x22, 0x20, 8)
/* not verified */ #define SOUND_OBJ_UNK23 0x5023
/* not verified */
#define SOUND_OBJ_UNK23 0x5023
#define SOUND_OBJ_DYING_ENEMY1 SOUND_ARG_LOAD(5, 0, 0x24, 0x40, 8)
/* not verified */ #define SOUND_OBJ_CANNON4 SOUND_ARG_LOAD(5, 0, 0x25, 0x40, 8)
/* not verified */ #define SOUND_OBJ_DYING_ENEMY2 0x5026
/* not verified */
#define SOUND_OBJ_CANNON4 SOUND_ARG_LOAD(5, 0, 0x25, 0x40, 8)
/* not verified */
#define SOUND_OBJ_DYING_ENEMY2 0x5026
#define SOUND_OBJ_BOBOMB_WALK SOUND_ARG_LOAD(5, 0, 0x27, 0x00, 8)
/* not verified */ #define SOUND_OBJ_SOMETHING_LANDING SOUND_ARG_LOAD(5, 0, 0x28, 0x80, 8)
/* not verified */ #define SOUND_OBJ_DIVING_IN_WATER SOUND_ARG_LOAD(5, 0, 0x29, 0xA0, 8)
/* not verified */ #define SOUND_OBJ_SNOW_SAND1 SOUND_ARG_LOAD(5, 0, 0x2A, 0x00, 8)
/* not verified */ #define SOUND_OBJ_SNOW_SAND2 SOUND_ARG_LOAD(5, 0, 0x2B, 0x00, 8)
/* not verified */
#define SOUND_OBJ_SOMETHING_LANDING SOUND_ARG_LOAD(5, 0, 0x28, 0x80, 8)
/* not verified */
#define SOUND_OBJ_DIVING_IN_WATER SOUND_ARG_LOAD(5, 0, 0x29, 0xA0, 8)
/* not verified */
#define SOUND_OBJ_SNOW_SAND1 SOUND_ARG_LOAD(5, 0, 0x2A, 0x00, 8)
/* not verified */
#define SOUND_OBJ_SNOW_SAND2 SOUND_ARG_LOAD(5, 0, 0x2B, 0x00, 8)
#define SOUND_OBJ_DEFAULT_DEATH SOUND_ARG_LOAD(5, 0, 0x2C, 0x80, 8)
#define SOUND_OBJ_BIG_PENGUIN_YELL SOUND_ARG_LOAD(5, 0, 0x2D, 0x00, 8)
#define SOUND_OBJ_WATER_BOMB_BOUNCING SOUND_ARG_LOAD(5, 0, 0x2E, 0x80, 8)
#define SOUND_OBJ_GOOMBA_ALERT SOUND_ARG_LOAD(5, 0, 0x2F, 0x00, 8)
#define SOUND_OBJ_WIGGLER_JUMP SOUND_ARG_LOAD(5, 0, 0x2F, 0x60, 8)
/* not verified */ #define SOUND_OBJ_STOMPED SOUND_ARG_LOAD(5, 0, 0x30, 0x80, 8)
/* not verified */ #define SOUND_OBJ_UNKNOWN6 SOUND_ARG_LOAD(5, 0, 0x31, 0x00, 8)
/* not verified */ #define SOUND_OBJ_DIVING_INTO_WATER SOUND_ARG_LOAD(5, 0, 0x32, 0x40, 8)
/* not verified */
#define SOUND_OBJ_STOMPED SOUND_ARG_LOAD(5, 0, 0x30, 0x80, 8)
/* not verified */
#define SOUND_OBJ_UNKNOWN6 SOUND_ARG_LOAD(5, 0, 0x31, 0x00, 8)
/* not verified */
#define SOUND_OBJ_DIVING_INTO_WATER SOUND_ARG_LOAD(5, 0, 0x32, 0x40, 8)
#define SOUND_OBJ_PIRANHA_PLANT_SHRINK SOUND_ARG_LOAD(5, 0, 0x33, 0x40, 8)
#define SOUND_OBJ_KOOPA_THE_QUICK_WALK SOUND_ARG_LOAD(5, 0, 0x34, 0x20, 8)
#define SOUND_OBJ_KOOPA_WALK SOUND_ARG_LOAD(5, 0, 0x35, 0x00, 8)
@@ -451,39 +639,52 @@
#define SOUND_OBJ_UKIKI_STEP_LEAVES SOUND_ARG_LOAD(5, 0, 0x3C, 0x00, 8)
#define SOUND_OBJ_KOOPA_TALK SOUND_ARG_LOAD(5, 0, 0x3D, 0xA0, 8)
#define SOUND_OBJ_KOOPA_DAMAGE SOUND_ARG_LOAD(5, 0, 0x3E, 0xA0, 8)
/* not verified */ #define SOUND_OBJ_KLEPTO1 SOUND_ARG_LOAD(5, 0, 0x3F, 0x40, 8)
/* not verified */ #define SOUND_OBJ_KLEPTO2 SOUND_ARG_LOAD(5, 0, 0x40, 0x60, 8)
/* not verified */
#define SOUND_OBJ_KLEPTO1 SOUND_ARG_LOAD(5, 0, 0x3F, 0x40, 8)
/* not verified */
#define SOUND_OBJ_KLEPTO2 SOUND_ARG_LOAD(5, 0, 0x40, 0x60, 8)
#define SOUND_OBJ_KING_BOBOMB_TALK SOUND_ARG_LOAD(5, 0, 0x41, 0x00, 8)
#define SOUND_OBJ_KING_BOBOMB_JUMP SOUND_ARG_LOAD(5, 0, 0x46, 0x80, 8)
#define SOUND_OBJ_KING_WHOMP_DEATH SOUND_ARG_LOAD(5, 1, 0x47, 0xC0, 8)
#define SOUND_OBJ_BOO_LAUGH_LONG SOUND_ARG_LOAD(5, 0, 0x48, 0x00, 8)
/* not verified */ #define SOUND_OBJ_EEL SOUND_ARG_LOAD(5, 0, 0x4A, 0x00, 8)
/* not verified */ #define SOUND_OBJ_EEL_2 SOUND_ARG_LOAD(5, 2, 0x4A, 0x00, 8)
/* not verified */
#define SOUND_OBJ_EEL SOUND_ARG_LOAD(5, 0, 0x4A, 0x00, 8)
/* not verified */
#define SOUND_OBJ_EEL_2 SOUND_ARG_LOAD(5, 2, 0x4A, 0x00, 8)
#define SOUND_OBJ_EYEROK_SHOW_EYE SOUND_ARG_LOAD(5, 2, 0x4B, 0x00, 8)
#define SOUND_OBJ_MR_BLIZZARD_ALERT SOUND_ARG_LOAD(5, 0, 0x4C, 0x00, 8)
#define SOUND_OBJ_SNUFIT_SHOOT SOUND_ARG_LOAD(5, 0, 0x4D, 0x00, 8)
#define SOUND_OBJ_SKEETER_WALK SOUND_ARG_LOAD(5, 0, 0x4E, 0x00, 8)
/* not verified */ #define SOUND_OBJ_WALKING_WATER SOUND_ARG_LOAD(5, 0, 0x4F, 0x00, 8)
/* not verified */
#define SOUND_OBJ_WALKING_WATER SOUND_ARG_LOAD(5, 0, 0x4F, 0x00, 8)
#define SOUND_OBJ_BIRD_CHIRP3 SOUND_ARG_LOAD(5, 0, 0x51, 0x40, 0)
#define SOUND_OBJ_PIRANHA_PLANT_APPEAR SOUND_ARG_LOAD(5, 0, 0x54, 0x20, 8)
#define SOUND_OBJ_FLAME_BLOWN SOUND_ARG_LOAD(5, 0, 0x55, 0x80, 8)
#define SOUND_OBJ_MAD_PIANO_CHOMPING SOUND_ARG_LOAD(5, 2, 0x56, 0x40, 8)
#define SOUND_OBJ_BOBOMB_BUDDY_TALK SOUND_ARG_LOAD(5, 0, 0x58, 0x40, 8)
/* not verified */ #define SOUND_OBJ_SPINY_UNK59 SOUND_ARG_LOAD(5, 0, 0x59, 0x10, 8)
/* not verified */
#define SOUND_OBJ_SPINY_UNK59 SOUND_ARG_LOAD(5, 0, 0x59, 0x10, 8)
#define SOUND_OBJ_WIGGLER_HIGH_PITCH SOUND_ARG_LOAD(5, 0, 0x5C, 0x40, 8)
#define SOUND_OBJ_HEAVEHO_TOSSED SOUND_ARG_LOAD(5, 0, 0x5D, 0x40, 8)
/* not verified */ #define SOUND_OBJ_WIGGLER_DEATH 0x505E
/* not verified */
#define SOUND_OBJ_WIGGLER_DEATH 0x505E
#define SOUND_OBJ_BOWSER_INTRO_LAUGH SOUND_ARG_LOAD(5, 0, 0x5F, 0x80, 9)
/* not verified */ #define SOUND_OBJ_ENEMY_DEATH_HIGH SOUND_ARG_LOAD(5, 0, 0x60, 0xB0, 8)
/* not verified */ #define SOUND_OBJ_ENEMY_DEATH_LOW SOUND_ARG_LOAD(5, 0, 0x61, 0xB0, 8)
/* not verified */
#define SOUND_OBJ_ENEMY_DEATH_HIGH SOUND_ARG_LOAD(5, 0, 0x60, 0xB0, 8)
/* not verified */
#define SOUND_OBJ_ENEMY_DEATH_LOW SOUND_ARG_LOAD(5, 0, 0x61, 0xB0, 8)
#define SOUND_OBJ_SWOOP_DEATH SOUND_ARG_LOAD(5, 0, 0x62, 0xB0, 8)
#define SOUND_OBJ_KOOPA_FLYGUY_DEATH SOUND_ARG_LOAD(5, 0, 0x63, 0xB0, 8)
#define SOUND_OBJ_POKEY_DEATH SOUND_ARG_LOAD(5, 0, 0x63, 0xC0, 8)
/* not verified */ #define SOUND_OBJ_SNOWMAN_BOUNCE SOUND_ARG_LOAD(5, 0, 0x64, 0xC0, 8)
/* not verified */
#define SOUND_OBJ_SNOWMAN_BOUNCE SOUND_ARG_LOAD(5, 0, 0x64, 0xC0, 8)
#define SOUND_OBJ_SNOWMAN_EXPLODE SOUND_ARG_LOAD(5, 0, 0x65, 0xD0, 8)
/* not verified */ #define SOUND_OBJ_POUNDING_LOUD SOUND_ARG_LOAD(5, 0, 0x68, 0x40, 8)
/* not verified */ #define SOUND_OBJ_MIPS_RABBIT SOUND_ARG_LOAD(5, 0, 0x6A, 0x00, 8)
/* not verified */ #define SOUND_OBJ_MIPS_RABBIT_WATER SOUND_ARG_LOAD(5, 0, 0x6C, 0x00, 8)
/* not verified */
#define SOUND_OBJ_POUNDING_LOUD SOUND_ARG_LOAD(5, 0, 0x68, 0x40, 8)
/* not verified */
#define SOUND_OBJ_MIPS_RABBIT SOUND_ARG_LOAD(5, 0, 0x6A, 0x00, 8)
/* not verified */
#define SOUND_OBJ_MIPS_RABBIT_WATER SOUND_ARG_LOAD(5, 0, 0x6C, 0x00, 8)
#define SOUND_OBJ_EYEROK_EXPLODE SOUND_ARG_LOAD(5, 0, 0x6D, 0x00, 8)
#define SOUND_OBJ_CHUCKYA_DEATH SOUND_ARG_LOAD(5, 1, 0x6E, 0x00, 8)
#define SOUND_OBJ_WIGGLER_TALK SOUND_ARG_LOAD(5, 0, 0x6F, 0x00, 8)
@@ -511,7 +712,8 @@
/* Menu Sound Effects */
#define SOUND_MENU_CHANGE_SELECT SOUND_ARG_LOAD(7, 0, 0x00, 0xF8, 8)
/* not verified */ #define SOUND_MENU_REVERSE_PAUSE 0x7001
/* not verified */
#define SOUND_MENU_REVERSE_PAUSE 0x7001
#define SOUND_MENU_PAUSE SOUND_ARG_LOAD(7, 0, 0x02, 0xF0, 8)
#define SOUND_MENU_PAUSE_HIGHPRIO SOUND_ARG_LOAD(7, 0, 0x02, 0xFF, 8)
#define SOUND_MENU_PAUSE_2 SOUND_ARG_LOAD(7, 0, 0x03, 0xFF, 8)
@@ -523,28 +725,39 @@
#define SOUND_MENU_LET_GO_MARIO_FACE SOUND_ARG_LOAD(7, 0, 0x09, 0x00, 8)
#define SOUND_MENU_HAND_APPEAR SOUND_ARG_LOAD(7, 0, 0x0A, 0x00, 8)
#define SOUND_MENU_HAND_DISAPPEAR SOUND_ARG_LOAD(7, 0, 0x0B, 0x00, 8)
/* not verified */ #define SOUND_MENU_UNK0C SOUND_ARG_LOAD(7, 0, 0x0C, 0x00, 8)
/* not verified */ #define SOUND_MENU_POWER_METER SOUND_ARG_LOAD(7, 0, 0x0D, 0x00, 8)
/* not verified */
#define SOUND_MENU_UNK0C SOUND_ARG_LOAD(7, 0, 0x0C, 0x00, 8)
/* not verified */
#define SOUND_MENU_POWER_METER SOUND_ARG_LOAD(7, 0, 0x0D, 0x00, 8)
#define SOUND_MENU_CAMERA_BUZZ SOUND_ARG_LOAD(7, 0, 0x0E, 0x00, 8)
#define SOUND_MENU_CAMERA_TURN SOUND_ARG_LOAD(7, 0, 0x0F, 0x00, 8)
/* not verified */ #define SOUND_MENU_UNK10 0x7010
/* not verified */
#define SOUND_MENU_UNK10 0x7010
#define SOUND_MENU_CLICK_FILE_SELECT SOUND_ARG_LOAD(7, 0, 0x11, 0x00, 8)
/* not verified */ #define SOUND_MENU_MESSAGE_NEXT_PAGE SOUND_ARG_LOAD(7, 0, 0x13, 0x00, 8)
/* not verified */
#define SOUND_MENU_MESSAGE_NEXT_PAGE SOUND_ARG_LOAD(7, 0, 0x13, 0x00, 8)
#define SOUND_MENU_COIN_ITS_A_ME_MARIO SOUND_ARG_LOAD(7, 0, 0x14, 0x00, 8)
#define SOUND_MENU_YOSHI_GAIN_LIVES SOUND_ARG_LOAD(7, 0, 0x15, 0x00, 8)
#define SOUND_MENU_ENTER_PIPE SOUND_ARG_LOAD(7, 0, 0x16, 0xA0, 8)
#define SOUND_MENU_EXIT_PIPE SOUND_ARG_LOAD(7, 0, 0x17, 0xA0, 8)
#define SOUND_MENU_BOWSER_LAUGH SOUND_ARG_LOAD(7, 0, 0x18, 0x80, 8)
#define SOUND_MENU_ENTER_HOLE SOUND_ARG_LOAD(7, 1, 0x19, 0x80, 8)
/* not verified */ #define SOUND_MENU_CLICK_CHANGE_VIEW SOUND_ARG_LOAD(7, 0, 0x1A, 0x80, 8)
/* not verified */ #define SOUND_MENU_CAMERA_UNUSED1 0x701B
/* not verified */ #define SOUND_MENU_CAMERA_UNUSED2 0x701C
/* not verified */ #define SOUND_MENU_MARIO_CASTLE_WARP SOUND_ARG_LOAD(7, 0, 0x1D, 0xB0, 8)
/* not verified */
#define SOUND_MENU_CLICK_CHANGE_VIEW SOUND_ARG_LOAD(7, 0, 0x1A, 0x80, 8)
/* not verified */
#define SOUND_MENU_CAMERA_UNUSED1 0x701B
/* not verified */
#define SOUND_MENU_CAMERA_UNUSED2 0x701C
/* not verified */
#define SOUND_MENU_MARIO_CASTLE_WARP SOUND_ARG_LOAD(7, 0, 0x1D, 0xB0, 8)
#define SOUND_MENU_STAR_SOUND SOUND_ARG_LOAD(7, 0, 0x1E, 0xFF, 8)
#define SOUND_MENU_THANK_YOU_PLAYING_MY_GAME SOUND_ARG_LOAD(7, 0, 0x1F, 0xFF, 8)
/* not verified */ #define SOUND_MENU_READ_A_SIGN 0x7020
/* not verified */ #define SOUND_MENU_EXIT_A_SIGN 0x7021
/* not verified */ #define SOUND_MENU_MARIO_CASTLE_WARP2 SOUND_ARG_LOAD(7, 0, 0x22, 0x20, 8)
/* not verified */
#define SOUND_MENU_READ_A_SIGN 0x7020
/* not verified */
#define SOUND_MENU_EXIT_A_SIGN 0x7021
/* not verified */
#define SOUND_MENU_MARIO_CASTLE_WARP2 SOUND_ARG_LOAD(7, 0, 0x22, 0x20, 8)
#define SOUND_MENU_STAR_SOUND_OKEY_DOKEY SOUND_ARG_LOAD(7, 0, 0x23, 0xFF, 8)
#define SOUND_MENU_STAR_SOUND_LETS_A_GO SOUND_ARG_LOAD(7, 0, 0x24, 0xFF, 8)
+1 -1
View File
@@ -357,7 +357,7 @@
CMD_BBH(0x19, 0x00, background), \
CMD_PTR(function)
#define GEO_BACKGROUND_COLOR(background) \
GEO_BACKGROUND(background, NULL)
GEO_BACKGROUND(background, nullptr)
/**
* 0x1A: No operation
+430 -209
View File
@@ -5,215 +5,436 @@
enum MarioAnimID
{
/* 0x00 */ MARIO_ANIM_SLOW_LEDGE_GRAB,
/* 0x01 */ MARIO_ANIM_FALL_OVER_BACKWARDS,
/* 0x02 */ MARIO_ANIM_BACKWARD_AIR_KB,
/* 0x03 */ MARIO_ANIM_DYING_ON_BACK,
/* 0x04 */ MARIO_ANIM_BACKFLIP,
/* 0x05 */ MARIO_ANIM_CLIMB_UP_POLE,
/* 0x06 */ MARIO_ANIM_GRAB_POLE_SHORT,
/* 0x07 */ MARIO_ANIM_GRAB_POLE_SWING_PART1,
/* 0x08 */ MARIO_ANIM_GRAB_POLE_SWING_PART2,
/* 0x09 */ MARIO_ANIM_HANDSTAND_IDLE,
/* 0x0A */ MARIO_ANIM_HANDSTAND_JUMP,
/* 0x0B */ MARIO_ANIM_START_HANDSTAND,
/* 0x0C */ MARIO_ANIM_RETURN_FROM_HANDSTAND,
/* 0x0D */ MARIO_ANIM_IDLE_ON_POLE,
/* 0x0E */ MARIO_ANIM_A_POSE,
/* 0x0F */ MARIO_ANIM_SKID_ON_GROUND,
/* 0x10 */ MARIO_ANIM_STOP_SKID,
/* 0x11 */ MARIO_ANIM_CROUCH_FROM_FAST_LONGJUMP,
/* 0x12 */ MARIO_ANIM_CROUCH_FROM_SLOW_LONGJUMP,
/* 0x13 */ MARIO_ANIM_FAST_LONGJUMP,
/* 0x14 */ MARIO_ANIM_SLOW_LONGJUMP,
/* 0x15 */ MARIO_ANIM_AIRBORNE_ON_STOMACH,
/* 0x16 */ MARIO_ANIM_WALK_WITH_LIGHT_OBJ,
/* 0x17 */ MARIO_ANIM_RUN_WITH_LIGHT_OBJ,
/* 0x18 */ MARIO_ANIM_SLOW_WALK_WITH_LIGHT_OBJ,
/* 0x19 */ MARIO_ANIM_SHIVERING_WARMING_HAND,
/* 0x1A */ MARIO_ANIM_SHIVERING_RETURN_TO_IDLE,
/* 0x1B */ MARIO_ANIM_SHIVERING,
/* 0x1C */ MARIO_ANIM_CLIMB_DOWN_LEDGE,
/* 0x1D */ MARIO_ANIM_CREDITS_WAVING,
/* 0x1E */ MARIO_ANIM_CREDITS_LOOK_UP,
/* 0x1F */ MARIO_ANIM_CREDITS_RETURN_FROM_LOOK_UP,
/* 0x20 */ MARIO_ANIM_CREDITS_RAISE_HAND,
/* 0x21 */ MARIO_ANIM_CREDITS_LOWER_HAND,
/* 0x22 */ MARIO_ANIM_CREDITS_TAKE_OFF_CAP,
/* 0x23 */ MARIO_ANIM_CREDITS_START_WALK_LOOK_UP,
/* 0x24 */ MARIO_ANIM_CREDITS_LOOK_BACK_THEN_RUN,
/* 0x25 */ MARIO_ANIM_FINAL_BOWSER_RAISE_HAND_SPIN,
/* 0x26 */ MARIO_ANIM_FINAL_BOWSER_WING_CAP_TAKE_OFF,
/* 0x27 */ MARIO_ANIM_CREDITS_PEACE_SIGN,
/* 0x28 */ MARIO_ANIM_STAND_UP_FROM_LAVA_BOOST,
/* 0x29 */ MARIO_ANIM_FIRE_LAVA_BURN,
/* 0x2A */ MARIO_ANIM_WING_CAP_FLY,
/* 0x2B */ MARIO_ANIM_HANG_ON_OWL,
/* 0x2C */ MARIO_ANIM_LAND_ON_STOMACH,
/* 0x2D */ MARIO_ANIM_AIR_FORWARD_KB,
/* 0x2E */ MARIO_ANIM_DYING_ON_STOMACH,
/* 0x2F */ MARIO_ANIM_SUFFOCATING,
/* 0x30 */ MARIO_ANIM_COUGHING,
/* 0x31 */ MARIO_ANIM_THROW_CATCH_KEY,
/* 0x32 */ MARIO_ANIM_DYING_FALL_OVER,
/* 0x33 */ MARIO_ANIM_IDLE_ON_LEDGE,
/* 0x34 */ MARIO_ANIM_FAST_LEDGE_GRAB,
/* 0x35 */ MARIO_ANIM_HANG_ON_CEILING,
/* 0x36 */ MARIO_ANIM_PUT_CAP_ON,
/* 0x37 */ MARIO_ANIM_TAKE_CAP_OFF_THEN_ON,
/* 0x38 */ MARIO_ANIM_QUICKLY_PUT_CAP_ON, // unused
/* 0x39 */ MARIO_ANIM_HEAD_STUCK_IN_GROUND,
/* 0x3A */ MARIO_ANIM_GROUND_POUND_LANDING,
/* 0x3B */ MARIO_ANIM_TRIPLE_JUMP_GROUND_POUND,
/* 0x3C */ MARIO_ANIM_START_GROUND_POUND,
/* 0x3D */ MARIO_ANIM_GROUND_POUND,
/* 0x3E */ MARIO_ANIM_BOTTOM_STUCK_IN_GROUND,
/* 0x3F */ MARIO_ANIM_IDLE_WITH_LIGHT_OBJ,
/* 0x40 */ MARIO_ANIM_JUMP_LAND_WITH_LIGHT_OBJ,
/* 0x41 */ MARIO_ANIM_JUMP_WITH_LIGHT_OBJ,
/* 0x42 */ MARIO_ANIM_FALL_LAND_WITH_LIGHT_OBJ,
/* 0x43 */ MARIO_ANIM_FALL_WITH_LIGHT_OBJ,
/* 0x44 */ MARIO_ANIM_FALL_FROM_SLIDING_WITH_LIGHT_OBJ,
/* 0x45 */ MARIO_ANIM_SLIDING_ON_BOTTOM_WITH_LIGHT_OBJ,
/* 0x46 */ MARIO_ANIM_STAND_UP_FROM_SLIDING_WITH_LIGHT_OBJ,
/* 0x47 */ MARIO_ANIM_RIDING_SHELL,
/* 0x48 */ MARIO_ANIM_WALKING,
/* 0x49 */ MARIO_ANIM_FORWARD_FLIP, // unused
/* 0x4A */ MARIO_ANIM_JUMP_RIDING_SHELL,
/* 0x4B */ MARIO_ANIM_LAND_FROM_DOUBLE_JUMP,
/* 0x4C */ MARIO_ANIM_DOUBLE_JUMP_FALL,
/* 0x4D */ MARIO_ANIM_SINGLE_JUMP,
/* 0x4E */ MARIO_ANIM_LAND_FROM_SINGLE_JUMP,
/* 0x4F */ MARIO_ANIM_AIR_KICK,
/* 0x50 */ MARIO_ANIM_DOUBLE_JUMP_RISE,
/* 0x51 */ MARIO_ANIM_START_FORWARD_SPINNING, // unused
/* 0x52 */ MARIO_ANIM_THROW_LIGHT_OBJECT,
/* 0x53 */ MARIO_ANIM_FALL_FROM_SLIDE_KICK,
/* 0x54 */ MARIO_ANIM_BEND_KNESS_RIDING_SHELL, // unused
/* 0x55 */ MARIO_ANIM_LEGS_STUCK_IN_GROUND,
/* 0x56 */ MARIO_ANIM_GENERAL_FALL,
/* 0x57 */ MARIO_ANIM_GENERAL_LAND,
/* 0x58 */ MARIO_ANIM_BEING_GRABBED,
/* 0x59 */ MARIO_ANIM_GRAB_HEAVY_OBJECT,
/* 0x5A */ MARIO_ANIM_SLOW_LAND_FROM_DIVE,
/* 0x5B */ MARIO_ANIM_FLY_FROM_CANNON,
/* 0x5C */ MARIO_ANIM_MOVE_ON_WIRE_NET_RIGHT,
/* 0x5D */ MARIO_ANIM_MOVE_ON_WIRE_NET_LEFT,
/* 0x5E */ MARIO_ANIM_MISSING_CAP,
/* 0x5F */ MARIO_ANIM_PULL_DOOR_WALK_IN,
/* 0x60 */ MARIO_ANIM_PUSH_DOOR_WALK_IN,
/* 0x61 */ MARIO_ANIM_UNLOCK_DOOR,
/* 0x62 */ MARIO_ANIM_START_REACH_POCKET, // unused, reaching keys maybe?
/* 0x63 */ MARIO_ANIM_REACH_POCKET, // unused
/* 0x64 */ MARIO_ANIM_STOP_REACH_POCKET, // unused
/* 0x65 */ MARIO_ANIM_GROUND_THROW,
/* 0x66 */ MARIO_ANIM_GROUND_KICK,
/* 0x67 */ MARIO_ANIM_FIRST_PUNCH,
/* 0x68 */ MARIO_ANIM_SECOND_PUNCH,
/* 0x69 */ MARIO_ANIM_FIRST_PUNCH_FAST,
/* 0x6A */ MARIO_ANIM_SECOND_PUNCH_FAST,
/* 0x6B */ MARIO_ANIM_PICK_UP_LIGHT_OBJ,
/* 0x6C */ MARIO_ANIM_PUSHING,
/* 0x6D */ MARIO_ANIM_START_RIDING_SHELL,
/* 0x6E */ MARIO_ANIM_PLACE_LIGHT_OBJ,
/* 0x6F */ MARIO_ANIM_FORWARD_SPINNING,
/* 0x70 */ MARIO_ANIM_BACKWARD_SPINNING,
/* 0x71 */ MARIO_ANIM_BREAKDANCE,
/* 0x72 */ MARIO_ANIM_RUNNING,
/* 0x73 */ MARIO_ANIM_RUNNING_UNUSED, // unused duplicate, originally part 2?
/* 0x74 */ MARIO_ANIM_SOFT_BACK_KB,
/* 0x75 */ MARIO_ANIM_SOFT_FRONT_KB,
/* 0x76 */ MARIO_ANIM_DYING_IN_QUICKSAND,
/* 0x77 */ MARIO_ANIM_IDLE_IN_QUICKSAND,
/* 0x78 */ MARIO_ANIM_MOVE_IN_QUICKSAND,
/* 0x79 */ MARIO_ANIM_ELECTROCUTION,
/* 0x7A */ MARIO_ANIM_SHOCKED,
/* 0x7B */ MARIO_ANIM_BACKWARD_KB,
/* 0x7C */ MARIO_ANIM_FORWARD_KB,
/* 0x7D */ MARIO_ANIM_IDLE_HEAVY_OBJ,
/* 0x7E */ MARIO_ANIM_STAND_AGAINST_WALL,
/* 0x7F */ MARIO_ANIM_SIDESTEP_LEFT,
/* 0x80 */ MARIO_ANIM_SIDESTEP_RIGHT,
/* 0x81 */ MARIO_ANIM_START_SLEEP_IDLE,
/* 0x82 */ MARIO_ANIM_START_SLEEP_SCRATCH,
/* 0x83 */ MARIO_ANIM_START_SLEEP_YAWN,
/* 0x84 */ MARIO_ANIM_START_SLEEP_SITTING,
/* 0x85 */ MARIO_ANIM_SLEEP_IDLE,
/* 0x86 */ MARIO_ANIM_SLEEP_START_LYING,
/* 0x87 */ MARIO_ANIM_SLEEP_LYING,
/* 0x88 */ MARIO_ANIM_DIVE,
/* 0x89 */ MARIO_ANIM_SLIDE_DIVE,
/* 0x8A */ MARIO_ANIM_GROUND_BONK,
/* 0x8B */ MARIO_ANIM_STOP_SLIDE_LIGHT_OBJ,
/* 0x8C */ MARIO_ANIM_SLIDE_KICK,
/* 0x8D */ MARIO_ANIM_CROUCH_FROM_SLIDE_KICK,
/* 0x8E */ MARIO_ANIM_SLIDE_MOTIONLESS, // unused
/* 0x8F */ MARIO_ANIM_STOP_SLIDE,
/* 0x90 */ MARIO_ANIM_FALL_FROM_SLIDE,
/* 0x91 */ MARIO_ANIM_SLIDE,
/* 0x92 */ MARIO_ANIM_TIPTOE,
/* 0x93 */ MARIO_ANIM_TWIRL_LAND,
/* 0x94 */ MARIO_ANIM_TWIRL,
/* 0x95 */ MARIO_ANIM_START_TWIRL,
/* 0x96 */ MARIO_ANIM_STOP_CROUCHING,
/* 0x97 */ MARIO_ANIM_START_CROUCHING,
/* 0x98 */ MARIO_ANIM_CROUCHING,
/* 0x99 */ MARIO_ANIM_CRAWLING,
/* 0x9A */ MARIO_ANIM_STOP_CRAWLING,
/* 0x9B */ MARIO_ANIM_START_CRAWLING,
/* 0x9C */ MARIO_ANIM_SUMMON_STAR,
/* 0x9D */ MARIO_ANIM_RETURN_STAR_APPROACH_DOOR,
/* 0x9E */ MARIO_ANIM_BACKWARDS_WATER_KB,
/* 0x9F */ MARIO_ANIM_SWIM_WITH_OBJ_PART1,
/* 0xA0 */ MARIO_ANIM_SWIM_WITH_OBJ_PART2,
/* 0xA1 */ MARIO_ANIM_FLUTTERKICK_WITH_OBJ,
/* 0xA2 */ MARIO_ANIM_WATER_ACTION_END_WITH_OBJ, // either swimming or flutterkicking
/* 0xA3 */ MARIO_ANIM_STOP_GRAB_OBJ_WATER,
/* 0xA4 */ MARIO_ANIM_WATER_IDLE_WITH_OBJ,
/* 0xA5 */ MARIO_ANIM_DROWNING_PART1,
/* 0xA6 */ MARIO_ANIM_DROWNING_PART2,
/* 0xA7 */ MARIO_ANIM_WATER_DYING,
/* 0xA8 */ MARIO_ANIM_WATER_FORWARD_KB,
/* 0xA9 */ MARIO_ANIM_FALL_FROM_WATER,
/* 0xAA */ MARIO_ANIM_SWIM_PART1,
/* 0xAB */ MARIO_ANIM_SWIM_PART2,
/* 0xAC */ MARIO_ANIM_FLUTTERKICK,
/* 0xAD */ MARIO_ANIM_WATER_ACTION_END, // either swimming or flutterkicking
/* 0xAE */ MARIO_ANIM_WATER_PICK_UP_OBJ,
/* 0xAF */ MARIO_ANIM_WATER_GRAB_OBJ_PART2,
/* 0xB0 */ MARIO_ANIM_WATER_GRAB_OBJ_PART1,
/* 0xB1 */ MARIO_ANIM_WATER_THROW_OBJ,
/* 0xB2 */ MARIO_ANIM_WATER_IDLE,
/* 0xB3 */ MARIO_ANIM_WATER_STAR_DANCE,
/* 0xB4 */ MARIO_ANIM_RETURN_FROM_WATER_STAR_DANCE,
/* 0xB5 */ MARIO_ANIM_GRAB_BOWSER,
/* 0xB6 */ MARIO_ANIM_SWINGING_BOWSER,
/* 0xB7 */ MARIO_ANIM_RELEASE_BOWSER,
/* 0xB8 */ MARIO_ANIM_HOLDING_BOWSER,
/* 0xB9 */ MARIO_ANIM_HEAVY_THROW,
/* 0xBA */ MARIO_ANIM_WALK_PANTING,
/* 0xBB */ MARIO_ANIM_WALK_WITH_HEAVY_OBJ,
/* 0xBC */ MARIO_ANIM_TURNING_PART1,
/* 0xBD */ MARIO_ANIM_TURNING_PART2,
/* 0xBE */ MARIO_ANIM_SLIDEFLIP_LAND,
/* 0XBF */ MARIO_ANIM_SLIDEFLIP,
/* 0xC0 */ MARIO_ANIM_TRIPLE_JUMP_LAND,
/* 0xC1 */ MARIO_ANIM_TRIPLE_JUMP,
/* 0xC2 */ MARIO_ANIM_FIRST_PERSON,
/* 0xC3 */ MARIO_ANIM_IDLE_HEAD_LEFT,
/* 0xC4 */ MARIO_ANIM_IDLE_HEAD_RIGHT,
/* 0xC5 */ MARIO_ANIM_IDLE_HEAD_CENTER,
/* 0xC6 */ MARIO_ANIM_HANDSTAND_LEFT,
/* 0xC7 */ MARIO_ANIM_HANDSTAND_RIGHT,
/* 0xC8 */ MARIO_ANIM_WAKE_FROM_SLEEP,
/* 0xC9 */ MARIO_ANIM_WAKE_FROM_LYING,
/* 0xCA */ MARIO_ANIM_START_TIPTOE,
/* 0xCB */ MARIO_ANIM_SLIDEJUMP, // pole jump and wall kick
/* 0xCC */ MARIO_ANIM_START_WALLKICK,
/* 0xCD */ MARIO_ANIM_STAR_DANCE,
/* 0xCE */ MARIO_ANIM_RETURN_FROM_STAR_DANCE,
/* 0xCF */ MARIO_ANIM_FORWARD_SPINNING_FLIP,
/* 0xD0 */ MARIO_ANIM_TRIPLE_JUMP_FLY
/* 0x00 */
MARIO_ANIM_SLOW_LEDGE_GRAB,
/* 0x01 */
MARIO_ANIM_FALL_OVER_BACKWARDS,
/* 0x02 */
MARIO_ANIM_BACKWARD_AIR_KB,
/* 0x03 */
MARIO_ANIM_DYING_ON_BACK,
/* 0x04 */
MARIO_ANIM_BACKFLIP,
/* 0x05 */
MARIO_ANIM_CLIMB_UP_POLE,
/* 0x06 */
MARIO_ANIM_GRAB_POLE_SHORT,
/* 0x07 */
MARIO_ANIM_GRAB_POLE_SWING_PART1,
/* 0x08 */
MARIO_ANIM_GRAB_POLE_SWING_PART2,
/* 0x09 */
MARIO_ANIM_HANDSTAND_IDLE,
/* 0x0A */
MARIO_ANIM_HANDSTAND_JUMP,
/* 0x0B */
MARIO_ANIM_START_HANDSTAND,
/* 0x0C */
MARIO_ANIM_RETURN_FROM_HANDSTAND,
/* 0x0D */
MARIO_ANIM_IDLE_ON_POLE,
/* 0x0E */
MARIO_ANIM_A_POSE,
/* 0x0F */
MARIO_ANIM_SKID_ON_GROUND,
/* 0x10 */
MARIO_ANIM_STOP_SKID,
/* 0x11 */
MARIO_ANIM_CROUCH_FROM_FAST_LONGJUMP,
/* 0x12 */
MARIO_ANIM_CROUCH_FROM_SLOW_LONGJUMP,
/* 0x13 */
MARIO_ANIM_FAST_LONGJUMP,
/* 0x14 */
MARIO_ANIM_SLOW_LONGJUMP,
/* 0x15 */
MARIO_ANIM_AIRBORNE_ON_STOMACH,
/* 0x16 */
MARIO_ANIM_WALK_WITH_LIGHT_OBJ,
/* 0x17 */
MARIO_ANIM_RUN_WITH_LIGHT_OBJ,
/* 0x18 */
MARIO_ANIM_SLOW_WALK_WITH_LIGHT_OBJ,
/* 0x19 */
MARIO_ANIM_SHIVERING_WARMING_HAND,
/* 0x1A */
MARIO_ANIM_SHIVERING_RETURN_TO_IDLE,
/* 0x1B */
MARIO_ANIM_SHIVERING,
/* 0x1C */
MARIO_ANIM_CLIMB_DOWN_LEDGE,
/* 0x1D */
MARIO_ANIM_CREDITS_WAVING,
/* 0x1E */
MARIO_ANIM_CREDITS_LOOK_UP,
/* 0x1F */
MARIO_ANIM_CREDITS_RETURN_FROM_LOOK_UP,
/* 0x20 */
MARIO_ANIM_CREDITS_RAISE_HAND,
/* 0x21 */
MARIO_ANIM_CREDITS_LOWER_HAND,
/* 0x22 */
MARIO_ANIM_CREDITS_TAKE_OFF_CAP,
/* 0x23 */
MARIO_ANIM_CREDITS_START_WALK_LOOK_UP,
/* 0x24 */
MARIO_ANIM_CREDITS_LOOK_BACK_THEN_RUN,
/* 0x25 */
MARIO_ANIM_FINAL_BOWSER_RAISE_HAND_SPIN,
/* 0x26 */
MARIO_ANIM_FINAL_BOWSER_WING_CAP_TAKE_OFF,
/* 0x27 */
MARIO_ANIM_CREDITS_PEACE_SIGN,
/* 0x28 */
MARIO_ANIM_STAND_UP_FROM_LAVA_BOOST,
/* 0x29 */
MARIO_ANIM_FIRE_LAVA_BURN,
/* 0x2A */
MARIO_ANIM_WING_CAP_FLY,
/* 0x2B */
MARIO_ANIM_HANG_ON_OWL,
/* 0x2C */
MARIO_ANIM_LAND_ON_STOMACH,
/* 0x2D */
MARIO_ANIM_AIR_FORWARD_KB,
/* 0x2E */
MARIO_ANIM_DYING_ON_STOMACH,
/* 0x2F */
MARIO_ANIM_SUFFOCATING,
/* 0x30 */
MARIO_ANIM_COUGHING,
/* 0x31 */
MARIO_ANIM_THROW_CATCH_KEY,
/* 0x32 */
MARIO_ANIM_DYING_FALL_OVER,
/* 0x33 */
MARIO_ANIM_IDLE_ON_LEDGE,
/* 0x34 */
MARIO_ANIM_FAST_LEDGE_GRAB,
/* 0x35 */
MARIO_ANIM_HANG_ON_CEILING,
/* 0x36 */
MARIO_ANIM_PUT_CAP_ON,
/* 0x37 */
MARIO_ANIM_TAKE_CAP_OFF_THEN_ON,
/* 0x38 */
MARIO_ANIM_QUICKLY_PUT_CAP_ON,
// unused
/* 0x39 */
MARIO_ANIM_HEAD_STUCK_IN_GROUND,
/* 0x3A */
MARIO_ANIM_GROUND_POUND_LANDING,
/* 0x3B */
MARIO_ANIM_TRIPLE_JUMP_GROUND_POUND,
/* 0x3C */
MARIO_ANIM_START_GROUND_POUND,
/* 0x3D */
MARIO_ANIM_GROUND_POUND,
/* 0x3E */
MARIO_ANIM_BOTTOM_STUCK_IN_GROUND,
/* 0x3F */
MARIO_ANIM_IDLE_WITH_LIGHT_OBJ,
/* 0x40 */
MARIO_ANIM_JUMP_LAND_WITH_LIGHT_OBJ,
/* 0x41 */
MARIO_ANIM_JUMP_WITH_LIGHT_OBJ,
/* 0x42 */
MARIO_ANIM_FALL_LAND_WITH_LIGHT_OBJ,
/* 0x43 */
MARIO_ANIM_FALL_WITH_LIGHT_OBJ,
/* 0x44 */
MARIO_ANIM_FALL_FROM_SLIDING_WITH_LIGHT_OBJ,
/* 0x45 */
MARIO_ANIM_SLIDING_ON_BOTTOM_WITH_LIGHT_OBJ,
/* 0x46 */
MARIO_ANIM_STAND_UP_FROM_SLIDING_WITH_LIGHT_OBJ,
/* 0x47 */
MARIO_ANIM_RIDING_SHELL,
/* 0x48 */
MARIO_ANIM_WALKING,
/* 0x49 */
MARIO_ANIM_FORWARD_FLIP,
// unused
/* 0x4A */
MARIO_ANIM_JUMP_RIDING_SHELL,
/* 0x4B */
MARIO_ANIM_LAND_FROM_DOUBLE_JUMP,
/* 0x4C */
MARIO_ANIM_DOUBLE_JUMP_FALL,
/* 0x4D */
MARIO_ANIM_SINGLE_JUMP,
/* 0x4E */
MARIO_ANIM_LAND_FROM_SINGLE_JUMP,
/* 0x4F */
MARIO_ANIM_AIR_KICK,
/* 0x50 */
MARIO_ANIM_DOUBLE_JUMP_RISE,
/* 0x51 */
MARIO_ANIM_START_FORWARD_SPINNING,
// unused
/* 0x52 */
MARIO_ANIM_THROW_LIGHT_OBJECT,
/* 0x53 */
MARIO_ANIM_FALL_FROM_SLIDE_KICK,
/* 0x54 */
MARIO_ANIM_BEND_KNESS_RIDING_SHELL,
// unused
/* 0x55 */
MARIO_ANIM_LEGS_STUCK_IN_GROUND,
/* 0x56 */
MARIO_ANIM_GENERAL_FALL,
/* 0x57 */
MARIO_ANIM_GENERAL_LAND,
/* 0x58 */
MARIO_ANIM_BEING_GRABBED,
/* 0x59 */
MARIO_ANIM_GRAB_HEAVY_OBJECT,
/* 0x5A */
MARIO_ANIM_SLOW_LAND_FROM_DIVE,
/* 0x5B */
MARIO_ANIM_FLY_FROM_CANNON,
/* 0x5C */
MARIO_ANIM_MOVE_ON_WIRE_NET_RIGHT,
/* 0x5D */
MARIO_ANIM_MOVE_ON_WIRE_NET_LEFT,
/* 0x5E */
MARIO_ANIM_MISSING_CAP,
/* 0x5F */
MARIO_ANIM_PULL_DOOR_WALK_IN,
/* 0x60 */
MARIO_ANIM_PUSH_DOOR_WALK_IN,
/* 0x61 */
MARIO_ANIM_UNLOCK_DOOR,
/* 0x62 */
MARIO_ANIM_START_REACH_POCKET,
// unused, reaching keys maybe?
/* 0x63 */
MARIO_ANIM_REACH_POCKET,
// unused
/* 0x64 */
MARIO_ANIM_STOP_REACH_POCKET,
// unused
/* 0x65 */
MARIO_ANIM_GROUND_THROW,
/* 0x66 */
MARIO_ANIM_GROUND_KICK,
/* 0x67 */
MARIO_ANIM_FIRST_PUNCH,
/* 0x68 */
MARIO_ANIM_SECOND_PUNCH,
/* 0x69 */
MARIO_ANIM_FIRST_PUNCH_FAST,
/* 0x6A */
MARIO_ANIM_SECOND_PUNCH_FAST,
/* 0x6B */
MARIO_ANIM_PICK_UP_LIGHT_OBJ,
/* 0x6C */
MARIO_ANIM_PUSHING,
/* 0x6D */
MARIO_ANIM_START_RIDING_SHELL,
/* 0x6E */
MARIO_ANIM_PLACE_LIGHT_OBJ,
/* 0x6F */
MARIO_ANIM_FORWARD_SPINNING,
/* 0x70 */
MARIO_ANIM_BACKWARD_SPINNING,
/* 0x71 */
MARIO_ANIM_BREAKDANCE,
/* 0x72 */
MARIO_ANIM_RUNNING,
/* 0x73 */
MARIO_ANIM_RUNNING_UNUSED,
// unused duplicate, originally part 2?
/* 0x74 */
MARIO_ANIM_SOFT_BACK_KB,
/* 0x75 */
MARIO_ANIM_SOFT_FRONT_KB,
/* 0x76 */
MARIO_ANIM_DYING_IN_QUICKSAND,
/* 0x77 */
MARIO_ANIM_IDLE_IN_QUICKSAND,
/* 0x78 */
MARIO_ANIM_MOVE_IN_QUICKSAND,
/* 0x79 */
MARIO_ANIM_ELECTROCUTION,
/* 0x7A */
MARIO_ANIM_SHOCKED,
/* 0x7B */
MARIO_ANIM_BACKWARD_KB,
/* 0x7C */
MARIO_ANIM_FORWARD_KB,
/* 0x7D */
MARIO_ANIM_IDLE_HEAVY_OBJ,
/* 0x7E */
MARIO_ANIM_STAND_AGAINST_WALL,
/* 0x7F */
MARIO_ANIM_SIDESTEP_LEFT,
/* 0x80 */
MARIO_ANIM_SIDESTEP_RIGHT,
/* 0x81 */
MARIO_ANIM_START_SLEEP_IDLE,
/* 0x82 */
MARIO_ANIM_START_SLEEP_SCRATCH,
/* 0x83 */
MARIO_ANIM_START_SLEEP_YAWN,
/* 0x84 */
MARIO_ANIM_START_SLEEP_SITTING,
/* 0x85 */
MARIO_ANIM_SLEEP_IDLE,
/* 0x86 */
MARIO_ANIM_SLEEP_START_LYING,
/* 0x87 */
MARIO_ANIM_SLEEP_LYING,
/* 0x88 */
MARIO_ANIM_DIVE,
/* 0x89 */
MARIO_ANIM_SLIDE_DIVE,
/* 0x8A */
MARIO_ANIM_GROUND_BONK,
/* 0x8B */
MARIO_ANIM_STOP_SLIDE_LIGHT_OBJ,
/* 0x8C */
MARIO_ANIM_SLIDE_KICK,
/* 0x8D */
MARIO_ANIM_CROUCH_FROM_SLIDE_KICK,
/* 0x8E */
MARIO_ANIM_SLIDE_MOTIONLESS,
// unused
/* 0x8F */
MARIO_ANIM_STOP_SLIDE,
/* 0x90 */
MARIO_ANIM_FALL_FROM_SLIDE,
/* 0x91 */
MARIO_ANIM_SLIDE,
/* 0x92 */
MARIO_ANIM_TIPTOE,
/* 0x93 */
MARIO_ANIM_TWIRL_LAND,
/* 0x94 */
MARIO_ANIM_TWIRL,
/* 0x95 */
MARIO_ANIM_START_TWIRL,
/* 0x96 */
MARIO_ANIM_STOP_CROUCHING,
/* 0x97 */
MARIO_ANIM_START_CROUCHING,
/* 0x98 */
MARIO_ANIM_CROUCHING,
/* 0x99 */
MARIO_ANIM_CRAWLING,
/* 0x9A */
MARIO_ANIM_STOP_CRAWLING,
/* 0x9B */
MARIO_ANIM_START_CRAWLING,
/* 0x9C */
MARIO_ANIM_SUMMON_STAR,
/* 0x9D */
MARIO_ANIM_RETURN_STAR_APPROACH_DOOR,
/* 0x9E */
MARIO_ANIM_BACKWARDS_WATER_KB,
/* 0x9F */
MARIO_ANIM_SWIM_WITH_OBJ_PART1,
/* 0xA0 */
MARIO_ANIM_SWIM_WITH_OBJ_PART2,
/* 0xA1 */
MARIO_ANIM_FLUTTERKICK_WITH_OBJ,
/* 0xA2 */
MARIO_ANIM_WATER_ACTION_END_WITH_OBJ,
// either swimming or flutterkicking
/* 0xA3 */
MARIO_ANIM_STOP_GRAB_OBJ_WATER,
/* 0xA4 */
MARIO_ANIM_WATER_IDLE_WITH_OBJ,
/* 0xA5 */
MARIO_ANIM_DROWNING_PART1,
/* 0xA6 */
MARIO_ANIM_DROWNING_PART2,
/* 0xA7 */
MARIO_ANIM_WATER_DYING,
/* 0xA8 */
MARIO_ANIM_WATER_FORWARD_KB,
/* 0xA9 */
MARIO_ANIM_FALL_FROM_WATER,
/* 0xAA */
MARIO_ANIM_SWIM_PART1,
/* 0xAB */
MARIO_ANIM_SWIM_PART2,
/* 0xAC */
MARIO_ANIM_FLUTTERKICK,
/* 0xAD */
MARIO_ANIM_WATER_ACTION_END,
// either swimming or flutterkicking
/* 0xAE */
MARIO_ANIM_WATER_PICK_UP_OBJ,
/* 0xAF */
MARIO_ANIM_WATER_GRAB_OBJ_PART2,
/* 0xB0 */
MARIO_ANIM_WATER_GRAB_OBJ_PART1,
/* 0xB1 */
MARIO_ANIM_WATER_THROW_OBJ,
/* 0xB2 */
MARIO_ANIM_WATER_IDLE,
/* 0xB3 */
MARIO_ANIM_WATER_STAR_DANCE,
/* 0xB4 */
MARIO_ANIM_RETURN_FROM_WATER_STAR_DANCE,
/* 0xB5 */
MARIO_ANIM_GRAB_BOWSER,
/* 0xB6 */
MARIO_ANIM_SWINGING_BOWSER,
/* 0xB7 */
MARIO_ANIM_RELEASE_BOWSER,
/* 0xB8 */
MARIO_ANIM_HOLDING_BOWSER,
/* 0xB9 */
MARIO_ANIM_HEAVY_THROW,
/* 0xBA */
MARIO_ANIM_WALK_PANTING,
/* 0xBB */
MARIO_ANIM_WALK_WITH_HEAVY_OBJ,
/* 0xBC */
MARIO_ANIM_TURNING_PART1,
/* 0xBD */
MARIO_ANIM_TURNING_PART2,
/* 0xBE */
MARIO_ANIM_SLIDEFLIP_LAND,
/* 0XBF */
MARIO_ANIM_SLIDEFLIP,
/* 0xC0 */
MARIO_ANIM_TRIPLE_JUMP_LAND,
/* 0xC1 */
MARIO_ANIM_TRIPLE_JUMP,
/* 0xC2 */
MARIO_ANIM_FIRST_PERSON,
/* 0xC3 */
MARIO_ANIM_IDLE_HEAD_LEFT,
/* 0xC4 */
MARIO_ANIM_IDLE_HEAD_RIGHT,
/* 0xC5 */
MARIO_ANIM_IDLE_HEAD_CENTER,
/* 0xC6 */
MARIO_ANIM_HANDSTAND_LEFT,
/* 0xC7 */
MARIO_ANIM_HANDSTAND_RIGHT,
/* 0xC8 */
MARIO_ANIM_WAKE_FROM_SLEEP,
/* 0xC9 */
MARIO_ANIM_WAKE_FROM_LYING,
/* 0xCA */
MARIO_ANIM_START_TIPTOE,
/* 0xCB */
MARIO_ANIM_SLIDEJUMP,
// pole jump and wall kick
/* 0xCC */
MARIO_ANIM_START_WALLKICK,
/* 0xCD */
MARIO_ANIM_STAR_DANCE,
/* 0xCE */
MARIO_ANIM_RETURN_FROM_STAR_DANCE,
/* 0xCF */
MARIO_ANIM_FORWARD_SPINNING_FLIP,
/* 0xD0 */
MARIO_ANIM_TRIPLE_JUMP_FLY
};
#endif // MARIO_ANIMATION_IDS_H
+50 -23
View File
@@ -5,41 +5,68 @@
enum MarioEyesGSCId
{
/*0x00*/ MARIO_EYES_BLINK,
/*0x01*/ MARIO_EYES_OPEN,
/*0x02*/ MARIO_EYES_HALF_CLOSED,
/*0x03*/ MARIO_EYES_CLOSED,
/*0x04*/ MARIO_EYES_LOOK_LEFT, // unused
/*0x05*/ MARIO_EYES_LOOK_RIGHT, // unused
/*0x06*/ MARIO_EYES_LOOK_UP, // unused
/*0x07*/ MARIO_EYES_LOOK_DOWN, // unused
/*0x08*/ MARIO_EYES_DEAD
/*0x00*/
MARIO_EYES_BLINK,
/*0x01*/
MARIO_EYES_OPEN,
/*0x02*/
MARIO_EYES_HALF_CLOSED,
/*0x03*/
MARIO_EYES_CLOSED,
/*0x04*/
MARIO_EYES_LOOK_LEFT,
// unused
/*0x05*/
MARIO_EYES_LOOK_RIGHT,
// unused
/*0x06*/
MARIO_EYES_LOOK_UP,
// unused
/*0x07*/
MARIO_EYES_LOOK_DOWN,
// unused
/*0x08*/
MARIO_EYES_DEAD
};
enum MarioHandGSCId
{
/*0x00*/ MARIO_HAND_FISTS,
/*0x01*/ MARIO_HAND_OPEN,
/*0x02*/ MARIO_HAND_PEACE_SIGN,
/*0x03*/ MARIO_HAND_HOLDING_CAP,
/*0x04*/ MARIO_HAND_HOLDING_WING_CAP,
/*0x05*/ MARIO_HAND_RIGHT_OPEN
/*0x00*/
MARIO_HAND_FISTS,
/*0x01*/
MARIO_HAND_OPEN,
/*0x02*/
MARIO_HAND_PEACE_SIGN,
/*0x03*/
MARIO_HAND_HOLDING_CAP,
/*0x04*/
MARIO_HAND_HOLDING_WING_CAP,
/*0x05*/
MARIO_HAND_RIGHT_OPEN
};
enum MarioCapGSCId
{
/*0x00*/ MARIO_HAS_DEFAULT_CAP_ON,
/*0x01*/ MARIO_HAS_DEFAULT_CAP_OFF,
/*0x02*/ MARIO_HAS_WING_CAP_ON,
/*0x03*/ MARIO_HAS_WING_CAP_OFF // unused
/*0x00*/
MARIO_HAS_DEFAULT_CAP_ON,
/*0x01*/
MARIO_HAS_DEFAULT_CAP_OFF,
/*0x02*/
MARIO_HAS_WING_CAP_ON,
/*0x03*/
MARIO_HAS_WING_CAP_OFF // unused
};
enum MarioGrabPosGSCId
{
/*0x00*/ GRAB_POS_NULL,
/*0x01*/ GRAB_POS_LIGHT_OBJ,
/*0x02*/ GRAB_POS_HEAVY_OBJ,
/*0x03*/ GRAB_POS_BOWSER
/*0x00*/
GRAB_POS_NULL,
/*0x01*/
GRAB_POS_LIGHT_OBJ,
/*0x02*/
GRAB_POS_HEAVY_OBJ,
/*0x03*/
GRAB_POS_BOWSER
};
#endif // MARIO_GEO_SWITCH_CASE_IDS_H
+2 -2
View File
@@ -586,7 +586,7 @@
#define /*0x0F4*/ oKickableBoardF4 OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oKickableBoardF8 OBJECT_FIELD_S32(0x1C)
/* King Bob-omb */
/* King Bob-omb */
#define /*0x088*/ oKingBobombUnk88 OBJECT_FIELD_S32(0x00)
#define /*0x0F8*/ oKingBobombUnkF8 OBJECT_FIELD_S32(0x1C)
#define /*0x0FC*/ oKingBobombUnkFC OBJECT_FIELD_S32(0x1D)
@@ -686,7 +686,7 @@
/* Mips */
#define /*0x0F4*/ oMipsStarStatus OBJECT_FIELD_S32(0x1B)
#define /*0x0F8*/ oMipsStartWaypointIndex OBJECT_FIELD_S32(0x1C)
// 0x1D-0x21 reserved for pathing
// 0x1D-0x21 reserved for pathing
#define /*0x1AC*/ oMipsForwardVelocity OBJECT_FIELD_F32(0x49)
/* Moneybag */
+72 -36
View File
@@ -3,42 +3,78 @@
#define SEQ_VARIATION 0x80
enum SeqId {
SEQ_SOUND_PLAYER, // 0x00
SEQ_EVENT_CUTSCENE_COLLECT_STAR, // 0x01
SEQ_MENU_TITLE_SCREEN, // 0x02
SEQ_LEVEL_GRASS, // 0x03
SEQ_LEVEL_INSIDE_CASTLE, // 0x04
SEQ_LEVEL_WATER, // 0x05
SEQ_LEVEL_HOT, // 0x06
SEQ_LEVEL_BOSS_KOOPA, // 0x07
SEQ_LEVEL_SNOW, // 0x08
SEQ_LEVEL_SLIDE, // 0x09
SEQ_LEVEL_SPOOKY, // 0x0A
SEQ_EVENT_PIRANHA_PLANT, // 0x0B
SEQ_LEVEL_UNDERGROUND, // 0x0C
SEQ_MENU_STAR_SELECT, // 0x0D
SEQ_EVENT_POWERUP, // 0x0E
SEQ_EVENT_METAL_CAP, // 0x0F
SEQ_EVENT_KOOPA_MESSAGE, // 0x10
SEQ_LEVEL_KOOPA_ROAD, // 0x11
SEQ_EVENT_HIGH_SCORE, // 0x12
SEQ_EVENT_MERRY_GO_ROUND, // 0x13
SEQ_EVENT_RACE, // 0x14
SEQ_EVENT_CUTSCENE_STAR_SPAWN, // 0x15
SEQ_EVENT_BOSS, // 0x16
SEQ_EVENT_CUTSCENE_COLLECT_KEY, // 0x17
SEQ_EVENT_ENDLESS_STAIRS, // 0x18
SEQ_LEVEL_BOSS_KOOPA_FINAL, // 0x19
SEQ_EVENT_CUTSCENE_CREDITS, // 0x1A
SEQ_EVENT_SOLVE_PUZZLE, // 0x1B
SEQ_EVENT_TOAD_MESSAGE, // 0x1C
SEQ_EVENT_PEACH_MESSAGE, // 0x1D
SEQ_EVENT_CUTSCENE_INTRO, // 0x1E
SEQ_EVENT_CUTSCENE_VICTORY, // 0x1F
SEQ_EVENT_CUTSCENE_ENDING, // 0x20
SEQ_MENU_FILE_SELECT, // 0x21
SEQ_EVENT_CUTSCENE_LAKITU, // 0x22 (not in JP)
enum SeqId
{
SEQ_SOUND_PLAYER,
// 0x00
SEQ_EVENT_CUTSCENE_COLLECT_STAR,
// 0x01
SEQ_MENU_TITLE_SCREEN,
// 0x02
SEQ_LEVEL_GRASS,
// 0x03
SEQ_LEVEL_INSIDE_CASTLE,
// 0x04
SEQ_LEVEL_WATER,
// 0x05
SEQ_LEVEL_HOT,
// 0x06
SEQ_LEVEL_BOSS_KOOPA,
// 0x07
SEQ_LEVEL_SNOW,
// 0x08
SEQ_LEVEL_SLIDE,
// 0x09
SEQ_LEVEL_SPOOKY,
// 0x0A
SEQ_EVENT_PIRANHA_PLANT,
// 0x0B
SEQ_LEVEL_UNDERGROUND,
// 0x0C
SEQ_MENU_STAR_SELECT,
// 0x0D
SEQ_EVENT_POWERUP,
// 0x0E
SEQ_EVENT_METAL_CAP,
// 0x0F
SEQ_EVENT_KOOPA_MESSAGE,
// 0x10
SEQ_LEVEL_KOOPA_ROAD,
// 0x11
SEQ_EVENT_HIGH_SCORE,
// 0x12
SEQ_EVENT_MERRY_GO_ROUND,
// 0x13
SEQ_EVENT_RACE,
// 0x14
SEQ_EVENT_CUTSCENE_STAR_SPAWN,
// 0x15
SEQ_EVENT_BOSS,
// 0x16
SEQ_EVENT_CUTSCENE_COLLECT_KEY,
// 0x17
SEQ_EVENT_ENDLESS_STAIRS,
// 0x18
SEQ_LEVEL_BOSS_KOOPA_FINAL,
// 0x19
SEQ_EVENT_CUTSCENE_CREDITS,
// 0x1A
SEQ_EVENT_SOLVE_PUZZLE,
// 0x1B
SEQ_EVENT_TOAD_MESSAGE,
// 0x1C
SEQ_EVENT_PEACH_MESSAGE,
// 0x1D
SEQ_EVENT_CUTSCENE_INTRO,
// 0x1E
SEQ_EVENT_CUTSCENE_VICTORY,
// 0x1F
SEQ_EVENT_CUTSCENE_ENDING,
// 0x20
SEQ_MENU_FILE_SELECT,
// 0x21
SEQ_EVENT_CUTSCENE_LAKITU,
// 0x22 (not in JP)
SEQ_COUNT
};
+2 -3
View File
@@ -1,7 +1,8 @@
#ifndef SPECIAL_PRESET_NAMES_H
#define SPECIAL_PRESET_NAMES_H
enum SpecialPresets {
enum SpecialPresets
{
special_null_start,
special_yellow_coin,
special_yellow_coin_2,
@@ -43,7 +44,6 @@ enum SpecialPresets {
special_rotating_counter_clockwise,
special_wf_tumbling_bridge,
special_large_bomp,
special_level_geo_03 = 0x65,
special_level_geo_04,
special_level_geo_05,
@@ -86,7 +86,6 @@ enum SpecialPresets {
special_1star_door,
special_3star_door,
special_key_door,
special_null_end = 0xFF
};
+311 -160
View File
@@ -14,26 +14,33 @@
// avoid on modern GCC. This only impacts -O2 and can matter for both the function
// itself and functions that call it.
#ifdef AVOID_UB
#define BAD_RETURN(cmd) void
#define BAD_RETURN(cmd) void
#else
#define BAD_RETURN(cmd) cmd
#define BAD_RETURN(cmd) cmd
#endif
struct Controller
{
/*0x00*/ s16 rawStickX; //
/*0x02*/ s16 rawStickY; //
/*0x04*/ float stickX; // [-64, 64] positive is right
/*0x08*/ float stickY; // [-64, 64] positive is up
/*0x0C*/ float stickMag; // distance from center [0, 64]
/*0x10*/ u16 buttonDown;
/*0x12*/ u16 buttonPressed;
///*0x14*/ OSContStatus *statusData;
/*0x00*/
s16 rawStickX; //
/*0x02*/
s16 rawStickY; //
/*0x04*/
float stickX; // [-64, 64] positive is right
/*0x08*/
float stickY; // [-64, 64] positive is up
/*0x0C*/
float stickMag; // distance from center [0, 64]
/*0x10*/
u16 buttonDown;
/*0x12*/
u16 buttonPressed;
///*0x14*/ OSContStatus *statusData;
///*0x18*/ OSContPad *controllerData;
#ifdef VERSION_SH
/*0x1C*/ int port;
#endif
#ifdef VERSION_SH
/*0x1C*/ int port;
#endif
};
typedef f32 Vec2f[2];
@@ -54,7 +61,8 @@ typedef s16 Trajectory;
typedef s16 PaintingData;
typedef uintptr_t BehaviorScript;
enum SpTaskState {
enum SpTaskState
{
SPTASK_STATE_NOT_STARTED,
SPTASK_STATE_RUNNING,
SPTASK_STATE_INTERRUPTED,
@@ -64,10 +72,14 @@ enum SpTaskState {
struct SPTask
{
/*0x00*/ OSTask task;
/*0x40*/ OSMesgQueue *msgqueue;
/*0x44*/ OSMesg msg;
/*0x48*/ enum SpTaskState state;
/*0x00*/
OSTask task;
/*0x40*/
OSMesgQueue *msgqueue;
/*0x44*/
OSMesg msg;
/*0x48*/
enum SpTaskState state;
}; // size = 0x4C, align = 0x8
struct VblankHandler
@@ -85,53 +97,87 @@ struct VblankHandler
#define ANIM_FLAG_6 (1 << 6) // 0x40
#define ANIM_FLAG_7 (1 << 7) // 0x80
struct Animation {
/*0x00*/ s16 flags;
/*0x02*/ s16 animYTransDivisor;
/*0x04*/ s16 startFrame;
/*0x06*/ s16 loopStart;
/*0x08*/ s16 loopEnd; /*0x0A*/ s16 unusedBoneCount;
/*0x0C*/ s16 *values;
/*0x10*/ u16 *index;
/*0x14*/ u32 length; // only used with Mario animations to determine how much to load. 0 otherwise.
struct Animation
{
/*0x00*/
s16 flags;
/*0x02*/
s16 animYTransDivisor;
/*0x04*/
s16 startFrame;
/*0x06*/
s16 loopStart;
/*0x08*/
s16 loopEnd; /*0x0A*/
s16 unusedBoneCount;
/*0x0C*/
s16 *values;
/*0x10*/
u16 *index;
/*0x14*/
u32 length; // only used with Mario animations to determine how much to load. 0 otherwise.
};
#define ANIMINDEX_NUMPARTS(animindex) (sizeof(animindex) / sizeof(u16) / 6 - 1)
struct GraphNode
{
/*0x00*/ s16 type; // structure type
/*0x02*/ s16 flags; // hi = drawing layer, lo = rendering modes
/*0x04*/ struct GraphNode *prev;
/*0x08*/ struct GraphNode *next;
/*0x0C*/ struct GraphNode *parent;
/*0x10*/ struct GraphNode *children;
/*0x00*/
s16 type; // structure type
/*0x02*/
s16 flags; // hi = drawing layer, lo = rendering modes
/*0x04*/
struct GraphNode *prev;
/*0x08*/
struct GraphNode *next;
/*0x0C*/
struct GraphNode *parent;
/*0x10*/
struct GraphNode *children;
};
struct AnimInfo
{
/*0x00 0x38*/ s16 animID;
/*0x02 0x3A*/ s16 animYTrans;
/*0x04 0x3C*/ struct Animation *curAnim;
/*0x08 0x40*/ s16 animFrame;
/*0x0A 0x42*/ u16 animTimer;
/*0x0C 0x44*/ s32 animFrameAccelAssist;
/*0x10 0x48*/ s32 animAccel;
/*0x00 0x38*/
s16 animID;
/*0x02 0x3A*/
s16 animYTrans;
/*0x04 0x3C*/
struct Animation *curAnim;
/*0x08 0x40*/
s16 animFrame;
/*0x0A 0x42*/
u16 animTimer;
/*0x0C 0x44*/
s32 animFrameAccelAssist;
/*0x10 0x48*/
s32 animAccel;
};
struct GraphNodeObject
{
/*0x00*/ struct GraphNode node;
/*0x14*/ struct GraphNode *sharedChild;
/*0x18*/ s8 areaIndex;
/*0x19*/ s8 activeAreaIndex;
/*0x1A*/ Vec3s angle;
/*0x20*/ Vec3f pos;
/*0x2C*/ Vec3f scale;
/*0x38*/ struct AnimInfo animInfo;
/*0x4C*/ struct SpawnInfo *unk4C;
/*0x50*/ Mat4 *throwMatrix; // matrix ptr
/*0x54*/ Vec3f cameraToObject;
/*0x00*/
struct GraphNode node;
/*0x14*/
struct GraphNode *sharedChild;
/*0x18*/
s8 areaIndex;
/*0x19*/
s8 activeAreaIndex;
/*0x1A*/
Vec3s angle;
/*0x20*/
Vec3f pos;
/*0x2C*/
Vec3f scale;
/*0x38*/
struct AnimInfo animInfo;
/*0x4C*/
struct SpawnInfo *unk4C;
/*0x50*/
Mat4 *throwMatrix; // matrix ptr
/*0x54*/
Vec3f cameraToObject;
};
struct ObjectNode
@@ -146,13 +192,21 @@ struct ObjectNode
struct Object
{
/*0x000*/ struct ObjectNode header;
/*0x068*/ struct Object *parentObj;
/*0x06C*/ struct Object *prevObj;
/*0x070*/ u32 collidedObjInteractTypes;
/*0x074*/ s16 activeFlags;
/*0x076*/ s16 numCollidedObjs;
/*0x078*/ struct Object *collidedObjs[4];
/*0x000*/
struct ObjectNode header;
/*0x068*/
struct Object *parentObj;
/*0x06C*/
struct Object *prevObj;
/*0x070*/
u32 collidedObjInteractTypes;
/*0x074*/
s16 activeFlags;
/*0x076*/
s16 numCollidedObjs;
/*0x078*/
struct Object *collidedObjs[4];
/*0x088*/
union
{
@@ -161,7 +215,7 @@ struct Object
s32 asS32[0x50];
s16 asS16[0x50][2];
f32 asF32[0x50];
#if !IS_64_BIT
#if !IS_64_BIT
s16 *asS16P[0x50];
s32 *asS32P[0x50];
struct Animation **asAnims[0x50];
@@ -171,10 +225,11 @@ struct Object
struct SM64SurfaceCollisionData *asSurface[0x50];
void *asVoidPtr[0x50];
const void *asConstVoidPtr[0x50];
#endif
#endif
} rawData;
#if IS_64_BIT
union {
#if IS_64_BIT
union
{
s16 *asS16P[0x50];
s32 *asS32P[0x50];
struct Animation **asAnims[0x50];
@@ -185,37 +240,63 @@ struct Object
void *asVoidPtr[0x50];
const void *asConstVoidPtr[0x50];
} ptrData;
#endif
/*0x1C8*/ u32 unused1;
/*0x1CC*/ const BehaviorScript *curBhvCommand;
/*0x1D0*/ u32 bhvStackIndex;
/*0x1D4*/ uintptr_t bhvStack[8];
/*0x1F4*/ s16 bhvDelayTimer;
/*0x1F6*/ s16 respawnInfoType;
/*0x1F8*/ f32 hitboxRadius;
/*0x1FC*/ f32 hitboxHeight;
/*0x200*/ f32 hurtboxRadius;
/*0x204*/ f32 hurtboxHeight;
/*0x208*/ f32 hitboxDownOffset;
/*0x20C*/ const BehaviorScript *behavior;
/*0x210*/ u32 unused2;
/*0x214*/ struct SM64SurfaceObjectTransform *platform; // libsm64: type change from Object*
/*0x218*/ void *collisionData;
/*0x21C*/ Mat4 transform;
/*0x25C*/ void *respawnInfo;
#endif
/*0x1C8*/
u32 unused1;
/*0x1CC*/
const BehaviorScript *curBhvCommand;
/*0x1D0*/
u32 bhvStackIndex;
/*0x1D4*/
uintptr_t bhvStack[8];
/*0x1F4*/
s16 bhvDelayTimer;
/*0x1F6*/
s16 respawnInfoType;
/*0x1F8*/
f32 hitboxRadius;
/*0x1FC*/
f32 hitboxHeight;
/*0x200*/
f32 hurtboxRadius;
/*0x204*/
f32 hurtboxHeight;
/*0x208*/
f32 hitboxDownOffset;
/*0x20C*/
const BehaviorScript *behavior;
/*0x210*/
u32 unused2;
/*0x214*/
struct SM64SurfaceObjectTransform *platform; // libsm64: type change from Object*
/*0x218*/
void *collisionData;
/*0x21C*/
Mat4 transform;
/*0x25C*/
void *respawnInfo;
};
struct ObjectHitbox
{
/*0x00*/ u32 interactType;
/*0x04*/ u8 downOffset;
/*0x05*/ s8 damageOrCoinValue;
/*0x06*/ s8 health;
/*0x07*/ s8 numLootCoins;
/*0x08*/ s16 radius;
/*0x0A*/ s16 height;
/*0x0C*/ s16 hurtboxRadius;
/*0x0E*/ s16 hurtboxHeight;
/*0x00*/
u32 interactType;
/*0x04*/
u8 downOffset;
/*0x05*/
s8 damageOrCoinValue;
/*0x06*/
s8 health;
/*0x07*/
s8 numLootCoins;
/*0x08*/
s16 radius;
/*0x0A*/
s16 height;
/*0x0C*/
s16 hurtboxRadius;
/*0x0E*/
s16 hurtboxHeight;
};
struct Waypoint
@@ -226,17 +307,28 @@ struct Waypoint
struct MarioBodyState
{
/*0x00*/ u32 action;
/*0x04*/ s8 capState; /// see MarioCapGSCId
/*0x05*/ s8 eyeState;
/*0x06*/ s8 handState;
/*0x07*/ s8 wingFlutter; /// whether Mario's wing cap wings are fluttering
/*0x08*/ s16 modelState;
/*0x0A*/ s8 grabPos;
/*0x0B*/ u8 punchState; /// 2 bits for type of punch, 6 bits for punch animation timer
/*0x0C*/ Vec3s torsoAngle;
/*0x12*/ Vec3s headAngle;
/*0x18*/ Vec3f heldObjLastPosition; /// also known as HOLP
/*0x00*/
u32 action;
/*0x04*/
s8 capState; /// see MarioCapGSCId
/*0x05*/
s8 eyeState;
/*0x06*/
s8 handState;
/*0x07*/
s8 wingFlutter; /// whether Mario's wing cap wings are fluttering
/*0x08*/
s16 modelState;
/*0x0A*/
s8 grabPos;
/*0x0B*/
u8 punchState; /// 2 bits for type of punch, 6 bits for punch animation timer
/*0x0C*/
Vec3s torsoAngle;
/*0x12*/
Vec3s headAngle;
/*0x18*/
Vec3f heldObjLastPosition; /// also known as HOLP
u8 padding[4];
};
@@ -263,66 +355,125 @@ struct MarioAnimation
struct MarioState
{
/*0x00*/ u16 unk00;
/*0x02*/ u16 input;
/*0x04*/ u32 flags;
/*0x08*/ u32 particleFlags;
/*0x0C*/ u32 action;
/*0x10*/ u32 prevAction;
/*0x14*/ u32 terrainSoundAddend;
/*0x18*/ u16 actionState;
/*0x1A*/ u16 actionTimer;
/*0x1C*/ u32 actionArg;
/*0x20*/ f32 intendedMag;
/*0x24*/ s16 intendedYaw;
/*0x26*/ s16 invincTimer;
/*0x28*/ u8 framesSinceA;
/*0x29*/ u8 framesSinceB;
/*0x2A*/ u8 wallKickTimer;
/*0x2B*/ u8 doubleJumpTimer;
/*0x2C*/ Vec3s faceAngle;
/*0x32*/ Vec3s angleVel;
/*0x38*/ s16 slideYaw;
/*0x3A*/ s16 twirlYaw;
/*0x3C*/ Vec3f pos;
/*0x48*/ Vec3f vel;
/*0x54*/ f32 forwardVel;
/*0x58*/ f32 slideVelX;
/*0x5C*/ f32 slideVelZ;
/*0x60*/ struct SM64SurfaceCollisionData *wall;
/*0x64*/ struct SM64SurfaceCollisionData *ceil;
/*0x68*/ struct SM64SurfaceCollisionData *floor;
/*0x6C*/ f32 ceilHeight;
/*0x70*/ f32 floorHeight;
/*0x74*/ s16 floorAngle;
/*0x76*/ s32 waterLevel; // libsm64: 32 bit (address offsets after this are wrong)
/*0x78*/ struct Object *interactObj;
/*0x7C*/ struct Object *heldObj;
/*0x80*/ struct Object *usedObj;
/*0x84*/ struct Object *riddenObj;
/*0x88*/ struct Object *marioObj;
/*0x8C*/ struct SpawnInfo *spawnInfo;
/*0x90*/ struct Area *area;
// /*0x94*/ struct PlayerCameraState *statusForCamera;
/*0x98*/ struct MarioBodyState *marioBodyState;
/*0x9C*/ struct Controller *controller;
/*0xA0*/ struct MarioAnimation *animation;
/*0xA4*/ u32 collidedObjInteractTypes;
/*0xA8*/ s16 numCoins;
/*0xAA*/ s16 numStars;
/*0xAC*/ s8 numKeys; // Unused key mechanic
/*0xAD*/ s8 numLives;
/*0xAE*/ s16 health;
/*0xB0*/ s16 unkB0;
/*0xB2*/ u8 hurtCounter;
/*0xB3*/ u8 healCounter;
/*0xB4*/ u8 squishTimer;
/*0xB5*/ u8 fadeWarpOpacity;
/*0xB6*/ u16 capTimer;
/*0xB8*/ s16 prevNumStarsForDialog;
/*0xBC*/ f32 peakHeight;
/*0xC0*/ f32 quicksandDepth;
/*0xC4*/ f32 unkC4;
/*0x00*/
u16 unk00;
/*0x02*/
u16 input;
/*0x04*/
u32 flags;
/*0x08*/
u32 particleFlags;
/*0x0C*/
u32 action;
/*0x10*/
u32 prevAction;
/*0x14*/
u32 terrainSoundAddend;
/*0x18*/
u16 actionState;
/*0x1A*/
u16 actionTimer;
/*0x1C*/
u32 actionArg;
/*0x20*/
f32 intendedMag;
/*0x24*/
s16 intendedYaw;
/*0x26*/
s16 invincTimer;
/*0x28*/
u8 framesSinceA;
/*0x29*/
u8 framesSinceB;
/*0x2A*/
u8 wallKickTimer;
/*0x2B*/
u8 doubleJumpTimer;
/*0x2C*/
Vec3s faceAngle;
/*0x32*/
Vec3s angleVel;
/*0x38*/
s16 slideYaw;
/*0x3A*/
s16 twirlYaw;
/*0x3C*/
Vec3f pos;
/*0x48*/
Vec3f vel;
/*0x54*/
f32 forwardVel;
/*0x58*/
f32 slideVelX;
/*0x5C*/
f32 slideVelZ;
/*0x60*/
struct SM64SurfaceCollisionData *wall;
/*0x64*/
struct SM64SurfaceCollisionData *ceil;
/*0x68*/
struct SM64SurfaceCollisionData *floor;
/*0x6C*/
f32 ceilHeight;
/*0x70*/
f32 floorHeight;
/*0x74*/
s16 floorAngle;
/*0x76*/
s32 waterLevel; // libsm64: 32 bit (address offsets after this are wrong)
/*0x78*/
struct Object *interactObj;
/*0x7C*/
struct Object *heldObj;
/*0x80*/
struct Object *usedObj;
/*0x84*/
struct Object *riddenObj;
/*0x88*/
struct Object *marioObj;
/*0x8C*/
struct SpawnInfo *spawnInfo;
/*0x90*/
struct Area *area;
// /*0x94*/ struct PlayerCameraState *statusForCamera;
/*0x98*/
struct MarioBodyState *marioBodyState;
/*0x9C*/
struct Controller *controller;
/*0xA0*/
struct MarioAnimation *animation;
/*0xA4*/
u32 collidedObjInteractTypes;
/*0xA8*/
s16 numCoins;
/*0xAA*/
s16 numStars;
/*0xAC*/
s8 numKeys; // Unused key mechanic
/*0xAD*/
s8 numLives;
/*0xAE*/
s16 health;
/*0xB0*/
s16 unkB0;
/*0xB2*/
u8 hurtCounter;
/*0xB3*/
u8 healCounter;
/*0xB4*/
u8 squishTimer;
/*0xB5*/
u8 fadeWarpOpacity;
/*0xB6*/
u16 capTimer;
/*0xB8*/
s16 prevNumStarsForDialog;
/*0xBC*/
f32 peakHeight;
/*0xC0*/
f32 quicksandDepth;
/*0xC4*/
f32 unkC4;
u16 curTerrain; // libsm64: added field
s32 gasLevel; // libsm64: added field
+13 -13
View File
@@ -5,7 +5,7 @@
// TODO don't handle every individual allocation with malloc, it sucks on windows
struct AllocOnlyPool
struct AllocOnlyPool
{
size_t allocatedCount;
void **allocatedBlocks;
@@ -20,40 +20,40 @@ void memory_init(void)
void memory_terminate(void)
{
alloc_only_pool_free( s_display_list_pool );
alloc_only_pool_free(s_display_list_pool);
}
struct AllocOnlyPool *alloc_only_pool_init(void)
{
struct AllocOnlyPool *newPool = malloc( sizeof( struct AllocOnlyPool ));
struct AllocOnlyPool *newPool = malloc(sizeof(struct AllocOnlyPool));
newPool->allocatedCount = 0;
newPool->allocatedBlocks = NULL;
newPool->allocatedBlocks = nullptr;
return newPool;
}
void *alloc_only_pool_alloc(struct AllocOnlyPool *pool, s32 size)
{
pool->allocatedCount++;
pool->allocatedBlocks = realloc( pool->allocatedBlocks, pool->allocatedCount * sizeof( void * ));
pool->allocatedBlocks[ pool->allocatedCount - 1 ] = malloc( size );
return pool->allocatedBlocks[ pool->allocatedCount - 1 ];
pool->allocatedBlocks = realloc(pool->allocatedBlocks, pool->allocatedCount * sizeof(void *));
pool->allocatedBlocks[pool->allocatedCount - 1] = malloc(size);
return pool->allocatedBlocks[pool->allocatedCount - 1];
}
void alloc_only_pool_free(struct AllocOnlyPool *pool)
{
for( int i = 0; i < pool->allocatedCount; ++i )
free( pool->allocatedBlocks[i] );
free( pool->allocatedBlocks );
free( pool );
for (int i = 0; i < pool->allocatedCount; ++i)
free(pool->allocatedBlocks[i]);
free(pool->allocatedBlocks);
free(pool);
}
void display_list_pool_reset(void)
{
alloc_only_pool_free( s_display_list_pool );
alloc_only_pool_free(s_display_list_pool);
s_display_list_pool = alloc_only_pool_init();
}
void *alloc_display_list(u32 size)
{
return alloc_only_pool_alloc( s_display_list_pool, (s32)size );
return alloc_only_pool_alloc(s_display_list_pool, (s32)size);
}
+4
View File
@@ -5,11 +5,15 @@
struct AllocOnlyPool;
extern void memory_init(void);
extern void memory_terminate(void);
extern struct AllocOnlyPool *alloc_only_pool_init(void);
extern void *alloc_only_pool_alloc(struct AllocOnlyPool *pool, s32 size);
extern void alloc_only_pool_free(struct AllocOnlyPool *pool);
extern void display_list_pool_reset(void);
extern void *alloc_display_list(u32 size);
+41 -20
View File
@@ -3,29 +3,35 @@
#define PATCH(SRC, BASE, TYPE) //SRC = (TYPE)((uintptr_t) SRC + (uintptr_t) BASE)
void alSeqFileNew(ALSeqFile *f, u8 *base) {
void alSeqFileNew(ALSeqFile *f, u8 *base)
{
int i;
for (i = 0; i < f->seqCount; i++) {
for (i = 0; i < f->seqCount; i++)
{
PATCH(f->seqArray[i].offset, base, u8 *);
}
}
static void _bnkfPatchBank(ALInstrument *inst, ALBankFile *f, u8 *table) {
static void _bnkfPatchBank(ALInstrument *inst, ALBankFile *f, u8 *table)
{
int i;
ALSound *sound;
ALWaveTable *wavetable;
u8 *table2;
if (inst->flags) {
if (inst->flags)
{
return;
}
inst->flags = 1;
for (i = 0; i < inst->soundCount; i++) {
for (i = 0; i < inst->soundCount; i++)
{
PATCH(inst->soundArray[i], f, ALSound *);
sound = inst->soundArray[i];
if (sound->flags) {
if (sound->flags)
{
continue;
}
@@ -36,19 +42,25 @@ static void _bnkfPatchBank(ALInstrument *inst, ALBankFile *f, u8 *table) {
PATCH(sound->keyMap, f, ALKeyMap *);
PATCH(sound->wavetable, f, ALWaveTable *);
wavetable = sound->wavetable;
if (wavetable->flags) {
if (wavetable->flags)
{
continue;
}
wavetable->flags = 1;
PATCH(wavetable->base, table2, u8 *);
if (wavetable->type == 0) {
if (wavetable->type == 0)
{
PATCH(wavetable->waveInfo.adpcmWave.book, f, ALADPCMBook *);
if (wavetable->waveInfo.adpcmWave.loop != NULL) {
if (wavetable->waveInfo.adpcmWave.loop != nullptr)
{
PATCH(wavetable->waveInfo.adpcmWave.loop, f, ALADPCMloop *);
}
} else if (wavetable->type == 1) {
if (wavetable->waveInfo.rawWave.loop != NULL) {
}
else if (wavetable->type == 1)
{
if (wavetable->waveInfo.rawWave.loop != nullptr)
{
PATCH(wavetable->waveInfo.rawWave.loop, f, ALRawLoop *);
}
}
@@ -57,34 +69,43 @@ static void _bnkfPatchBank(ALInstrument *inst, ALBankFile *f, u8 *table) {
// Force adding another jr $ra. Has to be called or it doesn't get put in the
// right place.
static void unused(void) {
static void unused(void)
{
}
void alBnkfNew(ALBankFile *f, u8 *table) {
void alBnkfNew(ALBankFile *f, u8 *table)
{
ALBank *bank;
int i;
int j;
unused();
if (f->revision != AL_BANK_VERSION) {
if (f->revision != AL_BANK_VERSION)
{
return;
}
for (i = 0; i < f->bankCount; i++) {
for (i = 0; i < f->bankCount; i++)
{
PATCH(f->bankArray[i], f, ALBank *);
if (f->bankArray[i] == NULL) {
if (f->bankArray[i] == nullptr)
{
continue;
}
bank = f->bankArray[i];
if (bank->flags == 0) {
if (bank->flags == 0)
{
bank->flags = 1;
if (bank->percussion != NULL) {
if (bank->percussion != nullptr)
{
PATCH(bank->percussion, f, ALInstrument *);
_bnkfPatchBank(bank->percussion, f, table);
}
for (j = 0; j < bank->instCount; j++) {
for (j = 0; j < bank->instCount; j++)
{
PATCH(bank->instArray[j], f, ALInstrument *);
if (bank->instArray[j] != NULL) {
if (bank->instArray[j] != nullptr)
{
_bnkfPatchBank(bank->instArray[j], f, table);
}
}

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