mirror of
https://github.com/izzy2lost/Ghostship.git
synced 2026-06-19 01:17:03 -07:00
Implemented clang-format among move to use the oot one
This commit is contained in:
@@ -4,31 +4,31 @@
|
||||
#ifdef VERSION_SH
|
||||
|
||||
struct ReverbSettingsEU sReverbSettings[] = {
|
||||
{0x01, 0x30, 0x2fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{0x01, 0x28, 0x47ff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{0x01, 0x40, 0x2fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{0x01, 0x38, 0x3fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{0x01, 0x30, 0x4fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{0x01, 0x28, 0x37ff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000},
|
||||
{ 0x01, 0x30, 0x2fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
{ 0x01, 0x28, 0x47ff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
{ 0x01, 0x40, 0x2fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
{ 0x01, 0x38, 0x3fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
{ 0x01, 0x30, 0x4fff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
{ 0x01, 0x28, 0x37ff, 0x0000, 0x0000, -1, 0x3000, 0x0000, 0x0000 },
|
||||
};
|
||||
|
||||
struct AudioSessionSettingsEU gAudioSessionPresets[] = {
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
|
||||
0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
|
||||
0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[2], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
|
||||
0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[3], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
|
||||
0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[4], 0x7fff, 0x0000, 0x00003a40, 0x00006d00,
|
||||
0x00000000, 0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00004000, 0x00006e00,
|
||||
0x00000000, 0x00003f00, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00004100, 0x00006e00,
|
||||
0x00000000, 0x00004400, 0x00002a80, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x14, 0x01, 0x00, &sReverbSettings[5], 0x7fff, 0x0000, 0x00003500, 0x00006280,
|
||||
0x00000000, 0x00004000, 0x00001b00, 0x00000000, 0x00000000, 0x00000000 }
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, 0x00000000,
|
||||
0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, 0x00000000,
|
||||
0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[2], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, 0x00000000,
|
||||
0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[3], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, 0x00000000,
|
||||
0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[4], 0x7fff, 0x0000, 0x00003a40, 0x00006d00, 0x00000000,
|
||||
0x00004400, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[0], 0x7fff, 0x0000, 0x00004000, 0x00006e00, 0x00000000,
|
||||
0x00003f00, 0x00002a00, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x10, 0x01, 0x00, &sReverbSettings[1], 0x7fff, 0x0000, 0x00004100, 0x00006e00, 0x00000000,
|
||||
0x00004400, 0x00002a80, 0x00000000, 0x00000000, 0x00000000 },
|
||||
{ 0x00007d00, 0x01, 0x14, 0x01, 0x00, &sReverbSettings[5], 0x7fff, 0x0000, 0x00003500, 0x00006280, 0x00000000,
|
||||
0x00004000, 0x00001b00, 0x00000000, 0x00000000, 0x00000000 }
|
||||
};
|
||||
|
||||
s8 gUnusedCount80333EE8 = UNUSED_COUNT_80333EE8;
|
||||
|
||||
@@ -19,23 +19,23 @@
|
||||
#define PORTAMENTO_MODE_4 4
|
||||
#define PORTAMENTO_MODE_5 5
|
||||
|
||||
void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
struct SequencePlayer *seqPlayer; // sp5C, t4
|
||||
struct SequenceChannel *seqChannel; // sp58, t5
|
||||
struct M64ScriptState *state;
|
||||
struct Portamento *portamento;
|
||||
struct AudioBankSound *sound;
|
||||
struct Instrument *instrument;
|
||||
struct Drum *drum;
|
||||
void seq_channel_layer_process_script(struct SequenceChannelLayer* layer) {
|
||||
struct SequencePlayer* seqPlayer; // sp5C, t4
|
||||
struct SequenceChannel* seqChannel; // sp58, t5
|
||||
struct M64ScriptState* state;
|
||||
struct Portamento* portamento;
|
||||
struct AudioBankSound* sound;
|
||||
struct Instrument* instrument;
|
||||
struct Drum* drum;
|
||||
s32 temp_a0_5;
|
||||
u8 sameSound;
|
||||
u8 cmd; // a0 sp3E, EU s2
|
||||
u8 cmdSemitone; // sp3D, t0
|
||||
u16 sp3A; // t2, a0, a1
|
||||
f32 tuning; // f0
|
||||
s32 vel; // sp30, t3
|
||||
s32 usedSemitone; // a1
|
||||
f32 freqScale; // sp28, f0
|
||||
u8 cmd; // a0 sp3E, EU s2
|
||||
u8 cmdSemitone; // sp3D, t0
|
||||
u16 sp3A; // t2, a0, a1
|
||||
f32 tuning; // f0
|
||||
s32 vel; // sp30, t3
|
||||
s32 usedSemitone; // a1
|
||||
f32 freqScale; // sp28, f0
|
||||
f32 sp24;
|
||||
f32 temp_f12;
|
||||
f32 temp_f2;
|
||||
@@ -50,7 +50,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
|
||||
sameSound = TRUE;
|
||||
|
||||
if(layer == NULL) {
|
||||
if (layer == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -80,10 +80,10 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
seqPlayer = (*seqChannel).seqPlayer;
|
||||
for (;;) {
|
||||
state = &layer->scriptState;
|
||||
// M64_READ_U8(state, cmd);
|
||||
// cmd = m64_read_u8(state);
|
||||
// M64_READ_U8(state, cmd);
|
||||
// cmd = m64_read_u8(state);
|
||||
{
|
||||
u8 *_ptr_pc;
|
||||
u8* _ptr_pc;
|
||||
_ptr_pc = (*state).pc++;
|
||||
cmd = *_ptr_pc;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
if (cmd == 0xc1) {
|
||||
layer->velocitySquare = (f32)(temp_a0_5 * temp_a0_5);
|
||||
} else {
|
||||
layer->pan = (f32) temp_a0_5 / US_FLOAT(128.0);
|
||||
layer->pan = (f32)temp_a0_5 / US_FLOAT(128.0);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -150,7 +150,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
case 0xc4: // layer_somethingon
|
||||
case 0xc5: // layer_somethingoff
|
||||
//! copt needs a ternary:
|
||||
//layer->continuousNotes = (cmd == 0xc4) ? TRUE : FALSE;
|
||||
// layer->continuousNotes = (cmd == 0xc4) ? TRUE : FALSE;
|
||||
{
|
||||
u8 setting;
|
||||
if (cmd == 0xc4) {
|
||||
@@ -244,7 +244,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
layer->noteDuration = *((*state).pc++);
|
||||
goto l1090;
|
||||
}
|
||||
l1090:
|
||||
l1090:
|
||||
cmdSemitone = cmd - (cmd & 0xc0);
|
||||
layer->velocitySquare = vel * vel;
|
||||
} else {
|
||||
@@ -262,17 +262,15 @@ l1090:
|
||||
sp3A = layer->playPercentage;
|
||||
goto l1138;
|
||||
}
|
||||
l1138:
|
||||
l1138:
|
||||
|
||||
cmdSemitone = cmd - (cmd & 0xc0);
|
||||
}
|
||||
|
||||
layer->delay = sp3A;
|
||||
layer->duration = layer->noteDuration * sp3A / 256;
|
||||
if ((seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_STOP_NOTES) != 0)
|
||||
|| seqChannel->stopSomething2
|
||||
|| !seqChannel->hasInstrument
|
||||
) {
|
||||
if ((seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_STOP_NOTES) != 0) ||
|
||||
seqChannel->stopSomething2 || !seqChannel->hasInstrument) {
|
||||
layer->stopSomething = TRUE;
|
||||
} else {
|
||||
if (seqChannel->instOrWave == 0) { // drum
|
||||
@@ -319,9 +317,9 @@ l1138:
|
||||
}
|
||||
|
||||
if (instrument != NULL) {
|
||||
sound = (u8) usedSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound
|
||||
: (u8) usedSemitone <= instrument->normalRangeHi ?
|
||||
&instrument->normalNotesSound : &instrument->highNotesSound;
|
||||
sound = (u8)usedSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound
|
||||
: (u8)usedSemitone <= instrument->normalRangeHi ? &instrument->normalNotesSound
|
||||
: &instrument->highNotesSound;
|
||||
|
||||
sameSound = (sound == (*layer).sound);
|
||||
layer->sound = sound;
|
||||
@@ -349,12 +347,12 @@ l1138:
|
||||
sp24 = temp_f12;
|
||||
goto l13cc;
|
||||
}
|
||||
l13cc:
|
||||
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));
|
||||
portamento->speed = US_FLOAT(32512.0) * FLOAT_CAST((*seqPlayer).tempo) /
|
||||
((f32)(*layer).delay * (f32)gTempoInternalToExternal *
|
||||
FLOAT_CAST((*layer).portamentoTime));
|
||||
} else {
|
||||
portamento->speed = US_FLOAT(127.0) / FLOAT_CAST((*layer).portamentoTime);
|
||||
}
|
||||
@@ -364,9 +362,9 @@ l13cc:
|
||||
layer->portamentoTargetNote = cmdSemitone;
|
||||
}
|
||||
} else if (instrument != NULL) {
|
||||
sound = cmdSemitone < instrument->normalRangeLo ?
|
||||
&instrument->lowNotesSound : cmdSemitone <= instrument->normalRangeHi ?
|
||||
&instrument->normalNotesSound : &instrument->highNotesSound;
|
||||
sound = cmdSemitone < instrument->normalRangeLo ? &instrument->lowNotesSound
|
||||
: cmdSemitone <= instrument->normalRangeHi ? &instrument->normalNotesSound
|
||||
: &instrument->highNotesSound;
|
||||
|
||||
sameSound = (sound == (*layer).sound);
|
||||
layer->sound = sound;
|
||||
|
||||
+403
-573
File diff suppressed because it is too large
Load Diff
+44
-45
@@ -13,7 +13,7 @@
|
||||
#endif
|
||||
|
||||
#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;
|
||||
|
||||
@@ -34,7 +34,7 @@ void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 reca
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
struct SequenceChannelLayer *layer = seqChannel->layers[i];
|
||||
struct SequenceChannelLayer* layer = seqChannel->layers[i];
|
||||
if (layer != NULL && layer->enabled && layer->note != NULL) {
|
||||
if (layer->notePropertiesNeedInit) {
|
||||
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
|
||||
@@ -57,13 +57,14 @@ 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)) * seqChannel->seqPlayer->gameVolume;
|
||||
channelVolume = (seqChannel->volume * (seqChannel->volumeScale * seqChannel->seqPlayer->fadeVolume)) *
|
||||
seqChannel->seqPlayer->gameVolume;
|
||||
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) {
|
||||
channelVolume *= seqChannel->seqPlayer->muteVolumeScale;
|
||||
}
|
||||
@@ -72,8 +73,9 @@ static void sequence_channel_process_sound(struct SequenceChannel *seqChannel) {
|
||||
panLayerWeight = US_FLOAT(1.0) - seqChannel->panChannelWeight;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
struct SequenceChannelLayer *layer = seqChannel->layers[i];
|
||||
if (layer != NULL && layer->enabled && layer->note != NULL || (layer != NULL && seqChannel->seqPlayer->recalculateVolume)) {
|
||||
struct SequenceChannelLayer* layer = seqChannel->layers[i];
|
||||
if (layer != NULL && layer->enabled && layer->note != NULL ||
|
||||
(layer != NULL && seqChannel->seqPlayer->recalculateVolume)) {
|
||||
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
|
||||
layer->noteVelocity = layer->velocitySquare * channelVolume;
|
||||
layer->notePan = (layer->pan * panLayerWeight) + panFromChannel;
|
||||
@@ -82,7 +84,7 @@ 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) {
|
||||
@@ -130,8 +132,7 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
|
||||
|
||||
// Process channels
|
||||
for (i = 0; i < CHANNELS_MAX; i++) {
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[i]) == TRUE
|
||||
&& seqPlayer->channels[i]->enabled == TRUE) {
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[i]) == TRUE && seqPlayer->channels[i]->enabled == TRUE) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
sequence_channel_process_sound(seqPlayer->channels[i], seqPlayer->recalculateVolume);
|
||||
#else
|
||||
@@ -145,7 +146,7 @@ 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)
|
||||
@@ -155,7 +156,7 @@ f32 get_portamento_freq_scale(struct Portamento *p) {
|
||||
#endif
|
||||
|
||||
p->cur += p->speed;
|
||||
v0 = (u32) p->cur;
|
||||
v0 = (u32)p->cur;
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (v0 > 127)
|
||||
@@ -175,14 +176,14 @@ 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;
|
||||
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;
|
||||
|
||||
@@ -208,7 +209,7 @@ 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;
|
||||
@@ -220,30 +221,29 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
|
||||
|
||||
if (vib->extentChangeTimer) {
|
||||
if (vib->extentChangeTimer == 1) {
|
||||
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
|
||||
vib->extent = (s32)vib->seqChannel->vibratoExtentTarget;
|
||||
} else {
|
||||
vib->extent +=
|
||||
((s32) vib->seqChannel->vibratoExtentTarget - vib->extent) / (s32) vib->extentChangeTimer;
|
||||
vib->extent += ((s32)vib->seqChannel->vibratoExtentTarget - vib->extent) / (s32)vib->extentChangeTimer;
|
||||
}
|
||||
|
||||
vib->extentChangeTimer--;
|
||||
} else if (vib->seqChannel->vibratoExtentTarget != (s32) vib->extent) {
|
||||
} else if (vib->seqChannel->vibratoExtentTarget != (s32)vib->extent) {
|
||||
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0) {
|
||||
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
|
||||
vib->extent = (s32)vib->seqChannel->vibratoExtentTarget;
|
||||
}
|
||||
}
|
||||
|
||||
if (vib->rateChangeTimer) {
|
||||
if (vib->rateChangeTimer == 1) {
|
||||
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
|
||||
vib->rate = (s32)vib->seqChannel->vibratoRateTarget;
|
||||
} else {
|
||||
vib->rate += ((s32) vib->seqChannel->vibratoRateTarget - vib->rate) / (s32) vib->rateChangeTimer;
|
||||
vib->rate += ((s32)vib->seqChannel->vibratoRateTarget - vib->rate) / (s32)vib->rateChangeTimer;
|
||||
}
|
||||
|
||||
vib->rateChangeTimer--;
|
||||
} else if (vib->seqChannel->vibratoRateTarget != (s32) vib->rate) {
|
||||
} else if (vib->seqChannel->vibratoRateTarget != (s32)vib->rate) {
|
||||
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0) {
|
||||
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
|
||||
vib->rate = (s32)vib->seqChannel->vibratoRateTarget;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
|
||||
}
|
||||
|
||||
pitchChange = get_vibrato_pitch_change(vib);
|
||||
extent = (f32) vib->extent / US_FLOAT(4096.0);
|
||||
extent = (f32)vib->extent / US_FLOAT(4096.0);
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
result = US_FLOAT(1.0) + extent * (gPitchBendFrequencyScale[pitchChange + 128] - US_FLOAT(1.0));
|
||||
@@ -262,7 +262,7 @@ 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) {
|
||||
note->portamentoFreqScale = get_portamento_freq_scale(¬e->portamento);
|
||||
@@ -280,11 +280,11 @@ void note_vibrato_update(struct Note *note) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void note_vibrato_init(struct Note *note) {
|
||||
struct VibratoState *vib;
|
||||
UNUSED struct SequenceChannel *seqChannel;
|
||||
void note_vibrato_init(struct Note* note) {
|
||||
struct VibratoState* vib;
|
||||
UNUSED struct SequenceChannel* seqChannel;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
struct NotePlaybackState *seqPlayerState = (struct NotePlaybackState *) ¬e->priority;
|
||||
struct NotePlaybackState* seqPlayerState = (struct NotePlaybackState*)¬e->priority;
|
||||
#endif
|
||||
|
||||
note->vibratoFreqScale = 1.0f;
|
||||
@@ -293,9 +293,8 @@ void note_vibrato_init(struct Note *note) {
|
||||
vib = ¬e->vibratoState;
|
||||
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
if (note->parentLayer->seqChannel->vibratoExtentStart == 0
|
||||
&& note->parentLayer->seqChannel->vibratoExtentTarget == 0
|
||||
&& note->parentLayer->portamento.mode == 0) {
|
||||
if (note->parentLayer->seqChannel->vibratoExtentStart == 0 &&
|
||||
note->parentLayer->seqChannel->vibratoExtentTarget == 0 && note->parentLayer->portamento.mode == 0) {
|
||||
vib->active = FALSE;
|
||||
return;
|
||||
}
|
||||
@@ -343,7 +342,7 @@ 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)
|
||||
@@ -363,9 +362,9 @@ 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)
|
||||
@@ -398,7 +397,7 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
// fallthrough
|
||||
|
||||
#ifdef VERSION_SH
|
||||
restart:
|
||||
restart:
|
||||
#endif
|
||||
case ADSR_STATE_LOOP:
|
||||
adsr->delay = BSWAP16(adsr->envelope[adsr->envIndex].delay);
|
||||
@@ -425,17 +424,17 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
if (adsr->delay >= 4) {
|
||||
adsr->delay = adsr->delay * gAudioBufferParameters.updatesPerFrame
|
||||
#ifdef VERSION_SH
|
||||
/ gAudioBufferParameters.presetUnk4
|
||||
/ gAudioBufferParameters.presetUnk4
|
||||
#endif
|
||||
/ 4;
|
||||
/ 4;
|
||||
}
|
||||
#if defined(VERSION_SH)
|
||||
if (adsr->delay == 0) {
|
||||
adsr->delay = 1;
|
||||
}
|
||||
adsr->target = (f32) BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
|
||||
adsr->target = (f32)BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0f;
|
||||
#elif defined(VERSION_EU)
|
||||
adsr->target = (f32) BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0;
|
||||
adsr->target = (f32)BSWAP16(adsr->envelope[adsr->envIndex].arg) / 32767.0;
|
||||
#endif
|
||||
adsr->target = adsr->target * adsr->target;
|
||||
adsr->velocity = (adsr->target - adsr->current) / adsr->delay;
|
||||
@@ -498,10 +497,10 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
}
|
||||
#else
|
||||
if (adsr->current < 100) {
|
||||
adsr->current = 0;
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
}
|
||||
if (adsr->current < 100) {
|
||||
adsr->current = 0;
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
+185
-218
File diff suppressed because it is too large
Load Diff
+157
-151
File diff suppressed because it is too large
Load Diff
+47
-56
@@ -14,19 +14,19 @@
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
|
||||
struct SharedDma {
|
||||
/*0x0*/ u8 *buffer; // target, points to pre-allocated buffer
|
||||
/*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
|
||||
}; // size = 0x10
|
||||
|
||||
// EU only
|
||||
void port_eu_init(void);
|
||||
|
||||
struct Note *gNotes;
|
||||
struct Note* gNotes;
|
||||
|
||||
struct SequencePlayer gSequencePlayers[SEQUENCE_PLAYERS];
|
||||
struct SequenceChannel gSequenceChannels[SEQUENCE_CHANNELS];
|
||||
@@ -46,8 +46,8 @@ OSIoMesg gAudioDmaIoMesg;
|
||||
|
||||
struct SharedDma sSampleDmas[0x60];
|
||||
u32 gSampleDmaNumListItems; // sh: 0x803503D4
|
||||
u32 sSampleDmaListSize1; // sh: 0x803503D8
|
||||
u32 sUnused80226B40; // set to 0, never read, sh: 0x803503DC
|
||||
u32 sSampleDmaListSize1; // sh: 0x803503D8
|
||||
u32 sUnused80226B40; // set to 0, never read, sh: 0x803503DC
|
||||
|
||||
// Circular buffer of DMAs with ttl = 0. tail <= head, wrapping around mod 256.
|
||||
u8 sSampleDmaReuseQueue1[256];
|
||||
@@ -90,17 +90,16 @@ s8 gAudioUpdatesPerFrame;
|
||||
extern u64 gAudioGlobalsStartMarker;
|
||||
extern u64 gAudioGlobalsEndMarker;
|
||||
|
||||
ALSeqFile *get_audio_file_header(s32 arg0);
|
||||
ALSeqFile* get_audio_file_header(s32 arg0);
|
||||
|
||||
#include <stdio.h>
|
||||
/**
|
||||
* 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) {
|
||||
eu_stubbed_printf_3("Romcopy %x -> %x ,size %x\n", devAddr, vAddr, nbytes);
|
||||
osInvalDCache(vAddr, nbytes);
|
||||
osPiStartDma(&gAudioDmaIoMesg, OS_MESG_PRI_HIGH, OS_READ, devAddr, vAddr, nbytes,
|
||||
&gAudioDmaMesgQueue);
|
||||
osPiStartDma(&gAudioDmaIoMesg, OS_MESG_PRI_HIGH, OS_READ, devAddr, vAddr, nbytes, &gAudioDmaMesgQueue);
|
||||
osRecvMesg(&gAudioDmaMesgQueue, NULL, OS_MESG_NOBLOCK);
|
||||
eu_stubbed_printf_0("Romcopyend\n");
|
||||
}
|
||||
@@ -127,7 +126,7 @@ 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);
|
||||
}
|
||||
@@ -136,7 +135,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
|
||||
@@ -154,30 +154,30 @@ void decrease_sample_dma_ttls() {
|
||||
|
||||
for (i = 0; i < sSampleDmaListSize1; i++) {
|
||||
#if defined(VERSION_EU)
|
||||
struct SharedDma *temp = &sSampleDmas[i];
|
||||
struct SharedDma* temp = &sSampleDmas[i];
|
||||
#else
|
||||
struct SharedDma *temp = sSampleDmas + i;
|
||||
struct SharedDma* temp = sSampleDmas + i;
|
||||
#endif
|
||||
if (temp->ttl != 0) {
|
||||
temp->ttl--;
|
||||
if (temp->ttl == 0) {
|
||||
temp->reuseIndex = sSampleDmaReuseQueueHead1;
|
||||
sSampleDmaReuseQueue1[sSampleDmaReuseQueueHead1++] = (u8) i;
|
||||
sSampleDmaReuseQueue1[sSampleDmaReuseQueueHead1++] = (u8)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
|
||||
#if defined(VERSION_EU)
|
||||
struct SharedDma *temp = &sSampleDmas[i];
|
||||
struct SharedDma* temp = &sSampleDmas[i];
|
||||
#else
|
||||
struct SharedDma *temp = sSampleDmas + i;
|
||||
struct SharedDma* temp = sSampleDmas + i;
|
||||
#endif
|
||||
if (temp->ttl != 0) {
|
||||
temp->ttl--;
|
||||
if (temp->ttl == 0) {
|
||||
temp->reuseIndex = sSampleDmaReuseQueueHead2;
|
||||
sSampleDmaReuseQueue2[sSampleDmaReuseQueueHead2++] = (u8) i;
|
||||
sSampleDmaReuseQueue2[sSampleDmaReuseQueueHead2++] = (u8)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,9 +185,9 @@ 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;
|
||||
struct SharedDma* dma;
|
||||
uintptr_t dmaDevAddr;
|
||||
u32 transfer;
|
||||
u32 i;
|
||||
@@ -199,21 +199,19 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
for (i = sSampleDmaListSize1; i < gSampleDmaNumListItems; i++) {
|
||||
dma = &sSampleDmas[i];
|
||||
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) {
|
||||
// Move the DMA out of the reuse queue, by swapping it with the
|
||||
// tail, and then incrementing the tail.
|
||||
if (dma->reuseIndex != sSampleDmaReuseQueueTail2) {
|
||||
sSampleDmaReuseQueue2[dma->reuseIndex] =
|
||||
sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
|
||||
sSampleDmas[sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2]].reuseIndex =
|
||||
dma->reuseIndex;
|
||||
sSampleDmaReuseQueue2[dma->reuseIndex] = sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2];
|
||||
sSampleDmas[sSampleDmaReuseQueue2[sSampleDmaReuseQueueTail2]].reuseIndex = dma->reuseIndex;
|
||||
}
|
||||
sSampleDmaReuseQueueTail2++;
|
||||
}
|
||||
dma->ttl = 60;
|
||||
*dmaIndexRef = (u8) i;
|
||||
*dmaIndexRef = (u8)i;
|
||||
return &dma->buffer[(devAddr - dma->source)];
|
||||
}
|
||||
}
|
||||
@@ -234,20 +232,17 @@ 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) {
|
||||
// Move the DMA out of the reuse queue, by swapping it with the
|
||||
// tail, and then incrementing the tail.
|
||||
if (dma->reuseIndex != sSampleDmaReuseQueueTail1) {
|
||||
#if defined(VERSION_EU)
|
||||
if (1) {
|
||||
}
|
||||
if (1) {}
|
||||
#endif
|
||||
sSampleDmaReuseQueue1[dma->reuseIndex] =
|
||||
sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1];
|
||||
sSampleDmas[sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1]].reuseIndex =
|
||||
dma->reuseIndex;
|
||||
sSampleDmaReuseQueue1[dma->reuseIndex] = sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1];
|
||||
sSampleDmas[sSampleDmaReuseQueue1[sSampleDmaReuseQueueTail1]].reuseIndex = dma->reuseIndex;
|
||||
}
|
||||
sSampleDmaReuseQueueTail1++;
|
||||
}
|
||||
@@ -277,20 +272,19 @@ void *dma_sample_data(uintptr_t devAddr, u32 size, s32 arg2, u8 *dmaIndexRef) {
|
||||
osInvalDCache(dma->buffer, transfer);
|
||||
#endif
|
||||
#if defined(VERSION_EU)
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount++], OS_MESG_PRI_NORMAL, OS_READ, dmaDevAddr,
|
||||
dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
*dmaIndexRef = dmaIndex;
|
||||
return (devAddr - dmaDevAddr) + dma->buffer;
|
||||
#else
|
||||
gCurrAudioFrameDmaCount++;
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount - 1], OS_MESG_PRI_NORMAL,
|
||||
OS_READ, dmaDevAddr, dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
osPiStartDma(&gCurrAudioFrameDmaIoMesgBufs[gCurrAudioFrameDmaCount - 1], OS_MESG_PRI_NORMAL, OS_READ, dmaDevAddr,
|
||||
dma->buffer, transfer, &gCurrAudioFrameDmaQueue);
|
||||
*dmaIndexRef = dmaIndex;
|
||||
return (devAddr - dmaDevAddr) + dma->buffer;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void init_sample_dma_buffers(UNUSED s32 arg0) {
|
||||
s32 i;
|
||||
#if defined(VERSION_EU)
|
||||
@@ -330,9 +324,9 @@ void init_sample_dma_buffers(UNUSED s32 arg0) {
|
||||
out1:
|
||||
#endif
|
||||
|
||||
for (i = 0; (u32) i < gSampleDmaNumListItems; i++) {
|
||||
sSampleDmaReuseQueue1[i] = (u8) i;
|
||||
sSampleDmas[i].reuseIndex = (u8) i;
|
||||
for (i = 0; (u32)i < gSampleDmaNumListItems; i++) {
|
||||
sSampleDmaReuseQueue1[i] = (u8)i;
|
||||
sSampleDmas[i].reuseIndex = (u8)i;
|
||||
}
|
||||
|
||||
for (j = gSampleDmaNumListItems; j < 0x100; j++) {
|
||||
@@ -340,7 +334,7 @@ out1:
|
||||
}
|
||||
|
||||
sSampleDmaReuseQueueTail1 = 0;
|
||||
sSampleDmaReuseQueueHead1 = (u8) gSampleDmaNumListItems;
|
||||
sSampleDmaReuseQueueHead1 = (u8)gSampleDmaNumListItems;
|
||||
sSampleDmaListSize1 = gSampleDmaNumListItems;
|
||||
|
||||
#if defined(VERSION_EU)
|
||||
@@ -368,8 +362,8 @@ out1:
|
||||
out2:
|
||||
#endif
|
||||
|
||||
for (i = sSampleDmaListSize1; (u32) i < gSampleDmaNumListItems; i++) {
|
||||
sSampleDmaReuseQueue2[i - sSampleDmaListSize1] = (u8) i;
|
||||
for (i = sSampleDmaListSize1; (u32)i < gSampleDmaNumListItems; i++) {
|
||||
sSampleDmaReuseQueue2[i - sSampleDmaListSize1] = (u8)i;
|
||||
sSampleDmas[i].reuseIndex = (u8)(i - sSampleDmaListSize1);
|
||||
}
|
||||
|
||||
@@ -390,11 +384,11 @@ uint8_t* load_sequence_immediate(s32 seqId, s32 arg1) {
|
||||
return GameEngine_LoadSequence(seqId)->data;
|
||||
}
|
||||
|
||||
struct CtlEntry* load_banks_immediate(s32 seqId, u8 *outDefaultBank) {
|
||||
struct CtlEntry* load_banks_immediate(s32 seqId, u8* outDefaultBank) {
|
||||
u32 bankId;
|
||||
struct AudioSequenceData *seqData = GameEngine_LoadSequence(seqId);
|
||||
struct CtlEntry *output;
|
||||
for(size_t i = 0; i < seqData->bankCount; i++) {
|
||||
struct AudioSequenceData* seqData = GameEngine_LoadSequence(seqId);
|
||||
struct CtlEntry* output;
|
||||
for (size_t i = 0; i < seqData->bankCount; i++) {
|
||||
output = GameEngine_LoadBank(bankId = seqData->banks[i]);
|
||||
}
|
||||
*outDefaultBank = bankId;
|
||||
@@ -438,7 +432,7 @@ void load_sequence(u32 player, u32 seqId, s32 loadAsync) {
|
||||
}
|
||||
|
||||
void load_sequence_internal(u32 player, u32 seqId, s32 loadAsync) {
|
||||
struct SequencePlayer *seqPlayer = &gSequencePlayers[player];
|
||||
struct SequencePlayer* seqPlayer = &gSequencePlayers[player];
|
||||
|
||||
if (seqId >= gSequenceCount) {
|
||||
return;
|
||||
@@ -473,7 +467,7 @@ void audio_init() {
|
||||
s32 i, j;
|
||||
UNUSED s32 lim1; // lim1 unused in EU
|
||||
UNUSED u32 size;
|
||||
UNUSED u64 *ptr64;
|
||||
UNUSED u64* ptr64;
|
||||
UNUSED s32 pad2;
|
||||
|
||||
gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
|
||||
@@ -488,15 +482,13 @@ void audio_init() {
|
||||
memset(gAudioHeap, 0, gAudioHeapSize);
|
||||
#else
|
||||
for (i = 0; i < gAudioHeapSize / 8; i++) {
|
||||
((u64 *) gAudioHeap)[i] = 0;
|
||||
((u64*)gAudioHeap)[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
D_EU_802298D0 = 20.03042f;
|
||||
gRefreshRate = 50;
|
||||
port_eu_init();
|
||||
if (k) {
|
||||
}
|
||||
if (k) {}
|
||||
#endif
|
||||
|
||||
eu_stubbed_printf_1("AudioHeap is %x\n", gAudioHeapSize);
|
||||
@@ -513,8 +505,7 @@ void audio_init() {
|
||||
gAudioTasks[0].task.t.data_size = 0;
|
||||
gAudioTasks[1].task.t.data_size = 0;
|
||||
osCreateMesgQueue(&gAudioDmaMesgQueue, &gAudioDmaMesg, 1);
|
||||
osCreateMesgQueue(&gCurrAudioFrameDmaQueue, gCurrAudioFrameDmaMesgBufs,
|
||||
ARRAY_COUNT(gCurrAudioFrameDmaMesgBufs));
|
||||
osCreateMesgQueue(&gCurrAudioFrameDmaQueue, gCurrAudioFrameDmaMesgBufs, ARRAY_COUNT(gCurrAudioFrameDmaMesgBufs));
|
||||
gCurrAudioFrameDmaCount = 0;
|
||||
gSampleDmaNumListItems = 0;
|
||||
|
||||
@@ -523,7 +514,7 @@ void audio_init() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
+240
-251
File diff suppressed because it is too large
Load Diff
+253
-211
File diff suppressed because it is too large
Load Diff
+139
-144
File diff suppressed because it is too large
Load Diff
+28
-31
@@ -24,7 +24,7 @@ typedef s32 FadeT;
|
||||
|
||||
extern volatile u8 gAudioResetStatus;
|
||||
extern u8 gAudioResetPresetIdToLoad;
|
||||
extern OSMesgQueue *OSMesgQueues[];
|
||||
extern OSMesgQueue* OSMesgQueues[];
|
||||
extern struct EuAudioCmd sAudioCmd[0x100];
|
||||
|
||||
void func_8031D690(s32 player, FadeT fadeInTime);
|
||||
@@ -33,13 +33,13 @@ void decrease_sample_dma_ttls(void);
|
||||
s32 audio_shut_down_and_reset_step(void);
|
||||
void func_802ad7ec(u32);
|
||||
|
||||
struct SPTask *create_next_audio_frame_task(void) {
|
||||
struct SPTask* create_next_audio_frame_task(void) {
|
||||
u32 samplesRemainingInAI;
|
||||
s32 writtenCmds;
|
||||
s32 index;
|
||||
OSTask_t *task;
|
||||
OSTask_t* task;
|
||||
s32 flags;
|
||||
s16 *currAiBuffer;
|
||||
s16* currAiBuffer;
|
||||
s32 oldDmaCount;
|
||||
OSMesg sp30;
|
||||
OSMesg sp2C;
|
||||
@@ -50,7 +50,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
osSendMesg(OSMesgQueues[0], (OSMesg) gAudioFrameCount, 0);
|
||||
osSendMesg(OSMesgQueues[0], (OSMesg)gAudioFrameCount, 0);
|
||||
|
||||
gAudioTaskIndex ^= 1;
|
||||
gCurrAiBufferIndex++;
|
||||
@@ -70,14 +70,14 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
|
||||
decrease_sample_dma_ttls();
|
||||
if (osRecvMesg(OSMesgQueues[2], &sp30, 0) != -1) {
|
||||
gAudioResetPresetIdToLoad = (u8) (s32) sp30;
|
||||
gAudioResetPresetIdToLoad = (u8)(s32)sp30;
|
||||
gAudioResetStatus = 5;
|
||||
}
|
||||
|
||||
if (gAudioResetStatus != 0) {
|
||||
if (audio_shut_down_and_reset_step() == 0) {
|
||||
if (gAudioResetStatus == 0) {
|
||||
osSendMesg(OSMesgQueues[3], (OSMesg) (s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
||||
osSendMesg(OSMesgQueues[3], (OSMesg)(s32)gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -88,8 +88,10 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
index = gCurrAiBufferIndex;
|
||||
currAiBuffer = gAiBuffers[index];
|
||||
|
||||
gAiBufferLengths[index] = ((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI +
|
||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE;
|
||||
gAiBufferLengths[index] =
|
||||
((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI + EXTRA_BUFFERED_AI_SAMPLES_TARGET) &
|
||||
~0xf) +
|
||||
SAMPLES_TO_OVERPRODUCE;
|
||||
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
|
||||
gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength;
|
||||
}
|
||||
@@ -98,7 +100,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
|
||||
if (osRecvMesg(OSMesgQueues[1], &sp2C, OS_MESG_NOBLOCK) != -1) {
|
||||
func_802ad7ec((u32) sp2C);
|
||||
func_802ad7ec((u32)sp2C);
|
||||
}
|
||||
|
||||
flags = 0;
|
||||
@@ -114,7 +116,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
task->type = M_AUDTASK;
|
||||
task->flags = flags;
|
||||
task->ucode_boot = rspF3DBootStart;
|
||||
task->ucode_boot_size = (u8 *) rspF3DBootEnd - (u8 *) rspF3DBootStart;
|
||||
task->ucode_boot_size = (u8*)rspF3DBootEnd - (u8*)rspF3DBootStart;
|
||||
task->ucode = rspAspMainStart;
|
||||
task->ucode_data = rspAspMainDataStart;
|
||||
task->ucode_size = 0x800; // (this size is ignored)
|
||||
@@ -130,7 +132,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
return gAudioTask;
|
||||
}
|
||||
|
||||
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
void eu_process_audio_cmd(struct EuAudioCmd* cmd) {
|
||||
s32 i;
|
||||
|
||||
switch (cmd->u.s.op) {
|
||||
@@ -148,8 +150,7 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -177,7 +178,7 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
|
||||
const char undefportcmd[] = "Undefined Port Command %d\n";
|
||||
|
||||
extern OSMesgQueue *OSMesgQueues[];
|
||||
extern OSMesgQueue* OSMesgQueues[];
|
||||
extern u8 D_EU_80302010;
|
||||
extern u8 D_EU_80302014;
|
||||
extern OSMesg OSMesg0;
|
||||
@@ -192,7 +193,6 @@ void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime) {
|
||||
gSequencePlayers[player].fadeVelocity = -(gSequencePlayers[player].fadeVolume / fadeOutTime);
|
||||
gSequencePlayers[player].state = 2;
|
||||
gSequencePlayers[player].fadeRemainingFrames = fadeOutTime;
|
||||
|
||||
}
|
||||
|
||||
void func_8031D690(s32 player, FadeT fadeInTime) {
|
||||
@@ -214,19 +214,19 @@ void port_eu_init_queues(void) {
|
||||
osCreateMesgQueue(OSMesgQueues[3], &OSMesg3, 1);
|
||||
}
|
||||
|
||||
void func_802ad6f0(s32 arg0, s32 *arg1) {
|
||||
struct EuAudioCmd *cmd = &sAudioCmd[D_EU_80302010 & 0xff];
|
||||
void func_802ad6f0(s32 arg0, s32* arg1) {
|
||||
struct EuAudioCmd* cmd = &sAudioCmd[D_EU_80302010 & 0xff];
|
||||
cmd->u.first = arg0;
|
||||
cmd->u2.as_u32 = *arg1;
|
||||
D_EU_80302010++;
|
||||
}
|
||||
|
||||
void func_802ad728(u32 arg0, f32 arg1) {
|
||||
func_802ad6f0(arg0, (s32*) &arg1);
|
||||
func_802ad6f0(arg0, (s32*)&arg1);
|
||||
}
|
||||
|
||||
void func_802ad74c(u32 arg0, u32 arg1) {
|
||||
func_802ad6f0(arg0, (s32*) &arg1);
|
||||
func_802ad6f0(arg0, (s32*)&arg1);
|
||||
}
|
||||
|
||||
void func_802ad770(u32 arg0, s8 arg1) {
|
||||
@@ -235,29 +235,27 @@ void func_802ad770(u32 arg0, s8 arg1) {
|
||||
}
|
||||
|
||||
void func_802ad7a0(void) {
|
||||
osSendMesg(OSMesgQueues[1],
|
||||
(OSMesg)(u32)((D_EU_80302014 & 0xff) << 8 | (D_EU_80302010 & 0xff)),
|
||||
OS_MESG_NOBLOCK);
|
||||
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) {
|
||||
struct EuAudioCmd *cmd;
|
||||
struct SequencePlayer *seqPlayer;
|
||||
struct SequenceChannel *chan;
|
||||
struct EuAudioCmd* cmd;
|
||||
struct SequencePlayer* seqPlayer;
|
||||
struct SequenceChannel* chan;
|
||||
u8 end = arg0 & 0xff;
|
||||
u8 i = (arg0 >> 8) & 0xff;
|
||||
|
||||
for (;;) {
|
||||
if (i == end) break;
|
||||
if (i == end)
|
||||
break;
|
||||
cmd = &sAudioCmd[i++ & 0xff];
|
||||
|
||||
if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
|
||||
seqPlayer = &gSequencePlayers[cmd->u.s.arg1];
|
||||
if ((cmd->u.s.op & 0x80) != 0) {
|
||||
eu_process_audio_cmd(cmd);
|
||||
}
|
||||
else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
} else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x41:
|
||||
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
|
||||
@@ -276,8 +274,7 @@ void func_802ad7ec(u32 arg0) {
|
||||
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
|
||||
} else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
|
||||
chan = seqPlayer->channels[cmd->u.s.arg2];
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(chan)) {
|
||||
switch (cmd->u.s.op) {
|
||||
|
||||
+45
-49
@@ -14,22 +14,22 @@
|
||||
#define SAMPLES_TO_OVERPRODUCE 0x10
|
||||
|
||||
extern s32 D_SH_80314FC8;
|
||||
extern struct SPTask *D_SH_80314FCC;
|
||||
extern struct SPTask* D_SH_80314FCC;
|
||||
extern u8 D_SH_80315098;
|
||||
extern u8 D_SH_8031509C;
|
||||
extern OSMesgQueue *D_SH_80350F68;
|
||||
extern OSMesgQueue* D_SH_80350F68;
|
||||
|
||||
void func_8031D690(s32 playerIndex, s32 numFrames);
|
||||
void seq_player_fade_to_zero_volume(s32 arg0, s32 numFrames);
|
||||
void func_802ad7ec(u32 arg0);
|
||||
|
||||
struct SPTask *create_next_audio_frame_task(void) {
|
||||
struct SPTask* create_next_audio_frame_task(void) {
|
||||
u32 samplesRemainingInAI;
|
||||
s32 writtenCmds;
|
||||
s32 index;
|
||||
OSTask_t *task;
|
||||
OSTask_t* task;
|
||||
s32 flags;
|
||||
s16 *currAiBuffer;
|
||||
s16* currAiBuffer;
|
||||
s32 oldDmaCount;
|
||||
s32 sp38;
|
||||
s32 sp34;
|
||||
@@ -42,7 +42,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
osSendMesg(D_SH_80350F38, (OSMesg) gAudioFrameCount, OS_MESG_NOBLOCK);
|
||||
osSendMesg(D_SH_80350F38, (OSMesg)gAudioFrameCount, OS_MESG_NOBLOCK);
|
||||
|
||||
gAudioTaskIndex ^= 1;
|
||||
gCurrAiBufferIndex++;
|
||||
@@ -57,23 +57,22 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
|
||||
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 (osRecvMesg(D_SH_80350F88, (OSMesg*)&sp38, OS_MESG_NOBLOCK) != -1) {
|
||||
if (gAudioResetStatus == 0) {
|
||||
gAudioResetStatus = 5;
|
||||
}
|
||||
gAudioResetPresetIdToLoad = (u8) sp38;
|
||||
gAudioResetPresetIdToLoad = (u8)sp38;
|
||||
}
|
||||
|
||||
if (gAudioResetStatus != 0) {
|
||||
if (audio_shut_down_and_reset_step() == 0) {
|
||||
if (gAudioResetStatus == 0) {
|
||||
osSendMesg(D_SH_80350FA8, (OSMesg) (s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
||||
osSendMesg(D_SH_80350FA8, (OSMesg)(s32)gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
||||
}
|
||||
D_SH_80314FCC = 0;
|
||||
return NULL;
|
||||
@@ -87,12 +86,14 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
|
||||
gAudioTask = &gAudioTasks[gAudioTaskIndex];
|
||||
gAudioCmd = (u64 *) gAudioCmdBuffers[gAudioTaskIndex];
|
||||
gAudioCmd = (u64*)gAudioCmdBuffers[gAudioTaskIndex];
|
||||
index = gCurrAiBufferIndex;
|
||||
currAiBuffer = gAiBuffers[index];
|
||||
|
||||
gAiBufferLengths[index] = (s16) ((((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI) +
|
||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) & ~0xf) + SAMPLES_TO_OVERPRODUCE);
|
||||
gAiBufferLengths[index] = (s16)((((gAudioBufferParameters.samplesPerFrameTarget - samplesRemainingInAI) +
|
||||
EXTRA_BUFFERED_AI_SAMPLES_TARGET) &
|
||||
~0xf) +
|
||||
SAMPLES_TO_OVERPRODUCE);
|
||||
if (gAiBufferLengths[index] < gAudioBufferParameters.minAiBufferLength) {
|
||||
gAiBufferLengths[index] = gAudioBufferParameters.minAiBufferLength;
|
||||
}
|
||||
@@ -100,16 +101,16 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
gAiBufferLengths[index] = gAudioBufferParameters.maxAiBufferLength;
|
||||
}
|
||||
|
||||
if (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1) {
|
||||
if (osRecvMesg(D_SH_80350F68, (OSMesg*)&sp34, 0) != -1) {
|
||||
do {
|
||||
func_802ad7ec(sp34);
|
||||
} while (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1);
|
||||
} while (osRecvMesg(D_SH_80350F68, (OSMesg*)&sp34, 0) != -1);
|
||||
}
|
||||
|
||||
flags = 0;
|
||||
gAudioCmd = synthesis_execute(gAudioCmd, &writtenCmds, currAiBuffer, gAiBufferLengths[index]);
|
||||
gAudioRandom = (u32) (osGetCount() * (gAudioRandom + gAudioFrameCount));
|
||||
gAudioRandom = (u32) (gAiBuffers[index][gAudioFrameCount & 0xFF] + gAudioRandom);
|
||||
gAudioRandom = (u32)(osGetCount() * (gAudioRandom + gAudioFrameCount));
|
||||
gAudioRandom = (u32)(gAiBuffers[index][gAudioFrameCount & 0xFF] + gAudioRandom);
|
||||
|
||||
index = gAudioTaskIndex;
|
||||
gAudioTask->msgqueue = NULL;
|
||||
@@ -119,7 +120,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
task->type = M_AUDTASK;
|
||||
task->flags = flags;
|
||||
task->ucode_boot = rspF3DBootStart;
|
||||
task->ucode_boot_size = (u8 *) rspF3DStart - (u8 *) rspF3DBootStart;
|
||||
task->ucode_boot_size = (u8*)rspF3DStart - (u8*)rspF3DBootStart;
|
||||
task->ucode = rspAspMainStart;
|
||||
task->ucode_data = rspAspMainDataStart;
|
||||
task->ucode_size = 0x1000;
|
||||
@@ -146,10 +147,10 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
void eu_process_audio_cmd(struct EuAudioCmd* cmd) {
|
||||
s32 i;
|
||||
struct Note *note;
|
||||
struct NoteSubEu *sub;
|
||||
struct Note* note;
|
||||
struct NoteSubEu* sub;
|
||||
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x81:
|
||||
@@ -166,8 +167,7 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -224,7 +224,7 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
}
|
||||
|
||||
void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime) {
|
||||
struct SequencePlayer *player;
|
||||
struct SequencePlayer* player;
|
||||
|
||||
if (fadeOutTime == 0) {
|
||||
fadeOutTime = 1;
|
||||
@@ -232,11 +232,11 @@ void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime) {
|
||||
player = &gSequencePlayers[arg0];
|
||||
player->state = 2;
|
||||
player->fadeRemainingFrames = fadeOutTime;
|
||||
player->fadeVelocity = -(player->fadeVolume / (f32) fadeOutTime);
|
||||
player->fadeVelocity = -(player->fadeVolume / (f32)fadeOutTime);
|
||||
}
|
||||
|
||||
void func_8031D690(s32 playerIndex, s32 fadeInTime) {
|
||||
struct SequencePlayer *player;
|
||||
struct SequencePlayer* player;
|
||||
|
||||
if (fadeInTime != 0) {
|
||||
player = &gSequencePlayers[playerIndex];
|
||||
@@ -262,8 +262,8 @@ void port_eu_init_queues(void) {
|
||||
}
|
||||
|
||||
extern struct EuAudioCmd sAudioCmd[0x100];
|
||||
void func_802ad6f0(s32 arg0, s32 *arg1) {
|
||||
struct EuAudioCmd *cmd = &sAudioCmd[D_SH_80350F18 & 0xff];
|
||||
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++;
|
||||
@@ -273,11 +273,11 @@ void func_802ad6f0(s32 arg0, s32 *arg1) {
|
||||
}
|
||||
|
||||
void func_802ad728(u32 arg0, f32 arg1) {
|
||||
func_802ad6f0(arg0, (s32 *) &arg1);
|
||||
func_802ad6f0(arg0, (s32*)&arg1);
|
||||
}
|
||||
|
||||
void func_802ad74c(u32 arg0, u32 arg1) {
|
||||
func_802ad6f0(arg0, (s32 *) &arg1);
|
||||
func_802ad6f0(arg0, (s32*)&arg1);
|
||||
}
|
||||
|
||||
void func_802ad770(u32 arg0, s8 arg1) {
|
||||
@@ -304,9 +304,9 @@ void func_sh_802f6540(void) {
|
||||
}
|
||||
|
||||
void func_802ad7ec(u32 arg0) {
|
||||
struct EuAudioCmd *cmd;
|
||||
struct SequencePlayer *seqPlayer;
|
||||
struct SequenceChannel *chan;
|
||||
struct EuAudioCmd* cmd;
|
||||
struct SequencePlayer* seqPlayer;
|
||||
struct SequenceChannel* chan;
|
||||
u8 end;
|
||||
|
||||
UNUSED static char shindouDebugPrint134[] = "Continue Port\n";
|
||||
@@ -333,16 +333,13 @@ void func_802ad7ec(u32 arg0) {
|
||||
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) {
|
||||
eu_process_audio_cmd(cmd);
|
||||
}
|
||||
else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
} else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x41:
|
||||
if (seqPlayer->fadeVolumeScale != cmd->u2.as_f32) {
|
||||
@@ -367,8 +364,7 @@ void func_802ad7ec(u32 arg0) {
|
||||
seqPlayer->seqVariationEu[cmd->u.s.arg3] = cmd->u2.as_s8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
|
||||
} else if (seqPlayer->enabled != FALSE && cmd->u.s.arg2 < 0x10) {
|
||||
chan = seqPlayer->channels[cmd->u.s.arg2];
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(chan)) {
|
||||
switch (cmd->u.s.op) {
|
||||
@@ -421,18 +417,18 @@ void func_802ad7ec(u32 arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
u32 func_sh_802f6878(s32 *arg0) {
|
||||
u32 func_sh_802f6878(s32* arg0) {
|
||||
u32 sp1C;
|
||||
|
||||
if (osRecvMesg(&gUnkQueue1, (OSMesg *) &sp1C, 0) == -1) {
|
||||
if (osRecvMesg(&gUnkQueue1, (OSMesg*)&sp1C, 0) == -1) {
|
||||
*arg0 = 0;
|
||||
return 0U;
|
||||
}
|
||||
*arg0 = (s32) (sp1C & 0xFFFFFF);
|
||||
*arg0 = (s32)(sp1C & 0xFFFFFF);
|
||||
return sp1C >> 0x18;
|
||||
}
|
||||
|
||||
u8 *func_sh_802f68e0(u32 index, u32 *a1) {
|
||||
u8* func_sh_802f68e0(u32 index, u32* a1) {
|
||||
return func_sh_802f3220(index, a1);
|
||||
}
|
||||
|
||||
@@ -440,7 +436,7 @@ s32 func_sh_802f6900(void) {
|
||||
s32 ret;
|
||||
s32 sp18;
|
||||
|
||||
ret = osRecvMesg(D_SH_80350FA8, (OSMesg *) &sp18, 0);
|
||||
ret = osRecvMesg(D_SH_80350FA8, (OSMesg*)&sp18, 0);
|
||||
|
||||
if (ret == -1) {
|
||||
return 0;
|
||||
@@ -471,8 +467,8 @@ void func_sh_802f69cc(void) {
|
||||
}
|
||||
|
||||
s32 func_sh_802f6a08(s32 playerIndex, s32 channelIndex, s32 soundScriptIOIndex) {
|
||||
struct SequenceChannel *seqChannel;
|
||||
struct SequencePlayer *player;
|
||||
struct SequenceChannel* seqChannel;
|
||||
struct SequencePlayer* player;
|
||||
|
||||
player = &gSequencePlayers[playerIndex];
|
||||
if (player->enabled) {
|
||||
|
||||
+217
-224
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ char shindouDebugPrint1[] = "Terminate-Canceled Channel %d,Phase %d\n";
|
||||
char shindouDebugPrint2[] = "S->W\n";
|
||||
char shindouDebugPrint3[] = "W->S\n";
|
||||
char shindouDebugPrint4[] = "S-Resample Pitch %x (old %d -> delay %d)\n";
|
||||
s32 shindouDebugPrintPadding1[] = {0,0,0};
|
||||
s32 shindouDebugPrintPadding1[] = { 0, 0, 0 };
|
||||
|
||||
// heap.c
|
||||
char shindouDebugPrint5[] = "Warning:Kill Note %x \n";
|
||||
@@ -14,7 +14,7 @@ char shindouDebugPrint6[] = "Kill Voice %d (ID %d) %d\n";
|
||||
char shindouDebugPrint7[] = "Warning: Running Sequence's data disappear!\n";
|
||||
char shindouDebugPrint8[] = "%x %x %x\n";
|
||||
char shindouDebugPrint9[] = "Audio:Memory:Heap OverFlow : Not Allocate %d!\n";
|
||||
char shindouDebugPrint10[] = "%x %x %x\n"; // Again
|
||||
char shindouDebugPrint10[] = "%x %x %x\n"; // Again
|
||||
char shindouDebugPrint11[] = "Audio:Memory:Heap OverFlow : Not Allocate %d!\n"; // Again
|
||||
char shindouDebugPrint12[] = "Audio:Memory:DataHeap Not Allocate \n";
|
||||
char shindouDebugPrint13[] = "StayHeap Not Allocate %d\n";
|
||||
@@ -65,7 +65,7 @@ char shindouDebugPrint57[] = "Request--------Single-Stay, %d\n";
|
||||
char shindouDebugPrint58[] = "Try Kill %d \n";
|
||||
char shindouDebugPrint59[] = "Try Kill %x %x\n";
|
||||
char shindouDebugPrint60[] = "Try Kill %x %x %x\n";
|
||||
s32 shindouDebugPrintPadding[] = {0, 0, 0};
|
||||
s32 shindouDebugPrintPadding[] = { 0, 0, 0 };
|
||||
|
||||
// load.c
|
||||
char shindouDebugPrint61[] = "CAUTION:WAVE CACHE FULL %d";
|
||||
@@ -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 = NULL;
|
||||
char shindouDebugPrint130[] = "BGLOAD Start %d\n";
|
||||
char shindouDebugPrint131[] = "Error: OverFlow Your Request\n";
|
||||
char shindouDebugPrint132[] = "---AudioSending (%d->%d) \n";
|
||||
|
||||
+281
-266
File diff suppressed because it is too large
Load Diff
+156
-155
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,6 @@ ALIGNED8 struct SaveBuffer gSaveBuffer;
|
||||
// 0x190a0 bytes
|
||||
struct GfxPool gGfxPools[2];
|
||||
|
||||
|
||||
// Yield buffer for audio, 0x400 bytes. Stubbed out post-JP since the audio
|
||||
// task never yields.
|
||||
#ifdef VERSION_JP
|
||||
|
||||
@@ -15,23 +15,23 @@
|
||||
#include "surface_collision.h"
|
||||
|
||||
// Macros for retrieving arguments from behavior scripts.
|
||||
#define BHV_CMD_GET_1ST_U8(index) (u8)((gCurBhvCommand[index] >> 24) & 0xFF) // unused
|
||||
#define BHV_CMD_GET_2ND_U8(index) (u8)((gCurBhvCommand[index] >> 16) & 0xFF)
|
||||
#define BHV_CMD_GET_3RD_U8(index) (u8)((gCurBhvCommand[index] >> 8) & 0xFF)
|
||||
#define BHV_CMD_GET_4TH_U8(index) (u8)((gCurBhvCommand[index]) & 0xFF)
|
||||
#define BHV_CMD_GET_1ST_U8(index) (u8)((gCurBhvCommand[index] >> 24) & 0xFF) // unused
|
||||
#define BHV_CMD_GET_2ND_U8(index) (u8)((gCurBhvCommand[index] >> 16) & 0xFF)
|
||||
#define BHV_CMD_GET_3RD_U8(index) (u8)((gCurBhvCommand[index] >> 8) & 0xFF)
|
||||
#define BHV_CMD_GET_4TH_U8(index) (u8)((gCurBhvCommand[index]) & 0xFF)
|
||||
|
||||
#define BHV_CMD_GET_1ST_S16(index) (s16)(gCurBhvCommand[index] >> 16)
|
||||
#define BHV_CMD_GET_2ND_S16(index) (s16)(gCurBhvCommand[index] & 0xFFFF)
|
||||
|
||||
#define BHV_CMD_GET_U32(index) (u32)(gCurBhvCommand[index])
|
||||
#define BHV_CMD_GET_VPTR(index) (void *)(gCurBhvCommand[index])
|
||||
#define BHV_CMD_GET_U32(index) (u32)(gCurBhvCommand[index])
|
||||
#define BHV_CMD_GET_VPTR(index) (void*)(gCurBhvCommand[index])
|
||||
|
||||
#define BHV_CMD_GET_ADDR_OF_CMD(index) (uintptr_t)(&gCurBhvCommand[index])
|
||||
|
||||
static u16 gRandomSeed16;
|
||||
|
||||
// Unused function that directly jumps to a behavior command and resets the object's stack index.
|
||||
UNUSED static void goto_behavior_unused(const BehaviorScript *bhvAddr) {
|
||||
UNUSED static void goto_behavior_unused(const BehaviorScript* bhvAddr) {
|
||||
gCurBhvCommand = segmented_to_virtual(bhvAddr);
|
||||
gCurrentObject->bhvStackIndex = 0;
|
||||
}
|
||||
@@ -68,7 +68,7 @@ u16 random_u16(void) {
|
||||
// Generate a pseudorandom float in the range [0, 1).
|
||||
f32 random_float(void) {
|
||||
f32 rnd = random_u16();
|
||||
return rnd / (double) 0x10000;
|
||||
return rnd / (double)0x10000;
|
||||
}
|
||||
|
||||
// Return either -1 or 1 with a 50:50 chance.
|
||||
@@ -81,7 +81,7 @@ s32 random_sign(void) {
|
||||
}
|
||||
|
||||
// Update an object's graphical position and rotation to match its real position and rotation.
|
||||
void obj_update_gfx_pos_and_angle(struct Object *obj) {
|
||||
void obj_update_gfx_pos_and_angle(struct Object* obj) {
|
||||
obj->header.gfx.pos[0] = obj->oPosX;
|
||||
obj->header.gfx.pos[1] = obj->oPosY + obj->oGraphYOffset;
|
||||
obj->header.gfx.pos[2] = obj->oPosZ;
|
||||
@@ -155,9 +155,9 @@ static s32 bhv_cmd_set_model(void) {
|
||||
// Usage: SPAWN_CHILD(modelID, behavior)
|
||||
static s32 bhv_cmd_spawn_child(void) {
|
||||
u32 model = BHV_CMD_GET_U32(1);
|
||||
const BehaviorScript *behavior = BHV_CMD_GET_VPTR(2);
|
||||
const BehaviorScript* behavior = BHV_CMD_GET_VPTR(2);
|
||||
|
||||
struct Object *child = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
struct Object* child = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
obj_copy_pos_and_angle(child, gCurrentObject);
|
||||
|
||||
gCurBhvCommand += 3;
|
||||
@@ -168,9 +168,9 @@ static s32 bhv_cmd_spawn_child(void) {
|
||||
// Usage: SPAWN_OBJ(modelID, behavior)
|
||||
static s32 bhv_cmd_spawn_obj(void) {
|
||||
u32 model = BHV_CMD_GET_U32(1);
|
||||
const BehaviorScript *behavior = BHV_CMD_GET_VPTR(2);
|
||||
const BehaviorScript* behavior = BHV_CMD_GET_VPTR(2);
|
||||
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
struct Object* object = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
obj_copy_pos_and_angle(object, gCurrentObject);
|
||||
// TODO: Does this cmd need renaming? This line is the only difference between this and the above func.
|
||||
gCurrentObject->prevObj = object;
|
||||
@@ -184,9 +184,9 @@ static s32 bhv_cmd_spawn_obj(void) {
|
||||
static s32 bhv_cmd_spawn_child_with_param(void) {
|
||||
u32 bhvParam = BHV_CMD_GET_2ND_S16(0);
|
||||
u32 modelID = BHV_CMD_GET_U32(1);
|
||||
const BehaviorScript *behavior = BHV_CMD_GET_VPTR(2);
|
||||
const BehaviorScript* behavior = BHV_CMD_GET_VPTR(2);
|
||||
|
||||
struct Object *child = spawn_object_at_origin(gCurrentObject, 0, modelID, behavior);
|
||||
struct Object* child = spawn_object_at_origin(gCurrentObject, 0, modelID, behavior);
|
||||
obj_copy_pos_and_angle(child, gCurrentObject);
|
||||
child->oBehParams2ndByte = bhvParam;
|
||||
|
||||
@@ -216,7 +216,7 @@ static s32 bhv_cmd_break_unused(void) {
|
||||
// Command 0x02: Jumps to a new behavior command and stores the return address in the object's behavior stack.
|
||||
// Usage: CALL(addr)
|
||||
static s32 bhv_cmd_call(void) {
|
||||
const BehaviorScript *jumpAddress;
|
||||
const BehaviorScript* jumpAddress;
|
||||
gCurBhvCommand++;
|
||||
|
||||
cur_obj_bhv_stack_push(BHV_CMD_GET_ADDR_OF_CMD(1)); // Store address of the next bhv command in the stack.
|
||||
@@ -229,7 +229,7 @@ static s32 bhv_cmd_call(void) {
|
||||
// Command 0x03: Jumps back to the behavior command stored in the object's behavior stack. Used after CALL.
|
||||
// Usage: RETURN()
|
||||
static s32 bhv_cmd_return(void) {
|
||||
gCurBhvCommand = (const BehaviorScript *) cur_obj_bhv_stack_pop(); // Retrieve command address and jump to it.
|
||||
gCurBhvCommand = (const BehaviorScript*)cur_obj_bhv_stack_pop(); // Retrieve command address and jump to it.
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -242,7 +242,8 @@ static s32 bhv_cmd_delay(void) {
|
||||
gCurrentObject->bhvDelayTimer++; // Increment timer
|
||||
} else {
|
||||
gCurrentObject->bhvDelayTimer = 0;
|
||||
gCurBhvCommand++; // Delay ended, move to next bhv command (note: following commands will not execute until next frame)
|
||||
gCurBhvCommand++; // Delay ended, move to next bhv command (note: following commands will not execute until next
|
||||
// frame)
|
||||
}
|
||||
|
||||
return BHV_PROC_BREAK;
|
||||
@@ -267,7 +268,7 @@ static s32 bhv_cmd_delay_var(void) {
|
||||
// Command 0x04: Jumps to a new behavior script without saving anything.
|
||||
// Usage: GOTO(addr)
|
||||
static s32 bhv_cmd_goto(void) {
|
||||
gCurBhvCommand++; // Useless
|
||||
gCurBhvCommand++; // Useless
|
||||
gCurBhvCommand = segmented_to_virtual(BHV_CMD_GET_VPTR(0)); // Jump directly to address
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
@@ -279,7 +280,7 @@ static s32 bhv_cmd_begin_repeat_unused(void) {
|
||||
s32 count = BHV_CMD_GET_2ND_U8(0);
|
||||
|
||||
cur_obj_bhv_stack_push(BHV_CMD_GET_ADDR_OF_CMD(1)); // Store address of the first command of the loop in the stack
|
||||
cur_obj_bhv_stack_push(count); // Store repeat count in the stack too
|
||||
cur_obj_bhv_stack_push(count); // Store repeat count in the stack too
|
||||
|
||||
gCurBhvCommand++;
|
||||
return BHV_PROC_CONTINUE;
|
||||
@@ -291,7 +292,7 @@ static s32 bhv_cmd_begin_repeat(void) {
|
||||
s32 count = BHV_CMD_GET_2ND_S16(0);
|
||||
|
||||
cur_obj_bhv_stack_push(BHV_CMD_GET_ADDR_OF_CMD(1)); // Store address of the first command of the loop in the stack
|
||||
cur_obj_bhv_stack_push(count); // Store repeat count in the stack too
|
||||
cur_obj_bhv_stack_push(count); // Store repeat count in the stack too
|
||||
|
||||
gCurBhvCommand++;
|
||||
return BHV_PROC_CONTINUE;
|
||||
@@ -304,11 +305,11 @@ static s32 bhv_cmd_end_repeat(void) {
|
||||
count--;
|
||||
|
||||
if (count != 0) {
|
||||
gCurBhvCommand = (const BehaviorScript *) cur_obj_bhv_stack_pop(); // Jump back to the first command in the loop
|
||||
gCurBhvCommand = (const BehaviorScript*)cur_obj_bhv_stack_pop(); // Jump back to the first command in the loop
|
||||
// Save address and count to the stack again
|
||||
cur_obj_bhv_stack_push(BHV_CMD_GET_ADDR_OF_CMD(0));
|
||||
cur_obj_bhv_stack_push(count);
|
||||
} else { // Finished iterating over the loop
|
||||
} else { // Finished iterating over the loop
|
||||
cur_obj_bhv_stack_pop(); // Necessary to remove address from the stack
|
||||
gCurBhvCommand++;
|
||||
}
|
||||
@@ -317,18 +318,18 @@ static s32 bhv_cmd_end_repeat(void) {
|
||||
return BHV_PROC_BREAK;
|
||||
}
|
||||
|
||||
// Command 0x07: Also marks the end of a repeating loop, but continues executing commands following the loop on the same frame.
|
||||
// Usage: END_REPEAT_CONTINUE()
|
||||
// Command 0x07: Also marks the end of a repeating loop, but continues executing commands following the loop on the same
|
||||
// frame. Usage: END_REPEAT_CONTINUE()
|
||||
static s32 bhv_cmd_end_repeat_continue(void) {
|
||||
u32 count = cur_obj_bhv_stack_pop();
|
||||
count--;
|
||||
|
||||
if (count != 0) {
|
||||
gCurBhvCommand = (const BehaviorScript *) cur_obj_bhv_stack_pop(); // Jump back to the first command in the loop
|
||||
gCurBhvCommand = (const BehaviorScript*)cur_obj_bhv_stack_pop(); // Jump back to the first command in the loop
|
||||
// Save address and count to the stack again
|
||||
cur_obj_bhv_stack_push(BHV_CMD_GET_ADDR_OF_CMD(0));
|
||||
cur_obj_bhv_stack_push(count);
|
||||
} else { // Finished iterating over the loop
|
||||
} else { // Finished iterating over the loop
|
||||
cur_obj_bhv_stack_pop(); // Necessary to remove address from the stack
|
||||
gCurBhvCommand++;
|
||||
}
|
||||
@@ -349,8 +350,8 @@ static s32 bhv_cmd_begin_loop(void) {
|
||||
// Command 0x09: Marks the end of an infinite loop.
|
||||
// Usage: END_LOOP()
|
||||
static s32 bhv_cmd_end_loop(void) {
|
||||
gCurBhvCommand = (const BehaviorScript *) cur_obj_bhv_stack_pop(); // Jump back to the first command in the loop
|
||||
cur_obj_bhv_stack_push(BHV_CMD_GET_ADDR_OF_CMD(0)); // Save address to the stack again
|
||||
gCurBhvCommand = (const BehaviorScript*)cur_obj_bhv_stack_pop(); // Jump back to the first command in the loop
|
||||
cur_obj_bhv_stack_push(BHV_CMD_GET_ADDR_OF_CMD(0)); // Save address to the stack again
|
||||
|
||||
return BHV_PROC_BREAK;
|
||||
}
|
||||
@@ -428,8 +429,8 @@ static s32 bhv_cmd_set_random_int(void) {
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x13: Gets a random short, right shifts it the specified amount and adds min to it, then sets the specified field to that value.
|
||||
// Usage: SET_INT_RAND_RSHIFT(field, min, rshift)
|
||||
// Command 0x13: Gets a random short, right shifts it the specified amount and adds min to it, then sets the specified
|
||||
// field to that value. Usage: SET_INT_RAND_RSHIFT(field, min, rshift)
|
||||
static s32 bhv_cmd_set_int_rand_rshift(void) {
|
||||
u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
s32 min = BHV_CMD_GET_2ND_S16(0);
|
||||
@@ -454,8 +455,8 @@ static s32 bhv_cmd_add_random_float(void) {
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
// Command 0x17: Gets a random short, right shifts it the specified amount and adds min to it, then adds the value to the specified field. Unused.
|
||||
// Usage: ADD_INT_RAND_RSHIFT(field, min, rshift)
|
||||
// Command 0x17: Gets a random short, right shifts it the specified amount and adds min to it, then adds the value to
|
||||
// the specified field. Unused. Usage: ADD_INT_RAND_RSHIFT(field, min, rshift)
|
||||
static s32 bhv_cmd_add_int_rand_rshift(void) {
|
||||
u8 field = BHV_CMD_GET_2ND_U8(0);
|
||||
s32 min = BHV_CMD_GET_2ND_S16(0);
|
||||
@@ -535,7 +536,7 @@ static s32 bhv_cmd_load_animations(void) {
|
||||
// Usage: ANIMATE(animIndex)
|
||||
static s32 bhv_cmd_animate(void) {
|
||||
s32 animIndex = BHV_CMD_GET_2ND_U8(0);
|
||||
struct Animation **animations = gCurrentObject->oAnimations;
|
||||
struct Animation** animations = gCurrentObject->oAnimations;
|
||||
|
||||
geo_obj_init_animation(&gCurrentObject->header.gfx, &animations[animIndex]);
|
||||
|
||||
@@ -731,7 +732,7 @@ static s32 bhv_cmd_set_int_random_from_table(void) {
|
||||
// Command 0x2A: Loads collision data for the object.
|
||||
// Usage: LOAD_COLLISION_DATA(collisionData)
|
||||
static s32 bhv_cmd_load_collision_data(void) {
|
||||
u32 *collisionData = segmented_to_virtual(BHV_CMD_GET_VPTR(1));
|
||||
u32* collisionData = segmented_to_virtual(BHV_CMD_GET_VPTR(1));
|
||||
|
||||
gCurrentObject->collisionData = collisionData;
|
||||
|
||||
@@ -780,7 +781,6 @@ static s32 bhv_cmd_scale(void) {
|
||||
return BHV_PROC_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
// Command 0x30: Sets various parameters that the object uses for calculating physics.
|
||||
// Usage: SET_OBJ_PHYSICS(wallHitboxRadius, gravity, bounciness, dragStrength, friction, buoyancy, unused1, unused2)
|
||||
static s32 bhv_cmd_set_obj_physics(void) {
|
||||
@@ -817,7 +817,7 @@ static s32 bhv_cmd_parent_bit_clear(void) {
|
||||
// Command 0x37: Spawns a water droplet with the given parameters.
|
||||
// Usage: SPAWN_WATER_DROPLET(dropletParams)
|
||||
static s32 bhv_cmd_spawn_water_droplet(void) {
|
||||
struct WaterDropletParams *dropletParams = BHV_CMD_GET_VPTR(1);
|
||||
struct WaterDropletParams* dropletParams = BHV_CMD_GET_VPTR(1);
|
||||
|
||||
spawn_water_droplet(gCurrentObject, dropletParams);
|
||||
|
||||
@@ -903,7 +903,8 @@ static BhvCommandProc BehaviorCmdTable[] = {
|
||||
bhv_cmd_spawn_water_droplet,
|
||||
};
|
||||
|
||||
// Execute the behavior script of the current object, process the object flags, and other miscellaneous code for updating objects.
|
||||
// Execute the behavior script of the current object, process the object flags, and other miscellaneous code for
|
||||
// updating objects.
|
||||
void cur_obj_update(void) {
|
||||
UNUSED u8 filler[4];
|
||||
|
||||
@@ -927,8 +928,8 @@ void cur_obj_update(void) {
|
||||
|
||||
// If the object's action has changed, reset the action timer.
|
||||
if (gCurrentObject->oAction != gCurrentObject->oPrevAction) {
|
||||
(void) (gCurrentObject->oTimer = 0, gCurrentObject->oSubAction = 0,
|
||||
gCurrentObject->oPrevAction = gCurrentObject->oAction);
|
||||
(void)(gCurrentObject->oTimer = 0, gCurrentObject->oSubAction = 0,
|
||||
gCurrentObject->oPrevAction = gCurrentObject->oAction);
|
||||
}
|
||||
|
||||
// Execute the behavior script.
|
||||
@@ -948,12 +949,12 @@ void cur_obj_update(void) {
|
||||
|
||||
// If the object's action has changed, reset the action timer.
|
||||
if (gCurrentObject->oAction != gCurrentObject->oPrevAction) {
|
||||
(void) (gCurrentObject->oTimer = 0, gCurrentObject->oSubAction = 0,
|
||||
gCurrentObject->oPrevAction = gCurrentObject->oAction);
|
||||
(void)(gCurrentObject->oTimer = 0, gCurrentObject->oSubAction = 0,
|
||||
gCurrentObject->oPrevAction = gCurrentObject->oAction);
|
||||
}
|
||||
|
||||
// Execute various code based on object flags.
|
||||
objFlags = (s16) gCurrentObject->oFlags;
|
||||
objFlags = (s16)gCurrentObject->oFlags;
|
||||
|
||||
if (objFlags & OBJ_FLAG_SET_FACE_ANGLE_TO_MOVE_ANGLE) {
|
||||
obj_set_face_angle_to_move_angle(gCurrentObject);
|
||||
|
||||
+81
-84
@@ -47,8 +47,8 @@ GeoLayoutCommandProc GeoLayoutJumpTable[] = {
|
||||
};
|
||||
|
||||
struct GraphNode gObjParentGraphNode;
|
||||
struct AllocOnlyPool *gGraphNodePool;
|
||||
struct GraphNode *gCurRootGraphNode;
|
||||
struct AllocOnlyPool* gGraphNodePool;
|
||||
struct GraphNode* gCurRootGraphNode;
|
||||
|
||||
UNUSED s32 D_8038BCA8;
|
||||
|
||||
@@ -91,16 +91,16 @@ UNUSED s32 D_8038BCA8;
|
||||
* so everything was reduced to a single ObjectParent with a single group, and
|
||||
* camera switching was all done in one node. End of speculation.
|
||||
*/
|
||||
struct GraphNode **gGeoViews;
|
||||
struct GraphNode** gGeoViews;
|
||||
u16 gGeoNumViews; // length of gGeoViews array
|
||||
|
||||
uintptr_t gGeoLayoutStack[16];
|
||||
struct GraphNode *gCurGraphNodeList[32];
|
||||
struct GraphNode* gCurGraphNodeList[32];
|
||||
s16 gCurGraphNodeIndex;
|
||||
s16 gGeoLayoutStackIndex; // similar to SP register in MIPS
|
||||
UNUSED s16 D_8038BD7C;
|
||||
s16 gGeoLayoutReturnIndex; // similar to RA register in MIPS
|
||||
u8 *gGeoLayoutCommand;
|
||||
u8* gGeoLayoutCommand;
|
||||
|
||||
u32 unused_8038B894[3] = { 0 };
|
||||
|
||||
@@ -109,7 +109,7 @@ u32 unused_8038B894[3] = { 0 };
|
||||
cmd+0x04: void *branchTarget
|
||||
*/
|
||||
void geo_layout_cmd_branch_and_link(void) {
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t)(gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (gCurGraphNodeIndex << 16) + gGeoLayoutReturnIndex;
|
||||
gGeoLayoutReturnIndex = gGeoLayoutStackIndex;
|
||||
gGeoLayoutCommand = segmented_to_virtual(cur_geo_cmd_ptr(0x04));
|
||||
@@ -120,7 +120,7 @@ void geo_layout_cmd_end(void) {
|
||||
gGeoLayoutStackIndex = gGeoLayoutReturnIndex;
|
||||
gGeoLayoutReturnIndex = gGeoLayoutStack[--gGeoLayoutStackIndex] & 0xFFFF;
|
||||
gCurGraphNodeIndex = gGeoLayoutStack[gGeoLayoutStackIndex] >> 16;
|
||||
gGeoLayoutCommand = (u8 *) gGeoLayoutStack[--gGeoLayoutStackIndex];
|
||||
gGeoLayoutCommand = (u8*)gGeoLayoutStack[--gGeoLayoutStackIndex];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -129,7 +129,7 @@ void geo_layout_cmd_end(void) {
|
||||
*/
|
||||
void geo_layout_cmd_branch(void) {
|
||||
if (cur_geo_cmd_u8(0x01) == 1) {
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t) (gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
|
||||
gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t)(gGeoLayoutCommand + CMD_PROCESS_OFFSET(8));
|
||||
}
|
||||
|
||||
gGeoLayoutCommand = segmented_to_virtual(cur_geo_cmd_ptr(0x04));
|
||||
@@ -137,7 +137,7 @@ void geo_layout_cmd_branch(void) {
|
||||
|
||||
// 0x03: Return from branch
|
||||
void geo_layout_cmd_return(void) {
|
||||
gGeoLayoutCommand = (u8 *) gGeoLayoutStack[--gGeoLayoutStackIndex];
|
||||
gGeoLayoutCommand = (u8*)gGeoLayoutStack[--gGeoLayoutStackIndex];
|
||||
}
|
||||
|
||||
// 0x04: Open node
|
||||
@@ -203,7 +203,7 @@ void geo_layout_cmd_update_node_flags(void) {
|
||||
*/
|
||||
void geo_layout_cmd_node_root(void) {
|
||||
s32 i;
|
||||
struct GraphNodeRoot *graphNode;
|
||||
struct GraphNodeRoot* graphNode;
|
||||
|
||||
s16 x = cur_geo_cmd_s16(0x04);
|
||||
s16 y = cur_geo_cmd_s16(0x06);
|
||||
@@ -218,7 +218,7 @@ void geo_layout_cmd_node_root(void) {
|
||||
graphNode = init_graph_node_root(gGraphNodePool, NULL, 0, x, y, width, height);
|
||||
|
||||
// TODO: check type
|
||||
gGeoViews = alloc_only_pool_alloc(gGraphNodePool, gGeoNumViews * sizeof(struct GraphNode *));
|
||||
gGeoViews = alloc_only_pool_alloc(gGraphNodePool, gGeoNumViews * sizeof(struct GraphNode*));
|
||||
|
||||
graphNode->views = gGeoViews;
|
||||
graphNode->numViews = gGeoNumViews;
|
||||
@@ -237,8 +237,8 @@ void geo_layout_cmd_node_root(void) {
|
||||
cmd+0x02: s16 scale as a percentage (usually it's 100)
|
||||
*/
|
||||
void geo_layout_cmd_node_ortho_projection(void) {
|
||||
struct GraphNodeOrthoProjection *graphNode;
|
||||
f32 scale = (f32) cur_geo_cmd_s16(0x02) / 100.0f;
|
||||
struct GraphNodeOrthoProjection* graphNode;
|
||||
f32 scale = (f32)cur_geo_cmd_s16(0x02) / 100.0f;
|
||||
|
||||
graphNode = init_graph_node_ortho_projection(gGraphNodePool, NULL, scale);
|
||||
|
||||
@@ -256,7 +256,7 @@ void geo_layout_cmd_node_ortho_projection(void) {
|
||||
[cmd+0x08: GraphNodeFunc frustumFunc]
|
||||
*/
|
||||
void geo_layout_cmd_node_perspective(void) {
|
||||
struct GraphNodePerspective *graphNode;
|
||||
struct GraphNodePerspective* graphNode;
|
||||
GraphNodeFunc frustumFunc = NULL;
|
||||
s16 fov = cur_geo_cmd_s16(0x02);
|
||||
s16 near = cur_geo_cmd_s16(0x04);
|
||||
@@ -264,11 +264,11 @@ void geo_layout_cmd_node_perspective(void) {
|
||||
|
||||
if (cur_geo_cmd_u8(0x01) != 0) {
|
||||
// optional asm function
|
||||
frustumFunc = (GraphNodeFunc) cur_geo_cmd_ptr(0x08);
|
||||
frustumFunc = (GraphNodeFunc)cur_geo_cmd_ptr(0x08);
|
||||
gGeoLayoutCommand += 4 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_perspective(gGraphNodePool, NULL, (f32) fov, near, far, frustumFunc, 0);
|
||||
graphNode = init_graph_node_perspective(gGraphNodePool, NULL, (f32)fov, near, far, frustumFunc, 0);
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
@@ -280,7 +280,7 @@ void geo_layout_cmd_node_perspective(void) {
|
||||
additional functionality
|
||||
*/
|
||||
void geo_layout_cmd_node_start(void) {
|
||||
struct GraphNodeStart *graphNode;
|
||||
struct GraphNodeStart* graphNode;
|
||||
|
||||
graphNode = init_graph_node_start(gGraphNodePool, NULL);
|
||||
|
||||
@@ -299,7 +299,7 @@ void geo_layout_cmd_nop3(void) {
|
||||
cmd+0x01: u8 enableZBuffer (1 = on, 0 = off)
|
||||
*/
|
||||
void geo_layout_cmd_node_master_list(void) {
|
||||
struct GraphNodeMasterList *graphNode;
|
||||
struct GraphNodeMasterList* graphNode;
|
||||
|
||||
graphNode = init_graph_node_master_list(gGraphNodePool, NULL, cur_geo_cmd_u8(0x01));
|
||||
|
||||
@@ -315,7 +315,7 @@ void geo_layout_cmd_node_master_list(void) {
|
||||
cmd+0x06: s16 maxDistance
|
||||
*/
|
||||
void geo_layout_cmd_node_level_of_detail(void) {
|
||||
struct GraphNodeLevelOfDetail *graphNode;
|
||||
struct GraphNodeLevelOfDetail* graphNode;
|
||||
s16 minDistance = cur_geo_cmd_s16(0x04);
|
||||
s16 maxDistance = cur_geo_cmd_s16(0x06);
|
||||
|
||||
@@ -335,14 +335,13 @@ void geo_layout_cmd_node_level_of_detail(void) {
|
||||
Used for animating coins, blinking, color selection, etc.
|
||||
*/
|
||||
void geo_layout_cmd_node_switch_case(void) {
|
||||
struct GraphNodeSwitchCase *graphNode;
|
||||
struct GraphNodeSwitchCase* graphNode;
|
||||
|
||||
graphNode =
|
||||
init_graph_node_switch_case(gGraphNodePool, NULL,
|
||||
cur_geo_cmd_s16(0x02), // case which is initially selected
|
||||
0,
|
||||
(GraphNodeFunc) cur_geo_cmd_ptr(0x04), // case update function
|
||||
0);
|
||||
graphNode = init_graph_node_switch_case(gGraphNodePool, NULL,
|
||||
cur_geo_cmd_s16(0x02), // case which is initially selected
|
||||
0,
|
||||
(GraphNodeFunc)cur_geo_cmd_ptr(0x04), // case update function
|
||||
0);
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
@@ -361,16 +360,16 @@ void geo_layout_cmd_node_switch_case(void) {
|
||||
cmd+0x10: GraphNodeFunc func
|
||||
*/
|
||||
void geo_layout_cmd_node_camera(void) {
|
||||
struct GraphNodeCamera *graphNode;
|
||||
s16 *cmdPos = (s16 *) &gGeoLayoutCommand[4];
|
||||
struct GraphNodeCamera* graphNode;
|
||||
s16* cmdPos = (s16*)&gGeoLayoutCommand[4];
|
||||
|
||||
Vec3f pos, focus;
|
||||
|
||||
cmdPos = read_vec3s_to_vec3f(pos, cmdPos);
|
||||
cmdPos = read_vec3s_to_vec3f(focus, cmdPos);
|
||||
|
||||
graphNode = init_graph_node_camera(gGraphNodePool, NULL, pos, focus,
|
||||
(GraphNodeFunc) cur_geo_cmd_ptr(0x10), cur_geo_cmd_s16(0x02));
|
||||
graphNode = init_graph_node_camera(gGraphNodePool, NULL, pos, focus, (GraphNodeFunc)cur_geo_cmd_ptr(0x10),
|
||||
cur_geo_cmd_s16(0x02));
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
@@ -414,15 +413,15 @@ void geo_layout_cmd_node_camera(void) {
|
||||
[cmd+var: void *displayList]
|
||||
*/
|
||||
void geo_layout_cmd_node_translation_rotation(void) {
|
||||
struct GraphNodeTranslationRotation *graphNode;
|
||||
struct GraphNodeTranslationRotation* graphNode;
|
||||
|
||||
Vec3s translation, rotation;
|
||||
|
||||
void *displayList = NULL;
|
||||
void* displayList = NULL;
|
||||
s16 drawingLayer = 0;
|
||||
|
||||
s16 params = cur_geo_cmd_u8(0x01);
|
||||
s16 *cmdPos = (s16 *) gGeoLayoutCommand;
|
||||
s16* cmdPos = (s16*)gGeoLayoutCommand;
|
||||
|
||||
switch ((params & 0x70) >> 4) {
|
||||
case 0:
|
||||
@@ -445,16 +444,16 @@ void geo_layout_cmd_node_translation_rotation(void) {
|
||||
}
|
||||
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
displayList = *(void**)&cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode = init_graph_node_translation_rotation(gGraphNodePool, NULL, drawingLayer, displayList,
|
||||
translation, rotation);
|
||||
graphNode =
|
||||
init_graph_node_translation_rotation(gGraphNodePool, NULL, drawingLayer, displayList, translation, rotation);
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand = (u8 *) cmdPos;
|
||||
gGeoLayoutCommand = (u8*)cmdPos;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -468,29 +467,28 @@ void geo_layout_cmd_node_translation_rotation(void) {
|
||||
[cmd+0x08: void *displayList]
|
||||
*/
|
||||
void geo_layout_cmd_node_translation(void) {
|
||||
struct GraphNodeTranslation *graphNode;
|
||||
struct GraphNodeTranslation* graphNode;
|
||||
|
||||
Vec3s translation;
|
||||
|
||||
s16 drawingLayer = 0;
|
||||
s16 params = cur_geo_cmd_u8(0x01);
|
||||
s16 *cmdPos = (s16 *) gGeoLayoutCommand;
|
||||
void *displayList = NULL;
|
||||
s16* cmdPos = (s16*)gGeoLayoutCommand;
|
||||
void* displayList = NULL;
|
||||
|
||||
cmdPos = read_vec3s(translation, &cmdPos[1]);
|
||||
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
displayList = *(void**)&cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
|
||||
graphNode =
|
||||
init_graph_node_translation(gGraphNodePool, NULL, drawingLayer, displayList, translation);
|
||||
graphNode = init_graph_node_translation(gGraphNodePool, NULL, drawingLayer, displayList, translation);
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand = (u8 *) cmdPos;
|
||||
gGeoLayoutCommand = (u8*)cmdPos;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -504,19 +502,19 @@ void geo_layout_cmd_node_translation(void) {
|
||||
[cmd+0x08: void *displayList]
|
||||
*/
|
||||
void geo_layout_cmd_node_rotation(void) {
|
||||
struct GraphNodeRotation *graphNode;
|
||||
struct GraphNodeRotation* graphNode;
|
||||
|
||||
Vec3s sp2c;
|
||||
|
||||
s16 drawingLayer = 0;
|
||||
s16 params = cur_geo_cmd_u8(0x01);
|
||||
s16 *cmdPos = (s16 *) gGeoLayoutCommand;
|
||||
void *displayList = NULL;
|
||||
s16* cmdPos = (s16*)gGeoLayoutCommand;
|
||||
void* displayList = NULL;
|
||||
|
||||
cmdPos = read_vec3s_angle(sp2c, &cmdPos[1]);
|
||||
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
displayList = *(void**)&cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
@@ -525,7 +523,7 @@ void geo_layout_cmd_node_rotation(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand = (u8 *) cmdPos;
|
||||
gGeoLayoutCommand = (u8*)cmdPos;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -537,12 +535,12 @@ void geo_layout_cmd_node_rotation(void) {
|
||||
[cmd+0x08: void *displayList]
|
||||
*/
|
||||
void geo_layout_cmd_node_scale(void) {
|
||||
struct GraphNodeScale *graphNode;
|
||||
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 = NULL;
|
||||
|
||||
if (params & 0x80) {
|
||||
displayList = cur_geo_cmd_ptr(0x08);
|
||||
@@ -571,16 +569,15 @@ void geo_layout_cmd_nop2(void) {
|
||||
cmd+0x08: void *displayList
|
||||
*/
|
||||
void geo_layout_cmd_node_animated_part(void) {
|
||||
struct GraphNodeAnimatedPart *graphNode;
|
||||
struct GraphNodeAnimatedPart* graphNode;
|
||||
Vec3s translation;
|
||||
s32 drawingLayer = cur_geo_cmd_u8(0x01);
|
||||
void *displayList = cur_geo_cmd_ptr(0x08);
|
||||
s16 *cmdPos = (s16 *) gGeoLayoutCommand;
|
||||
void* displayList = cur_geo_cmd_ptr(0x08);
|
||||
s16* cmdPos = (s16*)gGeoLayoutCommand;
|
||||
|
||||
read_vec3s(translation, &cmdPos[1]);
|
||||
|
||||
graphNode =
|
||||
init_graph_node_animated_part(gGraphNodePool, NULL, drawingLayer, displayList, translation);
|
||||
graphNode = init_graph_node_animated_part(gGraphNodePool, NULL, drawingLayer, displayList, translation);
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
@@ -598,17 +595,17 @@ void geo_layout_cmd_node_animated_part(void) {
|
||||
[cmd+0x08: void *displayList]
|
||||
*/
|
||||
void geo_layout_cmd_node_billboard(void) {
|
||||
struct GraphNodeBillboard *graphNode;
|
||||
struct GraphNodeBillboard* graphNode;
|
||||
Vec3s translation;
|
||||
s16 drawingLayer = 0;
|
||||
s16 params = cur_geo_cmd_u8(0x01);
|
||||
s16 *cmdPos = (s16 *) gGeoLayoutCommand;
|
||||
void *displayList = NULL;
|
||||
s16* cmdPos = (s16*)gGeoLayoutCommand;
|
||||
void* displayList = NULL;
|
||||
|
||||
cmdPos = read_vec3s(translation, &cmdPos[1]);
|
||||
|
||||
if (params & 0x80) {
|
||||
displayList = *(void **) &cmdPos[0];
|
||||
displayList = *(void**)&cmdPos[0];
|
||||
drawingLayer = params & 0x0F;
|
||||
cmdPos += 2 << CMD_SIZE_SHIFT;
|
||||
}
|
||||
@@ -617,7 +614,7 @@ void geo_layout_cmd_node_billboard(void) {
|
||||
|
||||
register_scene_graph_node(&graphNode->node);
|
||||
|
||||
gGeoLayoutCommand = (u8 *) cmdPos;
|
||||
gGeoLayoutCommand = (u8*)cmdPos;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -626,9 +623,9 @@ void geo_layout_cmd_node_billboard(void) {
|
||||
cmd+0x04: void *displayList
|
||||
*/
|
||||
void geo_layout_cmd_node_display_list(void) {
|
||||
struct GraphNodeDisplayList *graphNode;
|
||||
struct GraphNodeDisplayList* graphNode;
|
||||
s32 drawingLayer = cur_geo_cmd_u8(0x01);
|
||||
void *displayList = cur_geo_cmd_ptr(0x04);
|
||||
void* displayList = cur_geo_cmd_ptr(0x04);
|
||||
|
||||
graphNode = init_graph_node_display_list(gGraphNodePool, NULL, drawingLayer, displayList);
|
||||
|
||||
@@ -644,7 +641,7 @@ void geo_layout_cmd_node_display_list(void) {
|
||||
cmd+0x06: s16 shadowScale
|
||||
*/
|
||||
void geo_layout_cmd_node_shadow(void) {
|
||||
struct GraphNodeShadow *graphNode;
|
||||
struct GraphNodeShadow* graphNode;
|
||||
u8 shadowType = cur_geo_cmd_s16(0x02);
|
||||
u8 shadowSolidity = cur_geo_cmd_s16(0x04);
|
||||
s16 shadowScale = cur_geo_cmd_s16(0x06);
|
||||
@@ -658,7 +655,7 @@ 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) {
|
||||
struct GraphNodeObjectParent *graphNode;
|
||||
struct GraphNodeObjectParent* graphNode;
|
||||
|
||||
graphNode = init_graph_node_object_parent(gGraphNodePool, NULL, &gObjParentGraphNode);
|
||||
|
||||
@@ -673,11 +670,11 @@ void geo_layout_cmd_node_object_parent(void) {
|
||||
cmd+0x04: GraphNodeFunc func
|
||||
*/
|
||||
void geo_layout_cmd_node_generated(void) {
|
||||
struct GraphNodeGenerated *graphNode;
|
||||
struct GraphNodeGenerated* graphNode;
|
||||
|
||||
graphNode = init_graph_node_generated(gGraphNodePool, NULL,
|
||||
(GraphNodeFunc) cur_geo_cmd_ptr(0x04), // asm function
|
||||
cur_geo_cmd_s16(0x02)); // parameter
|
||||
(GraphNodeFunc)cur_geo_cmd_ptr(0x04), // asm function
|
||||
cur_geo_cmd_s16(0x02)); // parameter
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
@@ -690,13 +687,13 @@ void geo_layout_cmd_node_generated(void) {
|
||||
cmd+0x04: GraphNodeFunc backgroundFunc
|
||||
*/
|
||||
void geo_layout_cmd_node_background(void) {
|
||||
struct GraphNodeBackground *graphNode;
|
||||
struct GraphNodeBackground* graphNode;
|
||||
|
||||
graphNode = init_graph_node_background(
|
||||
gGraphNodePool, NULL,
|
||||
cur_geo_cmd_s16(0x02), // background ID, or RGBA5551 color if asm function is null
|
||||
(GraphNodeFunc) cur_geo_cmd_ptr(0x04), // asm function
|
||||
0);
|
||||
graphNode =
|
||||
init_graph_node_background(gGraphNodePool, NULL,
|
||||
cur_geo_cmd_s16(0x02), // background ID, or RGBA5551 color if asm function is null
|
||||
(GraphNodeFunc)cur_geo_cmd_ptr(0x04), // asm function
|
||||
0);
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
@@ -714,15 +711,15 @@ void geo_layout_cmd_nop(void) {
|
||||
cmd+0x02: s16 index (of gGeoViews)
|
||||
*/
|
||||
void geo_layout_cmd_copy_view(void) {
|
||||
struct GraphNodeObjectParent *graphNode;
|
||||
struct GraphNode *node = NULL;
|
||||
struct GraphNodeObjectParent* graphNode;
|
||||
struct GraphNode* node = NULL;
|
||||
s16 index = cur_geo_cmd_s16(0x02);
|
||||
|
||||
if (index >= 0) {
|
||||
node = gGeoViews[index];
|
||||
|
||||
if (node->type == GRAPH_NODE_TYPE_OBJECT_PARENT) {
|
||||
node = ((struct GraphNodeObjectParent *) node)->sharedChild;
|
||||
node = ((struct GraphNodeObjectParent*)node)->sharedChild;
|
||||
} else {
|
||||
node = NULL;
|
||||
}
|
||||
@@ -744,13 +741,13 @@ void geo_layout_cmd_copy_view(void) {
|
||||
cmd+0x08: GraphNodeFunc nodeFunc
|
||||
*/
|
||||
void geo_layout_cmd_node_held_obj(void) {
|
||||
struct GraphNodeHeldObject *graphNode;
|
||||
struct GraphNodeHeldObject* graphNode;
|
||||
Vec3s offset;
|
||||
|
||||
read_vec3s(offset, (s16 *) &gGeoLayoutCommand[0x02]);
|
||||
read_vec3s(offset, (s16*)&gGeoLayoutCommand[0x02]);
|
||||
|
||||
graphNode = init_graph_node_held_object(
|
||||
gGraphNodePool, NULL, NULL, offset, (GraphNodeFunc) cur_geo_cmd_ptr(0x08), cur_geo_cmd_u8(0x01));
|
||||
graphNode = init_graph_node_held_object(gGraphNodePool, NULL, NULL, offset, (GraphNodeFunc)cur_geo_cmd_ptr(0x08),
|
||||
cur_geo_cmd_u8(0x01));
|
||||
|
||||
register_scene_graph_node(&graphNode->fnNode.node);
|
||||
|
||||
@@ -763,13 +760,13 @@ void geo_layout_cmd_node_held_obj(void) {
|
||||
cmd+0x02: s16 cullingRadius
|
||||
*/
|
||||
void geo_layout_cmd_node_culling_radius(void) {
|
||||
struct GraphNodeCullingRadius *graphNode;
|
||||
struct GraphNodeCullingRadius* graphNode;
|
||||
graphNode = init_graph_node_culling_radius(gGraphNodePool, NULL, 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;
|
||||
@@ -787,7 +784,7 @@ struct GraphNode *process_geo_layout(struct AllocOnlyPool *pool, void *segptr) {
|
||||
gGeoLayoutStack[0] = 0;
|
||||
gGeoLayoutStack[1] = 0;
|
||||
|
||||
if(GameEngine_OTRSigCheck(segptr) == 1){
|
||||
if (GameEngine_OTRSigCheck(segptr) == 1) {
|
||||
GeoLayoutExecute(segptr);
|
||||
} else {
|
||||
gGeoLayoutCommand = segmented_to_virtual(segptr);
|
||||
|
||||
+100
-121
@@ -22,7 +22,7 @@ UNUSED Vec3s gVec3sOne = { 1, 1, 1 };
|
||||
* 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;
|
||||
@@ -34,8 +34,8 @@ void init_scene_graph_node_links(struct GraphNode *graphNode, s32 type) {
|
||||
/**
|
||||
* 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) {
|
||||
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) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeRoot));
|
||||
}
|
||||
@@ -59,9 +59,8 @@ 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) {
|
||||
struct GraphNodeOrthoProjection*
|
||||
init_graph_node_ortho_projection(struct AllocOnlyPool* pool, struct GraphNodeOrthoProjection* graphNode, f32 scale) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeOrthoProjection));
|
||||
}
|
||||
@@ -77,10 +76,9 @@ 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 *graphNode,
|
||||
f32 fov, s16 near, s16 far,
|
||||
GraphNodeFunc nodeFunc, s32 unused) {
|
||||
struct GraphNodePerspective* init_graph_node_perspective(struct AllocOnlyPool* pool,
|
||||
struct GraphNodePerspective* graphNode, f32 fov, s16 near,
|
||||
s16 far, GraphNodeFunc nodeFunc, s32 unused) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodePerspective));
|
||||
}
|
||||
@@ -105,8 +103,7 @@ 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) {
|
||||
struct GraphNodeStart* init_graph_node_start(struct AllocOnlyPool* pool, struct GraphNodeStart* graphNode) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeStart));
|
||||
}
|
||||
@@ -121,8 +118,8 @@ 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) {
|
||||
struct GraphNodeMasterList* init_graph_node_master_list(struct AllocOnlyPool* pool,
|
||||
struct GraphNodeMasterList* graphNode, s16 on) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeMasterList));
|
||||
}
|
||||
@@ -141,9 +138,9 @@ 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 *graphNode,
|
||||
s16 minDistance, s16 maxDistance) {
|
||||
struct GraphNodeLevelOfDetail* init_graph_node_render_range(struct AllocOnlyPool* pool,
|
||||
struct GraphNodeLevelOfDetail* graphNode, s16 minDistance,
|
||||
s16 maxDistance) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeLevelOfDetail));
|
||||
}
|
||||
@@ -160,10 +157,9 @@ 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 *graphNode,
|
||||
s16 numCases, s16 selectedCase,
|
||||
GraphNodeFunc nodeFunc, s32 unused) {
|
||||
struct GraphNodeSwitchCase* init_graph_node_switch_case(struct AllocOnlyPool* pool,
|
||||
struct GraphNodeSwitchCase* graphNode, s16 numCases,
|
||||
s16 selectedCase, GraphNodeFunc nodeFunc, s32 unused) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeSwitchCase));
|
||||
}
|
||||
@@ -186,9 +182,8 @@ 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 *graphNode, f32 *pos,
|
||||
f32 *focus, GraphNodeFunc func, s32 mode) {
|
||||
struct GraphNodeCamera* init_graph_node_camera(struct AllocOnlyPool* pool, struct GraphNodeCamera* graphNode, f32* pos,
|
||||
f32* focus, GraphNodeFunc func, s32 mode) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeCamera));
|
||||
}
|
||||
@@ -213,10 +208,9 @@ 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 *graphNode, s32 drawingLayer,
|
||||
void *displayList, Vec3s translation, Vec3s rotation) {
|
||||
struct GraphNodeTranslationRotation*
|
||||
init_graph_node_translation_rotation(struct AllocOnlyPool* pool, struct GraphNodeTranslationRotation* graphNode,
|
||||
s32 drawingLayer, void* displayList, Vec3s translation, Vec3s rotation) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeTranslationRotation));
|
||||
}
|
||||
@@ -236,10 +230,9 @@ 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 *graphNode,
|
||||
s32 drawingLayer, void *displayList,
|
||||
Vec3s translation) {
|
||||
struct GraphNodeTranslation* init_graph_node_translation(struct AllocOnlyPool* pool,
|
||||
struct GraphNodeTranslation* graphNode, s32 drawingLayer,
|
||||
void* displayList, Vec3s translation) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeTranslation));
|
||||
}
|
||||
@@ -258,10 +251,8 @@ 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 *graphNode,
|
||||
s32 drawingLayer, void *displayList,
|
||||
Vec3s rotation) {
|
||||
struct GraphNodeRotation* init_graph_node_rotation(struct AllocOnlyPool* pool, struct GraphNodeRotation* graphNode,
|
||||
s32 drawingLayer, void* displayList, Vec3s rotation) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeRotation));
|
||||
}
|
||||
@@ -279,9 +270,8 @@ 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 *graphNode, s32 drawingLayer,
|
||||
void *displayList, f32 scale) {
|
||||
struct GraphNodeScale* init_graph_node_scale(struct AllocOnlyPool* pool, struct GraphNodeScale* graphNode,
|
||||
s32 drawingLayer, void* displayList, f32 scale) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeScale));
|
||||
}
|
||||
@@ -299,10 +289,8 @@ 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 *graphNode,
|
||||
struct GraphNode *sharedChild, Vec3f pos, Vec3s angle,
|
||||
Vec3f scale) {
|
||||
struct GraphNodeObject* init_graph_node_object(struct AllocOnlyPool* pool, struct GraphNodeObject* graphNode,
|
||||
struct GraphNode* sharedChild, Vec3f pos, Vec3s angle, Vec3f scale) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeObject));
|
||||
}
|
||||
@@ -329,9 +317,8 @@ 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 *graphNode,
|
||||
s16 radius) {
|
||||
struct GraphNodeCullingRadius* init_graph_node_culling_radius(struct AllocOnlyPool* pool,
|
||||
struct GraphNodeCullingRadius* graphNode, s16 radius) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeCullingRadius));
|
||||
}
|
||||
@@ -347,10 +334,9 @@ 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 *graphNode,
|
||||
s32 drawingLayer, void *displayList,
|
||||
Vec3s translation) {
|
||||
struct GraphNodeAnimatedPart* init_graph_node_animated_part(struct AllocOnlyPool* pool,
|
||||
struct GraphNodeAnimatedPart* graphNode, s32 drawingLayer,
|
||||
void* displayList, Vec3s translation) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeAnimatedPart));
|
||||
}
|
||||
@@ -368,10 +354,8 @@ 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 *graphNode,
|
||||
s32 drawingLayer, void *displayList,
|
||||
Vec3s translation) {
|
||||
struct GraphNodeBillboard* init_graph_node_billboard(struct AllocOnlyPool* pool, struct GraphNodeBillboard* graphNode,
|
||||
s32 drawingLayer, void* displayList, Vec3s translation) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeBillboard));
|
||||
}
|
||||
@@ -389,9 +373,9 @@ 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 *graphNode,
|
||||
s32 drawingLayer, void *displayList) {
|
||||
struct GraphNodeDisplayList* init_graph_node_display_list(struct AllocOnlyPool* pool,
|
||||
struct GraphNodeDisplayList* graphNode, s32 drawingLayer,
|
||||
void* displayList) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeDisplayList));
|
||||
}
|
||||
@@ -408,9 +392,8 @@ 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 *graphNode, s16 shadowScale,
|
||||
u8 shadowSolidity, u8 shadowType) {
|
||||
struct GraphNodeShadow* init_graph_node_shadow(struct AllocOnlyPool* pool, struct GraphNodeShadow* graphNode,
|
||||
s16 shadowScale, u8 shadowSolidity, u8 shadowType) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeShadow));
|
||||
}
|
||||
@@ -428,9 +411,9 @@ 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 *graphNode,
|
||||
struct GraphNode *sharedChild) {
|
||||
struct GraphNodeObjectParent* init_graph_node_object_parent(struct AllocOnlyPool* pool,
|
||||
struct GraphNodeObjectParent* graphNode,
|
||||
struct GraphNode* sharedChild) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeObjectParent));
|
||||
}
|
||||
@@ -446,8 +429,7 @@ 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 *graphNode,
|
||||
struct GraphNodeGenerated* init_graph_node_generated(struct AllocOnlyPool* pool, struct GraphNodeGenerated* graphNode,
|
||||
GraphNodeFunc gfxFunc, s32 parameter) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeGenerated));
|
||||
@@ -469,10 +451,9 @@ 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 *graphNode,
|
||||
u16 background, GraphNodeFunc backgroundFunc,
|
||||
s32 zero) {
|
||||
struct GraphNodeBackground* init_graph_node_background(struct AllocOnlyPool* pool,
|
||||
struct GraphNodeBackground* graphNode, u16 background,
|
||||
GraphNodeFunc backgroundFunc, s32 zero) {
|
||||
if (pool != NULL) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeBackground));
|
||||
}
|
||||
@@ -495,11 +476,9 @@ 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 *graphNode,
|
||||
struct Object *objNode,
|
||||
Vec3s translation,
|
||||
GraphNodeFunc nodeFunc, s32 playerIndex) {
|
||||
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) {
|
||||
graphNode = alloc_only_pool_alloc(pool, sizeof(struct GraphNodeHeldObject));
|
||||
}
|
||||
@@ -522,9 +501,9 @@ 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 *parentFirstChild;
|
||||
struct GraphNode *parentLastChild;
|
||||
struct GraphNode* geo_add_child(struct GraphNode* parent, struct GraphNode* childNode) {
|
||||
struct GraphNode* parentFirstChild;
|
||||
struct GraphNode* parentLastChild;
|
||||
|
||||
if (childNode != NULL) {
|
||||
childNode->parent = parent;
|
||||
@@ -552,9 +531,9 @@ 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 *parent;
|
||||
struct GraphNode **firstChild;
|
||||
struct GraphNode* geo_remove_child(struct GraphNode* graphNode) {
|
||||
struct GraphNode* parent;
|
||||
struct GraphNode** firstChild;
|
||||
|
||||
parent = graphNode->parent;
|
||||
firstChild = &parent->children;
|
||||
@@ -582,10 +561,10 @@ 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 *lastSibling;
|
||||
struct GraphNode *parent;
|
||||
struct GraphNode **firstChild;
|
||||
struct GraphNode* geo_make_first_child(struct GraphNode* newFirstChild) {
|
||||
struct GraphNode* lastSibling;
|
||||
struct GraphNode* parent;
|
||||
struct GraphNode** firstChild;
|
||||
|
||||
parent = newFirstChild->parent;
|
||||
firstChild = &parent->children;
|
||||
@@ -610,15 +589,15 @@ 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) {
|
||||
struct GraphNode **globalPtr;
|
||||
struct GraphNode *curNode;
|
||||
struct FnGraphNode *asFnNode;
|
||||
void geo_call_global_function_nodes_helper(struct GraphNode* graphNode, s32 callContext) {
|
||||
struct GraphNode** globalPtr;
|
||||
struct GraphNode* curNode;
|
||||
struct FnGraphNode* asFnNode;
|
||||
|
||||
curNode = graphNode;
|
||||
|
||||
do {
|
||||
asFnNode = (struct FnGraphNode *) curNode;
|
||||
asFnNode = (struct FnGraphNode*)curNode;
|
||||
|
||||
if (curNode->type & GRAPH_NODE_TYPE_FUNCTIONAL) {
|
||||
if (asFnNode->func != NULL) {
|
||||
@@ -629,16 +608,16 @@ void geo_call_global_function_nodes_helper(struct GraphNode *graphNode, s32 call
|
||||
if (curNode->children != NULL) {
|
||||
switch (curNode->type) {
|
||||
case GRAPH_NODE_TYPE_MASTER_LIST:
|
||||
globalPtr = (struct GraphNode **) &gCurGraphNodeMasterList;
|
||||
globalPtr = (struct GraphNode**)&gCurGraphNodeMasterList;
|
||||
break;
|
||||
case GRAPH_NODE_TYPE_PERSPECTIVE:
|
||||
globalPtr = (struct GraphNode **) &gCurGraphNodeCamFrustum;
|
||||
globalPtr = (struct GraphNode**)&gCurGraphNodeCamFrustum;
|
||||
break;
|
||||
case GRAPH_NODE_TYPE_CAMERA:
|
||||
globalPtr = (struct GraphNode **) &gCurGraphNodeCamera;
|
||||
globalPtr = (struct GraphNode**)&gCurGraphNodeCamera;
|
||||
break;
|
||||
case GRAPH_NODE_TYPE_OBJECT:
|
||||
globalPtr = (struct GraphNode **) &gCurGraphNodeObject;
|
||||
globalPtr = (struct GraphNode**)&gCurGraphNodeObject;
|
||||
break;
|
||||
default:
|
||||
globalPtr = NULL;
|
||||
@@ -665,9 +644,9 @@ 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) {
|
||||
void geo_call_global_function_nodes(struct GraphNode* graphNode, s32 callContext) {
|
||||
if (graphNode->flags & GRAPH_RENDER_ACTIVE) {
|
||||
gCurGraphNodeRoot = (struct GraphNodeRoot *) graphNode;
|
||||
gCurGraphNodeRoot = (struct GraphNodeRoot*)graphNode;
|
||||
|
||||
if (graphNode->children != NULL) {
|
||||
geo_call_global_function_nodes_helper(graphNode->children, callContext);
|
||||
@@ -680,7 +659,7 @@ 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) {
|
||||
void geo_reset_object_node(struct GraphNodeObject* graphNode) {
|
||||
init_graph_node_object(NULL, graphNode, 0, gVec3fZero, gVec3sZero, gVec3fOne);
|
||||
|
||||
geo_add_child(&gObjParentGraphNode, &graphNode->node);
|
||||
@@ -690,7 +669,7 @@ 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);
|
||||
@@ -709,13 +688,13 @@ 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);
|
||||
|
||||
graphNode->pos[0] = (f32) spawn->startPos[0];
|
||||
graphNode->pos[1] = (f32) spawn->startPos[1];
|
||||
graphNode->pos[2] = (f32) spawn->startPos[2];
|
||||
graphNode->pos[0] = (f32)spawn->startPos[0];
|
||||
graphNode->pos[1] = (f32)spawn->startPos[1];
|
||||
graphNode->pos[2] = (f32)spawn->startPos[2];
|
||||
|
||||
graphNode->areaIndex = spawn->areaIndex;
|
||||
graphNode->activeAreaIndex = spawn->activeAreaIndex;
|
||||
@@ -733,15 +712,15 @@ 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) {
|
||||
struct Animation **animSegmented = animPtrAddr;
|
||||
void geo_obj_init_animation(struct GraphNodeObject* graphNode, struct Animation** animPtrAddr) {
|
||||
struct Animation** animSegmented = animPtrAddr;
|
||||
|
||||
// TODO: In theory we dont need this but lets keep it
|
||||
if(animSegmented == NULL){
|
||||
if (animSegmented == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct Animation *anim = segmented_to_virtual(*animSegmented);
|
||||
struct Animation* anim = segmented_to_virtual(*animSegmented);
|
||||
|
||||
if (graphNode->animInfo.curAnim != anim) {
|
||||
graphNode->animInfo.curAnim = anim;
|
||||
@@ -754,9 +733,9 @@ 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) {
|
||||
struct Animation **animSegmented = animPtrAddr;
|
||||
struct Animation *anim = segmented_to_virtual(*animSegmented);
|
||||
void geo_obj_init_animation_accel(struct GraphNodeObject* graphNode, struct Animation** animPtrAddr, u32 animAccel) {
|
||||
struct Animation** animSegmented = animPtrAddr;
|
||||
struct Animation* anim = segmented_to_virtual(*animSegmented);
|
||||
|
||||
if (graphNode->animInfo.curAnim != anim) {
|
||||
graphNode->animInfo.curAnim = anim;
|
||||
@@ -776,7 +755,7 @@ 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]) {
|
||||
@@ -795,9 +774,9 @@ 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 = obj->curAnim;
|
||||
struct Animation* anim = obj->curAnim;
|
||||
|
||||
if (obj->animTimer == gAreaUpdateCounter || anim->flags & ANIM_FLAG_2) {
|
||||
if (accelAssist != NULL) {
|
||||
@@ -852,12 +831,12 @@ 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) {
|
||||
struct Animation *animation = obj->animInfo.curAnim;
|
||||
void geo_retreive_animation_translation(struct GraphNodeObject* obj, Vec3f position) {
|
||||
struct Animation* animation = obj->animInfo.curAnim;
|
||||
|
||||
if (animation != NULL) {
|
||||
u16 *attribute = segmented_to_virtual((void *) animation->index);
|
||||
s16 *values = segmented_to_virtual((void *) animation->values);
|
||||
u16* attribute = segmented_to_virtual((void*)animation->index);
|
||||
s16* values = segmented_to_virtual((void*)animation->values);
|
||||
|
||||
s16 frame = obj->animInfo.animFrame;
|
||||
|
||||
@@ -865,9 +844,9 @@ void geo_retreive_animation_translation(struct GraphNodeObject *obj, Vec3f posit
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
position[0] = (f32) values[retrieve_animation_index(frame, &attribute)];
|
||||
position[1] = (f32) values[retrieve_animation_index(frame, &attribute)];
|
||||
position[2] = (f32) values[retrieve_animation_index(frame, &attribute)];
|
||||
position[0] = (f32)values[retrieve_animation_index(frame, &attribute)];
|
||||
position[1] = (f32)values[retrieve_animation_index(frame, &attribute)];
|
||||
position[2] = (f32)values[retrieve_animation_index(frame, &attribute)];
|
||||
} else {
|
||||
vec3f_set(position, 0, 0, 0);
|
||||
}
|
||||
@@ -877,15 +856,15 @@ 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 = NULL;
|
||||
|
||||
while (graphNode->parent != NULL) {
|
||||
graphNode = graphNode->parent;
|
||||
}
|
||||
|
||||
if (graphNode->type == GRAPH_NODE_TYPE_ROOT) {
|
||||
resGraphNode = (struct GraphNodeRoot *) graphNode;
|
||||
resGraphNode = (struct GraphNodeRoot*)graphNode;
|
||||
}
|
||||
|
||||
return resGraphNode;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user