Reformat to something more readable for me :3
This commit is contained in:
+1
-1
@@ -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,12 +109,13 @@ 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) {
|
||||
void seq_channel_layer_process_script(struct SequenceChannelLayer *layer)
|
||||
{
|
||||
struct SequencePlayer *seqPlayer; // sp5C, t4
|
||||
struct SequenceChannel *seqChannel; // sp58, t5
|
||||
struct M64ScriptState *state;
|
||||
@@ -144,31 +145,37 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
#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,9 +232,12 @@ 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 {
|
||||
}
|
||||
else
|
||||
{
|
||||
layer->pan = (f32)temp_a0_5 / US_FLOAT(128.0);
|
||||
}
|
||||
break;
|
||||
@@ -229,9 +245,12 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
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;
|
||||
@@ -242,9 +261,12 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
//layer->continuousNotes = (cmd == 0xc4) ? TRUE : FALSE;
|
||||
{
|
||||
u8 setting;
|
||||
if (cmd == 0xc4) {
|
||||
if (cmd == 0xc4)
|
||||
{
|
||||
setting = TRUE;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
setting = FALSE;
|
||||
}
|
||||
layer->continuousNotes = setting;
|
||||
@@ -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
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
+34
-18
@@ -18,22 +18,38 @@ struct ReverbSettingsEU sReverbSettings[] = {
|
||||
{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
|
||||
|
||||
@@ -183,7 +199,7 @@ struct AdsrEnvelope gDefaultEnvelope[] = {
|
||||
|
||||
#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 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)
|
||||
@@ -485,7 +501,7 @@ u8 unk_sh_data2[4] = { 0, 0, 0, 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
|
||||
#endif
|
||||
|
||||
+156
-74
@@ -14,13 +14,16 @@
|
||||
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
|
||||
@@ -36,7 +39,7 @@ void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 reca
|
||||
|
||||
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;
|
||||
@@ -58,23 +61,27 @@ void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 reca
|
||||
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)
|
||||
seqPlayer->recalculateVolume = TRUE;
|
||||
#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 (--seqPlayer->fadeRemainingFrames == 0)
|
||||
{
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (seqPlayer->state == 2) {
|
||||
if (seqPlayer->state == 2)
|
||||
{
|
||||
sequence_player_disable(seqPlayer);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
switch (seqPlayer->state) {
|
||||
switch (seqPlayer->state)
|
||||
{
|
||||
case SEQUENCE_PLAYER_STATE_FADE_OUT:
|
||||
sequence_player_disable(seqPlayer);
|
||||
return;
|
||||
@@ -124,15 +138,18 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
|
||||
}
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (seqPlayer->recalculateVolume) {
|
||||
if (seqPlayer->recalculateVolume)
|
||||
{
|
||||
seqPlayer->appliedFadeVolume = seqPlayer->fadeVolume * seqPlayer->fadeVolumeScale;
|
||||
}
|
||||
#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) {
|
||||
&& seqPlayer->channels[i]->enabled == TRUE)
|
||||
{
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
sequence_channel_process_sound(seqPlayer->channels[i], seqPlayer->recalculateVolume);
|
||||
#else
|
||||
@@ -146,11 +163,13 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
|
||||
#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 (p->mode == 0)
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
#endif
|
||||
@@ -176,20 +195,23 @@ f32 get_portamento_freq_scale(struct Portamento *p) {
|
||||
}
|
||||
|
||||
#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;
|
||||
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,46 +231,63 @@ 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) {
|
||||
if (vib->extentChangeTimer)
|
||||
{
|
||||
if (vib->extentChangeTimer == 1)
|
||||
{
|
||||
vib->extent = (s32)vib->seqChannel->vibratoExtentTarget;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
vib->extent +=
|
||||
((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) {
|
||||
}
|
||||
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) {
|
||||
if (vib->rateChangeTimer)
|
||||
{
|
||||
if (vib->rateChangeTimer == 1)
|
||||
{
|
||||
vib->rate = (s32)vib->seqChannel->vibratoRateTarget;
|
||||
} else {
|
||||
}
|
||||
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) {
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -263,27 +302,34 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void note_vibrato_update(struct Note *note) {
|
||||
void note_vibrato_update(struct Note *note)
|
||||
{
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (note->portamento.mode != 0) {
|
||||
if (note->portamento.mode != 0)
|
||||
{
|
||||
note->portamentoFreqScale = get_portamento_freq_scale(¬e->portamento);
|
||||
}
|
||||
if (note->vibratoState.active && note->parentLayer != NO_LAYER) {
|
||||
if (note->vibratoState.active && note->parentLayer != NO_LAYER)
|
||||
{
|
||||
note->vibratoFreqScale = get_vibrato_freq_scale(¬e->vibratoState);
|
||||
}
|
||||
#else
|
||||
if (note->vibratoState.active) {
|
||||
if (note->vibratoState.active)
|
||||
{
|
||||
note->portamentoFreqScale = get_portamento_freq_scale(¬e->portamento);
|
||||
if (note->parentLayer != NO_LAYER) {
|
||||
if (note->parentLayer != NO_LAYER)
|
||||
{
|
||||
note->vibratoFreqScale = get_vibrato_freq_scale(¬e->vibratoState);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void note_vibrato_init(struct Note *note) {
|
||||
void note_vibrato_init(struct Note *note)
|
||||
{
|
||||
struct VibratoState *vib;
|
||||
UNUSED struct SequenceChannel *seqChannel;
|
||||
UNUSED
|
||||
struct SequenceChannel *seqChannel;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
struct NotePlaybackState *seqPlayerState = (struct NotePlaybackState *)¬e->priority;
|
||||
#endif
|
||||
@@ -296,7 +342,8 @@ void note_vibrato_init(struct Note *note) {
|
||||
#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;
|
||||
}
|
||||
@@ -308,15 +355,21 @@ void note_vibrato_init(struct Note *note) {
|
||||
#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;
|
||||
@@ -327,15 +380,21 @@ void note_vibrato_init(struct Note *note) {
|
||||
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;
|
||||
@@ -344,7 +403,8 @@ void note_vibrato_init(struct Note *note) {
|
||||
#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)
|
||||
@@ -364,26 +424,32 @@ void adsr_init(struct AdsrState *adsr, struct AdsrEnvelope *envelope, UNUSED s16
|
||||
}
|
||||
|
||||
#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) {
|
||||
s32 adsr_update(struct AdsrState *adsr)
|
||||
{
|
||||
#endif
|
||||
u8 action = adsr->action;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
u8 state = adsr->state;
|
||||
switch (state) {
|
||||
#else
|
||||
switch (adsr->state) {
|
||||
switch (adsr->state)
|
||||
{
|
||||
#endif
|
||||
case ADSR_STATE_DISABLED:
|
||||
return 0;
|
||||
|
||||
case ADSR_STATE_INITIAL: {
|
||||
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) {
|
||||
if (action & ADSR_ACTION_HANG)
|
||||
{
|
||||
adsr->state = ADSR_STATE_HANG;
|
||||
break;
|
||||
}
|
||||
@@ -403,7 +469,8 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
#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;
|
||||
@@ -423,7 +490,8 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
|
||||
default:
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (adsr->delay >= 4) {
|
||||
if (adsr->delay >= 4)
|
||||
{
|
||||
adsr->delay = adsr->delay * gAudioBufferParameters.updatesPerFrame
|
||||
#ifdef VERSION_SH
|
||||
/ gAudioBufferParameters.presetUnk4
|
||||
@@ -431,7 +499,8 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
/ 4;
|
||||
}
|
||||
#if defined(VERSION_SH)
|
||||
if (adsr->delay == 0) {
|
||||
if (adsr->delay == 0)
|
||||
{
|
||||
adsr->delay = 1;
|
||||
}
|
||||
adsr->target = (f32)BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
|
||||
@@ -448,7 +517,8 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
adsr->envIndex++;
|
||||
break;
|
||||
}
|
||||
if (adsr->state != ADSR_STATE_FADE) {
|
||||
if (adsr->state != ADSR_STATE_FADE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
// fallthrough
|
||||
@@ -460,7 +530,8 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
adsr->currentHiRes += adsr->velocity;
|
||||
adsr->current = adsr->currentHiRes >> 0x10;
|
||||
#endif
|
||||
if (--adsr->delay <= 0) {
|
||||
if (--adsr->delay <= 0)
|
||||
{
|
||||
adsr->state = ADSR_STATE_LOOP;
|
||||
}
|
||||
// fallthrough
|
||||
@@ -469,14 +540,17 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
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 (adsr->sustain != 0.0f && state == ADSR_STATE_DECAY) {
|
||||
#else
|
||||
if (adsr->sustain != 0 && adsr->state == ADSR_STATE_DECAY) {
|
||||
if (adsr->sustain != 0 && adsr->state == ADSR_STATE_DECAY)
|
||||
{
|
||||
#endif
|
||||
if (adsr->current < adsr->sustain) {
|
||||
if (adsr->current < adsr->sustain)
|
||||
{
|
||||
adsr->current = adsr->sustain;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
adsr->delay = 128;
|
||||
@@ -489,17 +563,20 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
}
|
||||
|
||||
#if defined(VERSION_SH)
|
||||
if (adsr->current < 0.00001f) {
|
||||
if (adsr->current < 0.00001f)
|
||||
{
|
||||
adsr->current = 0.0f;
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
}
|
||||
#elif defined(VERSION_EU)
|
||||
if (adsr->current < 0) {
|
||||
if (adsr->current < 0)
|
||||
{
|
||||
adsr->current = 0.0f;
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
}
|
||||
#else
|
||||
if (adsr->current < 100) {
|
||||
if (adsr->current < 100)
|
||||
{
|
||||
adsr->current = 0;
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
}
|
||||
@@ -509,18 +586,21 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
|
||||
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)
|
||||
adsr->action = action & ~ADSR_ACTION_RELEASE;
|
||||
@@ -530,10 +610,12 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
}
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (adsr->current < 0.0f) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
+674
-322
File diff suppressed because it is too large
Load Diff
@@ -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_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
|
||||
|
||||
+593
-300
File diff suppressed because it is too large
Load Diff
+32
-14
@@ -23,7 +23,8 @@ struct SoundAllocPool
|
||||
s32 numAllocatedEntries;
|
||||
}; // size = 0x10
|
||||
|
||||
struct SeqOrBankEntry {
|
||||
struct SeqOrBankEntry
|
||||
{
|
||||
u8 *ptr;
|
||||
u32 size;
|
||||
#ifdef VERSION_SH
|
||||
@@ -36,21 +37,27 @@ struct SeqOrBankEntry {
|
||||
|
||||
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)
|
||||
|
||||
+536
-266
File diff suppressed because it is too large
Load Diff
+243
-123
@@ -11,14 +11,22 @@
|
||||
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
|
||||
struct SharedDma {
|
||||
/*0x0*/ u8 *buffer; // target, points to pre-allocated buffer
|
||||
/*0x4*/ uintptr_t source; // device address
|
||||
/*0x8*/ u16 sizeUnused; // set to bufSize, never read
|
||||
/*0xA*/ u16 bufSize; // size of buffer
|
||||
/*0xC*/ u8 unused2; // set to 0, never read
|
||||
/*0xD*/ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
|
||||
/*0xE*/ u8 ttl; // duration after which the DMA can be discarded
|
||||
struct SharedDma
|
||||
{
|
||||
/*0x0*/
|
||||
u8 *buffer; // target, points to pre-allocated buffer
|
||||
/*0x4*/
|
||||
uintptr_t source; // device address
|
||||
/*0x8*/
|
||||
u16 sizeUnused; // set to bufSize, never read
|
||||
/*0xA*/
|
||||
u16 bufSize; // size of buffer
|
||||
/*0xC*/
|
||||
u8 unused2; // set to 0, never read
|
||||
/*0xD*/
|
||||
u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
|
||||
/*0xE*/
|
||||
u8 ttl; // duration after which the DMA can be discarded
|
||||
}; // size = 0x10
|
||||
|
||||
// EU only
|
||||
@@ -110,7 +118,8 @@ ALSeqFile *get_audio_file_header(s32 arg0);
|
||||
/**
|
||||
* Performs an immediate DMA copy
|
||||
*/
|
||||
void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes) {
|
||||
void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes)
|
||||
{
|
||||
DEBUG_PRINT("audio_dma_copy_immediate()");
|
||||
DEBUG_PRINT("- dev addr: %x", devAddr);
|
||||
DEBUG_PRINT("- vAddr: %x", vAddr);
|
||||
@@ -122,7 +131,7 @@ void audio_dma_copy_immediate(uintptr_t devAddr, void *vAddr, size_t nbytes) {
|
||||
osPiStartDma(&gAudioDmaIoMesg, OS_MESG_PRI_HIGH, OS_READ, devAddr, vAddr, nbytes,
|
||||
&gAudioDmaMesgQueue);
|
||||
DEBUG_PRINT("- recv message");
|
||||
osRecvMesg(&gAudioDmaMesgQueue, NULL, OS_MESG_BLOCK);
|
||||
osRecvMesg(&gAudioDmaMesgQueue, nullptr, OS_MESG_BLOCK);
|
||||
eu_stubbed_printf_0("Romcopyend\n");
|
||||
}
|
||||
|
||||
@@ -148,7 +157,8 @@ u8 audioString49[] = "BANK LOAD MISS! FOR %d\n";
|
||||
/**
|
||||
* Performs an asynchronus (normal priority) DMA copy
|
||||
*/
|
||||
void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *queue, OSIoMesg *mesg) {
|
||||
void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *queue, OSIoMesg *mesg)
|
||||
{
|
||||
osInvalDCache(vAddr, nbytes);
|
||||
osPiStartDma(mesg, OS_MESG_PRI_NORMAL, OS_READ, devAddr, vAddr, nbytes, queue);
|
||||
}
|
||||
@@ -157,7 +167,8 @@ void audio_dma_copy_async(uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQ
|
||||
* Performs a partial asynchronous (normal priority) DMA copy. This is limited
|
||||
* to 0x1000 bytes transfer at once.
|
||||
*/
|
||||
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)
|
||||
{
|
||||
#if defined(VERSION_EU)
|
||||
ssize_t transfer = (*remaining >= 0x1000 ? 0x1000 : *remaining);
|
||||
#else
|
||||
@@ -170,33 +181,40 @@ void audio_dma_partial_copy_async(uintptr_t *devAddr, u8 **vAddr, ssize_t *remai
|
||||
*vAddr += transfer;
|
||||
}
|
||||
|
||||
void decrease_sample_dma_ttls() {
|
||||
void decrease_sample_dma_ttls()
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < sSampleDmaListSize1; i++) {
|
||||
for (i = 0; i < sSampleDmaListSize1; i++)
|
||||
{
|
||||
#if defined(VERSION_EU)
|
||||
struct SharedDma *temp = &sSampleDmas[i];
|
||||
#else
|
||||
struct SharedDma *temp = sSampleDmas + i;
|
||||
#endif
|
||||
if (temp->ttl != 0) {
|
||||
if (temp->ttl != 0)
|
||||
{
|
||||
temp->ttl--;
|
||||
if (temp->ttl == 0) {
|
||||
if (temp->ttl == 0)
|
||||
{
|
||||
temp->reuseIndex = sSampleDmaReuseQueueHead1;
|
||||
sSampleDmaReuseQueue1[sSampleDmaReuseQueueHead1++] = (u8)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++)
|
||||
{
|
||||
#if defined(VERSION_EU)
|
||||
struct SharedDma *temp = &sSampleDmas[i];
|
||||
#else
|
||||
struct SharedDma *temp = sSampleDmas + i;
|
||||
#endif
|
||||
if (temp->ttl != 0) {
|
||||
if (temp->ttl != 0)
|
||||
{
|
||||
temp->ttl--;
|
||||
if (temp->ttl == 0) {
|
||||
if (temp->ttl == 0)
|
||||
{
|
||||
temp->reuseIndex = sSampleDmaReuseQueueHead2;
|
||||
sSampleDmaReuseQueue2[sSampleDmaReuseQueueHead2++] = (u8)i;
|
||||
}
|
||||
@@ -206,7 +224,8 @@ void decrease_sample_dma_ttls() {
|
||||
sUnused80226B40 = 0;
|
||||
}
|
||||
|
||||
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef)
|
||||
{
|
||||
s32 hasDma = FALSE;
|
||||
struct SharedDma *dma;
|
||||
uintptr_t dmaDevAddr;
|
||||
@@ -216,20 +235,25 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
ssize_t bufferPos;
|
||||
UNUSED u32 pad;
|
||||
|
||||
if (arg2 != 0 || *dmaIndexRef >= sSampleDmaListSize1) {
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
|
||||
if (arg2 != 0 || *dmaIndexRef >= sSampleDmaListSize1)
|
||||
{
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++)
|
||||
{
|
||||
#if defined(VERSION_EU)
|
||||
dma = &sSampleDmas[i];
|
||||
#else
|
||||
dma = sSampleDmas + i;
|
||||
#endif
|
||||
bufferPos = devAddr - dma->source;
|
||||
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
|
||||
if (0 <= bufferPos && (size_t)bufferPos <= dma->bufSize - size)
|
||||
{
|
||||
// We already have a DMA request for this memory range.
|
||||
if (dma->ttl == 0 && sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2) {
|
||||
if (dma->ttl == 0 && sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2)
|
||||
{
|
||||
// Move the DMA out of the reuse queue, by swapping it with the
|
||||
// tail, and then incrementing the tail.
|
||||
if (dma->reuseIndex != sSampleDmaReuseQueueTail2) {
|
||||
if (dma->reuseIndex != sSampleDmaReuseQueueTail2)
|
||||
{
|
||||
sSampleDmaReuseQueue2[dma->reuseIndex] =
|
||||
sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
|
||||
sSampleDmas[sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2]].reuseIndex =
|
||||
@@ -247,7 +271,8 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
}
|
||||
}
|
||||
|
||||
if (sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2 && arg2 != 0) {
|
||||
if (sSampleDmaReuseQueueTail2 != sSampleDmaReuseQueueHead2 && arg2 != 0)
|
||||
{
|
||||
// Allocate a DMA from reuse queue 2. This queue can be empty, since
|
||||
// TTL 60 is pretty large.
|
||||
dmaIndex = sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
|
||||
@@ -255,7 +280,9 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
dma = sSampleDmas + dmaIndex;
|
||||
hasDma = TRUE;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(VERSION_EU)
|
||||
dma = sSampleDmas;
|
||||
dma += *dmaIndexRef;
|
||||
@@ -263,14 +290,18 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
dma = sSampleDmas + *dmaIndexRef;
|
||||
#endif
|
||||
bufferPos = devAddr - dma->source;
|
||||
if (0 <= bufferPos && (size_t) bufferPos <= dma->bufSize - size) {
|
||||
if (0 <= bufferPos && (size_t)bufferPos <= dma->bufSize - size)
|
||||
{
|
||||
// We already have DMA for this memory range.
|
||||
if (dma->ttl == 0) {
|
||||
if (dma->ttl == 0)
|
||||
{
|
||||
// Move the DMA out of the reuse queue, by swapping it with the
|
||||
// tail, and then incrementing the tail.
|
||||
if (dma->reuseIndex != sSampleDmaReuseQueueTail1) {
|
||||
if (dma->reuseIndex != sSampleDmaReuseQueueTail1)
|
||||
{
|
||||
#if defined(VERSION_EU)
|
||||
if (1) {
|
||||
if (1)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
sSampleDmaReuseQueue1[dma->reuseIndex] =
|
||||
@@ -289,7 +320,8 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasDma) {
|
||||
if (!hasDma)
|
||||
{
|
||||
// Allocate a DMA from reuse queue 1. This queue will hopefully never
|
||||
// be empty, since TTL 2 is so small.
|
||||
dmaIndex = sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1++];
|
||||
@@ -320,7 +352,8 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
}
|
||||
|
||||
|
||||
void init_sample_dma_buffers(UNUSED s32 arg0) {
|
||||
void init_sample_dma_buffers(UNUSED s32 arg0)
|
||||
{
|
||||
s32 i;
|
||||
#if defined(VERSION_EU)
|
||||
#define j i
|
||||
@@ -341,7 +374,8 @@ void init_sample_dma_buffers(UNUSED s32 arg0) {
|
||||
#endif
|
||||
{
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, sDmaBufSize);
|
||||
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
|
||||
if (sSampleDmas[gSampleDmaNumListItems].buffer == nullptr)
|
||||
{
|
||||
#if defined(VERSION_EU)
|
||||
break;
|
||||
#else
|
||||
@@ -359,12 +393,14 @@ void init_sample_dma_buffers(UNUSED s32 arg0) {
|
||||
out1:
|
||||
#endif
|
||||
|
||||
for (i = 0; (u32) i < gSampleDmaNumListItems; i++) {
|
||||
for (i = 0; (u32)i < gSampleDmaNumListItems; i++)
|
||||
{
|
||||
sSampleDmaReuseQueue1[i] = (u8)i;
|
||||
sSampleDmas[i].reuseIndex = (u8)i;
|
||||
}
|
||||
|
||||
for (j = gSampleDmaNumListItems; j < 0x100; j++) {
|
||||
for (j = gSampleDmaNumListItems; j < 0x100; j++)
|
||||
{
|
||||
sSampleDmaReuseQueue1[j] = 0;
|
||||
}
|
||||
|
||||
@@ -377,9 +413,11 @@ out1:
|
||||
#else
|
||||
sDmaBufSize = 160 * 9;
|
||||
#endif
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++)
|
||||
{
|
||||
sSampleDmas[gSampleDmaNumListItems].buffer = soundAlloc(&gNotesAndBuffersPool, sDmaBufSize);
|
||||
if (sSampleDmas[gSampleDmaNumListItems].buffer == NULL) {
|
||||
if (sSampleDmas[gSampleDmaNumListItems].buffer == nullptr)
|
||||
{
|
||||
#if defined(VERSION_EU)
|
||||
break;
|
||||
#else
|
||||
@@ -397,14 +435,16 @@ out1:
|
||||
out2:
|
||||
#endif
|
||||
|
||||
for (i = sSampleDmaListSize1; (u32) i < gSampleDmaNumListItems; i++) {
|
||||
for (i = sSampleDmaListSize1; (u32)i < gSampleDmaNumListItems; i++)
|
||||
{
|
||||
sSampleDmaReuseQueue2[i - sSampleDmaListSize1] = (u8)i;
|
||||
sSampleDmas[i].reuseIndex = (u8)(i - sSampleDmaListSize1);
|
||||
}
|
||||
|
||||
// This probably meant to touch the range size1..size2 as well... but it
|
||||
// doesn't matter, since these values are never read anyway.
|
||||
for (j = gSampleDmaNumListItems; j < 0x100; j++) {
|
||||
for (j = gSampleDmaNumListItems; j < 0x100; j++)
|
||||
{
|
||||
sSampleDmaReuseQueue2[j] = sSampleDmaListSize1;
|
||||
}
|
||||
|
||||
@@ -419,29 +459,36 @@ out2:
|
||||
// This function gets optimized out on US due to being static and never called
|
||||
UNUSED static
|
||||
#endif
|
||||
void patch_sound(UNUSED struct AudioBankSound *sound, UNUSED u8 *memBase, UNUSED u8 *offsetBase) {
|
||||
void patch_sound(UNUSEDstruct AudioBankSound * sound, UNUSED u8 * memBase, UNUSED u8 * offsetBase)
|
||||
{
|
||||
struct AudioBankSample *sample;
|
||||
void *patched;
|
||||
UNUSED u8 *mem; // unused on US
|
||||
|
||||
#define PATCH(x, base) (patched = (void *)((uintptr_t) (x) + (uintptr_t) base))
|
||||
|
||||
if (sound->sample != NULL) {
|
||||
if (sound->sample != nullptr)
|
||||
{
|
||||
sample = sound->sample = PATCH(sound->sample, memBase);
|
||||
if (sample->loaded == 0) {
|
||||
if (sample->loaded == 0)
|
||||
{
|
||||
sample->sampleAddr = PATCH(sample->sampleAddr, offsetBase);
|
||||
sample->loop = PATCH(sample->loop, memBase);
|
||||
sample->book = PATCH(sample->book, memBase);
|
||||
sample->loaded = 1;
|
||||
}
|
||||
#if defined(VERSION_EU)
|
||||
else if (sample->loaded == 0x80) {
|
||||
else if (sample->loaded == 0x80)
|
||||
{
|
||||
PATCH(sample->sampleAddr, offsetBase);
|
||||
mem = soundAlloc(&gNotesAndBuffersPool, sample->sampleSize);
|
||||
if (mem == NULL) {
|
||||
if (mem == nullptr)
|
||||
{
|
||||
sample->sampleAddr = patched;
|
||||
sample->loaded = 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
audio_dma_copy_immediate((uintptr_t)patched, mem, sample->sampleSize);
|
||||
sample->loaded = 0x81;
|
||||
sample->sampleAddr = mem;
|
||||
@@ -484,7 +531,8 @@ void patch_sound(UNUSED struct AudioBankSound *sound, UNUSED u8 *memBase, UNUSED
|
||||
#endif
|
||||
|
||||
// on US/JP this inlines patch_sound, using some -sopt compiler flag
|
||||
void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums) {
|
||||
void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums)
|
||||
{
|
||||
struct Instrument *instrument;
|
||||
struct Instrument **itInstrs;
|
||||
struct Instrument **end;
|
||||
@@ -509,21 +557,26 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
|
||||
|
||||
drums = mem->drums;
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
if (drums != NULL && numDrums > 0) {
|
||||
if (drums != nullptr && numDrums > 0)
|
||||
{
|
||||
mem->drums = (void *)((uintptr_t)drums + (uintptr_t)mem);
|
||||
if (numDrums > 0) //! unneeded when -sopt is enabled
|
||||
for (i = 0; i < numDrums; i++) {
|
||||
#else
|
||||
numDrums2 = numDrums;
|
||||
if (drums != NULL && numDrums2 > 0) {
|
||||
if (drums != nullptr && numDrums2 > 0)
|
||||
{
|
||||
mem->drums = PATCH(drums, mem);
|
||||
for (i = 0; i < numDrums2; i++) {
|
||||
for (i = 0; i < numDrums2; i++)
|
||||
{
|
||||
#endif
|
||||
patched = mem->drums[i];
|
||||
if (patched != NULL) {
|
||||
if (patched != nullptr)
|
||||
{
|
||||
drum = PATCH(patched, mem);
|
||||
mem->drums[i] = drum;
|
||||
if (drum->loaded == 0) {
|
||||
if (drum->loaded == 0)
|
||||
{
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
//! copt replaces drum with 'patched' for these two lines
|
||||
PATCH_SOUND(&(*(struct Drum *)patched).sound, mem, offset);
|
||||
@@ -535,7 +588,6 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
|
||||
drum->envelope = BASE_OFFSET(mem, patched);
|
||||
drum->loaded = 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -545,7 +597,8 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
if (numInstruments >= 1)
|
||||
#endif
|
||||
if (numInstruments > 0) {
|
||||
if (numInstruments > 0)
|
||||
{
|
||||
//! Doesn't affect EU, but required for US/JP
|
||||
struct Instrument **tempInst;
|
||||
itInstrs = temp->instruments;
|
||||
@@ -555,13 +608,16 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
l2:
|
||||
#else
|
||||
do {
|
||||
do
|
||||
{
|
||||
#endif
|
||||
if (*itInstrs != NULL) {
|
||||
if (*itInstrs != nullptr)
|
||||
{
|
||||
*itInstrs = BASE_OFFSET(*itInstrs, mem);
|
||||
instrument = *itInstrs;
|
||||
|
||||
if (instrument->loaded == 0) {
|
||||
if (instrument->loaded == 0)
|
||||
{
|
||||
PATCH_SOUND(&instrument->lowNotesSound, (u8 *) mem, offset);
|
||||
PATCH_SOUND(&instrument->normalNotesSound, (u8 *) mem, offset);
|
||||
PATCH_SOUND(&instrument->highNotesSound, (u8 *) mem, offset);
|
||||
@@ -573,11 +629,13 @@ l2:
|
||||
itInstrs++;
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
//! goto generated by copt, required to match US/JP
|
||||
if (end != itInstrs) {
|
||||
if (end != itInstrs)
|
||||
{
|
||||
goto l2;
|
||||
}
|
||||
#else
|
||||
} while (end != itInstrs);
|
||||
}
|
||||
while (end != itInstrs);
|
||||
#endif
|
||||
}
|
||||
#undef PATCH_MEM
|
||||
@@ -587,7 +645,8 @@ l2:
|
||||
#undef PATCH_SOUND
|
||||
}
|
||||
|
||||
struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) {
|
||||
struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1)
|
||||
{
|
||||
DEBUG_PRINT("bank_load_immediate()");
|
||||
|
||||
UNUSED u32 pad1[4];
|
||||
@@ -608,8 +667,9 @@ struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) {
|
||||
ctlData = gAlCtlHeader->seqArray[bankId].offset;
|
||||
DEBUG_PRINT("- alloc bank or seq");
|
||||
ret = alloc_bank_or_seq(&gBankLoadedPool, 1, alloc, arg1, bankId);
|
||||
if (ret == NULL) {
|
||||
return NULL;
|
||||
if (ret == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DEBUG_PRINT("- copying dma immediate 1");
|
||||
@@ -632,7 +692,8 @@ struct AudioBank *bank_load_immediate(s32 bankId, s32 arg1) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *seqPlayer) {
|
||||
struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *seqPlayer)
|
||||
{
|
||||
u32 numInstruments, numDrums;
|
||||
UNUSED u32 pad1[2];
|
||||
u32 buf[4];
|
||||
@@ -649,8 +710,9 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s
|
||||
alloc -= 0x10;
|
||||
ctlData = gAlCtlHeader->seqArray[bankId].offset;
|
||||
ret = alloc_bank_or_seq(&gBankLoadedPool, 1, alloc, arg1, bankId);
|
||||
if (ret == NULL) {
|
||||
return NULL;
|
||||
if (ret == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
audio_dma_copy_immediate((uintptr_t)ctlData, buf, 0x10);
|
||||
@@ -665,7 +727,8 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s
|
||||
seqPlayer->bankDmaCurrMemAddr = (u8 *)ret;
|
||||
seqPlayer->bankDmaCurrDevAddr = (uintptr_t)(ctlData + 0x10);
|
||||
seqPlayer->bankDmaRemaining = alloc;
|
||||
if (1) {
|
||||
if (1)
|
||||
{
|
||||
}
|
||||
#else
|
||||
seqPlayer->loadingBankNumInstruments = numInstruments;
|
||||
@@ -678,7 +741,7 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s
|
||||
mesgQueue = &seqPlayer->bankDmaMesgQueue;
|
||||
osCreateMesgQueue(mesgQueue, &seqPlayer->bankDmaMesg, 1);
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
seqPlayer->bankDmaMesg = NULL;
|
||||
seqPlayer->bankDmaMesg = nullptr;
|
||||
#endif
|
||||
seqPlayer->bankDmaInProgress = TRUE;
|
||||
audio_dma_partial_copy_async(&seqPlayer->bankDmaCurrDevAddr, &seqPlayer->bankDmaCurrMemAddr,
|
||||
@@ -687,7 +750,8 @@ struct AudioBank *bank_load_async(s32 bankId, s32 arg1, struct SequencePlayer *s
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *sequence_dma_immediate(s32 seqId, s32 arg1) {
|
||||
void *sequence_dma_immediate(s32 seqId, s32 arg1)
|
||||
{
|
||||
s32 seqLength;
|
||||
void *ptr;
|
||||
u8 *seqData;
|
||||
@@ -696,8 +760,9 @@ void *sequence_dma_immediate(s32 seqId, s32 arg1) {
|
||||
seqLength = ALIGN16(seqLength);
|
||||
seqData = gSeqFileHeader->seqArray[seqId].offset;
|
||||
ptr = alloc_bank_or_seq(&gSeqLoadedPool, 1, seqLength, arg1, seqId);
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
if (ptr == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
audio_dma_copy_immediate((uintptr_t)seqData, ptr, seqLength);
|
||||
@@ -705,7 +770,8 @@ void *sequence_dma_immediate(s32 seqId, s32 arg1) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer) {
|
||||
void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer)
|
||||
{
|
||||
s32 seqLength;
|
||||
void *ptr;
|
||||
u8 *seqData;
|
||||
@@ -716,23 +782,28 @@ void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer)
|
||||
seqLength = ALIGN16(seqLength);
|
||||
seqData = gSeqFileHeader->seqArray[seqId].offset;
|
||||
ptr = alloc_bank_or_seq(&gSeqLoadedPool, 1, seqLength, arg1, seqId);
|
||||
if (ptr == NULL) {
|
||||
if (ptr == nullptr)
|
||||
{
|
||||
eu_stubbed_printf_0("Heap Overflow Error\n");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (seqLength <= 0x40) {
|
||||
if (seqLength <= 0x40)
|
||||
{
|
||||
// Immediately load short sequenece
|
||||
audio_dma_copy_immediate((uintptr_t)seqData, ptr, seqLength);
|
||||
if (1) {
|
||||
if (1)
|
||||
{
|
||||
}
|
||||
gSeqLoadStatus[seqId] = SOUND_LOAD_STATUS_COMPLETE;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
audio_dma_copy_immediate((uintptr_t)seqData, ptr, 0x40);
|
||||
mesgQueue = &seqPlayer->seqDmaMesgQueue;
|
||||
osCreateMesgQueue(mesgQueue, &seqPlayer->seqDmaMesg, 1);
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
seqPlayer->seqDmaMesg = NULL;
|
||||
seqPlayer->seqDmaMesg = nullptr;
|
||||
#endif
|
||||
seqPlayer->seqDmaInProgress = TRUE;
|
||||
audio_dma_copy_async((uintptr_t)(seqData + 0x40), (u8 *)ptr + 0x40, seqLength - 0x40, mesgQueue,
|
||||
@@ -742,7 +813,8 @@ void *sequence_dma_async(s32 seqId, s32 arg1, struct SequencePlayer *seqPlayer)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
|
||||
u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount)
|
||||
{
|
||||
void *temp;
|
||||
u32 bankId;
|
||||
u16 offset;
|
||||
@@ -753,29 +825,37 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
|
||||
*nonNullCount = 0;
|
||||
#if defined(VERSION_EU)
|
||||
offset = ((u16 *)gAlBankSets)[seqId];
|
||||
for (i = gAlBankSets[offset++], ret = 0; i != 0; i--) {
|
||||
for (i = gAlBankSets[offset++], ret = 0; i != 0; i--)
|
||||
{
|
||||
bankId = gAlBankSets[offset++];
|
||||
#else
|
||||
offset = ((u16 *)gAlBankSets)[seqId] + 1;
|
||||
for (i = gAlBankSets[offset - 1], ret = 0; i != 0; i--) {
|
||||
for (i = gAlBankSets[offset - 1], ret = 0; i != 0; i--)
|
||||
{
|
||||
offset++;
|
||||
bankId = gAlBankSets[offset - 1];
|
||||
#endif
|
||||
|
||||
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE) {
|
||||
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE)
|
||||
{
|
||||
#if defined(VERSION_EU)
|
||||
temp = get_bank_or_seq(&gBankLoadedPool, 2, bankId);
|
||||
#else
|
||||
temp = get_bank_or_seq(&gBankLoadedPool, 2, gAlBankSets[offset - 1]);
|
||||
#endif
|
||||
} else {
|
||||
temp = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = nullptr;
|
||||
}
|
||||
|
||||
if (temp == NULL) {
|
||||
if (temp == nullptr)
|
||||
{
|
||||
(*nullCount)++;
|
||||
ret = bankId;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
(*nonNullCount)++;
|
||||
}
|
||||
}
|
||||
@@ -783,7 +863,8 @@ u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank) {
|
||||
struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank)
|
||||
{
|
||||
DEBUG_PRINT("load_banks_immediate()");
|
||||
void *ret;
|
||||
u32 bankId;
|
||||
@@ -793,30 +874,36 @@ struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank) {
|
||||
DEBUG_PRINT("- getting offset");
|
||||
offset = ((u16 *)gAlBankSets)[seqId];
|
||||
#ifdef VERSION_EU
|
||||
for (i = gAlBankSets[offset++]; i != 0; i--) {
|
||||
for (i = gAlBankSets[offset++]; i != 0; i--)
|
||||
{
|
||||
bankId = gAlBankSets[offset++];
|
||||
#else
|
||||
offset++;
|
||||
DEBUG_PRINT("- looping through bank sets");
|
||||
for (i = gAlBankSets[offset - 1]; i != 0; i--) {
|
||||
for (i = gAlBankSets[offset - 1]; i != 0; i--)
|
||||
{
|
||||
offset++;
|
||||
DEBUG_PRINT("- getting bank id");
|
||||
bankId = gAlBankSets[offset - 1];
|
||||
#endif
|
||||
|
||||
DEBUG_PRINT("- checking if bank load is complete");
|
||||
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE) {
|
||||
if (IS_BANK_LOAD_COMPLETE(bankId) == TRUE)
|
||||
{
|
||||
#ifdef VERSION_EU
|
||||
ret = get_bank_or_seq(&gBankLoadedPool, 2, bankId);
|
||||
#else
|
||||
DEBUG_PRINT("- getting bank or seq");
|
||||
ret = get_bank_or_seq(&gBankLoadedPool, 2, gAlBankSets[offset - 1]);
|
||||
#endif
|
||||
} else {
|
||||
ret = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = nullptr;
|
||||
}
|
||||
|
||||
if (ret == NULL) {
|
||||
if (ret == nullptr)
|
||||
{
|
||||
DEBUG_PRINT("- bank load immediate");
|
||||
ret = bank_load_immediate(bankId, 2);
|
||||
}
|
||||
@@ -825,33 +912,41 @@ struct AudioBank *load_banks_immediate(s32 seqId, u8 *outDefaultBank) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void preload_sequence(u32 seqId, u8 preloadMask) {
|
||||
void preload_sequence(u32 seqId, u8 preloadMask)
|
||||
{
|
||||
DEBUG_PRINT("preload_sequence()");
|
||||
void *sequenceData;
|
||||
u8 temp;
|
||||
|
||||
if (seqId >= gSequenceCount) {
|
||||
if (seqId >= gSequenceCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gAudioLoadLock = AUDIO_LOCK_LOADING;
|
||||
if (preloadMask & PRELOAD_BANKS) {
|
||||
if (preloadMask & PRELOAD_BANKS)
|
||||
{
|
||||
DEBUG_PRINT("- load banks immediate");
|
||||
load_banks_immediate(seqId, &temp);
|
||||
}
|
||||
|
||||
if (preloadMask & PRELOAD_SEQUENCE) {
|
||||
if (preloadMask & PRELOAD_SEQUENCE)
|
||||
{
|
||||
// @bug should be IS_SEQ_LOAD_COMPLETE
|
||||
DEBUG_PRINT("- checking if bank load immediate");
|
||||
if (IS_BANK_LOAD_COMPLETE(seqId) == TRUE) {
|
||||
if (IS_BANK_LOAD_COMPLETE(seqId) == TRUE)
|
||||
{
|
||||
eu_stubbed_printf_1("SEQ %d ALREADY CACHED\n", seqId);
|
||||
DEBUG_PRINT("- getting bank or seq");
|
||||
sequenceData = get_bank_or_seq(&gSeqLoadedPool, 2, seqId);
|
||||
} else {
|
||||
sequenceData = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
sequenceData = nullptr;
|
||||
}
|
||||
DEBUG_PRINT("- checking dma immediate");
|
||||
if (sequenceData == NULL && sequence_dma_immediate(seqId, 2) == NULL) {
|
||||
if (sequenceData == nullptr && sequence_dma_immediate(seqId, 2) == nullptr)
|
||||
{
|
||||
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
|
||||
return;
|
||||
}
|
||||
@@ -862,46 +957,59 @@ void preload_sequence(u32 seqId, u8 preloadMask) {
|
||||
|
||||
void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync);
|
||||
|
||||
void load_sequence(u32 player, u32 seqId, s32 loadAsync) {
|
||||
if (!loadAsync) {
|
||||
void load_sequence(u32 player, u32 seqId, s32 loadAsync)
|
||||
{
|
||||
if (!loadAsync)
|
||||
{
|
||||
gAudioLoadLock = AUDIO_LOCK_LOADING;
|
||||
}
|
||||
load_sequence_internal(player, seqId, loadAsync);
|
||||
if (!loadAsync) {
|
||||
if (!loadAsync)
|
||||
{
|
||||
gAudioLoadLock = AUDIO_LOCK_NOT_LOADING;
|
||||
}
|
||||
}
|
||||
|
||||
void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
|
||||
void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync)
|
||||
{
|
||||
void *sequenceData;
|
||||
struct SequencePlayer *seqPlayer = &gSequencePlayers[player];
|
||||
UNUSED u32 padding[2];
|
||||
|
||||
if (seqId >= gSequenceCount) {
|
||||
if (seqId >= gSequenceCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sequence_player_disable(seqPlayer);
|
||||
if (loadAsync) {
|
||||
if (loadAsync)
|
||||
{
|
||||
s32 numMissingBanks = 0;
|
||||
s32 dummy = 0;
|
||||
s32 bankId = get_missing_bank(seqId, &dummy, &numMissingBanks);
|
||||
if (numMissingBanks == 1) {
|
||||
if (numMissingBanks == 1)
|
||||
{
|
||||
eu_stubbed_printf_0("Ok,one bank slow load Start \n");
|
||||
if (bank_load_async(bankId, 2, seqPlayer) == NULL) {
|
||||
if (bank_load_async(bankId, 2, seqPlayer) == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// @bug This should set the last bank (i.e. the first in the JSON)
|
||||
// as default, not the missing one. This code path never gets
|
||||
// taken, though -- all sequence loading is synchronous.
|
||||
seqPlayer->defaultBank[0] = bankId;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
eu_stubbed_printf_1("Sorry,too many %d bank is none.fast load Start \n", numMissingBanks);
|
||||
if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == NULL) {
|
||||
if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == NULL) {
|
||||
}
|
||||
else if (load_banks_immediate(seqId, &seqPlayer->defaultBank[0]) == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -910,19 +1018,25 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
|
||||
|
||||
seqPlayer->seqId = seqId;
|
||||
sequenceData = get_bank_or_seq(&gSeqLoadedPool, 2, seqId);
|
||||
if (sequenceData == NULL) {
|
||||
if (seqPlayer->seqDmaInProgress) {
|
||||
if (sequenceData == nullptr)
|
||||
{
|
||||
if (seqPlayer->seqDmaInProgress)
|
||||
{
|
||||
eu_stubbed_printf_0("Error:Before Sequence-SlowDma remain.\n");
|
||||
eu_stubbed_printf_0(" Cancel Seq Start.\n");
|
||||
return;
|
||||
}
|
||||
if (loadAsync) {
|
||||
if (loadAsync)
|
||||
{
|
||||
sequenceData = sequence_dma_async(seqId, 2, seqPlayer);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
sequenceData = sequence_dma_immediate(seqId, 2);
|
||||
}
|
||||
|
||||
if (sequenceData == NULL) {
|
||||
if (sequenceData == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -937,7 +1051,8 @@ void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
|
||||
}
|
||||
|
||||
// (void) must be omitted from parameters to fix stack with -framepointer
|
||||
void audio_init() {
|
||||
void audio_init()
|
||||
{
|
||||
DEBUG_PRINT("audio_init()");
|
||||
UNUSED s8 pad[32];
|
||||
u8 buf[0x10];
|
||||
@@ -953,21 +1068,24 @@ void audio_init() {
|
||||
|
||||
DEBUG_PRINT("- setting values in unused");
|
||||
lim1 = gUnusedCount80333EE8;
|
||||
for (i = 0; i < lim1; i++) {
|
||||
for (i = 0; i < lim1; i++)
|
||||
{
|
||||
gUnused80226E58[i] = 0;
|
||||
gUnused80226E98[i] = 0;
|
||||
}
|
||||
|
||||
DEBUG_PRINT("- clearing audio heap");
|
||||
lim2 = gAudioHeapSize;
|
||||
for (i = 0; i <= lim2 / 8 - 1; i++) {
|
||||
for (i = 0; i <= lim2 / 8 - 1; i++)
|
||||
{
|
||||
((u64 *)gAudioHeap)[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
eu_stubbed_printf_1("AudioHeap is %x\n", gAudioHeapSize);
|
||||
|
||||
for (i = 0; i < NUMAIBUFFERS; i++) {
|
||||
for (i = 0; i < NUMAIBUFFERS; i++)
|
||||
{
|
||||
gAiBufferLengths[i] = 0xa0;
|
||||
}
|
||||
|
||||
@@ -975,7 +1093,7 @@ void audio_init() {
|
||||
gAudioTaskIndex = 0;
|
||||
gCurrAiBufferIndex = 0;
|
||||
gSoundMode = 0;
|
||||
gAudioTask = NULL;
|
||||
gAudioTask = nullptr;
|
||||
gAudioTasks[0].task.t.data_size = 0;
|
||||
gAudioTasks[1].task.t.data_size = 0;
|
||||
osCreateMesgQueue(&gAudioDmaMesgQueue, &gAudioDmaMesg, 1);
|
||||
@@ -986,10 +1104,12 @@ void audio_init() {
|
||||
|
||||
sound_init_main_pools(gAudioInitPoolSize);
|
||||
|
||||
for (i = 0; i < NUMAIBUFFERS; i++) {
|
||||
for (i = 0; i < NUMAIBUFFERS; i++)
|
||||
{
|
||||
gAiBuffers[i] = soundAlloc(&gAudioInitPool, AIBUFFER_LEN);
|
||||
|
||||
for (j = 0; j < (s32) (AIBUFFER_LEN / sizeof(s16)); j++) {
|
||||
for (j = 0; j < (s32)(AIBUFFER_LEN / sizeof(s16)); j++)
|
||||
{
|
||||
gAiBuffers[i][j] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -79,6 +81,7 @@ 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 decrease_sample_dma_ttls(void);
|
||||
#ifdef VERSION_SH
|
||||
void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef, s32 medium);
|
||||
|
||||
+544
-277
File diff suppressed because it is too large
Load Diff
+459
-235
File diff suppressed because it is too large
Load Diff
@@ -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)
|
||||
|
||||
+99
-55
@@ -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,9 +47,10 @@ 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);
|
||||
@@ -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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,14 +100,17 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
|
||||
gAiBufferLengths[index] = ((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI +
|
||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE;
|
||||
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
|
||||
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) {
|
||||
if (osRecvMesg(OSMesgQueues[1], &sp2C, OS_MESG_NOBLOCK) != -1)
|
||||
{
|
||||
func_802ad7ec((u32)sp2C);
|
||||
}
|
||||
|
||||
@@ -108,8 +120,8 @@ 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;
|
||||
@@ -120,35 +132,41 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
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) {
|
||||
if (osRecvMesg(OSMesgQueues[1], &msg, OS_MESG_NOBLOCK) != -1)
|
||||
{
|
||||
func_802ad7ec((u32)msg);
|
||||
}
|
||||
synthesis_execute(gAudioCmdBuffers[0], &writtenCmds, samples, num_samples);
|
||||
@@ -157,10 +175,12 @@ 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) {
|
||||
switch (cmd->u.s.op)
|
||||
{
|
||||
case 0x81:
|
||||
preload_sequence(cmd->u.s.arg2, 3);
|
||||
break;
|
||||
@@ -172,11 +192,14 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
break;
|
||||
|
||||
case 0x83:
|
||||
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
|
||||
if (cmd->u2.as_s32 == 0) {
|
||||
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE)
|
||||
{
|
||||
if (cmd->u2.as_s32 == 0)
|
||||
{
|
||||
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
}
|
||||
}
|
||||
@@ -187,14 +210,16 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
break;
|
||||
|
||||
case 0xf1:
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
gSequencePlayers[i].muted = TRUE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xf2:
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
gSequencePlayers[i].muted = FALSE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
@@ -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,51 +270,62 @@ 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) {
|
||||
void func_802ad728(u32 arg0, f32 arg1)
|
||||
{
|
||||
func_802ad6f0(arg0, (s32 *)&arg1);
|
||||
}
|
||||
|
||||
void func_802ad74c(u32 arg0, u32 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);
|
||||
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) {
|
||||
else if ((cmd->u.s.op & 0x40) != 0)
|
||||
{
|
||||
switch (cmd->u.s.op)
|
||||
{
|
||||
case 0x41:
|
||||
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
|
||||
seqPlayer->recalculateVolume = TRUE;
|
||||
@@ -304,11 +344,13 @@ void func_802ad7ec(u32 arg0) {
|
||||
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) {
|
||||
switch (cmd->u.s.op)
|
||||
{
|
||||
case 1:
|
||||
chan->volumeScale = cmd->u2.as_f32;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
@@ -329,7 +371,8 @@ void func_802ad7ec(u32 arg0) {
|
||||
chan->reverbVol = cmd->u2.as_s8;
|
||||
break;
|
||||
case 6:
|
||||
if (cmd->u.s.arg3 < 8) {
|
||||
if (cmd->u.s.arg3 < 8)
|
||||
{
|
||||
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
}
|
||||
break;
|
||||
@@ -344,7 +387,8 @@ void func_802ad7ec(u32 arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
void port_eu_init(void) {
|
||||
void port_eu_init(void)
|
||||
{
|
||||
port_eu_init_queues();
|
||||
}
|
||||
|
||||
|
||||
+190
-101
@@ -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,11 +38,13 @@ 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);
|
||||
|
||||
@@ -51,39 +54,49 @@ 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;
|
||||
}
|
||||
|
||||
if (gAudioResetStatus != 0) {
|
||||
if (audio_shut_down_and_reset_step() == 0) {
|
||||
if (gAudioResetStatus == 0) {
|
||||
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++;
|
||||
}
|
||||
|
||||
@@ -94,17 +107,22 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
|
||||
gAiBufferLengths[index] = (s16)((((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI) +
|
||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE);
|
||||
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
|
||||
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;
|
||||
@@ -113,8 +131,8 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
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;
|
||||
@@ -125,48 +143,59 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
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) {
|
||||
while (osRecvMesg(D_SH_80350F68, &msg, OS_MESG_NOBLOCK) != -1)
|
||||
{
|
||||
func_802ad7ec((u32)msg);
|
||||
}
|
||||
synthesis_execute(gAudioCmdBuffers[0], &writtenCmds, samples, num_samples);
|
||||
@@ -176,12 +205,14 @@ 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) {
|
||||
switch (cmd->u.s.op)
|
||||
{
|
||||
case 0x81:
|
||||
preload_sequence(cmd->u.s.arg2, 3);
|
||||
break;
|
||||
@@ -193,11 +224,14 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
break;
|
||||
|
||||
case 0x83:
|
||||
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE) {
|
||||
if (cmd->u2.as_s32 == 0) {
|
||||
if (gSequencePlayers[cmd->u.s.arg1].enabled != FALSE)
|
||||
{
|
||||
if (cmd->u2.as_s32 == 0)
|
||||
{
|
||||
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
}
|
||||
}
|
||||
@@ -211,25 +245,31 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
break;
|
||||
|
||||
case 0xf1:
|
||||
for (i = 0; i < 4; i++) {
|
||||
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++) {
|
||||
if (cmd->u2.as_s32 == 1)
|
||||
{
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++)
|
||||
{
|
||||
note = &gNotes[i];
|
||||
sub = ¬e->noteSubEu;
|
||||
if (note->noteSubEu.enabled && note->unkSH34 == 0) {
|
||||
if ((note->parentLayer->seqChannel->muteBehavior & 8) != 0) {
|
||||
if (note->noteSubEu.enabled && note->unkSH34 == 0)
|
||||
{
|
||||
if ((note->parentLayer->seqChannel->muteBehavior & 8) != 0)
|
||||
{
|
||||
sub->finished = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
gSequencePlayers[i].muted = FALSE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
@@ -253,10 +293,12 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
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];
|
||||
@@ -265,10 +307,12 @@ void seq_player_fade_to_zero_volume(s32 arg0, s32 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) {
|
||||
void func_802ad728(u32 arg0, f32 arg1)
|
||||
{
|
||||
func_802ad6f0(arg0, (s32 *)&arg1);
|
||||
}
|
||||
|
||||
void func_802ad74c(u32 arg0, u32 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,35 +401,45 @@ 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) {
|
||||
else if ((cmd->u.s.op & 0x40) != 0)
|
||||
{
|
||||
switch (cmd->u.s.op)
|
||||
{
|
||||
case 0x41:
|
||||
if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32) {
|
||||
if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32)
|
||||
{
|
||||
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
|
||||
seqPlayer->recalculateVolume = TRUE;
|
||||
}
|
||||
@@ -398,43 +462,51 @@ void func_802ad7ec(u32 arg0) {
|
||||
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) {
|
||||
switch (cmd->u.s.op)
|
||||
{
|
||||
case 1:
|
||||
if (chan->volumeScale != cmd->u2.as_f32) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
if (chan->reverbVol != cmd->u2.as_s8)
|
||||
{
|
||||
chan->reverbVol = cmd->u2.as_s8;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (cmd->u.s.arg3 < 8) {
|
||||
if (cmd->u.s.arg3 < 8)
|
||||
{
|
||||
chan->soundScriptIO[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
}
|
||||
break;
|
||||
@@ -452,10 +524,12 @@ 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;
|
||||
}
|
||||
@@ -463,63 +537,78 @@ u32 func_sh_802f6878(s32 *arg0) {
|
||||
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);
|
||||
|
||||
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};
|
||||
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";
|
||||
|
||||
+603
-300
File diff suppressed because it is too large
Load Diff
@@ -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 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
|
||||
|
||||
@@ -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";
|
||||
|
||||
+400
-178
File diff suppressed because it is too large
Load Diff
@@ -30,10 +30,14 @@ struct ReverbRingBufferItem
|
||||
|
||||
struct SynthesisReverb
|
||||
{
|
||||
/*0x00, 0x00, 0x00*/ u8 resampleFlags;
|
||||
/*0x01, 0x01, 0x01*/ u8 useReverb;
|
||||
/*0x02, 0x02, 0x02*/ u8 framesLeftToIgnore;
|
||||
/*0x03, 0x03, 0x03*/ u8 curFrame;
|
||||
/*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
|
||||
@@ -44,25 +48,37 @@ struct SynthesisReverb
|
||||
#ifdef VERSION_SH
|
||||
/* 0x08*/ u16 unk08;
|
||||
#endif
|
||||
/*0x04, 0x08, 0x0A*/ u16 reverbGain;
|
||||
/*0x06, 0x0A, 0x0C*/ u16 resampleRate;
|
||||
/*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;
|
||||
/*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];
|
||||
|
||||
/*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;
|
||||
|
||||
+316
-145
@@ -39,7 +39,8 @@
|
||||
|
||||
#define ALIGN(val, amnt) (((val) + (1 << amnt) - 1) & ~((1 << amnt) - 1))
|
||||
|
||||
struct VolumeChange {
|
||||
struct VolumeChange
|
||||
{
|
||||
u16 sourceLeft;
|
||||
u16 sourceRight;
|
||||
u16 targetLeft;
|
||||
@@ -65,7 +66,8 @@ struct NoteSubEu *gNoteSubsEu;
|
||||
// Equivalent functionality as the US/JP version,
|
||||
// just that the reverb structure is chosen from an array with index
|
||||
// Identical in EU.
|
||||
void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex) {
|
||||
void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
|
||||
{
|
||||
struct ReverbRingBufferItem *item;
|
||||
struct SynthesisReverb *reverb = &gSynthesisReverbs[reverbIndex];
|
||||
s32 srcPos;
|
||||
@@ -73,8 +75,10 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
|
||||
s32 nSamples;
|
||||
s32 excessiveSamples;
|
||||
s32 UNUSED pad[3];
|
||||
if (reverb->downsampleRate != 1) {
|
||||
if (reverb->framesLeftToIgnore == 0) {
|
||||
if (reverb->downsampleRate != 1)
|
||||
{
|
||||
if (reverb->framesLeftToIgnore == 0)
|
||||
{
|
||||
// Now that the RSP has finished, downsample the samples produced two frames ago by skipping
|
||||
// samples.
|
||||
item = &reverb->items[reverb->curFrame][updateIndex];
|
||||
@@ -83,13 +87,15 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
|
||||
osInvalDCache(item->toDownsampleLeft, DEFAULT_LEN_2CH);
|
||||
|
||||
for (srcPos = 0, dstPos = 0; dstPos < item->lengthA / 2;
|
||||
srcPos += reverb->downsampleRate, dstPos++) {
|
||||
srcPos += reverb->downsampleRate, dstPos++)
|
||||
{
|
||||
reverb->ringBuffer.left[item->startPos + dstPos] =
|
||||
item->toDownsampleLeft[srcPos];
|
||||
reverb->ringBuffer.right[item->startPos + dstPos] =
|
||||
item->toDownsampleRight[srcPos];
|
||||
}
|
||||
for (dstPos = 0; dstPos < item->lengthB / 2; srcPos += reverb->downsampleRate, dstPos++) {
|
||||
for (dstPos = 0; dstPos < item->lengthB / 2; srcPos += reverb->downsampleRate, dstPos++)
|
||||
{
|
||||
reverb->ringBuffer.left[dstPos] = item->toDownsampleLeft[srcPos];
|
||||
reverb->ringBuffer.right[dstPos] = item->toDownsampleRight[srcPos];
|
||||
}
|
||||
@@ -99,13 +105,16 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
|
||||
item = &reverb->items[reverb->curFrame][updateIndex];
|
||||
nSamples = chunkLen / reverb->downsampleRate;
|
||||
excessiveSamples = (nSamples + reverb->nextRingBufferPos) - reverb->bufSizePerChannel;
|
||||
if (excessiveSamples < 0) {
|
||||
if (excessiveSamples < 0)
|
||||
{
|
||||
// There is space in the ring buffer before it wraps around
|
||||
item->lengthA = nSamples * 2;
|
||||
item->lengthB = 0;
|
||||
item->startPos = (s32)reverb->nextRingBufferPos;
|
||||
reverb->nextRingBufferPos += nSamples;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ring buffer wrapped around
|
||||
item->lengthA = (nSamples - excessiveSamples) * 2;
|
||||
item->lengthB = excessiveSamples * 2;
|
||||
@@ -117,7 +126,8 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
|
||||
item->chunkLen = chunkLen;
|
||||
}
|
||||
|
||||
u64 *synthesis_load_reverb_ring_buffer(u64 *cmd, u16 addr, u16 srcOffset, s32 len, s32 reverbIndex) {
|
||||
u64 *synthesis_load_reverb_ring_buffer(u64 *cmd, u16 addr, u16 srcOffset, s32 len, s32 reverbIndex)
|
||||
{
|
||||
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.left[srcOffset]),
|
||||
addr, len);
|
||||
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.right[srcOffset]),
|
||||
@@ -125,7 +135,8 @@ u64 *synthesis_load_reverb_ring_buffer(u64 *cmd, u16 addr, u16 srcOffset, s32 le
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *synthesis_save_reverb_ring_buffer(u64 *cmd, u16 addr, u16 destOffset, s32 len, s32 reverbIndex) {
|
||||
u64 *synthesis_save_reverb_ring_buffer(u64 *cmd, u16 addr, u16 destOffset, s32 len, s32 reverbIndex)
|
||||
{
|
||||
aSaveBuffer(cmd++, addr,
|
||||
VIRTUAL_TO_PHYSICAL2(&gSynthesisReverbs[reverbIndex].ringBuffer.left[destOffset]), len);
|
||||
aSaveBuffer(cmd++, addr + DEFAULT_LEN_1CH,
|
||||
@@ -133,61 +144,84 @@ u64 *synthesis_save_reverb_ring_buffer(u64 *cmd, u16 addr, u16 destOffset, s32 l
|
||||
return cmd;
|
||||
}
|
||||
|
||||
void func_sh_802ed644(s32 updateIndexStart, s32 noteIndex) {
|
||||
void func_sh_802ed644(s32 updateIndexStart, s32 noteIndex)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = updateIndexStart + 1; i < gAudioBufferParameters.updatesPerFrame; i++) {
|
||||
if (!gNoteSubsEu[gMaxSimultaneousNotes * i + noteIndex].needsInit) {
|
||||
for (i = updateIndexStart + 1; i < gAudioBufferParameters.updatesPerFrame; i++)
|
||||
{
|
||||
if (!gNoteSubsEu[gMaxSimultaneousNotes * i + noteIndex].needsInit)
|
||||
{
|
||||
gNoteSubsEu[gMaxSimultaneousNotes * i + noteIndex].enabled = FALSE;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void synthesis_load_note_subs_eu(s32 updateIndex) {
|
||||
void synthesis_load_note_subs_eu(s32 updateIndex)
|
||||
{
|
||||
struct NoteSubEu *src;
|
||||
struct NoteSubEu *dest;
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++)
|
||||
{
|
||||
src = &gNotes[i].noteSubEu;
|
||||
dest = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i];
|
||||
if (src->enabled) {
|
||||
if (src->enabled)
|
||||
{
|
||||
*dest = *src;
|
||||
src->needsInit = FALSE;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
dest->enabled = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: (Scrub C) pointless mask and whitespace
|
||||
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
|
||||
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen)
|
||||
{
|
||||
s32 i, j;
|
||||
u32 *aiBufPtr;
|
||||
u64 *cmd = cmdBuf;
|
||||
s32 chunkLen;
|
||||
|
||||
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) {
|
||||
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--)
|
||||
{
|
||||
process_sequences(i - 1);
|
||||
synthesis_load_note_subs_eu(gAudioBufferParameters.updatesPerFrame - i);
|
||||
}
|
||||
aiBufPtr = (u32 *)aiBuf;
|
||||
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) {
|
||||
if (i == 1) {
|
||||
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
chunkLen = bufLen;
|
||||
} else {
|
||||
if (bufLen / i >= gAudioBufferParameters.samplesPerUpdateMax) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bufLen / i >= gAudioBufferParameters.samplesPerUpdateMax)
|
||||
{
|
||||
chunkLen = gAudioBufferParameters.samplesPerUpdateMax;
|
||||
} else if (bufLen / i <= gAudioBufferParameters.samplesPerUpdateMin) {
|
||||
}
|
||||
else if (bufLen / i <= gAudioBufferParameters.samplesPerUpdateMin)
|
||||
{
|
||||
chunkLen = gAudioBufferParameters.samplesPerUpdateMin;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
chunkLen = gAudioBufferParameters.samplesPerUpdate;
|
||||
}
|
||||
}
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++) {
|
||||
if (gSynthesisReverbs[j].useReverb != 0) {
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++)
|
||||
{
|
||||
if (gSynthesisReverbs[j].useReverb != 0)
|
||||
{
|
||||
prepare_reverb_ring_buffer(chunkLen, gAudioBufferParameters.updatesPerFrame - i, j);
|
||||
}
|
||||
}
|
||||
@@ -196,8 +230,10 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
|
||||
aiBufPtr += chunkLen;
|
||||
}
|
||||
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++) {
|
||||
if (gSynthesisReverbs[j].framesLeftToIgnore != 0) {
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++)
|
||||
{
|
||||
if (gSynthesisReverbs[j].framesLeftToIgnore != 0)
|
||||
{
|
||||
gSynthesisReverbs[j].framesLeftToIgnore--;
|
||||
}
|
||||
gSynthesisReverbs[j].curFrame ^= 1;
|
||||
@@ -206,26 +242,32 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen) {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s16 updateIndex) {
|
||||
u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s16 updateIndex)
|
||||
{
|
||||
struct ReverbRingBufferItem *item;
|
||||
s16 startPad;
|
||||
s16 paddedLengthA;
|
||||
|
||||
item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex];
|
||||
|
||||
if (gSynthesisReverbs[reverbIndex].downsampleRate == 1) {
|
||||
if (gSynthesisReverbs[reverbIndex].downsampleRate == 1)
|
||||
{
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex);
|
||||
if (item->lengthB != 0) {
|
||||
if (item->lengthB != 0)
|
||||
{
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex);
|
||||
}
|
||||
aAddMixer(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
aMix(cmd++, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
startPad = (item->startPos % 8u) * 2;
|
||||
paddedLengthA = ALIGN(startPad + item->lengthA, 4);
|
||||
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, (item->startPos - startPad / 2), DEFAULT_LEN_1CH, reverbIndex);
|
||||
if (item->lengthB != 0) {
|
||||
if (item->lengthB != 0)
|
||||
{
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + paddedLengthA, 0, DEFAULT_LEN_1CH - paddedLengthA, reverbIndex);
|
||||
}
|
||||
|
||||
@@ -238,7 +280,8 @@ u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s1
|
||||
aAddMixer(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
aMix(cmd++, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
}
|
||||
if (gSynthesisReverbs[reverbIndex].panRight != 0 || gSynthesisReverbs[reverbIndex].panLeft != 0) {
|
||||
if (gSynthesisReverbs[reverbIndex].panRight != 0 || gSynthesisReverbs[reverbIndex].panLeft != 0)
|
||||
{
|
||||
// Leak some audio from the left reverb channel into the right reverb channel and vice versa (pan)
|
||||
aDMEMMove(cmd++, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_RESAMPLED, DEFAULT_LEN_1CH);
|
||||
aMix(cmd++, gSynthesisReverbs[reverbIndex].panRight, DMEM_ADDR_WET_RIGHT_CH, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_1CH);
|
||||
@@ -247,7 +290,8 @@ u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s1
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *synthesis_load_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
|
||||
u64 *synthesis_load_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex)
|
||||
{
|
||||
struct ReverbRingBufferItem *item;
|
||||
struct SynthesisReverb *reverb;
|
||||
|
||||
@@ -255,22 +299,26 @@ u64 *synthesis_load_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
|
||||
item = &reverb->items[reverb->curFrame][updateIndex];
|
||||
// Get the oldest samples in the ring buffer into the wet channels
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, item->startPos, item->lengthA, reverbIndex);
|
||||
if (item->lengthB != 0) {
|
||||
if (item->lengthB != 0)
|
||||
{
|
||||
// Ring buffer wrapped
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + item->lengthA, 0, item->lengthB, reverbIndex);
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *synthesis_save_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
|
||||
u64 *synthesis_save_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex)
|
||||
{
|
||||
struct ReverbRingBufferItem *item;
|
||||
|
||||
item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex];
|
||||
switch (gSynthesisReverbs[reverbIndex].downsampleRate) {
|
||||
switch (gSynthesisReverbs[reverbIndex].downsampleRate)
|
||||
{
|
||||
case 1:
|
||||
// Put the oldest samples in the ring buffer into the wet channels
|
||||
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengthA, reverbIndex);
|
||||
if (item->lengthB != 0) {
|
||||
if (item->lengthB != 0)
|
||||
{
|
||||
// Ring buffer wrapped
|
||||
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengthA, 0, item->lengthB, reverbIndex);
|
||||
}
|
||||
@@ -287,7 +335,8 @@ u64 *synthesis_save_reverb_samples(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *func_sh_802EDF24(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
|
||||
u64 *func_sh_802EDF24(u64 *cmd, s16 reverbIndex, s16 updateIndex)
|
||||
{
|
||||
struct ReverbRingBufferItem *item;
|
||||
struct SynthesisReverb *reverb;
|
||||
|
||||
@@ -295,14 +344,16 @@ u64 *func_sh_802EDF24(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
|
||||
item = &reverb->items[reverb->curFrame][updateIndex];
|
||||
// Put the oldest samples in the ring buffer into the wet channels
|
||||
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED, item->startPos, item->lengthA, reverbIndex);
|
||||
if (item->lengthB != 0) {
|
||||
if (item->lengthB != 0)
|
||||
{
|
||||
// Ring buffer wrapped
|
||||
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_RESAMPLED + item->lengthA, 0, item->lengthB, reverbIndex);
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex) {
|
||||
u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex)
|
||||
{
|
||||
struct NoteSubEu *noteSubEu;
|
||||
u8 noteIndices[56];
|
||||
s32 temp;
|
||||
@@ -310,60 +361,81 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
|
||||
s16 j;
|
||||
s16 notePos = 0;
|
||||
|
||||
if (gNumSynthesisReverbs == 0) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
if (gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i].enabled) {
|
||||
if (gNumSynthesisReverbs == 0)
|
||||
{
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++)
|
||||
{
|
||||
if (gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i].enabled)
|
||||
{
|
||||
noteIndices[notePos++] = i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++)
|
||||
{
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++)
|
||||
{
|
||||
noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i];
|
||||
if (noteSubEu->enabled && j == noteSubEu->reverbIndex) {
|
||||
if (noteSubEu->enabled && j == noteSubEu->reverbIndex)
|
||||
{
|
||||
noteIndices[notePos++] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++)
|
||||
{
|
||||
noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + i];
|
||||
if (noteSubEu->enabled && noteSubEu->reverbIndex >= gNumSynthesisReverbs) {
|
||||
if (noteSubEu->enabled && noteSubEu->reverbIndex >= gNumSynthesisReverbs)
|
||||
{
|
||||
noteIndices[notePos++] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
aClearBuffer(cmd++, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
i = 0;
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++) {
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++)
|
||||
{
|
||||
gUseReverb = gSynthesisReverbs[j].useReverb;
|
||||
if (gUseReverb != 0) {
|
||||
if (gUseReverb != 0)
|
||||
{
|
||||
cmd = synthesis_resample_and_mix_reverb(cmd, bufLen, j, updateIndex);
|
||||
}
|
||||
for (; i < notePos; i++) {
|
||||
for (; i < notePos; i++)
|
||||
{
|
||||
temp = updateIndex * gMaxSimultaneousNotes;
|
||||
if (j == gNoteSubsEu[temp + noteIndices[i]].reverbIndex) {
|
||||
if (j == gNoteSubsEu[temp + noteIndices[i]].reverbIndex)
|
||||
{
|
||||
cmd = synthesis_process_note(noteIndices[i],
|
||||
&gNoteSubsEu[temp + noteIndices[i]],
|
||||
&gNotes[noteIndices[i]].synthesisState,
|
||||
aiBuf, bufLen, cmd, updateIndex);
|
||||
continue;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gSynthesisReverbs[j].useReverb != 0) {
|
||||
if (gSynthesisReverbs[j].unk100 != NULL) {
|
||||
if (gSynthesisReverbs[j].useReverb != 0)
|
||||
{
|
||||
if (gSynthesisReverbs[j].unk100 != nullptr)
|
||||
{
|
||||
aFilter(cmd++, 0x02, bufLen * 2, gSynthesisReverbs[j].unk100);
|
||||
aFilter(cmd++, gSynthesisReverbs[j].resampleFlags, DMEM_ADDR_WET_LEFT_CH, gSynthesisReverbs[j].unk108);
|
||||
}
|
||||
if (gSynthesisReverbs[j].unk104 != NULL) {
|
||||
if (gSynthesisReverbs[j].unk104 != nullptr)
|
||||
{
|
||||
aFilter(cmd++, 0x02, bufLen * 2, gSynthesisReverbs[j].unk104);
|
||||
aFilter(cmd++, gSynthesisReverbs[j].resampleFlags, DMEM_ADDR_WET_RIGHT_CH, gSynthesisReverbs[j].unk10C);
|
||||
}
|
||||
cmd = synthesis_save_reverb_samples(cmd, j, updateIndex);
|
||||
if (gSynthesisReverbs[j].unk5 != -1) {
|
||||
if (gSynthesisReverbs[gSynthesisReverbs[j].unk5].downsampleRate == 1) {
|
||||
if (gSynthesisReverbs[j].unk5 != -1)
|
||||
{
|
||||
if (gSynthesisReverbs[gSynthesisReverbs[j].unk5].downsampleRate == 1)
|
||||
{
|
||||
cmd = synthesis_load_reverb_samples(cmd, gSynthesisReverbs[j].unk5, updateIndex);
|
||||
aMix(cmd++, gSynthesisReverbs[j].unk08, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_RESAMPLED, DEFAULT_LEN_2CH);
|
||||
cmd = func_sh_802EDF24(cmd++, gSynthesisReverbs[j].unk5, updateIndex);
|
||||
@@ -371,7 +443,8 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
|
||||
}
|
||||
}
|
||||
}
|
||||
for (; i < notePos; i++) {
|
||||
for (; i < notePos; i++)
|
||||
{
|
||||
struct NoteSubEu *noteSubEu2 = &gNoteSubsEu[updateIndex * gMaxSimultaneousNotes + noteIndices[i]];
|
||||
cmd = synthesis_process_note(noteIndices[i],
|
||||
noteSubEu2,
|
||||
@@ -385,7 +458,8 @@ u64 *synthesis_do_one_audio_update(s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateI
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, UNUSED s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex) {
|
||||
u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, UNUSED s16 *aiBuf, s32 bufLen, u64 *cmd, s32 updateIndex)
|
||||
{
|
||||
UNUSED s32 pad0[3];
|
||||
struct AudioBankSample *audioBookSample; // sp164, sp138
|
||||
struct AdpcmLoop *loopInfo; // sp160, sp134
|
||||
@@ -438,10 +512,11 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
u16 addr;
|
||||
u8 synthesisVolume;
|
||||
|
||||
curLoadedBook = NULL;
|
||||
curLoadedBook = nullptr;
|
||||
note = &gNotes[noteIndex];
|
||||
flags = 0;
|
||||
if (noteSubEu->needsInit == TRUE) {
|
||||
if (noteSubEu->needsInit == TRUE)
|
||||
{
|
||||
flags = A_INIT;
|
||||
synthesisState->restart = 0;
|
||||
synthesisState->samplePosInt = 0;
|
||||
@@ -461,46 +536,63 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
nSamplesToLoad = (samplesLenFixedPoint >> 0x10);
|
||||
synthesisState->samplePosFrac = samplesLenFixedPoint & 0xFFFF;
|
||||
|
||||
if ((synthesisState->unk5 == 1) && (nParts == 2)) {
|
||||
if ((synthesisState->unk5 == 1) && (nParts == 2))
|
||||
{
|
||||
nSamplesToLoad += 2;
|
||||
sp56 = 2;
|
||||
} else if ((synthesisState->unk5 == 2) && (nParts == 1)) {
|
||||
}
|
||||
else if ((synthesisState->unk5 == 2) && (nParts == 1))
|
||||
{
|
||||
nSamplesToLoad -= 4;
|
||||
sp56 = 4;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
sp56 = 0;
|
||||
}
|
||||
|
||||
|
||||
synthesisState->unk5 = nParts;
|
||||
|
||||
if (noteSubEu->isSyntheticWave) {
|
||||
if (noteSubEu->isSyntheticWave)
|
||||
{
|
||||
cmd = load_wave_samples(cmd, noteSubEu, synthesisState, nSamplesToLoad);
|
||||
noteSamplesDmemAddrBeforeResampling = (synthesisState->samplePosInt * 2) + DMEM_ADDR_UNCOMPRESSED_NOTE;
|
||||
synthesisState->samplePosInt += nSamplesToLoad;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// ADPCM note
|
||||
audioBookSample = noteSubEu->sound.audioBankSound->sample;
|
||||
loopInfo = audioBookSample->loop;
|
||||
endPos = loopInfo->end;
|
||||
sampleAddr = audioBookSample->sampleAddr;
|
||||
resampledTempLen = 0;
|
||||
for (curPart = 0; curPart < nParts; curPart++) {
|
||||
for (curPart = 0; curPart < nParts; curPart++)
|
||||
{
|
||||
nAdpcmSamplesProcessed = 0; // s8
|
||||
s5 = 0; // s4
|
||||
|
||||
if (nParts == 1) {
|
||||
if (nParts == 1)
|
||||
{
|
||||
samplesLenAdjusted = nSamplesToLoad;
|
||||
} else if (nSamplesToLoad & 1) {
|
||||
}
|
||||
else if (nSamplesToLoad & 1)
|
||||
{
|
||||
samplesLenAdjusted = (nSamplesToLoad & ~1) + (curPart * 2);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
samplesLenAdjusted = nSamplesToLoad;
|
||||
}
|
||||
|
||||
if (audioBookSample->codec == CODEC_ADPCM) {
|
||||
if (curLoadedBook != (*audioBookSample->book).book) {
|
||||
if (audioBookSample->codec == CODEC_ADPCM)
|
||||
{
|
||||
if (curLoadedBook != (*audioBookSample->book).book)
|
||||
{
|
||||
u32 nEntries;
|
||||
switch (noteSubEu->bookOffset) {
|
||||
switch (noteSubEu->bookOffset)
|
||||
{
|
||||
case 1:
|
||||
curLoadedBook = euUnknownData_80301950 + 1;
|
||||
break;
|
||||
@@ -517,7 +609,8 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
}
|
||||
}
|
||||
|
||||
while (nAdpcmSamplesProcessed != samplesLenAdjusted) {
|
||||
while (nAdpcmSamplesProcessed != samplesLenAdjusted)
|
||||
{
|
||||
s32 samplesRemaining; // v1
|
||||
s32 s0;
|
||||
|
||||
@@ -527,30 +620,39 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
samplesRemaining = endPos - synthesisState->samplePosInt;
|
||||
nSamplesToProcess = samplesLenAdjusted - nAdpcmSamplesProcessed;
|
||||
|
||||
if (s2 == 0 && synthesisState->restart == FALSE) {
|
||||
if (s2 == 0 && synthesisState->restart == FALSE)
|
||||
{
|
||||
s2 = 16;
|
||||
}
|
||||
s6 = 16 - s2; // a1
|
||||
if (nSamplesToProcess < samplesRemaining) {
|
||||
if (nSamplesToProcess < samplesRemaining)
|
||||
{
|
||||
t0 = (nSamplesToProcess - s6 + 0xf) / 16;
|
||||
s0 = t0 * 16;
|
||||
s3 = s6 + s0 - nSamplesToProcess;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
s0 = samplesRemaining - s6;
|
||||
s3 = 0;
|
||||
if (s0 <= 0) {
|
||||
if (s0 <= 0)
|
||||
{
|
||||
s0 = 0;
|
||||
s6 = samplesRemaining;
|
||||
}
|
||||
t0 = (s0 + 0xf) / 16;
|
||||
if (loopInfo->count != 0) {
|
||||
if (loopInfo->count != 0)
|
||||
{
|
||||
// Loop around and restart
|
||||
restart = 1;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
noteFinished = 1;
|
||||
}
|
||||
}
|
||||
switch (audioBookSample->codec) {
|
||||
switch (audioBookSample->codec)
|
||||
{
|
||||
case CODEC_ADPCM:
|
||||
unk_s6 = 9;
|
||||
sp88 = 0x10;
|
||||
@@ -561,13 +663,18 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
sp88 = 0x10;
|
||||
sp84 = 0;
|
||||
break;
|
||||
case CODEC_SKIP: goto skip;
|
||||
case CODEC_SKIP:
|
||||
goto skip;
|
||||
}
|
||||
if (t0 != 0) {
|
||||
if (t0 != 0)
|
||||
{
|
||||
temp = (synthesisState->samplePosInt + sp88 - s2) / 16;
|
||||
if (audioBookSample->medium == 0) {
|
||||
if (audioBookSample->medium == 0)
|
||||
{
|
||||
v0_2 = sp84 + (temp * unk_s6) + sampleAddr;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
v0_2 = dma_sample_data((uintptr_t)(sp84 + (temp * unk_s6) + sampleAddr),
|
||||
ALIGN(t0 * unk_s6 + 16, 4), flags, &synthesisState->sampleDmaIndex, audioBookSample->medium);
|
||||
}
|
||||
@@ -576,18 +683,23 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
aligned = ALIGN(t0 * unk_s6 + 16, 4);
|
||||
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
|
||||
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(v0_2 - a3), addr, ALIGN(t0 * unk_s6 + 16, 4));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
s0 = 0;
|
||||
a3 = 0;
|
||||
}
|
||||
if (synthesisState->restart != FALSE) {
|
||||
if (synthesisState->restart != FALSE)
|
||||
{
|
||||
aSetLoop(cmd++, VIRTUAL_TO_PHYSICAL2(audioBookSample->loop->state));
|
||||
flags = A_LOOP; // = 2
|
||||
synthesisState->restart = FALSE;
|
||||
}
|
||||
nSamplesInThisIteration = s0 + s6 - s3;
|
||||
if (nAdpcmSamplesProcessed == 0) {
|
||||
switch (audioBookSample->codec) {
|
||||
if (nAdpcmSamplesProcessed == 0)
|
||||
{
|
||||
switch (audioBookSample->codec)
|
||||
{
|
||||
case CODEC_ADPCM:
|
||||
aligned = ALIGN(t0 * unk_s6 + 16, 4);
|
||||
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
|
||||
@@ -602,9 +714,12 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
break;
|
||||
}
|
||||
sp130 = s2 * 2;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
s5Aligned = ALIGN(s5 + 16, 4);
|
||||
switch (audioBookSample->codec) {
|
||||
switch (audioBookSample->codec)
|
||||
{
|
||||
case CODEC_ADPCM:
|
||||
aligned = ALIGN(t0 * unk_s6 + 16, 4);
|
||||
addr = (DMEM_ADDR_COMPRESSED_ADPCM_DATA - aligned) & 0xffff;
|
||||
@@ -621,7 +736,8 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
aDMEMMove(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5Aligned + (s2 * 2), DMEM_ADDR_UNCOMPRESSED_NOTE + s5, (nSamplesInThisIteration) * 2);
|
||||
}
|
||||
nAdpcmSamplesProcessed += nSamplesInThisIteration;
|
||||
switch (flags) {
|
||||
switch (flags)
|
||||
{
|
||||
case A_INIT: // = 1
|
||||
sp130 = 0x20;
|
||||
s5 = (s0 + 0x10) * 2;
|
||||
@@ -630,16 +746,19 @@ u64 *synthesis_process_note(s32 noteIndex, struct NoteSubEu *noteSubEu, struct N
|
||||
s5 = (nSamplesInThisIteration) * 2 + s5;
|
||||
break;
|
||||
default:
|
||||
if (s5 != 0) {
|
||||
if (s5 != 0)
|
||||
{
|
||||
s5 = (nSamplesInThisIteration) * 2 + s5;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
s5 = (s2 + (nSamplesInThisIteration)) * 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
flags = 0;
|
||||
skip:
|
||||
if (noteFinished) {
|
||||
skip: if (noteFinished)
|
||||
{
|
||||
aClearBuffer(cmd++, DMEM_ADDR_UNCOMPRESSED_NOTE + s5,
|
||||
(samplesLenAdjusted - nAdpcmSamplesProcessed) * 2);
|
||||
noteSubEu->finished = 1;
|
||||
@@ -647,25 +766,31 @@ skip:
|
||||
func_sh_802ed644(updateIndex, noteIndex);
|
||||
break;
|
||||
}
|
||||
if (restart != 0) {
|
||||
if (restart != 0)
|
||||
{
|
||||
synthesisState->restart = TRUE;
|
||||
synthesisState->samplePosInt = loopInfo->start;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
synthesisState->samplePosInt += nSamplesToProcess;
|
||||
}
|
||||
}
|
||||
|
||||
switch (nParts) {
|
||||
switch (nParts)
|
||||
{
|
||||
case 1:
|
||||
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_UNCOMPRESSED_NOTE + sp130;
|
||||
break;
|
||||
case 2:
|
||||
switch (curPart) {
|
||||
switch (curPart)
|
||||
{
|
||||
case 0:
|
||||
aDownsampleHalf(cmd++, ALIGN(samplesLenAdjusted / 2, 3), DMEM_ADDR_UNCOMPRESSED_NOTE + sp130, DMEM_ADDR_RESAMPLED);
|
||||
resampledTempLen = samplesLenAdjusted;
|
||||
noteSamplesDmemAddrBeforeResampling = DMEM_ADDR_RESAMPLED;
|
||||
if (noteSubEu->finished != FALSE) {
|
||||
if (noteSubEu->finished != FALSE)
|
||||
{
|
||||
aClearBuffer(cmd++, noteSamplesDmemAddrBeforeResampling + resampledTempLen, samplesLenAdjusted + 0x10);
|
||||
}
|
||||
break;
|
||||
@@ -674,52 +799,65 @@ skip:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (noteSubEu->finished != FALSE) {
|
||||
if (noteSubEu->finished != FALSE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
flags = 0;
|
||||
if (noteSubEu->needsInit == TRUE) {
|
||||
if (noteSubEu->needsInit == TRUE)
|
||||
{
|
||||
flags = A_INIT;
|
||||
noteSubEu->needsInit = FALSE;
|
||||
}
|
||||
flags = flags | sp56;
|
||||
cmd = final_resample(cmd, synthesisState, bufLen * 2, resamplingRateFixedPoint,
|
||||
noteSamplesDmemAddrBeforeResampling, flags);
|
||||
if ((flags & 1) != 0) {
|
||||
if ((flags & 1) != 0)
|
||||
{
|
||||
flags = 1;
|
||||
}
|
||||
|
||||
if (noteSubEu->filter) {
|
||||
if (noteSubEu->filter)
|
||||
{
|
||||
aFilter(cmd++, 0x02, bufLen * 2, noteSubEu->filter);
|
||||
aFilter(cmd++, flags, DMEM_ADDR_TEMP, synthesisState->synthesisBuffers->filterBuffer);
|
||||
|
||||
}
|
||||
|
||||
if (noteSubEu->bookOffset == 3) {
|
||||
if (noteSubEu->bookOffset == 3)
|
||||
{
|
||||
aUnknown25(cmd++, 0, bufLen * 2, DMEM_ADDR_TEMP, DMEM_ADDR_TEMP);
|
||||
}
|
||||
|
||||
synthesisVolume = noteSubEu->synthesisVolume;
|
||||
if (synthesisVolume != 0) {
|
||||
if (synthesisVolume < 0x10) {
|
||||
if (synthesisVolume != 0)
|
||||
{
|
||||
if (synthesisVolume < 0x10)
|
||||
{
|
||||
synthesisVolume = 0x10;
|
||||
}
|
||||
|
||||
aHiLoGain(cmd++, synthesisVolume, (bufLen + 0x10) * 2, DMEM_ADDR_TEMP);
|
||||
}
|
||||
|
||||
if (noteSubEu->headsetPanRight != 0 || synthesisState->prevHeadsetPanRight != 0) {
|
||||
if (noteSubEu->headsetPanRight != 0 || synthesisState->prevHeadsetPanRight != 0)
|
||||
{
|
||||
leftRight = 1;
|
||||
} else if (noteSubEu->headsetPanLeft != 0 || synthesisState->prevHeadsetPanLeft != 0) {
|
||||
}
|
||||
else if (noteSubEu->headsetPanLeft != 0 || synthesisState->prevHeadsetPanLeft != 0)
|
||||
{
|
||||
leftRight = 2;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
leftRight = 0;
|
||||
}
|
||||
cmd = process_envelope(cmd, noteSubEu, synthesisState, bufLen, DMEM_ADDR_TEMP, leftRight, flags);
|
||||
if (noteSubEu->usesHeadsetPanEffects) {
|
||||
if ((flags & 1) == 0) {
|
||||
if (noteSubEu->usesHeadsetPanEffects)
|
||||
{
|
||||
if ((flags & 1) == 0)
|
||||
{
|
||||
flags = 0;
|
||||
}
|
||||
cmd = note_apply_headset_pan_effects(cmd, noteSubEu, synthesisState, bufLen * 2, flags, leftRight);
|
||||
@@ -728,7 +866,8 @@ skip:
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamplesToLoad) {
|
||||
u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *synthesisState, s32 nSamplesToLoad)
|
||||
{
|
||||
s32 a3;
|
||||
s32 repeats;
|
||||
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(noteSubEu->sound.samples),
|
||||
@@ -736,9 +875,11 @@ u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthes
|
||||
|
||||
synthesisState->samplePosInt &= 0x3f;
|
||||
a3 = 64 - synthesisState->samplePosInt;
|
||||
if (a3 < nSamplesToLoad) {
|
||||
if (a3 < nSamplesToLoad)
|
||||
{
|
||||
repeats = (nSamplesToLoad - a3 + 63) / 64;
|
||||
if (repeats != 0) {
|
||||
if (repeats != 0)
|
||||
{
|
||||
aDuplicate(cmd++,
|
||||
/*dmemin*/ DMEM_ADDR_UNCOMPRESSED_NOTE,
|
||||
/*dmemout*/ DMEM_ADDR_UNCOMPRESSED_NOTE + 128,
|
||||
@@ -748,17 +889,22 @@ u64 *load_wave_samples(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthes
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *final_resample(u64 *cmd, struct NoteSynthesisState *synthesisState, s32 count, u16 pitch, u16 dmemIn, u32 flags) {
|
||||
if (pitch == 0) {
|
||||
u64 *final_resample(u64 *cmd, struct NoteSynthesisState *synthesisState, s32 count, u16 pitch, u16 dmemIn, u32 flags)
|
||||
{
|
||||
if (pitch == 0)
|
||||
{
|
||||
aClearBuffer(cmd++, DMEM_ADDR_TEMP, count);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
aSetBuffer(cmd++, /*flags*/ 0, dmemIn, /*dmemout*/ DMEM_ADDR_TEMP, count);
|
||||
aResample(cmd++, flags, pitch, VIRTUAL_TO_PHYSICAL2(synthesisState->synthesisBuffers->finalResampleState));
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, UNUSED u32 flags) {
|
||||
u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisState *synthesisState, s32 nSamples, u16 inBuf, s32 headsetPanSettings, UNUSED u32 flags)
|
||||
{
|
||||
u16 sourceRight;
|
||||
u16 sourceLeft;
|
||||
u16 targetLeft;
|
||||
@@ -776,34 +922,45 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat
|
||||
targetLeft <<= 4;
|
||||
targetRight <<= 4;
|
||||
|
||||
if (targetLeft != sourceLeft) {
|
||||
if (targetLeft != sourceLeft)
|
||||
{
|
||||
rampLeft = (targetLeft - sourceLeft) / (nSamples >> 3);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
rampLeft = 0;
|
||||
}
|
||||
if (targetRight != sourceRight) {
|
||||
if (targetRight != sourceRight)
|
||||
{
|
||||
rampRight = (targetRight - sourceRight) / (nSamples >> 3);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
rampRight = 0;
|
||||
}
|
||||
|
||||
sourceReverbVol = synthesisState->reverbVol;
|
||||
if (note->reverbVol != sourceReverbVol) {
|
||||
if (note->reverbVol != sourceReverbVol)
|
||||
{
|
||||
reverbVolDiff = ((note->reverbVol & 0x7f) - (sourceReverbVol & 0x7f)) << 9;
|
||||
rampReverb = reverbVolDiff / (nSamples >> 3);
|
||||
synthesisState->reverbVol = note->reverbVol;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
rampReverb = 0;
|
||||
}
|
||||
synthesisState->curVolLeft = sourceLeft + rampLeft * (nSamples >> 3);
|
||||
synthesisState->curVolRight = sourceRight + rampRight * (nSamples >> 3);
|
||||
|
||||
if (note->usesHeadsetPanEffects) {
|
||||
if (note->usesHeadsetPanEffects)
|
||||
{
|
||||
aClearBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DEFAULT_LEN_1CH);
|
||||
aEnvSetup1(cmd++, (sourceReverbVol & 0x7f) * 2, rampReverb, rampLeft, rampRight);
|
||||
aEnvSetup2(cmd++, sourceLeft, sourceRight);
|
||||
|
||||
switch (headsetPanSettings) {
|
||||
switch (headsetPanSettings)
|
||||
{
|
||||
case 1:
|
||||
aEnvMixer(cmd++,
|
||||
inBuf, nSamples,
|
||||
@@ -835,7 +992,9 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat
|
||||
DMEM_ADDR_WET_RIGHT_CH);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
aEnvSetup1(cmd++, (sourceReverbVol & 0x7f) * 2, rampReverb, rampLeft, rampRight);
|
||||
aEnvSetup2(cmd++, sourceLeft, sourceRight);
|
||||
aEnvMixer(cmd++,
|
||||
@@ -850,14 +1009,16 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat
|
||||
return cmd;
|
||||
}
|
||||
|
||||
u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight) {
|
||||
u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight)
|
||||
{
|
||||
u16 dest;
|
||||
u16 pitch;
|
||||
u8 prevPanShift;
|
||||
u8 panShift;
|
||||
UNUSED u8 unkDebug;
|
||||
|
||||
switch (leftRight) {
|
||||
switch (leftRight)
|
||||
{
|
||||
case 1:
|
||||
dest = DMEM_ADDR_LEFT_CH;
|
||||
panShift = noteSubEu->headsetPanRight;
|
||||
@@ -877,31 +1038,41 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struc
|
||||
return cmd;
|
||||
}
|
||||
|
||||
if (flags != 1) { // A_INIT?
|
||||
if (flags != 1)
|
||||
{ // A_INIT?
|
||||
// Slightly adjust the sample rate in order to fit a change in pan shift
|
||||
if (panShift != prevPanShift) {
|
||||
if (panShift != prevPanShift)
|
||||
{
|
||||
pitch = (((bufLen << 0xf) / 2) - 1) / ((bufLen + panShift - prevPanShift - 2) / 2);
|
||||
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, (bufLen + panShift) - prevPanShift);
|
||||
aResampleZoh(cmd++, pitch, 0);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
aDMEMMove(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, bufLen);
|
||||
}
|
||||
|
||||
if (prevPanShift != 0) {
|
||||
if (prevPanShift != 0)
|
||||
{
|
||||
aLoadBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panSamplesBuffer),
|
||||
DMEM_ADDR_NOTE_PAN_TEMP, ALIGN(prevPanShift, 4));
|
||||
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + prevPanShift, bufLen + panShift - prevPanShift);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP, bufLen + panShift);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just shift right
|
||||
aDMEMMove(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, bufLen);
|
||||
aClearBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP, panShift);
|
||||
aDMEMMove(cmd++, DMEM_ADDR_TEMP, DMEM_ADDR_NOTE_PAN_TEMP + panShift, bufLen);
|
||||
}
|
||||
|
||||
if (panShift) {
|
||||
if (panShift)
|
||||
{
|
||||
// Save excessive samples for next iteration
|
||||
aSaveBuffer(cmd++, DMEM_ADDR_NOTE_PAN_TEMP + bufLen,
|
||||
VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panSamplesBuffer), ALIGN(panShift, 4));
|
||||
|
||||
+133
-83
@@ -108,7 +108,8 @@ u32 unused_8038B894[3] = { 0 };
|
||||
0x00: Branch and store return address
|
||||
cmd+0x04: void *branchTarget
|
||||
*/
|
||||
void geo_layout_cmd_branch_and_link(void) {
|
||||
void geo_layout_cmd_branch_and_link(void)
|
||||
{
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t)(gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (gCurGraphNodeIndex << 16) + gGeoLayoutReturnIndex;
|
||||
gGeoLayoutReturnIndex = gGeoLayoutStackIndex;
|
||||
@@ -116,7 +117,8 @@ void geo_layout_cmd_branch_and_link(void) {
|
||||
}
|
||||
|
||||
// 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;
|
||||
@@ -127,8 +129,10 @@ void geo_layout_cmd_end(void) {
|
||||
0x02: Branch
|
||||
cmd+0x04: void *branchTarget
|
||||
*/
|
||||
void geo_layout_cmd_branch(void) {
|
||||
if (cur_geo_cmd_u8(0x01) == 1) {
|
||||
void geo_layout_cmd_branch(void)
|
||||
{
|
||||
if (cur_geo_cmd_u8(0x01) == 1)
|
||||
{
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t)(gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
|
||||
}
|
||||
|
||||
@@ -136,19 +140,22 @@ void geo_layout_cmd_branch(void) {
|
||||
}
|
||||
|
||||
// 0x03: Return from branch
|
||||
void geo_layout_cmd_return(void) {
|
||||
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;
|
||||
|
||||
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);
|
||||
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,11 +354,12 @@ 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,
|
||||
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
|
||||
@@ -360,7 +381,8 @@ 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];
|
||||
|
||||
@@ -369,7 +391,7 @@ void geo_layout_cmd_node_camera(void) {
|
||||
cmdPos = read_vec3s_to_vec3f(pos, cmdPos);
|
||||
cmdPos = read_vec3s_to_vec3f(focus, cmdPos);
|
||||
|
||||
graphNode = init_graph_node_camera(gGraphNodePool, NULL, pos, focus,
|
||||
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;
|
||||
|
||||
switch ((params & 0x70) >> 4) {
|
||||
switch ((params & 0x70) >> 4)
|
||||
{
|
||||
case 0:
|
||||
cmdPos = read_vec3s(translation, &cmdPos[2]);
|
||||
cmdPos = read_vec3s_angle(rotation, cmdPos);
|
||||
@@ -444,13 +468,14 @@ void geo_layout_cmd_node_translation_rotation(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (params & 0x80) {
|
||||
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);
|
||||
|
||||
@@ -467,7 +492,8 @@ 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;
|
||||
@@ -475,18 +501,19 @@ void geo_layout_cmd_node_translation(void) {
|
||||
s16 drawingLayer = 0;
|
||||
s16 params = cur_geo_cmd_u8(0x01);
|
||||
s16 *cmdPos = (s16 *)gGeoLayoutCommand;
|
||||
void *displayList = NULL;
|
||||
void *displayList = nullptr;
|
||||
|
||||
cmdPos = read_vec3s(translation, &cmdPos[1]);
|
||||
|
||||
if (params & 0x80) {
|
||||
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);
|
||||
|
||||
@@ -503,7 +530,8 @@ 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;
|
||||
@@ -511,17 +539,18 @@ void geo_layout_cmd_node_rotation(void) {
|
||||
s16 drawingLayer = 0;
|
||||
s16 params = cur_geo_cmd_u8(0x01);
|
||||
s16 *cmdPos = (s16 *)gGeoLayoutCommand;
|
||||
void *displayList = NULL;
|
||||
void *displayList = nullptr;
|
||||
|
||||
cmdPos = read_vec3s_angle(sp2c, &cmdPos[1]);
|
||||
|
||||
if (params & 0x80) {
|
||||
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);
|
||||
|
||||
@@ -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,7 +602,8 @@ 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);
|
||||
@@ -580,7 +613,7 @@ void geo_layout_cmd_node_animated_part(void) {
|
||||
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,23 +630,25 @@ 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;
|
||||
void *displayList = nullptr;
|
||||
|
||||
cmdPos = read_vec3s(translation, &cmdPos[1]);
|
||||
|
||||
if (params & 0x80) {
|
||||
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);
|
||||
|
||||
@@ -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,10 +710,11 @@ 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,
|
||||
graphNode = init_graph_node_generated(gGraphNodePool, nullptr,
|
||||
(GraphNodeFunc)cur_geo_cmd_ptr(0x04), // asm function
|
||||
cur_geo_cmd_s16(0x02)); // parameter
|
||||
|
||||
@@ -689,11 +728,12 @@ 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
|
||||
0);
|
||||
@@ -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) {
|
||||
if (node->type == GRAPH_NODE_TYPE_OBJECT_PARENT)
|
||||
{
|
||||
node = ((struct GraphNodeObjectParent *)node)->sharedChild;
|
||||
} else {
|
||||
node = NULL;
|
||||
}
|
||||
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]);
|
||||
|
||||
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]]();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
+327
-168
@@ -18,25 +18,30 @@ static Vec3f gVec3fOne = { 1.0f, 1.0f, 1.0f };
|
||||
* Initialize a geo node with a given type. Sets all links such that there
|
||||
* are no siblings, parent or children for this node.
|
||||
*/
|
||||
void init_scene_graph_node_links(struct GraphNode *graphNode, s32 type) {
|
||||
void init_scene_graph_node_links(struct GraphNode *graphNode, s32 type)
|
||||
{
|
||||
graphNode->type = type;
|
||||
graphNode->flags = GRAPH_RENDER_ACTIVE;
|
||||
graphNode->prev = graphNode;
|
||||
graphNode->next = graphNode;
|
||||
graphNode->parent = NULL;
|
||||
graphNode->children = NULL;
|
||||
graphNode->parent = nullptr;
|
||||
graphNode->children = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocated and returns a newly created root node
|
||||
*/
|
||||
struct GraphNodeRoot *init_graph_node_root(struct AllocOnlyPool *pool, struct GraphNodeRoot *graphNode,
|
||||
s16 areaIndex, s16 x, s16 y, s16 width, s16 height) {
|
||||
if (pool != NULL) {
|
||||
struct GraphNodeRoot *init_graph_node_root(
|
||||
struct AllocOnlyPool *pool, struct GraphNodeRoot *graphNode,
|
||||
s16 areaIndex, s16 x, s16 y, s16 width, s16 height)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeRoot));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ROOT);
|
||||
|
||||
graphNode->areaIndex = areaIndex;
|
||||
@@ -45,7 +50,7 @@ struct GraphNodeRoot *init_graph_node_root(struct AllocOnlyPool *pool, struct Gr
|
||||
graphNode->y = y;
|
||||
graphNode->width = width;
|
||||
graphNode->height = height;
|
||||
graphNode->views = NULL;
|
||||
graphNode->views = nullptr;
|
||||
graphNode->numViews = 0;
|
||||
}
|
||||
|
||||
@@ -55,14 +60,17 @@ struct GraphNodeRoot *init_graph_node_root(struct AllocOnlyPool *pool, struct Gr
|
||||
/**
|
||||
* Allocates and returns a newly created otrhographic projection node
|
||||
*/
|
||||
struct GraphNodeOrthoProjection *
|
||||
init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrthoProjection *graphNode,
|
||||
f32 scale) {
|
||||
if (pool != NULL) {
|
||||
struct GraphNodeOrthoProjection *init_graph_node_ortho_projection(
|
||||
struct AllocOnlyPool *pool, struct GraphNodeOrthoProjection *graphNode,
|
||||
f32 scale)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeOrthoProjection));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ORTHO_PROJECTION);
|
||||
graphNode->scale = scale;
|
||||
}
|
||||
@@ -73,15 +81,19 @@ init_graph_node_ortho_projection(struct AllocOnlyPool *pool, struct GraphNodeOrt
|
||||
/**
|
||||
* Allocates and returns a newly created perspective node
|
||||
*/
|
||||
struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *pool,
|
||||
struct GraphNodePerspective *init_graph_node_perspective(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodePerspective *graphNode,
|
||||
f32 fov, s16 near, s16 far,
|
||||
GraphNodeFunc nodeFunc, s32 unused) {
|
||||
if (pool != NULL) {
|
||||
GraphNodeFunc nodeFunc, s32 unused)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodePerspective));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_PERSPECTIVE);
|
||||
|
||||
graphNode->fov = fov;
|
||||
@@ -90,7 +102,8 @@ struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *p
|
||||
graphNode->fnNode.func = nodeFunc;
|
||||
graphNode->unused = unused;
|
||||
|
||||
if (nodeFunc != NULL) {
|
||||
if (nodeFunc != nullptr)
|
||||
{
|
||||
nodeFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
|
||||
}
|
||||
}
|
||||
@@ -101,13 +114,17 @@ struct GraphNodePerspective *init_graph_node_perspective(struct AllocOnlyPool *p
|
||||
/**
|
||||
* Allocates and returns a newly created start node
|
||||
*/
|
||||
struct GraphNodeStart *init_graph_node_start(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeStart *graphNode) {
|
||||
if (pool != NULL) {
|
||||
struct GraphNodeStart *init_graph_node_start(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeStart *graphNode)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeStart));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_START);
|
||||
}
|
||||
|
||||
@@ -117,16 +134,21 @@ struct GraphNodeStart *init_graph_node_start(struct AllocOnlyPool *pool,
|
||||
/**
|
||||
* Allocates and returns a newly created master list node
|
||||
*/
|
||||
struct GraphNodeMasterList *init_graph_node_master_list(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeMasterList *graphNode, s16 on) {
|
||||
if (pool != NULL) {
|
||||
struct GraphNodeMasterList *init_graph_node_master_list(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeMasterList *graphNode, s16 on)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeMasterList));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_MASTER_LIST);
|
||||
|
||||
if (on) {
|
||||
if (on)
|
||||
{
|
||||
graphNode->node.flags |= GRAPH_RENDER_Z_BUFFER;
|
||||
}
|
||||
}
|
||||
@@ -137,14 +159,18 @@ struct GraphNodeMasterList *init_graph_node_master_list(struct AllocOnlyPool *po
|
||||
/**
|
||||
* Allocates and returns a newly created render range node
|
||||
*/
|
||||
struct GraphNodeLevelOfDetail *init_graph_node_render_range(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeLevelOfDetail *init_graph_node_render_range(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeLevelOfDetail *graphNode,
|
||||
s16 minDistance, s16 maxDistance) {
|
||||
if (pool != NULL) {
|
||||
s16 minDistance, s16 maxDistance)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeLevelOfDetail));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_LEVEL_OF_DETAIL);
|
||||
graphNode->minDistance = minDistance;
|
||||
graphNode->maxDistance = maxDistance;
|
||||
@@ -156,22 +182,27 @@ struct GraphNodeLevelOfDetail *init_graph_node_render_range(struct AllocOnlyPool
|
||||
/**
|
||||
* Allocates and returns a newly created switch case node
|
||||
*/
|
||||
struct GraphNodeSwitchCase *init_graph_node_switch_case(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeSwitchCase *init_graph_node_switch_case(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeSwitchCase *graphNode,
|
||||
s16 numCases, s16 selectedCase,
|
||||
GraphNodeFunc nodeFunc, s32 unused) {
|
||||
if (pool != NULL) {
|
||||
GraphNodeFunc nodeFunc, s32 unused)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeSwitchCase));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_SWITCH_CASE);
|
||||
graphNode->numCases = numCases;
|
||||
graphNode->selectedCase = selectedCase;
|
||||
graphNode->fnNode.func = nodeFunc;
|
||||
graphNode->unused = unused;
|
||||
|
||||
if (nodeFunc != NULL) {
|
||||
if (nodeFunc != nullptr)
|
||||
{
|
||||
nodeFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
|
||||
}
|
||||
}
|
||||
@@ -182,14 +213,18 @@ struct GraphNodeSwitchCase *init_graph_node_switch_case(struct AllocOnlyPool *po
|
||||
/**
|
||||
* Allocates and returns a newly created camera node
|
||||
*/
|
||||
struct GraphNodeCamera *init_graph_node_camera(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeCamera *init_graph_node_camera(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeCamera *graphNode, f32 *pos,
|
||||
f32 *focus, GraphNodeFunc func, s32 mode) {
|
||||
if (pool != NULL) {
|
||||
f32 *focus, GraphNodeFunc func, s32 mode)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeCamera));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_CAMERA);
|
||||
vec3f_copy(graphNode->pos, pos);
|
||||
vec3f_copy(graphNode->focus, focus);
|
||||
@@ -198,7 +233,8 @@ struct GraphNodeCamera *init_graph_node_camera(struct AllocOnlyPool *pool,
|
||||
graphNode->roll = 0;
|
||||
graphNode->rollScreen = 0;
|
||||
|
||||
if (func != NULL) {
|
||||
if (func != nullptr)
|
||||
{
|
||||
func(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
|
||||
}
|
||||
}
|
||||
@@ -209,15 +245,18 @@ struct GraphNodeCamera *init_graph_node_camera(struct AllocOnlyPool *pool,
|
||||
/**
|
||||
* Allocates and returns a newly created translation rotation node
|
||||
*/
|
||||
struct GraphNodeTranslationRotation *
|
||||
init_graph_node_translation_rotation(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeTranslationRotation *init_graph_node_translation_rotation(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeTranslationRotation *graphNode, s32 drawingLayer,
|
||||
void *displayList, Vec3s translation, Vec3s rotation) {
|
||||
if (pool != NULL) {
|
||||
void *displayList, Vec3s translation, Vec3s rotation)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeTranslationRotation));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_TRANSLATION_ROTATION);
|
||||
|
||||
vec3s_copy(graphNode->translation, translation);
|
||||
@@ -232,15 +271,19 @@ init_graph_node_translation_rotation(struct AllocOnlyPool *pool,
|
||||
/**
|
||||
* Allocates and returns a newly created translation node
|
||||
*/
|
||||
struct GraphNodeTranslation *init_graph_node_translation(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeTranslation *init_graph_node_translation(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeTranslation *graphNode,
|
||||
s32 drawingLayer, void *displayList,
|
||||
Vec3s translation) {
|
||||
if (pool != NULL) {
|
||||
Vec3s translation)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeTranslation));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_TRANSLATION);
|
||||
|
||||
vec3s_copy(graphNode->translation, translation);
|
||||
@@ -254,15 +297,19 @@ struct GraphNodeTranslation *init_graph_node_translation(struct AllocOnlyPool *p
|
||||
/**
|
||||
* Allocates and returns a newly created rotation node
|
||||
*/
|
||||
struct GraphNodeRotation *init_graph_node_rotation(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeRotation *init_graph_node_rotation(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeRotation *graphNode,
|
||||
s32 drawingLayer, void *displayList,
|
||||
Vec3s rotation) {
|
||||
if (pool != NULL) {
|
||||
Vec3s rotation)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeRotation));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ROTATION);
|
||||
vec3s_copy(graphNode->rotation, rotation);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
@@ -275,14 +322,18 @@ struct GraphNodeRotation *init_graph_node_rotation(struct AllocOnlyPool *pool,
|
||||
/**
|
||||
* Allocates and returns a newly created scaling node
|
||||
*/
|
||||
struct GraphNodeScale *init_graph_node_scale(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeScale *init_graph_node_scale(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeScale *graphNode, s32 drawingLayer,
|
||||
void *displayList, f32 scale) {
|
||||
if (pool != NULL) {
|
||||
void *displayList, f32 scale)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeScale));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_SCALE);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
graphNode->scale = scale;
|
||||
@@ -295,15 +346,19 @@ struct GraphNodeScale *init_graph_node_scale(struct AllocOnlyPool *pool,
|
||||
/**
|
||||
* Allocates and returns a newly created object node
|
||||
*/
|
||||
struct GraphNodeObject *init_graph_node_object(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeObject *init_graph_node_object(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeObject *graphNode,
|
||||
struct GraphNode *sharedChild, Vec3f pos, Vec3s angle,
|
||||
Vec3f scale) {
|
||||
if (pool != NULL) {
|
||||
Vec3f scale)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeObject));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_OBJECT);
|
||||
vec3f_copy(graphNode->pos, pos);
|
||||
vec3f_copy(graphNode->scale, scale);
|
||||
@@ -313,9 +368,9 @@ struct GraphNodeObject *init_graph_node_object(struct AllocOnlyPool *pool,
|
||||
vec3f_copy(graphNode->cameraToObject, gVec3fZero);
|
||||
#endif
|
||||
graphNode->sharedChild = sharedChild;
|
||||
graphNode->throwMatrix = NULL;
|
||||
graphNode->throwMatrix = nullptr;
|
||||
graphNode->animInfo.animID = 0;
|
||||
graphNode->animInfo.curAnim = NULL;
|
||||
graphNode->animInfo.curAnim = nullptr;
|
||||
graphNode->animInfo.animFrame = 0;
|
||||
graphNode->animInfo.animFrameAccelAssist = 0;
|
||||
graphNode->animInfo.animAccel = 0x10000;
|
||||
@@ -329,14 +384,18 @@ struct GraphNodeObject *init_graph_node_object(struct AllocOnlyPool *pool,
|
||||
/**
|
||||
* Allocates and returns a newly created frustum culling radius node
|
||||
*/
|
||||
struct GraphNodeCullingRadius *init_graph_node_culling_radius(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeCullingRadius *init_graph_node_culling_radius(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeCullingRadius *graphNode,
|
||||
s16 radius) {
|
||||
if (pool != NULL) {
|
||||
s16 radius)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeCullingRadius));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_CULLING_RADIUS);
|
||||
graphNode->cullingRadius = radius;
|
||||
}
|
||||
@@ -347,15 +406,19 @@ struct GraphNodeCullingRadius *init_graph_node_culling_radius(struct AllocOnlyPo
|
||||
/**
|
||||
* Allocates and returns a newly created animated part node
|
||||
*/
|
||||
struct GraphNodeAnimatedPart *init_graph_node_animated_part(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeAnimatedPart *init_graph_node_animated_part(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeAnimatedPart *graphNode,
|
||||
s32 drawingLayer, void *displayList,
|
||||
Vec3s translation) {
|
||||
if (pool != NULL) {
|
||||
Vec3s translation)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeAnimatedPart));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_ANIMATED_PART);
|
||||
vec3s_copy(graphNode->translation, translation);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
@@ -368,15 +431,19 @@ struct GraphNodeAnimatedPart *init_graph_node_animated_part(struct AllocOnlyPool
|
||||
/**
|
||||
* Allocates and returns a newly created billboard node
|
||||
*/
|
||||
struct GraphNodeBillboard *init_graph_node_billboard(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeBillboard *init_graph_node_billboard(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeBillboard *graphNode,
|
||||
s32 drawingLayer, void *displayList,
|
||||
Vec3s translation) {
|
||||
if (pool != NULL) {
|
||||
Vec3s translation)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeBillboard));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_BILLBOARD);
|
||||
vec3s_copy(graphNode->translation, translation);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
@@ -389,14 +456,18 @@ struct GraphNodeBillboard *init_graph_node_billboard(struct AllocOnlyPool *pool,
|
||||
/**
|
||||
* Allocates and returns a newly created displaylist node
|
||||
*/
|
||||
struct GraphNodeDisplayList *init_graph_node_display_list(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeDisplayList *init_graph_node_display_list(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeDisplayList *graphNode,
|
||||
s32 drawingLayer, void *displayList) {
|
||||
if (pool != NULL) {
|
||||
s32 drawingLayer, void *displayList)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeDisplayList));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_DISPLAY_LIST);
|
||||
graphNode->node.flags = (drawingLayer << 8) | (graphNode->node.flags & 0xFF);
|
||||
graphNode->displayList = displayList;
|
||||
@@ -408,14 +479,18 @@ struct GraphNodeDisplayList *init_graph_node_display_list(struct AllocOnlyPool *
|
||||
/**
|
||||
* Allocates and returns a newly created shadow node
|
||||
*/
|
||||
struct GraphNodeShadow *init_graph_node_shadow(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeShadow *init_graph_node_shadow(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeShadow *graphNode, s16 shadowScale,
|
||||
u8 shadowSolidity, u8 shadowType) {
|
||||
if (pool != NULL) {
|
||||
u8 shadowSolidity, u8 shadowType)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeShadow));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_SHADOW);
|
||||
graphNode->shadowScale = shadowScale;
|
||||
graphNode->shadowSolidity = shadowSolidity;
|
||||
@@ -428,14 +503,18 @@ struct GraphNodeShadow *init_graph_node_shadow(struct AllocOnlyPool *pool,
|
||||
/**
|
||||
* Allocates and returns a newly created object parent node
|
||||
*/
|
||||
struct GraphNodeObjectParent *init_graph_node_object_parent(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeObjectParent *init_graph_node_object_parent(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeObjectParent *graphNode,
|
||||
struct GraphNode *sharedChild) {
|
||||
if (pool != NULL) {
|
||||
struct GraphNode *sharedChild)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeObjectParent));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->node, GRAPH_NODE_TYPE_OBJECT_PARENT);
|
||||
graphNode->sharedChild = sharedChild;
|
||||
}
|
||||
@@ -446,19 +525,24 @@ struct GraphNodeObjectParent *init_graph_node_object_parent(struct AllocOnlyPool
|
||||
/**
|
||||
* Allocates and returns a newly created generated node
|
||||
*/
|
||||
struct GraphNodeGenerated *init_graph_node_generated(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeGenerated *init_graph_node_generated(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeGenerated *graphNode,
|
||||
GraphNodeFunc gfxFunc, s32 parameter) {
|
||||
if (pool != NULL) {
|
||||
GraphNodeFunc gfxFunc, s32 parameter)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeGenerated));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_GENERATED_LIST);
|
||||
graphNode->fnNode.func = gfxFunc;
|
||||
graphNode->parameter = parameter;
|
||||
|
||||
if (gfxFunc != NULL) {
|
||||
if (gfxFunc != nullptr)
|
||||
{
|
||||
gfxFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
|
||||
}
|
||||
}
|
||||
@@ -469,22 +553,27 @@ struct GraphNodeGenerated *init_graph_node_generated(struct AllocOnlyPool *pool,
|
||||
/**
|
||||
* Allocates and returns a newly created background node
|
||||
*/
|
||||
struct GraphNodeBackground *init_graph_node_background(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeBackground *init_graph_node_background(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeBackground *graphNode,
|
||||
u16 background, GraphNodeFunc backgroundFunc,
|
||||
s32 zero) {
|
||||
if (pool != NULL) {
|
||||
s32 zero)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeBackground));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_BACKGROUND);
|
||||
|
||||
graphNode->background = (background << 16) | background;
|
||||
graphNode->fnNode.func = backgroundFunc;
|
||||
graphNode->unused = zero; // always 0, unused
|
||||
|
||||
if (backgroundFunc != NULL) {
|
||||
if (backgroundFunc != nullptr)
|
||||
{
|
||||
backgroundFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
|
||||
}
|
||||
}
|
||||
@@ -495,23 +584,28 @@ struct GraphNodeBackground *init_graph_node_background(struct AllocOnlyPool *poo
|
||||
/**
|
||||
* Allocates and returns a newly created held object node
|
||||
*/
|
||||
struct GraphNodeHeldObject *init_graph_node_held_object(struct AllocOnlyPool *pool,
|
||||
struct GraphNodeHeldObject *init_graph_node_held_object(
|
||||
struct AllocOnlyPool *pool,
|
||||
struct GraphNodeHeldObject *graphNode,
|
||||
struct Object *objNode,
|
||||
Vec3s translation,
|
||||
GraphNodeFunc nodeFunc, s32 playerIndex) {
|
||||
if (pool != NULL) {
|
||||
GraphNodeFunc nodeFunc, s32 playerIndex)
|
||||
{
|
||||
if (pool != nullptr)
|
||||
{
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeHeldObject));
|
||||
}
|
||||
|
||||
if (graphNode != NULL) {
|
||||
if (graphNode != nullptr)
|
||||
{
|
||||
init_scene_graph_node_links(&graphNode->fnNode.node, GRAPH_NODE_TYPE_HELD_OBJ);
|
||||
vec3s_copy(graphNode->translation, translation);
|
||||
graphNode->objNode = objNode;
|
||||
graphNode->fnNode.func = nodeFunc;
|
||||
graphNode->playerIndex = playerIndex;
|
||||
|
||||
if (nodeFunc != NULL) {
|
||||
if (nodeFunc != nullptr)
|
||||
{
|
||||
nodeFunc(GEO_CONTEXT_CREATE, &graphNode->fnNode.node, pool);
|
||||
}
|
||||
}
|
||||
@@ -522,19 +616,24 @@ struct GraphNodeHeldObject *init_graph_node_held_object(struct AllocOnlyPool *po
|
||||
/**
|
||||
* Adds 'childNode' to the end of the list children from 'parent'
|
||||
*/
|
||||
struct GraphNode *geo_add_child(struct GraphNode *parent, struct GraphNode *childNode) {
|
||||
struct GraphNode *geo_add_child(struct GraphNode *parent, struct GraphNode *childNode)
|
||||
{
|
||||
struct GraphNode *parentFirstChild;
|
||||
struct GraphNode *parentLastChild;
|
||||
|
||||
if (childNode != NULL) {
|
||||
if (childNode != nullptr)
|
||||
{
|
||||
childNode->parent = parent;
|
||||
parentFirstChild = parent->children;
|
||||
|
||||
if (parentFirstChild == NULL) {
|
||||
if (parentFirstChild == nullptr)
|
||||
{
|
||||
parent->children = childNode;
|
||||
childNode->prev = childNode;
|
||||
childNode->next = childNode;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
parentLastChild = parentFirstChild->prev;
|
||||
childNode->prev = parentLastChild;
|
||||
childNode->next = parentFirstChild;
|
||||
@@ -552,7 +651,8 @@ struct GraphNode *geo_add_child(struct GraphNode *parent, struct GraphNode *chil
|
||||
* since geo nodes are allocated in a pointer-bumping pool that
|
||||
* gets thrown out when changing areas.
|
||||
*/
|
||||
struct GraphNode *geo_remove_child(struct GraphNode *graphNode) {
|
||||
struct GraphNode *geo_remove_child(struct GraphNode *graphNode)
|
||||
{
|
||||
struct GraphNode *parent;
|
||||
struct GraphNode **firstChild;
|
||||
|
||||
@@ -564,11 +664,15 @@ struct GraphNode *geo_remove_child(struct GraphNode *graphNode) {
|
||||
graphNode->next->prev = graphNode->prev;
|
||||
|
||||
// If this node was the first child, a new first child must be chosen
|
||||
if (*firstChild == graphNode) {
|
||||
if (*firstChild == graphNode)
|
||||
{
|
||||
// The list is circular, so this checks whether it was the only child
|
||||
if (graphNode->next == graphNode) {
|
||||
*firstChild = NULL; // Parent has no children anymore
|
||||
} else {
|
||||
if (graphNode->next == graphNode)
|
||||
{
|
||||
*firstChild = nullptr; // Parent has no children anymore
|
||||
}
|
||||
else
|
||||
{
|
||||
*firstChild = graphNode->next; // Choose a new first child
|
||||
}
|
||||
}
|
||||
@@ -582,7 +686,8 @@ struct GraphNode *geo_remove_child(struct GraphNode *graphNode) {
|
||||
* object is always drawn before any other objects. (Note that the geo order
|
||||
* is independent from processing group order, where Mario is not first.)
|
||||
*/
|
||||
struct GraphNode *geo_make_first_child(struct GraphNode *newFirstChild) {
|
||||
struct GraphNode *geo_make_first_child(struct GraphNode *newFirstChild)
|
||||
{
|
||||
struct GraphNode *lastSibling;
|
||||
struct GraphNode *parent;
|
||||
struct GraphNode **firstChild;
|
||||
@@ -590,8 +695,10 @@ struct GraphNode *geo_make_first_child(struct GraphNode *newFirstChild) {
|
||||
parent = newFirstChild->parent;
|
||||
firstChild = &parent->children;
|
||||
|
||||
if (*firstChild != newFirstChild) {
|
||||
if ((*firstChild)->prev != newFirstChild) {
|
||||
if (*firstChild != newFirstChild)
|
||||
{
|
||||
if ((*firstChild)->prev != newFirstChild)
|
||||
{
|
||||
newFirstChild->prev->next = newFirstChild->next;
|
||||
newFirstChild->next->prev = newFirstChild->prev;
|
||||
lastSibling = (*firstChild)->prev;
|
||||
@@ -610,24 +717,30 @@ struct GraphNode *geo_make_first_child(struct GraphNode *newFirstChild) {
|
||||
* Helper function for geo_call_global_function_nodes that recursively
|
||||
* traverses the scene graph and calls the functions of global nodes.
|
||||
*/
|
||||
void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 callContext) {
|
||||
void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 callContext)
|
||||
{
|
||||
struct GraphNode **globalPtr;
|
||||
struct GraphNode *curNode;
|
||||
struct FnGraphNode *asFnNode;
|
||||
|
||||
curNode = graphNode;
|
||||
|
||||
do {
|
||||
do
|
||||
{
|
||||
asFnNode = (struct FnGraphNode *)curNode;
|
||||
|
||||
if (curNode->type & GRAPH_NODE_TYPE_FUNCTIONAL) {
|
||||
if (asFnNode->func != NULL) {
|
||||
asFnNode->func(callContext, curNode, NULL);
|
||||
if (curNode->type & GRAPH_NODE_TYPE_FUNCTIONAL)
|
||||
{
|
||||
if (asFnNode->func != nullptr)
|
||||
{
|
||||
asFnNode->func(callContext, curNode, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
if (curNode->children != NULL) {
|
||||
switch (curNode->type) {
|
||||
if (curNode->children != nullptr)
|
||||
{
|
||||
switch (curNode->type)
|
||||
{
|
||||
case GRAPH_NODE_TYPE_MASTER_LIST:
|
||||
globalPtr = (struct GraphNode **)&gCurGraphNodeMasterList;
|
||||
break;
|
||||
@@ -641,21 +754,24 @@ void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 call
|
||||
globalPtr = (struct GraphNode **)&gCurGraphNodeObject;
|
||||
break;
|
||||
default:
|
||||
globalPtr = NULL;
|
||||
globalPtr = nullptr;
|
||||
break;
|
||||
}
|
||||
|
||||
if (globalPtr != NULL) {
|
||||
if (globalPtr != nullptr)
|
||||
{
|
||||
*globalPtr = curNode;
|
||||
}
|
||||
|
||||
geo_call_global_function_nodes_helper(curNode->children, callContext);
|
||||
|
||||
if (globalPtr != NULL) {
|
||||
*globalPtr = NULL;
|
||||
if (globalPtr != nullptr)
|
||||
{
|
||||
*globalPtr = nullptr;
|
||||
}
|
||||
}
|
||||
} while ((curNode = curNode->next) != graphNode);
|
||||
}
|
||||
while ((curNode = curNode->next) != graphNode);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -665,11 +781,14 @@ void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 call
|
||||
* callContext is one of the GEO_CONTEXT_ defines.
|
||||
* The graphNode argument should be of type GraphNodeRoot.
|
||||
*/
|
||||
void geo_call_global_function_nodes(struct GraphNode *graphNode, s32 callContext) {
|
||||
if (graphNode->flags & GRAPH_RENDER_ACTIVE) {
|
||||
void geo_call_global_function_nodes(struct GraphNode *graphNode, s32 callContext)
|
||||
{
|
||||
if (graphNode->flags & GRAPH_RENDER_ACTIVE)
|
||||
{
|
||||
gCurGraphNodeRoot = (struct GraphNodeRoot *)graphNode;
|
||||
|
||||
if (graphNode->children != NULL) {
|
||||
if (graphNode->children != nullptr)
|
||||
{
|
||||
geo_call_global_function_nodes_helper(graphNode->children, callContext);
|
||||
}
|
||||
|
||||
@@ -680,8 +799,9 @@ void geo_call_global_function_nodes(struct GraphNode *graphNode, s32 callContext
|
||||
/**
|
||||
* When objects are cleared, this is called on all object nodes (loaded or unloaded).
|
||||
*/
|
||||
void geo_reset_object_node(struct GraphNodeObject *graphNode) {
|
||||
init_graph_node_object(NULL, graphNode, 0, gVec3fZero, gVec3sZero, gVec3fOne);
|
||||
void geo_reset_object_node(struct GraphNodeObject *graphNode)
|
||||
{
|
||||
init_graph_node_object(nullptr, graphNode, 0, gVec3fZero, gVec3sZero, gVec3fOne);
|
||||
|
||||
geo_add_child(&gObjParentGraphNode, &graphNode->node);
|
||||
graphNode->node.flags &= ~GRAPH_RENDER_ACTIVE;
|
||||
@@ -690,15 +810,16 @@ void geo_reset_object_node(struct GraphNodeObject *graphNode) {
|
||||
/**
|
||||
* Initialize an object node using the given parameters
|
||||
*/
|
||||
void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f pos, Vec3s angle) {
|
||||
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;
|
||||
@@ -709,7 +830,8 @@ void geo_obj_init(struct GraphNodeObject *graphNode, void *sharedChild, Vec3f po
|
||||
/**
|
||||
* Initialize and object node using the given SpawnInfo struct
|
||||
*/
|
||||
void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo *spawn) {
|
||||
void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo *spawn)
|
||||
{
|
||||
vec3f_set(graphNode->scale, 1.0f, 1.0f, 1.0f);
|
||||
vec3s_copy(graphNode->angle, spawn->startAngle);
|
||||
|
||||
@@ -721,7 +843,7 @@ void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo
|
||||
graphNode->activeAreaIndex = spawn->activeAreaIndex;
|
||||
graphNode->sharedChild = spawn->unk18;
|
||||
graphNode->unk4C = spawn;
|
||||
graphNode->throwMatrix = NULL;
|
||||
graphNode->throwMatrix = nullptr;
|
||||
graphNode->animInfo.curAnim = 0;
|
||||
|
||||
graphNode->node.flags |= GRAPH_RENDER_ACTIVE;
|
||||
@@ -733,11 +855,13 @@ void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo
|
||||
/**
|
||||
* Initialize the animation of an object node
|
||||
*/
|
||||
void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr) {
|
||||
void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr)
|
||||
{
|
||||
struct Animation **animSegmented = segmented_to_virtual(animPtrAddr);
|
||||
struct Animation *anim = segmented_to_virtual(*animSegmented);
|
||||
|
||||
if (graphNode->animInfo.curAnim != anim) {
|
||||
if (graphNode->animInfo.curAnim != anim)
|
||||
{
|
||||
graphNode->animInfo.curAnim = anim;
|
||||
graphNode->animInfo.animFrame = anim->startFrame + ((anim->flags & ANIM_FLAG_FORWARD) ? 1 : -1);
|
||||
graphNode->animInfo.animAccel = 0;
|
||||
@@ -748,11 +872,13 @@ void geo_obj_init_animation(struct GraphNodeObject *graphNode, struct Animation
|
||||
/**
|
||||
* Initialize the animation of an object node
|
||||
*/
|
||||
void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr, u32 animAccel) {
|
||||
void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Animation **animPtrAddr, u32 animAccel)
|
||||
{
|
||||
struct Animation **animSegmented = segmented_to_virtual(animPtrAddr);
|
||||
struct Animation *anim = segmented_to_virtual(*animSegmented);
|
||||
|
||||
if (graphNode->animInfo.curAnim != anim) {
|
||||
if (graphNode->animInfo.curAnim != anim)
|
||||
{
|
||||
graphNode->animInfo.curAnim = anim;
|
||||
graphNode->animInfo.animYTrans = 0;
|
||||
graphNode->animInfo.animFrameAccelAssist =
|
||||
@@ -770,12 +896,16 @@ void geo_obj_init_animation_accel(struct GraphNodeObject *graphNode, struct Anim
|
||||
* and the second s16 the actual index. This index can be used to index in the array
|
||||
* with actual animation values.
|
||||
*/
|
||||
s32 retrieve_animation_index(s32 frame, u16 **attributes) {
|
||||
s32 retrieve_animation_index(s32 frame, u16 **attributes)
|
||||
{
|
||||
s32 result;
|
||||
|
||||
if (frame < (*attributes)[0]) {
|
||||
if (frame < (*attributes)[0])
|
||||
{
|
||||
result = (*attributes)[1] + frame;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
result = (*attributes)[1] + (*attributes)[0] - 1;
|
||||
}
|
||||
|
||||
@@ -789,51 +919,72 @@ s32 retrieve_animation_index(s32 frame, u16 **attributes) {
|
||||
* whether it plays forwards or backwards, and whether it stops or loops at
|
||||
* the end etc.
|
||||
*/
|
||||
s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist) {
|
||||
s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist)
|
||||
{
|
||||
s32 result;
|
||||
struct Animation *anim;
|
||||
|
||||
anim = obj->curAnim;
|
||||
|
||||
if (obj->animTimer == gAreaUpdateCounter || anim->flags & ANIM_FLAG_2) {
|
||||
if (accelAssist != NULL) {
|
||||
if (obj->animTimer == gAreaUpdateCounter || anim->flags & ANIM_FLAG_2)
|
||||
{
|
||||
if (accelAssist != nullptr)
|
||||
{
|
||||
accelAssist[0] = obj->animFrameAccelAssist;
|
||||
}
|
||||
|
||||
return obj->animFrame;
|
||||
}
|
||||
|
||||
if (anim->flags & ANIM_FLAG_FORWARD) {
|
||||
if (obj->animAccel) {
|
||||
if (anim->flags & ANIM_FLAG_FORWARD)
|
||||
{
|
||||
if (obj->animAccel)
|
||||
{
|
||||
result = obj->animFrameAccelAssist - obj->animAccel;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
result = (obj->animFrame - 1) << 16;
|
||||
}
|
||||
|
||||
if (GET_HIGH_S16_OF_32(result) < anim->loopStart) {
|
||||
if (anim->flags & ANIM_FLAG_NOLOOP) {
|
||||
if (GET_HIGH_S16_OF_32(result) < anim->loopStart)
|
||||
{
|
||||
if (anim->flags & ANIM_FLAG_NOLOOP)
|
||||
{
|
||||
SET_HIGH_S16_OF_32(result, anim->loopStart);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_HIGH_S16_OF_32(result, anim->loopEnd - 1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (obj->animAccel != 0) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (obj->animAccel != 0)
|
||||
{
|
||||
result = obj->animFrameAccelAssist + obj->animAccel;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
result = (obj->animFrame + 1) << 16;
|
||||
}
|
||||
|
||||
if (GET_HIGH_S16_OF_32(result) >= anim->loopEnd) {
|
||||
if (anim->flags & ANIM_FLAG_NOLOOP) {
|
||||
if (GET_HIGH_S16_OF_32(result) >= anim->loopEnd)
|
||||
{
|
||||
if (anim->flags & ANIM_FLAG_NOLOOP)
|
||||
{
|
||||
SET_HIGH_S16_OF_32(result, anim->loopEnd - 1);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
SET_HIGH_S16_OF_32(result, anim->loopStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (accelAssist != 0) {
|
||||
if (accelAssist != 0)
|
||||
{
|
||||
accelAssist[0] = result;
|
||||
}
|
||||
|
||||
@@ -848,19 +999,22 @@ s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist) {
|
||||
* currently happens in-line in geo_process_shadow where it also accounts for
|
||||
* animations without lateral translation.
|
||||
*/
|
||||
void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f position) {
|
||||
void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f position)
|
||||
{
|
||||
struct Animation *animation = obj->animInfo.curAnim;
|
||||
u16 *attribute;
|
||||
s16 *values;
|
||||
s16 frame;
|
||||
|
||||
if (animation != NULL) {
|
||||
if (animation != nullptr)
|
||||
{
|
||||
attribute = segmented_to_virtual((void *)animation->index);
|
||||
values = segmented_to_virtual((void *)animation->values);
|
||||
|
||||
frame = obj->animInfo.animFrame;
|
||||
|
||||
if (frame < 0) {
|
||||
if (frame < 0)
|
||||
{
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
@@ -870,7 +1024,9 @@ void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f posit
|
||||
position[1] = (f32)values[retrieve_animation_index(frame, &attribute)];
|
||||
position[2] = (f32)values[retrieve_animation_index(frame, &attribute)];
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
vec3f_set(position, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
@@ -879,14 +1035,17 @@ void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f posit
|
||||
* Unused function to find the root of the geo node tree, which should be a
|
||||
* GraphNodeRoot. If it is not for some reason, null is returned.
|
||||
*/
|
||||
struct GraphNodeRoot *geo_find_root(struct GraphNode *graphNode) {
|
||||
struct GraphNodeRoot *resGraphNode = NULL;
|
||||
struct GraphNodeRoot *geo_find_root(struct GraphNode *graphNode)
|
||||
{
|
||||
struct GraphNodeRoot *resGraphNode = nullptr;
|
||||
|
||||
while (graphNode->parent != NULL) {
|
||||
while (graphNode->parent != nullptr)
|
||||
{
|
||||
graphNode = graphNode->parent;
|
||||
}
|
||||
|
||||
if (graphNode->type == GRAPH_NODE_TYPE_ROOT) {
|
||||
if (graphNode->type == GRAPH_NODE_TYPE_ROOT)
|
||||
{
|
||||
resGraphNode = (struct GraphNodeRoot *)graphNode;
|
||||
}
|
||||
|
||||
|
||||
+220
-92
@@ -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,
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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 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,
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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 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,
|
||||
|
||||
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,
|
||||
|
||||
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 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(Vec3s dst, s16 *src);
|
||||
|
||||
s16 *read_vec3s_angle(Vec3s dst, s16 *src);
|
||||
|
||||
void register_scene_graph_node(struct GraphNode *graphNode);
|
||||
|
||||
#endif // GRAPH_NODE_H
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
#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) {
|
||||
if (((uintptr_t)(*src) & 7) == 4)
|
||||
{
|
||||
*src += 2; // skip 32 bits
|
||||
}
|
||||
ret = *(*src)++;
|
||||
if (((uintptr_t)(*src) & 7) == 4) {
|
||||
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) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gCurGraphNodeList[gCurGraphNodeIndex - 1]->type == GRAPH_NODE_TYPE_OBJECT_PARENT)
|
||||
{
|
||||
((struct GraphNodeObjectParent *)gCurGraphNodeList[gCurGraphNodeIndex - 1])
|
||||
->sharedChild = graphNode;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
geo_add_child(gCurGraphNodeList[gCurGraphNodeIndex - 1], graphNode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,7 +23,9 @@ 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;
|
||||
@@ -29,8 +34,10 @@ void guMtxL2F(float mf[4][4], Mtx *m) {
|
||||
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++) {
|
||||
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;
|
||||
@@ -41,27 +48,37 @@ void guMtxL2F(float mf[4][4], Mtx *m) {
|
||||
}
|
||||
}
|
||||
#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) {
|
||||
|
||||
void guMtxIdent(Mtx *m)
|
||||
{
|
||||
#ifndef GBI_FLOATS
|
||||
float mf[4][4];
|
||||
guMtxIdentF(mf);
|
||||
|
||||
@@ -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
|
||||
+167
-79
@@ -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;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
*d++ = *s++;
|
||||
}
|
||||
}
|
||||
@@ -1588,7 +1604,8 @@ 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
|
||||
@@ -1603,7 +1620,8 @@ void mtxf_identity(Mat4 mtx) {
|
||||
/**
|
||||
* 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;
|
||||
@@ -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];
|
||||
@@ -1995,6 +2027,7 @@ void mtxf_mul_vec3f(Mat4 mtx, Vec3f b) {
|
||||
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,7 +2037,8 @@ 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) {
|
||||
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.
|
||||
@@ -2016,7 +2050,8 @@ void mtxf_to_mtx(Mtx *dest, Mat4 src) {
|
||||
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
|
||||
@@ -2027,7 +2062,8 @@ void mtxf_to_mtx(Mtx *dest, Mat4 src) {
|
||||
/**
|
||||
* 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,7 +2082,8 @@ 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];
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
@@ -8,17 +8,20 @@
|
||||
/**
|
||||
* 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 ) {
|
||||
for (int i = 0; i < groupCount; ++i)
|
||||
{
|
||||
uint32_t surfCount = loaded_surface_iter_group_size(i);
|
||||
for( int j = 0; j < surfCount; ++j ) {
|
||||
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
|
||||
@@ -33,17 +36,20 @@ static struct SM64SurfaceCollisionData *find_ceil_from_list( f32 x, f32 y, f32 z
|
||||
x2 = surf->vertex2[0];
|
||||
|
||||
// Checking if point is in bounds of the triangle laterally.
|
||||
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) > 0) {
|
||||
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) {
|
||||
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) > 0) {
|
||||
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) > 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -55,7 +61,8 @@ static struct SM64SurfaceCollisionData *find_ceil_from_list( f32 x, f32 y, f32 z
|
||||
f32 height;
|
||||
|
||||
// If a wall, ignore it. Likely a remnant, should never occur.
|
||||
if (ny == 0.0f) {
|
||||
if (ny == 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -66,7 +73,8 @@ static struct SM64SurfaceCollisionData *find_ceil_from_list( f32 x, f32 y, f32 z
|
||||
//! (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) {
|
||||
if (y - (height - -78.0f) > 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -76,25 +84,29 @@ static struct SM64SurfaceCollisionData *find_ceil_from_list( f32 x, f32 y, f32 z
|
||||
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 ) {
|
||||
for (int i = 0; i < groupCount; ++i)
|
||||
{
|
||||
uint32_t surfCount = loaded_surface_iter_group_size(i);
|
||||
for( int j = 0; j < surfCount; ++j ) {
|
||||
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
|
||||
@@ -109,7 +121,8 @@ static struct SM64SurfaceCollisionData *find_floor_from_list( f32 x, f32 y, f32
|
||||
z2 = surf->vertex2[2];
|
||||
|
||||
// Check that the point is within the triangle bounds.
|
||||
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0) {
|
||||
if ((z1 - z) * (x2 - x1) - (x1 - x) * (z2 - z1) < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -117,10 +130,12 @@ static struct SM64SurfaceCollisionData *find_floor_from_list( f32 x, f32 y, f32
|
||||
x3 = surf->vertex3[0];
|
||||
z3 = surf->vertex3[2];
|
||||
|
||||
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0) {
|
||||
if ((z2 - z) * (x3 - x2) - (x2 - x) * (z3 - z2) < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) < 0) {
|
||||
if ((z3 - z) * (x1 - x3) - (x3 - x) * (z1 - z3) < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -130,14 +145,16 @@ static struct SM64SurfaceCollisionData *find_floor_from_list( f32 x, f32 y, f32
|
||||
oo = surf->originOffset;
|
||||
|
||||
// If a wall, ignore it. Likely a remnant, should never occur.
|
||||
if (ny == 0.0f) {
|
||||
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) {
|
||||
if (y - (height + -78.0f) < 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -146,11 +163,13 @@ static struct SM64SurfaceCollisionData *find_floor_from_list( f32 x, f32 y, f32
|
||||
*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,14 +182,17 @@ 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 ) {
|
||||
for (int i = 0; i < groupCount; ++i)
|
||||
{
|
||||
uint32_t surfCount = loaded_surface_iter_group_size(i);
|
||||
for( int j = 0; j < surfCount; ++j ) {
|
||||
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
|
||||
@@ -179,18 +201,21 @@ static s32 find_wall_collisions_from_list( struct SM64WallCollisionData *data) {
|
||||
// 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 ) {
|
||||
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) {
|
||||
if (y < surf->lowerY || y > surf->upperY)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
offset = surf->normal.x * x + surf->normal.y * y + surf->normal.z * z + surf->originOffset;
|
||||
|
||||
if (offset < -radius || offset > radius) {
|
||||
if (offset < -radius || offset > radius)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -200,74 +225,107 @@ static s32 find_wall_collisions_from_list( struct SM64WallCollisionData *data) {
|
||||
//! (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->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) {
|
||||
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) {
|
||||
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) {
|
||||
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
|
||||
{
|
||||
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];
|
||||
|
||||
if (surf->normal.z > 0.0f) {
|
||||
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) > 0.0f) {
|
||||
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) {
|
||||
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) > 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) > 0.0f) {
|
||||
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) > 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) < 0.0f) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((y1 - y) * (w2 - w1) - (w1 - px) * (y2 - y1) < 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) < 0.0f) {
|
||||
if ((y2 - y) * (w3 - w2) - (w2 - px) * (y3 - y2) < 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) < 0.0f) {
|
||||
if ((y3 - y) * (w1 - w3) - (w3 - px) * (y1 - y3) < 0.0f)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore camera only surfaces.
|
||||
if (surf->type == SURFACE_CAMERA_BOUNDARY) {
|
||||
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 (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)) {
|
||||
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 != NULL && gCurrentObject == gMarioObject
|
||||
&& (gMarioState->flags & MARIO_VANISH_CAP)) {
|
||||
if (gCurrentObject != nullptr && gCurrentObject == gMarioObject
|
||||
&& (gMarioState->flags & MARIO_VANISH_CAP))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -280,12 +338,14 @@ static s32 find_wall_collisions_from_list( struct SM64WallCollisionData *data) {
|
||||
//! (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) {
|
||||
if (data->numWalls < 4)
|
||||
{
|
||||
data->walls[data->numWalls++] = surf;
|
||||
}
|
||||
|
||||
numCols++;
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
return numCols;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -13,12 +13,19 @@
|
||||
#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
|
||||
|
||||
+112
-56
@@ -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?
|
||||
/*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;
|
||||
/*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;
|
||||
|
||||
@@ -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) {
|
||||
if (run == TRUE)
|
||||
{
|
||||
sp1C = (struct Object *)gCurGraphNodeObject;
|
||||
if (sp1C == gMarioObject && sp1C->prevObj != NULL) {
|
||||
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;
|
||||
}
|
||||
+191
-95
@@ -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;
|
||||
@@ -348,6 +367,7 @@ struct Camera;
|
||||
* These are concurrent: multiple CameraEvents can occur on the same frame.
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
+323
-154
@@ -58,12 +58,15 @@
|
||||
// u8 sDelayInvincTimer;
|
||||
// s16 sInvulnerable;
|
||||
|
||||
struct InteractionHandler {
|
||||
struct InteractionHandler
|
||||
{
|
||||
u32 interactType;
|
||||
|
||||
u32 (*handler)(struct MarioState *, u32, struct Object *);
|
||||
};
|
||||
|
||||
static u32 interact_noop(struct MarioState *m, u32 interactType, struct Object *o) {
|
||||
static u32 interact_noop(struct MarioState *m, u32 interactType, struct Object *o)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -120,8 +123,8 @@ static u8 sPssSlideStarted = FALSE;
|
||||
/**
|
||||
* Returns the type of cap Mario is wearing.
|
||||
*/
|
||||
u32 get_mario_cap_flag(struct Object *capObject) {
|
||||
|
||||
u32 get_mario_cap_flag(struct Object *capObject)
|
||||
{
|
||||
return MARIO_NORMAL_CAP;
|
||||
|
||||
// const BehaviorScript *script = virtual_to_segmented(0x13, capObject->behavior);
|
||||
@@ -142,21 +145,24 @@ u32 get_mario_cap_flag(struct Object *capObject) {
|
||||
* Returns true if the passed in object has a moving angle yaw
|
||||
* in the angular range given towards Mario.
|
||||
*/
|
||||
u32 object_facing_mario(struct MarioState *m, struct Object *o, s16 angleRange) {
|
||||
u32 object_facing_mario(struct MarioState *m, struct Object *o, s16 angleRange)
|
||||
{
|
||||
f32 dx = m->pos[0] - o->oPosX;
|
||||
f32 dz = m->pos[2] - o->oPosZ;
|
||||
|
||||
s16 angleToMario = atan2s(dz, dx);
|
||||
s16 dAngle = angleToMario - o->oMoveAngleYaw;
|
||||
|
||||
if (-angleRange <= dAngle && dAngle <= angleRange) {
|
||||
if (-angleRange <= dAngle && dAngle <= angleRange)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o) {
|
||||
s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o)
|
||||
{
|
||||
f32 dx = o->oPosX - m->pos[0];
|
||||
f32 dz = o->oPosZ - m->pos[2];
|
||||
|
||||
@@ -167,49 +173,70 @@ s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o) {
|
||||
* Determines Mario's interaction with a given object depending on their proximity,
|
||||
* action, speed, and position.
|
||||
*/
|
||||
u32 determine_interaction(struct MarioState *m, struct Object *o) {
|
||||
u32 determine_interaction(struct MarioState *m, struct Object *o)
|
||||
{
|
||||
u32 interaction = 0;
|
||||
u32 action = m->action;
|
||||
|
||||
if (action & ACT_FLAG_ATTACKING) {
|
||||
if (action == ACT_PUNCHING || action == ACT_MOVE_PUNCHING || action == ACT_JUMP_KICK) {
|
||||
if (action & ACT_FLAG_ATTACKING)
|
||||
{
|
||||
if (action == ACT_PUNCHING || action == ACT_MOVE_PUNCHING || action == ACT_JUMP_KICK)
|
||||
{
|
||||
s16 dYawToObject = mario_obj_angle_to_object(m, o) - m->faceAngle[1];
|
||||
|
||||
if (m->flags & MARIO_PUNCHING) {
|
||||
if (m->flags & MARIO_PUNCHING)
|
||||
{
|
||||
// 120 degrees total, or 60 each way
|
||||
if (-0x2AAA <= dYawToObject && dYawToObject <= 0x2AAA) {
|
||||
if (-0x2AAA <= dYawToObject && dYawToObject <= 0x2AAA)
|
||||
{
|
||||
interaction = INT_PUNCH;
|
||||
}
|
||||
}
|
||||
if (m->flags & MARIO_KICKING) {
|
||||
if (m->flags & MARIO_KICKING)
|
||||
{
|
||||
// 120 degrees total, or 60 each way
|
||||
if (-0x2AAA <= dYawToObject && dYawToObject <= 0x2AAA) {
|
||||
if (-0x2AAA <= dYawToObject && dYawToObject <= 0x2AAA)
|
||||
{
|
||||
interaction = INT_KICK;
|
||||
}
|
||||
}
|
||||
if (m->flags & MARIO_TRIPPING) {
|
||||
if (m->flags & MARIO_TRIPPING)
|
||||
{
|
||||
// 180 degrees total, or 90 each way
|
||||
if (-0x4000 <= dYawToObject && dYawToObject <= 0x4000) {
|
||||
if (-0x4000 <= dYawToObject && dYawToObject <= 0x4000)
|
||||
{
|
||||
interaction = INT_TRIP;
|
||||
}
|
||||
}
|
||||
} else if (action == ACT_GROUND_POUND || action == ACT_TWIRLING) {
|
||||
if (m->vel[1] < 0.0f) {
|
||||
}
|
||||
else if (action == ACT_GROUND_POUND || action == ACT_TWIRLING)
|
||||
{
|
||||
if (m->vel[1] < 0.0f)
|
||||
{
|
||||
interaction = INT_GROUND_POUND_OR_TWIRL;
|
||||
}
|
||||
} else if (action == ACT_GROUND_POUND_LAND || action == ACT_TWIRL_LAND) {
|
||||
}
|
||||
else if (action == ACT_GROUND_POUND_LAND || action == ACT_TWIRL_LAND)
|
||||
{
|
||||
// Neither ground pounding nor twirling change Mario's vertical speed on landing.,
|
||||
// so the speed check is nearly always true (perhaps not if you land while going upwards?)
|
||||
// Additionally, actionState it set on each first thing in their action, so this is
|
||||
// only true prior to the very first frame (i.e. active 1 frame prior to it run).
|
||||
if (m->vel[1] < 0.0f && m->actionState == 0) {
|
||||
if (m->vel[1] < 0.0f && m->actionState == 0)
|
||||
{
|
||||
interaction = INT_GROUND_POUND_OR_TWIRL;
|
||||
}
|
||||
} else if (action == ACT_SLIDE_KICK || action == ACT_SLIDE_KICK_SLIDE) {
|
||||
}
|
||||
else if (action == ACT_SLIDE_KICK || action == ACT_SLIDE_KICK_SLIDE)
|
||||
{
|
||||
interaction = INT_SLIDE_KICK;
|
||||
} else if (action & ACT_FLAG_RIDING_SHELL) {
|
||||
}
|
||||
else if (action & ACT_FLAG_RIDING_SHELL)
|
||||
{
|
||||
interaction = INT_FAST_ATTACK_OR_SHELL;
|
||||
} else if (m->forwardVel <= -26.0f || 26.0f <= m->forwardVel) {
|
||||
}
|
||||
else if (m->forwardVel <= -26.0f || 26.0f <= m->forwardVel)
|
||||
{
|
||||
interaction = INT_FAST_ATTACK_OR_SHELL;
|
||||
}
|
||||
}
|
||||
@@ -217,13 +244,19 @@ u32 determine_interaction(struct MarioState *m, struct Object *o) {
|
||||
// Prior to this, the interaction type could be overwritten. This requires, however,
|
||||
// that the interaction not be set prior. This specifically overrides turning a ground
|
||||
// pound into just a bounce.
|
||||
if (interaction == 0 && (action & ACT_FLAG_AIR)) {
|
||||
if (m->vel[1] < 0.0f) {
|
||||
if (m->pos[1] > o->oPosY) {
|
||||
if (interaction == 0 && (action & ACT_FLAG_AIR))
|
||||
{
|
||||
if (m->vel[1] < 0.0f)
|
||||
{
|
||||
if (m->pos[1] > o->oPosY)
|
||||
{
|
||||
interaction = INT_HIT_FROM_ABOVE;
|
||||
}
|
||||
} else {
|
||||
if (m->pos[1] < o->oPosY) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m->pos[1] < o->oPosY)
|
||||
{
|
||||
interaction = INT_HIT_FROM_BELOW;
|
||||
}
|
||||
}
|
||||
@@ -235,10 +268,12 @@ u32 determine_interaction(struct MarioState *m, struct Object *o) {
|
||||
/**
|
||||
* Sets the interaction types for INT_STATUS_INTERACTED, INT_STATUS_WAS_ATTACKED
|
||||
*/
|
||||
u32 attack_object(struct Object *o, s32 interaction) {
|
||||
u32 attack_object(struct Object *o, s32 interaction)
|
||||
{
|
||||
u32 attackType = 0;
|
||||
|
||||
switch (interaction) {
|
||||
switch (interaction)
|
||||
{
|
||||
case INT_GROUND_POUND_OR_TWIRL:
|
||||
attackType = ATTACK_GROUND_POUND_OR_TWIRL;
|
||||
break;
|
||||
@@ -265,23 +300,29 @@ u32 attack_object(struct Object *o, s32 interaction) {
|
||||
return attackType;
|
||||
}
|
||||
|
||||
void mario_stop_riding_object(struct MarioState *m) {
|
||||
if (m->riddenObj != NULL) {
|
||||
void mario_stop_riding_object(struct MarioState *m)
|
||||
{
|
||||
if (m->riddenObj != nullptr)
|
||||
{
|
||||
m->riddenObj->oInteractStatus = INT_STATUS_STOP_RIDING;
|
||||
stop_shell_music();
|
||||
m->riddenObj = NULL;
|
||||
m->riddenObj = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void mario_grab_used_object(struct MarioState *m) {
|
||||
if (m->heldObj == NULL) {
|
||||
void mario_grab_used_object(struct MarioState *m)
|
||||
{
|
||||
if (m->heldObj == nullptr)
|
||||
{
|
||||
m->heldObj = m->usedObj;
|
||||
// obj_set_held_state(m->heldObj, bhvCarrySomething3);
|
||||
}
|
||||
}
|
||||
|
||||
void mario_drop_held_object(struct MarioState *m) {
|
||||
if (m->heldObj != NULL) {
|
||||
void mario_drop_held_object(struct MarioState *m)
|
||||
{
|
||||
if (m->heldObj != nullptr)
|
||||
{
|
||||
// if (m->heldObj->behavior == segmented_to_virtual(bhvKoopaShellUnderwater)) {
|
||||
// stop_shell_music();
|
||||
// }
|
||||
@@ -297,12 +338,14 @@ void mario_drop_held_object(struct MarioState *m) {
|
||||
|
||||
m->heldObj->oMoveAngleYaw = m->faceAngle[1];
|
||||
|
||||
m->heldObj = NULL;
|
||||
m->heldObj = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void mario_throw_held_object(struct MarioState *m) {
|
||||
if (m->heldObj != NULL) {
|
||||
void mario_throw_held_object(struct MarioState *m)
|
||||
{
|
||||
if (m->heldObj != nullptr)
|
||||
{
|
||||
// if (m->heldObj->behavior == segmented_to_virtual(bhvKoopaShellUnderwater)) {
|
||||
// stop_shell_music();
|
||||
// }
|
||||
@@ -315,25 +358,29 @@ void mario_throw_held_object(struct MarioState *m) {
|
||||
|
||||
m->heldObj->oMoveAngleYaw = m->faceAngle[1];
|
||||
|
||||
m->heldObj = NULL;
|
||||
m->heldObj = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void mario_stop_riding_and_holding(struct MarioState *m) {
|
||||
void mario_stop_riding_and_holding(struct MarioState *m)
|
||||
{
|
||||
mario_drop_held_object(m);
|
||||
mario_stop_riding_object(m);
|
||||
|
||||
if (m->action == ACT_RIDING_HOOT) {
|
||||
if (m->action == ACT_RIDING_HOOT)
|
||||
{
|
||||
m->usedObj->oInteractStatus = 0;
|
||||
m->usedObj->oHootMarioReleaseTime = gGlobalTimer;
|
||||
}
|
||||
}
|
||||
|
||||
u32 does_mario_have_normal_cap_on_head(struct MarioState *m) {
|
||||
u32 does_mario_have_normal_cap_on_head(struct MarioState *m)
|
||||
{
|
||||
return (m->flags & (MARIO_CAPS | MARIO_CAP_ON_HEAD)) == (MARIO_NORMAL_CAP | MARIO_CAP_ON_HEAD);
|
||||
}
|
||||
|
||||
void mario_blow_off_cap(struct MarioState *m, f32 capSpeed) {
|
||||
void mario_blow_off_cap(struct MarioState *m, f32 capSpeed)
|
||||
{
|
||||
// struct Object *capObject;
|
||||
|
||||
// if (does_mario_have_normal_cap_on_head(m)) {
|
||||
@@ -353,10 +400,12 @@ void mario_blow_off_cap(struct MarioState *m, f32 capSpeed) {
|
||||
// }
|
||||
}
|
||||
|
||||
u32 mario_lose_cap_to_enemy(u32 arg) {
|
||||
u32 mario_lose_cap_to_enemy(u32 arg)
|
||||
{
|
||||
u32 wasWearingCap = FALSE;
|
||||
|
||||
if (does_mario_have_normal_cap_on_head(gMarioState)) {
|
||||
if (does_mario_have_normal_cap_on_head(gMarioState))
|
||||
{
|
||||
save_file_set_flags(arg == 1 ? SAVE_FLAG_CAP_ON_KLEPTO : SAVE_FLAG_CAP_ON_UKIKI);
|
||||
gMarioState->flags &= ~(MARIO_NORMAL_CAP | MARIO_CAP_ON_HEAD);
|
||||
wasWearingCap = TRUE;
|
||||
@@ -365,22 +414,29 @@ u32 mario_lose_cap_to_enemy(u32 arg) {
|
||||
return wasWearingCap;
|
||||
}
|
||||
|
||||
void mario_retrieve_cap(void) {
|
||||
void mario_retrieve_cap(void)
|
||||
{
|
||||
mario_drop_held_object(gMarioState);
|
||||
save_file_clear_flags(SAVE_FLAG_CAP_ON_KLEPTO | SAVE_FLAG_CAP_ON_UKIKI);
|
||||
gMarioState->flags &= ~MARIO_CAP_ON_HEAD;
|
||||
gMarioState->flags |= MARIO_NORMAL_CAP | MARIO_CAP_IN_HAND;
|
||||
}
|
||||
|
||||
u32 able_to_grab_object(struct MarioState *m, UNUSED struct Object *o) {
|
||||
u32 able_to_grab_object(struct MarioState *m, UNUSED struct Object *o)
|
||||
{
|
||||
u32 action = m->action;
|
||||
|
||||
if (action == ACT_DIVE_SLIDE || action == ACT_DIVE) {
|
||||
if (!(o->oInteractionSubtype & INT_SUBTYPE_GRABS_MARIO)) {
|
||||
if (action == ACT_DIVE_SLIDE || action == ACT_DIVE)
|
||||
{
|
||||
if (!(o->oInteractionSubtype & INT_SUBTYPE_GRABS_MARIO))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
} else if (action == ACT_PUNCHING || action == ACT_MOVE_PUNCHING) {
|
||||
if (m->actionArg < 2) {
|
||||
}
|
||||
else if (action == ACT_PUNCHING || action == ACT_MOVE_PUNCHING)
|
||||
{
|
||||
if (m->actionArg < 2)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -388,26 +444,31 @@ u32 able_to_grab_object(struct MarioState *m, UNUSED struct Object *o) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType) {
|
||||
struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType)
|
||||
{
|
||||
s32 i;
|
||||
struct Object *object;
|
||||
|
||||
for (i = 0; i < m->marioObj->numCollidedObjs; i++) {
|
||||
for (i = 0; i < m->marioObj->numCollidedObjs; i++)
|
||||
{
|
||||
object = m->marioObj->collidedObjs[i];
|
||||
|
||||
if (object->oInteractType == interactType) {
|
||||
if (object->oInteractType == interactType)
|
||||
{
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
u32 mario_check_object_grab(struct MarioState *m) {
|
||||
u32 mario_check_object_grab(struct MarioState *m)
|
||||
{
|
||||
u32 result = FALSE;
|
||||
// const BehaviorScript *script;
|
||||
|
||||
if (m->input & INPUT_INTERACT_OBJ_GRABBABLE) {
|
||||
if (m->input & INPUT_INTERACT_OBJ_GRABBABLE)
|
||||
{
|
||||
// script = virtual_to_segmented(0x13, m->interactObj->behavior);
|
||||
|
||||
// if (script == bhvBowser) {
|
||||
@@ -419,10 +480,12 @@ u32 mario_check_object_grab(struct MarioState *m) {
|
||||
// }
|
||||
// } else {
|
||||
s16 facingDYaw = mario_obj_angle_to_object(m, m->interactObj) - m->faceAngle[1];
|
||||
if (facingDYaw >= -0x2AAA && facingDYaw <= 0x2AAA) {
|
||||
if (facingDYaw >= -0x2AAA && facingDYaw <= 0x2AAA)
|
||||
{
|
||||
m->usedObj = m->interactObj;
|
||||
|
||||
if (!(m->action & ACT_FLAG_AIR)) {
|
||||
if (!(m->action & ACT_FLAG_AIR))
|
||||
{
|
||||
set_mario_action(
|
||||
m, (m->action & ACT_FLAG_DIVING) ? ACT_DIVE_PICKING_UP : ACT_PICKING_UP, 0);
|
||||
}
|
||||
@@ -435,7 +498,8 @@ u32 mario_check_object_grab(struct MarioState *m) {
|
||||
return result;
|
||||
}
|
||||
|
||||
u32 bully_knock_back_mario(struct MarioState *mario) {
|
||||
u32 bully_knock_back_mario(struct MarioState *mario)
|
||||
{
|
||||
struct BullyCollisionData marioData;
|
||||
struct BullyCollisionData bullyData;
|
||||
s16 newMarioYaw;
|
||||
@@ -458,9 +522,12 @@ u32 bully_knock_back_mario(struct MarioState *mario) {
|
||||
init_bully_collision_data(&bullyData, bully->oPosX, bully->oPosZ, bully->oForwardVel,
|
||||
bully->oMoveAngleYaw, marioToBullyRatio, bully->hitboxRadius + 2.0f);
|
||||
|
||||
if (mario->forwardVel != 0.0f) {
|
||||
if (mario->forwardVel != 0.0f)
|
||||
{
|
||||
transfer_bully_speed(&marioData, &bullyData);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
transfer_bully_speed(&bullyData, &marioData);
|
||||
}
|
||||
|
||||
@@ -480,19 +547,28 @@ u32 bully_knock_back_mario(struct MarioState *mario) {
|
||||
bully->oPosX = bullyData.posX;
|
||||
bully->oPosZ = bullyData.posZ;
|
||||
|
||||
if (marioDYaw < -0x4000 || marioDYaw > 0x4000) {
|
||||
if (marioDYaw < -0x4000 || marioDYaw > 0x4000)
|
||||
{
|
||||
mario->faceAngle[1] += 0x8000;
|
||||
mario->forwardVel *= -1.0f;
|
||||
|
||||
if (mario->action & ACT_FLAG_AIR) {
|
||||
if (mario->action & ACT_FLAG_AIR)
|
||||
{
|
||||
bonkAction = ACT_BACKWARD_AIR_KB;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
bonkAction = ACT_SOFT_BACKWARD_GROUND_KB;
|
||||
}
|
||||
} else {
|
||||
if (mario->action & ACT_FLAG_AIR) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mario->action & ACT_FLAG_AIR)
|
||||
{
|
||||
bonkAction = ACT_FORWARD_AIR_KB;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
bonkAction = ACT_SOFT_FORWARD_GROUND_KB;
|
||||
}
|
||||
}
|
||||
@@ -500,7 +576,8 @@ u32 bully_knock_back_mario(struct MarioState *mario) {
|
||||
return bonkAction;
|
||||
}
|
||||
|
||||
void bounce_off_object(struct MarioState *m, struct Object *o, f32 velY) {
|
||||
void bounce_off_object(struct MarioState *m, struct Object *o, f32 velY)
|
||||
{
|
||||
m->pos[1] = o->oPosY + o->hitboxHeight;
|
||||
m->vel[1] = velY;
|
||||
|
||||
@@ -509,7 +586,8 @@ void bounce_off_object(struct MarioState *m, struct Object *o, f32 velY) {
|
||||
play_sound(SOUND_ACTION_BOUNCE_OFF_OBJECT, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
void hit_object_from_below(struct MarioState *m, UNUSED struct Object *o) {
|
||||
void hit_object_from_below(struct MarioState *m, UNUSED struct Object *o)
|
||||
{
|
||||
m->vel[1] = 0.0f;
|
||||
set_camera_shake_from_hit(SHAKE_HIT_FROM_BELOW);
|
||||
}
|
||||
@@ -544,7 +622,8 @@ void hit_object_from_below(struct MarioState *m, UNUSED struct Object *o) {
|
||||
// return bonkAction;
|
||||
// }
|
||||
|
||||
u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) {
|
||||
u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg)
|
||||
{
|
||||
u32 bonkAction;
|
||||
|
||||
s16 terrainIndex = 0; // 1 = air, 2 = water, 0 = default
|
||||
@@ -554,46 +633,67 @@ u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) {
|
||||
s16 facingDYaw = angleToObject - m->faceAngle[1];
|
||||
s16 remainingHealth = m->health - 0x40 * m->hurtCounter;
|
||||
|
||||
if (m->action & (ACT_FLAG_SWIMMING | ACT_FLAG_METAL_WATER)) {
|
||||
if (m->action & (ACT_FLAG_SWIMMING | ACT_FLAG_METAL_WATER))
|
||||
{
|
||||
terrainIndex = 2;
|
||||
} else if (m->action & (ACT_FLAG_AIR | ACT_FLAG_ON_POLE | ACT_FLAG_HANGING)) {
|
||||
}
|
||||
else if (m->action & (ACT_FLAG_AIR | ACT_FLAG_ON_POLE | ACT_FLAG_HANGING))
|
||||
{
|
||||
terrainIndex = 1;
|
||||
}
|
||||
|
||||
if (remainingHealth < 0x100) {
|
||||
if (remainingHealth < 0x100)
|
||||
{
|
||||
strengthIndex = 2;
|
||||
} else if (m->interactObj->oDamageOrCoinValue >= 4) {
|
||||
}
|
||||
else if (m->interactObj->oDamageOrCoinValue >= 4)
|
||||
{
|
||||
strengthIndex = 2;
|
||||
} else if (m->interactObj->oDamageOrCoinValue >= 2) {
|
||||
}
|
||||
else if (m->interactObj->oDamageOrCoinValue >= 2)
|
||||
{
|
||||
strengthIndex = 1;
|
||||
}
|
||||
|
||||
m->faceAngle[1] = angleToObject;
|
||||
|
||||
if (terrainIndex == 2) {
|
||||
if (m->forwardVel < 28.0f) {
|
||||
if (terrainIndex == 2)
|
||||
{
|
||||
if (m->forwardVel < 28.0f)
|
||||
{
|
||||
mario_set_forward_vel(m, 28.0f);
|
||||
}
|
||||
|
||||
if (m->pos[1] >= m->interactObj->oPosY) {
|
||||
if (m->vel[1] < 20.0f) {
|
||||
if (m->pos[1] >= m->interactObj->oPosY)
|
||||
{
|
||||
if (m->vel[1] < 20.0f)
|
||||
{
|
||||
m->vel[1] = 20.0f;
|
||||
}
|
||||
} else {
|
||||
if (m->vel[1] > 0.0f) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m->vel[1] > 0.0f)
|
||||
{
|
||||
m->vel[1] = 0.0f;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (m->forwardVel < 16.0f) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m->forwardVel < 16.0f)
|
||||
{
|
||||
mario_set_forward_vel(m, 16.0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (-0x4000 <= facingDYaw && facingDYaw <= 0x4000) {
|
||||
if (-0x4000 <= facingDYaw && facingDYaw <= 0x4000)
|
||||
{
|
||||
m->forwardVel *= -1.0f;
|
||||
bonkAction = sBackwardKnockbackActions[terrainIndex][strengthIndex];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
m->faceAngle[1] += 0x8000;
|
||||
bonkAction = sForwardKnockbackActions[terrainIndex][strengthIndex];
|
||||
}
|
||||
@@ -601,22 +701,27 @@ u32 determine_knockback_action(struct MarioState *m, UNUSED s32 arg) {
|
||||
return bonkAction;
|
||||
}
|
||||
|
||||
void push_mario_out_of_object(struct MarioState *m, struct Object *o, f32 padding) {
|
||||
void push_mario_out_of_object(struct MarioState *m, struct Object *o, f32 padding)
|
||||
{
|
||||
f32 minDistance = o->hitboxRadius + m->marioObj->hitboxRadius + padding;
|
||||
|
||||
f32 offsetX = m->pos[0] - o->oPosX;
|
||||
f32 offsetZ = m->pos[2] - o->oPosZ;
|
||||
f32 distance = sqrtf(offsetX * offsetX + offsetZ * offsetZ);
|
||||
|
||||
if (distance < minDistance) {
|
||||
if (distance < minDistance)
|
||||
{
|
||||
struct SM64SurfaceCollisionData *floor;
|
||||
s16 pushAngle;
|
||||
f32 newMarioX;
|
||||
f32 newMarioZ;
|
||||
|
||||
if (distance == 0.0f) {
|
||||
if (distance == 0.0f)
|
||||
{
|
||||
pushAngle = m->faceAngle[1];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
pushAngle = atan2s(offsetZ, offsetX);
|
||||
}
|
||||
|
||||
@@ -626,7 +731,8 @@ void push_mario_out_of_object(struct MarioState *m, struct Object *o, f32 paddin
|
||||
f32_find_wall_collision(&newMarioX, &m->pos[1], &newMarioZ, 60.0f, 50.0f);
|
||||
|
||||
find_floor(newMarioX, m->pos[1], newMarioZ, &floor);
|
||||
if (floor != NULL) {
|
||||
if (floor != nullptr)
|
||||
{
|
||||
//! Doesn't update Mario's referenced floor (allows oob death when
|
||||
// an object pushes you into a steep slope while in a ground action)
|
||||
m->pos[0] = newMarioX;
|
||||
@@ -635,15 +741,21 @@ void push_mario_out_of_object(struct MarioState *m, struct Object *o, f32 paddin
|
||||
}
|
||||
}
|
||||
|
||||
void bounce_back_from_attack(struct MarioState *m, u32 interaction) {
|
||||
if (interaction & (INT_PUNCH | INT_KICK | INT_TRIP)) {
|
||||
if (m->action == ACT_PUNCHING) {
|
||||
void bounce_back_from_attack(struct MarioState *m, u32 interaction)
|
||||
{
|
||||
if (interaction & (INT_PUNCH | INT_KICK | INT_TRIP))
|
||||
{
|
||||
if (m->action == ACT_PUNCHING)
|
||||
{
|
||||
m->action = ACT_MOVE_PUNCHING;
|
||||
}
|
||||
|
||||
if (m->action & ACT_FLAG_AIR) {
|
||||
if (m->action & ACT_FLAG_AIR)
|
||||
{
|
||||
mario_set_forward_vel(m, -16.0f);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
mario_set_forward_vel(m, -48.0f);
|
||||
}
|
||||
|
||||
@@ -651,12 +763,14 @@ void bounce_back_from_attack(struct MarioState *m, u32 interaction) {
|
||||
m->particleFlags |= PARTICLE_TRIANGLE;
|
||||
}
|
||||
|
||||
if (interaction & (INT_PUNCH | INT_KICK | INT_TRIP | INT_FAST_ATTACK_OR_SHELL)) {
|
||||
if (interaction & (INT_PUNCH | INT_KICK | INT_TRIP | INT_FAST_ATTACK_OR_SHELL))
|
||||
{
|
||||
play_sound(SOUND_ACTION_HIT_2, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
}
|
||||
|
||||
u32 should_push_or_pull_door(struct MarioState *m, struct Object *o) {
|
||||
u32 should_push_or_pull_door(struct MarioState *m, struct Object *o)
|
||||
{
|
||||
f32 dx = o->oPosX - m->pos[0];
|
||||
f32 dz = o->oPosZ - m->pos[2];
|
||||
|
||||
@@ -665,7 +779,8 @@ u32 should_push_or_pull_door(struct MarioState *m, struct Object *o) {
|
||||
return (dYaw >= -0x4000 && dYaw <= 0x4000) ? 0x00000001 : 0x00000002;
|
||||
}
|
||||
|
||||
u32 take_damage_from_interact_object(struct MarioState *m) {
|
||||
u32 take_damage_from_interact_object(struct MarioState *m)
|
||||
{
|
||||
// s32 shake;
|
||||
s32 damage = m->interactObj->oDamageOrCoinValue;
|
||||
|
||||
@@ -677,11 +792,13 @@ u32 take_damage_from_interact_object(struct MarioState *m) {
|
||||
// shake = SHAKE_SMALL_DAMAGE;
|
||||
// }
|
||||
|
||||
if (!(m->flags & MARIO_CAP_ON_HEAD)) {
|
||||
if (!(m->flags & MARIO_CAP_ON_HEAD))
|
||||
{
|
||||
damage += (damage + 1) / 2;
|
||||
}
|
||||
|
||||
if (m->flags & MARIO_METAL_CAP) {
|
||||
if (m->flags & MARIO_METAL_CAP)
|
||||
{
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
@@ -695,21 +812,25 @@ u32 take_damage_from_interact_object(struct MarioState *m) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o) {
|
||||
u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o)
|
||||
{
|
||||
u32 damage;
|
||||
|
||||
if (!sInvulnerable && !(m->flags & MARIO_VANISH_CAP)
|
||||
&& !(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY)) {
|
||||
&& !(o->oInteractionSubtype & INT_SUBTYPE_DELAY_INVINCIBILITY))
|
||||
{
|
||||
o->oInteractStatus = INT_STATUS_INTERACTED | INT_STATUS_ATTACKED_MARIO;
|
||||
m->interactObj = o;
|
||||
|
||||
damage = take_damage_from_interact_object(m);
|
||||
|
||||
if (o->oInteractionSubtype & INT_SUBTYPE_BIG_KNOCKBACK) {
|
||||
if (o->oInteractionSubtype & INT_SUBTYPE_BIG_KNOCKBACK)
|
||||
{
|
||||
m->forwardVel = 40.0f;
|
||||
}
|
||||
|
||||
if (o->oDamageOrCoinValue > 0) {
|
||||
if (o->oDamageOrCoinValue > 0)
|
||||
{
|
||||
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
@@ -721,18 +842,23 @@ u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void reset_mario_pitch(struct MarioState *m) {
|
||||
if (m->action == ACT_WATER_JUMP || m->action == ACT_SHOT_FROM_CANNON || m->action == ACT_FLYING) {
|
||||
void reset_mario_pitch(struct MarioState *m)
|
||||
{
|
||||
if (m->action == ACT_WATER_JUMP || m->action == ACT_SHOT_FROM_CANNON || m->action == ACT_FLYING)
|
||||
{
|
||||
set_camera_mode(m->area->camera, m->area->camera->defMode, 1);
|
||||
m->faceAngle[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
u32 check_object_grab_mario(struct MarioState *m, UNUSED u32 interactType, struct Object *o) {
|
||||
u32 check_object_grab_mario(struct MarioState *m, UNUSED u32 interactType, struct Object *o)
|
||||
{
|
||||
if ((!(m->action & (ACT_FLAG_AIR | ACT_FLAG_INVULNERABLE | ACT_FLAG_ATTACKING)) || !sInvulnerable)
|
||||
&& (o->oInteractionSubtype & INT_SUBTYPE_GRABS_MARIO)) {
|
||||
if (object_facing_mario(m, o, 0x2AAA)) {
|
||||
&& (o->oInteractionSubtype & INT_SUBTYPE_GRABS_MARIO))
|
||||
{
|
||||
if (object_facing_mario(m, o, 0x2AAA))
|
||||
{
|
||||
mario_stop_riding_and_holding(m);
|
||||
o->oInteractStatus = INT_STATUS_INTERACTED | INT_STATUS_GRABBED_MARIO;
|
||||
|
||||
@@ -754,21 +880,26 @@ u32 check_object_grab_mario(struct MarioState *m, UNUSED u32 interactType, struc
|
||||
}
|
||||
|
||||
|
||||
u32 mario_can_talk(struct MarioState *m, u32 arg) {
|
||||
u32 mario_can_talk(struct MarioState *m, u32 arg)
|
||||
{
|
||||
s16 val6;
|
||||
|
||||
if ((m->action & ACT_FLAG_IDLE) != 0x00000000) {
|
||||
if ((m->action & ACT_FLAG_IDLE) != 0x00000000)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (m->action == ACT_WALKING) {
|
||||
if (arg) {
|
||||
if (m->action == ACT_WALKING)
|
||||
{
|
||||
if (arg)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
val6 = m->marioObj->header.gfx.animInfo.animID;
|
||||
|
||||
if (val6 == 0x0080 || val6 == 0x007F || val6 == 0x006C) {
|
||||
if (val6 == 0x0080 || val6 == 0x007F || val6 == 0x006C)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -788,10 +919,13 @@ u32 mario_can_talk(struct MarioState *m, u32 arg) {
|
||||
#define SIGN_RANGE 0x4000
|
||||
#endif
|
||||
|
||||
u32 check_read_sign(struct MarioState *m, struct Object *o) {
|
||||
if ((m->input & READ_MASK) && mario_can_talk(m, 0) && object_facing_mario(m, o, SIGN_RANGE)) {
|
||||
u32 check_read_sign(struct MarioState *m, struct Object *o)
|
||||
{
|
||||
if ((m->input & READ_MASK) && mario_can_talk(m, 0) && object_facing_mario(m, o, SIGN_RANGE))
|
||||
{
|
||||
s16 facingDYaw = (s16)(o->oMoveAngleYaw + 0x8000) - m->faceAngle[1];
|
||||
if (facingDYaw >= -SIGN_RANGE && facingDYaw <= SIGN_RANGE) {
|
||||
if (facingDYaw >= -SIGN_RANGE && facingDYaw <= SIGN_RANGE)
|
||||
{
|
||||
f32 targetX = o->oPosX + 105.0f * sins(o->oMoveAngleYaw);
|
||||
f32 targetZ = o->oPosZ + 105.0f * coss(o->oMoveAngleYaw);
|
||||
|
||||
@@ -808,10 +942,13 @@ u32 check_read_sign(struct MarioState *m, struct Object *o) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u32 check_npc_talk(struct MarioState *m, struct Object *o) {
|
||||
if ((m->input & READ_MASK) && mario_can_talk(m, 1)) {
|
||||
u32 check_npc_talk(struct MarioState *m, struct Object *o)
|
||||
{
|
||||
if ((m->input & READ_MASK) && mario_can_talk(m, 1))
|
||||
{
|
||||
s16 facingDYaw = mario_obj_angle_to_object(m, o) - m->faceAngle[1];
|
||||
if (facingDYaw >= -0x4000 && facingDYaw <= 0x4000) {
|
||||
if (facingDYaw >= -0x4000 && facingDYaw <= 0x4000)
|
||||
{
|
||||
o->oInteractStatus = INT_STATUS_INTERACTED;
|
||||
|
||||
m->interactObj = o;
|
||||
@@ -826,23 +963,30 @@ u32 check_npc_talk(struct MarioState *m, struct Object *o) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void check_kick_or_punch_wall(struct MarioState *m) {
|
||||
if (m->flags & (MARIO_PUNCHING | MARIO_KICKING | MARIO_TRIPPING)) {
|
||||
void check_kick_or_punch_wall(struct MarioState *m)
|
||||
{
|
||||
if (m->flags & (MARIO_PUNCHING | MARIO_KICKING | MARIO_TRIPPING))
|
||||
{
|
||||
Vec3f detector;
|
||||
detector[0] = m->pos[0] + 50.0f * sins(m->faceAngle[1]);
|
||||
detector[2] = m->pos[2] + 50.0f * coss(m->faceAngle[1]);
|
||||
detector[1] = m->pos[1];
|
||||
|
||||
if (resolve_and_return_wall_collisions(detector, 80.0f, 5.0f) != NULL) {
|
||||
if (m->action != ACT_MOVE_PUNCHING || m->forwardVel >= 0.0f) {
|
||||
if (m->action == ACT_PUNCHING) {
|
||||
if (resolve_and_return_wall_collisions(detector, 80.0f, 5.0f) != nullptr)
|
||||
{
|
||||
if (m->action != ACT_MOVE_PUNCHING || m->forwardVel >= 0.0f)
|
||||
{
|
||||
if (m->action == ACT_PUNCHING)
|
||||
{
|
||||
m->action = ACT_MOVE_PUNCHING;
|
||||
}
|
||||
|
||||
mario_set_forward_vel(m, -48.0f);
|
||||
play_sound(SOUND_ACTION_HIT_2, m->marioObj->header.gfx.cameraToObject);
|
||||
m->particleFlags |= PARTICLE_TRIANGLE;
|
||||
} else if (m->action & ACT_FLAG_AIR) {
|
||||
}
|
||||
else if (m->action & ACT_FLAG_AIR)
|
||||
{
|
||||
mario_set_forward_vel(m, -16.0f);
|
||||
play_sound(SOUND_ACTION_HIT_2, m->marioObj->header.gfx.cameraToObject);
|
||||
m->particleFlags |= PARTICLE_TRIANGLE;
|
||||
@@ -851,21 +995,27 @@ void check_kick_or_punch_wall(struct MarioState *m) {
|
||||
}
|
||||
}
|
||||
|
||||
void mario_process_interactions(struct MarioState *m) {
|
||||
void mario_process_interactions(struct MarioState *m)
|
||||
{
|
||||
sDelayInvincTimer = FALSE;
|
||||
sInvulnerable = (m->action & ACT_FLAG_INVULNERABLE) || m->invincTimer != 0;
|
||||
|
||||
if (!(m->action & ACT_FLAG_INTANGIBLE) && m->collidedObjInteractTypes != 0) {
|
||||
if (!(m->action & ACT_FLAG_INTANGIBLE) && m->collidedObjInteractTypes != 0)
|
||||
{
|
||||
s32 i;
|
||||
for (i = 0; i < 31; i++) {
|
||||
for (i = 0; i < 31; i++)
|
||||
{
|
||||
u32 interactType = sInteractionHandlers[i].interactType;
|
||||
if (m->collidedObjInteractTypes & interactType) {
|
||||
if (m->collidedObjInteractTypes & interactType)
|
||||
{
|
||||
struct Object *object = mario_get_collided_object(m, interactType);
|
||||
|
||||
m->collidedObjInteractTypes &= ~interactType;
|
||||
|
||||
if (!(object->oInteractStatus & INT_STATUS_INTERACTED)) {
|
||||
if (sInteractionHandlers[i].handler(m, interactType, object)) {
|
||||
if (!(object->oInteractStatus & INT_STATUS_INTERACTED))
|
||||
{
|
||||
if (sInteractionHandlers[i].handler(m, interactType, object))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -873,7 +1023,8 @@ void mario_process_interactions(struct MarioState *m) {
|
||||
}
|
||||
}
|
||||
|
||||
if (m->invincTimer > 0 && !sDelayInvincTimer) {
|
||||
if (m->invincTimer > 0 && !sDelayInvincTimer)
|
||||
{
|
||||
m->invincTimer -= 1;
|
||||
}
|
||||
|
||||
@@ -882,25 +1033,33 @@ void mario_process_interactions(struct MarioState *m) {
|
||||
check_kick_or_punch_wall(m);
|
||||
m->flags &= ~MARIO_PUNCHING & ~MARIO_KICKING & ~MARIO_TRIPPING;
|
||||
|
||||
if (!(m->marioObj->collidedObjInteractTypes & (INTERACT_WARP_DOOR | INTERACT_DOOR))) {
|
||||
if (!(m->marioObj->collidedObjInteractTypes & (INTERACT_WARP_DOOR | INTERACT_DOOR)))
|
||||
{
|
||||
sDisplayingDoorText = FALSE;
|
||||
}
|
||||
if (!(m->marioObj->collidedObjInteractTypes & INTERACT_WARP)) {
|
||||
if (!(m->marioObj->collidedObjInteractTypes & INTERACT_WARP))
|
||||
{
|
||||
sJustTeleported = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void check_death_barrier(struct MarioState *m) {
|
||||
if (m->pos[1] < m->floorHeight + 2048.0f) {
|
||||
if (level_trigger_warp(m, WARP_OP_WARP_FLOOR) == 20 && !(m->flags & MARIO_UNKNOWN_18)) {
|
||||
void check_death_barrier(struct MarioState *m)
|
||||
{
|
||||
if (m->pos[1] < m->floorHeight + 2048.0f)
|
||||
{
|
||||
if (level_trigger_warp(m, WARP_OP_WARP_FLOOR) == 20 && !(m->flags & MARIO_UNKNOWN_18))
|
||||
{
|
||||
play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void check_lava_boost(struct MarioState *m) {
|
||||
if (!(m->action & ACT_FLAG_RIDING_SHELL) && m->pos[1] < m->floorHeight + 10.0f) {
|
||||
if (!(m->flags & MARIO_METAL_CAP)) {
|
||||
void check_lava_boost(struct MarioState *m)
|
||||
{
|
||||
if (!(m->action & ACT_FLAG_RIDING_SHELL) && m->pos[1] < m->floorHeight + 10.0f)
|
||||
{
|
||||
if (!(m->flags & MARIO_METAL_CAP))
|
||||
{
|
||||
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 12 : 18;
|
||||
}
|
||||
|
||||
@@ -909,7 +1068,8 @@ void check_lava_boost(struct MarioState *m) {
|
||||
}
|
||||
}
|
||||
|
||||
void pss_begin_slide(UNUSED struct MarioState *m) {
|
||||
void pss_begin_slide(UNUSEDstruct MarioState * m)
|
||||
{
|
||||
// if (!(gHudDisplay.flags & HUD_DISPLAY_FLAG_TIMER)) {
|
||||
// level_control_timer(TIMER_CONTROL_SHOW);
|
||||
// level_control_timer(TIMER_CONTROL_START);
|
||||
@@ -917,11 +1077,14 @@ void pss_begin_slide(UNUSED struct MarioState *m) {
|
||||
// }
|
||||
}
|
||||
|
||||
void pss_end_slide(struct MarioState *m) {
|
||||
void pss_end_slide(struct MarioState *m)
|
||||
{
|
||||
//! This flag isn't set on death or level entry, allowing double star spawn
|
||||
if (sPssSlideStarted) {
|
||||
if (sPssSlideStarted)
|
||||
{
|
||||
u16 slideTime = level_control_timer(TIMER_CONTROL_STOP);
|
||||
if (slideTime < 630) {
|
||||
if (slideTime < 630)
|
||||
{
|
||||
m->marioObj->oBehParams = (1 << 24);
|
||||
spawn_default_star(-6358.0f, -4300.0f, 4700.0f);
|
||||
}
|
||||
@@ -929,15 +1092,19 @@ void pss_end_slide(struct MarioState *m) {
|
||||
}
|
||||
}
|
||||
|
||||
void mario_handle_special_floors(struct MarioState *m) {
|
||||
if ((m->action & ACT_GROUP_MASK) == ACT_GROUP_CUTSCENE) {
|
||||
void mario_handle_special_floors(struct MarioState *m)
|
||||
{
|
||||
if ((m->action & ACT_GROUP_MASK) == ACT_GROUP_CUTSCENE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m->floor != NULL) {
|
||||
if (m->floor != nullptr)
|
||||
{
|
||||
s32 floorType = m->floor->type;
|
||||
|
||||
switch (floorType) {
|
||||
switch (floorType)
|
||||
{
|
||||
case SURFACE_DEATH_PLANE:
|
||||
case SURFACE_VERTICAL_WIND:
|
||||
check_death_barrier(m);
|
||||
@@ -956,8 +1123,10 @@ void mario_handle_special_floors(struct MarioState *m) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(m->action & ACT_FLAG_AIR) && !(m->action & ACT_FLAG_SWIMMING)) {
|
||||
switch (floorType) {
|
||||
if (!(m->action & ACT_FLAG_AIR) && !(m->action & ACT_FLAG_SWIMMING))
|
||||
{
|
||||
switch (floorType)
|
||||
{
|
||||
case SURFACE_BURNING:
|
||||
check_lava_boost(m);
|
||||
break;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -89,20 +89,29 @@
|
||||
// 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);
|
||||
|
||||
+609
-287
File diff suppressed because it is too large
Load Diff
@@ -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(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
@@ -31,7 +31,8 @@ static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f };
|
||||
#define HANG_HIT_CEIL_OR_OOB 1
|
||||
#define HANG_LEFT_CEIL 2
|
||||
|
||||
void add_tree_leaf_particles(struct MarioState *m) {
|
||||
void add_tree_leaf_particles(struct MarioState *m)
|
||||
{
|
||||
// f32 leafHeight;
|
||||
|
||||
// if (m->usedObj->behavior == segmented_to_virtual(bhvTree)) {
|
||||
@@ -47,7 +48,8 @@ void add_tree_leaf_particles(struct MarioState *m) {
|
||||
// }
|
||||
}
|
||||
|
||||
void play_climbing_sounds(struct MarioState *m, s32 b) {
|
||||
void play_climbing_sounds(struct MarioState *m, s32 b)
|
||||
{
|
||||
// s32 isOnTree = (m->usedObj->behavior == segmented_to_virtual(bhvTree));
|
||||
|
||||
// if (b == 1) {
|
||||
@@ -61,7 +63,8 @@ void play_climbing_sounds(struct MarioState *m, s32 b) {
|
||||
// }
|
||||
}
|
||||
|
||||
s32 set_pole_position(struct MarioState *m, f32 offsetY) {
|
||||
s32 set_pole_position(struct MarioState *m, f32 offsetY)
|
||||
{
|
||||
UNUSED s32 unused1;
|
||||
UNUSED s32 unused2;
|
||||
UNUSED s32 unused3;
|
||||
@@ -74,7 +77,8 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY) {
|
||||
f32 poleTop = m->usedObj->hitboxHeight - 100.0f;
|
||||
struct Object *marioObj = m->marioObj;
|
||||
|
||||
if (marioObj->oMarioPolePos > poleTop) {
|
||||
if (marioObj->oMarioPolePos > poleTop)
|
||||
{
|
||||
marioObj->oMarioPolePos = poleTop;
|
||||
}
|
||||
|
||||
@@ -86,26 +90,35 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY) {
|
||||
collided |= f32_find_wall_collision(&m->pos[0], &m->pos[1], &m->pos[2], 30.0f, 24.0f);
|
||||
|
||||
ceilHeight = vec3f_find_ceil(m->pos, m->pos[1], &ceil);
|
||||
if (m->pos[1] > ceilHeight - 160.0f) {
|
||||
if (m->pos[1] > ceilHeight - 160.0f)
|
||||
{
|
||||
m->pos[1] = ceilHeight - 160.0f;
|
||||
marioObj->oMarioPolePos = m->pos[1] - m->usedObj->oPosY;
|
||||
}
|
||||
|
||||
floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
|
||||
if (m->pos[1] < floorHeight) {
|
||||
if (m->pos[1] < floorHeight)
|
||||
{
|
||||
m->pos[1] = floorHeight;
|
||||
set_mario_action(m, ACT_IDLE, 0);
|
||||
result = POLE_TOUCHED_FLOOR;
|
||||
} else if (marioObj->oMarioPolePos < -m->usedObj->hitboxDownOffset) {
|
||||
}
|
||||
else if (marioObj->oMarioPolePos < -m->usedObj->hitboxDownOffset)
|
||||
{
|
||||
m->pos[1] = m->usedObj->oPosY - m->usedObj->hitboxDownOffset;
|
||||
set_mario_action(m, ACT_FREEFALL, 0);
|
||||
result = POLE_FELL_OFF;
|
||||
} else if (collided) {
|
||||
if (m->pos[1] > floorHeight + 20.0f) {
|
||||
}
|
||||
else if (collided)
|
||||
{
|
||||
if (m->pos[1] > floorHeight + 20.0f)
|
||||
{
|
||||
m->forwardVel = -2.0f;
|
||||
set_mario_action(m, ACT_SOFT_BONK, 0);
|
||||
result = POLE_FELL_OFF;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
set_mario_action(m, ACT_IDLE, 0);
|
||||
result = POLE_TOUCHED_FLOOR;
|
||||
}
|
||||
@@ -118,52 +131,62 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY) {
|
||||
return result;
|
||||
}
|
||||
|
||||
s32 act_holding_pole(struct MarioState *m) {
|
||||
s32 act_holding_pole(struct MarioState *m)
|
||||
{
|
||||
struct Object *marioObj = m->marioObj;
|
||||
|
||||
#ifdef VERSION_JP
|
||||
if (m->input & INPUT_A_PRESSED) {
|
||||
if (m->input & INPUT_A_PRESSED)
|
||||
{
|
||||
add_tree_leaf_particles(m);
|
||||
m->faceAngle[1] += 0x8000;
|
||||
return set_mario_action(m, ACT_WALL_KICK_AIR, 0);
|
||||
}
|
||||
|
||||
if (m->input & INPUT_Z_PRESSED) {
|
||||
if (m->input & INPUT_Z_PRESSED)
|
||||
{
|
||||
add_tree_leaf_particles(m);
|
||||
m->forwardVel = -2.0f;
|
||||
return set_mario_action(m, ACT_SOFT_BONK, 0);
|
||||
}
|
||||
#else
|
||||
if ((m->input & INPUT_Z_PRESSED) || m->health < 0x100) {
|
||||
if ((m->input & INPUT_Z_PRESSED) || m->health < 0x100)
|
||||
{
|
||||
add_tree_leaf_particles(m);
|
||||
m->forwardVel = -2.0f;
|
||||
return set_mario_action(m, ACT_SOFT_BONK, 0);
|
||||
}
|
||||
|
||||
if (m->input & INPUT_A_PRESSED) {
|
||||
if (m->input & INPUT_A_PRESSED)
|
||||
{
|
||||
add_tree_leaf_particles(m);
|
||||
m->faceAngle[1] += 0x8000;
|
||||
return set_mario_action(m, ACT_WALL_KICK_AIR, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m->controller->stickY > 16.0f) {
|
||||
if (m->controller->stickY > 16.0f)
|
||||
{
|
||||
f32 poleTop = m->usedObj->hitboxHeight - 100.0f;
|
||||
// const BehaviorScript *poleBehavior = virtual_to_segmented(0x13, m->usedObj->behavior);
|
||||
|
||||
if (marioObj->oMarioPolePos < poleTop - 0.4f) {
|
||||
if (marioObj->oMarioPolePos < poleTop - 0.4f)
|
||||
{
|
||||
return set_mario_action(m, ACT_CLIMBING_POLE, 0);
|
||||
}
|
||||
|
||||
// if (poleBehavior != bhvGiantPole && m->controller->stickY > 50.0f) {
|
||||
if (m->controller->stickY > 50.0f) {
|
||||
if (m->controller->stickY > 50.0f)
|
||||
{
|
||||
return set_mario_action(m, ACT_TOP_OF_POLE_TRANSITION, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (m->controller->stickY < -16.0f) {
|
||||
if (m->controller->stickY < -16.0f)
|
||||
{
|
||||
marioObj->oMarioPoleYawVel -= m->controller->stickY * 2;
|
||||
if (marioObj->oMarioPoleYawVel > 0x1000) {
|
||||
if (marioObj->oMarioPoleYawVel > 0x1000)
|
||||
{
|
||||
marioObj->oMarioPoleYawVel = 0x1000;
|
||||
}
|
||||
|
||||
@@ -182,38 +205,45 @@ s32 act_holding_pole(struct MarioState *m) {
|
||||
reset_rumble_timers();
|
||||
#endif
|
||||
func_80320A4C(1, marioObj->oMarioPoleYawVel / 0x100 * 2);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
marioObj->oMarioPoleYawVel = 0;
|
||||
m->faceAngle[1] -= m->controller->stickX * 16.0f;
|
||||
}
|
||||
|
||||
if (set_pole_position(m, 0.0f) == POLE_NONE) {
|
||||
if (set_pole_position(m, 0.0f) == POLE_NONE)
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_IDLE_ON_POLE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_climbing_pole(struct MarioState *m) {
|
||||
s32 act_climbing_pole(struct MarioState *m)
|
||||
{
|
||||
s32 sp24;
|
||||
struct Object *marioObj = m->marioObj;
|
||||
s16 cameraAngle = m->area->camera->yaw;
|
||||
|
||||
#ifndef VERSION_JP
|
||||
if (m->health < 0x100) {
|
||||
if (m->health < 0x100)
|
||||
{
|
||||
add_tree_leaf_particles(m);
|
||||
m->forwardVel = -2.0f;
|
||||
return set_mario_action(m, ACT_SOFT_BONK, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m->input & INPUT_A_PRESSED) {
|
||||
if (m->input & INPUT_A_PRESSED)
|
||||
{
|
||||
add_tree_leaf_particles(m);
|
||||
m->faceAngle[1] += 0x8000;
|
||||
return set_mario_action(m, ACT_WALL_KICK_AIR, 0);
|
||||
}
|
||||
|
||||
if (m->controller->stickY < 8.0f) {
|
||||
if (m->controller->stickY < 8.0f)
|
||||
{
|
||||
return set_mario_action(m, ACT_HOLDING_POLE, 0);
|
||||
}
|
||||
|
||||
@@ -221,7 +251,8 @@ s32 act_climbing_pole(struct MarioState *m) {
|
||||
marioObj->oMarioPoleYawVel = 0;
|
||||
m->faceAngle[1] = cameraAngle - approach_s32((s16)(cameraAngle - m->faceAngle[1]), 0, 0x400, 0x400);
|
||||
|
||||
if (set_pole_position(m, 0.0f) == POLE_NONE) {
|
||||
if (set_pole_position(m, 0.0f) == POLE_NONE)
|
||||
{
|
||||
sp24 = m->controller->stickY / 4.0f * 0x10000;
|
||||
set_mario_anim_with_accel(m, MARIO_ANIM_CLIMB_UP_POLE, sp24);
|
||||
add_tree_leaf_particles(m);
|
||||
@@ -231,12 +262,15 @@ s32 act_climbing_pole(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_grab_pole_slow(struct MarioState *m) {
|
||||
s32 act_grab_pole_slow(struct MarioState *m)
|
||||
{
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_WHOA, MARIO_MARIO_SOUND_PLAYED);
|
||||
|
||||
if (set_pole_position(m, 0.0f) == POLE_NONE) {
|
||||
if (set_pole_position(m, 0.0f) == POLE_NONE)
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_GRAB_POLE_SHORT);
|
||||
if (is_anim_at_end(m)) {
|
||||
if (is_anim_at_end(m))
|
||||
{
|
||||
set_mario_action(m, ACT_HOLDING_POLE, 0);
|
||||
}
|
||||
add_tree_leaf_particles(m);
|
||||
@@ -245,19 +279,25 @@ s32 act_grab_pole_slow(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_grab_pole_fast(struct MarioState *m) {
|
||||
s32 act_grab_pole_fast(struct MarioState *m)
|
||||
{
|
||||
struct Object *marioObj = m->marioObj;
|
||||
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_WHOA, MARIO_MARIO_SOUND_PLAYED);
|
||||
m->faceAngle[1] += marioObj->oMarioPoleYawVel;
|
||||
marioObj->oMarioPoleYawVel = marioObj->oMarioPoleYawVel * 8 / 10;
|
||||
|
||||
if (set_pole_position(m, 0.0f) == POLE_NONE) {
|
||||
if (marioObj->oMarioPoleYawVel > 0x800) {
|
||||
if (set_pole_position(m, 0.0f) == POLE_NONE)
|
||||
{
|
||||
if (marioObj->oMarioPoleYawVel > 0x800)
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_GRAB_POLE_SWING_PART1);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_GRAB_POLE_SWING_PART2);
|
||||
if (is_anim_at_end(m)) {
|
||||
if (is_anim_at_end(m))
|
||||
{
|
||||
marioObj->oMarioPoleYawVel = 0;
|
||||
set_mario_action(m, ACT_HOLDING_POLE, 0);
|
||||
}
|
||||
@@ -268,18 +308,24 @@ s32 act_grab_pole_fast(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_top_of_pole_transition(struct MarioState *m) {
|
||||
s32 act_top_of_pole_transition(struct MarioState *m)
|
||||
{
|
||||
struct Object *marioObj = m->marioObj;
|
||||
|
||||
marioObj->oMarioPoleYawVel = 0;
|
||||
if (m->actionArg == 0) {
|
||||
if (m->actionArg == 0)
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_START_HANDSTAND);
|
||||
if (is_anim_at_end(m)) {
|
||||
if (is_anim_at_end(m))
|
||||
{
|
||||
return set_mario_action(m, ACT_TOP_OF_POLE, 0);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_RETURN_FROM_HANDSTAND);
|
||||
if (m->marioObj->header.gfx.animInfo.animFrame == 0) {
|
||||
if (m->marioObj->header.gfx.animInfo.animFrame == 0)
|
||||
{
|
||||
return set_mario_action(m, ACT_HOLDING_POLE, 0);
|
||||
}
|
||||
}
|
||||
@@ -288,13 +334,17 @@ s32 act_top_of_pole_transition(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_top_of_pole(struct MarioState *m) {
|
||||
UNUSED struct Object *marioObj = m->marioObj;
|
||||
s32 act_top_of_pole(struct MarioState *m)
|
||||
{
|
||||
UNUSED
|
||||
struct Object *marioObj = m->marioObj;
|
||||
|
||||
if (m->input & INPUT_A_PRESSED) {
|
||||
if (m->input & INPUT_A_PRESSED)
|
||||
{
|
||||
return set_mario_action(m, ACT_TOP_OF_POLE_JUMP, 0);
|
||||
}
|
||||
if (m->controller->stickY < -16.0f) {
|
||||
if (m->controller->stickY < -16.0f)
|
||||
{
|
||||
return set_mario_action(m, ACT_TOP_OF_POLE_TRANSITION, 1);
|
||||
}
|
||||
|
||||
@@ -305,7 +355,8 @@ s32 act_top_of_pole(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos) {
|
||||
s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos)
|
||||
{
|
||||
UNUSED s32 unused;
|
||||
struct SM64SurfaceCollisionData *ceil;
|
||||
struct SM64SurfaceCollisionData *floor;
|
||||
@@ -317,24 +368,30 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos) {
|
||||
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
|
||||
ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
|
||||
|
||||
if (floor == NULL) {
|
||||
if (floor == nullptr)
|
||||
{
|
||||
return HANG_HIT_CEIL_OR_OOB;
|
||||
}
|
||||
if (ceil == NULL) {
|
||||
if (ceil == nullptr)
|
||||
{
|
||||
return HANG_LEFT_CEIL;
|
||||
}
|
||||
if (ceilHeight - floorHeight <= 160.0f) {
|
||||
if (ceilHeight - floorHeight <= 160.0f)
|
||||
{
|
||||
return HANG_HIT_CEIL_OR_OOB;
|
||||
}
|
||||
if (ceil->type != SURFACE_HANGABLE) {
|
||||
if (ceil->type != SURFACE_HANGABLE)
|
||||
{
|
||||
return HANG_LEFT_CEIL;
|
||||
}
|
||||
|
||||
ceilOffset = ceilHeight - (nextPos[1] + 160.0f);
|
||||
if (ceilOffset < -30.0f) {
|
||||
if (ceilOffset < -30.0f)
|
||||
{
|
||||
return HANG_HIT_CEIL_OR_OOB;
|
||||
}
|
||||
if (ceilOffset > 30.0f) {
|
||||
if (ceilOffset > 30.0f)
|
||||
{
|
||||
return HANG_LEFT_CEIL;
|
||||
}
|
||||
|
||||
@@ -349,13 +406,15 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos) {
|
||||
return HANG_NONE;
|
||||
}
|
||||
|
||||
s32 update_hang_moving(struct MarioState *m) {
|
||||
s32 update_hang_moving(struct MarioState *m)
|
||||
{
|
||||
s32 stepResult;
|
||||
Vec3f nextPos;
|
||||
f32 maxSpeed = 4.0f;
|
||||
|
||||
m->forwardVel += 1.0f;
|
||||
if (m->forwardVel > maxSpeed) {
|
||||
if (m->forwardVel > maxSpeed)
|
||||
{
|
||||
m->forwardVel = maxSpeed;
|
||||
}
|
||||
|
||||
@@ -381,7 +440,8 @@ s32 update_hang_moving(struct MarioState *m) {
|
||||
return stepResult;
|
||||
}
|
||||
|
||||
void update_hang_stationary(struct MarioState *m) {
|
||||
void update_hang_stationary(struct MarioState *m)
|
||||
{
|
||||
m->forwardVel = 0.0f;
|
||||
m->slideVelX = 0.0f;
|
||||
m->slideVelZ = 0.0f;
|
||||
@@ -391,28 +451,34 @@ void update_hang_stationary(struct MarioState *m) {
|
||||
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
|
||||
}
|
||||
|
||||
s32 act_start_hanging(struct MarioState *m) {
|
||||
s32 act_start_hanging(struct MarioState *m)
|
||||
{
|
||||
#ifdef VERSION_SH
|
||||
if (m->actionTimer++ == 0) {
|
||||
if (m->actionTimer++ == 0)
|
||||
{
|
||||
queue_rumble_data(5, 80);
|
||||
}
|
||||
#else
|
||||
m->actionTimer++;
|
||||
#endif
|
||||
|
||||
if ((m->input & INPUT_NONZERO_ANALOG) && m->actionTimer >= 31) {
|
||||
if ((m->input & INPUT_NONZERO_ANALOG) && m->actionTimer >= 31)
|
||||
{
|
||||
return set_mario_action(m, ACT_HANGING, 0);
|
||||
}
|
||||
|
||||
if (!(m->input & INPUT_A_DOWN)) {
|
||||
if (!(m->input & INPUT_A_DOWN))
|
||||
{
|
||||
return set_mario_action(m, ACT_FREEFALL, 0);
|
||||
}
|
||||
|
||||
if (m->input & INPUT_Z_PRESSED) {
|
||||
if (m->input & INPUT_Z_PRESSED)
|
||||
{
|
||||
return set_mario_action(m, ACT_GROUND_POUND, 0);
|
||||
}
|
||||
|
||||
if (m->ceil == NULL || m->ceil->type != SURFACE_HANGABLE) {
|
||||
if (m->ceil == nullptr || m->ceil->type != SURFACE_HANGABLE)
|
||||
{
|
||||
return set_mario_action(m, ACT_FREEFALL, 0);
|
||||
}
|
||||
|
||||
@@ -420,33 +486,42 @@ s32 act_start_hanging(struct MarioState *m) {
|
||||
play_sound_if_no_flag(m, SOUND_ACTION_HANGING_STEP, MARIO_ACTION_SOUND_PLAYED);
|
||||
update_hang_stationary(m);
|
||||
|
||||
if (is_anim_at_end(m)) {
|
||||
if (is_anim_at_end(m))
|
||||
{
|
||||
set_mario_action(m, ACT_HANGING, 0);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_hanging(struct MarioState *m) {
|
||||
if (m->input & INPUT_NONZERO_ANALOG) {
|
||||
s32 act_hanging(struct MarioState *m)
|
||||
{
|
||||
if (m->input & INPUT_NONZERO_ANALOG)
|
||||
{
|
||||
return set_mario_action(m, ACT_HANG_MOVING, m->actionArg);
|
||||
}
|
||||
|
||||
if (!(m->input & INPUT_A_DOWN)) {
|
||||
if (!(m->input & INPUT_A_DOWN))
|
||||
{
|
||||
return set_mario_action(m, ACT_FREEFALL, 0);
|
||||
}
|
||||
|
||||
if (m->input & INPUT_Z_PRESSED) {
|
||||
if (m->input & INPUT_Z_PRESSED)
|
||||
{
|
||||
return set_mario_action(m, ACT_GROUND_POUND, 0);
|
||||
}
|
||||
|
||||
if (m->ceil == NULL || m->ceil->type != SURFACE_HANGABLE) {
|
||||
if (m->ceil == nullptr || m->ceil->type != SURFACE_HANGABLE)
|
||||
{
|
||||
return set_mario_action(m, ACT_FREEFALL, 0);
|
||||
}
|
||||
|
||||
if (m->actionArg & 1) {
|
||||
if (m->actionArg & 1)
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_HANDSTAND_LEFT);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_HANDSTAND_RIGHT);
|
||||
}
|
||||
|
||||
@@ -455,47 +530,59 @@ s32 act_hanging(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_hang_moving(struct MarioState *m) {
|
||||
if (!(m->input & INPUT_A_DOWN)) {
|
||||
s32 act_hang_moving(struct MarioState *m)
|
||||
{
|
||||
if (!(m->input & INPUT_A_DOWN))
|
||||
{
|
||||
return set_mario_action(m, ACT_FREEFALL, 0);
|
||||
}
|
||||
|
||||
if (m->input & INPUT_Z_PRESSED) {
|
||||
if (m->input & INPUT_Z_PRESSED)
|
||||
{
|
||||
return set_mario_action(m, ACT_GROUND_POUND, 0);
|
||||
}
|
||||
|
||||
if (m->ceil == NULL || m->ceil->type != SURFACE_HANGABLE) {
|
||||
if (m->ceil == nullptr || m->ceil->type != SURFACE_HANGABLE)
|
||||
{
|
||||
return set_mario_action(m, ACT_FREEFALL, 0);
|
||||
}
|
||||
|
||||
if (m->actionArg & 1) {
|
||||
if (m->actionArg & 1)
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_MOVE_ON_WIRE_NET_RIGHT);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_MOVE_ON_WIRE_NET_LEFT);
|
||||
}
|
||||
|
||||
if (m->marioObj->header.gfx.animInfo.animFrame == 12) {
|
||||
if (m->marioObj->header.gfx.animInfo.animFrame == 12)
|
||||
{
|
||||
play_sound(SOUND_ACTION_HANGING_STEP, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(5, 30);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (is_anim_past_end(m)) {
|
||||
if (is_anim_past_end(m))
|
||||
{
|
||||
m->actionArg ^= 1;
|
||||
if (m->input & INPUT_UNKNOWN_5) {
|
||||
if (m->input & INPUT_UNKNOWN_5)
|
||||
{
|
||||
return set_mario_action(m, ACT_HANGING, m->actionArg);
|
||||
}
|
||||
}
|
||||
|
||||
if (update_hang_moving(m) == HANG_LEFT_CEIL) {
|
||||
if (update_hang_moving(m) == HANG_LEFT_CEIL)
|
||||
{
|
||||
set_mario_action(m, ACT_FREEFALL, 0);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 let_go_of_ledge(struct MarioState *m) {
|
||||
s32 let_go_of_ledge(struct MarioState *m)
|
||||
{
|
||||
f32 floorHeight;
|
||||
struct SM64SurfaceCollisionData *floor;
|
||||
|
||||
@@ -505,23 +592,28 @@ s32 let_go_of_ledge(struct MarioState *m) {
|
||||
m->pos[2] -= 60.0f * coss(m->faceAngle[1]);
|
||||
|
||||
floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
|
||||
if (floorHeight < m->pos[1] - 100.0f) {
|
||||
if (floorHeight < m->pos[1] - 100.0f)
|
||||
{
|
||||
m->pos[1] -= 100.0f;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
m->pos[1] = floorHeight;
|
||||
}
|
||||
|
||||
return set_mario_action(m, ACT_SOFT_BONK, 0);
|
||||
}
|
||||
|
||||
void climb_up_ledge(struct MarioState *m) {
|
||||
void climb_up_ledge(struct MarioState *m)
|
||||
{
|
||||
set_mario_animation(m, MARIO_ANIM_IDLE_HEAD_LEFT);
|
||||
m->pos[0] += 14.0f * sins(m->faceAngle[1]);
|
||||
m->pos[2] += 14.0f * coss(m->faceAngle[1]);
|
||||
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
|
||||
}
|
||||
|
||||
void update_ledge_climb_camera(struct MarioState *m) {
|
||||
void update_ledge_climb_camera(struct MarioState *m)
|
||||
{
|
||||
// f32 sp4;
|
||||
|
||||
// if (m->actionTimer < 14) {
|
||||
@@ -536,41 +628,51 @@ void update_ledge_climb_camera(struct MarioState *m) {
|
||||
// m->flags |= MARIO_UNKNOWN_25;
|
||||
}
|
||||
|
||||
void update_ledge_climb(struct MarioState *m, s32 animation, u32 endAction) {
|
||||
void update_ledge_climb(struct MarioState *m, s32 animation, u32 endAction)
|
||||
{
|
||||
stop_and_set_height_to_floor(m);
|
||||
|
||||
set_mario_animation(m, animation);
|
||||
if (is_anim_at_end(m)) {
|
||||
if (is_anim_at_end(m))
|
||||
{
|
||||
set_mario_action(m, endAction, 0);
|
||||
if (endAction == ACT_IDLE) {
|
||||
if (endAction == ACT_IDLE)
|
||||
{
|
||||
climb_up_ledge(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 act_ledge_grab(struct MarioState *m) {
|
||||
s32 act_ledge_grab(struct MarioState *m)
|
||||
{
|
||||
f32 heightAboveFloor;
|
||||
s16 intendedDYaw = m->intendedYaw - m->faceAngle[1];
|
||||
s32 hasSpaceForMario = (m->ceilHeight - m->floorHeight >= 160.0f);
|
||||
|
||||
if (m->actionTimer < 10) {
|
||||
if (m->actionTimer < 10)
|
||||
{
|
||||
m->actionTimer++;
|
||||
}
|
||||
|
||||
if (m->floor->normal.y < 0.9063078f) {
|
||||
if (m->floor->normal.y < 0.9063078f)
|
||||
{
|
||||
return let_go_of_ledge(m);
|
||||
}
|
||||
|
||||
if (m->input & (INPUT_Z_PRESSED | INPUT_OFF_FLOOR)) {
|
||||
if (m->input & (INPUT_Z_PRESSED | INPUT_OFF_FLOOR))
|
||||
{
|
||||
return let_go_of_ledge(m);
|
||||
}
|
||||
|
||||
if ((m->input & INPUT_A_PRESSED) && hasSpaceForMario) {
|
||||
if ((m->input & INPUT_A_PRESSED) && hasSpaceForMario)
|
||||
{
|
||||
return set_mario_action(m, ACT_LEDGE_CLIMB_FAST, 0);
|
||||
}
|
||||
|
||||
if (m->input & INPUT_UNKNOWN_10) {
|
||||
if (m->marioObj->oInteractStatus & INT_STATUS_MARIO_UNK1) {
|
||||
if (m->input & INPUT_UNKNOWN_10)
|
||||
{
|
||||
if (m->marioObj->oInteractStatus & INT_STATUS_MARIO_UNK1)
|
||||
{
|
||||
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 12 : 18;
|
||||
}
|
||||
return let_go_of_ledge(m);
|
||||
@@ -582,21 +684,27 @@ s32 act_ledge_grab(struct MarioState *m) {
|
||||
if (m->actionTimer == 10 && (m->input & INPUT_NONZERO_ANALOG))
|
||||
#endif
|
||||
{
|
||||
if (intendedDYaw >= -0x4000 && intendedDYaw <= 0x4000) {
|
||||
if (hasSpaceForMario) {
|
||||
if (intendedDYaw >= -0x4000 && intendedDYaw <= 0x4000)
|
||||
{
|
||||
if (hasSpaceForMario)
|
||||
{
|
||||
return set_mario_action(m, ACT_LEDGE_CLIMB_SLOW_1, 0);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return let_go_of_ledge(m);
|
||||
}
|
||||
}
|
||||
|
||||
heightAboveFloor = m->pos[1] - find_floor_height_relative_polar(m, -0x8000, 30.0f);
|
||||
if (hasSpaceForMario && heightAboveFloor < 100.0f) {
|
||||
if (hasSpaceForMario && heightAboveFloor < 100.0f)
|
||||
{
|
||||
return set_mario_action(m, ACT_LEDGE_CLIMB_FAST, 0);
|
||||
}
|
||||
|
||||
if (m->actionArg == 0) {
|
||||
if (m->actionArg == 0)
|
||||
{
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_WHOA, MARIO_MARIO_SOUND_PLAYED);
|
||||
}
|
||||
|
||||
@@ -606,8 +714,10 @@ s32 act_ledge_grab(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_ledge_climb_slow(struct MarioState *m) {
|
||||
if (m->input & INPUT_OFF_FLOOR) {
|
||||
s32 act_ledge_climb_slow(struct MarioState *m)
|
||||
{
|
||||
if (m->input & INPUT_OFF_FLOOR)
|
||||
{
|
||||
return let_go_of_ledge(m);
|
||||
}
|
||||
|
||||
@@ -615,27 +725,32 @@ s32 act_ledge_climb_slow(struct MarioState *m) {
|
||||
|
||||
if (m->actionTimer >= 28
|
||||
&& (m->input
|
||||
& (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE))) {
|
||||
& (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE)))
|
||||
{
|
||||
climb_up_ledge(m);
|
||||
return check_common_action_exits(m);
|
||||
}
|
||||
|
||||
if (m->actionTimer == 10) {
|
||||
if (m->actionTimer == 10)
|
||||
{
|
||||
play_sound_if_no_flag(m, SOUND_MARIO_EEUH, MARIO_MARIO_SOUND_PLAYED);
|
||||
}
|
||||
|
||||
update_ledge_climb(m, MARIO_ANIM_SLOW_LEDGE_GRAB, ACT_IDLE);
|
||||
|
||||
update_ledge_climb_camera(m);
|
||||
if (m->marioObj->header.gfx.animInfo.animFrame == 17) {
|
||||
if (m->marioObj->header.gfx.animInfo.animFrame == 17)
|
||||
{
|
||||
m->action = ACT_LEDGE_CLIMB_SLOW_2;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_ledge_climb_down(struct MarioState *m) {
|
||||
if (m->input & INPUT_OFF_FLOOR) {
|
||||
s32 act_ledge_climb_down(struct MarioState *m)
|
||||
{
|
||||
if (m->input & INPUT_OFF_FLOOR)
|
||||
{
|
||||
return let_go_of_ledge(m);
|
||||
}
|
||||
|
||||
@@ -647,8 +762,10 @@ s32 act_ledge_climb_down(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_ledge_climb_fast(struct MarioState *m) {
|
||||
if (m->input & INPUT_OFF_FLOOR) {
|
||||
s32 act_ledge_climb_fast(struct MarioState *m)
|
||||
{
|
||||
if (m->input & INPUT_OFF_FLOOR)
|
||||
{
|
||||
return let_go_of_ledge(m);
|
||||
}
|
||||
|
||||
@@ -656,7 +773,8 @@ s32 act_ledge_climb_fast(struct MarioState *m) {
|
||||
|
||||
update_ledge_climb(m, MARIO_ANIM_FAST_LEDGE_GRAB, ACT_IDLE);
|
||||
|
||||
if (m->marioObj->header.gfx.animInfo.animFrame == 8) {
|
||||
if (m->marioObj->header.gfx.animInfo.animFrame == 8)
|
||||
{
|
||||
play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING);
|
||||
}
|
||||
update_ledge_climb_camera(m);
|
||||
@@ -664,8 +782,10 @@ s32 act_ledge_climb_fast(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_grabbed(struct MarioState *m) {
|
||||
if (m->marioObj->oInteractStatus & INT_STATUS_MARIO_UNK2) {
|
||||
s32 act_grabbed(struct MarioState *m)
|
||||
{
|
||||
if (m->marioObj->oInteractStatus & INT_STATUS_MARIO_UNK2)
|
||||
{
|
||||
s32 thrown = (m->marioObj->oInteractStatus & INT_STATUS_MARIO_UNK6) == 0;
|
||||
|
||||
m->faceAngle[1] = m->usedObj->oMoveAngleYaw;
|
||||
@@ -682,12 +802,14 @@ s32 act_grabbed(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_in_cannon(struct MarioState *m) {
|
||||
s32 act_in_cannon(struct MarioState *m)
|
||||
{
|
||||
struct Object *marioObj = m->marioObj;
|
||||
s16 startFacePitch = m->faceAngle[0];
|
||||
s16 startFaceYaw = m->faceAngle[1];
|
||||
|
||||
switch (m->actionState) {
|
||||
switch (m->actionState)
|
||||
{
|
||||
case 0:
|
||||
m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
|
||||
m->usedObj->oInteractStatus = INT_STATUS_INTERACTED;
|
||||
@@ -707,7 +829,8 @@ s32 act_in_cannon(struct MarioState *m) {
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (m->usedObj->oAction == 1) {
|
||||
if (m->usedObj->oAction == 1)
|
||||
{
|
||||
m->faceAngle[0] = m->usedObj->oMoveAnglePitch;
|
||||
m->faceAngle[1] = m->usedObj->oMoveAngleYaw;
|
||||
|
||||
@@ -722,22 +845,27 @@ s32 act_in_cannon(struct MarioState *m) {
|
||||
m->faceAngle[0] -= (s16)(m->controller->stickY * 10.0f);
|
||||
marioObj->oMarioCannonInputYaw -= (s16)(m->controller->stickX * 10.0f);
|
||||
|
||||
if (m->faceAngle[0] > 0x38E3) {
|
||||
if (m->faceAngle[0] > 0x38E3)
|
||||
{
|
||||
m->faceAngle[0] = 0x38E3;
|
||||
}
|
||||
if (m->faceAngle[0] < 0) {
|
||||
if (m->faceAngle[0] < 0)
|
||||
{
|
||||
m->faceAngle[0] = 0;
|
||||
}
|
||||
|
||||
if (marioObj->oMarioCannonInputYaw > 0x4000) {
|
||||
if (marioObj->oMarioCannonInputYaw > 0x4000)
|
||||
{
|
||||
marioObj->oMarioCannonInputYaw = 0x4000;
|
||||
}
|
||||
if (marioObj->oMarioCannonInputYaw < -0x4000) {
|
||||
if (marioObj->oMarioCannonInputYaw < -0x4000)
|
||||
{
|
||||
marioObj->oMarioCannonInputYaw = -0x4000;
|
||||
}
|
||||
|
||||
m->faceAngle[1] = marioObj->oMarioCannonObjectYaw + marioObj->oMarioCannonInputYaw;
|
||||
if (m->input & INPUT_A_PRESSED) {
|
||||
if (m->input & INPUT_A_PRESSED)
|
||||
{
|
||||
m->forwardVel = 100.0f * coss(m->faceAngle[0]);
|
||||
|
||||
m->vel[1] = 100.0f * sins(m->faceAngle[0]);
|
||||
@@ -757,7 +885,9 @@ s32 act_in_cannon(struct MarioState *m) {
|
||||
#endif
|
||||
m->usedObj->oAction = 2;
|
||||
return FALSE;
|
||||
} else if (m->faceAngle[0] != startFacePitch || m->faceAngle[1] != startFaceYaw) {
|
||||
}
|
||||
else if (m->faceAngle[0] != startFacePitch || m->faceAngle[1] != startFaceYaw)
|
||||
{
|
||||
play_sound(SOUND_MOVING_AIM_CANNON, m->marioObj->header.gfx.cameraToObject);
|
||||
#ifdef VERSION_SH
|
||||
reset_rumble_timers_2(0);
|
||||
@@ -772,7 +902,8 @@ s32 act_in_cannon(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 act_tornado_twirling(struct MarioState *m) {
|
||||
s32 act_tornado_twirling(struct MarioState *m)
|
||||
{
|
||||
struct SM64SurfaceCollisionData *floor;
|
||||
Vec3f nextPos;
|
||||
f32 sinAngleVel;
|
||||
@@ -785,25 +916,31 @@ s32 act_tornado_twirling(struct MarioState *m) {
|
||||
f32 dx = (m->pos[0] - usedObj->oPosX) * 0.95f;
|
||||
f32 dz = (m->pos[2] - usedObj->oPosZ) * 0.95f;
|
||||
|
||||
if (m->vel[1] < 60.0f) {
|
||||
if (m->vel[1] < 60.0f)
|
||||
{
|
||||
m->vel[1] += 1.0f;
|
||||
}
|
||||
|
||||
if ((marioObj->oMarioTornadoPosY += m->vel[1]) < 0.0f) {
|
||||
if ((marioObj->oMarioTornadoPosY += m->vel[1]) < 0.0f)
|
||||
{
|
||||
marioObj->oMarioTornadoPosY = 0.0f;
|
||||
}
|
||||
if (marioObj->oMarioTornadoPosY > usedObj->hitboxHeight) {
|
||||
if (m->vel[1] < 20.0f) {
|
||||
if (marioObj->oMarioTornadoPosY > usedObj->hitboxHeight)
|
||||
{
|
||||
if (m->vel[1] < 20.0f)
|
||||
{
|
||||
m->vel[1] = 20.0f;
|
||||
}
|
||||
return set_mario_action(m, ACT_TWIRLING, 1);
|
||||
}
|
||||
|
||||
if (m->angleVel[1] < 0x3000) {
|
||||
if (m->angleVel[1] < 0x3000)
|
||||
{
|
||||
m->angleVel[1] += 0x100;
|
||||
}
|
||||
|
||||
if (marioObj->oMarioTornadoYawVel < 0x1000) {
|
||||
if (marioObj->oMarioTornadoYawVel < 0x1000)
|
||||
{
|
||||
marioObj->oMarioTornadoYawVel += 0x100;
|
||||
}
|
||||
|
||||
@@ -819,14 +956,20 @@ s32 act_tornado_twirling(struct MarioState *m) {
|
||||
f32_find_wall_collision(&nextPos[0], &nextPos[1], &nextPos[2], 60.0f, 50.0f);
|
||||
|
||||
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
|
||||
if (floor != NULL) {
|
||||
if (floor != nullptr)
|
||||
{
|
||||
m->floor = floor;
|
||||
m->floorHeight = floorHeight;
|
||||
vec3f_copy(m->pos, nextPos);
|
||||
} else {
|
||||
if (nextPos[1] >= m->floorHeight) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nextPos[1] >= m->floorHeight)
|
||||
{
|
||||
m->pos[1] = nextPos[1];
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
m->pos[1] = m->floorHeight;
|
||||
}
|
||||
}
|
||||
@@ -835,12 +978,14 @@ s32 act_tornado_twirling(struct MarioState *m) {
|
||||
|
||||
set_mario_animation(m, (m->actionArg == 0) ? MARIO_ANIM_START_TWIRL : MARIO_ANIM_TWIRL);
|
||||
|
||||
if (is_anim_past_end(m)) {
|
||||
if (is_anim_past_end(m))
|
||||
{
|
||||
m->actionArg = 1;
|
||||
}
|
||||
|
||||
// Play sound on angle overflow
|
||||
if (prevTwirlYaw > m->twirlYaw) {
|
||||
if (prevTwirlYaw > m->twirlYaw)
|
||||
{
|
||||
play_sound(SOUND_ACTION_TWIRL, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
|
||||
@@ -853,18 +998,22 @@ s32 act_tornado_twirling(struct MarioState *m) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 check_common_automatic_cancels(struct MarioState *m) {
|
||||
if (m->pos[1] < m->waterLevel - 100) {
|
||||
s32 check_common_automatic_cancels(struct MarioState *m)
|
||||
{
|
||||
if (m->pos[1] < m->waterLevel - 100)
|
||||
{
|
||||
return set_water_plunge_action(m);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 mario_execute_automatic_action(struct MarioState *m) {
|
||||
s32 mario_execute_automatic_action(struct MarioState *m)
|
||||
{
|
||||
s32 cancel;
|
||||
|
||||
if (check_common_automatic_cancels(m)) {
|
||||
if (check_common_automatic_cancels(m))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
@@ -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
|
||||
|
||||
@@ -23,45 +23,58 @@
|
||||
*/
|
||||
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:
|
||||
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,15 +82,18 @@ 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;
|
||||
@@ -87,32 +103,40 @@ s32 mario_update_punch_sequence(struct MarioState *m) {
|
||||
// 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,20 +307,25 @@ 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);
|
||||
@@ -280,16 +338,20 @@ s32 act_throwing(struct MarioState *m) {
|
||||
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);
|
||||
@@ -302,16 +364,20 @@ s32 act_heavy_throw(struct MarioState *m) {
|
||||
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,8 +385,10 @@ 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;
|
||||
@@ -332,7 +400,8 @@ s32 act_picking_up_bowser(struct MarioState *m) {
|
||||
}
|
||||
|
||||
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,14 +409,19 @@ 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) {
|
||||
if (m->input & INPUT_B_PRESSED)
|
||||
{
|
||||
#ifndef VERSION_JP
|
||||
if (m->angleVel[1] <= -0xE00 || m->angleVel[1] >= 0xE00) {
|
||||
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
|
||||
@@ -356,43 +430,57 @@ s32 act_holding_bowser(struct MarioState *m) {
|
||||
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,13 +490,15 @@ 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]) {
|
||||
if (m->angleVel[1] <= -0x100 && spin < m->faceAngle[1])
|
||||
{
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(4, 20);
|
||||
#endif
|
||||
play_sound(SOUND_OBJ_BOWSER_SPINNING, m->marioObj->header.gfx.cameraToObject);
|
||||
}
|
||||
if (m->angleVel[1] >= 0x100 && spin > m->faceAngle[1]) {
|
||||
if (m->angleVel[1] >= 0x100 && spin > m->faceAngle[1])
|
||||
{
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(4, 20);
|
||||
#endif
|
||||
@@ -416,23 +506,31 @@ s32 act_holding_bowser(struct MarioState *m) {
|
||||
}
|
||||
|
||||
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) {
|
||||
s32 act_releasing_bowser(struct MarioState *m)
|
||||
{
|
||||
if (++m->actionTimer == 1)
|
||||
{
|
||||
if (m->actionArg == 0)
|
||||
{
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(4, 50);
|
||||
#endif
|
||||
mario_throw_held_object(m);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef VERSION_SH
|
||||
queue_rumble_data(4, 50);
|
||||
#endif
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
+166
-87
@@ -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,
|
||||
@@ -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,7 +108,8 @@ static s8 gMarioAttackScaleAnimation[3 * 6] = {
|
||||
// return gfx;
|
||||
// }
|
||||
|
||||
static void toad_message_faded(void) {
|
||||
static void toad_message_faded(void)
|
||||
{
|
||||
// if (gCurrentObject->oDistanceToMario > 700.0f) {
|
||||
// gCurrentObject->oToadMessageRecentlyTalked = FALSE;
|
||||
// }
|
||||
@@ -115,7 +118,8 @@ static void toad_message_faded(void) {
|
||||
// }
|
||||
}
|
||||
|
||||
static void toad_message_opaque(void) {
|
||||
static void toad_message_opaque(void)
|
||||
{
|
||||
// if (gCurrentObject->oDistanceToMario > 700.0f) {
|
||||
// gCurrentObject->oToadMessageState = TOAD_MESSAGE_FADING;
|
||||
// } else if (!gCurrentObject->oToadMessageRecentlyTalked) {
|
||||
@@ -128,7 +132,8 @@ static void toad_message_opaque(void) {
|
||||
// }
|
||||
}
|
||||
|
||||
static void toad_message_talking(void) {
|
||||
static void toad_message_talking(void)
|
||||
{
|
||||
// if (cur_obj_update_dialog_with_cutscene(3, 1, CUTSCENE_DIALOG, gCurrentObject->oToadMessageDialogId)
|
||||
// != 0) {
|
||||
// gCurrentObject->oToadMessageRecentlyTalked = TRUE;
|
||||
@@ -150,22 +155,29 @@ static void toad_message_talking(void) {
|
||||
// }
|
||||
}
|
||||
|
||||
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,7 +197,8 @@ void bhv_toad_message_loop(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void bhv_toad_message_init(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;
|
||||
@@ -232,7 +245,8 @@ void bhv_toad_message_init(void) {
|
||||
// sparkleParticle->oPosY -= gCurrentObject->oUnlockDoorStarTimer * 10.0f;
|
||||
//}
|
||||
|
||||
void bhv_unlock_door_star_init(void) {
|
||||
void bhv_unlock_door_star_init(void)
|
||||
{
|
||||
// gCurrentObject->oUnlockDoorStarState = UNLOCK_DOOR_STAR_RISING;
|
||||
// gCurrentObject->oUnlockDoorStarTimer = 0;
|
||||
// gCurrentObject->oUnlockDoorStarYawVel = 0x1000;
|
||||
@@ -243,7 +257,8 @@ void bhv_unlock_door_star_init(void) {
|
||||
// obj_scale(gCurrentObject, 0.5f);
|
||||
}
|
||||
|
||||
void bhv_unlock_door_star_loop(void) {
|
||||
void bhv_unlock_door_star_loop(void)
|
||||
{
|
||||
// UNUSED u8 unused1[4];
|
||||
// s16 prevYaw = gCurrentObject->oMoveAngleYaw;
|
||||
// UNUSED u8 unused2[4];
|
||||
@@ -304,15 +319,19 @@ void bhv_unlock_door_star_loop(void) {
|
||||
/**
|
||||
* 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;
|
||||
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,71 +367,86 @@ 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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
if (callContext == GEO_CONTEXT_RENDER)
|
||||
{
|
||||
struct GraphNodeRotation *rotNode = (struct GraphNodeRotation *)node->next;
|
||||
// struct Camera *camera = gCurGraphNodeCamera->config.camera;
|
||||
|
||||
@@ -426,32 +462,40 @@ Gfx *geo_mario_head_rotation(s32 callContext, struct GraphNode *node, UNUSED Mat
|
||||
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) {
|
||||
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 {
|
||||
}
|
||||
else
|
||||
{
|
||||
switchCase->selectedCase =
|
||||
(bodyState->handState < 2) ? bodyState->handState : MARIO_HAND_FISTS;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -462,15 +506,19 @@ 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) {
|
||||
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;
|
||||
}
|
||||
@@ -479,94 +527,121 @@ Gfx *geo_mario_hand_foot_scaler(s32 callContext, struct GraphNode *node, UNUSED
|
||||
/ 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) {
|
||||
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 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;
|
||||
|
||||
if (callContext == GEO_CONTEXT_RENDER) {
|
||||
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) {
|
||||
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,13 +672,14 @@ 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) {
|
||||
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);
|
||||
// init_graph_node_object(nullptr, &gMirrorMario, nullptr, gVec3fZero, gVec3sZero, gVec3fOne);
|
||||
// break;
|
||||
// case GEO_CONTEXT_AREA_LOAD:
|
||||
// geo_add_child(node, &gMirrorMario.node);
|
||||
@@ -629,16 +707,17 @@ Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
return NULL;
|
||||
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) {
|
||||
Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c)
|
||||
{
|
||||
// struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node;
|
||||
// Gfx *gfx = NULL;
|
||||
// Gfx *gfx = nullptr;
|
||||
|
||||
// if (callContext == GEO_CONTEXT_RENDER && gCurGraphNodeObject == &gMirrorMario) {
|
||||
// gfx = alloc_display_list(3 * sizeof(*gfx));
|
||||
@@ -655,5 +734,5 @@ Gfx *geo_mirror_mario_backface_culling(s32 callContext, struct GraphNode *node,
|
||||
// asGenerated->fnNode.node.flags = (asGenerated->fnNode.node.flags & 0xFF) | (LAYER_OPAQUE << 8);
|
||||
// }
|
||||
// return gfx;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+237
-114
@@ -12,7 +12,7 @@ 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
|
||||
{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,24 +216,30 @@ 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);
|
||||
}
|
||||
|
||||
@@ -219,7 +255,8 @@ u32 mario_update_windy_ground(struct MarioState *m) {
|
||||
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,102 +575,143 @@ 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;
|
||||
}
|
||||
}
|
||||
@@ -608,15 +723,17 @@ void apply_vertical_wind(struct MarioState *m) {
|
||||
}
|
||||
}
|
||||
|
||||
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]);
|
||||
|
||||
@@ -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,
|
||||
|
||||
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
|
||||
@@ -11,15 +11,17 @@
|
||||
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;
|
||||
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,16 +29,17 @@ 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++) {
|
||||
for (i = 0; i < 0x50; i++)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
obj->rawData.asS32[i] = 0;
|
||||
#endif
|
||||
#ifdef _WIN64
|
||||
obj->ptrData.asVoidPtr[i] = NULL;
|
||||
obj->ptrData.asVoidPtr[i] = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -51,23 +54,26 @@ static struct Object *allocate_object(void) {
|
||||
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,7 +168,8 @@ 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;
|
||||
|
||||
@@ -180,7 +192,8 @@ void bhv_mario_update(void) {
|
||||
// }
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -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);
|
||||
@@ -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;
|
||||
@@ -114,12 +126,14 @@ void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform
|
||||
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];
|
||||
}
|
||||
|
||||
@@ -162,8 +176,10 @@ void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
@@ -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
@@ -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);
|
||||
|
||||
|
||||
+37
-11
@@ -42,7 +42,8 @@ struct SaveFile
|
||||
struct SaveBlockSignature signature;
|
||||
};
|
||||
|
||||
enum SaveFileIndex {
|
||||
enum SaveFileIndex
|
||||
{
|
||||
SAVE_FILE_A,
|
||||
SAVE_FILE_B,
|
||||
SAVE_FILE_C,
|
||||
@@ -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);
|
||||
|
||||
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);
|
||||
|
||||
@@ -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,30 +163,48 @@ 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 (soundMenuFlags & SOUND_MENU_FLAG_LETGOMARIOFACE)
|
||||
{
|
||||
queue_rumble_data(10, 60);
|
||||
}
|
||||
#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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
+40
-20
@@ -98,28 +98,32 @@
|
||||
* Data Structures.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int flags: 8;
|
||||
unsigned int gain: 16;
|
||||
unsigned int addr;
|
||||
} Aadpcm;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int flags: 8;
|
||||
unsigned int gain: 16;
|
||||
unsigned int addr;
|
||||
} Apolef;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int flags: 8;
|
||||
unsigned int pad1: 16;
|
||||
unsigned int addr;
|
||||
} Aenvelope;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int pad1: 8;
|
||||
unsigned int dmem: 16;
|
||||
@@ -127,7 +131,8 @@ typedef struct {
|
||||
unsigned int count: 16;
|
||||
} Aclearbuff;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int pad1: 8;
|
||||
unsigned int pad2: 16;
|
||||
@@ -135,20 +140,23 @@ typedef struct {
|
||||
unsigned int inR: 16;
|
||||
} Ainterleave;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int pad1: 24;
|
||||
unsigned int addr;
|
||||
} Aloadbuff;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int flags: 8;
|
||||
unsigned int pad1: 16;
|
||||
unsigned int addr;
|
||||
} Aenvmixer;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int flags: 8;
|
||||
unsigned int gain: 16;
|
||||
@@ -156,34 +164,39 @@ typedef struct {
|
||||
unsigned int dmemo: 16;
|
||||
} Amixer;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int flags: 8;
|
||||
unsigned int dmem2: 16;
|
||||
unsigned int addr;
|
||||
} Apan;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int flags: 8;
|
||||
unsigned int pitch: 16;
|
||||
unsigned int addr;
|
||||
} Aresample;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int flags: 8;
|
||||
unsigned int pad1: 16;
|
||||
unsigned int addr;
|
||||
} Areverb;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int pad1: 24;
|
||||
unsigned int addr;
|
||||
} Asavebuff;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int pad1: 24;
|
||||
unsigned int pad2: 2;
|
||||
@@ -191,7 +204,8 @@ typedef struct {
|
||||
unsigned int base: 24;
|
||||
} Asegment;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int flags: 8;
|
||||
unsigned int dmemin: 16;
|
||||
@@ -199,7 +213,8 @@ typedef struct {
|
||||
unsigned int count: 16;
|
||||
} Asetbuff;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int flags: 8;
|
||||
unsigned int vol: 16;
|
||||
@@ -207,7 +222,8 @@ typedef struct {
|
||||
unsigned int volrate: 16;
|
||||
} Asetvol;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int pad1: 8;
|
||||
unsigned int dmemin: 16;
|
||||
@@ -215,14 +231,16 @@ typedef struct {
|
||||
unsigned int count: 16;
|
||||
} Admemmove;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int pad1: 8;
|
||||
unsigned int count: 16;
|
||||
unsigned int addr;
|
||||
} Aloadadpcm;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8;
|
||||
unsigned int pad1: 8;
|
||||
unsigned int pad2: 16;
|
||||
@@ -233,12 +251,14 @@ typedef struct {
|
||||
* Generic Acmd Packet
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
uintptr_t w0;
|
||||
uintptr_t w1;
|
||||
} Awords;
|
||||
|
||||
typedef union {
|
||||
typedef union
|
||||
{
|
||||
Awords words;
|
||||
#if IS_BIG_ENDIAN && !IS_64_BIT
|
||||
Aadpcm adpcm;
|
||||
|
||||
+90
-50
@@ -24,7 +24,6 @@
|
||||
#include "ultratypes.h"
|
||||
|
||||
|
||||
|
||||
// FROM mbi.h
|
||||
/*
|
||||
* the SHIFT macros are used to build display list commands, inserting
|
||||
@@ -51,9 +50,6 @@
|
||||
#define G_OFF (0)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* To use the F3DEX ucodes, define F3DEX_GBI before include this file.
|
||||
*
|
||||
@@ -1141,7 +1137,8 @@
|
||||
/*
|
||||
* Vertex (set up for use with colors)
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
#ifndef GBI_FLOATS
|
||||
short ob[3]; /* x, y, z */
|
||||
#else
|
||||
@@ -1155,7 +1152,8 @@ typedef struct {
|
||||
/*
|
||||
* Vertex (set up for use with normals)
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
#ifndef GBI_FLOATS
|
||||
short ob[3]; /* x, y, z */
|
||||
#else
|
||||
@@ -1167,7 +1165,8 @@ typedef struct {
|
||||
unsigned char a; /* alpha */
|
||||
} Vtx_tn;
|
||||
|
||||
typedef union {
|
||||
typedef union
|
||||
{
|
||||
Vtx_t v; /* Use this one for colors */
|
||||
Vtx_tn n; /* Use this one for normals */
|
||||
long long int force_structure_alignment;
|
||||
@@ -1177,7 +1176,8 @@ typedef union {
|
||||
* Sprite structure
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
void *SourceImagePointer;
|
||||
void *TlutPointer;
|
||||
short Stride;
|
||||
@@ -1191,10 +1191,10 @@ typedef struct {
|
||||
|
||||
/* padding to bring structure size to 64 bit allignment */
|
||||
char dummy[4];
|
||||
|
||||
} uSprite_t;
|
||||
|
||||
typedef union {
|
||||
typedef union
|
||||
{
|
||||
uSprite_t s;
|
||||
|
||||
/* Need to make sure this is 64 bit aligned */
|
||||
@@ -1204,7 +1204,8 @@ typedef union {
|
||||
/*
|
||||
* Triangle face
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned char flag;
|
||||
unsigned char v[3];
|
||||
} Tri;
|
||||
@@ -1217,12 +1218,14 @@ typedef struct {
|
||||
*/
|
||||
typedef s32 Mtx_t[4][4];
|
||||
|
||||
typedef union {
|
||||
typedef union
|
||||
{
|
||||
Mtx_t m;
|
||||
long long int force_structure_alignment;
|
||||
} Mtx;
|
||||
#else
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
float m[4][4];
|
||||
} Mtx;
|
||||
#endif
|
||||
@@ -1261,13 +1264,15 @@ typedef struct {
|
||||
* (SCREEN_WD/2)*4, (SCREEN_HT/2)*4, G_MAXZ, 0,
|
||||
* (SCREEN_WD/2)*4, (SCREEN_HT/2)*4, 0, 0,
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
short vscale[4]; /* scale, 2 bits fraction */
|
||||
short vtrans[4]; /* translate, 2 bits fraction */
|
||||
/* both the above arrays are padded to 64-bit boundary */
|
||||
} Vp_t;
|
||||
|
||||
typedef union {
|
||||
typedef union
|
||||
{
|
||||
Vp_t vp;
|
||||
long long int force_structure_alignment;
|
||||
} Vp;
|
||||
@@ -1427,7 +1432,8 @@ typedef union {
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned char col[3]; /* diffuse light value (rgba) */
|
||||
char pad1;
|
||||
unsigned char colc[3]; /* copy of diffuse light value (rgba) */
|
||||
@@ -1436,77 +1442,92 @@ typedef struct {
|
||||
char pad3;
|
||||
} Light_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned char col[3]; /* ambient light value (rgba) */
|
||||
char pad1;
|
||||
unsigned char colc[3]; /* copy of ambient light value (rgba) */
|
||||
char pad2;
|
||||
} Ambient_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int x1, y1, x2, y2; /* texture offsets for highlight 1/2 */
|
||||
} Hilite_t;
|
||||
|
||||
typedef union {
|
||||
typedef union
|
||||
{
|
||||
Light_t l;
|
||||
long long int force_structure_alignment[2];
|
||||
} Light;
|
||||
|
||||
typedef union {
|
||||
typedef union
|
||||
{
|
||||
Ambient_t l;
|
||||
long long int force_structure_alignment[1];
|
||||
} Ambient;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Ambient a;
|
||||
Light l[7];
|
||||
} Lightsn;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Ambient a;
|
||||
Light l[1];
|
||||
} Lights0;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Ambient a;
|
||||
Light l[1];
|
||||
} Lights1;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Ambient a;
|
||||
Light l[2];
|
||||
} Lights2;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Ambient a;
|
||||
Light l[3];
|
||||
} Lights3;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Ambient a;
|
||||
Light l[4];
|
||||
} Lights4;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Ambient a;
|
||||
Light l[5];
|
||||
} Lights5;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Ambient a;
|
||||
Light l[6];
|
||||
} Lights6;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Ambient a;
|
||||
Light l[7];
|
||||
} Lights7;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
Light l[2];
|
||||
} LookAt;
|
||||
|
||||
typedef union {
|
||||
typedef union
|
||||
{
|
||||
Hilite_t h;
|
||||
long int force_structure_alignment[4];
|
||||
} Hilite;
|
||||
@@ -1571,7 +1592,8 @@ typedef union {
|
||||
/*
|
||||
* Graphics DMA Packet
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
unsigned int par: 8;
|
||||
unsigned int len: 16;
|
||||
@@ -1581,13 +1603,15 @@ typedef struct {
|
||||
/*
|
||||
* Graphics Immediate Mode Packet types
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
int pad: 24;
|
||||
Tri tri;
|
||||
} Gtri;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
int pad1: 24;
|
||||
int pad2: 24;
|
||||
@@ -1603,7 +1627,8 @@ typedef struct {
|
||||
* int base:24;
|
||||
* } Gsegment;
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
int pad0: 8;
|
||||
int mw_index: 8;
|
||||
@@ -1612,7 +1637,8 @@ typedef struct {
|
||||
int base: 24;
|
||||
} Gsegment;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
int pad0: 8;
|
||||
int sft: 8;
|
||||
@@ -1620,7 +1646,8 @@ typedef struct {
|
||||
unsigned int data: 32;
|
||||
} GsetothermodeL;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
int pad0: 8;
|
||||
int sft: 8;
|
||||
@@ -1628,7 +1655,8 @@ typedef struct {
|
||||
unsigned int data: 32;
|
||||
} GsetothermodeH;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned char cmd;
|
||||
unsigned char lodscale;
|
||||
unsigned char tile;
|
||||
@@ -1637,13 +1665,15 @@ typedef struct {
|
||||
unsigned short t;
|
||||
} Gtexture;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
int pad: 24;
|
||||
Tri line;
|
||||
} Gline3D;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
int pad1: 24;
|
||||
short int pad2;
|
||||
@@ -1654,7 +1684,8 @@ typedef struct {
|
||||
/*
|
||||
* RDP Packet types
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
unsigned int fmt: 3;
|
||||
unsigned int siz: 2;
|
||||
@@ -1663,13 +1694,15 @@ typedef struct {
|
||||
uintptr_t dram; /* to account for 1024 */
|
||||
} Gsetimg;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
unsigned int muxs0: 24;
|
||||
unsigned int muxs1: 32;
|
||||
} Gsetcombine;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
unsigned char pad;
|
||||
unsigned char prim_min_level;
|
||||
@@ -1677,7 +1710,8 @@ typedef struct {
|
||||
unsigned long color;
|
||||
} Gsetcolor;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
int x0: 10;
|
||||
int x0frac: 2;
|
||||
@@ -1690,7 +1724,8 @@ typedef struct {
|
||||
int y1frac: 2;
|
||||
} Gfillrect;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
unsigned int fmt: 3;
|
||||
unsigned int siz: 2;
|
||||
@@ -1710,7 +1745,8 @@ typedef struct {
|
||||
unsigned int shifts: 4;
|
||||
} Gsettile;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int cmd: 8;
|
||||
unsigned int sl: 12;
|
||||
unsigned int tl: 12;
|
||||
@@ -1726,7 +1762,8 @@ typedef Gloadtile Gsettilesize;
|
||||
|
||||
typedef Gloadtile Gloadtlut;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned int cmd: 8; /* command */
|
||||
unsigned int xl: 12; /* X coordinate of upper left */
|
||||
unsigned int yl: 12; /* Y coordinate of upper left */
|
||||
@@ -1743,7 +1780,8 @@ typedef struct {
|
||||
/*
|
||||
* Textured rectangles are 128 bits not 64 bits
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
unsigned long w0;
|
||||
unsigned long w1;
|
||||
unsigned long w2;
|
||||
@@ -1757,7 +1795,8 @@ typedef struct {
|
||||
/*
|
||||
* Generic Gfx Packet
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
uintptr_t w0;
|
||||
uintptr_t w1;
|
||||
} Gwords;
|
||||
@@ -1770,7 +1809,8 @@ typedef struct {
|
||||
* 64-bit systems, only the 'words' member may be accessed; the rest of the
|
||||
* structs don't have matching layouts for now.)
|
||||
*/
|
||||
typedef union {
|
||||
typedef union
|
||||
{
|
||||
Gwords words;
|
||||
#if !defined(F3D_OLD) && IS_BIG_ENDIAN && !IS_64_BIT
|
||||
Gdma dma;
|
||||
|
||||
@@ -6,8 +6,15 @@
|
||||
|
||||
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
|
||||
@@ -16,7 +23,11 @@ typedef struct
|
||||
unsigned short seqCount;
|
||||
unsigned int pad;
|
||||
ALSeqData seqArray[1];
|
||||
} __attribute__((aligned (16))) ALSeqFile;
|
||||
} __attribute__((aligned (16)
|
||||
|
||||
)
|
||||
)
|
||||
ALSeqFile;
|
||||
|
||||
void alSeqFileNew(ALSeqFile * f, u8 * base);
|
||||
|
||||
|
||||
+18
-10
@@ -32,7 +32,9 @@
|
||||
#define _OS_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif
|
||||
|
||||
#include "ultratypes.h"
|
||||
@@ -49,7 +51,8 @@ extern "C" {
|
||||
/*
|
||||
* Structure for device manager block
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
s32 active; /* Status flag */
|
||||
OSThread *thread; /* Calling thread */
|
||||
OSMesgQueue *cmdQueue; /* Command queue */
|
||||
@@ -57,6 +60,7 @@ typedef struct {
|
||||
OSMesgQueue *acsQueue; /* Access queue */
|
||||
/* Raw DMA routine */
|
||||
s32 (*dma)(s32, u32, void *, u32);
|
||||
|
||||
s32 (*edma)(OSPiHandle *, s32, u32, void *, u32);
|
||||
} OSDevMgr;
|
||||
|
||||
@@ -65,8 +69,8 @@ typedef struct {
|
||||
*/
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int status;
|
||||
OSMesgQueue *queue;
|
||||
int channel;
|
||||
@@ -83,7 +87,8 @@ typedef struct {
|
||||
} OSPfs;
|
||||
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
u32 file_size; /* bytes */
|
||||
u32 game_code;
|
||||
u16 company_code;
|
||||
@@ -94,7 +99,8 @@ typedef struct {
|
||||
/*
|
||||
* Structure for Profiler
|
||||
*/
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
u16 *histo_base; /* histogram base */
|
||||
u32 histo_size; /* histogram size */
|
||||
u32 *text_start; /* start of text segment */
|
||||
@@ -575,7 +581,6 @@ extern OSPiHandle *__osPiTable; /* The head of OSPiHandle link list */
|
||||
extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Function prototypes
|
||||
@@ -584,7 +589,8 @@ extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/
|
||||
|
||||
/* Thread operations */
|
||||
|
||||
extern void osCreateThread(OSThread *, OSId, void (*)(void *),
|
||||
extern void osCreateThread(
|
||||
OSThread *, OSId, void (*)(void *),
|
||||
void *, void *, OSPri);
|
||||
extern void osDestroyThread(OSThread *);
|
||||
extern void osYieldThread(void);
|
||||
@@ -665,7 +671,8 @@ 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,
|
||||
extern s32 osPiStartDma(
|
||||
OSIoMesg *, s32, s32, u32, void *, u32,
|
||||
OSMesgQueue *);
|
||||
extern void osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32);
|
||||
|
||||
@@ -691,7 +698,8 @@ extern void osCreateViManager(OSPri);
|
||||
|
||||
extern OSTime osGetTime(void);
|
||||
extern void osSetTime(OSTime);
|
||||
extern u32 osSetTimer(OSTimer *, OSTime, OSTime,
|
||||
extern u32 osSetTimer(
|
||||
OSTimer *, OSTime, OSTime,
|
||||
OSMesgQueue *, OSMesg);
|
||||
extern int osStopTimer(OSTimer *);
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#define _OS_AI_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif
|
||||
|
||||
#include "ultratypes.h"
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#define _OS_CACHE_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif
|
||||
|
||||
#include "ultratypes.h"
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#define _OS_CONT_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif
|
||||
|
||||
#include "ultratypes.h"
|
||||
@@ -50,20 +52,23 @@ extern "C" {
|
||||
* Structure for controllers
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
u16 type; /* Controller Type */
|
||||
u8 status; /* Controller status */
|
||||
u8 errnum;
|
||||
} OSContStatus;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
u16 button;
|
||||
s8 stick_x; /* -80 <= stick_x <= 80 */
|
||||
s8 stick_y; /* -80 <= stick_y <= 80 */
|
||||
u8 errnum;
|
||||
} OSContPad;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
void *address; /* Ram pad Address: 11 bits */
|
||||
u8 databuffer[32]; /* address of the data buffer */
|
||||
u8 addressCrc; /* CRC code for address */
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#define _OS_EEPROM_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif
|
||||
|
||||
#include "ultratypes.h"
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#define _OS_EXCEPTION_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif
|
||||
|
||||
#include "ultratypes.h"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#define _OS_MESSAGE_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif
|
||||
|
||||
#include "ultratypes.h"
|
||||
@@ -55,7 +57,8 @@ typedef void * OSMesg;
|
||||
/*
|
||||
* Structure for message queue
|
||||
*/
|
||||
typedef struct OSMesgQueue_s {
|
||||
typedef struct OSMesgQueue_s
|
||||
{
|
||||
OSThread *mtqueue; /* Queue to store threads blocked
|
||||
on empty mailboxes (receive) */
|
||||
OSThread *fullqueue; /* Queue to store threads blocked
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
/* Miscellaneous OS functions */
|
||||
|
||||
void osInitialize(void);
|
||||
|
||||
u32 osGetCount(void);
|
||||
|
||||
uintptr_t osVirtualToPhysical(void *);
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
/* Types */
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
#if !defined(VERSION_EU)
|
||||
u32 errStatus;
|
||||
#endif
|
||||
@@ -17,7 +18,8 @@ typedef struct {
|
||||
u32 C1ErrSector[4];
|
||||
} __OSBlockInfo;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
u32 cmdType; // 0
|
||||
u16 transferMode; // 4
|
||||
u16 blockNum; // 6
|
||||
@@ -31,7 +33,8 @@ typedef struct {
|
||||
__OSBlockInfo block[2]; // 18
|
||||
} __OSTranxInfo;
|
||||
|
||||
typedef struct OSPiHandle_s {
|
||||
typedef struct OSPiHandle_s
|
||||
{
|
||||
struct OSPiHandle_s *next;
|
||||
u8 type;
|
||||
u8 latency;
|
||||
@@ -44,23 +47,30 @@ 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;
|
||||
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
|
||||
@@ -76,13 +86,19 @@ typedef struct {
|
||||
|
||||
/* Functions */
|
||||
|
||||
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr,
|
||||
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
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#define _OS_RDP_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif
|
||||
|
||||
#include "ultratypes.h"
|
||||
|
||||
@@ -23,19 +23,30 @@ 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;
|
||||
/*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
|
||||
|
||||
@@ -21,7 +21,9 @@ typedef u64 OSTime;
|
||||
/* Functions */
|
||||
|
||||
OSTime osGetTime(void);
|
||||
|
||||
void osSetTime(OSTime time);
|
||||
|
||||
u32 osSetTimer(OSTimer *, OSTime, OSTime, OSMesgQueue *, OSMesg);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#define _OS_TLB_H_
|
||||
|
||||
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#endif
|
||||
|
||||
#include "ultratypes.h"
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef _ULTRA64_TYPES_H_
|
||||
#define _ULTRA64_TYPES_H_
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#ifndef nullptr
|
||||
#define nullptr (void *)0
|
||||
#endif
|
||||
|
||||
#define TRUE 1
|
||||
|
||||
+426
-213
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
+300
-149
@@ -22,13 +22,20 @@
|
||||
|
||||
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;
|
||||
/*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
|
||||
@@ -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
|
||||
{
|
||||
@@ -174,7 +228,8 @@ struct Object
|
||||
#endif
|
||||
} rawData;
|
||||
#if IS_64_BIT
|
||||
union {
|
||||
union
|
||||
{
|
||||
s16 *asS16P[0x50];
|
||||
s32 *asS32P[0x50];
|
||||
struct Animation **asAnims[0x50];
|
||||
@@ -186,36 +241,62 @@ struct Object
|
||||
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;
|
||||
/*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;
|
||||
/*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;
|
||||
/*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
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ struct AllocOnlyPool *alloc_only_pool_init(void)
|
||||
{
|
||||
struct AllocOnlyPool *newPool = malloc(sizeof(struct AllocOnlyPool));
|
||||
newPool->allocatedCount = 0;
|
||||
newPool->allocatedBlocks = NULL;
|
||||
newPool->allocatedBlocks = nullptr;
|
||||
return newPool;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@ typedef s32 ALMicroTime;
|
||||
/* Possible wavetable types */
|
||||
enum
|
||||
{
|
||||
AL_ADPCM_WAVE = 0,
|
||||
AL_RAW16_WAVE
|
||||
AL_ADPCM_WAVE = 0, AL_RAW16_WAVE
|
||||
};
|
||||
|
||||
typedef struct
|
||||
@@ -71,7 +70,8 @@ typedef struct ALWaveTable_s
|
||||
s32 len; /* length of data in bytes */
|
||||
u8 type; /* compression type */
|
||||
u8 flags; /* offset/address flags */
|
||||
union {
|
||||
union
|
||||
{
|
||||
ALADPCMWaveInfo adpcmWave;
|
||||
ALRAWWaveInfo rawWave;
|
||||
} waveInfo;
|
||||
|
||||
@@ -11,12 +11,18 @@
|
||||
#ifdef AVOID_UB
|
||||
typedef struct OSThread_ListHead_s
|
||||
{
|
||||
/*0x00*/ struct OSThread_s *next;
|
||||
/*0x04*/ OSPri priority;
|
||||
/*0x08*/ struct OSThread_s *queue;
|
||||
/*0x0C*/ struct OSThread_s *tlnext;
|
||||
/*0x10*/ struct OSThread_s *unk10;
|
||||
/*0x14*/ u32 unk14;
|
||||
/*0x00*/
|
||||
struct OSThread_s *next;
|
||||
/*0x04*/
|
||||
OSPri priority;
|
||||
/*0x08*/
|
||||
struct OSThread_s *queue;
|
||||
/*0x0C*/
|
||||
struct OSThread_s *tlnext;
|
||||
/*0x10*/
|
||||
struct OSThread_s *unk10;
|
||||
/*0x14*/
|
||||
u32 unk14;
|
||||
} OSThread_ListHead;
|
||||
|
||||
// Now fix the symbols to the new one.
|
||||
@@ -46,12 +52,14 @@ extern u32 D_80365E00[15];
|
||||
extern u32 D_80365E3C;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
u32 initialized; // probably something like initialized?
|
||||
OSThread *mgrThread;
|
||||
OSMesgQueue *cmdQueue;
|
||||
OSMesgQueue *eventQueue;
|
||||
OSMesgQueue *accessQueue;
|
||||
|
||||
s32 (*dma_func)(s32, u32, void *, size_t);
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
s32 (*edma_func)(OSPiHandle *, s32, u32, void *, size_t);
|
||||
@@ -61,39 +69,74 @@ typedef struct {
|
||||
} OSMgrArgs;
|
||||
|
||||
s32 __osDisableInt(void);
|
||||
|
||||
void __osRestoreInt(s32);
|
||||
|
||||
void __osEnqueueAndYield(OSThread **);
|
||||
|
||||
void __osDequeueThread(OSThread **, OSThread *);
|
||||
|
||||
void __osEnqueueThread(OSThread **, OSThread *);
|
||||
|
||||
OSThread *__osPopThread(OSThread **);
|
||||
|
||||
s32 __osSiRawStartDma(s32, void *);
|
||||
|
||||
void __osSiCreateAccessQueue(void);
|
||||
|
||||
void __osSiGetAccess(void);
|
||||
|
||||
void __osSiRelAccess(void);
|
||||
|
||||
u32 __osProbeTLB(void *);
|
||||
|
||||
void __osPiCreateAccessQueue(void);
|
||||
|
||||
void __osPiGetAccess(void);
|
||||
|
||||
void __osSetSR(u32);
|
||||
|
||||
u32 __osGetSR(void);
|
||||
|
||||
void __osSetFpcCsr(u32);
|
||||
|
||||
s32 __osSiRawReadIo(void *, u32 *);
|
||||
|
||||
s32 __osSiRawWriteIo(void *, u32);
|
||||
|
||||
s32 osPiRawReadIo(u32 a0, u32 *a1);
|
||||
|
||||
void __osSpSetStatus(u32);
|
||||
|
||||
u32 __osSpGetStatus(void);
|
||||
|
||||
s32 __osSpSetPc(void *);
|
||||
|
||||
s32 __osSpDeviceBusy(void);
|
||||
|
||||
s32 __osSiDeviceBusy(void);
|
||||
|
||||
s32 __osSpRawStartDma(u32 dir, void *sp_ptr, void *dram_ptr, size_t size);
|
||||
|
||||
void __osViInit(void);
|
||||
|
||||
OSViContext *__osViGetCurrentContext(void);
|
||||
|
||||
OSViContext *__osViGetCurrentContext2(void);
|
||||
|
||||
void __osViSwapContext(void);
|
||||
|
||||
void __osSetTimerIntr(u64);
|
||||
|
||||
u64 __osInsertTimer(OSTimer *);
|
||||
|
||||
void __osSetCompare(u32);
|
||||
|
||||
s32 __osAiDeviceBusy(void);
|
||||
|
||||
void __osDispatchThread(void);
|
||||
|
||||
u32 __osGetCause(void);
|
||||
|
||||
s32 __osAtomicDec(u32 *);
|
||||
#endif
|
||||
|
||||
+375
-178
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user