mirror of
https://github.com/n64decomp/sm64
synced 2026-07-27 14:50:05 -04:00
Refresh 7
This commit is contained in:
+5
-5
@@ -4,10 +4,10 @@
|
||||
#include "data.h"
|
||||
#include "effects.h"
|
||||
|
||||
extern struct OSMesgQueue *OSMesgQueue0;
|
||||
extern struct OSMesgQueue *OSMesgQueue1;
|
||||
extern struct OSMesgQueue *OSMesgQueue2;
|
||||
extern struct OSMesgQueue *OSMesgQueue3;
|
||||
extern struct OSMesgQueue OSMesgQueue0;
|
||||
extern struct OSMesgQueue OSMesgQueue1;
|
||||
extern struct OSMesgQueue OSMesgQueue2;
|
||||
extern struct OSMesgQueue OSMesgQueue3;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
struct ReverbSettingsEU sReverbSettings[] = {
|
||||
@@ -182,7 +182,7 @@ struct AdsrEnvelope gDefaultEnvelope[] = {
|
||||
|
||||
#ifdef VERSION_EU
|
||||
struct NoteSubEu gZeroNoteSub = { 0 };
|
||||
struct NoteSubEu gDefaultNoteSub = { 1, 1 };
|
||||
struct NoteSubEu gDefaultNoteSub = { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, { NULL } };
|
||||
|
||||
s16 sSawtoothWaves[256] = {
|
||||
0, 1023, 2047, 3071, 4095, 5119, 6143, 7167, 8191, 9215, 10239,
|
||||
|
||||
+51
-98
@@ -13,47 +13,68 @@
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 arg1) {
|
||||
f32 weight;
|
||||
static void sequence_channel_process_sound(struct SequenceChannel *seqChannel, s32 recalculateVolume) {
|
||||
f32 channelVolume;
|
||||
s32 i;
|
||||
|
||||
if (seqChannel->unk1.as_bitfields.unk0b40 || arg1) {
|
||||
weight = seqChannel->volume * seqChannel->volumeScale * seqChannel->seqPlayer->unkEu2C;
|
||||
if (seqChannel->changes.as_bitfields.volume || recalculateVolume) {
|
||||
channelVolume = seqChannel->volume * seqChannel->volumeScale * seqChannel->seqPlayer->appliedFadeVolume;
|
||||
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) {
|
||||
weight = seqChannel->seqPlayer->muteVolumeScale * weight;
|
||||
channelVolume = seqChannel->seqPlayer->muteVolumeScale * channelVolume;
|
||||
}
|
||||
seqChannel->panChannelWeight = weight;
|
||||
seqChannel->appliedVolume = channelVolume;
|
||||
}
|
||||
|
||||
if (seqChannel->unk1.as_bitfields.unk0b20) {
|
||||
seqChannel->pan = seqChannel->unk9 * seqChannel->unkA;
|
||||
if (seqChannel->changes.as_bitfields.pan) {
|
||||
seqChannel->pan = seqChannel->newPan * seqChannel->panChannelWeight;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
struct SequenceChannelLayer *layer = seqChannel->layers[i];
|
||||
if (layer && layer->enabled && layer->note) {
|
||||
if (layer->unkEu0b4) {
|
||||
if (layer != NULL && layer->enabled && layer->note != NULL) {
|
||||
if (layer->notePropertiesNeedInit) {
|
||||
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
|
||||
layer->noteVelocity = layer->velocitySquare * seqChannel->panChannelWeight;
|
||||
layer->notePan = (seqChannel->pan + layer->euUnk5 * (0x80 - seqChannel->unkA)) >> 7;
|
||||
layer->unkEu0b4 = 0;
|
||||
layer->noteVelocity = layer->velocitySquare * seqChannel->appliedVolume;
|
||||
layer->notePan = (seqChannel->pan + layer->pan * (0x80 - seqChannel->panChannelWeight)) >> 7;
|
||||
layer->notePropertiesNeedInit = FALSE;
|
||||
} else {
|
||||
if (seqChannel->unk1.as_bitfields.unk0b80) {
|
||||
if (seqChannel->changes.as_bitfields.freqScale) {
|
||||
layer->noteFreqScale = layer->freqScale * seqChannel->freqScale;
|
||||
}
|
||||
if (seqChannel->unk1.as_bitfields.unk0b40 || arg1) {
|
||||
layer->noteVelocity = layer->velocitySquare * seqChannel->panChannelWeight;
|
||||
if (seqChannel->changes.as_bitfields.volume || recalculateVolume) {
|
||||
layer->noteVelocity = layer->velocitySquare * seqChannel->appliedVolume;
|
||||
}
|
||||
if (seqChannel->unk1.as_bitfields.unk0b20) {
|
||||
layer->notePan = (seqChannel->pan + layer->euUnk5 * (0x80 - seqChannel->unkA)) >> 7;
|
||||
if (seqChannel->changes.as_bitfields.pan) {
|
||||
layer->notePan = (seqChannel->pan + layer->pan * (0x80 - seqChannel->panChannelWeight)) >> 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
seqChannel->unk1.as_u8 = 0;
|
||||
seqChannel->changes.as_u8 = 0;
|
||||
}
|
||||
#else
|
||||
void func_80319E70(void) {
|
||||
static void sequence_channel_process_sound(struct SequenceChannel *seqChannel) {
|
||||
f32 channelVolume;
|
||||
f32 panLayerWeight;
|
||||
f32 panFromChannel;
|
||||
s32 i;
|
||||
|
||||
channelVolume = seqChannel->volume * seqChannel->volumeScale * seqChannel->seqPlayer->fadeVolume;
|
||||
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) {
|
||||
channelVolume *= seqChannel->seqPlayer->muteVolumeScale;
|
||||
}
|
||||
|
||||
panFromChannel = seqChannel->pan * seqChannel->panChannelWeight;
|
||||
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->noteFreqScale = layer->freqScale * seqChannel->freqScale;
|
||||
layer->noteVelocity = layer->velocitySquare * channelVolume;
|
||||
layer->notePan = (layer->pan * panLayerWeight) + panFromChannel;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -63,7 +84,7 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
|
||||
if (seqPlayer->fadeTimer != 0) {
|
||||
seqPlayer->fadeVolume += seqPlayer->fadeVelocity;
|
||||
#ifdef VERSION_EU
|
||||
seqPlayer->unk_eu = TRUE;
|
||||
seqPlayer->recalculateVolume = TRUE;
|
||||
#endif
|
||||
|
||||
if (seqPlayer->fadeVolume > US_FLOAT2(1)) {
|
||||
@@ -98,8 +119,8 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
if (seqPlayer->unk_eu) {
|
||||
seqPlayer->unkEu2C = seqPlayer->fadeVolume * seqPlayer->unkEu28;
|
||||
if (seqPlayer->recalculateVolume) {
|
||||
seqPlayer->appliedFadeVolume = seqPlayer->fadeVolume * seqPlayer->fadeVolumeScale;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -108,37 +129,15 @@ void sequence_player_process_sound(struct SequencePlayer *seqPlayer) {
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(seqPlayer->channels[i]) == TRUE
|
||||
&& seqPlayer->channels[i]->enabled == TRUE) {
|
||||
#ifdef VERSION_EU
|
||||
sequence_channel_process_sound(seqPlayer->channels[i], seqPlayer->unk_eu);
|
||||
sequence_channel_process_sound(seqPlayer->channels[i], seqPlayer->recalculateVolume);
|
||||
#else
|
||||
f32 channelVolume;
|
||||
f32 panLayerWeight;
|
||||
f32 panFromChannel;
|
||||
s32 layerIndex;
|
||||
struct SequenceChannel *seqChannel = seqPlayer->channels[i];
|
||||
|
||||
channelVolume =
|
||||
seqChannel->seqPlayer->fadeVolume * (seqChannel->volume * seqChannel->volumeScale);
|
||||
if (seqChannel->seqPlayer->muted && (seqChannel->muteBehavior & MUTE_BEHAVIOR_SOFTEN) != 0) {
|
||||
channelVolume *= seqChannel->seqPlayer->muteVolumeScale;
|
||||
}
|
||||
|
||||
panFromChannel = seqChannel->panChannelWeight * seqChannel->pan;
|
||||
panLayerWeight = US_FLOAT(1.0) - seqChannel->panChannelWeight;
|
||||
|
||||
for (layerIndex = 0; layerIndex < 4; layerIndex++) {
|
||||
struct SequenceChannelLayer *seqLayer = seqChannel->layers[layerIndex];
|
||||
if (seqLayer != NULL && seqLayer->enabled && seqLayer->note != NULL) {
|
||||
seqLayer->noteFreqScale = seqChannel->freqScale * seqLayer->freqScale;
|
||||
seqLayer->noteVelocity = seqLayer->velocitySquare * channelVolume;
|
||||
seqLayer->notePan = (seqLayer->pan * panLayerWeight) + panFromChannel;
|
||||
}
|
||||
}
|
||||
sequence_channel_process_sound(seqPlayer->channels[i]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
seqPlayer->unk_eu = FALSE;
|
||||
seqPlayer->recalculateVolume = FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -224,18 +223,10 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
|
||||
}
|
||||
|
||||
vib->extentChangeTimer--;
|
||||
#ifdef VERSION_EU
|
||||
} else if ((s32) vib->extent != (*vib).seqChannel->vibratoExtentTarget) {
|
||||
} else if (vib->seqChannel->vibratoExtentTarget != (s32) vib->extent) {
|
||||
if ((vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay) == 0) {
|
||||
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
|
||||
}
|
||||
#else
|
||||
} else if ((s32) vib->extent != vib->seqChannel->vibratoExtentTarget) {
|
||||
vib->extentChangeTimer = vib->seqChannel->vibratoExtentChangeDelay;
|
||||
if (vib->extentChangeTimer == 0) {
|
||||
vib->extent = (s32) vib->seqChannel->vibratoExtentTarget;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (vib->rateChangeTimer) {
|
||||
@@ -246,18 +237,10 @@ f32 get_vibrato_freq_scale(struct VibratoState *vib) {
|
||||
}
|
||||
|
||||
vib->rateChangeTimer--;
|
||||
#ifdef VERSION_EU
|
||||
} else if ((s32) vib->rate != (*vib).seqChannel->vibratoRateTarget) {
|
||||
} else if (vib->seqChannel->vibratoRateTarget != (s32) vib->rate) {
|
||||
if ((vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay) == 0) {
|
||||
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
|
||||
}
|
||||
#else
|
||||
} else if ((s32) vib->rate != vib->seqChannel->vibratoRateTarget) {
|
||||
vib->rateChangeTimer = vib->seqChannel->vibratoRateChangeDelay;
|
||||
if (vib->rateChangeTimer == 0) {
|
||||
vib->rate = (s32) vib->seqChannel->vibratoRateTarget;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (vib->extent == 0) {
|
||||
@@ -339,15 +322,13 @@ void note_vibrato_init(struct Note *note) {
|
||||
vib->seqChannel = note->parentLayer->seqChannel;
|
||||
seqChannel = vib->seqChannel;
|
||||
|
||||
vib->extentChangeTimer = seqChannel->vibratoExtentChangeDelay;
|
||||
if (vib->extentChangeTimer == 0) {
|
||||
if ((vib->extentChangeTimer = seqChannel->vibratoExtentChangeDelay) == 0) {
|
||||
vib->extent = seqChannel->vibratoExtentTarget;
|
||||
} else {
|
||||
vib->extent = seqChannel->vibratoExtentStart;
|
||||
}
|
||||
|
||||
vib->rateChangeTimer = seqChannel->vibratoRateChangeDelay;
|
||||
if (vib->rateChangeTimer == 0) {
|
||||
if ((vib->rateChangeTimer = seqChannel->vibratoRateChangeDelay) == 0) {
|
||||
vib->rate = seqChannel->vibratoRateTarget;
|
||||
} else {
|
||||
vib->rate = seqChannel->vibratoRateStart;
|
||||
@@ -396,11 +377,7 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
#endif
|
||||
if (action & ADSR_ACTION_HANG) {
|
||||
adsr->state = ADSR_STATE_HANG;
|
||||
#ifdef VERSION_EU
|
||||
break;
|
||||
#else
|
||||
goto CONT;
|
||||
#endif
|
||||
}
|
||||
// fallthrough
|
||||
}
|
||||
@@ -446,11 +423,7 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
break;
|
||||
}
|
||||
if (adsr->state != ADSR_STATE_FADE) {
|
||||
#ifdef VERSION_EU
|
||||
break;
|
||||
#else
|
||||
goto CONT;
|
||||
#endif
|
||||
}
|
||||
// fallthrough
|
||||
|
||||
@@ -467,11 +440,7 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
// fallthrough
|
||||
|
||||
case ADSR_STATE_HANG:
|
||||
#ifdef VERSION_EU
|
||||
break;
|
||||
#else
|
||||
goto CONT;
|
||||
#endif
|
||||
|
||||
case ADSR_STATE_DECAY:
|
||||
case ADSR_STATE_RELEASE: {
|
||||
@@ -490,11 +459,7 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
#endif
|
||||
adsr->state = ADSR_STATE_SUSTAIN;
|
||||
}
|
||||
#ifdef VERSION_EU
|
||||
break;
|
||||
#else
|
||||
goto CONT;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
@@ -508,11 +473,7 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
adsr->state = ADSR_STATE_DISABLED;
|
||||
}
|
||||
#endif
|
||||
#ifdef VERSION_EU
|
||||
break;
|
||||
#else
|
||||
goto CONT;
|
||||
#endif
|
||||
}
|
||||
|
||||
case ADSR_STATE_SUSTAIN:
|
||||
@@ -520,17 +481,9 @@ s32 adsr_update(struct AdsrState *adsr) {
|
||||
if (adsr->delay == 0) {
|
||||
adsr->state = ADSR_STATE_RELEASE;
|
||||
}
|
||||
#ifdef VERSION_EU
|
||||
break;
|
||||
#else
|
||||
goto CONT;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef VERSION_EU
|
||||
CONT:
|
||||
#endif
|
||||
|
||||
if ((action & ADSR_ACTION_DECAY)) {
|
||||
adsr->state = ADSR_STATE_DECAY;
|
||||
adsr->action = action & ~ADSR_ACTION_DECAY;
|
||||
|
||||
+8
-16
@@ -1,6 +1,6 @@
|
||||
#include <ultra64.h>
|
||||
#include "sm64.h"
|
||||
#include "memory.h"
|
||||
#include "heap.h"
|
||||
#include "load.h"
|
||||
#include "data.h"
|
||||
#include "seqplayer.h"
|
||||
@@ -753,10 +753,8 @@ void func_8031D838(s32 player, FadeT fadeInTime, u8 targetVolume) {
|
||||
#ifdef VERSION_EU
|
||||
extern void func_802ad7a0(void);
|
||||
|
||||
void maybe_tick_game_sound(void)
|
||||
{
|
||||
if (sGameLoopTicked != 0)
|
||||
{
|
||||
void maybe_tick_game_sound(void) {
|
||||
if (sGameLoopTicked != 0) {
|
||||
update_game_sound();
|
||||
sGameLoopTicked = 0;
|
||||
}
|
||||
@@ -764,6 +762,7 @@ void maybe_tick_game_sound(void)
|
||||
}
|
||||
|
||||
void func_eu_802e9bec(s32 player, s32 channel, s32 arg2) {
|
||||
// EU verson of unused_803209D8
|
||||
// chan->stopSomething2 = arg2?
|
||||
func_802ad770(0x08000000 | (player & 0xff) << 16 | (channel & 0xff) << 8, (s8) arg2);
|
||||
}
|
||||
@@ -1607,12 +1606,6 @@ void update_game_sound(void) {
|
||||
#undef ARG2_VAL1
|
||||
#undef ARG2_VAL2
|
||||
|
||||
#if defined(VERSION_EU) && !defined(NON_MATCHING)
|
||||
// Just regalloc differences
|
||||
void play_sequence(u8 player, u8 seqId, u16 fadeTimer);
|
||||
GLOBAL_ASM("asm/non_matchings/eu/play_sequence.s")
|
||||
#else
|
||||
|
||||
void play_sequence(u8 player, u8 seqId, u16 fadeTimer) {
|
||||
u8 temp_ret;
|
||||
u8 i;
|
||||
@@ -1629,13 +1622,13 @@ void play_sequence(u8 player, u8 seqId, u16 fadeTimer) {
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
func_802ad770(0x46000000 | (player & 0xff) << 16, seqId & 0x80);
|
||||
func_802ad74c(0x82000000 | (player & 0xff) << 16 | ((seqId & 0x7f) & 0xff) << 8, fadeTimer);
|
||||
func_802ad770(0x46000000 | ((u8)(u32)player) << 16, seqId & 0x80);
|
||||
func_802ad74c(0x82000000 | ((u8)(u32)player) << 16 | ((u8)(seqId & 0x7f)) << 8, fadeTimer);
|
||||
|
||||
if (player == 0) {
|
||||
temp_ret = func_803200E4(0);
|
||||
if (temp_ret != 0xff) {
|
||||
gSequencePlayers[0].unkEu28 = (f32) temp_ret / US_FLOAT(127.0);
|
||||
gSequencePlayers[0].fadeVolumeScale = (f32) temp_ret / US_FLOAT(127.0);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -1653,7 +1646,6 @@ void play_sequence(u8 player, u8 seqId, u16 fadeTimer) {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void sequence_player_fade_out(u8 player, u16 fadeTimer) {
|
||||
#ifdef VERSION_EU
|
||||
@@ -2440,7 +2432,7 @@ void sound_reset(u8 presetId) {
|
||||
sGameLoopTicked = 0;
|
||||
disable_all_sequence_players();
|
||||
sound_init();
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
#if defined(VERSION_JP) || defined(VERSION_US) || defined(VERSION_SH)
|
||||
audio_reset_session(&gAudioSessionPresets[presetId]);
|
||||
#else
|
||||
audio_reset_session_eu(presetId);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <ultra64.h>
|
||||
#include <macros.h>
|
||||
|
||||
#include "memory.h"
|
||||
#include "heap.h"
|
||||
#include "data.h"
|
||||
#include "load.h"
|
||||
#include "synthesis.h"
|
||||
@@ -31,7 +31,7 @@ u8 sReverbDownsampleRateLog; // never read
|
||||
struct SoundAllocPool gAudioSessionPool;
|
||||
struct SoundAllocPool gAudioInitPool;
|
||||
struct SoundAllocPool gNotesAndBuffersPool;
|
||||
u8 sAudioMemoryPad[0x20]; // probably two unused pools
|
||||
u8 sAudioHeapPad[0x20]; // probably two unused pools
|
||||
struct SoundAllocPool gSeqAndBankPool;
|
||||
struct SoundAllocPool gPersistentCommonPool;
|
||||
struct SoundAllocPool gTemporaryCommonPool;
|
||||
@@ -95,8 +95,7 @@ f64 root_newton_step(f64 x, s32 k, f64 d)
|
||||
*
|
||||
* @return the root, or 1.0 if d is 0
|
||||
*/
|
||||
f64 kth_root(f64 d, s32 k)
|
||||
{
|
||||
f64 kth_root(f64 d, s32 k) {
|
||||
f64 root = 1.5;
|
||||
f64 next;
|
||||
f64 diff;
|
||||
@@ -128,7 +127,7 @@ f64 kth_root(f64 d, s32 k)
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
void func_eu_802e1cd0(s32 UNUSED unused, s32 len) {
|
||||
void build_vol_rampings_table(s32 UNUSED unused, s32 len) {
|
||||
s32 i;
|
||||
s32 step;
|
||||
s32 d;
|
||||
@@ -308,30 +307,34 @@ static void unused_803163D4() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(VERSION_EU) && !defined(NON_MATCHING)
|
||||
GLOBAL_ASM("asm/non_matchings/eu/audio/alloc_bank_or_seq.s")
|
||||
#else
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id) {
|
||||
// arg3 = 0, 1 or 2?
|
||||
|
||||
u8 *table; // sp5C
|
||||
u8 isSound; // sp5B
|
||||
struct TemporaryPool *tp; // sp30
|
||||
struct PersistentPool *persistent = &arg0->persistent;
|
||||
struct SoundAllocPool *pool;
|
||||
void *ret;
|
||||
u32 firstVal;
|
||||
u32 secondVal;
|
||||
#ifndef VERSION_EU
|
||||
u16 UNUSED _firstVal;
|
||||
u16 UNUSED _secondVal;
|
||||
#else
|
||||
u16 firstVal;
|
||||
u16 secondVal;
|
||||
#endif
|
||||
u32 nullID = -1;
|
||||
u8 *table;
|
||||
u8 isSound;
|
||||
#ifndef VERSION_EU
|
||||
u16 firstVal;
|
||||
u16 secondVal;
|
||||
u32 bothDiscardable;
|
||||
u32 leftDiscardable, rightDiscardable;
|
||||
u32 leftNotLoaded, rightNotLoaded;
|
||||
u32 leftAvail, rightAvail;
|
||||
UNUSED s32 temp;
|
||||
struct TemporaryPool *v1; // sp30
|
||||
struct PersistentPool *persistent = &arg0->persistent;
|
||||
#endif
|
||||
|
||||
if (arg3 == 0) {
|
||||
v1 = &arg0->temporary;
|
||||
tp = &arg0->temporary;
|
||||
if (arg0 == &gSeqLoadedPool) {
|
||||
table = gSeqLoadStatus;
|
||||
isSound = FALSE;
|
||||
@@ -340,10 +343,10 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
isSound = TRUE;
|
||||
}
|
||||
|
||||
firstVal = (v1->entries[0].id == -1 ? SOUND_LOAD_STATUS_NOT_LOADED
|
||||
: table[v1->entries[0].id]); // a3, a2
|
||||
secondVal =
|
||||
(v1->entries[1].id == -1 ? SOUND_LOAD_STATUS_NOT_LOADED : table[v1->entries[1].id]); // a1
|
||||
firstVal = (tp->entries[0].id == (s8)nullID ? SOUND_LOAD_STATUS_NOT_LOADED : table[tp->entries[0].id]); // a3, a2
|
||||
secondVal = (tp->entries[1].id == (s8)nullID ? SOUND_LOAD_STATUS_NOT_LOADED : table[tp->entries[1].id]); // a1
|
||||
|
||||
#ifndef VERSION_EU
|
||||
leftNotLoaded = (firstVal == SOUND_LOAD_STATUS_NOT_LOADED);
|
||||
leftDiscardable = (firstVal == SOUND_LOAD_STATUS_DISCARDABLE); // t0
|
||||
leftAvail = (firstVal != SOUND_LOAD_STATUS_IN_PROGRESS);
|
||||
@@ -353,83 +356,111 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
bothDiscardable = (leftDiscardable && rightDiscardable); // a0
|
||||
|
||||
if (leftNotLoaded) {
|
||||
v1->nextSide = 0;
|
||||
tp->nextSide = 0;
|
||||
} else if (rightNotLoaded) {
|
||||
v1->nextSide = 1;
|
||||
tp->nextSide = 1;
|
||||
} else if (bothDiscardable) {
|
||||
// Use the opposite side from last time.
|
||||
} else if (leftDiscardable) {
|
||||
v1->nextSide = 0;
|
||||
} else if (firstVal == SOUND_LOAD_STATUS_DISCARDABLE) { //??!
|
||||
tp->nextSide = 0;
|
||||
} else if (rightDiscardable) {
|
||||
v1->nextSide = 1;
|
||||
tp->nextSide = 1;
|
||||
} else if (leftAvail) {
|
||||
v1->nextSide = 0;
|
||||
tp->nextSide = 0;
|
||||
} else if (rightAvail) {
|
||||
v1->nextSide = 1;
|
||||
tp->nextSide = 1;
|
||||
} else {
|
||||
// Both left and right sides are being loaded into.
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
if (firstVal == SOUND_LOAD_STATUS_NOT_LOADED) {
|
||||
tp->nextSide = 0;
|
||||
} else if (secondVal == SOUND_LOAD_STATUS_NOT_LOADED) {
|
||||
tp->nextSide = 1;
|
||||
} else if ((firstVal == SOUND_LOAD_STATUS_DISCARDABLE) && (secondVal == SOUND_LOAD_STATUS_DISCARDABLE)) {
|
||||
// Use the opposite side from last time.
|
||||
} else if (firstVal == SOUND_LOAD_STATUS_DISCARDABLE) {
|
||||
tp->nextSide = 0;
|
||||
} else if (secondVal == SOUND_LOAD_STATUS_DISCARDABLE) {
|
||||
tp->nextSide = 1;
|
||||
} else if (firstVal != SOUND_LOAD_STATUS_IN_PROGRESS) {
|
||||
tp->nextSide = 0;
|
||||
} else if (secondVal != SOUND_LOAD_STATUS_IN_PROGRESS) {
|
||||
tp->nextSide = 1;
|
||||
} else {
|
||||
// Both left and right sides are being loaded into.
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (v1->entries[v1->nextSide].id != -1) {
|
||||
table[v1->entries[v1->nextSide].id] = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
pool = &arg0->temporary.pool; // a1
|
||||
if (tp->entries[tp->nextSide].id != (s8)nullID) {
|
||||
table[tp->entries[tp->nextSide].id] = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
if (isSound == TRUE) {
|
||||
discard_bank(v1->entries[v1->nextSide].id);
|
||||
discard_bank(tp->entries[tp->nextSide].id);
|
||||
}
|
||||
}
|
||||
|
||||
pool = &arg0->temporary.pool; // a1
|
||||
switch (v1->nextSide) {
|
||||
switch (tp->nextSide) {
|
||||
case 0:
|
||||
v1->entries[0].ptr = pool->start;
|
||||
v1->entries[0].id = id;
|
||||
v1->entries[0].size = size;
|
||||
tp->entries[0].ptr = pool->start;
|
||||
tp->entries[0].id = id;
|
||||
tp->entries[0].size = size;
|
||||
|
||||
pool->cur = pool->start + size;
|
||||
|
||||
if (v1->entries[1].ptr < pool->cur) {
|
||||
if (tp->entries[1].ptr < pool->cur) {
|
||||
// Throw out the entry on the other side if it doesn't fit.
|
||||
// (possible @bug: what if it's currently being loaded?)
|
||||
table[v1->entries[1].id] = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
table[tp->entries[1].id] = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
|
||||
switch (isSound) {
|
||||
case FALSE:
|
||||
discard_sequence(v1->entries[1].id);
|
||||
discard_sequence(tp->entries[1].id);
|
||||
break;
|
||||
case TRUE:
|
||||
discard_bank(v1->entries[1].id);
|
||||
discard_bank(tp->entries[1].id);
|
||||
break;
|
||||
}
|
||||
|
||||
v1->entries[1].id = -1;
|
||||
v1->entries[1].ptr = pool->size + pool->start;
|
||||
tp->entries[1].id = (s32)nullID;
|
||||
#ifdef VERSION_EU
|
||||
tp->entries[1].ptr = pool->start + pool->size;
|
||||
#else
|
||||
tp->entries[1].ptr = pool->size + pool->start;
|
||||
#endif
|
||||
}
|
||||
|
||||
ret = v1->entries[0].ptr;
|
||||
ret = tp->entries[0].ptr;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
v1->entries[1].ptr = pool->size + pool->start - size - 0x10;
|
||||
v1->entries[1].id = id;
|
||||
v1->entries[1].size = size;
|
||||
#ifdef VERSION_EU
|
||||
tp->entries[1].ptr = pool->start + pool->size - size - 0x10;
|
||||
#else
|
||||
tp->entries[1].ptr = pool->size + pool->start - size - 0x10;
|
||||
#endif
|
||||
tp->entries[1].id = id;
|
||||
tp->entries[1].size = size;
|
||||
|
||||
if (v1->entries[1].ptr < pool->cur) {
|
||||
table[v1->entries[0].id] = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
if (tp->entries[1].ptr < pool->cur) {
|
||||
table[tp->entries[0].id] = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
|
||||
switch (isSound) {
|
||||
case FALSE:
|
||||
discard_sequence(v1->entries[0].id);
|
||||
discard_sequence(tp->entries[0].id);
|
||||
break;
|
||||
case TRUE:
|
||||
discard_bank(v1->entries[0].id);
|
||||
discard_bank(tp->entries[0].id);
|
||||
break;
|
||||
}
|
||||
|
||||
v1->entries[0].id = -1;
|
||||
tp->entries[0].id = (s32)nullID;
|
||||
pool->cur = pool->start;
|
||||
}
|
||||
|
||||
ret = v1->entries[1].ptr;
|
||||
ret = tp->entries[1].ptr;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -438,19 +469,31 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
|
||||
// Switch sides for next time in case both entries are
|
||||
// SOUND_LOAD_STATUS_DISCARDABLE.
|
||||
v1->nextSide ^= 1;
|
||||
tp->nextSide ^= 1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
ret = soundAlloc(&arg0->persistent.pool, arg1 * size);
|
||||
arg0->persistent.entries[arg0->persistent.numEntries].ptr = ret;
|
||||
|
||||
if (ret == NULL)
|
||||
#else
|
||||
persistent->entries[persistent->numEntries].ptr = soundAlloc(&persistent->pool, arg1 * size);
|
||||
|
||||
if (persistent->entries[persistent->numEntries].ptr == NULL) {
|
||||
if (persistent->entries[persistent->numEntries].ptr == NULL)
|
||||
#endif
|
||||
{
|
||||
switch (arg3) {
|
||||
case 2:
|
||||
#ifdef VERSION_EU
|
||||
return alloc_bank_or_seq(arg0, arg1, size, 0, id);
|
||||
#else
|
||||
// Prevent tail call optimization.
|
||||
ret = alloc_bank_or_seq(arg0, arg1, size, 0, id);
|
||||
return ret;
|
||||
#endif
|
||||
case 1:
|
||||
return NULL;
|
||||
}
|
||||
@@ -460,14 +503,12 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
// Because the buffer is small enough that more don't fit?
|
||||
persistent->entries[persistent->numEntries].id = id;
|
||||
persistent->entries[persistent->numEntries].size = size;
|
||||
persistent->numEntries++;
|
||||
return persistent->entries[persistent->numEntries - 1].ptr;
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
return persistent->entries[persistent->numEntries++].ptr;
|
||||
#else
|
||||
GLOBAL_ASM("asm/non_matchings/alloc_bank_or_seq.s")
|
||||
#endif
|
||||
persistent->numEntries++; return persistent->entries[persistent->numEntries - 1].ptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 id) {
|
||||
u32 i;
|
||||
@@ -548,7 +589,7 @@ void decrease_reverb_gain(void) {
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
s32 func_eu_802E2AA0(void) {
|
||||
s32 audio_shut_down_and_reset_step(void) {
|
||||
s32 i;
|
||||
s32 j;
|
||||
switch (gAudioResetStatus) {
|
||||
@@ -621,7 +662,6 @@ void wait_for_audio_frames(s32 frames) {
|
||||
void audio_reset_session(struct AudioSessionSettings *preset) {
|
||||
#else
|
||||
void audio_reset_session(void) {
|
||||
// TODO: verify compilation again and try to match better
|
||||
struct AudioSessionSettingsEU *preset = &gAudioSessionPresets[gAudioResetPresetIdToLoad];
|
||||
struct ReverbSettingsEU *reverbSettings;
|
||||
#endif
|
||||
@@ -886,7 +926,7 @@ void audio_reset_session(void) {
|
||||
init_sample_dma_buffers(gMaxSimultaneousNotes);
|
||||
|
||||
#ifdef VERSION_EU
|
||||
func_eu_802e1cd0(0, gAudioBufferParameters.samplesPerUpdate);
|
||||
build_vol_rampings_table(0, gAudioBufferParameters.samplesPerUpdate);
|
||||
#endif
|
||||
|
||||
osWritebackDCacheAll();
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef AUDIO_MEMORY_H
|
||||
#define AUDIO_MEMORY_H
|
||||
#ifndef AUDIO_HEAP_H
|
||||
#define AUDIO_HEAP_H
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@@ -63,9 +63,10 @@ void sound_init_main_pools(s32 sizeForAudioInitPool);
|
||||
void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id);
|
||||
void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 arg2);
|
||||
#ifdef VERSION_EU
|
||||
s32 audio_shut_down_and_reset_step(void);
|
||||
void audio_reset_session(void);
|
||||
#else
|
||||
void audio_reset_session(struct AudioSessionSettings *preset);
|
||||
#endif
|
||||
|
||||
#endif /* AUDIO_MEMORY_H */
|
||||
#endif /* AUDIO_HEAP_H */
|
||||
+45
-22
@@ -215,7 +215,7 @@ struct SequencePlayer
|
||||
/*0x000, 0x000*/ u8 seqDmaInProgress : 1;
|
||||
/*0x000, 0x000*/ u8 bankDmaInProgress : 1;
|
||||
#ifdef VERSION_EU
|
||||
/* 0x000*/ u8 unk_eu : 1;
|
||||
/* 0x000*/ u8 recalculateVolume : 1;
|
||||
#endif
|
||||
#ifndef VERSION_EU
|
||||
/*0x001 */ s8 seqVariation;
|
||||
@@ -251,8 +251,8 @@ struct SequencePlayer
|
||||
/*0x020, 0x020*/ f32 volume; // set to 0.0f
|
||||
/*0x024, 0x024*/ f32 muteVolumeScale; // set to 0.5f
|
||||
#ifdef VERSION_EU
|
||||
/* , 0x028*/ f32 unkEu28;
|
||||
/* , 0x02C*/ f32 unkEu2C;
|
||||
/* , 0x028*/ f32 fadeVolumeScale;
|
||||
/* , 0x02C*/ f32 appliedFadeVolume;
|
||||
#else
|
||||
/* */ u8 pad2[4];
|
||||
#endif
|
||||
@@ -340,12 +340,12 @@ struct SequenceChannel
|
||||
#ifdef VERSION_EU
|
||||
/* , 0x01*/ union {
|
||||
struct {
|
||||
u8 unk0b80 : 1;
|
||||
u8 unk0b40 : 1;
|
||||
u8 unk0b20 : 1;
|
||||
u8 freqScale : 1;
|
||||
u8 volume : 1;
|
||||
u8 pan : 1;
|
||||
} as_bitfields;
|
||||
u8 as_u8;
|
||||
} unk1;
|
||||
} changes;
|
||||
#endif
|
||||
/*0x01, 0x02*/ u8 noteAllocPolicy;
|
||||
/*0x02, 0x03*/ u8 muteBehavior;
|
||||
@@ -354,9 +354,9 @@ struct SequenceChannel
|
||||
/*0x05, 0x06*/ u8 bankId;
|
||||
#ifdef VERSION_EU
|
||||
/* , 0x07*/ u8 reverbIndex;
|
||||
/* , 0x08*/ u8 unk8;
|
||||
/* , 0x09*/ u8 unk9;
|
||||
/* , 0x0A*/ u8 unkA;
|
||||
/* , 0x08*/ u8 bookOffset;
|
||||
/* , 0x09*/ u8 newPan;
|
||||
/* , 0x0A*/ u8 panChannelWeight; // proportion of pan that comes from the channel (0..128)
|
||||
#else
|
||||
/*0x06, */ u8 updatesPerFrameUnused;
|
||||
#endif
|
||||
@@ -374,11 +374,12 @@ struct SequenceChannel
|
||||
/*0x1C, 0x20*/ f32 volumeScale;
|
||||
/*0x20, 0x24*/ f32 volume;
|
||||
#ifndef VERSION_EU
|
||||
/*0x24, 0x28*/ f32 pan;
|
||||
/*0x24, */ f32 pan;
|
||||
/*0x28, */ f32 panChannelWeight; // proportion of pan that comes from the channel (0..1)
|
||||
#else
|
||||
/*0x24, 0x28*/ s32 pan;
|
||||
/* , 0x28*/ s32 pan;
|
||||
/* , 0x2C*/ f32 appliedVolume;
|
||||
#endif
|
||||
/*0x28, 0x2C*/ f32 panChannelWeight; // proportion of pan that comes from the channel (0..1)
|
||||
/*0x2C, 0x30*/ f32 freqScale;
|
||||
/*0x30, 0x34*/ u8 (*dynTable)[][2];
|
||||
/*0x34, ????*/ struct Note *noteUnused; // never read
|
||||
@@ -401,16 +402,16 @@ struct SequenceChannelLayer // Maybe SequenceTrack?
|
||||
/*0x00, 0x00*/ u8 stopSomething : 1; // ?
|
||||
/*0x00, 0x00*/ u8 continuousNotes : 1; // keep the same note for consecutive notes with the same sound
|
||||
#ifdef VERSION_EU
|
||||
/* , 0x00*/ u8 unkEu0b8 : 1;
|
||||
/* , 0x00*/ u8 unkEu0b4 : 1;
|
||||
/* , 0x00*/ u8 unkEu0b2 : 1;
|
||||
/* , 0x01*/ u8 euUnk1; // euInstOrWave?
|
||||
/* , 0x00*/ u8 unusedEu0b8 : 1;
|
||||
/* , 0x00*/ u8 notePropertiesNeedInit : 1;
|
||||
/* , 0x00*/ u8 ignoreDrumPan : 1;
|
||||
/* , 0x01*/ u8 instOrWave;
|
||||
#endif
|
||||
/*0x01, 0x02*/ u8 status;
|
||||
/*0x02, 0x03*/ u8 noteDuration; // set to 0x80
|
||||
/*0x03, 0x04*/ u8 portamentoTargetNote;
|
||||
#ifdef VERSION_EU
|
||||
/* , 0x05*/ u8 euUnk5; // contains US/JP pan * 128.0f
|
||||
/* , 0x05*/ u8 pan; // 0..128
|
||||
/* , 0x06*/ u8 notePan;
|
||||
#endif
|
||||
/*0x04, 0x08*/ struct Portamento portamento;
|
||||
@@ -422,7 +423,7 @@ struct SequenceChannelLayer // Maybe SequenceTrack?
|
||||
/*0x20, 0x24*/ f32 freqScale;
|
||||
/*0x24, 0x28*/ f32 velocitySquare;
|
||||
#ifndef VERSION_EU
|
||||
/*0x28*/ f32 pan;
|
||||
/*0x28, */ f32 pan; // 0..1
|
||||
#endif
|
||||
/*0x2C, 0x2C*/ f32 noteVelocity;
|
||||
#ifndef VERSION_EU
|
||||
@@ -452,7 +453,7 @@ struct NoteSynthesisState
|
||||
/*0x01*/ u8 sampleDmaIndex;
|
||||
/*0x02*/ u8 prevHeadsetPanRight;
|
||||
/*0x03*/ u8 prevHeadsetPanLeft;
|
||||
/* */ u16 samplePosFrac; //?
|
||||
/*0x04*/ u16 samplePosFrac;
|
||||
/*0x08*/ s32 samplePosInt;
|
||||
/*0x0C*/ struct NoteSynthesisBuffers *synthesisBuffers;
|
||||
/*0x10*/ s16 curVolLeft;
|
||||
@@ -485,8 +486,8 @@ struct NoteSubEu
|
||||
/*0x00*/ u8 stereoStrongLeft : 1;
|
||||
/*0x00*/ u8 stereoHeadsetEffects : 1;
|
||||
/*0x00*/ u8 usesHeadsetPanEffects : 1;
|
||||
/*0x01*/ u8 unk1b567 : 3;
|
||||
/*0x01*/ u8 unk1b234 : 3;
|
||||
/*0x01*/ u8 reverbIndex : 3;
|
||||
/*0x01*/ u8 bookOffset : 3;
|
||||
/*0x01*/ u8 isSyntheticWave : 1;
|
||||
/*0x01*/ u8 hasTwoAdpcmParts : 1;
|
||||
/*0x02*/ u8 bankId;
|
||||
@@ -506,7 +507,9 @@ struct Note
|
||||
/* U/J, EU */
|
||||
/*0xA4, 0x00*/ struct AudioListItem listItem;
|
||||
/* 0x10*/ struct NoteSynthesisState synthesisState;
|
||||
#ifdef TARGET_N64
|
||||
u8 pad0[12];
|
||||
#endif
|
||||
/*0x04, 0x30*/ u8 priority;
|
||||
/* 0x31*/ u8 waveId;
|
||||
/* 0x32*/ u8 sampleCountIndex;
|
||||
@@ -643,20 +646,40 @@ struct AudioBufferParametersEU {
|
||||
|
||||
struct EuAudioCmd {
|
||||
union {
|
||||
#if IS_BIG_ENDIAN
|
||||
struct {
|
||||
u8 op;
|
||||
u8 arg1;
|
||||
u8 arg2;
|
||||
u8 arg3;
|
||||
} s;
|
||||
#else
|
||||
struct {
|
||||
u8 arg3;
|
||||
u8 arg2;
|
||||
u8 arg1;
|
||||
u8 op;
|
||||
} s;
|
||||
#endif
|
||||
s32 first;
|
||||
} u;
|
||||
union {
|
||||
s32 as_s32;
|
||||
u32 as_u32;
|
||||
f32 as_f32;
|
||||
#if IS_BIG_ENDIAN
|
||||
u8 as_u8;
|
||||
s8 as_s8;
|
||||
#else
|
||||
struct {
|
||||
u8 pad0[3];
|
||||
u8 as_u8;
|
||||
};
|
||||
struct {
|
||||
u8 pad1[3];
|
||||
s8 as_s8;
|
||||
};
|
||||
#endif
|
||||
} u2;
|
||||
};
|
||||
|
||||
|
||||
+26
-27
@@ -2,7 +2,7 @@
|
||||
#include <macros.h>
|
||||
|
||||
#include "load.h"
|
||||
#include "memory.h"
|
||||
#include "heap.h"
|
||||
#include "data.h"
|
||||
#include "seqplayer.h"
|
||||
|
||||
@@ -19,8 +19,7 @@ struct SharedDma {
|
||||
}; // size = 0x10
|
||||
|
||||
// EU only
|
||||
void func_802ada64(void);
|
||||
s32 func_eu_802E2AA0(void);
|
||||
void port_eu_init(void);
|
||||
|
||||
struct Note *gNotes;
|
||||
|
||||
@@ -425,27 +424,27 @@ void patch_sound(UNUSED struct AudioBankSound *sound, UNUSED u8 *memBase, UNUSED
|
||||
}
|
||||
|
||||
#ifndef VERSION_EU
|
||||
#define PATCH_SOUND(_sound, mem, offset) \
|
||||
{ \
|
||||
struct AudioBankSound *sound = _sound; \
|
||||
struct AudioBankSample *sample; \
|
||||
void *patched; \
|
||||
if ((*sound).sample != (void *) 0) \
|
||||
{ \
|
||||
patched = (void *)(((unsigned int)(*sound).sample) + ((unsigned int)((unsigned char *) mem))); \
|
||||
(*sound).sample = patched; \
|
||||
sample = (*sound).sample; \
|
||||
if ((*sample).loaded == 0) \
|
||||
{ \
|
||||
patched = (void *)(((unsigned int)(*sample).sampleAddr) + ((unsigned int) offset)); \
|
||||
(*sample).sampleAddr = patched; \
|
||||
patched = (void *)(((unsigned int)(*sample).loop) + ((unsigned int)((unsigned char *) mem))); \
|
||||
(*sample).loop = patched; \
|
||||
patched = (void *)(((unsigned int)(*sample).book) + ((unsigned int)((unsigned char *) mem))); \
|
||||
(*sample).book = patched; \
|
||||
(*sample).loaded = 1; \
|
||||
} \
|
||||
} \
|
||||
#define PATCH_SOUND(_sound, mem, offset) \
|
||||
{ \
|
||||
struct AudioBankSound *sound = _sound; \
|
||||
struct AudioBankSample *sample; \
|
||||
void *patched; \
|
||||
if ((*sound).sample != (void *) 0) \
|
||||
{ \
|
||||
patched = (void *)(((uintptr_t)(*sound).sample) + ((uintptr_t)((u8 *) mem))); \
|
||||
(*sound).sample = patched; \
|
||||
sample = (*sound).sample; \
|
||||
if ((*sample).loaded == 0) \
|
||||
{ \
|
||||
patched = (void *)(((uintptr_t)(*sample).sampleAddr) + ((uintptr_t) offset)); \
|
||||
(*sample).sampleAddr = patched; \
|
||||
patched = (void *)(((uintptr_t)(*sample).loop) + ((uintptr_t)((u8 *) mem))); \
|
||||
(*sample).loop = patched; \
|
||||
patched = (void *)(((uintptr_t)(*sample).book) + ((uintptr_t)((u8 *) mem))); \
|
||||
(*sample).book = patched; \
|
||||
(*sample).loaded = 1; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -469,7 +468,7 @@ void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32
|
||||
drums = mem->drums;
|
||||
#ifndef VERSION_EU
|
||||
if (drums != NULL && numDrums > 0) {
|
||||
mem->drums = (void *)((unsigned int) drums + (unsigned int) mem);
|
||||
mem->drums = (void *)((uintptr_t) drums + (uintptr_t) mem);
|
||||
if (numDrums > 0) //! unneeded when -sopt is enabled
|
||||
for (i = 0; i < numDrums; i++) {
|
||||
#else
|
||||
@@ -923,7 +922,7 @@ void audio_init() {
|
||||
|
||||
D_EU_802298D0 = 20.03042f;
|
||||
gRefreshRate = 50;
|
||||
func_802ada64();
|
||||
port_eu_init();
|
||||
if (k) {
|
||||
}
|
||||
#endif
|
||||
@@ -958,7 +957,7 @@ void audio_init() {
|
||||
#ifdef VERSION_EU
|
||||
gAudioResetPresetIdToLoad = 0;
|
||||
gAudioResetStatus = 1;
|
||||
func_eu_802E2AA0();
|
||||
audio_shut_down_and_reset_step();
|
||||
#else
|
||||
audio_reset_session(&gAudioSessionPresets[0]);
|
||||
#endif
|
||||
|
||||
+12
-12
@@ -1,7 +1,7 @@
|
||||
#include <ultra64.h>
|
||||
#include <macros.h>
|
||||
|
||||
#include "memory.h"
|
||||
#include "heap.h"
|
||||
#include "data.h"
|
||||
#include "load.h"
|
||||
#include "seqplayer.h"
|
||||
@@ -102,7 +102,7 @@ void note_set_resampling_rate(struct Note *note, f32 resamplingRateInput) {
|
||||
note->noteSubEu.resamplingRateFixedPoint = (s32) (resamplingRate * 32768.0f);
|
||||
}
|
||||
|
||||
struct AudioBankSound *func_eu_802e4e5c(struct Instrument *instrument, s32 semitone) {
|
||||
struct AudioBankSound *instrument_get_audio_bank_sound(struct Instrument *instrument, s32 semitone) {
|
||||
struct AudioBankSound *sound;
|
||||
if (semitone < instrument->normalRangeLo) {
|
||||
sound = &instrument->lowNotesSound;
|
||||
@@ -114,7 +114,7 @@ struct AudioBankSound *func_eu_802e4e5c(struct Instrument *instrument, s32 semit
|
||||
return sound;
|
||||
}
|
||||
|
||||
struct Instrument *func_eu_802e4e98(s32 bankId, s32 instId) {
|
||||
struct Instrument *get_instrument_inner(s32 bankId, s32 instId) {
|
||||
struct Instrument *inst;
|
||||
|
||||
if (IS_BANK_LOAD_COMPLETE(bankId) == FALSE) {
|
||||
@@ -146,7 +146,7 @@ struct Instrument *func_eu_802e4e98(s32 bankId, s32 instId) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct Drum *func_eu_802e4fb8(s32 bankId, s32 drumId) {
|
||||
struct Drum *get_drum(s32 bankId, s32 drumId) {
|
||||
struct Drum *drum;
|
||||
if (drumId >= gCtlEntries[bankId].numDrums) {
|
||||
gAudioErrorFlags = ((bankId << 8) + drumId) + 0x4000000;
|
||||
@@ -223,7 +223,7 @@ void process_notes(void) {
|
||||
u8 reverb;
|
||||
UNUSED u8 pad3;
|
||||
u8 pan;
|
||||
u8 unk;
|
||||
u8 bookOffset;
|
||||
#endif
|
||||
struct NoteAttributes *attributes;
|
||||
#ifndef VERSION_EU
|
||||
@@ -321,13 +321,13 @@ void process_notes(void) {
|
||||
reverb = attributes->reverb;
|
||||
if (1) {
|
||||
}
|
||||
unk = noteSubEu->unk1b234;
|
||||
bookOffset = noteSubEu->bookOffset;
|
||||
} else {
|
||||
frequency = playbackState->parentLayer->noteFreqScale;
|
||||
velocity = playbackState->parentLayer->noteVelocity;
|
||||
pan = playbackState->parentLayer->notePan;
|
||||
reverb = playbackState->parentLayer->seqChannel->reverb;
|
||||
unk = playbackState->parentLayer->seqChannel->unk8 & 0x7; // bitfield?
|
||||
bookOffset = playbackState->parentLayer->seqChannel->bookOffset & 0x7;
|
||||
}
|
||||
|
||||
frequency *= playbackState->vibratoFreqScale * playbackState->portamentoFreqScale;
|
||||
@@ -335,7 +335,7 @@ void process_notes(void) {
|
||||
velocity = velocity * scale * scale;
|
||||
note_set_resampling_rate(note, frequency);
|
||||
note_set_vel_pan_reverb(note, velocity, pan, reverb);
|
||||
noteSubEu->unk1b234 = unk;
|
||||
noteSubEu->bookOffset = bookOffset;
|
||||
skip:;
|
||||
}
|
||||
#else
|
||||
@@ -589,7 +589,7 @@ void init_synthetic_wave(struct Note *note, struct SequenceChannelLayer *seqLaye
|
||||
#ifdef VERSION_EU
|
||||
s32 sampleCountIndex;
|
||||
s32 waveSampleCountIndex;
|
||||
s32 waveId = seqLayer->euUnk1;
|
||||
s32 waveId = seqLayer->instOrWave;
|
||||
if (waveId == 0xff) {
|
||||
waveId = seqLayer->seqChannel->instOrWave;
|
||||
}
|
||||
@@ -799,14 +799,14 @@ void note_init_for_layer(struct Note *note, struct SequenceChannelLayer *seqLaye
|
||||
note->prevParentLayer = NO_LAYER;
|
||||
note->parentLayer = seqLayer;
|
||||
note->priority = seqLayer->seqChannel->notePriority;
|
||||
seqLayer->unkEu0b4 = TRUE;
|
||||
seqLayer->notePropertiesNeedInit = TRUE;
|
||||
seqLayer->status = SOUND_LOAD_STATUS_DISCARDABLE; // "loaded"
|
||||
seqLayer->note = note;
|
||||
seqLayer->seqChannel->noteUnused = note;
|
||||
seqLayer->seqChannel->layerUnused = seqLayer;
|
||||
seqLayer->noteVelocity = 0.0f;
|
||||
note_init(note);
|
||||
instId = seqLayer->euUnk1;
|
||||
instId = seqLayer->instOrWave;
|
||||
if (instId == 0xff) {
|
||||
instId = seqLayer->seqChannel->instOrWave;
|
||||
}
|
||||
@@ -823,7 +823,7 @@ void note_init_for_layer(struct Note *note, struct SequenceChannelLayer *seqLaye
|
||||
}
|
||||
sub->bankId = seqLayer->seqChannel->bankId;
|
||||
sub->stereoHeadsetEffects = seqLayer->seqChannel->stereoHeadsetEffects;
|
||||
sub->unk1b567 = seqLayer->seqChannel->reverbIndex & 3;
|
||||
sub->reverbIndex = seqLayer->seqChannel->reverbIndex & 3;
|
||||
}
|
||||
#else
|
||||
s32 note_init_for_layer(struct Note *note, struct SequenceChannelLayer *seqLayer) {
|
||||
|
||||
@@ -29,8 +29,9 @@ void reclaim_notes(void);
|
||||
void note_init_all(void);
|
||||
|
||||
#ifdef VERSION_EU
|
||||
struct AudioBankSound *func_eu_802e4e5c(struct Instrument *instrument, s32 semitone);
|
||||
struct Drum *func_eu_802e4fb8(s32 bankId, s32 drumId);
|
||||
struct AudioBankSound *instrument_get_audio_bank_sound(struct Instrument *instrument, s32 semitone);
|
||||
struct Instrument *get_instrument_inner(s32 bankId, s32 instId);
|
||||
struct Drum *get_drum(s32 bankId, s32 drumId);
|
||||
void note_init_volume(struct Note *note);
|
||||
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb);
|
||||
void note_set_frequency(struct Note *note, f32 frequency);
|
||||
|
||||
+15
-15
@@ -29,9 +29,9 @@ extern struct EuAudioCmd sAudioCmd[0x100];
|
||||
|
||||
void func_8031D690(s32 player, FadeT fadeInTime);
|
||||
void sequence_player_fade_out_internal(s32 player, FadeT fadeOutTime);
|
||||
void func_802ad668(void);
|
||||
void port_eu_init_queues(void);
|
||||
void decrease_sample_dma_ttls(void);
|
||||
s32 func_eu_802E2AA0(void);
|
||||
s32 audio_shut_down_and_reset_step(void);
|
||||
void func_802ad7ec(u32);
|
||||
|
||||
struct SPTask *create_next_audio_frame_task(void) {
|
||||
@@ -76,7 +76,7 @@ struct SPTask *create_next_audio_frame_task(void) {
|
||||
}
|
||||
|
||||
if (gAudioResetStatus != 0) {
|
||||
if (func_eu_802E2AA0() == 0) {
|
||||
if (audio_shut_down_and_reset_step() == 0) {
|
||||
if (gAudioResetStatus == 0) {
|
||||
osSendMesg(OSMesgQueues[3], (OSMesg) (s32) gAudioResetPresetIdToLoad, OS_MESG_NOBLOCK);
|
||||
}
|
||||
@@ -164,14 +164,14 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
case 0xf1:
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSequencePlayers[i].muted = TRUE;
|
||||
gSequencePlayers[i].unk_eu = TRUE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xf2:
|
||||
for (i = 0; i < 4; i++) {
|
||||
gSequencePlayers[i].muted = FALSE;
|
||||
gSequencePlayers[i].unk_eu = TRUE;
|
||||
gSequencePlayers[i].recalculateVolume = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ void func_8031D690(s32 player, FadeT fadeInTime) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802ad668(void) {
|
||||
void port_eu_init_queues(void) {
|
||||
D_EU_80302010 = 0;
|
||||
D_EU_80302014 = 0;
|
||||
osCreateMesgQueue(OSMesgQueues[0], &OSMesg0, 1);
|
||||
@@ -262,8 +262,8 @@ void func_802ad7ec(u32 arg0) {
|
||||
else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
switch (cmd->u.s.op) {
|
||||
case 0x41:
|
||||
seqPlayer->unkEu28 = cmd->u2.as_f32;
|
||||
seqPlayer->unk_eu = TRUE;
|
||||
seqPlayer->fadeVolumeScale = cmd->u2.as_f32;
|
||||
seqPlayer->recalculateVolume = TRUE;
|
||||
break;
|
||||
|
||||
case 0x47:
|
||||
@@ -286,19 +286,19 @@ void func_802ad7ec(u32 arg0) {
|
||||
switch (cmd->u.s.op) {
|
||||
case 1:
|
||||
chan->volumeScale = cmd->u2.as_f32;
|
||||
chan->unk1.as_bitfields.unk0b40 = TRUE;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
break;
|
||||
case 2:
|
||||
chan->volume = cmd->u2.as_f32;
|
||||
chan->unk1.as_bitfields.unk0b40 = TRUE;
|
||||
chan->changes.as_bitfields.volume = TRUE;
|
||||
break;
|
||||
case 3:
|
||||
chan->unk9 = cmd->u2.as_s8;
|
||||
chan->unk1.as_bitfields.unk0b20 = TRUE;
|
||||
chan->newPan = cmd->u2.as_s8;
|
||||
chan->changes.as_bitfields.pan = TRUE;
|
||||
break;
|
||||
case 4:
|
||||
chan->freqScale = cmd->u2.as_f32;
|
||||
chan->unk1.as_bitfields.unk0b80 = TRUE;
|
||||
chan->changes.as_bitfields.freqScale = TRUE;
|
||||
break;
|
||||
case 5:
|
||||
chan->reverb = cmd->u2.as_s8;
|
||||
@@ -319,8 +319,8 @@ void func_802ad7ec(u32 arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802ada64(void) {
|
||||
func_802ad668();
|
||||
void port_eu_init(void) {
|
||||
port_eu_init_queues();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+68
-64
@@ -1,7 +1,7 @@
|
||||
#include <ultra64.h>
|
||||
#include <macros.h>
|
||||
|
||||
#include "memory.h"
|
||||
#include "heap.h"
|
||||
#include "data.h"
|
||||
#include "load.h"
|
||||
#include "seqplayer.h"
|
||||
@@ -33,11 +33,11 @@ void sequence_channel_init(struct SequenceChannel *seqChannel) {
|
||||
seqChannel->transposition = 0;
|
||||
seqChannel->largeNotes = FALSE;
|
||||
#ifdef VERSION_EU
|
||||
seqChannel->unk8 = 0;
|
||||
seqChannel->unk1.as_u8 = 0xff;
|
||||
seqChannel->bookOffset = 0;
|
||||
seqChannel->changes.as_u8 = 0xff;
|
||||
seqChannel->scriptState.depth = 0;
|
||||
seqChannel->unk9 = 0x40;
|
||||
seqChannel->unkA = 0x80;
|
||||
seqChannel->newPan = 0x40;
|
||||
seqChannel->panChannelWeight = 0x80;
|
||||
seqChannel->noteUnused = NULL;
|
||||
seqChannel->reverbIndex = 0;
|
||||
#else
|
||||
@@ -105,14 +105,14 @@ s32 seq_channel_set_layer(struct SequenceChannel *seqChannel, s32 layerIndex) {
|
||||
layer->continuousNotes = FALSE;
|
||||
layer->finished = FALSE;
|
||||
#ifdef VERSION_EU
|
||||
layer->unkEu0b2 = FALSE;
|
||||
layer->ignoreDrumPan = FALSE;
|
||||
#endif
|
||||
layer->portamento.mode = 0;
|
||||
layer->scriptState.depth = 0;
|
||||
layer->status = SOUND_LOAD_STATUS_NOT_LOADED;
|
||||
layer->noteDuration = 0x80;
|
||||
#ifdef VERSION_EU
|
||||
layer->euUnk5 = 0x40;
|
||||
layer->pan = 0x40;
|
||||
#endif
|
||||
layer->transposition = 0;
|
||||
layer->delay = 0;
|
||||
@@ -123,7 +123,7 @@ s32 seq_channel_set_layer(struct SequenceChannel *seqChannel, s32 layerIndex) {
|
||||
#ifdef VERSION_EU
|
||||
layer->freqScale = 1.0f;
|
||||
layer->velocitySquare = 0.0f;
|
||||
layer->euUnk1 = 0xff;
|
||||
layer->instOrWave = 0xff;
|
||||
#else
|
||||
layer->velocitySquare = 0.0f;
|
||||
layer->pan = 0.5f;
|
||||
@@ -244,18 +244,18 @@ void sequence_player_disable_channels(struct SequencePlayer *seqPlayer, u16 chan
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(VERSION_EU) && !defined(NON_MATCHING)
|
||||
GLOBAL_ASM("asm/non_matchings/eu/audio/sequence_channel_enable.s")
|
||||
#else
|
||||
void sequence_channel_enable(struct SequencePlayer *seqPlayer, u8 channelIndex, void *arg2) {
|
||||
struct SequenceChannel *seqChannel = seqPlayer->channels[channelIndex];
|
||||
s32 i;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
if (IS_SEQUENCE_CHANNEL_VALID(seqChannel) == FALSE) {
|
||||
// not matching exactly, but this is the logic at least (stubbed printfs?)
|
||||
if (seqPlayer == &gSequencePlayers[0]) {
|
||||
} else if (seqPlayer == &gSequencePlayers[1]) {
|
||||
struct SequencePlayer *bgMusic = &gSequencePlayers[0];
|
||||
struct SequencePlayer *miscMusic = &gSequencePlayers[1];
|
||||
|
||||
if (seqPlayer == bgMusic) {
|
||||
} else if (seqPlayer == miscMusic) {
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
#else
|
||||
@@ -273,7 +273,6 @@ void sequence_channel_enable(struct SequencePlayer *seqPlayer, u8 channelIndex,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void sequence_player_disable(struct SequencePlayer *seqPlayer) {
|
||||
sequence_player_disable_channels(seqPlayer, 0xffff);
|
||||
@@ -464,7 +463,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
seqPlayer = seqChannel->seqPlayer;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
layer->unkEu0b4 = TRUE;
|
||||
layer->notePropertiesNeedInit = TRUE;
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
@@ -553,7 +552,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
layer->velocitySquare = (f32)(temp_a0_5 * temp_a0_5);
|
||||
} else {
|
||||
#ifdef VERSION_EU
|
||||
layer->euUnk5 = temp_a0_5;
|
||||
layer->pan = temp_a0_5;
|
||||
#else
|
||||
layer->pan = (f32) temp_a0_5 / US_FLOAT(128.0);
|
||||
#endif
|
||||
@@ -624,9 +623,9 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
if (instId >= 0x7f) {
|
||||
#ifdef VERSION_EU
|
||||
if (instId == 0x7f) {
|
||||
layer->euUnk1 = 0;
|
||||
layer->instOrWave = 0;
|
||||
} else {
|
||||
layer->euUnk1 = instId;
|
||||
layer->instOrWave = instId;
|
||||
layer->instrument = NULL;
|
||||
}
|
||||
if (instId != 0xff) {
|
||||
@@ -639,11 +638,11 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
|
||||
#ifdef VERSION_EU
|
||||
instId = get_instrument(seqChannel, instId, &layer->instrument, &layer->adsr);
|
||||
layer->euUnk1 = instId;
|
||||
layer->instOrWave = instId;
|
||||
if (instId == 0) {
|
||||
layer->euUnk1 = 0xff;
|
||||
layer->instOrWave = 0xff;
|
||||
}
|
||||
//layer->euUnk1 = instId == 0 ? 0xff : instId;
|
||||
//layer->instOrWave = instId == 0 ? 0xff : instId;
|
||||
break;
|
||||
#else
|
||||
bankId = seqChannel->bankId; // maybe a temp, to match get_instrument
|
||||
@@ -732,7 +731,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
break;
|
||||
|
||||
case 0xcc:
|
||||
layer->unkEu0b2 = TRUE;
|
||||
layer->ignoreDrumPan = TRUE;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -869,9 +868,9 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
layer->stopSomething = TRUE;
|
||||
} else {
|
||||
#ifdef VERSION_EU
|
||||
if ((layer->euUnk1 == 0xff ? seqChannel->instOrWave : layer->euUnk1) == 0) {
|
||||
if ((layer->instOrWave == 0xff ? seqChannel->instOrWave : layer->instOrWave) == 0) {
|
||||
drumIndex = cmdSemitone + seqChannel->transposition + layer->transposition;
|
||||
drum = func_eu_802e4fb8(seqChannel->bankId, drumIndex);
|
||||
drum = get_drum(seqChannel->bankId, drumIndex);
|
||||
#else
|
||||
if (seqChannel->instOrWave == 0) { // drum
|
||||
drumIndex = cmdSemitone + seqChannel->transposition + layer->transposition;
|
||||
@@ -893,8 +892,8 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
layer->adsr.envelope = drum->envelope;
|
||||
layer->adsr.releaseRate = drum->releaseRate;
|
||||
#ifdef VERSION_EU
|
||||
if (!layer->unkEu0b2) {
|
||||
layer->euUnk5 = drum->pan;
|
||||
if (!layer->ignoreDrumPan) {
|
||||
layer->pan = drum->pan;
|
||||
}
|
||||
#else
|
||||
layer->pan = FLOAT_CAST(drum->pan) / US_FLOAT(128.0);
|
||||
@@ -912,7 +911,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
layer->stopSomething = TRUE;
|
||||
} else {
|
||||
#ifdef VERSION_EU
|
||||
if (layer->euUnk1 == 0xff) {
|
||||
if (layer->instOrWave == 0xff) {
|
||||
instrument = seqChannel->instrument;
|
||||
} else {
|
||||
instrument = layer->instrument;
|
||||
@@ -931,7 +930,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
}
|
||||
if (instrument != NULL) {
|
||||
#ifdef VERSION_EU
|
||||
sound = func_eu_802e4e5c(instrument, usedSemitone);
|
||||
sound = instrument_get_audio_bank_sound(instrument, usedSemitone);
|
||||
#else
|
||||
if (usedSemitone < instrument->normalRangeLo) {
|
||||
sound = &instrument->lowNotesSound;
|
||||
@@ -990,7 +989,7 @@ void seq_channel_layer_process_script(struct SequenceChannelLayer *layer) {
|
||||
}
|
||||
} else if (instrument != NULL) {
|
||||
#ifdef VERSION_EU
|
||||
sound = func_eu_802e4e5c(instrument, semitone);
|
||||
sound = instrument_get_audio_bank_sound(instrument, semitone);
|
||||
#else
|
||||
if (semitone < instrument->normalRangeLo) {
|
||||
sound = &instrument->lowNotesSound;
|
||||
@@ -1055,14 +1054,12 @@ GLOBAL_ASM("asm/non_matchings/seq_channel_layer_process_script_jp.s")
|
||||
GLOBAL_ASM("asm/non_matchings/seq_channel_layer_process_script_us.s")
|
||||
#endif
|
||||
|
||||
struct Instrument *func_eu_802e4e98(s32 bankId, s32 instId);
|
||||
|
||||
u8 get_instrument(struct SequenceChannel *seqChannel, u8 instId, struct Instrument **instOut,
|
||||
struct AdsrSettings *adsr)
|
||||
{
|
||||
struct Instrument *inst;
|
||||
#ifdef VERSION_EU
|
||||
inst = func_eu_802e4e98(seqChannel->bankId, instId);
|
||||
inst = get_instrument_inner(seqChannel->bankId, instId);
|
||||
if (inst == NULL)
|
||||
{
|
||||
*instOut = NULL;
|
||||
@@ -1362,21 +1359,21 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
case 0xdf: // chan_setvol
|
||||
sequence_channel_set_volume(seqChannel, m64_read_u8(state));
|
||||
#ifdef VERSION_EU
|
||||
seqChannel->unk1.as_bitfields.unk0b40 = TRUE;
|
||||
seqChannel->changes.as_bitfields.volume = TRUE;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0xe0: // chan_setvolscale
|
||||
seqChannel->volumeScale = FLOAT_CAST(m64_read_u8(state)) / US_FLOAT(128.0);
|
||||
#ifdef VERSION_EU
|
||||
seqChannel->unk1.as_bitfields.unk0b40 = TRUE;
|
||||
seqChannel->changes.as_bitfields.volume = TRUE;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0xde: // chan_freqscale; pitch bend using raw frequency multiplier N/2^15 (N is u16)
|
||||
sp5A = m64_read_s16(state);
|
||||
#ifdef VERSION_EU
|
||||
seqChannel->unk1.as_bitfields.unk0b80 = TRUE;
|
||||
seqChannel->changes.as_bitfields.freqScale = TRUE;
|
||||
#endif
|
||||
seqChannel->freqScale = FLOAT_CAST(sp5A) / US_FLOAT(32768.0);
|
||||
break;
|
||||
@@ -1386,14 +1383,14 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
temp = m64_read_u8(state) + 127;
|
||||
seqChannel->freqScale = gPitchBendFrequencyScale[temp];
|
||||
#ifdef VERSION_EU
|
||||
seqChannel->unk1.as_bitfields.unk0b80 = TRUE;
|
||||
seqChannel->changes.as_bitfields.freqScale = TRUE;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 0xdd: // chan_setpan
|
||||
#ifdef VERSION_EU
|
||||
seqChannel->unk9 = m64_read_u8(state);
|
||||
seqChannel->unk1.as_bitfields.unk0b20 = TRUE;
|
||||
seqChannel->newPan = m64_read_u8(state);
|
||||
seqChannel->changes.as_bitfields.pan = TRUE;
|
||||
#else
|
||||
seqChannel->pan = FLOAT_CAST(m64_read_u8(state)) / US_FLOAT(128.0);
|
||||
#endif
|
||||
@@ -1401,8 +1398,8 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
|
||||
case 0xdc: // chan_setpanmix; set proportion of pan to come from channel (0..128)
|
||||
#ifdef VERSION_EU
|
||||
seqChannel->unkA = m64_read_u8(state);
|
||||
seqChannel->unk1.as_bitfields.unk0b20 = TRUE;
|
||||
seqChannel->panChannelWeight = m64_read_u8(state);
|
||||
seqChannel->changes.as_bitfields.pan = TRUE;
|
||||
#else
|
||||
seqChannel->panChannelWeight = FLOAT_CAST(m64_read_u8(state)) / US_FLOAT(128.0);
|
||||
#endif
|
||||
@@ -1544,7 +1541,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
|
||||
#ifdef VERSION_EU
|
||||
case 0xe6:
|
||||
seqChannel->unk8 = m64_read_u8(state);
|
||||
seqChannel->bookOffset = m64_read_u8(state);
|
||||
break;
|
||||
|
||||
case 0xe7:
|
||||
@@ -1554,11 +1551,11 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
seqChannel->noteAllocPolicy = *arr++;
|
||||
seqChannel->notePriority = *arr++;
|
||||
seqChannel->transposition = (s8) *arr++;
|
||||
seqChannel->unk9 = *arr++;
|
||||
seqChannel->unkA = *arr++;
|
||||
seqChannel->newPan = *arr++;
|
||||
seqChannel->panChannelWeight = *arr++;
|
||||
seqChannel->reverb = *arr++;
|
||||
seqChannel->reverbIndex = *arr++; // reverb index?
|
||||
seqChannel->unk1.as_bitfields.unk0b20 = TRUE;
|
||||
seqChannel->changes.as_bitfields.pan = TRUE;
|
||||
break;
|
||||
|
||||
case 0xe8:
|
||||
@@ -1566,11 +1563,11 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
seqChannel->noteAllocPolicy = m64_read_u8(state);
|
||||
seqChannel->notePriority = m64_read_u8(state);
|
||||
seqChannel->transposition = (s8) m64_read_u8(state);
|
||||
seqChannel->unk9 = m64_read_u8(state);
|
||||
seqChannel->unkA = m64_read_u8(state);
|
||||
seqChannel->newPan = m64_read_u8(state);
|
||||
seqChannel->panChannelWeight = m64_read_u8(state);
|
||||
seqChannel->reverb = m64_read_u8(state);
|
||||
seqChannel->reverbIndex = m64_read_u8(state);
|
||||
seqChannel->unk1.as_bitfields.unk0b20 = TRUE;
|
||||
seqChannel->changes.as_bitfields.pan = TRUE;
|
||||
break;
|
||||
|
||||
case 0xec:
|
||||
@@ -1689,14 +1686,10 @@ GLOBAL_ASM("asm/non_matchings/sequence_channel_process_script_jp.s")
|
||||
GLOBAL_ASM("asm/non_matchings/sequence_channel_process_script_us.s")
|
||||
#endif
|
||||
|
||||
#if defined(VERSION_EU) && !defined(NON_MATCHING)
|
||||
GLOBAL_ASM("asm/non_matchings/eu/audio/sequence_player_process_sequence.s")
|
||||
#else
|
||||
void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
u8 cmd;
|
||||
u8 loBits;
|
||||
u8 temp;
|
||||
s8 tempSigned;
|
||||
s32 value;
|
||||
s32 i;
|
||||
u16 u16v;
|
||||
@@ -1758,6 +1751,10 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
if (osRecvMesg(&seqPlayer->seqDmaMesgQueue, NULL, 0) == -1) {
|
||||
return;
|
||||
}
|
||||
#ifndef AVOID_UB
|
||||
if (temp) {
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
if (seqPlayer->seqDmaMesg == NULL) {
|
||||
return;
|
||||
@@ -1791,10 +1788,14 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
|
||||
state = &seqPlayer->scriptState;
|
||||
if (seqPlayer->delay > 1) {
|
||||
#ifndef AVOID_UB
|
||||
if (temp) {
|
||||
}
|
||||
#endif
|
||||
seqPlayer->delay--;
|
||||
} else {
|
||||
#ifdef VERSION_EU
|
||||
seqPlayer->unk_eu = 1;
|
||||
seqPlayer->recalculateVolume = 1;
|
||||
#endif
|
||||
for (;;) {
|
||||
cmd = m64_read_u8(state);
|
||||
@@ -1804,7 +1805,11 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
sequence_player_disable(seqPlayer);
|
||||
break;
|
||||
}
|
||||
#ifdef VERSION_EU
|
||||
state->pc = state->stack[--state->depth];
|
||||
#else
|
||||
state->depth--, state->pc = state->stack[state->depth];
|
||||
#endif
|
||||
}
|
||||
|
||||
if (cmd == 0xfd) // seq_delay
|
||||
@@ -1873,14 +1878,14 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
case 0xf4:
|
||||
case 0xf3:
|
||||
case 0xf2:
|
||||
tempSigned = m64_read_u8(state);
|
||||
temp = m64_read_u8(state);
|
||||
if (cmd == 0xf3 && value != 0) {
|
||||
break;
|
||||
}
|
||||
if (cmd == 0xf2 && value >= 0) {
|
||||
break;
|
||||
}
|
||||
state->pc += tempSigned;
|
||||
state->pc += (s8)temp;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1942,7 +1947,7 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
case SEQUENCE_PLAYER_STATE_2:
|
||||
seqPlayer->fadeTimer = u16v;
|
||||
seqPlayer->state = temp;
|
||||
seqPlayer->fadeVelocity = (0.0f - seqPlayer->fadeVolume) / (s32) u16v;
|
||||
seqPlayer->fadeVelocity = (0.0f - seqPlayer->fadeVolume) / (s32) (u16v & 0xFFFFu);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -1988,16 +1993,16 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
break;
|
||||
|
||||
case 0xda: // seq_changevol
|
||||
tempSigned = m64_read_u8(state);
|
||||
temp = m64_read_u8(state);
|
||||
seqPlayer->fadeVolume =
|
||||
seqPlayer->fadeVolume + (f32) tempSigned / US_FLOAT(127.0);
|
||||
seqPlayer->fadeVolume + (f32) (s8)temp / US_FLOAT(127.0);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
case 0xd9:
|
||||
tempSigned = m64_read_u8(state);
|
||||
seqPlayer->unkEu28 = tempSigned / 127.0f;
|
||||
temp = m64_read_u8(state);
|
||||
seqPlayer->fadeVolumeScale = (s8)temp / 127.0f;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -2012,8 +2017,8 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
break;
|
||||
|
||||
case 0xd5: // seq_setmutescale
|
||||
tempSigned = m64_read_u8(state);
|
||||
seqPlayer->muteVolumeScale = (f32) tempSigned / US_FLOAT(127.0);
|
||||
temp = m64_read_u8(state);
|
||||
seqPlayer->muteVolumeScale = (f32) (s8)temp / US_FLOAT(127.0);
|
||||
break;
|
||||
|
||||
case 0xd4: // seq_mute
|
||||
@@ -2125,7 +2130,6 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// This runs 240 times per second.
|
||||
void process_sequences(UNUSED s32 iterationsRemaining) {
|
||||
@@ -2172,7 +2176,7 @@ void init_sequence_player(u32 player) {
|
||||
seqPlayer->shortNoteDurationTable = gDefaultShortNoteDurationTable;
|
||||
seqPlayer->fadeVolume = 1.0f;
|
||||
#ifdef VERSION_EU
|
||||
seqPlayer->unkEu28 = 1.0f;
|
||||
seqPlayer->fadeVolumeScale = 1.0f;
|
||||
#endif
|
||||
seqPlayer->fadeVelocity = 0.0f;
|
||||
seqPlayer->volume = 0.0f;
|
||||
|
||||
+131
-156
@@ -2,7 +2,7 @@
|
||||
#include <macros.h>
|
||||
|
||||
#include "synthesis.h"
|
||||
#include "memory.h"
|
||||
#include "heap.h"
|
||||
#include "data.h"
|
||||
#include "load.h"
|
||||
#include "seqplayer.h"
|
||||
@@ -81,19 +81,16 @@ u8 sAudioSynthesisPad[0x20];
|
||||
#endif
|
||||
|
||||
#if defined(VERSION_EU)
|
||||
#ifndef NON_MATCHING
|
||||
GLOBAL_ASM("asm/non_matchings/eu/audio/prepare_reverb_ring_buffer.s")
|
||||
#else
|
||||
// Equivalent functionality as the US/JP version,
|
||||
// just that the reverb structure is chosen from an array with index
|
||||
void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex) {
|
||||
struct SynthesisReverb *reverb = &gSynthesisReverbs[reverbIndex];
|
||||
struct ReverbRingBufferItem *item;
|
||||
struct SynthesisReverb *reverb = &gSynthesisReverbs[reverbIndex];
|
||||
s32 srcPos;
|
||||
s32 dstPos;
|
||||
s32 nSamples;
|
||||
//s32 numSamplesAfterDownsampling;
|
||||
s32 excessiveSamples;
|
||||
s32 UNUSED pad[3];
|
||||
if (reverb->downsampleRate != 1) {
|
||||
if (reverb->framesLeftToIgnore == 0) {
|
||||
// Now that the RSP has finished, downsample the samples produced two frames ago by skipping
|
||||
@@ -105,9 +102,9 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
|
||||
|
||||
for (srcPos = 0, dstPos = 0; dstPos < item->lengths[0] / 2;
|
||||
srcPos += reverb->downsampleRate, dstPos++) {
|
||||
reverb->ringBuffer.left[dstPos + item->startPos] =
|
||||
reverb->ringBuffer.left[item->startPos + dstPos] =
|
||||
item->toDownsampleLeft[srcPos];
|
||||
reverb->ringBuffer.right[dstPos + item->startPos] =
|
||||
reverb->ringBuffer.right[item->startPos + dstPos] =
|
||||
item->toDownsampleRight[srcPos];
|
||||
}
|
||||
for (dstPos = 0; dstPos < item->lengths[1] / 2; srcPos += reverb->downsampleRate, dstPos++) {
|
||||
@@ -117,11 +114,9 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
|
||||
}
|
||||
}
|
||||
|
||||
//numSamplesAfterDownsampling =
|
||||
nSamples = chunkLen / reverb->downsampleRate;
|
||||
excessiveSamples =
|
||||
(nSamples + reverb->nextRingBufferPos) - reverb->bufSizePerChannel;
|
||||
item = &reverb->items[reverb->curFrame][updateIndex];
|
||||
nSamples = chunkLen / reverb->downsampleRate;
|
||||
excessiveSamples = (nSamples + reverb->nextRingBufferPos) - reverb->bufSizePerChannel;
|
||||
if (excessiveSamples < 0) {
|
||||
// There is space in the ring buffer before it wraps around
|
||||
item->lengths[0] = nSamples * 2;
|
||||
@@ -130,7 +125,6 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
|
||||
reverb->nextRingBufferPos += nSamples;
|
||||
} else {
|
||||
// Ring buffer wrapped around
|
||||
//nSamples = numSamplesAfterDownsampling - excessiveSamples;
|
||||
item->lengths[0] = (nSamples - excessiveSamples) * 2;
|
||||
item->lengths[1] = excessiveSamples * 2;
|
||||
item->startPos = reverb->nextRingBufferPos;
|
||||
@@ -140,7 +134,6 @@ void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex, s32 reverbIndex)
|
||||
item->numSamplesAfterDownsampling = nSamples;
|
||||
item->chunkLen = chunkLen;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
void prepare_reverb_ring_buffer(s32 chunkLen, u32 updateIndex) {
|
||||
struct ReverbRingBufferItem *item;
|
||||
@@ -261,50 +254,33 @@ s32 get_volume_ramping(u16 sourceVol, u16 targetVol, s32 arg2) {
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#ifndef NON_MATCHING
|
||||
GLOBAL_ASM("asm/non_matchings/eu/audio/synthesis_execute.s")
|
||||
#else
|
||||
//TODO: (Scrub C) pointless mask and whitespace
|
||||
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen) {
|
||||
s32 nextVolRampTable;
|
||||
s32 temp;
|
||||
s32 i;
|
||||
s32 remaining;
|
||||
s32 i, j;
|
||||
f32 *leftVolRamp;
|
||||
f32 *rightVolRamp;
|
||||
s32 chunkLen;
|
||||
s32 j;
|
||||
u32 *aiBufPtr;
|
||||
u64 *cmd = cmdBuf;
|
||||
s32 chunkLen;
|
||||
s32 nextVolRampTable;
|
||||
|
||||
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) {
|
||||
process_sequences(i - 1);
|
||||
synthesis_load_note_subs_eu(gAudioBufferParameters.updatesPerFrame - i);
|
||||
}
|
||||
aSegment(cmd++, 0, 0);
|
||||
remaining = bufLen;
|
||||
aiBufPtr = (u32 *) aiBuf;
|
||||
for (i = gAudioBufferParameters.updatesPerFrame; i > 0; i--) {
|
||||
if (i == 1) {
|
||||
leftVolRamp = gLeftVolRampings[nextVolRampTable];
|
||||
rightVolRamp = gRightVolRampings[nextVolRampTable];
|
||||
chunkLen = remaining;
|
||||
// self-assignment has no affect when added here, could possibly simplify a macro definition
|
||||
chunkLen = bufLen; nextVolRampTable = nextVolRampTable; leftVolRamp = gLeftVolRampings[nextVolRampTable]; rightVolRamp = gRightVolRampings[nextVolRampTable & 0xFFFFFFFF];
|
||||
} else {
|
||||
temp = remaining / i;
|
||||
if (temp >= gAudioBufferParameters.samplesPerUpdateMax) {
|
||||
leftVolRamp = gLeftVolRampings[2];
|
||||
rightVolRamp = gRightVolRampings[2];
|
||||
chunkLen = gAudioBufferParameters.samplesPerUpdateMax;
|
||||
nextVolRampTable = 2;
|
||||
} else if (temp <= gAudioBufferParameters.samplesPerUpdateMin) {
|
||||
leftVolRamp = gLeftVolRampings[0];
|
||||
rightVolRamp = gRightVolRampings[0];
|
||||
chunkLen = gAudioBufferParameters.samplesPerUpdateMin;
|
||||
nextVolRampTable = 0;
|
||||
if (bufLen / i >= gAudioBufferParameters.samplesPerUpdateMax) {
|
||||
chunkLen = gAudioBufferParameters.samplesPerUpdateMax; nextVolRampTable = 2; leftVolRamp = gLeftVolRampings[2]; rightVolRamp = gRightVolRampings[2];
|
||||
} else if (bufLen / i <= gAudioBufferParameters.samplesPerUpdateMin) {
|
||||
chunkLen = gAudioBufferParameters.samplesPerUpdateMin; nextVolRampTable = 0; leftVolRamp = gLeftVolRampings[0]; rightVolRamp = gRightVolRampings[0];
|
||||
} else {
|
||||
leftVolRamp = gLeftVolRampings[1];
|
||||
rightVolRamp = gRightVolRampings[1];
|
||||
chunkLen = gAudioBufferParameters.samplesPerUpdate;
|
||||
nextVolRampTable = 1;
|
||||
chunkLen = gAudioBufferParameters.samplesPerUpdate; nextVolRampTable = 1; leftVolRamp = gLeftVolRampings[1]; rightVolRamp = gRightVolRampings[1];
|
||||
}
|
||||
}
|
||||
gCurrentLeftVolRamping = leftVolRamp;
|
||||
@@ -315,19 +291,19 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen) {
|
||||
}
|
||||
}
|
||||
cmd = synthesis_do_one_audio_update((u16 *) aiBufPtr, chunkLen, cmd, gAudioBufferParameters.updatesPerFrame - i);
|
||||
remaining -= chunkLen;
|
||||
bufLen -= chunkLen;
|
||||
aiBufPtr += chunkLen;
|
||||
}
|
||||
for (i = 0; i < gNumSynthesisReverbs; i++) {
|
||||
if (gSynthesisReverbs[i].framesLeftToIgnore != 0) {
|
||||
gSynthesisReverbs[i].framesLeftToIgnore--;
|
||||
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++) {
|
||||
if (gSynthesisReverbs[j].framesLeftToIgnore != 0) {
|
||||
gSynthesisReverbs[j].framesLeftToIgnore--;
|
||||
}
|
||||
gSynthesisReverbs[i].curFrame ^= 1;
|
||||
gSynthesisReverbs[j].curFrame ^= 1;
|
||||
}
|
||||
*writtenCmds = cmd - cmdBuf;
|
||||
return cmd;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
// bufLen will be divisible by 16
|
||||
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen) {
|
||||
@@ -372,171 +348,153 @@ u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, u16 *aiBuf, s32 bufLen) {
|
||||
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#ifndef NON_MATCHING
|
||||
GLOBAL_ASM("asm/non_matchings/eu/audio/synthesis_resample_and_mix_reverb.s")
|
||||
u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s16 updateIndex);
|
||||
#else
|
||||
u64 *synthesis_resample_and_mix_reverb(u64 *cmd, s32 bufLen, s16 reverbIndex, s16 updateIndex) {
|
||||
struct ReverbRingBufferItem *item; // sp5C
|
||||
struct ReverbRingBufferItem *item;
|
||||
s16 temp_t9; // sp5a
|
||||
s16 sp58; // sp58
|
||||
struct SynthesisReverb *reverb;
|
||||
|
||||
reverb = &gSynthesisReverbs[reverbIndex];
|
||||
item = &reverb->items[reverb->curFrame][updateIndex];
|
||||
item = &gSynthesisReverbs[reverbIndex].items[gSynthesisReverbs[reverbIndex].curFrame][updateIndex];
|
||||
|
||||
aClearBuffer(cmd++, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
if (reverb->downsampleRate == 1) {
|
||||
if (gSynthesisReverbs[reverbIndex].downsampleRate == 1) {
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengths[0], reverbIndex);
|
||||
if (item->lengths[1] != 0) {
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengths[0], 0, item->lengths[1], reverbIndex);
|
||||
}
|
||||
aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH);
|
||||
aMix(cmd++, 0, 0x7fff, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH);
|
||||
aMix(cmd++, 0, 0x8000 + reverb->reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH);
|
||||
aMix(cmd++, 0, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH);
|
||||
} else {
|
||||
temp_t9 = (item->startPos & 7) * 2;
|
||||
sp58 = ALIGN(temp_t9 + item->lengths[0], 4);
|
||||
temp_t9 = (item->startPos % 8u) * 2;
|
||||
sp58 = ALIGN(item->lengths[0] + (sp58=temp_t9), 4);
|
||||
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, 0x20, (item->startPos - temp_t9 / 2), DEFAULT_LEN_1CH, reverbIndex);
|
||||
if (item->lengths[1] != 0) {
|
||||
cmd = synthesis_load_reverb_ring_buffer(cmd, 0x20 + sp58, 0, DEFAULT_LEN_1CH - sp58, reverbIndex);
|
||||
}
|
||||
|
||||
aSetBuffer(cmd++, 0, temp_t9 + DMEM_ADDR_ADPCM_RESAMPLED, DMEM_ADDR_WET_LEFT_CH, bufLen * 2);
|
||||
aResample(cmd++, reverb->resampleFlags, reverb->resampleRate, VIRTUAL_TO_PHYSICAL2(reverb->resampleStateLeft));
|
||||
aResample(cmd++, gSynthesisReverbs[reverbIndex].resampleFlags, gSynthesisReverbs[reverbIndex].resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverbs[reverbIndex].resampleStateLeft));
|
||||
|
||||
aSetBuffer(cmd++, 0, temp_t9 + DMEM_ADDR_ADPCM_RESAMPLED2, DMEM_ADDR_WET_RIGHT_CH, bufLen * 2);
|
||||
aResample(cmd++, reverb->resampleFlags, reverb->resampleRate, VIRTUAL_TO_PHYSICAL2(reverb->resampleStateRight));
|
||||
aResample(cmd++, gSynthesisReverbs[reverbIndex].resampleFlags, gSynthesisReverbs[reverbIndex].resampleRate, VIRTUAL_TO_PHYSICAL2(gSynthesisReverbs[reverbIndex].resampleStateRight));
|
||||
|
||||
aSetBuffer(cmd++, 0, 0, 0, DEFAULT_LEN_2CH);
|
||||
aMix(cmd++, 0, 0x7fff, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_LEFT_CH);
|
||||
aMix(cmd++, 0, 0x8000 + reverb->reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH);
|
||||
aMix(cmd++, 0, 0x8000 + gSynthesisReverbs[reverbIndex].reverbGain, DMEM_ADDR_WET_LEFT_CH, DMEM_ADDR_WET_LEFT_CH);
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NON_MATCHING
|
||||
GLOBAL_ASM("asm/non_matchings/eu/audio/func_eu_802e00d8.s")
|
||||
u64 *func_eu_802e00d8(u64 *cmd, s16 reverbIndex, s16 updateIndex);
|
||||
#else
|
||||
u64 *func_eu_802e00d8(u64 *cmd, s16 reverbIndex, s16 updateIndex) {
|
||||
struct SynthesisReverb *reverb;
|
||||
u64 *synthesis_save_reverb_samples(u64 *cmdBuf, s16 reverbIndex, s16 updateIndex) {
|
||||
struct ReverbRingBufferItem *item;
|
||||
struct SynthesisReverb *reverb;
|
||||
u64 *cmd = cmdBuf;
|
||||
|
||||
reverb = &gSynthesisReverbs[reverbIndex];
|
||||
item = &reverb->items[reverb->curFrame][updateIndex];
|
||||
if (reverb->useReverb != 0) {
|
||||
if (1) {
|
||||
}
|
||||
if (reverb->downsampleRate == 1) {
|
||||
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengths[0], reverbIndex);
|
||||
// Put the oldest samples in the ring buffer into the wet channels
|
||||
cmd = cmdBuf = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH, item->startPos, item->lengths[0], reverbIndex);
|
||||
if (item->lengths[1] != 0) {
|
||||
// Ring buffer wrapped
|
||||
cmd = synthesis_save_reverb_ring_buffer(cmd, DMEM_ADDR_WET_LEFT_CH + item->lengths[0], 0, item->lengths[1], reverbIndex);
|
||||
cmdBuf = cmd;
|
||||
}
|
||||
} else {
|
||||
aSetBuffer(cmd++, 0, 0, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(reverb->items[reverb->curFrame][updateIndex].toDownsampleLeft));
|
||||
// Downsampling is done later by CPU when RSP is done, therefore we need to have double
|
||||
// buffering. Left and right buffers are adjacent in memory.
|
||||
aSetBuffer(cmdBuf++, 0, 0, DMEM_ADDR_WET_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
aSaveBuffer(cmdBuf++, VIRTUAL_TO_PHYSICAL2(reverb->items[reverb->curFrame][updateIndex].toDownsampleLeft));
|
||||
reverb->resampleFlags = 0;
|
||||
}
|
||||
}
|
||||
return cmd;
|
||||
return cmdBuf;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#ifndef NON_MATCHING
|
||||
GLOBAL_ASM("asm/non_matchings/eu/audio/synthesis_do_one_audio_update.s")
|
||||
#else
|
||||
u64 *synthesis_do_one_audio_update(u16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateIndex) {
|
||||
u8 sp84[60];
|
||||
struct SynthesisReverb *sp60;
|
||||
s32 temp_lo;
|
||||
s32 temp_lo_2;
|
||||
u8 temp_v1;
|
||||
u8 temp_v1_2;
|
||||
struct NoteSubEu *temp_t5;
|
||||
struct NoteSubEu *temp_v0;
|
||||
s32 phi_s1;
|
||||
s16 phi_s2;
|
||||
s16 phi_s3;
|
||||
s32 phi_s1_2;
|
||||
s32 phi_v1_2;
|
||||
s32 phi_s1_3;
|
||||
s16 phi_s3_2;
|
||||
s32 phi_s1_4;
|
||||
u8 *phi_s0_2;
|
||||
s32 bufLen2;
|
||||
struct NoteSubEu *noteSubEu;
|
||||
u8 noteIndices[56];
|
||||
s32 temp;
|
||||
s32 i;
|
||||
s16 j;
|
||||
s16 notePos = 0;
|
||||
|
||||
if (gNumSynthesisReverbs == 0) {
|
||||
phi_s2 = 0;
|
||||
for (phi_s1 = 0; phi_s1 < gMaxSimultaneousNotes; phi_s1++) {
|
||||
if (gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + phi_s1].enabled) {
|
||||
sp84[phi_s2++] = phi_s1;
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
temp = updateIndex;
|
||||
if (gNoteSubsEu[gMaxSimultaneousNotes * temp + i].enabled) {
|
||||
noteIndices[notePos++] = i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
phi_s2 = 0;
|
||||
for (phi_s3 = 0; phi_s3 < gNumSynthesisReverbs; phi_s3++) {
|
||||
for (phi_s1_2 = 0; phi_s1_2 < gMaxSimultaneousNotes; phi_s1_2++) {
|
||||
temp_v0 = &gNoteSubsEu[gMaxSimultaneousNotes * updateIndex + phi_s1_2];
|
||||
if (temp_v0->enabled) {
|
||||
if (phi_s3 == temp_v0->unk1b567) {
|
||||
sp84[phi_s2++] = phi_s1_2;
|
||||
}
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
temp = updateIndex;
|
||||
noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * temp + i];
|
||||
if (noteSubEu->enabled && j == noteSubEu->reverbIndex) {
|
||||
noteIndices[notePos++] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
phi_v1_2 = gMaxSimultaneousNotes * updateIndex;
|
||||
for (phi_s1_3 = 0; phi_s1_3 < gMaxSimultaneousNotes; phi_s1_3++) {
|
||||
if (gNoteSubsEu[phi_v1_2].enabled) {
|
||||
if (temp_v0->unk1b567 >= gNumSynthesisReverbs) {
|
||||
sp84[phi_s2++] = phi_s1_3;
|
||||
}
|
||||
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
temp = updateIndex;
|
||||
noteSubEu = &gNoteSubsEu[gMaxSimultaneousNotes * temp + i];
|
||||
if (noteSubEu->enabled && noteSubEu->reverbIndex >= gNumSynthesisReverbs) {
|
||||
noteIndices[notePos++] = i;
|
||||
}
|
||||
phi_v1_2++;
|
||||
}
|
||||
}
|
||||
aClearBuffer(cmd++, DMEM_ADDR_LEFT_CH, DEFAULT_LEN_2CH);
|
||||
phi_s1_4 = 0;
|
||||
for (phi_s3_2 = 0; phi_s3_2 < gNumSynthesisReverbs; phi_s3_2++) {
|
||||
sp60 = &gSynthesisReverbs[phi_s3_2];
|
||||
gUseReverb = sp60->useReverb;
|
||||
i = 0;
|
||||
for (j = 0; j < gNumSynthesisReverbs; j++) {
|
||||
gUseReverb = gSynthesisReverbs[j].useReverb;
|
||||
if (gUseReverb != 0) {
|
||||
cmd = synthesis_resample_and_mix_reverb(cmd, bufLen, phi_s3_2, (s16) updateIndex);
|
||||
cmd = synthesis_resample_and_mix_reverb(cmd, bufLen, j, updateIndex);
|
||||
}
|
||||
for (; phi_s1_4 < phi_s2; phi_s1_4++) {
|
||||
temp_v1 = sp84[phi_s1_4];
|
||||
temp_lo = updateIndex * gMaxSimultaneousNotes;
|
||||
if (phi_s3_2 == gNoteSubsEu[temp_v1 + temp_lo].unk1b567) {
|
||||
cmd = synthesis_process_note(&gNotes[temp_v1], &gNoteSubsEu[temp_v1 + temp_lo], &gNotes[temp_v1].synthesisState, aiBuf, bufLen, cmd);
|
||||
for (; i < notePos; i++) {
|
||||
temp = updateIndex;
|
||||
temp *= gMaxSimultaneousNotes;
|
||||
if (j == gNoteSubsEu[temp + noteIndices[i]].reverbIndex) {
|
||||
cmd = synthesis_process_note(&gNotes[noteIndices[i]],
|
||||
&gNoteSubsEu[temp + noteIndices[i]],
|
||||
&gNotes[noteIndices[i]].synthesisState,
|
||||
aiBuf, bufLen, cmd);
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sp60->useReverb != 0) {
|
||||
cmd = func_eu_802e00d8(cmd, phi_s3_2, (s16) updateIndex);
|
||||
if (gSynthesisReverbs[j].useReverb != 0) {
|
||||
cmd = synthesis_save_reverb_samples(cmd, j, updateIndex);
|
||||
}
|
||||
}
|
||||
phi_s0_2 = &sp84[phi_s1_4];
|
||||
for (; phi_s1_4 < phi_s2; phi_s1_4++) {
|
||||
temp_v1_2 = *phi_s0_2;
|
||||
temp_lo_2 = updateIndex * gMaxSimultaneousNotes;
|
||||
temp_t5 = &gNoteSubsEu[temp_v1_2 + temp_lo_2];
|
||||
if (IS_BANK_LOAD_COMPLETE(temp_t5->bankId) == TRUE) {
|
||||
cmd = synthesis_process_note(&gNotes[temp_v1_2], &gNoteSubsEu[temp_v1_2 + temp_lo_2], &gNotes[temp_v1_2].synthesisState, aiBuf, bufLen, cmd);
|
||||
for (; i < notePos; i++) {
|
||||
temp = updateIndex;
|
||||
temp *= gMaxSimultaneousNotes;
|
||||
if (IS_BANK_LOAD_COMPLETE(gNoteSubsEu[temp + noteIndices[i]].bankId) == TRUE) {
|
||||
cmd = synthesis_process_note(&gNotes[noteIndices[i]],
|
||||
&gNoteSubsEu[temp + noteIndices[i]],
|
||||
&gNotes[noteIndices[i]].synthesisState,
|
||||
aiBuf, bufLen, cmd);
|
||||
} else {
|
||||
gAudioErrorFlags = (temp_t5->bankId + (phi_s1_4 << 8)) + 0x10000000;
|
||||
gAudioErrorFlags = (gNoteSubsEu[temp + noteIndices[i]].bankId + (i << 8)) + 0x10000000;
|
||||
}
|
||||
phi_s0_2++;
|
||||
}
|
||||
bufLen2 = bufLen * 2;
|
||||
aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, bufLen2);
|
||||
|
||||
temp = bufLen * 2;
|
||||
aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, temp);
|
||||
aInterleave(cmd++, DMEM_ADDR_LEFT_CH, DMEM_ADDR_RIGHT_CH);
|
||||
aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, bufLen2 * 2);
|
||||
aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, temp * 2);
|
||||
aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(aiBuf));
|
||||
return cmd;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
u64 *synthesis_do_one_audio_update(u16 *aiBuf, s32 bufLen, u64 *cmd, u32 updateIndex) {
|
||||
UNUSED s32 pad1[1];
|
||||
@@ -738,8 +696,8 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
|
||||
if (noteSubEu->isSyntheticWave) {
|
||||
noteSamplesDmemAddrBeforeResampling =
|
||||
DMEM_ADDR_UNCOMPRESSED_NOTE + synthesisState->samplePosInt * 2;
|
||||
synthesisState->samplePosInt += (samplesLenFixedPoint >> 10);
|
||||
cmd = load_wave_samples(cmd, noteSubEu, synthesisState, samplesLenFixedPoint >> 10);
|
||||
synthesisState->samplePosInt += (samplesLenFixedPoint >> 0x10);
|
||||
cmd = load_wave_samples(cmd, noteSubEu, synthesisState, samplesLenFixedPoint >> 0x10);
|
||||
}
|
||||
#else
|
||||
if (note->sound == NULL) {
|
||||
@@ -798,11 +756,15 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
|
||||
u32 nEntries; // v1
|
||||
curLoadedBook = audioBookSample->book->book;
|
||||
nEntries = audioBookSample->book->order * audioBookSample->book->npredictors;
|
||||
#ifdef VERSION_EU
|
||||
aLoadADPCM(cmd++, nEntries * 16, VIRTUAL_TO_PHYSICAL2(curLoadedBook + noteSubEu->bookOffset));
|
||||
#else
|
||||
aLoadADPCM(cmd++, nEntries * 16, VIRTUAL_TO_PHYSICAL2(curLoadedBook));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
if (noteSubEu->unk1b234) {
|
||||
if (noteSubEu->bookOffset) {
|
||||
curLoadedBook = (s16 *) &euUnknownData_80301950; // what's this? never read
|
||||
}
|
||||
#endif
|
||||
@@ -952,8 +914,8 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
|
||||
(samplesLenAdjusted - nAdpcmSamplesProcessed) * 2);
|
||||
#ifdef VERSION_EU
|
||||
noteSubEu->finished = 1;
|
||||
noteSubEu->finished = 1;
|
||||
noteSubEu->enabled = 0;
|
||||
note->noteSubEu.finished = 1;
|
||||
note->noteSubEu.enabled = 0;
|
||||
#else
|
||||
note->samplePosInt = 0;
|
||||
note->finished = 1;
|
||||
@@ -1049,6 +1011,9 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
|
||||
flags = A_INIT;
|
||||
noteSubEu->needsInit = FALSE;
|
||||
}
|
||||
|
||||
cmd = final_resample(cmd, synthesisState, bufLen * 2, resamplingRateFixedPoint,
|
||||
noteSamplesDmemAddrBeforeResampling, flags);
|
||||
#else
|
||||
if (note->needsInit == TRUE) {
|
||||
flags = A_INIT;
|
||||
@@ -1075,8 +1040,6 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
|
||||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
cmd = final_resample(cmd, synthesisState, bufLen * 2, resamplingRateFixedPoint,
|
||||
noteSamplesDmemAddrBeforeResampling, flags);
|
||||
cmd = process_envelope(cmd, noteSubEu, synthesisState, bufLen, 0, s0);
|
||||
#else
|
||||
cmd = process_envelope(cmd, note, bufLen, 0, s0, flags);
|
||||
@@ -1105,7 +1068,7 @@ u64 *synthesis_process_notes(u16 *aiBuf, s32 bufLen, u64 *cmd) {
|
||||
|
||||
return cmd;
|
||||
}
|
||||
#elif defined(VERSION_JP)
|
||||
#elif defined(VERSION_JP) || defined(VERSION_SH) // todo: extract this nonmatching if applicable.
|
||||
GLOBAL_ASM("asm/non_matchings/synthesis_process_notes_jp.s")
|
||||
#elif defined(VERSION_US)
|
||||
GLOBAL_ASM("asm/non_matchings/synthesis_process_notes_us.s")
|
||||
@@ -1335,41 +1298,44 @@ u64 *process_envelope(u64 *cmd, struct NoteSubEu *note, struct NoteSynthesisStat
|
||||
return cmd;
|
||||
}
|
||||
|
||||
#if defined(VERSION_EU) && !defined(NON_MATCHING)
|
||||
GLOBAL_ASM("asm/non_matchings/eu/audio/note_apply_headset_pan_effects.s")
|
||||
#else
|
||||
#ifdef VERSION_EU
|
||||
u64 *note_apply_headset_pan_effects(u64 *cmd, struct NoteSubEu *noteSubEu, struct NoteSynthesisState *note, s32 bufLen, s32 flags, s32 leftRight) {
|
||||
#else
|
||||
u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32 flags, s32 leftRight) {
|
||||
#endif
|
||||
u16 dest;
|
||||
u16 prevPanShift;
|
||||
u16 panShift;
|
||||
u16 pitch; // t2
|
||||
#ifndef VERSION_EU
|
||||
u16 prevPanShift;
|
||||
u16 panShift;
|
||||
UNUSED s32 padding[11];
|
||||
#else
|
||||
u8 prevPanShift;
|
||||
u8 panShift;
|
||||
UNUSED u8 unkDebug;
|
||||
#endif
|
||||
|
||||
switch (leftRight) {
|
||||
case 1:
|
||||
dest = DMEM_ADDR_LEFT_CH;
|
||||
note->prevHeadsetPanLeft = 0;
|
||||
#ifndef VERSION_EU
|
||||
note->prevHeadsetPanLeft = 0;
|
||||
panShift = note->headsetPanRight;
|
||||
#else
|
||||
panShift = noteSubEu->headsetPanRight;
|
||||
note->prevHeadsetPanLeft = 0;
|
||||
#endif
|
||||
prevPanShift = note->prevHeadsetPanRight;
|
||||
note->prevHeadsetPanRight = panShift;
|
||||
break;
|
||||
case 2:
|
||||
dest = DMEM_ADDR_RIGHT_CH;
|
||||
note->prevHeadsetPanRight = 0;
|
||||
#ifndef VERSION_EU
|
||||
note->prevHeadsetPanRight = 0;
|
||||
panShift = note->headsetPanLeft;
|
||||
#else
|
||||
panShift = noteSubEu->headsetPanLeft;
|
||||
note->prevHeadsetPanRight = 0;
|
||||
#endif
|
||||
|
||||
prevPanShift = note->prevHeadsetPanLeft;
|
||||
@@ -1392,13 +1358,23 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32
|
||||
aSetBuffer(cmd++, 0, 0, DMEM_ADDR_TEMP, 32);
|
||||
aSaveBuffer(cmd++, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panResampleState));
|
||||
|
||||
#ifdef VERSION_EU
|
||||
pitch = (bufLen << 0xf) / (bufLen + panShift - prevPanShift + 8);
|
||||
if (pitch) {
|
||||
}
|
||||
#else
|
||||
pitch = (bufLen << 0xf) / (panShift + bufLen - prevPanShift + 8);
|
||||
#endif
|
||||
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP + 8, DMEM_ADDR_TEMP,
|
||||
panShift + bufLen - prevPanShift);
|
||||
aResample(cmd++, 0, pitch, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panResampleState));
|
||||
} else {
|
||||
pitch = (panShift == 0) ? (bufLen << 0xf) / (bufLen - prevPanShift - 4)
|
||||
: (bufLen << 0xf) / (bufLen + panShift - prevPanShift);
|
||||
#if defined(VERSION_EU) && !defined(AVOID_UB)
|
||||
if (unkDebug) { // UB
|
||||
}
|
||||
#endif
|
||||
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP,
|
||||
panShift + bufLen - prevPanShift);
|
||||
aResample(cmd++, 0, pitch, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panResampleState));
|
||||
@@ -1430,7 +1406,6 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32
|
||||
|
||||
return cmd;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(VERSION_EU)
|
||||
// Moved to playback.c in EU
|
||||
|
||||
@@ -92,7 +92,7 @@ static void Unknown80383E44(void) // ?
|
||||
}
|
||||
|
||||
static s32 beh_cmd_hide(void) {
|
||||
obj_hide();
|
||||
cur_obj_hide();
|
||||
gBehCommand++;
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ static s32 beh_cmd_spawn_child(void) {
|
||||
|
||||
struct Object *child = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
|
||||
copy_object_pos_and_angle(child, gCurrentObject);
|
||||
obj_copy_pos_and_angle(child, gCurrentObject);
|
||||
|
||||
gBehCommand += 3;
|
||||
return BEH_CONTINUE;
|
||||
@@ -134,7 +134,7 @@ static s32 beh_cmd_spawn_obj(void) {
|
||||
|
||||
struct Object *object = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
|
||||
copy_object_pos_and_angle(object, gCurrentObject);
|
||||
obj_copy_pos_and_angle(object, gCurrentObject);
|
||||
|
||||
gCurrentObject->prevObj = object;
|
||||
|
||||
@@ -149,7 +149,7 @@ static s32 beh_cmd_spawn_child_with_param(void) {
|
||||
|
||||
struct Object *child = spawn_object_at_origin(gCurrentObject, 0, model, behavior);
|
||||
|
||||
copy_object_pos_and_angle(child, gCurrentObject);
|
||||
obj_copy_pos_and_angle(child, gCurrentObject);
|
||||
|
||||
child->oBehParams2ndByte = behParam;
|
||||
|
||||
@@ -562,13 +562,13 @@ static s32 Behavior24(void) {
|
||||
}
|
||||
|
||||
static s32 beh_cmd_begin(void) {
|
||||
if (obj_has_behavior(bhvHauntedChair)) {
|
||||
if (cur_obj_has_behavior(bhvHauntedChair)) {
|
||||
bhv_init_room();
|
||||
}
|
||||
if (obj_has_behavior(bhvMadPiano)) {
|
||||
if (cur_obj_has_behavior(bhvMadPiano)) {
|
||||
bhv_init_room();
|
||||
}
|
||||
if (obj_has_behavior(bhvMessagePanel)) {
|
||||
if (cur_obj_has_behavior(bhvMessagePanel)) {
|
||||
gCurrentObject->oCollisionDistance = 150.0f;
|
||||
}
|
||||
gBehCommand++;
|
||||
@@ -622,7 +622,7 @@ static s32 beh_cmd_scale(void) {
|
||||
UNUSED u8 sp1f = (u8)((gBehCommand[0] >> 16) & 0xFF);
|
||||
s16 sp1c = gBehCommand[0] & 0xFFFF;
|
||||
|
||||
obj_scale((f32) sp1c / 100.0f);
|
||||
cur_obj_scale((f32) sp1c / 100.0f);
|
||||
|
||||
gBehCommand++;
|
||||
return BEH_CONTINUE;
|
||||
@@ -658,9 +658,10 @@ static s32 beh_cmd_bit_clear_int32(void) {
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
|
||||
static s32 beh_cmd_spawn_water_splash(void) {
|
||||
struct WaterSplashParams *arg0 = (struct WaterSplashParams *) gBehCommand[1];
|
||||
spawn_water_splash(gCurrentObject, arg0);
|
||||
static s32 beh_cmd_spawn_water_droplet(void) {
|
||||
struct WaterDropletParams *dropletParams = (struct WaterDropletParams *) gBehCommand[1];
|
||||
spawn_water_droplet(gCurrentObject, dropletParams);
|
||||
|
||||
gBehCommand += 2;
|
||||
return BEH_CONTINUE;
|
||||
}
|
||||
@@ -738,7 +739,7 @@ static BehCommandProc BehaviorJumpTable[] = {
|
||||
beh_cmd_tex_anim_rate,
|
||||
beh_cmd_disable_rendering,
|
||||
Behavior36,
|
||||
beh_cmd_spawn_water_splash,
|
||||
beh_cmd_spawn_water_droplet,
|
||||
};
|
||||
|
||||
void cur_object_exec_behavior(void) {
|
||||
@@ -757,7 +758,7 @@ void cur_object_exec_behavior(void) {
|
||||
}
|
||||
|
||||
if (flagsLo & OBJ_FLAG_COMPUTE_ANGLE_TO_MARIO) {
|
||||
gCurrentObject->oAngleToMario = angle_to_object(gCurrentObject, gMarioObject);
|
||||
gCurrentObject->oAngleToMario = obj_angle_to_object(gCurrentObject, gMarioObject);
|
||||
}
|
||||
|
||||
if (gCurrentObject->oAction != gCurrentObject->oPrevAction) {
|
||||
@@ -786,7 +787,7 @@ void cur_object_exec_behavior(void) {
|
||||
flagsLo = (s16) gCurrentObject->oFlags;
|
||||
|
||||
if (flagsLo & OBJ_FLAG_0010) {
|
||||
obj_set_facing_to_move_angles(gCurrentObject);
|
||||
obj_set_face_angle_to_move_angle(gCurrentObject);
|
||||
}
|
||||
|
||||
if (flagsLo & OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW) {
|
||||
@@ -794,19 +795,19 @@ void cur_object_exec_behavior(void) {
|
||||
}
|
||||
|
||||
if (flagsLo & OBJ_FLAG_MOVE_XZ_USING_FVEL) {
|
||||
obj_move_xz_using_fvel_and_yaw();
|
||||
cur_obj_move_xz_using_fvel_and_yaw();
|
||||
}
|
||||
|
||||
if (flagsLo & OBJ_FLAG_MOVE_Y_WITH_TERMINAL_VEL) {
|
||||
obj_move_y_with_terminal_vel();
|
||||
cur_obj_move_y_with_terminal_vel();
|
||||
}
|
||||
|
||||
if (flagsLo & OBJ_FLAG_TRANSFORM_RELATIVE_TO_PARENT) {
|
||||
build_object_transform_relative_to_parent(gCurrentObject);
|
||||
obj_build_transform_relative_to_parent(gCurrentObject);
|
||||
}
|
||||
|
||||
if (flagsLo & OBJ_FLAG_0800) {
|
||||
func_802A2270(gCurrentObject);
|
||||
obj_set_throw_matrix_from_transform(gCurrentObject);
|
||||
}
|
||||
|
||||
if (flagsLo & OBJ_FLAG_UPDATE_GFX_POS_AND_ANGLE) {
|
||||
@@ -814,7 +815,7 @@ void cur_object_exec_behavior(void) {
|
||||
}
|
||||
|
||||
if (gCurrentObject->oRoom != -1) {
|
||||
obj_enable_rendering_if_mario_in_room();
|
||||
cur_obj_enable_rendering_if_mario_in_room();
|
||||
} else if ((flagsLo & OBJ_FLAG_COMPUTE_DIST_TO_MARIO) && gCurrentObject->collisionData == NULL) {
|
||||
if (!(flagsLo & OBJ_FLAG_ACTIVE_FROM_AFAR)) {
|
||||
if (distanceFromMario > gCurrentObject->oDrawingDistance) {
|
||||
|
||||
@@ -295,7 +295,7 @@ static void level_cmd_load_mario_head(void) {
|
||||
}
|
||||
|
||||
static void level_cmd_load_mio0_texture(void) {
|
||||
func_80278304(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 8));
|
||||
load_segment_decompress_heap(CMD_GET(s16, 2), CMD_GET(void *, 4), CMD_GET(void *, 8));
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ static void level_cmd_init_level(void) {
|
||||
|
||||
static void level_cmd_clear_level(void) {
|
||||
clear_objects();
|
||||
func_8027A7C4();
|
||||
clear_area_graph_nodes();
|
||||
clear_areas();
|
||||
main_pool_pop_state();
|
||||
|
||||
@@ -630,8 +630,8 @@ static void level_cmd_load_area(void) {
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
static void level_cmd_2A(void) {
|
||||
func_8027A998();
|
||||
static void level_cmd_unload_area(void) {
|
||||
unload_area();
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
@@ -649,7 +649,7 @@ static void level_cmd_set_mario_start_pos(void) {
|
||||
}
|
||||
|
||||
static void level_cmd_2C(void) {
|
||||
func_8027AA88();
|
||||
unload_mario_area();
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
@@ -692,7 +692,7 @@ static void level_cmd_set_menu_music(void) {
|
||||
}
|
||||
|
||||
static void level_cmd_38(void) {
|
||||
func_802491FC(CMD_GET(s16, 2));
|
||||
fadeout_music(CMD_GET(s16, 2));
|
||||
sCurrentCmd = CMD_NEXT;
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ static void (*LevelScriptJumpTable[])(void) = {
|
||||
/*27*/ level_cmd_create_painting_warp_node,
|
||||
/*28*/ level_cmd_create_instant_warp,
|
||||
/*29*/ level_cmd_load_area,
|
||||
/*2A*/ level_cmd_2A,
|
||||
/*2A*/ level_cmd_unload_area,
|
||||
/*2B*/ level_cmd_set_mario_start_pos,
|
||||
/*2C*/ level_cmd_2C,
|
||||
/*2D*/ level_cmd_2D,
|
||||
|
||||
@@ -623,10 +623,10 @@ void transform_object_vertices(s16 **data, s16 *vertexData) {
|
||||
|
||||
if (gCurrentObject->header.gfx.throwMatrix == NULL) {
|
||||
gCurrentObject->header.gfx.throwMatrix = objectTransform;
|
||||
build_object_transform_from_pos_and_angle(gCurrentObject, O_POS_INDEX, O_FACE_ANGLE_INDEX);
|
||||
obj_build_transform_from_pos_and_angle(gCurrentObject, O_POS_INDEX, O_FACE_ANGLE_INDEX);
|
||||
}
|
||||
|
||||
apply_object_scale_to_matrix(gCurrentObject, m, *objectTransform);
|
||||
obj_apply_scale_to_matrix(gCurrentObject, m, *objectTransform);
|
||||
|
||||
// Go through all vertices, rotating and translating them to transform the object.
|
||||
while (numVertices--) {
|
||||
|
||||
+10
-10
@@ -76,7 +76,7 @@ const char *gNoControllerMsg[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
void func_8027A220(Vp *a, Vp *b, u8 c, u8 d, u8 e) {
|
||||
void override_viewport_and_clip(Vp *a, Vp *b, u8 c, u8 d, u8 e) {
|
||||
u16 sp6 = ((c >> 3) << 11) | ((d >> 3) << 6) | ((e >> 3) << 1) | 1;
|
||||
|
||||
gFBSetColor = (sp6 << 16) | sp6;
|
||||
@@ -138,13 +138,13 @@ struct ObjectWarpNode *area_get_warp_node(u8 id) {
|
||||
return node;
|
||||
}
|
||||
|
||||
struct ObjectWarpNode *func_8027A478(struct Object *o) {
|
||||
struct ObjectWarpNode *area_get_warp_node_from_params(struct Object *o) {
|
||||
u8 sp1F = (o->oBehParams & 0x00FF0000) >> 16;
|
||||
|
||||
return area_get_warp_node(sp1F);
|
||||
}
|
||||
|
||||
void func_8027A4C4(void) {
|
||||
void load_obj_warp_nodes(void) {
|
||||
struct ObjectWarpNode *sp24;
|
||||
struct Object *sp20 = (struct Object *) gObjParentGraphNode.children;
|
||||
|
||||
@@ -152,7 +152,7 @@ void func_8027A4C4(void) {
|
||||
struct Object *sp1C = sp20;
|
||||
|
||||
if (sp1C->activeFlags && get_mario_spawn_type(sp1C) != 0) {
|
||||
sp24 = func_8027A478(sp1C);
|
||||
sp24 = area_get_warp_node_from_params(sp1C);
|
||||
if (sp24 != NULL) {
|
||||
sp24->object = sp1C;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ void clear_areas(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_8027A7C4(void) {
|
||||
void clear_area_graph_nodes(void) {
|
||||
s32 i;
|
||||
|
||||
if (gCurrentArea != NULL) {
|
||||
@@ -223,12 +223,12 @@ void load_area(s32 index) {
|
||||
spawn_objects_from_info(0, gCurrentArea->objectSpawnInfos);
|
||||
}
|
||||
|
||||
func_8027A4C4();
|
||||
load_obj_warp_nodes();
|
||||
geo_call_global_function_nodes(gCurrentArea->unk04, GEO_CONTEXT_AREA_LOAD);
|
||||
}
|
||||
}
|
||||
|
||||
void func_8027A998(void) {
|
||||
void unload_area(void) {
|
||||
if (gCurrentArea != NULL) {
|
||||
unload_objects_from_area(0, gCurrentArea->index);
|
||||
geo_call_global_function_nodes(gCurrentArea->unk04, GEO_CONTEXT_AREA_UNLOAD);
|
||||
@@ -249,13 +249,13 @@ void load_mario_area(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_8027AA88(void) {
|
||||
void unload_mario_area(void) {
|
||||
if (gCurrentArea != NULL && (gCurrentArea->flags & 0x01)) {
|
||||
unload_objects_from_area(0, gMarioSpawnInfo->activeAreaIndex);
|
||||
|
||||
gCurrentArea->flags &= ~0x01;
|
||||
if (gCurrentArea->flags == 0) {
|
||||
func_8027A998();
|
||||
unload_area();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,7 +264,7 @@ void change_area(s32 index) {
|
||||
s32 areaFlags = gCurrentArea->flags;
|
||||
|
||||
if (gCurrAreaIndex != index) {
|
||||
func_8027A998();
|
||||
unload_area();
|
||||
load_area(index);
|
||||
|
||||
gCurrentArea->flags = areaFlags;
|
||||
|
||||
+4
-4
@@ -134,16 +134,16 @@ extern s16 gCurrSaveFileNum;
|
||||
extern s16 gCurrLevelNum;
|
||||
|
||||
|
||||
void func_8027A220(Vp *a, Vp *b, u8 c, u8 d, u8 e);
|
||||
void override_viewport_and_clip(Vp *a, Vp *b, u8 c, u8 d, u8 e);
|
||||
void print_intro_text(void);
|
||||
u32 get_mario_spawn_type(struct Object *o);
|
||||
struct ObjectWarpNode *area_get_warp_node(u8 id);
|
||||
void clear_areas(void);
|
||||
void func_8027A7C4(void);
|
||||
void clear_area_graph_nodes(void);
|
||||
void load_area(s32 index);
|
||||
void func_8027A998(void);
|
||||
void unload_area(void);
|
||||
void load_mario_area(void);
|
||||
void func_8027AA88(void);
|
||||
void unload_mario_area(void);
|
||||
void change_area(s32 index);
|
||||
void area_update_objects(void);
|
||||
void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue);
|
||||
|
||||
+34
-20
@@ -74,13 +74,6 @@ struct Struct802C0DF0 {
|
||||
const BehaviorScript *behavior;
|
||||
};
|
||||
|
||||
struct Struct8032FE4C {
|
||||
s32 unk0;
|
||||
s32 unk1;
|
||||
f32 unk2;
|
||||
f32 unk3;
|
||||
};
|
||||
|
||||
struct Struct8032F754 {
|
||||
s32 unk0;
|
||||
Vec3f unk1;
|
||||
@@ -93,7 +86,7 @@ struct Struct8032FCE8 {
|
||||
void *unk2;
|
||||
};
|
||||
|
||||
extern void BehClimbDetectLoop();
|
||||
extern void bhv_pole_base_loop();
|
||||
extern s16 gDebugInfo[][8];
|
||||
extern s8 gDoorAdjacentRooms[][2];
|
||||
extern u8 inside_castle_seg7_collision_ddd_warp_2[];
|
||||
@@ -107,7 +100,7 @@ extern struct Animation *blue_fish_seg3_anims_0301C2B0[];
|
||||
extern struct Animation *cyan_fish_seg6_anims_0600E264[];
|
||||
extern struct Animation *blue_fish_seg3_anims_0301C2B0[];
|
||||
|
||||
void func_802A8D18(f32, f32, s32);
|
||||
void common_anchor_mario_behavior(f32, f32, s32);
|
||||
|
||||
s32 mario_moving_fast_enough_to_make_piranha_plant_bite(void);
|
||||
void obj_set_secondary_camera_focus(void);
|
||||
@@ -141,7 +134,7 @@ s16 D_8032F0CC[] = { 6047, 5664, 5292, 4934, 4587, 4254, 3933, 3624, 3329, 3046,
|
||||
struct SpawnParticlesInfo D_8032F270 = { 2, 20, MODEL_MIST, 0, 40, 5, 30, 20, 252, 30, 330.0f, 10.0f };
|
||||
|
||||
// generate_wind_puffs/dust (something like that)
|
||||
void func_802AA618(s32 sp18, s32 sp1C, f32 sp20) {
|
||||
void spawn_mist_particles_variable(s32 sp18, s32 sp1C, f32 sp20) {
|
||||
D_8032F270.sizeBase = sp20;
|
||||
D_8032F270.sizeRange = sp20 / 20.0;
|
||||
D_8032F270.offsetY = sp1C;
|
||||
@@ -152,7 +145,7 @@ void func_802AA618(s32 sp18, s32 sp1C, f32 sp20) {
|
||||
} else {
|
||||
D_8032F270.count = 4;
|
||||
}
|
||||
obj_spawn_particles(&D_8032F270);
|
||||
cur_obj_spawn_particles(&D_8032F270);
|
||||
}
|
||||
|
||||
#include "behaviors/sparkle_spawn_star.inc.c"
|
||||
@@ -187,16 +180,16 @@ void func_802AA618(s32 sp18, s32 sp1C, f32 sp20) {
|
||||
#include "behaviors/breakable_box.inc.c"
|
||||
|
||||
// not sure what this is doing here. not in a behavior file.
|
||||
Gfx *Geo18_802B1BB0(s32 run, UNUSED struct GraphNode *node, Mat4 mtx) {
|
||||
Gfx *geo_move_mario_part_from_parent(s32 run, UNUSED struct GraphNode *node, Mat4 mtx) {
|
||||
Mat4 sp20;
|
||||
struct Object *sp1C;
|
||||
|
||||
if (run == TRUE) {
|
||||
sp1C = (struct Object *) gCurGraphNodeObject;
|
||||
if (sp1C == gMarioObject && sp1C->prevObj != NULL) {
|
||||
func_8029D704(sp20, mtx, gCurGraphNodeCamera->matrixPtr);
|
||||
func_8029D558(sp20, sp1C->prevObj);
|
||||
func_8029EA0C(sp1C->prevObj);
|
||||
create_transformation_from_matrices(sp20, mtx, gCurGraphNodeCamera->matrixPtr);
|
||||
obj_update_pos_from_parent_transformation(sp20, sp1C->prevObj);
|
||||
obj_set_gfx_pos_from_pos(sp1C->prevObj);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -211,7 +204,7 @@ Gfx *Geo18_802B1BB0(s32 run, UNUSED struct GraphNode *node, Mat4 mtx) {
|
||||
|
||||
// not in behavior file
|
||||
// n is the number of objects to spawn, r if the rate of change of phase (frequency?)
|
||||
void func_802B2328(s32 n, s32 a1, s32 a2, s32 r) {
|
||||
void spawn_sparkle_particles(s32 n, s32 a1, s32 a2, s32 r) {
|
||||
s32 i;
|
||||
s16 separation = 0x10000 / n; // Evenly spread around a circle
|
||||
for (i = 0; i < n; i++) {
|
||||
@@ -232,6 +225,15 @@ void func_802B2328(s32 n, s32 a1, s32 a2, s32 r) {
|
||||
#include "behaviors/bullet_bill.inc.c"
|
||||
#include "behaviors/bowser.inc.c"
|
||||
#include "behaviors/blue_fish.inc.c"
|
||||
|
||||
// Not in behavior file, duplicate of vec3f_copy except without bad return.
|
||||
// Used in a few behavior files.
|
||||
void vec3f_copy_2(Vec3f dest, Vec3f src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
}
|
||||
|
||||
#include "behaviors/checkerboard_platform.inc.c"
|
||||
#include "behaviors/ddd_warp.inc.c"
|
||||
#include "behaviors/water_pillar.inc.c"
|
||||
@@ -252,6 +254,18 @@ void func_802B2328(s32 n, s32 a1, s32 a2, s32 r) {
|
||||
#include "behaviors/tox_box.inc.c"
|
||||
#include "behaviors/piranha_plant.inc.c"
|
||||
#include "behaviors/bowser_puzzle_piece.inc.c"
|
||||
|
||||
s32 set_obj_anim_with_accel_and_sound(s16 a0, s16 a1, s32 a2) {
|
||||
f32 sp1C;
|
||||
if ((sp1C = o->header.gfx.unk38.animAccel / (f32) 0x10000) == 0)
|
||||
sp1C = 1.0f;
|
||||
if (cur_obj_check_anim_frame_in_range(a0, sp1C) || cur_obj_check_anim_frame_in_range(a1, sp1C)) {
|
||||
cur_obj_play_sound_2(a2);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "behaviors/tuxie.inc.c"
|
||||
#include "behaviors/fish.inc.c"
|
||||
#include "behaviors/express_elevator.inc.c"
|
||||
@@ -280,7 +294,7 @@ void func_802B2328(s32 n, s32 a1, s32 a2, s32 r) {
|
||||
#include "behaviors/sparkle_spawn.inc.c"
|
||||
#include "behaviors/scuttlebug.inc.c" // :scuttleeyes:
|
||||
#include "behaviors/whomp.inc.c"
|
||||
#include "behaviors/water_splash.inc.c"
|
||||
#include "behaviors/wind_particle.inc.c"
|
||||
#include "behaviors/snowman_wind.inc.c"
|
||||
#include "behaviors/walking_penguin.inc.c"
|
||||
#include "behaviors/water_splashes_and_waves.inc.c"
|
||||
#include "behaviors/strong_wind_particle.inc.c"
|
||||
#include "behaviors/sl_snowman_wind.inc.c"
|
||||
#include "behaviors/sl_walking_penguin.inc.c"
|
||||
|
||||
+41
-40
@@ -1,20 +1,21 @@
|
||||
#ifndef _BEHAVIOR_ACTIONS_H
|
||||
#define _BEHAVIOR_ACTIONS_H
|
||||
|
||||
extern void func_802AA618(s32,s32,f32);
|
||||
extern void spawn_mist_particles_variable(s32,s32,f32);
|
||||
extern void bhv_spawn_star_no_level_exit(u32);
|
||||
extern void bhv_star_door_loop_2();
|
||||
extern void spawn_triangle_break_particles(s16,s16,f32,s16);
|
||||
extern void func_802ADA94(void);
|
||||
extern void func_802ADBBC(u32);
|
||||
extern void func_802ADC20(s16,s16);
|
||||
extern s32 func_802B0C54(f32,f32);
|
||||
extern s32 func_802B2894(f32*,f32*,f32,f32);
|
||||
void func_802B8F7C(Vec3f dest,Vec3f src);
|
||||
extern void func_802BCFC4(f32,f32,s16,s16);
|
||||
|
||||
extern void spawn_mist_from_global(void);
|
||||
extern void clear_particle_flags(u32);
|
||||
extern void spawn_wind_particles(s16,s16);
|
||||
extern s32 check_if_moving_over_floor(f32,f32);
|
||||
extern s32 arc_to_goal_pos(f32*,f32*,f32,f32);
|
||||
void vec3f_copy_2(Vec3f dest,Vec3f src);
|
||||
extern void tox_box_move(f32,f32,s16,s16);
|
||||
extern void play_penguin_walking_sound(s32);
|
||||
extern s32 func_802C5A64(s32*);
|
||||
extern void func_802C76E0(s32, f32, f32, f32, f32);
|
||||
extern s32 update_angle_from_move_flags(s32*);
|
||||
extern void cur_obj_spawn_strong_wind_particles(s32, f32, f32, f32, f32);
|
||||
|
||||
void bhv_cap_switch_loop(void);
|
||||
void bhv_tiny_star_particles_init(void);
|
||||
@@ -29,7 +30,7 @@ void bhv_mr_i_particle_loop(void);
|
||||
void bhv_piranha_particle_loop(void);
|
||||
void bhv_giant_pole_loop(void);
|
||||
void bhv_pole_init(void);
|
||||
void BehClimbDetectLoop(void);
|
||||
void bhv_pole_base_loop(void);
|
||||
void bhv_thi_huge_island_top_loop(void);
|
||||
void bhv_thi_tiny_island_top_loop(void);
|
||||
void bhv_king_bobomb_loop(void);
|
||||
@@ -58,7 +59,7 @@ void bhv_kickable_board_loop(void);
|
||||
void bhv_tower_door_loop(void);
|
||||
void bhv_wf_rotating_wooden_platform_loop(void);
|
||||
void bhv_koopa_shell_underwater_loop(void);
|
||||
void BehFadingWarpLoop(void);
|
||||
void bhv_fading_warp_loop(void);
|
||||
void bhv_warp_loop(void);
|
||||
void bhv_white_puff_exploding_loop(void);
|
||||
void bhv_spawned_star_init(void);
|
||||
@@ -85,7 +86,7 @@ void bhv_water_mist_loop(void);
|
||||
void bhv_water_mist_spawn_loop(void);
|
||||
void bhv_water_mist_2_loop(void);
|
||||
void bhv_pound_white_puffs_init(void);
|
||||
void bhv_unused_0e40_init(void);
|
||||
void bhv_ground_sand_init(void);
|
||||
void bhv_ground_snow_init(void);
|
||||
void bhv_wind_loop(void);
|
||||
void bhv_unused_particle_spawn_loop(void);
|
||||
@@ -161,7 +162,7 @@ void bhv_flame_moving_forward_growing_loop(void);
|
||||
void bhv_flame_bowser_init(void);
|
||||
void bhv_flame_bowser_loop(void);
|
||||
void bhv_flame_large_burning_out_init(void);
|
||||
void bhv_blue_fish_loop(void);
|
||||
void bhv_blue_fish_movement_loop(void);
|
||||
void bhv_tank_fish_group_loop(void);
|
||||
void bhv_checkerboard_elevator_group_init(void);
|
||||
void bhv_checkerboard_platform_init(void);
|
||||
@@ -194,13 +195,13 @@ void bhv_lll_bowser_puzzle_piece_loop(void);
|
||||
void bhv_lll_bowser_puzzle_loop(void);
|
||||
void bhv_tuxies_mother_loop(void);
|
||||
void bhv_small_penguin_loop(void);
|
||||
void bhv_large_fish_group_loop(void);
|
||||
void bhv_fish_loop(void);
|
||||
void bhv_fish_group_2_loop(void);
|
||||
void bhv_wdw_express_elevator_loop(void);
|
||||
void bhv_bird_chirp_chirp_loop(void);
|
||||
void bhv_cheep_cheep_loop(void);
|
||||
void bhv_bub_spawner_loop(void);
|
||||
void bhv_bub_loop(void);
|
||||
void bhv_exclamation_box_loop(void);
|
||||
void bhv_rotatin_exclamation_box_loop(void);
|
||||
void bhv_rotating_exclamation_box_loop(void);
|
||||
void bhv_sound_spawner_init(void);
|
||||
void bhv_bowsers_sub_loop(void);
|
||||
void bhv_sushi_shark_loop(void);
|
||||
@@ -241,16 +242,16 @@ void bhv_sparkle_spawn_loop(void);
|
||||
void bhv_scuttlebug_loop(void);
|
||||
void bhv_scuttlebug_spawn_loop(void);
|
||||
void bhv_whomp_loop(void);
|
||||
void bhv_water_splash_loop(void);
|
||||
void bhv_water_drops_loop(void);
|
||||
void bhv_water_surface_white_wave_init(void);
|
||||
void bhv_object_bubble_ripples_init(void);
|
||||
void bhv_surface_waves_loop(void);
|
||||
void bhv_surface_wave_shrinking_init(void);
|
||||
void bhv_wave_trail_loop(void);
|
||||
void bhv_white_wind_particle_loop(void);
|
||||
void bhv_snowman_wind_blowing_loop(void);
|
||||
void bhv_walking_penguin_loop(void);
|
||||
void bhv_water_splash_spawn_droplets(void);
|
||||
void bhv_water_droplet_loop(void);
|
||||
void bhv_water_droplet_splash_init(void);
|
||||
void bhv_bubble_splash_init(void);
|
||||
void bhv_idle_water_wave_loop(void);
|
||||
void bhv_shallow_water_splash_init(void);
|
||||
void bhv_wave_trail_shrink(void);
|
||||
void bhv_strong_wind_particle_loop(void);
|
||||
void bhv_sl_snowman_wind_loop(void);
|
||||
void bhv_sl_walking_penguin_loop(void);
|
||||
void bhv_menu_button_init(void);
|
||||
void bhv_menu_button_loop(void);
|
||||
void bhv_menu_button_manager_init(void);
|
||||
@@ -544,32 +545,32 @@ void bhv_intro_peach_loop(void);
|
||||
void bhv_end_birds_1_loop(void);
|
||||
void bhv_end_birds_2_loop(void);
|
||||
void bhv_intro_scene_loop(void);
|
||||
void BehDustSmokeLoop(void);
|
||||
void BehYoshiLoop(void);
|
||||
void bhvLllVolcanoFallingTrap_loop(void);
|
||||
void bhv_dust_smoke_loop(void);
|
||||
void bhv_yoshi_loop(void);
|
||||
void bhv_volcano_trap_loop(void);
|
||||
|
||||
extern Gfx *Geo18_802B1BB0(s32 run, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
extern Gfx *geo_move_mario_part_from_parent(s32 run, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
|
||||
// Bowser
|
||||
extern Gfx *Geo18_802B7D44(s32 a0, struct GraphNode *node, UNUSED s32 a2);
|
||||
extern Gfx *Geo18_802B798C(s32 run, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
extern Gfx *geo_bits_bowser_coloring(s32 a0, struct GraphNode *node, UNUSED s32 a2);
|
||||
extern Gfx *geo_update_body_rot_from_parent(s32 run, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
extern Gfx *geo_switch_bowser_eyes(s32 run, struct GraphNode *node, UNUSED Mat4 *mtx);
|
||||
|
||||
// Tuxie
|
||||
extern Gfx *geo_switch_tuxie_mother_eyes(s32 run, struct GraphNode *node, UNUSED Mat4 *mtx);
|
||||
|
||||
// Cap switch
|
||||
extern Gfx *Geo18_802A719C(s32 run, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
extern Gfx *geo_update_held_mario_pos(s32 run, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
|
||||
// Snufit
|
||||
extern Gfx *Geo18_8030D93C(s32 arg0, struct GraphNode *node, UNUSED void *arg2);
|
||||
extern Gfx *Geo18_8030D9AC(s32 arg0, struct GraphNode *node, UNUSED void *arg2);
|
||||
extern Gfx *geo_snufit_move_mask(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
extern Gfx *geo_snufit_scale_body(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c);
|
||||
|
||||
// Bowser key cutscene
|
||||
extern Gfx *Geo18_802BA2B0(s32 run, struct GraphNode *node, UNUSED f32 mtx[4][4]);
|
||||
extern Gfx *geo_scale_bowser_key(s32 run, struct GraphNode *node, UNUSED f32 mtx[4][4]);
|
||||
|
||||
// Water splash
|
||||
extern struct WaterSplashParams D_8032FDD0;
|
||||
extern struct WaterSplashParams D_8032FE18;
|
||||
extern struct WaterDropletParams sShallowWaterSplashDropletParams;
|
||||
extern struct WaterDropletParams sShallowWaterWaveDropletParams;
|
||||
|
||||
#endif // _BEHAVIOR_ACTIONS_H
|
||||
|
||||
@@ -31,7 +31,7 @@ void bhv_homing_amp_init(void) {
|
||||
|
||||
// Homing amps start at 1/10th their normal size.
|
||||
// They grow when they "appear" to Mario.
|
||||
obj_scale(0.1f);
|
||||
cur_obj_scale(0.1f);
|
||||
|
||||
// Hide the amp (until Mario gets near).
|
||||
o->header.gfx.node.flags |= GRAPH_RENDER_INVISIBLE;
|
||||
@@ -44,7 +44,7 @@ static void check_amp_attack(void) {
|
||||
// Strange placement for this call. The hitbox is never cleared.
|
||||
// For perspective, this code is run every frame of bhv_circling_amp_loop
|
||||
// and every frame of a homing amp's HOMING_AMP_ACT_CHASE action.
|
||||
set_object_hitbox(o, &sAmpHitbox);
|
||||
obj_set_hitbox(o, &sAmpHitbox);
|
||||
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
|
||||
// Unnecessary if statement, maybe caused by a macro for
|
||||
@@ -77,11 +77,11 @@ static void homing_amp_appear_loop(void) {
|
||||
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, targetYaw, 0x1000);
|
||||
|
||||
// For 30 frames, make the amp "appear" by increasing its size by 0.03 each frame,
|
||||
// except for the first frame (when oTimer == 0) because the expression in obj_scale
|
||||
// except for the first frame (when oTimer == 0) because the expression in cur_obj_scale
|
||||
// evaluates to 0.1, which is the same as it was before. After 30 frames, it ends at
|
||||
// a scale factor of 0.97. The amp remains at 97% of its real height for 60 more frames.
|
||||
if (o->oTimer < 30) {
|
||||
obj_scale(0.1 + 0.9 * (f32)(o->oTimer / 30.0f));
|
||||
cur_obj_scale(0.1 + 0.9 * (f32)(o->oTimer / 30.0f));
|
||||
} else {
|
||||
o->oAnimState = 1;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ static void homing_amp_appear_loop(void) {
|
||||
// Once the timer becomes greater than 90, i.e. 91 frames have passed,
|
||||
// reset the amp's size and start chasing Mario.
|
||||
if (o->oTimer >= 91) {
|
||||
obj_scale(1.0f);
|
||||
cur_obj_scale(1.0f);
|
||||
o->oAction = HOMING_AMP_ACT_CHASE;
|
||||
o->oAmpYPhase = 0;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ static void amp_attack_cooldown_loop(void) {
|
||||
o->header.gfx.unk38.animFrame += 2;
|
||||
o->oForwardVel = 0;
|
||||
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
|
||||
if (o->oTimer >= 31) {
|
||||
o->oAnimState = 0;
|
||||
@@ -189,7 +189,7 @@ static void amp_attack_cooldown_loop(void) {
|
||||
|
||||
if (o->oTimer >= 91) {
|
||||
o->oAnimState = 1;
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
o->oAction = HOMING_AMP_ACT_CHASE;
|
||||
}
|
||||
}
|
||||
@@ -213,7 +213,7 @@ void bhv_homing_amp_loop(void) {
|
||||
|
||||
case HOMING_AMP_ACT_CHASE:
|
||||
homing_amp_chase_loop();
|
||||
PlaySound(SOUND_AIR_AMP_BUZZ);
|
||||
cur_obj_play_sound_1(SOUND_AIR_AMP_BUZZ);
|
||||
break;
|
||||
|
||||
case HOMING_AMP_ACT_GIVE_UP:
|
||||
@@ -292,7 +292,7 @@ static void fixed_circling_amp_idle_loop(void) {
|
||||
// Oscillate
|
||||
o->oAmpYPhase++;
|
||||
|
||||
// Where there is a PlaySound call in the main circling amp update function,
|
||||
// Where there is a cur_obj_play_sound_1 call in the main circling amp update function,
|
||||
// there is nothing here. Fixed amps are the only amps that never play
|
||||
// the "amp buzzing" sound.
|
||||
}
|
||||
@@ -318,7 +318,7 @@ static void circling_amp_idle_loop(void) {
|
||||
// Oscillate
|
||||
o->oAmpYPhase++;
|
||||
|
||||
PlaySound(SOUND_AIR_AMP_BUZZ);
|
||||
cur_obj_play_sound_1(SOUND_AIR_AMP_BUZZ);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ struct Struct80331A54 D_80331A54[][5] = {
|
||||
s16 D_80331ACC[] = { 250, 200, 200 };
|
||||
|
||||
void bhv_animates_on_floor_switch_press_init(void) {
|
||||
o->parentObj = obj_nearest_object_with_behavior(bhvFloorSwitchAnimatesObject);
|
||||
o->parentObj = cur_obj_nearest_object_with_behavior(bhvFloorSwitchAnimatesObject);
|
||||
}
|
||||
|
||||
void bhv_animates_on_floor_switch_press_loop(void) {
|
||||
@@ -53,9 +53,9 @@ void bhv_animates_on_floor_switch_press_loop(void) {
|
||||
|
||||
if (o->oFloorSwitchPressAnimationUnkF4 != 0) {
|
||||
if (o->oFloorSwitchPressAnimationUnkF4 < 60) {
|
||||
PlaySound(SOUND_GENERAL2_SWITCH_TICK_SLOW);
|
||||
cur_obj_play_sound_1(SOUND_GENERAL2_SWITCH_TICK_SLOW);
|
||||
} else {
|
||||
PlaySound(SOUND_GENERAL2_SWITCH_TICK_FAST);
|
||||
cur_obj_play_sound_1(SOUND_GENERAL2_SWITCH_TICK_FAST);
|
||||
}
|
||||
|
||||
if (--o->oFloorSwitchPressAnimationUnkF4 == 0) {
|
||||
@@ -73,5 +73,5 @@ void bhv_animates_on_floor_switch_press_loop(void) {
|
||||
o->collisionData = segmented_to_virtual(
|
||||
D_80331A54[o->oBehParams2ndByte][o->oFloorSwitchPressAnimationUnkF8 / 2].unk00);
|
||||
|
||||
obj_set_model(D_80331A54[o->oBehParams2ndByte][o->oFloorSwitchPressAnimationUnkF8 / 2].unk04);
|
||||
cur_obj_set_model(D_80331A54[o->oBehParams2ndByte][o->oFloorSwitchPressAnimationUnkF8 / 2].unk04);
|
||||
}
|
||||
|
||||
@@ -32,11 +32,11 @@ void bhv_haunted_bookshelf_loop(void) {
|
||||
case HAUNTED_BOOKSHELF_ACT_RECEDE:
|
||||
// Move the bookshelf and play the sound
|
||||
o->oPosX += 5.0f;
|
||||
PlaySound(SOUND_ENV_ELEVATOR4_2);
|
||||
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4_2);
|
||||
|
||||
// Delete the object after 102 frames
|
||||
if (o->oTimer > 101) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -33,10 +33,10 @@ static void handle_merry_go_round_music(void) {
|
||||
}
|
||||
|
||||
// All floors in the merry-go-round's enclosure have surface type 0x1A.
|
||||
// The obj_is_mario_on_platform check is redundant since the merry-go-round
|
||||
// The cur_obj_is_mario_on_platform check is redundant since the merry-go-round
|
||||
// has surface type 0x1A, so Mario cannot be on the merry-go-round
|
||||
// without being on a floor with surface type 0x1A (SURFACE_MGR_MUSIC).
|
||||
if (obj_is_mario_on_platform() || marioFloorType == SURFACE_MGR_MUSIC) {
|
||||
if (cur_obj_is_mario_on_platform() || marioFloorType == SURFACE_MGR_MUSIC) {
|
||||
// If Mario is in the merry-go-round's enclosure, play only the merry-go-round music.
|
||||
play_secondary_music(SEQ_EVENT_MERRY_GO_ROUND, 0, 78, 50);
|
||||
gMarioOnMerryGoRound = TRUE;
|
||||
@@ -57,7 +57,7 @@ static void handle_merry_go_round_music(void) {
|
||||
func_80321080(300); // Switch to BBH music? FIXME: Audio needs labelling
|
||||
o->oMerryGoRoundMusicShouldPlay = FALSE;
|
||||
} else {
|
||||
PlaySound(SOUND_ENV_MERRY_GO_ROUND_CREAKING);
|
||||
cur_obj_play_sound_1(SOUND_ENV_MERRY_GO_ROUND_CREAKING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ void bhv_alpha_boo_key_loop(void) {
|
||||
o->oFaceAngleRoll += 0x200;
|
||||
o->oFaceAngleYaw += 0x200;
|
||||
|
||||
if (are_objects_collided(o, gMarioObject)) {
|
||||
if (obj_check_if_collided_with_object(o, gMarioObject)) {
|
||||
// This line makes the object inside the key's parent boo drop.
|
||||
// Was this intended to make the boo die when the key is collected?
|
||||
// Boos don't read from oBooDeathStatus, they only set it to let the
|
||||
@@ -38,7 +38,7 @@ void bhv_alpha_boo_key_loop(void) {
|
||||
o->parentObj->oBooDeathStatus = BOO_DEATH_STATUS_DYING;
|
||||
|
||||
// Delete the object and spawn sparkles
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
spawn_object(o, MODEL_SPARKLES, bhvGoldenCoinSparkles);
|
||||
}
|
||||
}
|
||||
@@ -51,8 +51,8 @@ void bhv_alpha_boo_key_loop(void) {
|
||||
*/
|
||||
static void beta_boo_key_dropped_loop(void) {
|
||||
// Apply standard physics to the key
|
||||
obj_update_floor_and_walls();
|
||||
obj_move_standard(78);
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_move_standard(78);
|
||||
|
||||
// Slowly increase the Y offset to make the model aligned correctly.
|
||||
// This is spread out over 13 frames so that it's not noticable.
|
||||
@@ -82,9 +82,9 @@ static void beta_boo_key_dropped_loop(void) {
|
||||
// If the key hits the floor or 90 frames have elapsed since it was dropped,
|
||||
// become tangible and handle collision.
|
||||
if (o->oTimer > 90 || o->oMoveFlags & OBJ_MOVE_LANDED) {
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
|
||||
if (are_objects_collided(o, gMarioObject)) {
|
||||
if (obj_check_if_collided_with_object(o, gMarioObject)) {
|
||||
// This interaction status is 0x01, the first interaction status flag.
|
||||
// It was only used for Hoot in the final game, but it seems it could've
|
||||
// done something else or held some special meaning in beta.
|
||||
@@ -97,7 +97,7 @@ static void beta_boo_key_dropped_loop(void) {
|
||||
o->parentObj->oInteractStatus = INT_STATUS_HOOT_GRABBED_BY_MARIO;
|
||||
|
||||
// Delete the object and spawn sparkles
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
spawn_object(o, MODEL_SPARKLES, bhvGoldenCoinSparkles);
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ static void beta_boo_key_drop(void) {
|
||||
|
||||
// Update the key to be inside the boo
|
||||
struct Object *parent = o->parentObj;
|
||||
copy_object_pos(o, parent);
|
||||
obj_copy_pos(o, parent);
|
||||
|
||||
// This if statement to only run this code on the first frame
|
||||
// is redundant, since it instantly sets the action to BETA_BOO_KEY_ACT_DROPPED
|
||||
@@ -147,7 +147,7 @@ static void beta_boo_key_drop(void) {
|
||||
static void beta_boo_key_inside_boo_loop(void) {
|
||||
// Update the key to be inside the boo at all times
|
||||
struct Object *parent = o->parentObj;
|
||||
copy_object_pos(o, parent);
|
||||
obj_copy_pos(o, parent);
|
||||
|
||||
// Use a Y offset of 40 to make the key model aligned correctly.
|
||||
// (Why didn't they use oGraphYOffset?)
|
||||
@@ -170,5 +170,5 @@ static void (*sBetaBooKeyActions[])(void) = { beta_boo_key_inside_boo_loop, beta
|
||||
* Update function for bhvBetaBooKey.
|
||||
*/
|
||||
void bhv_beta_boo_key_loop(void) {
|
||||
obj_call_action_function(sBetaBooKeyActions);
|
||||
cur_obj_call_action_function(sBetaBooKeyActions);
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
void bhv_beta_bowser_anchor_loop(void) {
|
||||
// Set the object's position to be 30 units above Mario's feet,
|
||||
// and 300 units in front of him.
|
||||
obj_set_pos_relative(gMarioObject, 0, 30.0f, 300.0f);
|
||||
cur_obj_set_pos_relative(gMarioObject, 0, 30.0f, 300.0f);
|
||||
|
||||
o->hitboxRadius = gDebugInfo[4][0] + 100;
|
||||
o->hitboxHeight = gDebugInfo[4][1] + 300;
|
||||
|
||||
attack_collided_non_mario_object(o);
|
||||
obj_attack_collided_from_other_object(o);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
void bhv_beta_chest_bottom_init(void) {
|
||||
// Set the object's model
|
||||
obj_set_model(MODEL_TREASURE_CHEST_BASE);
|
||||
cur_obj_set_model(MODEL_TREASURE_CHEST_BASE);
|
||||
|
||||
// ??? Pointless code?
|
||||
// Maybe chests were originally intended to have random yaws.
|
||||
@@ -33,7 +33,7 @@ void bhv_beta_chest_bottom_init(void) {
|
||||
* with radius 200 units and height 200 units.
|
||||
*/
|
||||
void bhv_beta_chest_bottom_loop(void) {
|
||||
obj_push_mario_away_from_cylinder(200.0f, 200.0f);
|
||||
cur_obj_push_mario_away_from_cylinder(200.0f, 200.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,9 +21,9 @@ void bhv_beta_holdable_object_init(void) {
|
||||
*/
|
||||
static void beta_holdable_object_drop(void) {
|
||||
// Re-enable rendering
|
||||
obj_enable_rendering();
|
||||
cur_obj_enable_rendering();
|
||||
|
||||
obj_get_dropped();
|
||||
cur_obj_get_dropped();
|
||||
|
||||
o->oHeldState = HELD_FREE;
|
||||
|
||||
@@ -35,10 +35,10 @@ static void beta_holdable_object_drop(void) {
|
||||
* Throw the object.
|
||||
*/
|
||||
static void beta_holdable_object_throw(void) {
|
||||
// obj_enable_rendering_2 just calls obj_enable_rendering and does
|
||||
// cur_obj_enable_rendering_2 just calls cur_obj_enable_rendering and does
|
||||
// nothing else; it's useless here. Maybe it originally did more?
|
||||
obj_enable_rendering_2();
|
||||
obj_enable_rendering();
|
||||
cur_obj_enable_rendering_2();
|
||||
cur_obj_enable_rendering();
|
||||
|
||||
o->oHeldState = HELD_FREE;
|
||||
|
||||
@@ -64,7 +64,7 @@ void bhv_beta_holdable_object_loop(void) {
|
||||
|
||||
case HELD_HELD:
|
||||
// Disable rendering to hide the object while it's held
|
||||
obj_disable_rendering();
|
||||
cur_obj_disable_rendering();
|
||||
break;
|
||||
|
||||
case HELD_THROWN:
|
||||
|
||||
@@ -20,8 +20,8 @@ void bhv_beta_trampoline_spring_loop(void) {
|
||||
f32 yDisplacement;
|
||||
|
||||
// Update to be 75 units under the trampoline top
|
||||
copy_object_pos_and_angle(o, o->parentObj);
|
||||
copy_object_graph_y_offset(o, o->parentObj);
|
||||
obj_copy_pos_and_angle(o, o->parentObj);
|
||||
obj_copy_graph_y_offset(o, o->parentObj);
|
||||
o->oPosY -= 75.0f;
|
||||
|
||||
// If the trampoline top is above its original position,
|
||||
@@ -42,7 +42,7 @@ void bhv_beta_trampoline_spring_loop(void) {
|
||||
}
|
||||
|
||||
// Scale the spring
|
||||
scale_object_xyz(o, 1.0f, yScale, 1.0f);
|
||||
obj_scale_xyz(o, 1.0f, yScale, 1.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ void bhv_beta_trampoline_spring_loop(void) {
|
||||
* do anything.
|
||||
*/
|
||||
void bhv_beta_trampoline_top_loop(void) {
|
||||
obj_set_model(MODEL_TRAMPOLINE);
|
||||
cur_obj_set_model(MODEL_TRAMPOLINE);
|
||||
|
||||
// When initialized, spawn the rest of the trampoline
|
||||
if (o->oTimer == 0) {
|
||||
@@ -83,5 +83,5 @@ void bhv_beta_trampoline_top_loop(void) {
|
||||
// that the trampoline is currently in use. This potential
|
||||
// trampoline infrastructure is found in mario_step.c. See
|
||||
// that file for more details.
|
||||
nop_80254E50();
|
||||
stub_mario_step_2();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ static void bird_act_inactive(void) {
|
||||
if (o->oBehParams2ndByte != BIRD_BP_SPAWNED) {
|
||||
s32 i;
|
||||
|
||||
PlaySound2(SOUND_GENERAL_BIRDS_FLY_AWAY);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_BIRDS_FLY_AWAY);
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
spawn_object(o, MODEL_BIRDS, bhvBird);
|
||||
@@ -42,7 +42,7 @@ static void bird_act_inactive(void) {
|
||||
|
||||
o->oBirdSpeed = 40.0f;
|
||||
|
||||
obj_unhide();
|
||||
cur_obj_unhide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,12 +63,12 @@ static void bird_act_fly(void) {
|
||||
// is itself. In other words, when a group of birds has its spawner bird
|
||||
// fly past Y=8000, they will all despawn simultaneously. Otherwise, fly.
|
||||
if (o->parentObj->oPosY > 8000.0f) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
// If the bird is a spawner bird, fly towards its home; otherwise,
|
||||
// fly towards the bird's spawner bird.
|
||||
if (o->oBehParams2ndByte != BIRD_BP_SPAWNED) {
|
||||
distance = obj_lateral_dist_to_home();
|
||||
distance = cur_obj_lateral_dist_to_home();
|
||||
|
||||
// The spawner bird will start with its downwards (positive) pitch
|
||||
// and will continuously decrease its pitch (i.e. make itself face more upwards)
|
||||
@@ -76,13 +76,13 @@ static void bird_act_fly(void) {
|
||||
// This is done by making its target pitch the arctangent of its distance
|
||||
// to its home and its position - 10,000 (which is always negative).
|
||||
o->oBirdTargetPitch = atan2s(distance, o->oPosY - 10000.0f);
|
||||
o->oBirdTargetYaw = obj_angle_to_home();
|
||||
o->oBirdTargetYaw = cur_obj_angle_to_home();
|
||||
} else {
|
||||
distance = lateral_dist_between_objects(o, o->parentObj);
|
||||
|
||||
// The bird's target pitch will face directly to its spawner bird.
|
||||
o->oBirdTargetPitch = atan2s(distance, o->oPosY - o->parentObj->oPosY);
|
||||
o->oBirdTargetYaw = angle_to_object(o, o->parentObj);
|
||||
o->oBirdTargetYaw = obj_angle_to_object(o, o->parentObj);
|
||||
|
||||
// The bird goes faster the farther it is from its spawner bird so it can catch up.
|
||||
o->oBirdSpeed = 0.04f * dist_between_objects(o, o->parentObj) + 20.0f;
|
||||
@@ -90,7 +90,7 @@ static void bird_act_fly(void) {
|
||||
|
||||
// Approach to match the bird's target yaw and pitch.
|
||||
obj_move_pitch_approach(o->oBirdTargetPitch, 140);
|
||||
obj_rotate_yaw_toward(o->oBirdTargetYaw, 800);
|
||||
cur_obj_rotate_yaw_toward(o->oBirdTargetYaw, 800);
|
||||
obj_roll_to_match_yaw_turn(o->oBirdTargetYaw, 0x3000, 600);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ static void bird_act_fly(void) {
|
||||
// a constant added to its Y position every frame since
|
||||
// its Y velocity is reset every frame by
|
||||
// obj_compute_vel_from_move_pitch.
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,11 +13,11 @@ void bhv_hidden_blue_coin_loop(void) {
|
||||
switch (o->oAction) {
|
||||
case HIDDEN_BLUE_COIN_ACT_INACTIVE:
|
||||
// Become invisible and intangible
|
||||
obj_disable_rendering();
|
||||
obj_become_intangible();
|
||||
cur_obj_disable_rendering();
|
||||
cur_obj_become_intangible();
|
||||
|
||||
// Set action to HIDDEN_BLUE_COIN_ACT_WAITING after the blue coin switch is found.
|
||||
o->oHiddenBlueCoinSwitch = obj_nearest_object_with_behavior(bhvBlueCoinSwitch);
|
||||
o->oHiddenBlueCoinSwitch = cur_obj_nearest_object_with_behavior(bhvBlueCoinSwitch);
|
||||
|
||||
if (o->oHiddenBlueCoinSwitch != NULL) {
|
||||
o->oAction++;
|
||||
@@ -35,19 +35,19 @@ void bhv_hidden_blue_coin_loop(void) {
|
||||
break;
|
||||
case HIDDEN_BLUE_COIN_ACT_ACTIVE:
|
||||
// Become tangible
|
||||
obj_enable_rendering();
|
||||
obj_become_tangible();
|
||||
cur_obj_enable_rendering();
|
||||
cur_obj_become_tangible();
|
||||
|
||||
// Delete the coin once collected
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
|
||||
spawn_object(o, MODEL_SPARKLES, bhvGoldenCoinSparkles);
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
// After 200 frames of waiting and 20 2-frame blinks (for 240 frames total),
|
||||
// delete the object.
|
||||
if (obj_wait_then_blink(200, 20)) {
|
||||
mark_object_for_deletion(o);
|
||||
if (cur_obj_wait_then_blink(200, 20)) {
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -61,7 +61,7 @@ void bhv_hidden_blue_coin_loop(void) {
|
||||
*/
|
||||
void bhv_blue_coin_switch_loop(void) {
|
||||
// The switch's model is 1/3 size.
|
||||
obj_scale(3.0f);
|
||||
cur_obj_scale(3.0f);
|
||||
|
||||
switch (o->oAction) {
|
||||
case BLUE_COIN_SWITCH_ACT_IDLE:
|
||||
@@ -77,7 +77,7 @@ void bhv_blue_coin_switch_loop(void) {
|
||||
// Set gravity to 0 so it doesn't accelerate when receding.
|
||||
o->oGravity = 0.0f;
|
||||
|
||||
PlaySound2(SOUND_GENERAL_SWITCH_DOOR_OPEN);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_SWITCH_DOOR_OPEN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ void bhv_blue_coin_switch_loop(void) {
|
||||
// This is probably an off-by-one error, since the switch is 100 units tall
|
||||
// and recedes at 20 units/frame, which means it will fully recede after 5 frames.
|
||||
if (o->oTimer > 5) {
|
||||
obj_hide();
|
||||
cur_obj_hide();
|
||||
|
||||
// Set to BLUE_COIN_SWITCH_ACT_TICKING
|
||||
o->oAction++;
|
||||
@@ -98,13 +98,13 @@ void bhv_blue_coin_switch_loop(void) {
|
||||
o->oPosY = gMarioObject->oPosY - 40.0f;
|
||||
|
||||
// Spawn particles. There's a function that calls this same function
|
||||
// with the same arguments, func_802A3004, why didn't they just call that?
|
||||
func_802AA618(0, 0, 46.0f);
|
||||
// with the same arguments, spawn_mist_particles, why didn't they just call that?
|
||||
spawn_mist_particles_variable(0, 0, 46.0f);
|
||||
} else {
|
||||
// Have collision while receding
|
||||
load_object_collision_model();
|
||||
// Recede
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -118,8 +118,8 @@ void bhv_blue_coin_switch_loop(void) {
|
||||
|
||||
// Delete the switch (which stops the sound) after the last coin is collected,
|
||||
// or after the coins unload after the 240-frame timer expires.
|
||||
if (obj_nearest_object_with_behavior(bhvHiddenBlueCoin) == NULL || o->oTimer > 240) {
|
||||
mark_object_for_deletion(o);
|
||||
if (cur_obj_nearest_object_with_behavior(bhvHiddenBlueCoin) == NULL || o->oTimer > 240) {
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -1,76 +1,127 @@
|
||||
// blue_fish.c.inc
|
||||
/**
|
||||
* @file blue_fish.inc.c
|
||||
* Implements behaviour and spawning for bhvBlueFish located in the castle aquarium outside of SA.
|
||||
*/
|
||||
|
||||
void bhv_blue_fish_loop(void) {
|
||||
f32 sp24;
|
||||
/**
|
||||
* Determines fish movement.
|
||||
*/
|
||||
void bhv_blue_fish_movement_loop(void) {
|
||||
f32 randomSwitch;
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
func_8029ED98(0, 1.0f);
|
||||
// Initial dive phase after spawning
|
||||
case BLUE_FISH_ACT_DIVE:
|
||||
cur_obj_init_animation_with_accel_and_sound(0, 1.0f);
|
||||
|
||||
// Assigns random values to variables that help determine natural motion.
|
||||
if (o->oTimer == 0) {
|
||||
o->oBlueFishUnk100 = RandomSign() << 11;
|
||||
o->oBlueFishUnkF4 = RandomFloat() * 2;
|
||||
o->oBlueFishUnkF8 = (s32)(RandomFloat() * 30) & 0xFE;
|
||||
sp24 = RandomFloat() * 5;
|
||||
if (sp24 < 2.0f)
|
||||
o->oBlueFishRandomAngle = RandomSign() << 11;
|
||||
o->oBlueFishRandomVel = RandomFloat() * 2;
|
||||
o->oBlueFishRandomTime = (s32)(RandomFloat() * 30) & 0xFE;
|
||||
|
||||
// Adjusts pitch velocity or sets to zero dependant on outcome of randomSwitch.
|
||||
randomSwitch = RandomFloat() * 5;
|
||||
if (randomSwitch < 2.0f) {
|
||||
o->oAngleVelPitch = random_f32_around_zero(128);
|
||||
else
|
||||
} else {
|
||||
o->oAngleVelPitch = 0;
|
||||
}
|
||||
}
|
||||
o->oForwardVel = o->oBlueFishUnkF4 + 3.0f;
|
||||
if (o->oTimer >= o->oBlueFishUnkF8 + 60)
|
||||
|
||||
// Set forward velocity and progress oAction to BLUE_FISH_ACT_TURN.
|
||||
o->oForwardVel = o->oBlueFishRandomVel + 3.0f;
|
||||
if (o->oTimer >= o->oBlueFishRandomTime + 60) {
|
||||
o->oAction++;
|
||||
if (o->oTimer < (o->oBlueFishUnkF8 + 60) / 2)
|
||||
}
|
||||
|
||||
// Set pitch velocity
|
||||
if (o->oTimer < (o->oBlueFishRandomTime + 60) / 2) {
|
||||
o->oFaceAnglePitch += o->oAngleVelPitch;
|
||||
else
|
||||
} else {
|
||||
o->oFaceAnglePitch -= o->oAngleVelPitch;
|
||||
}
|
||||
|
||||
// Calculate new Y velocity
|
||||
o->oVelY = -sins(o->oFaceAnglePitch) * o->oForwardVel;
|
||||
break;
|
||||
case 1:
|
||||
func_8029ED98(0, 2.0f);
|
||||
o->oMoveAngleYaw = (s32)(o->oBlueFishUnk100 + o->oMoveAngleYaw);
|
||||
if (o->oTimer == 15)
|
||||
// Animates and adjusts fish yaw angle.
|
||||
case BLUE_FISH_ACT_TURN:
|
||||
cur_obj_init_animation_with_accel_and_sound(0, 2.0f);
|
||||
o->oMoveAngleYaw = (s32)(o->oBlueFishRandomAngle + o->oMoveAngleYaw);
|
||||
if (o->oTimer == 15) {
|
||||
o->oAction++;
|
||||
break;
|
||||
case 2:
|
||||
func_8029ED98(0, 1.0f);
|
||||
if (o->oTimer >= o->oBlueFishUnkF8 + 60)
|
||||
}
|
||||
break;
|
||||
// Animates and adjusts pitch to an upward direction.
|
||||
case BLUE_FISH_ACT_ASCEND:
|
||||
cur_obj_init_animation_with_accel_and_sound(0, 1.0f);
|
||||
|
||||
// Progresses oAction to BLUE_FISH_ACT_TURN_BACK after elapsed time.
|
||||
if (o->oTimer >= o->oBlueFishRandomTime + 60) {
|
||||
o->oAction++;
|
||||
if (o->oTimer < (o->oBlueFishUnkF8 + 60) / 2)
|
||||
}
|
||||
|
||||
// Adjusts pitch angle. Direction relies on time not passed.
|
||||
if (o->oTimer < (o->oBlueFishRandomTime + 60) / 2) {
|
||||
o->oFaceAnglePitch -= o->oAngleVelPitch;
|
||||
else
|
||||
} else {
|
||||
o->oFaceAnglePitch += o->oAngleVelPitch;
|
||||
break;
|
||||
case 3:
|
||||
func_8029ED98(0, 2.0f);
|
||||
o->oMoveAngleYaw = (s32)(o->oBlueFishUnk100 + o->oMoveAngleYaw);
|
||||
if (o->oTimer == 15)
|
||||
o->oAction = 0;
|
||||
}
|
||||
break;
|
||||
// Animates and turns fish around
|
||||
case BLUE_FISH_ACT_TURN_BACK:
|
||||
cur_obj_init_animation_with_accel_and_sound(0, 2.0f);
|
||||
o->oMoveAngleYaw = (s32)(o->oBlueFishRandomAngle + o->oMoveAngleYaw);
|
||||
|
||||
// Sets the fish back to the BLUE_FISH_ACT_DIVE phase.
|
||||
if (o->oTimer == 15) {
|
||||
o->oAction = BLUE_FISH_ACT_DIVE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Calculates Y velocity and calls physics engine.
|
||||
o->oVelY = -sins(o->oFaceAnglePitch) * o->oForwardVel;
|
||||
obj_move_using_fvel_and_gravity();
|
||||
if (o->parentObj->oAction == 2)
|
||||
mark_object_for_deletion(o);
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
|
||||
// Deletes object if the parent has oAction set to BLUE_FISH_ACT_DUPLICATE.
|
||||
if (o->parentObj->oAction == BLUE_FISH_ACT_DUPLICATE) {
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawns fifteen fish if Mario resides in room fifteen or seven.
|
||||
* They move at random within 200.0f
|
||||
*/
|
||||
void bhv_tank_fish_group_loop(void) {
|
||||
struct Object *fish;
|
||||
s32 i;
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
case BLUE_FISH_ACT_SPAWN:
|
||||
if (gMarioCurrentRoom == 15 || gMarioCurrentRoom == 7) {
|
||||
|
||||
// spawns fifteen fish and moves them within 200.0f
|
||||
for (i = 0; i < 15; i++) {
|
||||
fish = spawn_object_relative(0, 300, 0, -200, o, MODEL_FISH, bhvBlueFish);
|
||||
translate_object_xyz_random(fish, 200.0f);
|
||||
obj_translate_xyz_random(fish, 200.0f);
|
||||
}
|
||||
|
||||
// Proceed to BLUE_FISH_ACT_ROOM phase.
|
||||
o->oAction++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (gMarioCurrentRoom != 15 && gMarioCurrentRoom != 7)
|
||||
|
||||
// Sets next oAction phase if Mario is not in rooms fifteen and seven.
|
||||
case BLUE_FISH_ACT_ROOM:
|
||||
if (gMarioCurrentRoom != 15 && gMarioCurrentRoom != 7) {
|
||||
o->oAction++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
o->oAction = 0;
|
||||
|
||||
// Sets oAction to the BLUE_FISH_ACT_SPAWN phase.
|
||||
case BLUE_FISH_ACT_DUPLICATE:
|
||||
o->oAction = BLUE_FISH_ACT_SPAWN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ void bhv_bobomb_init(void) {
|
||||
o->oInteractionSubtype = INT_SUBTYPE_KICKABLE;
|
||||
}
|
||||
|
||||
void func_802E5B7C(void) {
|
||||
void bobomb_spawn_coin(void) {
|
||||
if (((o->oBehParams >> 8) & 0x1) == 0) {
|
||||
obj_spawn_yellow_coins(o, 1);
|
||||
o->oBehParams = 0x100;
|
||||
@@ -27,22 +27,23 @@ void func_802E5B7C(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void BobombExplodeLoop(void) {
|
||||
void bobomb_act_explode(void) {
|
||||
struct Object *explosion;
|
||||
if (o->oTimer < 5)
|
||||
obj_scale(1.0 + (f32) o->oTimer / 5.0);
|
||||
cur_obj_scale(1.0 + (f32) o->oTimer / 5.0);
|
||||
else {
|
||||
explosion = spawn_object(o, MODEL_EXPLOSION, bhvExplosion);
|
||||
explosion->oGraphYOffset += 100.0f;
|
||||
|
||||
func_802E5B7C();
|
||||
bobomb_spawn_coin();
|
||||
create_respawner(MODEL_BLACK_BOBOMB, bhvBobomb, 3000);
|
||||
o->activeFlags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckBobombInteractions(void) {
|
||||
set_object_hitbox(o, &sBobombHitbox);
|
||||
|
||||
void bobomb_check_interactions(void) {
|
||||
obj_set_hitbox(o, &sBobombHitbox);
|
||||
if ((o->oInteractStatus & INT_STATUS_INTERACTED) != 0) /* bit 15 */
|
||||
{
|
||||
if ((o->oInteractStatus & INTERACT_GRABBABLE) != 0) /* bit 1 */
|
||||
@@ -59,11 +60,11 @@ void CheckBobombInteractions(void) {
|
||||
o->oInteractStatus = 0;
|
||||
}
|
||||
|
||||
if (attack_collided_non_mario_object(o) == 1)
|
||||
if (obj_attack_collided_from_other_object(o) == 1)
|
||||
o->oAction = BOBOMB_ACT_EXPLODE;
|
||||
}
|
||||
|
||||
void BobombPatrolLoop(void) {
|
||||
void bobomb_act_patrol(void) {
|
||||
UNUSED s8 filler[4];
|
||||
UNUSED s16 sp22;
|
||||
s16 collisionFlags;
|
||||
@@ -80,7 +81,7 @@ void BobombPatrolLoop(void) {
|
||||
obj_check_floor_death(collisionFlags, sObjFloor);
|
||||
}
|
||||
|
||||
void BobombChaseMarioLoop(void) {
|
||||
void bobomb_act_chase_mario(void) {
|
||||
UNUSED u8 filler[4];
|
||||
s16 sp1a, collisionFlags;
|
||||
|
||||
@@ -90,35 +91,35 @@ void BobombChaseMarioLoop(void) {
|
||||
collisionFlags = object_step();
|
||||
|
||||
if (sp1a == 5 || sp1a == 16)
|
||||
PlaySound2(SOUND_OBJ_BOBOMB_WALK);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
|
||||
|
||||
obj_turn_toward_object(o, gMarioObject, 16, 0x800);
|
||||
obj_check_floor_death(collisionFlags, sObjFloor);
|
||||
}
|
||||
|
||||
void BobombLaunchedLoop(void) {
|
||||
void bobomb_act_launched(void) {
|
||||
s16 collisionFlags = 0;
|
||||
collisionFlags = object_step();
|
||||
if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) == OBJ_COL_FLAG_GROUNDED)
|
||||
o->oAction = BOBOMB_ACT_EXPLODE; /* bit 0 */
|
||||
}
|
||||
|
||||
void GenericBobombFreeLoop(void) {
|
||||
void generic_bobomb_free_loop(void) {
|
||||
switch (o->oAction) {
|
||||
case BOBOMB_ACT_PATROL:
|
||||
BobombPatrolLoop();
|
||||
bobomb_act_patrol();
|
||||
break;
|
||||
|
||||
case BOBOMB_ACT_LAUNCHED:
|
||||
BobombLaunchedLoop();
|
||||
bobomb_act_launched();
|
||||
break;
|
||||
|
||||
case BOBOMB_ACT_CHASE_MARIO:
|
||||
BobombChaseMarioLoop();
|
||||
bobomb_act_chase_mario();
|
||||
break;
|
||||
|
||||
case BOBOMB_ACT_EXPLODE:
|
||||
BobombExplodeLoop();
|
||||
bobomb_act_explode();
|
||||
break;
|
||||
|
||||
case BOBOMB_ACT_LAVA_DEATH:
|
||||
@@ -132,20 +133,20 @@ void GenericBobombFreeLoop(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
CheckBobombInteractions();
|
||||
bobomb_check_interactions();
|
||||
|
||||
if (o->oBobombFuseTimer >= 151)
|
||||
o->oAction = 3;
|
||||
}
|
||||
|
||||
void StationaryBobombFreeLoop(void) {
|
||||
void stationary_bobomb_free_loop(void) {
|
||||
switch (o->oAction) {
|
||||
case BOBOMB_ACT_LAUNCHED:
|
||||
BobombLaunchedLoop();
|
||||
bobomb_act_launched();
|
||||
break;
|
||||
|
||||
case BOBOMB_ACT_EXPLODE:
|
||||
BobombExplodeLoop();
|
||||
bobomb_act_explode();
|
||||
break;
|
||||
|
||||
case BOBOMB_ACT_LAVA_DEATH:
|
||||
@@ -159,28 +160,28 @@ void StationaryBobombFreeLoop(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
CheckBobombInteractions();
|
||||
bobomb_check_interactions();
|
||||
|
||||
if (o->oBobombFuseTimer >= 151)
|
||||
o->oAction = 3;
|
||||
}
|
||||
|
||||
void BobombFreeLoop(void) {
|
||||
void bobomb_free_loop(void) {
|
||||
if (o->oBehParams2ndByte == BOBOMB_BP_STYPE_GENERIC)
|
||||
GenericBobombFreeLoop();
|
||||
generic_bobomb_free_loop();
|
||||
else
|
||||
StationaryBobombFreeLoop();
|
||||
stationary_bobomb_free_loop();
|
||||
}
|
||||
|
||||
void BobombHeldLoop(void) {
|
||||
void bobomb_held_loop(void) {
|
||||
o->header.gfx.node.flags |= 0x10; /* bit 4 */
|
||||
SetObjAnimation(1);
|
||||
obj_set_pos_relative(gMarioObject, 0, 60.0f, 100.0);
|
||||
cur_obj_init_animation(1);
|
||||
cur_obj_set_pos_relative(gMarioObject, 0, 60.0f, 100.0);
|
||||
|
||||
o->oBobombFuseLit = 1;
|
||||
if (o->oBobombFuseTimer >= 151) {
|
||||
//! Although the Bob-omb's action is set to explode when the fuse timer expires,
|
||||
// BobombExplodeLoop() will not execute until the bob-omb's held state changes.
|
||||
// bobomb_act_explode() will not execute until the bob-omb's held state changes.
|
||||
// This allows the Bob-omb to be regrabbed indefinitely.
|
||||
|
||||
gMarioObject->oInteractStatus |= INTERACT_DAMAGE; /* bit 3 */
|
||||
@@ -188,18 +189,18 @@ void BobombHeldLoop(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void BobombDroppedLoop(void) {
|
||||
obj_get_dropped();
|
||||
void bobomb_dropped_loop(void) {
|
||||
cur_obj_get_dropped();
|
||||
|
||||
o->header.gfx.node.flags &= ~0x10; /* bit 4 = 0 */
|
||||
SetObjAnimation(0);
|
||||
cur_obj_init_animation(0);
|
||||
|
||||
o->oHeldState = 0;
|
||||
o->oAction = BOBOMB_ACT_PATROL;
|
||||
}
|
||||
|
||||
void BobombThrownLoop(void) {
|
||||
obj_enable_rendering_2();
|
||||
void bobomb_thrown_loop(void) {
|
||||
cur_obj_enable_rendering_2();
|
||||
|
||||
o->header.gfx.node.flags &= ~0x10; /* bit 4 = 0 */
|
||||
o->oHeldState = 0;
|
||||
@@ -211,7 +212,7 @@ void BobombThrownLoop(void) {
|
||||
|
||||
// sp18 = blinkTimer
|
||||
|
||||
void ObjRandomBlink(s32 *blinkTimer) {
|
||||
void curr_obj_random_blink(s32 *blinkTimer) {
|
||||
if (*blinkTimer == 0) {
|
||||
if ((s16)(RandomFloat() * 100.0f) == 0) {
|
||||
o->oAnimState = 1;
|
||||
@@ -235,23 +236,23 @@ void bhv_bobomb_loop(void) {
|
||||
if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 4000) != 0) {
|
||||
switch (o->oHeldState) {
|
||||
case HELD_FREE:
|
||||
BobombFreeLoop();
|
||||
bobomb_free_loop();
|
||||
break;
|
||||
|
||||
case HELD_HELD:
|
||||
BobombHeldLoop();
|
||||
bobomb_held_loop();
|
||||
break;
|
||||
|
||||
case HELD_THROWN:
|
||||
BobombThrownLoop();
|
||||
bobomb_thrown_loop();
|
||||
break;
|
||||
|
||||
case HELD_DROPPED:
|
||||
BobombDroppedLoop();
|
||||
bobomb_dropped_loop();
|
||||
break;
|
||||
}
|
||||
|
||||
ObjRandomBlink(&o->oBobombBlinkTimer);
|
||||
curr_obj_random_blink(&o->oBobombBlinkTimer);
|
||||
|
||||
if (o->oBobombFuseLit == 1) {
|
||||
if (o->oBobombFuseTimer >= 121)
|
||||
@@ -263,7 +264,7 @@ void bhv_bobomb_loop(void) {
|
||||
== 0) /* oBobombFuseTimer % 2 or oBobombFuseTimer % 8 */
|
||||
spawn_object(o, MODEL_SMOKE, bhvBobombFuseSmoke);
|
||||
|
||||
PlaySound(SOUND_AIR_BOBOMB_LIT_FUSE);
|
||||
cur_obj_play_sound_1(SOUND_AIR_BOBOMB_LIT_FUSE);
|
||||
|
||||
o->oBobombFuseTimer++;
|
||||
}
|
||||
@@ -274,7 +275,7 @@ void bhv_bobomb_fuse_smoke_init(void) {
|
||||
o->oPosX += (s32)(RandomFloat() * 80.0f) - 40;
|
||||
o->oPosY += (s32)(RandomFloat() * 80.0f) + 60;
|
||||
o->oPosZ += (s32)(RandomFloat() * 80.0f) - 40;
|
||||
obj_scale(1.2f);
|
||||
cur_obj_scale(1.2f);
|
||||
}
|
||||
|
||||
void bhv_bobomb_buddy_init(void) {
|
||||
@@ -284,7 +285,7 @@ void bhv_bobomb_buddy_init(void) {
|
||||
o->oInteractionSubtype = INT_SUBTYPE_NPC;
|
||||
}
|
||||
|
||||
void BobombBuddyIdleLoop(void) {
|
||||
void bobomb_buddy_act_idle(void) {
|
||||
UNUSED u8 filler[4];
|
||||
s16 sp1a = o->header.gfx.unk38.animFrame;
|
||||
UNUSED s16 collisionFlags = 0;
|
||||
@@ -296,7 +297,7 @@ void BobombBuddyIdleLoop(void) {
|
||||
collisionFlags = object_step();
|
||||
|
||||
if ((sp1a == 5) || (sp1a == 16))
|
||||
PlaySound2(SOUND_OBJ_BOBOMB_WALK);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
|
||||
|
||||
if (o->oDistanceToMario < 1000.0f)
|
||||
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oAngleToMario, 0x140);
|
||||
@@ -313,7 +314,7 @@ void BobombBuddyIdleLoop(void) {
|
||||
* dialogSecondText is called after Bob-omb Buddy has the cannon(s) ready and
|
||||
* then tells Mario that is "Ready for blastoff".
|
||||
*/
|
||||
void BobombBuddyCannonLoop(s16 dialogFirstText, s16 dialogSecondText) {
|
||||
void bobomb_buddy_cannon_dialog(s16 dialogFirstText, s16 dialogSecondText) {
|
||||
struct Object *cannonClosed;
|
||||
s16 buddyText, cutscene;
|
||||
|
||||
@@ -322,7 +323,7 @@ void BobombBuddyCannonLoop(s16 dialogFirstText, s16 dialogSecondText) {
|
||||
buddyText = cutscene_object_with_dialog(CUTSCENE_DIALOG, o, dialogFirstText);
|
||||
if (buddyText != 0) {
|
||||
save_file_set_cannon_unlocked();
|
||||
cannonClosed = obj_nearest_object_with_behavior(bhvCannonClosed);
|
||||
cannonClosed = cur_obj_nearest_object_with_behavior(bhvCannonClosed);
|
||||
if (cannonClosed != 0)
|
||||
o->oBobombBuddyCannonStatus = BOBOMB_BUDDY_CANNON_OPENING;
|
||||
else
|
||||
@@ -331,7 +332,7 @@ void BobombBuddyCannonLoop(s16 dialogFirstText, s16 dialogSecondText) {
|
||||
break;
|
||||
|
||||
case BOBOMB_BUDDY_CANNON_OPENING:
|
||||
cannonClosed = obj_nearest_object_with_behavior(bhvCannonClosed);
|
||||
cannonClosed = cur_obj_nearest_object_with_behavior(bhvCannonClosed);
|
||||
cutscene = cutscene_object(CUTSCENE_PREPARE_CANNON, cannonClosed);
|
||||
if (cutscene == -1)
|
||||
o->oBobombBuddyCannonStatus = BOBOMB_BUDDY_CANNON_OPENED;
|
||||
@@ -355,7 +356,7 @@ void BobombBuddyCannonLoop(s16 dialogFirstText, s16 dialogSecondText) {
|
||||
}
|
||||
}
|
||||
|
||||
void BobombBuddyTalkLoop(void) {
|
||||
void bobomb_buddy_act_talk(void) {
|
||||
if (set_mario_npc_dialog(1) == 2) {
|
||||
o->activeFlags |= 0x20; /* bit 5 */
|
||||
|
||||
@@ -374,38 +375,38 @@ void BobombBuddyTalkLoop(void) {
|
||||
|
||||
case BOBOMB_BUDDY_ROLE_CANNON:
|
||||
if (gCurrCourseNum == COURSE_BOB)
|
||||
BobombBuddyCannonLoop(DIALOG_004, DIALOG_105);
|
||||
bobomb_buddy_cannon_dialog(DIALOG_004, DIALOG_105);
|
||||
else
|
||||
BobombBuddyCannonLoop(DIALOG_047, DIALOG_106);
|
||||
bobomb_buddy_cannon_dialog(DIALOG_047, DIALOG_106);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BobombBuddyTurnToTalkLoop(void) {
|
||||
void bobomb_buddy_act_turn_to_talk(void) {
|
||||
s16 sp1e = o->header.gfx.unk38.animFrame;
|
||||
if ((sp1e == 5) || (sp1e == 16))
|
||||
PlaySound2(SOUND_OBJ_BOBOMB_WALK);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BOBOMB_WALK);
|
||||
|
||||
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oAngleToMario, 0x1000);
|
||||
if ((s16) o->oMoveAngleYaw == (s16) o->oAngleToMario)
|
||||
o->oAction = BOBOMB_BUDDY_ACT_TALK;
|
||||
|
||||
PlaySound2(SOUND_ACTION_READ_SIGN);
|
||||
cur_obj_play_sound_2(SOUND_ACTION_READ_SIGN);
|
||||
}
|
||||
|
||||
void BobombBuddyActionLoop(void) {
|
||||
void bobomb_buddy_actions(void) {
|
||||
switch (o->oAction) {
|
||||
case BOBOMB_BUDDY_ACT_IDLE:
|
||||
BobombBuddyIdleLoop();
|
||||
bobomb_buddy_act_idle();
|
||||
break;
|
||||
|
||||
case BOBOMB_BUDDY_ACT_TURN_TO_TALK:
|
||||
BobombBuddyTurnToTalkLoop();
|
||||
bobomb_buddy_act_turn_to_talk();
|
||||
break;
|
||||
|
||||
case BOBOMB_BUDDY_ACT_TALK:
|
||||
BobombBuddyTalkLoop();
|
||||
bobomb_buddy_act_talk();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -413,9 +414,9 @@ void BobombBuddyActionLoop(void) {
|
||||
}
|
||||
|
||||
void bhv_bobomb_buddy_loop(void) {
|
||||
BobombBuddyActionLoop();
|
||||
bobomb_buddy_actions();
|
||||
|
||||
ObjRandomBlink(&o->oBobombBuddyBlinkTimer);
|
||||
curr_obj_random_blink(&o->oBobombBuddyBlinkTimer);
|
||||
|
||||
o->oInteractStatus = 0;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ void bhv_small_bomp_loop(void) {
|
||||
if (o->oTimer == 15.0) {
|
||||
o->oAction = BOMP_ACT_EXTEND;
|
||||
o->oForwardVel = 40.0f;
|
||||
PlaySound2(SOUND_OBJ_UNKNOWN2);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -38,7 +38,7 @@ void bhv_small_bomp_loop(void) {
|
||||
o->oAction = BOMP_ACT_RETRACT;
|
||||
o->oForwardVel = 10.0f;
|
||||
o->oMoveAngleYaw -= 0x8000;
|
||||
PlaySound2(SOUND_OBJ_UNKNOWN2);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -80,7 +80,7 @@ void bhv_large_bomp_loop(void) {
|
||||
if (o->oTimer == 15.0) {
|
||||
o->oAction = BOMP_ACT_EXTEND;
|
||||
o->oForwardVel = 10.0f;
|
||||
PlaySound2(SOUND_OBJ_UNKNOWN2);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -94,7 +94,7 @@ void bhv_large_bomp_loop(void) {
|
||||
o->oAction = BOMP_ACT_RETRACT;
|
||||
o->oForwardVel = 10.0f;
|
||||
o->oMoveAngleYaw -= 0x8000;
|
||||
PlaySound2(SOUND_OBJ_UNKNOWN2);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN2);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
+106
-106
@@ -30,7 +30,7 @@ void bhv_boo_init(void) {
|
||||
}
|
||||
|
||||
static s32 boo_should_be_stopped(void) {
|
||||
if (obj_has_behavior(bhvMerryGoRoundBigBoo) || obj_has_behavior(bhvMerryGoRoundBoo)) {
|
||||
if (cur_obj_has_behavior(bhvMerryGoRoundBigBoo) || cur_obj_has_behavior(bhvMerryGoRoundBoo)) {
|
||||
if (gMarioOnMerryGoRound == FALSE) {
|
||||
return TRUE;
|
||||
} else {
|
||||
@@ -54,13 +54,13 @@ static s32 boo_should_be_stopped(void) {
|
||||
static s32 boo_should_be_active(void) {
|
||||
f32 activationRadius;
|
||||
|
||||
if (obj_has_behavior(bhvBalconyBigBoo)) {
|
||||
if (cur_obj_has_behavior(bhvBalconyBigBoo)) {
|
||||
activationRadius = 5000.0f;
|
||||
} else {
|
||||
activationRadius = 1500.0f;
|
||||
}
|
||||
|
||||
if (obj_has_behavior(bhvMerryGoRoundBigBoo) || obj_has_behavior(bhvMerryGoRoundBoo)) {
|
||||
if (cur_obj_has_behavior(bhvMerryGoRoundBigBoo) || cur_obj_has_behavior(bhvMerryGoRoundBoo)) {
|
||||
if (gMarioOnMerryGoRound == TRUE) {
|
||||
return TRUE;
|
||||
} else {
|
||||
@@ -87,7 +87,7 @@ void bhv_courtyard_boo_triplet_init(void) {
|
||||
struct Object *boo;
|
||||
|
||||
if (gHudDisplay.stars < 12) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
for (i = 0; i < 3; i++) {
|
||||
boo = spawn_object_relative(
|
||||
@@ -125,7 +125,7 @@ static void boo_approach_target_opacity_and_update_scale(void) {
|
||||
}
|
||||
|
||||
scale = (o->oOpacity/255.0f * 0.4 + 0.6) * o->oBooBaseScale;
|
||||
scale_object(o, scale); // why no obj_scale? was obj_scale written later?
|
||||
obj_scale(o, scale); // why no cur_obj_scale? was cur_obj_scale written later?
|
||||
}
|
||||
|
||||
static void boo_oscillate(s32 ignoreOpacity) {
|
||||
@@ -156,7 +156,7 @@ static s32 boo_vanish_or_appear(void) {
|
||||
) {
|
||||
if (o->oOpacity == 40) {
|
||||
o->oBooTargetOpacity = 255;
|
||||
PlaySound2(SOUND_OBJ_BOO_LAUGH_LONG);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BOO_LAUGH_LONG);
|
||||
}
|
||||
|
||||
if (o->oOpacity > 180) {
|
||||
@@ -170,7 +170,7 @@ static s32 boo_vanish_or_appear(void) {
|
||||
}
|
||||
|
||||
static void boo_set_move_yaw_for_during_hit(s32 hurt) {
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
|
||||
o->oFlags &= ~OBJ_FLAG_SET_FACE_YAW_TO_MOVE_YAW;
|
||||
o->oBooMoveYawBeforeHit = (f32) o->oMoveAngleYaw;
|
||||
@@ -225,7 +225,7 @@ static s32 boo_update_after_bounced_on(f32 a0) {
|
||||
if (o->oTimer < 32) {
|
||||
boo_move_during_hit(FALSE, D_8032F0CC[o->oTimer]/5000.0f * a0);
|
||||
} else {
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
boo_reset_after_hit();
|
||||
o->oAction = 1;
|
||||
return TRUE;
|
||||
@@ -247,7 +247,7 @@ static s32 big_boo_update_during_nonlethal_hit(f32 a0) {
|
||||
} else if (o->oTimer < 48) {
|
||||
big_boo_shake_after_hit();
|
||||
} else {
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
boo_reset_after_hit();
|
||||
|
||||
o->oAction = 1;
|
||||
@@ -274,14 +274,14 @@ static s32 boo_update_during_death(void) {
|
||||
}
|
||||
|
||||
if (o->oTimer > 30 || o->oMoveFlags & 0x200) {
|
||||
func_802A3004();
|
||||
spawn_mist_particles();
|
||||
o->oBooDeathStatus = BOO_DEATH_STATUS_DEAD;
|
||||
|
||||
if (o->oBooParentBigBoo != NULL) {
|
||||
parentBigBoo = o->oBooParentBigBoo;
|
||||
|
||||
#ifndef VERSION_JP
|
||||
if (!obj_has_behavior(bhvBoo)) {
|
||||
if (!cur_obj_has_behavior(bhvBoo)) {
|
||||
parentBigBoo->oBigBooNumMinionBoosKilled++;
|
||||
}
|
||||
#else
|
||||
@@ -313,15 +313,15 @@ static s32 boo_get_attack_status(void) {
|
||||
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
|
||||
if ((o->oInteractStatus & INT_STATUS_WAS_ATTACKED) && obj_has_attack_type(ATTACK_FROM_ABOVE) == FALSE) {
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
|
||||
o->oInteractStatus = 0;
|
||||
|
||||
PlaySound2(SOUND_OBJ_BOO_LAUGH_SHORT);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BOO_LAUGH_SHORT);
|
||||
|
||||
attackStatus = BOO_ATTACKED;
|
||||
} else {
|
||||
PlaySound2(SOUND_OBJ_BOO_BOUNCE_TOP);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BOO_BOUNCE_TOP);
|
||||
|
||||
o->oInteractStatus = 0;
|
||||
|
||||
@@ -340,23 +340,23 @@ static void boo_chase_mario(f32 a0, s16 a1, f32 a2) {
|
||||
if (boo_vanish_or_appear()) {
|
||||
o->oInteractType = 0x8000;
|
||||
|
||||
if (obj_lateral_dist_from_mario_to_home() > 1500.0f) {
|
||||
sp1A = obj_angle_to_home();
|
||||
if (cur_obj_lateral_dist_from_mario_to_home() > 1500.0f) {
|
||||
sp1A = cur_obj_angle_to_home();
|
||||
} else {
|
||||
sp1A = o->oAngleToMario;
|
||||
}
|
||||
|
||||
obj_rotate_yaw_toward(sp1A, a1);
|
||||
cur_obj_rotate_yaw_toward(sp1A, a1);
|
||||
o->oVelY = 0.0f;
|
||||
|
||||
if (mario_is_in_air_action() == 0) {
|
||||
sp1C = o->oPosY - gMarioObject->oPosY;
|
||||
if (a0 < sp1C && sp1C < 500.0f) {
|
||||
o->oVelY = func_802A0BF4(o->oPosY, gMarioObject->oPosY + 50.0f, 10.f, 2.0f);
|
||||
o->oVelY = increment_velocity_toward_range(o->oPosY, gMarioObject->oPosY + 50.0f, 10.f, 2.0f);
|
||||
}
|
||||
}
|
||||
|
||||
func_8029F684(10.0f - o->oBooNegatedAggressiveness, a2);
|
||||
cur_obj_set_vel_from_mario_vel(10.0f - o->oBooNegatedAggressiveness, a2);
|
||||
|
||||
if (o->oForwardVel != 0.0f) {
|
||||
boo_oscillate(FALSE);
|
||||
@@ -370,18 +370,18 @@ static void boo_chase_mario(f32 a0, s16 a1, f32 a2) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBoo0(void) {
|
||||
static void boo_act_0(void) {
|
||||
o->activeFlags |= ACTIVE_FLAG_MOVE_THROUGH_GRATE;
|
||||
|
||||
if (o->oBehParams2ndByte == 2) {
|
||||
o->oRoom = 10;
|
||||
}
|
||||
|
||||
obj_set_pos_to_home();
|
||||
cur_obj_set_pos_to_home();
|
||||
o->oMoveAngleYaw = o->oBooInitialMoveYaw;
|
||||
boo_stop();
|
||||
|
||||
o->oBooParentBigBoo = obj_nearest_object_with_behavior(bhvGhostHuntBigBoo);
|
||||
o->oBooParentBigBoo = cur_obj_nearest_object_with_behavior(bhvGhostHuntBigBoo);
|
||||
o->oBooBaseScale = 1.0f;
|
||||
o->oBooTargetOpacity = 0xFF;
|
||||
|
||||
@@ -396,7 +396,7 @@ static void ActionBoo0(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBoo5(void) {
|
||||
static void boo_act_5(void) {
|
||||
if (o->oTimer < 30) {
|
||||
o->oVelY = 0.0f;
|
||||
o->oForwardVel = 13.0f;
|
||||
@@ -408,7 +408,7 @@ static void ActionBoo5(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBoo1(void) {
|
||||
static void boo_act_1(void) {
|
||||
s32 attackStatus;
|
||||
|
||||
if (o->oTimer == 0) {
|
||||
@@ -436,37 +436,37 @@ static void ActionBoo1(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBoo2(void) {
|
||||
static void boo_act_2(void) {
|
||||
if (boo_update_after_bounced_on(20.0f)) {
|
||||
o->oAction = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBoo3(void) {
|
||||
static void boo_act_3(void) {
|
||||
if (boo_update_during_death()) {
|
||||
if (o->oBehParams2ndByte != 0) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
o->oAction = 4;
|
||||
obj_disable();
|
||||
cur_obj_disable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called when a Go on a Ghost Hunt boo dies
|
||||
static void ActionBoo4(void) {
|
||||
static void boo_act_4(void) {
|
||||
s32 dialogID;
|
||||
|
||||
// If there are no remaining "minion" boos, show the dialog of the Big Boo
|
||||
if (obj_nearest_object_with_behavior(bhvGhostHuntBoo) == NULL) {
|
||||
if (cur_obj_nearest_object_with_behavior(bhvGhostHuntBoo) == NULL) {
|
||||
dialogID = DIALOG_108;
|
||||
} else {
|
||||
dialogID = DIALOG_107;
|
||||
}
|
||||
|
||||
if (obj_update_dialog(2, 2, dialogID, 0)) {
|
||||
if (cur_obj_update_dialog(2, 2, dialogID, 0)) {
|
||||
create_sound_spawner(SOUND_OBJ_DYING_ENEMY1);
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
|
||||
if (dialogID == DIALOG_108) { // If the Big Boo should spawn, play the jingle
|
||||
play_puzzle_jingle();
|
||||
@@ -475,23 +475,23 @@ static void ActionBoo4(void) {
|
||||
}
|
||||
|
||||
static void (*sBooActions[])(void) = {
|
||||
ActionBoo0,
|
||||
ActionBoo1,
|
||||
ActionBoo2,
|
||||
ActionBoo3,
|
||||
ActionBoo4,
|
||||
ActionBoo5
|
||||
boo_act_0,
|
||||
boo_act_1,
|
||||
boo_act_2,
|
||||
boo_act_3,
|
||||
boo_act_4,
|
||||
boo_act_5
|
||||
};
|
||||
|
||||
void bhv_boo_loop(void) {
|
||||
//PARTIAL_UPDATE
|
||||
|
||||
obj_update_floor_and_walls();
|
||||
obj_call_action_function(sBooActions);
|
||||
obj_move_standard(78);
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_call_action_function(sBooActions);
|
||||
cur_obj_move_standard(78);
|
||||
boo_approach_target_opacity_and_update_scale();
|
||||
|
||||
if (object_has_behavior(o->parentObj, bhvMerryGoRoundBooManager)) {
|
||||
if (obj_has_behavior(o->parentObj, bhvMerryGoRoundBooManager)) {
|
||||
if (o->activeFlags == 0) {
|
||||
o->parentObj->oMerryGoRoundBooManagerNumBoosKilled++;
|
||||
}
|
||||
@@ -500,8 +500,8 @@ void bhv_boo_loop(void) {
|
||||
o->oInteractStatus = 0;
|
||||
}
|
||||
|
||||
static void ActionBooGivingStar0(void) {
|
||||
if (obj_has_behavior(bhvBalconyBigBoo)) {
|
||||
static void big_boo_act_0(void) {
|
||||
if (cur_obj_has_behavior(bhvBalconyBigBoo)) {
|
||||
obj_set_secondary_camera_focus();
|
||||
// number of killed boos set > 5 so that boo always loads
|
||||
// redundant? this is also done in behavior_data.s
|
||||
@@ -517,25 +517,25 @@ static void ActionBooGivingStar0(void) {
|
||||
#endif
|
||||
o->oAction = 1;
|
||||
|
||||
obj_set_pos_to_home();
|
||||
cur_obj_set_pos_to_home();
|
||||
o->oMoveAngleYaw = o->oBooInitialMoveYaw;
|
||||
|
||||
obj_unhide();
|
||||
cur_obj_unhide();
|
||||
|
||||
o->oBooTargetOpacity = 0xFF;
|
||||
o->oBooBaseScale = 3.0f;
|
||||
o->oHealth = 3;
|
||||
|
||||
obj_scale(3.0f);
|
||||
obj_become_tangible();
|
||||
cur_obj_scale(3.0f);
|
||||
cur_obj_become_tangible();
|
||||
} else {
|
||||
obj_hide();
|
||||
obj_become_intangible();
|
||||
cur_obj_hide();
|
||||
cur_obj_become_intangible();
|
||||
boo_stop();
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBooGivingStar1(void) {
|
||||
static void big_boo_act_1(void) {
|
||||
s32 attackStatus;
|
||||
s16 sp22;
|
||||
f32 sp1C;
|
||||
@@ -553,7 +553,7 @@ static void ActionBooGivingStar1(void) {
|
||||
attackStatus = boo_get_attack_status();
|
||||
|
||||
// redundant; this check is in boo_should_be_stopped
|
||||
if (obj_has_behavior(bhvMerryGoRoundBigBoo)) {
|
||||
if (cur_obj_has_behavior(bhvMerryGoRoundBigBoo)) {
|
||||
if (gMarioOnMerryGoRound == FALSE) {
|
||||
o->oAction = 0;
|
||||
}
|
||||
@@ -574,44 +574,44 @@ static void ActionBooGivingStar1(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBooGivingStar2(void) {
|
||||
static void big_boo_act_2(void) {
|
||||
if (boo_update_after_bounced_on(20.0f)) {
|
||||
o->oAction = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void big_boo_spawn_ghost_hunt_star(void) {
|
||||
create_star(980.0f, 1100.0f, 250.0f);
|
||||
spawn_default_star(980.0f, 1100.0f, 250.0f);
|
||||
}
|
||||
|
||||
static void big_boo_spawn_balcony_star(void) {
|
||||
create_star(700.0f, 3200.0f, 1900.0f);
|
||||
spawn_default_star(700.0f, 3200.0f, 1900.0f);
|
||||
}
|
||||
|
||||
static void big_boo_spawn_merry_go_round_star(void) {
|
||||
struct Object *merryGoRound;
|
||||
|
||||
create_star(-1600.0f, -2100.0f, 205.0f);
|
||||
spawn_default_star(-1600.0f, -2100.0f, 205.0f);
|
||||
|
||||
merryGoRound = obj_nearest_object_with_behavior(bhvMerryGoRound);
|
||||
merryGoRound = cur_obj_nearest_object_with_behavior(bhvMerryGoRound);
|
||||
|
||||
if (merryGoRound != NULL) {
|
||||
merryGoRound->oMerryGoRoundStopped = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBooGivingStar3(void) {
|
||||
static void big_boo_act_3(void) {
|
||||
if (o->oTimer == 0) {
|
||||
o->oHealth--;
|
||||
}
|
||||
|
||||
if (o->oHealth == 0) {
|
||||
if (boo_update_during_death()) {
|
||||
obj_disable();
|
||||
cur_obj_disable();
|
||||
|
||||
o->oAction = 4;
|
||||
|
||||
set_object_angle(o, 0, 0, 0);
|
||||
obj_set_angle(o, 0, 0, 0);
|
||||
|
||||
if (o->oBehParams2ndByte == 0) {
|
||||
big_boo_spawn_ghost_hunt_star();
|
||||
@@ -623,7 +623,7 @@ static void ActionBooGivingStar3(void) {
|
||||
}
|
||||
} else {
|
||||
if (o->oTimer == 0) {
|
||||
func_802A3004();
|
||||
spawn_mist_particles();
|
||||
o->oBooBaseScale -= 0.5;
|
||||
}
|
||||
|
||||
@@ -633,65 +633,65 @@ static void ActionBooGivingStar3(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBooGivingStar4(void) {
|
||||
static void big_boo_act_4(void) {
|
||||
#ifndef VERSION_JP
|
||||
boo_stop();
|
||||
#endif
|
||||
|
||||
if (o->oBehParams2ndByte == 0) {
|
||||
set_object_pos(o, 973, 0, 626);
|
||||
obj_set_pos(o, 973, 0, 626);
|
||||
|
||||
if (o->oTimer > 60 && o->oDistanceToMario < 600.0f) {
|
||||
set_object_pos(o, 973, 0, 717);
|
||||
obj_set_pos(o, 973, 0, 717);
|
||||
|
||||
spawn_object_relative(0, 0, 0, 0, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
||||
spawn_object_relative(1, 0, 0, -200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
||||
spawn_object_relative(2, 0, 0, 200, o, MODEL_BBH_STAIRCASE_STEP, bhvBooBossSpawnedBridge);
|
||||
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
} else {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
}
|
||||
|
||||
static void (*sBooGivingStarActions[])(void) = {
|
||||
ActionBooGivingStar0,
|
||||
ActionBooGivingStar1,
|
||||
ActionBooGivingStar2,
|
||||
ActionBooGivingStar3,
|
||||
ActionBooGivingStar4
|
||||
big_boo_act_0,
|
||||
big_boo_act_1,
|
||||
big_boo_act_2,
|
||||
big_boo_act_3,
|
||||
big_boo_act_4
|
||||
};
|
||||
|
||||
void bhv_big_boo_loop(void) {
|
||||
//PARTIAL_UPDATE
|
||||
|
||||
set_object_hitbox(o, &sBooGivingStarHitbox);
|
||||
obj_set_hitbox(o, &sBooGivingStarHitbox);
|
||||
|
||||
o->oGraphYOffset = o->oBooBaseScale * 60.0f;
|
||||
|
||||
obj_update_floor_and_walls();
|
||||
obj_call_action_function(sBooGivingStarActions);
|
||||
obj_move_standard(78);
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_call_action_function(sBooGivingStarActions);
|
||||
cur_obj_move_standard(78);
|
||||
|
||||
boo_approach_target_opacity_and_update_scale();
|
||||
o->oInteractStatus = 0;
|
||||
}
|
||||
|
||||
static void ActionBooWithCage0(void) {
|
||||
static void boo_with_cage_act_0(void) {
|
||||
o->oBooParentBigBoo = NULL;
|
||||
o->oBooTargetOpacity = 0xFF;
|
||||
o->oBooBaseScale = 2.0f;
|
||||
|
||||
obj_scale(2.0f);
|
||||
obj_become_tangible();
|
||||
cur_obj_scale(2.0f);
|
||||
cur_obj_become_tangible();
|
||||
|
||||
if (boo_should_be_active()) {
|
||||
o->oAction = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBooWithCage1(void) {
|
||||
static void boo_with_cage_act_1(void) {
|
||||
s32 attackStatus;
|
||||
|
||||
boo_chase_mario(100.0f, 512, 0.5f);
|
||||
@@ -711,15 +711,15 @@ static void ActionBooWithCage1(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBooWithCage2(void) {
|
||||
static void boo_with_cage_act_2(void) {
|
||||
if (boo_update_after_bounced_on(20.0f)) {
|
||||
o->oAction = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void ActionBooWithCage3(void) {
|
||||
static void boo_with_cage_act_3(void) {
|
||||
if (boo_update_during_death()) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,7 +727,7 @@ void bhv_boo_with_cage_init(void) {
|
||||
struct Object* cage;
|
||||
|
||||
if (gHudDisplay.stars < 12) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
cage = spawn_object(o, MODEL_HAUNTED_CAGE, bhvBooCage);
|
||||
cage->oBehParams = o->oBehParams;
|
||||
@@ -735,20 +735,20 @@ void bhv_boo_with_cage_init(void) {
|
||||
}
|
||||
|
||||
static void (*sBooWithCageActions[])(void) = {
|
||||
ActionBooWithCage0,
|
||||
ActionBooWithCage1,
|
||||
ActionBooWithCage2,
|
||||
ActionBooWithCage3
|
||||
boo_with_cage_act_0,
|
||||
boo_with_cage_act_1,
|
||||
boo_with_cage_act_2,
|
||||
boo_with_cage_act_3
|
||||
};
|
||||
|
||||
void bhv_boo_with_cage_loop(void)
|
||||
{
|
||||
//PARTIAL_UPDATE
|
||||
|
||||
obj_update_floor_and_walls();
|
||||
obj_call_action_function(sBooWithCageActions);
|
||||
obj_move_standard(78);
|
||||
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_call_action_function(sBooWithCageActions);
|
||||
cur_obj_move_standard(78);
|
||||
|
||||
boo_approach_target_opacity_and_update_scale();
|
||||
o->oInteractStatus = 0;
|
||||
}
|
||||
@@ -770,7 +770,7 @@ void bhv_merry_go_round_boo_manager_loop(void) {
|
||||
|
||||
if (o->oMerryGoRoundBooManagerNumBoosKilled > 4) {
|
||||
struct Object *boo = spawn_object(o, MODEL_BOO, bhvMerryGoRoundBigBoo);
|
||||
copy_object_behavior_params(boo, o);
|
||||
obj_copy_behavior_params(boo, o);
|
||||
|
||||
o->oAction = 2;
|
||||
|
||||
@@ -799,7 +799,7 @@ void obj_set_secondary_camera_focus(void) {
|
||||
}
|
||||
|
||||
void bhv_animated_texture_loop(void) {
|
||||
func_802A3470();
|
||||
cur_obj_set_pos_to_home_with_debug();
|
||||
}
|
||||
|
||||
void bhv_boo_in_castle_loop(void) {
|
||||
@@ -808,38 +808,38 @@ void bhv_boo_in_castle_loop(void) {
|
||||
o->oBooBaseScale = 2.0f;
|
||||
|
||||
if (o->oAction == 0) {
|
||||
obj_hide();
|
||||
cur_obj_hide();
|
||||
|
||||
if (gHudDisplay.stars < 12) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
if (gMarioCurrentRoom == 1) {
|
||||
o->oAction++;
|
||||
}
|
||||
} else if (o->oAction == 1) {
|
||||
obj_unhide();
|
||||
cur_obj_unhide();
|
||||
|
||||
o->oOpacity = 180;
|
||||
|
||||
if (o->oTimer == 0) {
|
||||
obj_scale(o->oBooBaseScale);
|
||||
cur_obj_scale(o->oBooBaseScale);
|
||||
}
|
||||
|
||||
if (o->oDistanceToMario < 1000.0f) {
|
||||
o->oAction++;
|
||||
PlaySound2(SOUND_OBJ_BOO_LAUGH_LONG);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BOO_LAUGH_LONG);
|
||||
}
|
||||
|
||||
o->oForwardVel = 0.0f;
|
||||
targetAngle = o->oAngleToMario;
|
||||
} else {
|
||||
obj_forward_vel_approach_upward(32.0f, 1.0f);
|
||||
cur_obj_forward_vel_approach_upward(32.0f, 1.0f);
|
||||
|
||||
o->oHomeX = -1000.0f;
|
||||
o->oHomeZ = -9000.0f;
|
||||
|
||||
targetAngle = obj_angle_to_home();
|
||||
targetAngle = cur_obj_angle_to_home();
|
||||
|
||||
if (o->oPosZ < -5000.0f) {
|
||||
if (o->oOpacity > 0) {
|
||||
@@ -856,11 +856,11 @@ void bhv_boo_in_castle_loop(void) {
|
||||
|
||||
o->oVelY = 0.0f;
|
||||
|
||||
targetAngle = obj_angle_to_home();
|
||||
targetAngle = cur_obj_angle_to_home();
|
||||
|
||||
obj_rotate_yaw_toward(targetAngle, 0x5A8);
|
||||
cur_obj_rotate_yaw_toward(targetAngle, 0x5A8);
|
||||
boo_oscillate(TRUE);
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
}
|
||||
|
||||
void bhv_boo_boss_spawned_bridge_loop(void) {
|
||||
@@ -885,7 +885,7 @@ void bhv_boo_boss_spawned_bridge_loop(void) {
|
||||
// fallthrough
|
||||
case 1:
|
||||
o->oPosY += 8.0f;
|
||||
PlaySound(SOUND_ENV_ELEVATOR2);
|
||||
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR2);
|
||||
|
||||
if (o->oPosY > targetY) {
|
||||
o->oPosY = targetY;
|
||||
@@ -895,10 +895,10 @@ void bhv_boo_boss_spawned_bridge_loop(void) {
|
||||
break;
|
||||
case 2:
|
||||
if (o->oTimer == 0) {
|
||||
PlaySound2(SOUND_GENERAL_UNKNOWN4_LOWPRIO);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_UNKNOWN4_LOWPRIO);
|
||||
}
|
||||
|
||||
if (func_802A362C(o->oTimer)) {
|
||||
if (cur_obj_move_up_and_down(o->oTimer)) {
|
||||
o->oAction++;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,16 +27,16 @@ static struct ObjectHitbox sBooCageHitbox = {
|
||||
void bhv_boo_cage_loop(void) {
|
||||
UNUSED s32 unused;
|
||||
|
||||
set_object_hitbox(o, &sBooCageHitbox);
|
||||
obj_set_hitbox(o, &sBooCageHitbox);
|
||||
|
||||
switch (o->oAction) {
|
||||
case BOO_CAGE_ACT_IN_BOO:
|
||||
// Don't let Mario enter BBH until the boo is killed
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
|
||||
// Useless scale. This is also found in the code for BOO_CAGE_ACT_ON_GROUND.
|
||||
// Was the boo cage originally meant to have been shrunk and grow while falling?
|
||||
obj_scale(1.0f);
|
||||
cur_obj_scale(1.0f);
|
||||
|
||||
// If the cage's parent boo is killed, set the action to BOO_CAGE_ACT_FALLING,
|
||||
// give the cage an initial Y velocity of 60 units/frame, and play the puzzle jingle.
|
||||
@@ -46,7 +46,7 @@ void bhv_boo_cage_loop(void) {
|
||||
o->oVelY = 60.0f;
|
||||
play_puzzle_jingle();
|
||||
} else {
|
||||
copy_object_pos_and_angle(o, o->parentObj);
|
||||
obj_copy_pos_and_angle(o, o->parentObj);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -57,15 +57,15 @@ void bhv_boo_cage_loop(void) {
|
||||
o->oFaceAngleRoll = 0;
|
||||
|
||||
// Apply standard physics to the cage.
|
||||
obj_update_floor_and_walls();
|
||||
obj_move_standard(-78);
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_move_standard(-78);
|
||||
|
||||
// Spawn sparkles while the cage falls.
|
||||
spawn_object(o, MODEL_NONE, bhvSparkleSpawn);
|
||||
|
||||
// When the cage lands/bounces, play a landing/bouncing sound.
|
||||
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
|
||||
PlaySound2(SOUND_GENERAL_SOFT_LANDING);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_SOFT_LANDING);
|
||||
}
|
||||
|
||||
// Once the cage stops bouncing and settles on the ground,
|
||||
@@ -80,13 +80,13 @@ void bhv_boo_cage_loop(void) {
|
||||
break;
|
||||
case BOO_CAGE_ACT_ON_GROUND:
|
||||
// Allow Mario to enter the cage once it's still on the ground.
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
|
||||
// The other useless scale
|
||||
obj_scale(1.0f);
|
||||
cur_obj_scale(1.0f);
|
||||
|
||||
// Set the action to BOO_CAGE_ACT_MARIO_JUMPING_IN when Mario jumps in.
|
||||
if (are_objects_collided(o, gMarioObject)) {
|
||||
if (obj_check_if_collided_with_object(o, gMarioObject)) {
|
||||
o->oAction++;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@ void bhv_big_boulder_init(void) {
|
||||
o->oBuoyancy = 2.0f;
|
||||
}
|
||||
|
||||
void func_802F05DC(void) {
|
||||
void boulder_act_1(void) {
|
||||
s16 sp1E;
|
||||
|
||||
sp1E = object_step_without_floor_orient();
|
||||
if ((sp1E & 0x09) == 0x01 && o->oVelY > 10.0f) {
|
||||
PlaySound2(SOUND_GENERAL_GRINDEL_ROLL);
|
||||
func_802A3004();
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_GRINDEL_ROLL);
|
||||
spawn_mist_particles();
|
||||
}
|
||||
|
||||
if (o->oForwardVel > 70.0)
|
||||
@@ -27,7 +27,7 @@ void func_802F05DC(void) {
|
||||
}
|
||||
|
||||
void bhv_big_boulder_loop(void) {
|
||||
obj_scale(1.5f);
|
||||
cur_obj_scale(1.5f);
|
||||
o->oGraphYOffset = 270.0f;
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
@@ -36,13 +36,13 @@ void bhv_big_boulder_loop(void) {
|
||||
break;
|
||||
|
||||
case 1:
|
||||
func_802F05DC();
|
||||
func_802EFB84(1.5f);
|
||||
PlaySound(SOUND_ENV_UNKNOWN2);
|
||||
boulder_act_1();
|
||||
adjust_rolling_face_pitch(1.5f);
|
||||
cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2);
|
||||
break;
|
||||
}
|
||||
|
||||
func_802EFB2C();
|
||||
set_rolling_sphere_hitbox();
|
||||
}
|
||||
|
||||
void bhv_big_boulder_generator_loop(void) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
void bhv_bouncing_fireball_flame_loop(void) {
|
||||
o->activeFlags |= 0x400;
|
||||
obj_update_floor_and_walls();
|
||||
cur_obj_update_floor_and_walls();
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
if (o->oTimer == 0) {
|
||||
@@ -18,12 +18,12 @@ void bhv_bouncing_fireball_flame_loop(void) {
|
||||
o->oForwardVel = 30.0f;
|
||||
}
|
||||
if (o->oMoveFlags & (0x40 | 0x10 | 0x2) && o->oTimer > 100)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
break;
|
||||
}
|
||||
if (o->oTimer > 300)
|
||||
mark_object_for_deletion(o);
|
||||
obj_move_standard(78);
|
||||
obj_mark_for_deletion(o);
|
||||
cur_obj_move_standard(78);
|
||||
o->oInteractStatus = 0;
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ void bhv_bouncing_fireball_loop(void) {
|
||||
case 1:
|
||||
sp2C = spawn_object(o, MODEL_RED_FLAME, bhvBouncingFireballFlame);
|
||||
sp28 = (10 - o->oTimer) * 0.5;
|
||||
scale_object_xyz(sp2C, sp28, sp28, sp28);
|
||||
obj_scale_xyz(sp2C, sp28, sp28, sp28);
|
||||
if (o->oTimer == 0)
|
||||
make_object_tangible(sp2C);
|
||||
obj_become_tangible(sp2C);
|
||||
if (o->oTimer > 10)
|
||||
o->oAction++;
|
||||
break;
|
||||
|
||||
@@ -32,14 +32,14 @@ void bhv_bowling_ball_init(void) {
|
||||
o->oBuoyancy = 2.0f;
|
||||
}
|
||||
|
||||
void func_802EDA14(void) {
|
||||
set_object_hitbox(o, &sBowlingBallHitbox);
|
||||
void bowling_ball_set_hitbox(void) {
|
||||
obj_set_hitbox(o, &sBowlingBallHitbox);
|
||||
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED)
|
||||
o->oInteractStatus = 0;
|
||||
}
|
||||
|
||||
void func_802EDA6C(void) {
|
||||
void bowling_ball_set_waypoints(void) {
|
||||
switch (o->oBehParams2ndByte) {
|
||||
case BBALL_BP_STYPE_BOB_UPPER:
|
||||
o->oPathedWaypointsS16 = segmented_to_virtual(bob_seg7_metal_ball_path0);
|
||||
@@ -67,11 +67,11 @@ void bhv_bowling_ball_roll_loop(void) {
|
||||
s16 collisionFlags;
|
||||
s32 sp18;
|
||||
|
||||
func_802EDA6C();
|
||||
bowling_ball_set_waypoints();
|
||||
collisionFlags = object_step();
|
||||
|
||||
//! Uninitialzed parameter, but the parameter is unused in the called function
|
||||
sp18 = obj_follow_path(sp18);
|
||||
sp18 = cur_obj_follow_path(sp18);
|
||||
|
||||
o->oBowlingBallTargetYaw = o->oPathedTargetYaw;
|
||||
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, o->oBowlingBallTargetYaw, 0x400);
|
||||
@@ -79,28 +79,28 @@ void bhv_bowling_ball_roll_loop(void) {
|
||||
o->oForwardVel = 70.0;
|
||||
}
|
||||
|
||||
func_802EDA14();
|
||||
bowling_ball_set_hitbox();
|
||||
|
||||
if (sp18 == -1) {
|
||||
if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 7000)) {
|
||||
func_802A3004();
|
||||
func_802AA618(0, 0, 92.0f);
|
||||
spawn_mist_particles();
|
||||
spawn_mist_particles_variable(0, 0, 92.0f);
|
||||
}
|
||||
|
||||
o->activeFlags = 0;
|
||||
}
|
||||
|
||||
if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && (o->oVelY > 5.0f))
|
||||
PlaySound2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);
|
||||
}
|
||||
|
||||
void bhv_bowling_ball_initializeLoop(void) {
|
||||
s32 sp1c;
|
||||
|
||||
func_802EDA6C();
|
||||
bowling_ball_set_waypoints();
|
||||
|
||||
//! Uninitialzed parameter, but the parameter is unused in the called function
|
||||
sp1c = obj_follow_path(sp1c);
|
||||
sp1c = cur_obj_follow_path(sp1c);
|
||||
|
||||
o->oMoveAngleYaw = o->oPathedTargetYaw;
|
||||
|
||||
@@ -123,7 +123,7 @@ void bhv_bowling_ball_initializeLoop(void) {
|
||||
|
||||
case BBALL_BP_STYPE_THI_SMALL:
|
||||
o->oForwardVel = 10.0f;
|
||||
obj_scale(0.3f);
|
||||
cur_obj_scale(0.3f);
|
||||
o->oGraphYOffset = 39.0f;
|
||||
break;
|
||||
}
|
||||
@@ -221,9 +221,9 @@ void bhv_bob_pit_bowling_ball_loop(void) {
|
||||
if ((sp1c->normalX == 0) && (sp1c->normalZ == 0))
|
||||
o->oForwardVel = 28.0f;
|
||||
|
||||
func_802EDA14();
|
||||
bowling_ball_set_hitbox();
|
||||
set_camera_shake_from_point(SHAKE_POS_BOWLING_BALL, o->oPosX, o->oPosY, o->oPosZ);
|
||||
PlaySound(SOUND_ENV_UNKNOWN2);
|
||||
cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2);
|
||||
set_object_visibility(o, 3000);
|
||||
}
|
||||
|
||||
@@ -240,19 +240,19 @@ void bhv_free_bowling_ball_init(void) {
|
||||
|
||||
void bhv_free_bowling_ball_roll_loop(void) {
|
||||
s16 collisionFlags = object_step();
|
||||
func_802EDA14();
|
||||
bowling_ball_set_hitbox();
|
||||
|
||||
if (o->oForwardVel > 10.0f) {
|
||||
set_camera_shake_from_point(SHAKE_POS_BOWLING_BALL, o->oPosX, o->oPosY, o->oPosZ);
|
||||
PlaySound(SOUND_ENV_UNKNOWN2);
|
||||
cur_obj_play_sound_1(SOUND_ENV_UNKNOWN2);
|
||||
}
|
||||
|
||||
if ((collisionFlags & OBJ_COL_FLAG_GROUNDED) && !(collisionFlags & OBJ_COL_FLAGS_LANDED))
|
||||
PlaySound2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1_LOWPRIO);
|
||||
|
||||
if (!is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 6000)) {
|
||||
o->header.gfx.node.flags |= 0x10; /* bit 4 */
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
|
||||
o->oPosX = o->oHomeX;
|
||||
o->oPosY = o->oHomeY;
|
||||
@@ -270,7 +270,7 @@ void bhv_free_bowling_ball_loop(void) {
|
||||
if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 3000)) {
|
||||
o->oAction = FREE_BBALL_ACT_ROLL;
|
||||
o->header.gfx.node.flags &= ~0x10; /* bit 4 */
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
+285
-295
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
// bowser_bomb.c.inc
|
||||
|
||||
void bhv_bowser_bomb_loop(void) {
|
||||
if (are_objects_collided(o, gMarioObject) == 1) {
|
||||
if (obj_check_if_collided_with_object(o, gMarioObject) == 1) {
|
||||
o->oInteractStatus &= ~INT_STATUS_INTERACTED; /* bit 15 */
|
||||
spawn_object(o, MODEL_EXPLOSION, bhvExplosion);
|
||||
o->activeFlags = 0;
|
||||
@@ -21,7 +21,7 @@ void bhv_bowser_bomb_loop(void) {
|
||||
void bhv_bowser_bomb_explosion_loop(void) {
|
||||
struct Object *mineSmoke;
|
||||
|
||||
obj_scale((f32) o->oTimer / 14.0f * 9.0 + 1.0);
|
||||
cur_obj_scale((f32) o->oTimer / 14.0f * 9.0 + 1.0);
|
||||
if ((o->oTimer % 4 == 0) && (o->oTimer < 20)) {
|
||||
mineSmoke = spawn_object(o, MODEL_BOWSER_SMOKE, bhvBowserBombSmoke);
|
||||
mineSmoke->oPosX += RandomFloat() * 600.0f - 400.0f;
|
||||
@@ -36,7 +36,7 @@ void bhv_bowser_bomb_explosion_loop(void) {
|
||||
}
|
||||
|
||||
void bhv_bowser_bomb_smoke_loop(void) {
|
||||
obj_scale((f32) o->oTimer / 14.0f * 9.0 + 1.0);
|
||||
cur_obj_scale((f32) o->oTimer / 14.0f * 9.0 + 1.0);
|
||||
if (o->oTimer % 2 == 0)
|
||||
o->oAnimState++;
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ struct ObjectHitbox sBowserKeyHitbox = {
|
||||
};
|
||||
|
||||
void bhv_bowser_key_loop(void) {
|
||||
obj_scale(0.5f);
|
||||
cur_obj_scale(0.5f);
|
||||
if (o->oAngleVelYaw > 0x400)
|
||||
o->oAngleVelYaw -= 0x100;
|
||||
o->oFaceAngleYaw += o->oAngleVelYaw;
|
||||
@@ -22,20 +22,20 @@ void bhv_bowser_key_loop(void) {
|
||||
if (o->oAction == 0) {
|
||||
if (o->oTimer == 0)
|
||||
o->oVelY = 70.0f;
|
||||
func_802B2328(3, 200, 80, -60);
|
||||
spawn_sparkle_particles(3, 200, 80, -60);
|
||||
spawn_object(o, MODEL_NONE, bhvSparkleSpawn);
|
||||
obj_update_floor_and_walls();
|
||||
obj_move_standard(78);
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_move_standard(78);
|
||||
if (o->oMoveFlags & OBJ_MOVE_ON_GROUND)
|
||||
o->oAction++;
|
||||
else if (o->oMoveFlags & OBJ_MOVE_LANDED)
|
||||
#ifndef VERSION_JP
|
||||
PlaySound2(SOUND_GENERAL_UNKNOWN3_2);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_UNKNOWN3_2);
|
||||
#else
|
||||
PlaySound2(SOUND_GENERAL_UNKNOWN3_LOWPRIO);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_UNKNOWN3_LOWPRIO);
|
||||
#endif
|
||||
} else {
|
||||
set_object_hitbox(o, &sBowserKeyHitbox);
|
||||
obj_set_hitbox(o, &sBowserKeyHitbox);
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
|
||||
mark_obj_for_deletion(o);
|
||||
o->oInteractStatus = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// bowser_key_cutscene.inc.c
|
||||
|
||||
Gfx *Geo18_802BA2B0(s32 run, struct GraphNode *node, UNUSED f32 mtx[4][4]) {
|
||||
Gfx *geo_scale_bowser_key(s32 run, struct GraphNode *node, UNUSED f32 mtx[4][4]) {
|
||||
struct Object *sp4;
|
||||
if (run == TRUE) {
|
||||
sp4 = (struct Object *) gCurGraphNodeObject;
|
||||
@@ -12,7 +12,7 @@ Gfx *Geo18_802BA2B0(s32 run, struct GraphNode *node, UNUSED f32 mtx[4][4]) {
|
||||
void bhv_bowser_key_unlock_door_loop(void) {
|
||||
s32 animTimer;
|
||||
animTimer = o->header.gfx.unk38.animFrame;
|
||||
set_obj_animation_and_sound_state(0);
|
||||
cur_obj_init_animation_with_sound(0);
|
||||
if (animTimer < 38)
|
||||
o->oBowserKeyScale = 0.0f;
|
||||
else if (animTimer < 49)
|
||||
@@ -26,12 +26,12 @@ void bhv_bowser_key_unlock_door_loop(void) {
|
||||
else
|
||||
o->oBowserKeyScale = 1.0f;
|
||||
if (o->oTimer > 150)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
void bhv_bowser_key_course_exit_loop(void) {
|
||||
s32 animTimer = o->header.gfx.unk38.animFrame;
|
||||
set_obj_animation_and_sound_state(1);
|
||||
cur_obj_init_animation_with_sound(1);
|
||||
if (animTimer < 38)
|
||||
o->oBowserKeyScale = 0.2f;
|
||||
else if (animTimer < 52)
|
||||
@@ -43,5 +43,5 @@ void bhv_bowser_key_course_exit_loop(void) {
|
||||
else
|
||||
o->oBowserKeyScale = 0.2f;
|
||||
if (o->oTimer > 138)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ void bhv_lll_bowser_puzzle_piece_update(void) {
|
||||
// If we should advance to the next action...
|
||||
if (o->oBowserPuzzlePieceContinuePerformingAction == 0) {
|
||||
// Start doing the next action.
|
||||
obj_change_action(*nextAction);
|
||||
cur_obj_change_action(*nextAction);
|
||||
|
||||
// Advance the pointer to the next action.
|
||||
nextAction++;
|
||||
@@ -200,7 +200,7 @@ void bhv_lll_bowser_puzzle_piece_move(f32 xOffset, f32 zOffset, s32 duration, UN
|
||||
} else {
|
||||
// On frame 20, play the shifting sound.
|
||||
if (o->oTimer == 20)
|
||||
PlaySound2(SOUND_OBJ2_BOWSER_PUZZLE_PIECE_MOVE);
|
||||
cur_obj_play_sound_2(SOUND_OBJ2_BOWSER_PUZZLE_PIECE_MOVE);
|
||||
|
||||
// For the number of frames specified by duration, move the piece.
|
||||
if (o->oTimer < duration + 20) {
|
||||
@@ -208,7 +208,7 @@ void bhv_lll_bowser_puzzle_piece_move(f32 xOffset, f32 zOffset, s32 duration, UN
|
||||
o->oBowserPuzzlePieceOffsetZ += zOffset;
|
||||
} else {
|
||||
// This doesn't actually accomplish anything since
|
||||
// obj_change_action is going to be called before the
|
||||
// cur_obj_change_action is going to be called before the
|
||||
// next action is performed anyway.
|
||||
o->oAction = 2;
|
||||
|
||||
@@ -255,7 +255,7 @@ void (*sBowserPuzzlePieceActions[])(void) = {
|
||||
void bhv_lll_bowser_puzzle_piece_loop(void) {
|
||||
bhv_lll_bowser_puzzle_piece_update();
|
||||
|
||||
obj_call_action_function(sBowserPuzzlePieceActions);
|
||||
cur_obj_call_action_function(sBowserPuzzlePieceActions);
|
||||
|
||||
o->oPosX = o->oBowserPuzzlePieceOffsetX + o->oHomeX;
|
||||
o->oPosY = o->oBowserPuzzlePieceOffsetY + o->oHomeY;
|
||||
|
||||
@@ -19,6 +19,6 @@ void spawn_triangle_break_particles(s16 numTris, s16 triModel, f32 triSize, s16
|
||||
triangle->oAngleVelPitch = 0x80 * (s32)(RandomFloat() + 50.0f);
|
||||
triangle->oForwardVel = 30.0f;
|
||||
}
|
||||
scale_object(triangle, triSize);
|
||||
obj_scale(triangle, triSize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// breakable_box.c.inc
|
||||
|
||||
void bhv_breakable_box_loop(void) {
|
||||
set_object_hitbox(o, &sBreakableBoxHitbox);
|
||||
obj_set_model(MODEL_BREAKABLE_BOX_SMALL);
|
||||
obj_set_hitbox(o, &sBreakableBoxHitbox);
|
||||
cur_obj_set_model(MODEL_BREAKABLE_BOX_SMALL);
|
||||
if (o->oTimer == 0)
|
||||
func_802B0E74();
|
||||
if (obj_was_attacked_or_ground_pounded() != 0) {
|
||||
func_802A3C98(46.0f, 1);
|
||||
breakable_box_init();
|
||||
if (cur_obj_was_attacked_or_ground_pounded() != 0) {
|
||||
obj_explode_and_spawn_coins(46.0f, 1);
|
||||
create_sound_spawner(SOUND_GENERAL_BREAK_BOX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,33 +16,33 @@ void bhv_breakable_box_small_init(void) {
|
||||
o->oGravity = 2.5f;
|
||||
o->oFriction = 0.99f;
|
||||
o->oBuoyancy = 1.4f;
|
||||
obj_scale(0.4f);
|
||||
set_object_hitbox(o, &sBreakableBoxSmallHitbox);
|
||||
cur_obj_scale(0.4f);
|
||||
obj_set_hitbox(o, &sBreakableBoxSmallHitbox);
|
||||
o->oAnimState = 1;
|
||||
o->activeFlags |= 0x200;
|
||||
}
|
||||
|
||||
void func_802F4CE8(void) {
|
||||
void small_breakable_box_spawn_dust(void) {
|
||||
struct Object *sp24 = spawn_object(o, MODEL_SMOKE, bhvSmoke);
|
||||
sp24->oPosX += (s32)(RandomFloat() * 80.0f) - 40;
|
||||
sp24->oPosZ += (s32)(RandomFloat() * 80.0f) - 40;
|
||||
}
|
||||
|
||||
void func_802F4DB4(void) {
|
||||
void small_breakable_box_act_move(void) {
|
||||
s16 sp1E = object_step();
|
||||
|
||||
attack_collided_non_mario_object(o);
|
||||
obj_attack_collided_from_other_object(o);
|
||||
if (sp1E == 1)
|
||||
PlaySound2(SOUND_GENERAL_BOX_LANDING_2);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_BOX_LANDING_2);
|
||||
if (sp1E & 1) {
|
||||
if (o->oForwardVel > 20.0f) {
|
||||
PlaySound2(SOUND_ENV_SLIDING);
|
||||
func_802F4CE8();
|
||||
cur_obj_play_sound_2(SOUND_ENV_SLIDING);
|
||||
small_breakable_box_spawn_dust();
|
||||
}
|
||||
}
|
||||
|
||||
if (sp1E & 2) {
|
||||
func_802A3004();
|
||||
spawn_mist_particles();
|
||||
spawn_triangle_break_particles(20, 138, 0.7f, 3);
|
||||
obj_spawn_yellow_coins(o, 3);
|
||||
create_sound_spawner(SOUND_GENERAL_BREAK_BOX);
|
||||
@@ -73,7 +73,7 @@ void breakable_box_small_released_loop(void) {
|
||||
void breakable_box_small_idle_loop(void) {
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
func_802F4DB4();
|
||||
small_breakable_box_act_move();
|
||||
break;
|
||||
|
||||
case 100:
|
||||
@@ -91,9 +91,9 @@ void breakable_box_small_idle_loop(void) {
|
||||
}
|
||||
|
||||
void breakable_box_small_get_dropped(void) {
|
||||
obj_become_tangible();
|
||||
obj_enable_rendering();
|
||||
obj_get_dropped();
|
||||
cur_obj_become_tangible();
|
||||
cur_obj_enable_rendering();
|
||||
cur_obj_get_dropped();
|
||||
o->header.gfx.node.flags &= ~0x10;
|
||||
o->oHeldState = 0;
|
||||
o->oBreakableBoxSmallReleased = 1;
|
||||
@@ -101,9 +101,9 @@ void breakable_box_small_get_dropped(void) {
|
||||
}
|
||||
|
||||
void breakable_box_small_get_thrown(void) {
|
||||
obj_become_tangible();
|
||||
obj_enable_rendering_2();
|
||||
obj_enable_rendering();
|
||||
cur_obj_become_tangible();
|
||||
cur_obj_enable_rendering_2();
|
||||
cur_obj_enable_rendering();
|
||||
o->header.gfx.node.flags &= ~0x10;
|
||||
o->oHeldState = 0;
|
||||
o->oFlags &= ~0x08;
|
||||
@@ -121,8 +121,8 @@ void bhv_breakable_box_small_loop(void) {
|
||||
break;
|
||||
|
||||
case 1:
|
||||
obj_disable_rendering();
|
||||
obj_become_intangible();
|
||||
cur_obj_disable_rendering();
|
||||
cur_obj_become_intangible();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
void bhv_wf_breakable_wall_loop(void) {
|
||||
if (gMarioStates->action == ACT_SHOT_FROM_CANNON) {
|
||||
obj_become_tangible();
|
||||
if (are_objects_collided(o, gMarioObject)) {
|
||||
if (obj_has_behavior(bhvWfBreakableWallRight))
|
||||
cur_obj_become_tangible();
|
||||
if (obj_check_if_collided_with_object(o, gMarioObject)) {
|
||||
if (cur_obj_has_behavior(bhvWfBreakableWallRight))
|
||||
play_puzzle_jingle();
|
||||
create_sound_spawner(SOUND_GENERAL_WALL_EXPLOSION);
|
||||
o->oInteractType = 8;
|
||||
o->oDamageOrCoinValue = 1;
|
||||
func_802A3C98(80.0f, 0);
|
||||
obj_explode_and_spawn_coins(80.0f, 0);
|
||||
}
|
||||
} else
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// to do nothing, which indicates this behavior set is incomplete.
|
||||
|
||||
// TODO: Rename these. These have nothing to do with birds.
|
||||
void ActionBirdChirpChirp0(void) {
|
||||
void bub_spawner_act_0(void) {
|
||||
s32 i;
|
||||
s32 sp18 = o->oBirdChirpChirpUnkF4;
|
||||
if (o->oDistanceToMario < 1500.0f) {
|
||||
@@ -15,27 +15,27 @@ void ActionBirdChirpChirp0(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionBirdChirpChirp1(void) {
|
||||
void bub_spawner_act_1(void) {
|
||||
if (gMarioObject->oPosY - o->oPosY > 2000.0f)
|
||||
o->oAction = 2;
|
||||
}
|
||||
|
||||
void ActionBirdChirpChirp2(void) {
|
||||
void bub_spawner_act_2(void) {
|
||||
o->oAction = 3;
|
||||
}
|
||||
|
||||
void ActionBirdChirpChirp3(void) {
|
||||
void bub_spawner_act_3(void) {
|
||||
o->oAction = 0;
|
||||
}
|
||||
|
||||
void (*sBirdChirpChirpActions[])(void) = { ActionBirdChirpChirp0, ActionBirdChirpChirp1,
|
||||
ActionBirdChirpChirp2, ActionBirdChirpChirp3 };
|
||||
void (*sBirdChirpChirpActions[])(void) = { bub_spawner_act_0, bub_spawner_act_1,
|
||||
bub_spawner_act_2, bub_spawner_act_3 };
|
||||
|
||||
void bhv_bird_chirp_chirp_loop(void) {
|
||||
obj_call_action_function(sBirdChirpChirpActions);
|
||||
void bhv_bub_spawner_loop(void) {
|
||||
cur_obj_call_action_function(sBirdChirpChirpActions);
|
||||
}
|
||||
|
||||
void func_802C0240(s32 a0) {
|
||||
void bub_move_vertically(s32 a0) {
|
||||
f32 sp1C = o->parentObj->oPosY;
|
||||
if (sp1C - 100.0f - o->oCheepCheepUnk104 < o->oPosY
|
||||
&& o->oPosY < sp1C + 1000.0f + o->oCheepCheepUnk104)
|
||||
@@ -44,13 +44,13 @@ void func_802C0240(s32 a0) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionCheepCheep0(void) {
|
||||
void bub_act_0(void) {
|
||||
o->oCheepCheepUnkFC = RandomFloat() * 100.0f;
|
||||
o->oCheepCheepUnk104 = RandomFloat() * 300.0f;
|
||||
o->oAction = 1;
|
||||
}
|
||||
|
||||
void ActionCheepCheep1(void) {
|
||||
void bub_act_1(void) {
|
||||
f32 dy;
|
||||
if (o->oTimer == 0) {
|
||||
o->oForwardVel = RandomFloat() * 2 + 2;
|
||||
@@ -61,17 +61,17 @@ void ActionCheepCheep1(void) {
|
||||
if (dy < 0.0f)
|
||||
dy = 0.0f - dy;
|
||||
if (dy < 500.0f)
|
||||
func_802C0240(1);
|
||||
bub_move_vertically(1);
|
||||
else
|
||||
func_802C0240(4);
|
||||
bub_move_vertically(4);
|
||||
} else {
|
||||
o->oPosY = o->oCheepCheepUnkF4 - 50.0f;
|
||||
if (dy > 300.0f)
|
||||
o->oPosY = o->oPosY - 1.0f;
|
||||
}
|
||||
if (800.0f < obj_lateral_dist_from_mario_to_home())
|
||||
o->oAngleToMario = obj_angle_to_home();
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 0x100);
|
||||
if (800.0f < cur_obj_lateral_dist_from_mario_to_home())
|
||||
o->oAngleToMario = cur_obj_angle_to_home();
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x100);
|
||||
if (o->oDistanceToMario < 200.0f)
|
||||
if (o->oCheepCheepUnk108 < 0.5)
|
||||
o->oAction = 2;
|
||||
@@ -79,7 +79,7 @@ void ActionCheepCheep1(void) {
|
||||
o->oAction = 2;
|
||||
}
|
||||
|
||||
void ActionCheepCheep2(void) {
|
||||
void bub_act_2(void) {
|
||||
f32 dy;
|
||||
if (o->oTimer < 20) {
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED)
|
||||
@@ -87,7 +87,7 @@ void ActionCheepCheep2(void) {
|
||||
} else
|
||||
o->oInteractStatus = 0;
|
||||
if (o->oTimer == 0)
|
||||
PlaySound2(SOUND_GENERAL_MOVING_WATER);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_MOVING_WATER);
|
||||
if (o->oForwardVel == 0.0f)
|
||||
o->oForwardVel = 6.0f;
|
||||
dy = o->oPosY - gMarioObject->oPosY;
|
||||
@@ -95,30 +95,30 @@ void ActionCheepCheep2(void) {
|
||||
if (dy < 0.0f)
|
||||
dy = 0.0f - dy;
|
||||
if (dy < 500.0f)
|
||||
func_802C0240(2);
|
||||
bub_move_vertically(2);
|
||||
else
|
||||
func_802C0240(4);
|
||||
bub_move_vertically(4);
|
||||
} else {
|
||||
o->oPosY = o->oCheepCheepUnkF4 - 50.0f;
|
||||
if (dy > 300.0f)
|
||||
o->oPosY -= 1.0f;
|
||||
}
|
||||
if (obj_lateral_dist_from_mario_to_home() > 800.0f)
|
||||
o->oAngleToMario = obj_angle_to_home();
|
||||
obj_rotate_yaw_toward(o->oAngleToMario + 0x8000, 0x400);
|
||||
if (cur_obj_lateral_dist_from_mario_to_home() > 800.0f)
|
||||
o->oAngleToMario = cur_obj_angle_to_home();
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario + 0x8000, 0x400);
|
||||
if (o->oTimer > 200 && o->oDistanceToMario > 600.0f)
|
||||
o->oAction = 1;
|
||||
}
|
||||
|
||||
void (*sCheepCheepActions[])(void) = { ActionCheepCheep0, ActionCheepCheep1, ActionCheepCheep2 };
|
||||
void (*sCheepCheepActions[])(void) = { bub_act_0, bub_act_1, bub_act_2 };
|
||||
|
||||
void bhv_cheep_cheep_loop(void) {
|
||||
void bhv_bub_loop(void) {
|
||||
o->oCheepCheepUnkF4 = find_water_level(o->oPosX, o->oPosZ);
|
||||
o->oCheepCheepUnkF8 = gMarioObject->oPosY + o->oCheepCheepUnkFC;
|
||||
o->oWallHitboxRadius = 30.0f;
|
||||
obj_update_floor_and_walls();
|
||||
obj_call_action_function(sCheepCheepActions);
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_call_action_function(sCheepCheepActions);
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
if (o->parentObj->oAction == 2)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ static struct ObjectHitbox sBubbaHitbox = {
|
||||
void bubba_act_0(void) {
|
||||
f32 sp24;
|
||||
|
||||
sp24 = obj_lateral_dist_to_home();
|
||||
sp24 = cur_obj_lateral_dist_to_home();
|
||||
treat_far_home_as_mario(2000.0f);
|
||||
o->oAnimState = 0;
|
||||
|
||||
@@ -34,7 +34,7 @@ void bubba_act_0(void) {
|
||||
}
|
||||
|
||||
if ((o->oBubbaUnkFC = o->oMoveFlags & 0x00000200) != 0) {
|
||||
o->oBubbaUnk1AE = obj_reflect_move_angle_off_wall();
|
||||
o->oBubbaUnk1AE = cur_obj_reflect_move_angle_off_wall();
|
||||
} else if (o->oTimer > 30 && o->oDistanceToMario < 2000.0f) {
|
||||
o->oAction = 1;
|
||||
} else if (o->oBubbaUnkF8 != 0) {
|
||||
@@ -55,7 +55,7 @@ void bubba_act_1(void) {
|
||||
o->oAction = 0;
|
||||
} else if (o->oBubbaUnk100 != 0) {
|
||||
if (--o->oBubbaUnk100 == 0) {
|
||||
PlaySound2(SOUND_OBJ_BUBBA_CHOMP);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BUBBA_CHOMP);
|
||||
o->oAction = 0;
|
||||
} else if (o->oBubbaUnk100 < 15) {
|
||||
o->oAnimState = 1;
|
||||
@@ -71,7 +71,7 @@ void bubba_act_1(void) {
|
||||
o->oBubbaUnk1AE = o->oAngleToMario;
|
||||
o->oBubbaUnk1AC = o->oBubbaUnk104;
|
||||
|
||||
obj_rotate_yaw_toward(o->oBubbaUnk1AE, 400);
|
||||
cur_obj_rotate_yaw_toward(o->oBubbaUnk1AE, 400);
|
||||
obj_move_pitch_approach(o->oBubbaUnk1AC, 400);
|
||||
}
|
||||
} else {
|
||||
@@ -119,7 +119,7 @@ void bhv_bubba_loop(void) {
|
||||
o->hurtboxRadius = 150.0f;
|
||||
}
|
||||
|
||||
obj_update_floor_and_walls();
|
||||
cur_obj_update_floor_and_walls();
|
||||
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
@@ -134,7 +134,7 @@ void bhv_bubba_loop(void) {
|
||||
if (o->oMoveFlags & 0x00000008) {
|
||||
sp38 = spawn_object(o, MODEL_WATER_SPLASH, bhvWaterSplash);
|
||||
if (sp38 != NULL) {
|
||||
scale_object(sp38, 3.0f);
|
||||
obj_scale(sp38, 3.0f);
|
||||
}
|
||||
|
||||
o->oBubbaUnk108 = o->oVelY;
|
||||
@@ -163,7 +163,7 @@ void bhv_bubba_loop(void) {
|
||||
obj_face_pitch_approach(o->oMoveAnglePitch, 400);
|
||||
obj_check_attacks(&sBubbaHitbox, o->oAction);
|
||||
|
||||
obj_move_standard(78);
|
||||
cur_obj_move_standard(78);
|
||||
|
||||
o->oFloorHeight += 150.0f;
|
||||
if (o->oPosY < o->oFloorHeight) {
|
||||
|
||||
@@ -7,16 +7,16 @@ void bhv_object_bubble_init(void) {
|
||||
}
|
||||
|
||||
void bhv_object_bubble_loop(void) {
|
||||
struct Object *bubbleRipples;
|
||||
struct Object *bubbleSplash;
|
||||
f32 waterY = find_water_level(o->oPosX, o->oPosZ);
|
||||
f32 bubbleY = o->oPosY;
|
||||
|
||||
if (bubbleY > waterY) {
|
||||
if (gFreeObjectList.next) {
|
||||
bubbleRipples = spawn_object_at_origin(o, 0, MODEL_SPOT_ON_GROUND, bhvObjectBubbleRipples);
|
||||
bubbleRipples->oPosX = o->oPosX;
|
||||
bubbleRipples->oPosY = bubbleY + 5.0f;
|
||||
bubbleRipples->oPosZ = o->oPosZ;
|
||||
bubbleSplash = spawn_object_at_origin(o, 0, MODEL_SMALL_WATER_SPLASH, bhvBubbleSplash);
|
||||
bubbleSplash->oPosX = o->oPosX;
|
||||
bubbleSplash->oPosY = bubbleY + 5.0f;
|
||||
bubbleSplash->oPosZ = o->oPosZ;
|
||||
}
|
||||
|
||||
o->activeFlags = 0;
|
||||
|
||||
@@ -2,31 +2,31 @@
|
||||
|
||||
// bullet bill smoke
|
||||
void bhv_white_puff_smoke_init(void) {
|
||||
obj_scale(RandomFloat() * 2 + 2.0);
|
||||
cur_obj_scale(RandomFloat() * 2 + 2.0);
|
||||
}
|
||||
|
||||
void bhv_bullet_bill_init(void) {
|
||||
o->oBulletBillUnkF8 = o->oMoveAngleYaw;
|
||||
}
|
||||
|
||||
void ActionBulletBill0(void) {
|
||||
obj_become_tangible();
|
||||
void bullet_bill_act_0(void) {
|
||||
cur_obj_become_tangible();
|
||||
o->oForwardVel = 0.0f;
|
||||
o->oMoveAngleYaw = o->oBulletBillUnkF8;
|
||||
o->oFaceAnglePitch = 0;
|
||||
o->oFaceAngleRoll = 0;
|
||||
o->oMoveFlags = 0;
|
||||
obj_set_pos_to_home();
|
||||
cur_obj_set_pos_to_home();
|
||||
o->oAction = 1;
|
||||
}
|
||||
|
||||
void ActionBulletBill1(void) {
|
||||
void bullet_bill_act_1(void) {
|
||||
s16 sp1E = abs_angle_diff(o->oAngleToMario, o->oMoveAngleYaw);
|
||||
if (sp1E < 0x2000 && 400.0f < o->oDistanceToMario && o->oDistanceToMario < 1500.0f)
|
||||
o->oAction = 2;
|
||||
}
|
||||
|
||||
void ActionBulletBill2(void) {
|
||||
void bullet_bill_act_2(void) {
|
||||
if (o->oTimer < 40)
|
||||
o->oForwardVel = 3.0f;
|
||||
else if (o->oTimer < 50) {
|
||||
@@ -36,30 +36,30 @@ void ActionBulletBill2(void) {
|
||||
o->oForwardVel = -3.0f;
|
||||
} else {
|
||||
if (o->oTimer > 70)
|
||||
obj_update_floor_and_walls();
|
||||
cur_obj_update_floor_and_walls();
|
||||
spawn_object(o, MODEL_SMOKE, bhvWhitePuffSmoke);
|
||||
o->oForwardVel = 30.0f;
|
||||
if (o->oDistanceToMario > 300.0f)
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 0x100);
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x100);
|
||||
if (o->oTimer == 50) {
|
||||
PlaySound2(SOUND_OBJ_POUNDING_CANNON);
|
||||
ShakeScreen(SHAKE_POS_SMALL);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_POUNDING_CANNON);
|
||||
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
||||
}
|
||||
if (o->oTimer > 150 || o->oMoveFlags & 0x200) {
|
||||
o->oAction = 3;
|
||||
func_802A3004();
|
||||
spawn_mist_particles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActionBulletBill3(void) {
|
||||
void bullet_bill_act_3(void) {
|
||||
o->oAction = 0;
|
||||
}
|
||||
|
||||
void ActionBulletBill4(void) {
|
||||
void bullet_bill_act_4(void) {
|
||||
if (o->oTimer == 0) {
|
||||
o->oForwardVel = -30.0f;
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
}
|
||||
o->oFaceAnglePitch += 0x1000;
|
||||
o->oFaceAngleRoll += 0x1000;
|
||||
@@ -68,11 +68,11 @@ void ActionBulletBill4(void) {
|
||||
o->oAction = 0;
|
||||
}
|
||||
|
||||
void (*sBulletBillActions[])(void) = { ActionBulletBill0, ActionBulletBill1, ActionBulletBill2,
|
||||
ActionBulletBill3, ActionBulletBill4 };
|
||||
void (*sBulletBillActions[])(void) = { bullet_bill_act_0, bullet_bill_act_1, bullet_bill_act_2,
|
||||
bullet_bill_act_3, bullet_bill_act_4 };
|
||||
|
||||
void bhv_bullet_bill_loop(void) {
|
||||
obj_call_action_function(sBulletBillActions);
|
||||
if (obj_check_interacted())
|
||||
cur_obj_call_action_function(sBulletBillActions);
|
||||
if (cur_obj_check_interacted())
|
||||
o->oAction = 4;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ static struct ObjectHitbox sBigBullyHitbox = {
|
||||
};
|
||||
|
||||
void bhv_small_bully_init(void) {
|
||||
SetObjAnimation(0);
|
||||
cur_obj_init_animation(0);
|
||||
|
||||
o->oHomeX = o->oPosX;
|
||||
o->oHomeZ = o->oPosZ;
|
||||
@@ -34,11 +34,11 @@ void bhv_small_bully_init(void) {
|
||||
o->oFriction = 0.91;
|
||||
o->oBuoyancy = 1.3;
|
||||
|
||||
set_object_hitbox(o, &sSmallBullyHitbox);
|
||||
obj_set_hitbox(o, &sSmallBullyHitbox);
|
||||
}
|
||||
|
||||
void bhv_big_bully_init(void) {
|
||||
SetObjAnimation(0);
|
||||
cur_obj_init_animation(0);
|
||||
|
||||
o->oHomeX = o->oPosX;
|
||||
o->oHomeY = o->oPosY;
|
||||
@@ -48,25 +48,25 @@ void bhv_big_bully_init(void) {
|
||||
o->oFriction = 0.93;
|
||||
o->oBuoyancy = 1.3;
|
||||
|
||||
set_object_hitbox(o, &sBigBullyHitbox);
|
||||
obj_set_hitbox(o, &sBigBullyHitbox);
|
||||
}
|
||||
|
||||
void BullyCheckMarioCollision(void) {
|
||||
void bully_check_mario_collision(void) {
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
|
||||
if (o->oBehParams2ndByte == BULLY_BP_SIZE_SMALL)
|
||||
PlaySound2(SOUND_OBJ2_BULLY_ATTACKED);
|
||||
cur_obj_play_sound_2(SOUND_OBJ2_BULLY_ATTACKED);
|
||||
else
|
||||
PlaySound2(SOUND_OBJ2_LARGE_BULLY_ATTACKED);
|
||||
cur_obj_play_sound_2(SOUND_OBJ2_LARGE_BULLY_ATTACKED);
|
||||
|
||||
o->oInteractStatus &= ~INT_STATUS_INTERACTED;
|
||||
o->oAction = BULLY_ACT_KNOCKBACK;
|
||||
o->oFlags &= ~0x8; /* bit 3 */
|
||||
SetObjAnimation(3);
|
||||
cur_obj_init_animation(3);
|
||||
o->oBullyMarioCollisionAngle = o->oMoveAngleYaw;
|
||||
}
|
||||
}
|
||||
|
||||
void BullyChaseMarioLoop(void) {
|
||||
void bully_act_chase_mario(void) {
|
||||
f32 homeX = o->oHomeX;
|
||||
f32 posY = o->oPosY;
|
||||
f32 homeZ = o->oHomeZ;
|
||||
@@ -86,11 +86,11 @@ void BullyChaseMarioLoop(void) {
|
||||
|
||||
if (!is_point_within_radius_of_mario(homeX, posY, homeZ, 1000)) {
|
||||
o->oAction = BULLY_ACT_PATROL;
|
||||
SetObjAnimation(0);
|
||||
cur_obj_init_animation(0);
|
||||
}
|
||||
}
|
||||
|
||||
void BullyKnockbackLoop(void) {
|
||||
void bully_act_knockback(void) {
|
||||
if (o->oForwardVel < 10.0 && (s32) o->oVelY == 0) {
|
||||
o->oForwardVel = 1.0;
|
||||
o->oBullyKBTimerAndMinionKOCounter++;
|
||||
@@ -103,11 +103,11 @@ void BullyKnockbackLoop(void) {
|
||||
if (o->oBullyKBTimerAndMinionKOCounter == 18) {
|
||||
o->oAction = BULLY_ACT_CHASE_MARIO;
|
||||
o->oBullyKBTimerAndMinionKOCounter = 0;
|
||||
SetObjAnimation(1);
|
||||
cur_obj_init_animation(1);
|
||||
}
|
||||
}
|
||||
|
||||
void BullyBackUpLoop(void) {
|
||||
void bully_act_back_up(void) {
|
||||
if (o->oTimer == 0) {
|
||||
o->oFlags &= ~0x8; /* bit 3 */
|
||||
o->oMoveAngleYaw += 0x8000;
|
||||
@@ -115,7 +115,7 @@ void BullyBackUpLoop(void) {
|
||||
|
||||
o->oForwardVel = 5.0;
|
||||
|
||||
//! BullyBackUpCheck() happens after this function, and has the potential to reset
|
||||
//! bully_backup_check() happens after this function, and has the potential to reset
|
||||
// the bully's action to BULLY_ACT_BACK_UP. Because the back up action is only
|
||||
// set to end when the timer EQUALS 15, if this happens on that frame, the bully
|
||||
// will be stuck in BULLY_ACT_BACK_UP forever until Mario hits it or its death
|
||||
@@ -129,7 +129,7 @@ void BullyBackUpLoop(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void BullyBackUpCheck(s16 collisionFlags) {
|
||||
void bully_backup_check(s16 collisionFlags) {
|
||||
if (!(collisionFlags & 0x8) && o->oAction != BULLY_ACT_KNOCKBACK) /* bit 3 */
|
||||
{
|
||||
o->oPosX = o->oBullyPrevX;
|
||||
@@ -138,15 +138,15 @@ void BullyBackUpCheck(s16 collisionFlags) {
|
||||
}
|
||||
}
|
||||
|
||||
void PlayBullyStompingSound(void) {
|
||||
void bully_play_stomping_sound(void) {
|
||||
s16 sp26 = o->header.gfx.unk38.animFrame;
|
||||
switch (o->oAction) {
|
||||
case BULLY_ACT_PATROL:
|
||||
if (sp26 == 0 || sp26 == 12) {
|
||||
if (o->oBehParams2ndByte == BULLY_BP_SIZE_SMALL)
|
||||
PlaySound2(SOUND_OBJ_BULLY_WALK);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BULLY_WALK);
|
||||
else
|
||||
PlaySound2(SOUND_OBJ_BULLY_WALKING);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BULLY_WALKING);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -154,19 +154,19 @@ void PlayBullyStompingSound(void) {
|
||||
case BULLY_ACT_BACK_UP:
|
||||
if (sp26 == 0 || sp26 == 5) {
|
||||
if (o->oBehParams2ndByte == BULLY_BP_SIZE_SMALL)
|
||||
PlaySound2(SOUND_OBJ_BULLY_WALK);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BULLY_WALK);
|
||||
else
|
||||
PlaySound2(SOUND_OBJ_BULLY_WALKING);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_BULLY_WALKING);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BullyStep(void) {
|
||||
void bully_step(void) {
|
||||
s16 collisionFlags = 0;
|
||||
collisionFlags = object_step();
|
||||
BullyBackUpCheck(collisionFlags);
|
||||
PlayBullyStompingSound();
|
||||
bully_backup_check(collisionFlags);
|
||||
bully_play_stomping_sound();
|
||||
obj_check_floor_death(collisionFlags, sObjFloor);
|
||||
|
||||
if (o->oBullySubtype & BULLY_STYPE_CHILL) {
|
||||
@@ -175,14 +175,14 @@ void BullyStep(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void BullySpawnCoin(void) {
|
||||
void bully_spawn_coin(void) {
|
||||
struct Object *coin = spawn_object(o, MODEL_YELLOW_COIN, bhvMovingYellowCoin);
|
||||
#ifdef VERSION_JP //TODO: maybe move this ifdef logic to the header?
|
||||
PlaySound2(SOUND_GENERAL_COIN_SPURT);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT);
|
||||
#elif VERSION_EU
|
||||
PlaySound2(SOUND_GENERAL_COIN_SPURT_EU);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_EU);
|
||||
#else
|
||||
PlaySound2(SOUND_GENERAL_COIN_SPURT_2);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_2);
|
||||
#endif
|
||||
coin->oForwardVel = 10.0f;
|
||||
coin->oVelY = 100.0f;
|
||||
@@ -190,19 +190,19 @@ void BullySpawnCoin(void) {
|
||||
coin->oMoveAngleYaw = (f32)(o->oBullyMarioCollisionAngle + 0x8000) + RandomFloat() * 1024.0f;
|
||||
}
|
||||
|
||||
void BullyLavaDeath(void) {
|
||||
void bully_act_level_death(void) {
|
||||
if (obj_lava_death() == 1) {
|
||||
if (o->oBehParams2ndByte == BULLY_BP_SIZE_SMALL) {
|
||||
if (o->oBullySubtype == BULLY_STYPE_MINION)
|
||||
o->parentObj->oBullyKBTimerAndMinionKOCounter++;
|
||||
BullySpawnCoin();
|
||||
bully_spawn_coin();
|
||||
} else {
|
||||
func_802A3004();
|
||||
spawn_mist_particles();
|
||||
|
||||
if (o->oBullySubtype == BULLY_STYPE_CHILL)
|
||||
create_star(130.0f, 1600.0f, -4335.0f);
|
||||
spawn_default_star(130.0f, 1600.0f, -4335.0f);
|
||||
else {
|
||||
create_star(0, 950.0f, -6800.0f);
|
||||
spawn_default_star(0, 950.0f, -6800.0f);
|
||||
spawn_object_abs_with_rot(o, 0, MODEL_NONE, bhvLllTumblingBridge, 0, 154, -5631, 0, 0,
|
||||
0);
|
||||
}
|
||||
@@ -219,7 +219,7 @@ void bhv_bully_loop(void) {
|
||||
// death action by colliding with it. Since the bully hitbox is tall enough to collide
|
||||
// with Mario even when it is under a lava floor, this can get the bully stuck OOB
|
||||
// if there is nothing under the lava floor.
|
||||
BullyCheckMarioCollision();
|
||||
bully_check_mario_collision();
|
||||
|
||||
switch (o->oAction) {
|
||||
case BULLY_ACT_PATROL:
|
||||
@@ -227,29 +227,29 @@ void bhv_bully_loop(void) {
|
||||
|
||||
if (obj_return_home_if_safe(o, o->oHomeX, o->oPosY, o->oHomeZ, 800) == 1) {
|
||||
o->oAction = BULLY_ACT_CHASE_MARIO;
|
||||
SetObjAnimation(1);
|
||||
cur_obj_init_animation(1);
|
||||
}
|
||||
|
||||
BullyStep();
|
||||
bully_step();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_CHASE_MARIO:
|
||||
BullyChaseMarioLoop();
|
||||
BullyStep();
|
||||
bully_act_chase_mario();
|
||||
bully_step();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_KNOCKBACK:
|
||||
BullyKnockbackLoop();
|
||||
BullyStep();
|
||||
bully_act_knockback();
|
||||
bully_step();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_BACK_UP:
|
||||
BullyBackUpLoop();
|
||||
BullyStep();
|
||||
bully_act_back_up();
|
||||
bully_step();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_LAVA_DEATH:
|
||||
BullyLavaDeath();
|
||||
bully_act_level_death();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_DEATH_PLANE_DEATH:
|
||||
@@ -265,7 +265,7 @@ void bhv_bully_loop(void) {
|
||||
// sp40 = arg2
|
||||
// sp44 = arg3
|
||||
|
||||
void BigBullySpawnMinion(s32 arg0, s32 arg1, s32 arg2, s16 arg3) {
|
||||
void big_bully_spawn_minion(s32 arg0, s32 arg1, s32 arg2, s16 arg3) {
|
||||
struct Object *bully =
|
||||
spawn_object_abs_with_rot(o, 0, MODEL_BULLY, bhvSmallBully, arg0, arg1, arg2, 0, arg3, 00);
|
||||
bully->oBullySubtype = BULLY_STYPE_MINION;
|
||||
@@ -273,21 +273,21 @@ void BigBullySpawnMinion(s32 arg0, s32 arg1, s32 arg2, s16 arg3) {
|
||||
}
|
||||
|
||||
void bhv_big_bully_with_minions_init(void) {
|
||||
BigBullySpawnMinion(4454, 307, -5426, 0);
|
||||
BigBullySpawnMinion(3840, 307, -6041, 0);
|
||||
BigBullySpawnMinion(3226, 307, -5426, 0);
|
||||
big_bully_spawn_minion(4454, 307, -5426, 0);
|
||||
big_bully_spawn_minion(3840, 307, -6041, 0);
|
||||
big_bully_spawn_minion(3226, 307, -5426, 0);
|
||||
|
||||
o->header.gfx.node.flags |= 0x10; /* bit 4 */
|
||||
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
|
||||
o->oAction = BULLY_ACT_INACTIVE;
|
||||
}
|
||||
|
||||
void BigBullyWithMinionsLavaDeath(void) {
|
||||
void big_bully_spawn_star(void) {
|
||||
if (obj_lava_death() == 1) {
|
||||
func_802A3004();
|
||||
create_star(3700.0f, 600.0f, -5500.0f);
|
||||
spawn_mist_particles();
|
||||
spawn_default_star(3700.0f, 600.0f, -5500.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ void bhv_big_bully_with_minions_loop(void) {
|
||||
o->oBullyPrevY = o->oPosY;
|
||||
o->oBullyPrevZ = o->oPosZ;
|
||||
|
||||
BullyCheckMarioCollision();
|
||||
bully_check_mario_collision();
|
||||
|
||||
switch (o->oAction) {
|
||||
case BULLY_ACT_PATROL:
|
||||
@@ -310,25 +310,25 @@ void bhv_big_bully_with_minions_loop(void) {
|
||||
|
||||
if (obj_return_home_if_safe(o, o->oHomeX, o->oPosY, o->oHomeZ, 1000) == 1) {
|
||||
o->oAction = BULLY_ACT_CHASE_MARIO;
|
||||
SetObjAnimation(1);
|
||||
cur_obj_init_animation(1);
|
||||
}
|
||||
|
||||
BullyStep();
|
||||
bully_step();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_CHASE_MARIO:
|
||||
BullyChaseMarioLoop();
|
||||
BullyStep();
|
||||
bully_act_chase_mario();
|
||||
bully_step();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_KNOCKBACK:
|
||||
BullyKnockbackLoop();
|
||||
BullyStep();
|
||||
bully_act_knockback();
|
||||
bully_step();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_BACK_UP:
|
||||
BullyBackUpLoop();
|
||||
BullyStep();
|
||||
bully_act_back_up();
|
||||
bully_step();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_INACTIVE:
|
||||
@@ -350,17 +350,17 @@ void bhv_big_bully_with_minions_loop(void) {
|
||||
o->oAction = BULLY_ACT_PATROL;
|
||||
|
||||
if (collisionFlags == 1) {
|
||||
PlaySound2(SOUND_OBJ_THWOMP);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_THWOMP);
|
||||
set_camera_shake_from_point(SHAKE_POS_SMALL, o->oPosX, o->oPosY, o->oPosZ);
|
||||
func_802A3004();
|
||||
spawn_mist_particles();
|
||||
}
|
||||
|
||||
o->header.gfx.node.flags &= ~0x10; /* bit 4 */
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_LAVA_DEATH:
|
||||
BigBullyWithMinionsLavaDeath();
|
||||
big_bully_spawn_star();
|
||||
break;
|
||||
|
||||
case BULLY_ACT_DEATH_PLANE_DEATH:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// butterfly.c.inc
|
||||
|
||||
void bhv_butterfly_init(void) {
|
||||
SetObjAnimation(1);
|
||||
cur_obj_init_animation(1);
|
||||
|
||||
o->oButterflyYPhase = RandomFloat() * 100.0f;
|
||||
o->header.gfx.unk38.animFrame = RandomFloat() * 7.0f;
|
||||
@@ -12,7 +12,7 @@ void bhv_butterfly_init(void) {
|
||||
|
||||
// sp28 = speed
|
||||
|
||||
void ButterflyStep(s32 speed) {
|
||||
void butterfly_step(s32 speed) {
|
||||
struct FloorGeometry *sp24;
|
||||
s16 yaw = o->oMoveAngleYaw;
|
||||
s16 pitch = o->oMoveAnglePitch;
|
||||
@@ -41,7 +41,7 @@ void ButterflyStep(s32 speed) {
|
||||
o->oButterflyYPhase = 0;
|
||||
}
|
||||
|
||||
void CalculateButterflyAngle(void) {
|
||||
void butterfly_calculate_angle(void) {
|
||||
gMarioObject->oPosX += 5 * o->oButterflyYPhase / 4;
|
||||
gMarioObject->oPosZ += 5 * o->oButterflyYPhase / 4;
|
||||
obj_turn_toward_object(o, gMarioObject, 16, 0x300);
|
||||
@@ -53,25 +53,25 @@ void CalculateButterflyAngle(void) {
|
||||
gMarioObject->oPosY -= (5 * o->oButterflyYPhase + 0x100) / 4;
|
||||
}
|
||||
|
||||
void ButterflyRestingLoop(void) {
|
||||
void butterfly_act_rest(void) {
|
||||
if (is_point_within_radius_of_mario(o->oPosX, o->oPosY, o->oPosZ, 1000)) {
|
||||
SetObjAnimation(0);
|
||||
cur_obj_init_animation(0);
|
||||
|
||||
o->oAction = BUTTERFLY_ACT_FOLLOW_MARIO;
|
||||
o->oMoveAngleYaw = gMarioObject->header.gfx.angle[1];
|
||||
}
|
||||
}
|
||||
|
||||
void ButterflyFollowMarioLoop(void) {
|
||||
CalculateButterflyAngle();
|
||||
void butterfly_act_follow_mario(void) {
|
||||
butterfly_calculate_angle();
|
||||
|
||||
ButterflyStep(7);
|
||||
butterfly_step(7);
|
||||
|
||||
if (!is_point_within_radius_of_mario(o->oHomeX, o->oHomeY, o->oHomeZ, 1200))
|
||||
o->oAction = BUTTERFLY_ACT_RETURN_HOME;
|
||||
}
|
||||
|
||||
void ButterflyReturnHomeLoop(void) {
|
||||
void butterfly_act_return_home(void) {
|
||||
f32 homeDistX = o->oHomeX - o->oPosX;
|
||||
f32 homeDistY = o->oHomeY - o->oPosY;
|
||||
f32 homeDistZ = o->oHomeZ - o->oPosZ;
|
||||
@@ -81,10 +81,10 @@ void ButterflyReturnHomeLoop(void) {
|
||||
o->oMoveAngleYaw = approach_s16_symmetric(o->oMoveAngleYaw, hAngleToHome, 0x800);
|
||||
o->oMoveAnglePitch = approach_s16_symmetric(o->oMoveAnglePitch, vAngleToHome, 0x50);
|
||||
|
||||
ButterflyStep(7);
|
||||
butterfly_step(7);
|
||||
|
||||
if (homeDistX * homeDistX + homeDistY * homeDistY + homeDistZ * homeDistZ < 144.0f) {
|
||||
SetObjAnimation(1);
|
||||
cur_obj_init_animation(1);
|
||||
|
||||
o->oAction = BUTTERFLY_ACT_RESTING;
|
||||
o->oPosX = o->oHomeX;
|
||||
@@ -96,15 +96,15 @@ void ButterflyReturnHomeLoop(void) {
|
||||
void bhv_butterfly_loop(void) {
|
||||
switch (o->oAction) {
|
||||
case BUTTERFLY_ACT_RESTING:
|
||||
ButterflyRestingLoop();
|
||||
butterfly_act_rest();
|
||||
break;
|
||||
|
||||
case BUTTERFLY_ACT_FOLLOW_MARIO:
|
||||
ButterflyFollowMarioLoop();
|
||||
butterfly_act_follow_mario();
|
||||
break;
|
||||
|
||||
case BUTTERFLY_ACT_RETURN_HOME:
|
||||
ButterflyReturnHomeLoop();
|
||||
butterfly_act_return_home();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ void bhv_camera_lakitu_init(void) {
|
||||
if (o->oBehParams2ndByte != CAMERA_LAKITU_BP_FOLLOW_CAMERA) {
|
||||
// Despawn unless this is the very beginning of the game
|
||||
if (gShouldNotPlayCastleMusic != TRUE) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
} else {
|
||||
spawn_object_relative_with_scale(CLOUD_BP_LAKITU_CLOUD, 0, 0, 0, 2.0f, o, MODEL_MIST, bhvCloud);
|
||||
@@ -64,7 +64,7 @@ static void camera_lakitu_intro_act_show_dialog(void) {
|
||||
s16 targetMovePitch;
|
||||
s16 targetMoveYaw;
|
||||
|
||||
PlaySound(SOUND_AIR_LAKITU_FLY);
|
||||
cur_obj_play_sound_1(SOUND_AIR_LAKITU_FLY);
|
||||
|
||||
// Face toward mario
|
||||
o->oFaceAnglePitch = obj_turn_pitch_toward_mario(120.0f, 0);
|
||||
@@ -74,7 +74,7 @@ static void camera_lakitu_intro_act_show_dialog(void) {
|
||||
if (o->oCameraLakituFinishedDialog) {
|
||||
approach_f32_ptr(&o->oCameraLakituSpeed, 60.0f, 3.0f);
|
||||
if (o->oDistanceToMario > 6000.0f) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
targetMovePitch = -0x3000;
|
||||
@@ -115,7 +115,7 @@ static void camera_lakitu_intro_act_show_dialog(void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (obj_update_dialog_with_cutscene(2, DIALOG_UNK2_FLAG_0, CUTSCENE_DIALOG, DIALOG_034) != 0) {
|
||||
} else if (cur_obj_update_dialog_with_cutscene(2, DIALOG_UNK2_FLAG_0, CUTSCENE_DIALOG, DIALOG_034) != 0) {
|
||||
o->oCameraLakituFinishedDialog = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -124,11 +124,11 @@ static void camera_lakitu_intro_act_show_dialog(void) {
|
||||
obj_move_pitch_approach(targetMovePitch, o->oCameraLakituPitchVel);
|
||||
|
||||
o->oCameraLakituYawVel = approach_s16_symmetric(o->oCameraLakituYawVel, 0x7D0, 0x64);
|
||||
obj_rotate_yaw_toward(targetMoveYaw, o->oCameraLakituYawVel);
|
||||
cur_obj_rotate_yaw_toward(targetMoveYaw, o->oCameraLakituYawVel);
|
||||
|
||||
// vel y is explicitly computed, so gravity doesn't apply
|
||||
obj_compute_vel_from_move_pitch(o->oCameraLakituSpeed);
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,9 +153,9 @@ void bhv_camera_lakitu_update(void) {
|
||||
} else {
|
||||
f32 val0C = (f32) 0x875C3D / 0x800 - gLakituState.curPos[0];
|
||||
if (gLakituState.curPos[0] < 1700.0f || val0C < 0.0f) {
|
||||
obj_hide();
|
||||
cur_obj_hide();
|
||||
} else {
|
||||
obj_unhide();
|
||||
cur_obj_unhide();
|
||||
|
||||
o->oPosX = gLakituState.curPos[0];
|
||||
o->oPosY = gLakituState.curPos[1];
|
||||
@@ -164,8 +164,8 @@ void bhv_camera_lakitu_update(void) {
|
||||
o->oHomeX = gLakituState.curFocus[0];
|
||||
o->oHomeZ = gLakituState.curFocus[2];
|
||||
|
||||
o->oFaceAngleYaw = -obj_angle_to_home();
|
||||
o->oFaceAnglePitch = atan2s(obj_lateral_dist_to_home(),
|
||||
o->oFaceAngleYaw = -cur_obj_angle_to_home();
|
||||
o->oFaceAnglePitch = atan2s(cur_obj_lateral_dist_to_home(),
|
||||
o->oPosY - gLakituState.curFocus[1]);
|
||||
|
||||
o->oPosX = (f32) 0x875C3D / 0x800 + val0C;
|
||||
|
||||
@@ -4,7 +4,7 @@ void bhv_cannon_base_unused_loop(void) {
|
||||
o->oPosY += o->oVelY;
|
||||
}
|
||||
|
||||
void ActionOpenedCannon0(void) {
|
||||
void opened_cannon_act_0(void) {
|
||||
if (o->oTimer == 0) {
|
||||
o->oInteractStatus = 0;
|
||||
o->oPosX = o->oHomeX;
|
||||
@@ -14,12 +14,12 @@ void ActionOpenedCannon0(void) {
|
||||
o->oMoveAngleYaw = (s16)(o->oBehParams2ndByte << 8);
|
||||
o->oCannonUnkF4 = 0;
|
||||
o->oCannonUnk10C = 0;
|
||||
obj_enable_rendering();
|
||||
obj_become_tangible();
|
||||
cur_obj_enable_rendering();
|
||||
cur_obj_become_tangible();
|
||||
}
|
||||
if (o->oDistanceToMario < 500.0f) {
|
||||
obj_become_tangible();
|
||||
obj_enable_rendering();
|
||||
cur_obj_become_tangible();
|
||||
cur_obj_enable_rendering();
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED
|
||||
&& (!(o->oInteractStatus
|
||||
& INT_STATUS_TOUCHED_BOB_OMB))) // bob-omb explodes when it gets into a cannon
|
||||
@@ -30,15 +30,15 @@ void ActionOpenedCannon0(void) {
|
||||
} else
|
||||
o->oInteractStatus = 0;
|
||||
} else {
|
||||
obj_become_intangible();
|
||||
obj_disable_rendering();
|
||||
cur_obj_become_intangible();
|
||||
cur_obj_disable_rendering();
|
||||
o->oCannonUnk10C = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ActionOpenedCannon4(void) {
|
||||
void opened_cannon_act_4(void) {
|
||||
if (o->oTimer == 0)
|
||||
PlaySound2(SOUND_OBJ_CANNON1);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_CANNON1);
|
||||
o->oPosY += 5.0f;
|
||||
o->oPosX += (f32)((o->oTimer / 2 & 1) - 0.5) * 2;
|
||||
o->oPosZ += (f32)((o->oTimer / 2 & 1) - 0.5) * 2;
|
||||
@@ -49,9 +49,9 @@ void ActionOpenedCannon4(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionOpenedCannon6(void) {
|
||||
void opened_cannon_act_6(void) {
|
||||
if (o->oTimer == 0)
|
||||
PlaySound2(SOUND_OBJ_CANNON2);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_CANNON2);
|
||||
if (o->oTimer < 4) {
|
||||
o->oPosX += (f32)((o->oTimer / 2 & 1) - 0.5) * 4.0f;
|
||||
o->oPosZ += (f32)((o->oTimer / 2 & 1) - 0.5) * 4.0f;
|
||||
@@ -71,9 +71,9 @@ void ActionOpenedCannon6(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionOpenedCannon5(void) {
|
||||
void opened_cannon_act_5(void) {
|
||||
if (o->oTimer == 0)
|
||||
PlaySound2(SOUND_OBJ_CANNON3);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_CANNON3);
|
||||
if (o->oTimer < 4) {
|
||||
} else {
|
||||
if (o->oTimer < 20) {
|
||||
@@ -85,34 +85,34 @@ void ActionOpenedCannon5(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionOpenedCannon1(void) {
|
||||
void opened_cannon_act_1(void) {
|
||||
UNUSED s32 unused;
|
||||
obj_become_intangible();
|
||||
obj_disable_rendering();
|
||||
cur_obj_become_intangible();
|
||||
cur_obj_disable_rendering();
|
||||
o->oCannonUnk10C = 0;
|
||||
gMarioShotFromCannon = 1;
|
||||
}
|
||||
|
||||
void ActionOpenedCannon2(void) {
|
||||
void opened_cannon_act_2(void) {
|
||||
o->oAction = 3;
|
||||
}
|
||||
|
||||
void ActionOpenedCannon3(void) {
|
||||
void opened_cannon_act_3(void) {
|
||||
UNUSED s32 unused;
|
||||
if (o->oTimer > 3)
|
||||
o->oAction = 0;
|
||||
}
|
||||
|
||||
void (*sOpenedCannonActions[])(void) = { ActionOpenedCannon0, ActionOpenedCannon1, ActionOpenedCannon2,
|
||||
ActionOpenedCannon3, ActionOpenedCannon4, ActionOpenedCannon5,
|
||||
ActionOpenedCannon6 };
|
||||
void (*sOpenedCannonActions[])(void) = { opened_cannon_act_0, opened_cannon_act_1, opened_cannon_act_2,
|
||||
opened_cannon_act_3, opened_cannon_act_4, opened_cannon_act_5,
|
||||
opened_cannon_act_6 };
|
||||
|
||||
u8 unused0EA1FC[] = { 2, 0, 0, 0, 0, 0, 0, 0, 63, 128, 0, 0, 2, 0, 0, 0, 65, 32, 0, 0,
|
||||
63, 128, 0, 0, 2, 0, 0, 0, 65, 160, 0, 0, 63, 128, 0, 0, 2, 0, 0, 0,
|
||||
65, 160, 0, 0, 63, 128, 0, 0, 8, 0, 0, 0, 65, 32, 0, 0, 63, 128, 0, 0 };
|
||||
|
||||
void bhv_cannon_base_loop(void) {
|
||||
obj_call_action_function(sOpenedCannonActions);
|
||||
cur_obj_call_action_function(sOpenedCannonActions);
|
||||
if (o->oCannonUnkF8)
|
||||
o->oCannonUnkF8++;
|
||||
o->oInteractStatus = 0;
|
||||
@@ -121,10 +121,10 @@ void bhv_cannon_base_loop(void) {
|
||||
void bhv_cannon_barrel_loop(void) {
|
||||
struct Object *parent = o->parentObj;
|
||||
if (parent->header.gfx.node.flags & GRAPH_RENDER_ACTIVE) {
|
||||
obj_enable_rendering();
|
||||
copy_object_pos(o, o->parentObj);
|
||||
cur_obj_enable_rendering();
|
||||
obj_copy_pos(o, o->parentObj);
|
||||
o->oMoveAngleYaw = o->parentObj->oMoveAngleYaw;
|
||||
o->oFaceAnglePitch = o->parentObj->oMoveAnglePitch;
|
||||
} else
|
||||
obj_disable_rendering();
|
||||
cur_obj_disable_rendering();
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ void bhv_cannon_closed_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void CannonTrapDoorOpeningLoop(void) {
|
||||
void cannon_door_act_opening(void) {
|
||||
if (o->oTimer == 0)
|
||||
PlaySound2(SOUND_GENERAL_CANNON_UP);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_CANNON_UP);
|
||||
|
||||
if (o->oTimer < 30) {
|
||||
o->oVelY = -0.5f;
|
||||
@@ -55,7 +55,7 @@ void bhv_cannon_closed_loop(void) {
|
||||
break;
|
||||
|
||||
case CANNON_TRAP_DOOR_ACT_OPENING:
|
||||
CannonTrapDoorOpeningLoop();
|
||||
cannon_door_act_opening();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ static struct ObjectHitbox sCapHitbox = {
|
||||
/* hurtboxHeight: */ 90,
|
||||
};
|
||||
|
||||
s32 func_802F0904(void) {
|
||||
set_object_hitbox(o, &sCapHitbox);
|
||||
s32 cap_set_hitbox(void) {
|
||||
obj_set_hitbox(o, &sCapHitbox);
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED) {
|
||||
o->activeFlags = 0;
|
||||
o->oInteractStatus = 0;
|
||||
@@ -23,13 +23,13 @@ s32 func_802F0904(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void func_802F0978(void) {
|
||||
void cap_despawn(void) {
|
||||
if (o->oTimer > 300) {
|
||||
obj_flicker_and_disappear(o, 300);
|
||||
}
|
||||
}
|
||||
|
||||
void func_802F09C0(void) {
|
||||
void cap_check_quicksand(void) {
|
||||
if (sObjFloor == NULL)
|
||||
return;
|
||||
|
||||
@@ -74,7 +74,7 @@ void func_802F09C0(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802F0B68(void) {
|
||||
void cap_sink_quicksand(void) {
|
||||
switch (o->oAction) {
|
||||
case 10:
|
||||
if (o->oTimer < 10) {
|
||||
@@ -106,7 +106,7 @@ void func_802F0B68(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
func_802F09C0();
|
||||
cap_check_quicksand();
|
||||
}
|
||||
|
||||
void bhv_wing_cap_init(void) {
|
||||
@@ -116,7 +116,7 @@ void bhv_wing_cap_init(void) {
|
||||
o->oOpacity = 255;
|
||||
}
|
||||
|
||||
void func_802F0D70(void) {
|
||||
void cap_scale_vertically(void) {
|
||||
o->oCapUnkF8 += 0x2000;
|
||||
o->header.gfx.scale[1] = coss(o->oCapUnkF8) * 0.3 + 0.7;
|
||||
if (o->oCapUnkF8 == 0x10000) {
|
||||
@@ -125,13 +125,13 @@ void func_802F0D70(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802F0E0C(void) {
|
||||
void wing_vanish_cap_act_0(void) {
|
||||
s16 sp1E;
|
||||
|
||||
o->oFaceAngleYaw += o->oForwardVel * 128.0f;
|
||||
sp1E = object_step();
|
||||
if (sp1E & 0x01) {
|
||||
func_802F09C0();
|
||||
cap_check_quicksand();
|
||||
if (o->oVelY != 0.0f) {
|
||||
o->oCapUnkF4 = 1;
|
||||
o->oVelY = 0.0f;
|
||||
@@ -139,26 +139,26 @@ void func_802F0E0C(void) {
|
||||
}
|
||||
|
||||
if (o->oCapUnkF4 == 1)
|
||||
func_802F0D70();
|
||||
cap_scale_vertically();
|
||||
}
|
||||
|
||||
void bhv_wing_vanish_cap_loop(void) {
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
func_802F0E0C();
|
||||
wing_vanish_cap_act_0();
|
||||
break;
|
||||
|
||||
default:
|
||||
object_step();
|
||||
func_802F0B68();
|
||||
cap_sink_quicksand();
|
||||
break;
|
||||
}
|
||||
|
||||
if (o->oTimer > 20)
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
|
||||
func_802F0978();
|
||||
func_802F0904();
|
||||
cap_despawn();
|
||||
cap_set_hitbox();
|
||||
}
|
||||
|
||||
void bhv_metal_cap_init(void) {
|
||||
@@ -168,32 +168,32 @@ void bhv_metal_cap_init(void) {
|
||||
o->oOpacity = 0xFF;
|
||||
}
|
||||
|
||||
void func_802F0FE0(void) {
|
||||
void metal_cap_act_0(void) {
|
||||
s16 sp1E;
|
||||
|
||||
o->oFaceAngleYaw += o->oForwardVel * 128.0f;
|
||||
sp1E = object_step();
|
||||
if (sp1E & 0x01)
|
||||
func_802F09C0();
|
||||
cap_check_quicksand();
|
||||
}
|
||||
|
||||
void bhv_metal_cap_loop(void) {
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
func_802F0FE0();
|
||||
metal_cap_act_0();
|
||||
break;
|
||||
|
||||
default:
|
||||
object_step();
|
||||
func_802F0B68();
|
||||
cap_sink_quicksand();
|
||||
break;
|
||||
}
|
||||
|
||||
if (o->oTimer > 20)
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
|
||||
func_802F0904();
|
||||
func_802F0978();
|
||||
cap_set_hitbox();
|
||||
cap_despawn();
|
||||
}
|
||||
|
||||
void bhv_normal_cap_init(void) {
|
||||
@@ -205,7 +205,7 @@ void bhv_normal_cap_init(void) {
|
||||
save_file_set_cap_pos(o->oPosX, o->oPosY, o->oPosZ);
|
||||
}
|
||||
|
||||
void func_802F1190(void) {
|
||||
void normal_cap_set_save_flags(void) {
|
||||
save_file_clear_flags(SAVE_FLAG_CAP_ON_GROUND);
|
||||
|
||||
switch (gCurrCourseNum) {
|
||||
@@ -227,14 +227,14 @@ void func_802F1190(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802F1234(void) {
|
||||
void normal_cap_act_0(void) {
|
||||
s16 sp1E;
|
||||
|
||||
o->oFaceAngleYaw += o->oForwardVel * 128.0f;
|
||||
o->oFaceAnglePitch += o->oForwardVel * 80.0f;
|
||||
sp1E = object_step();
|
||||
if (sp1E & 0x01) {
|
||||
func_802F09C0();
|
||||
cap_check_quicksand();
|
||||
|
||||
if (o->oVelY != 0.0f) {
|
||||
o->oCapUnkF4 = 1;
|
||||
@@ -244,18 +244,18 @@ void func_802F1234(void) {
|
||||
}
|
||||
|
||||
if (o->oCapUnkF4 == 1)
|
||||
func_802F0D70();
|
||||
cap_scale_vertically();
|
||||
}
|
||||
|
||||
void bhv_normal_cap_loop(void) {
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
func_802F1234();
|
||||
normal_cap_act_0();
|
||||
break;
|
||||
|
||||
default:
|
||||
object_step();
|
||||
func_802F0B68();
|
||||
cap_sink_quicksand();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -263,9 +263,9 @@ void bhv_normal_cap_loop(void) {
|
||||
save_file_set_cap_pos(o->oPosX, o->oPosY, o->oPosZ);
|
||||
|
||||
if (o->activeFlags == 0)
|
||||
func_802F1190();
|
||||
normal_cap_set_save_flags();
|
||||
|
||||
if (func_802F0904() == 1)
|
||||
if (cap_set_hitbox() == 1)
|
||||
save_file_clear_flags(SAVE_FLAG_CAP_ON_GROUND);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// capswitch.c.inc
|
||||
|
||||
void ActionActivateCapSwitch0(void) {
|
||||
void cap_switch_act_0(void) {
|
||||
o->oAnimState = o->oBehParams2ndByte;
|
||||
obj_scale(0.5f);
|
||||
cur_obj_scale(0.5f);
|
||||
o->oPosY += 71.0f;
|
||||
spawn_object_relative_with_scale(0, 0, -71, 0, 0.5f, o, MODEL_CAP_SWITCH_BASE, bhvCapSwitchBase);
|
||||
if (gCurrLevelNum != LEVEL_UNKNOWN_32) {
|
||||
@@ -15,51 +15,36 @@ void ActionActivateCapSwitch0(void) {
|
||||
o->oAction = 1;
|
||||
}
|
||||
|
||||
void ActionActivateCapSwitch1(void) {
|
||||
if (obj_is_mario_on_platform()) {
|
||||
void cap_switch_act_1(void) {
|
||||
if (cur_obj_is_mario_on_platform()) {
|
||||
save_file_set_flags(D_8032F0C0[o->oBehParams2ndByte]);
|
||||
o->oAction = 2;
|
||||
PlaySound2(SOUND_GENERAL_ACTIVATE_CAP_SWITCH);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_ACTIVATE_CAP_SWITCH);
|
||||
}
|
||||
}
|
||||
|
||||
void ActionActivateCapSwitch2(void) {
|
||||
void cap_switch_act_2(void) {
|
||||
s32 sp1C;
|
||||
if (o->oTimer < 5) {
|
||||
func_802A3398(2, 4, 0.5f, 0.1f);
|
||||
cur_obj_scale_over_time(2, 4, 0.5f, 0.1f);
|
||||
if (o->oTimer == 4) {
|
||||
ShakeScreen(SHAKE_POS_SMALL);
|
||||
func_802A3004();
|
||||
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
||||
spawn_mist_particles();
|
||||
spawn_triangle_break_particles(60, 139, 0.3f, o->oBehParams2ndByte);
|
||||
}
|
||||
} else {
|
||||
sp1C = obj_update_dialog_with_cutscene(1, 0x0C, CUTSCENE_CAP_SWITCH_PRESS, 0);
|
||||
sp1C = cur_obj_update_dialog_with_cutscene(1, 0x0C, CUTSCENE_CAP_SWITCH_PRESS, 0);
|
||||
if (sp1C)
|
||||
o->oAction = 3;
|
||||
}
|
||||
}
|
||||
|
||||
void ActionActivateCapSwitch3() {
|
||||
void cap_switch_act_3() {
|
||||
} // dead function
|
||||
|
||||
void (*sCapSwitchActions[])(void) = { ActionActivateCapSwitch0, ActionActivateCapSwitch1,
|
||||
ActionActivateCapSwitch2, ActionActivateCapSwitch3 };
|
||||
void (*sCapSwitchActions[])(void) = { cap_switch_act_0, cap_switch_act_1,
|
||||
cap_switch_act_2, cap_switch_act_3 };
|
||||
|
||||
void bhv_cap_switch_loop(void) {
|
||||
obj_call_action_function(sCapSwitchActions);
|
||||
}
|
||||
|
||||
Gfx *Geo18_802A719C(s32 run, UNUSED struct GraphNode *node, Mat4 mtx) {
|
||||
Mat4 sp20;
|
||||
struct Object *sp1C;
|
||||
|
||||
if (run == TRUE) {
|
||||
sp1C = (struct Object *) gCurGraphNodeObject;
|
||||
if (sp1C->prevObj != NULL) {
|
||||
func_8029D704(sp20, mtx, gCurGraphNodeCamera->matrixPtr);
|
||||
func_8029D558(sp20, sp1C->prevObj);
|
||||
func_8029EA0C(sp1C->prevObj);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
cur_obj_call_action_function(sCapSwitchActions);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ void bhv_castle_floor_trap_open_detect(void) {
|
||||
|
||||
void bhv_castle_floor_trap_open(void) {
|
||||
if (o->oTimer == 0)
|
||||
PlaySound2(SOUND_GENERAL_CASTLE_TRAP_OPEN);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_CASTLE_TRAP_OPEN);
|
||||
o->oAngleVelRoll -= 0x100;
|
||||
o->oFaceAngleRoll += o->oAngleVelRoll;
|
||||
if (o->oFaceAngleRoll < -0x4000) {
|
||||
|
||||
@@ -11,24 +11,24 @@ void bhv_celebration_star_init(void) {
|
||||
o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_BOWSER_KEY];
|
||||
o->oFaceAnglePitch = 0;
|
||||
o->oFaceAngleRoll = 49152;
|
||||
obj_scale(0.1f);
|
||||
cur_obj_scale(0.1f);
|
||||
o->oCelebStarUnkF4 = 1;
|
||||
} else {
|
||||
o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_STAR];
|
||||
o->oFaceAnglePitch = 0;
|
||||
o->oFaceAngleRoll = 0;
|
||||
obj_scale(0.4f);
|
||||
cur_obj_scale(0.4f);
|
||||
o->oCelebStarUnkF4 = 0;
|
||||
}
|
||||
#else
|
||||
o->header.gfx.sharedChild = gLoadedGraphNodes[MODEL_STAR];
|
||||
obj_scale(0.4f);
|
||||
cur_obj_scale(0.4f);
|
||||
o->oFaceAnglePitch = 0;
|
||||
o->oFaceAngleRoll = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CelebrationStarSpinAroundMarioLoop(void) {
|
||||
void celeb_star_act_spin_around_mario(void) {
|
||||
o->oPosX = o->oHomeX + sins(o->oMoveAngleYaw) * (f32)(o->oCelebStarDiameterOfRotation / 2);
|
||||
o->oPosZ = o->oHomeZ + coss(o->oMoveAngleYaw) * (f32)(o->oCelebStarDiameterOfRotation / 2);
|
||||
o->oPosY += 5.0f;
|
||||
@@ -44,17 +44,17 @@ void CelebrationStarSpinAroundMarioLoop(void) {
|
||||
o->oCelebStarDiameterOfRotation -= 20;
|
||||
}
|
||||
|
||||
void CelebrationStarFaceCameraLoop(void) {
|
||||
void celeb_star_act_face_camera(void) {
|
||||
|
||||
if (o->oTimer < 10) {
|
||||
#if BUGFIX_STAR_BOWSER_KEY
|
||||
if (o->oCelebStarUnkF4 == 0) {
|
||||
obj_scale((f32) o->oTimer / 10.0);
|
||||
cur_obj_scale((f32) o->oTimer / 10.0);
|
||||
} else {
|
||||
obj_scale((f32) o->oTimer / 30.0);
|
||||
cur_obj_scale((f32) o->oTimer / 30.0);
|
||||
}
|
||||
#else
|
||||
obj_scale((f32) o->oTimer / 10.0);
|
||||
cur_obj_scale((f32) o->oTimer / 10.0);
|
||||
#endif
|
||||
o->oFaceAngleYaw += 0x1000;
|
||||
} else {
|
||||
@@ -68,11 +68,11 @@ void CelebrationStarFaceCameraLoop(void) {
|
||||
void bhv_celebration_star_loop(void) {
|
||||
switch (o->oAction) {
|
||||
case CELEB_STAR_ACT_SPIN_AROUND_MARIO:
|
||||
CelebrationStarSpinAroundMarioLoop();
|
||||
celeb_star_act_spin_around_mario();
|
||||
break;
|
||||
|
||||
case CELEB_STAR_ACT_FACE_CAMERA:
|
||||
CelebrationStarFaceCameraLoop();
|
||||
celeb_star_act_face_camera();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -85,6 +85,6 @@ void bhv_celebration_star_sparkle_loop(void) {
|
||||
}
|
||||
|
||||
void bhv_star_key_collection_puff_spawner_loop(void) {
|
||||
func_802AA618(0, 10, 30.0f);
|
||||
spawn_mist_particles_variable(0, 10, 30.0f);
|
||||
o->activeFlags = 0;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ void bhv_chain_chomp_chain_part_update(void) {
|
||||
struct ChainSegment *segment;
|
||||
|
||||
if (o->parentObj->oAction == CHAIN_CHOMP_ACT_UNLOAD_CHAIN) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else if (o->oBehParams2ndByte != CHAIN_CHOMP_CHAIN_PART_BP_PIVOT) {
|
||||
segment = &o->parentObj->oChainChompSegments[o->oBehParams2ndByte];
|
||||
|
||||
@@ -41,8 +41,8 @@ void bhv_chain_chomp_chain_part_update(void) {
|
||||
o->oPosZ = o->parentObj->parentObj->oPosZ + segment->posZ;
|
||||
;
|
||||
} else if (o->parentObj->oChainChompReleaseStatus != CHAIN_CHOMP_NOT_RELEASED) {
|
||||
obj_update_floor_and_walls();
|
||||
obj_move_standard(78);
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_move_standard(78);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ static void chain_chomp_act_uninitialized(void) {
|
||||
chain_segment_init(&segments[i]);
|
||||
}
|
||||
|
||||
obj_set_pos_to_home();
|
||||
cur_obj_set_pos_to_home();
|
||||
|
||||
// Spawn the pivot and set to parent
|
||||
if ((o->parentObj =
|
||||
@@ -78,7 +78,7 @@ static void chain_chomp_act_uninitialized(void) {
|
||||
}
|
||||
|
||||
o->oAction = CHAIN_CHOMP_ACT_MOVE;
|
||||
obj_unhide();
|
||||
cur_obj_unhide();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,15 +174,15 @@ static void chain_chomp_sub_act_turn(void) {
|
||||
obj_move_pitch_approach(0, 0x100);
|
||||
|
||||
if (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) {
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 0x400);
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x400);
|
||||
if (abs_angle_diff(o->oAngleToMario, o->oMoveAngleYaw) < 0x800) {
|
||||
if (o->oTimer > 30) {
|
||||
if (obj_check_anim_frame(0)) {
|
||||
func_8029F6F0();
|
||||
if (cur_obj_check_anim_frame(0)) {
|
||||
cur_obj_reverse_animation();
|
||||
if (o->oTimer > 40) {
|
||||
// Increase the maximum distance from the pivot and enter
|
||||
// the lunging sub-action.
|
||||
PlaySound2(SOUND_GENERAL_CHAIN_CHOMP2);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_CHAIN_CHOMP2);
|
||||
|
||||
o->oSubAction = CHAIN_CHOMP_SUB_ACT_LUNGE;
|
||||
o->oChainChompMaxDistFromPivotPerChainPart = 900.0f / 5;
|
||||
@@ -199,12 +199,12 @@ static void chain_chomp_sub_act_turn(void) {
|
||||
o->oForwardVel = 0.0f;
|
||||
}
|
||||
} else {
|
||||
PlaySound2(SOUND_GENERAL_CHAIN_CHOMP1);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_CHAIN_CHOMP1);
|
||||
o->oForwardVel = 10.0f;
|
||||
o->oVelY = 20.0f;
|
||||
}
|
||||
} else {
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 0x190);
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x190);
|
||||
o->oTimer = 0;
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ static void chain_chomp_sub_act_lunge(void) {
|
||||
;
|
||||
} else {
|
||||
// Turn toward pivot
|
||||
obj_rotate_yaw_toward(atan2s(o->oChainChompSegments[0].posZ, o->oChainChompSegments[0].posX),
|
||||
cur_obj_rotate_yaw_toward(atan2s(o->oChainChompSegments[0].posZ, o->oChainChompSegments[0].posX),
|
||||
0x1000);
|
||||
|
||||
if (o->oChainChompUnk104 != 0.0f) {
|
||||
@@ -247,7 +247,7 @@ static void chain_chomp_sub_act_lunge(void) {
|
||||
}
|
||||
|
||||
if (o->oTimer < 30) {
|
||||
func_8029F6F0();
|
||||
cur_obj_reverse_animation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ static void chain_chomp_released_lunge_around(void) {
|
||||
if (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) {
|
||||
// Before first bounce, turn toward mario and wait 2 seconds
|
||||
if (o->oChainChompNumLunges == 0) {
|
||||
if (obj_rotate_yaw_toward(o->oAngleToMario, 0x320)) {
|
||||
if (cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x320)) {
|
||||
if (o->oTimer > 60) {
|
||||
o->oChainChompNumLunges += 1;
|
||||
// enable wall collision
|
||||
@@ -289,7 +289,7 @@ static void chain_chomp_released_lunge_around(void) {
|
||||
}
|
||||
} else {
|
||||
if (++o->oChainChompNumLunges <= 5) {
|
||||
PlaySound2(SOUND_GENERAL_CHAIN_CHOMP1);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_CHAIN_CHOMP1);
|
||||
o->oMoveAngleYaw = o->oAngleToMario + RandomSign() * 0x2000;
|
||||
o->oForwardVel = 30.0f;
|
||||
o->oVelY = 50.0f;
|
||||
@@ -297,8 +297,8 @@ static void chain_chomp_released_lunge_around(void) {
|
||||
o->oChainChompReleaseStatus = CHAIN_CHOMP_RELEASED_BREAK_GATE;
|
||||
o->oHomeX = 1450.0f;
|
||||
o->oHomeZ = 562.0f;
|
||||
o->oMoveAngleYaw = obj_angle_to_home();
|
||||
o->oForwardVel = obj_lateral_dist_to_home() / 8;
|
||||
o->oMoveAngleYaw = cur_obj_angle_to_home();
|
||||
o->oForwardVel = cur_obj_lateral_dist_to_home() / 8;
|
||||
o->oVelY = 50.0f;
|
||||
}
|
||||
}
|
||||
@@ -318,15 +318,15 @@ static void chain_chomp_released_break_gate(void) {
|
||||
// in a softlock
|
||||
if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
|
||||
o->oChainChompHitGate = TRUE;
|
||||
o->oMoveAngleYaw = obj_reflect_move_angle_off_wall();
|
||||
o->oMoveAngleYaw = cur_obj_reflect_move_angle_off_wall();
|
||||
o->oForwardVel *= 0.4f;
|
||||
}
|
||||
} else if (o->oMoveFlags & OBJ_MOVE_MASK_ON_GROUND) {
|
||||
o->oChainChompReleaseStatus = CHAIN_CHOMP_RELEASED_JUMP_AWAY;
|
||||
o->oHomeX = 3288.0f;
|
||||
o->oHomeZ = -1770.0f;
|
||||
o->oMoveAngleYaw = obj_angle_to_home();
|
||||
o->oForwardVel = obj_lateral_dist_to_home() / 50.0f;
|
||||
o->oMoveAngleYaw = cur_obj_angle_to_home();
|
||||
o->oForwardVel = cur_obj_lateral_dist_to_home() / 50.0f;
|
||||
o->oVelY = 120.0f;
|
||||
}
|
||||
}
|
||||
@@ -363,7 +363,7 @@ static void chain_chomp_act_move(void) {
|
||||
o->oAction = CHAIN_CHOMP_ACT_UNLOAD_CHAIN;
|
||||
o->oForwardVel = o->oVelY = 0.0f;
|
||||
} else {
|
||||
obj_update_floor_and_walls();
|
||||
cur_obj_update_floor_and_walls();
|
||||
|
||||
switch (o->oChainChompReleaseStatus) {
|
||||
case CHAIN_CHOMP_NOT_RELEASED:
|
||||
@@ -393,7 +393,7 @@ static void chain_chomp_act_move(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
obj_move_standard(78);
|
||||
cur_obj_move_standard(78);
|
||||
|
||||
// Segment 0 connects the pivot to the chain chomp itself
|
||||
o->oChainChompSegments[0].posX = o->oPosX - o->parentObj->oPosX;
|
||||
@@ -454,13 +454,13 @@ static void chain_chomp_act_move(void) {
|
||||
* themselves when they see that the chain chomp is in this action.
|
||||
*/
|
||||
static void chain_chomp_act_unload_chain(void) {
|
||||
obj_hide();
|
||||
cur_obj_hide();
|
||||
mem_pool_free(gObjectMemoryPool, o->oChainChompSegments);
|
||||
|
||||
o->oAction = CHAIN_CHOMP_ACT_UNINITIALIZED;
|
||||
|
||||
if (o->oChainChompReleaseStatus != CHAIN_CHOMP_NOT_RELEASED) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,13 +487,13 @@ void bhv_chain_chomp_update(void) {
|
||||
void bhv_wooden_post_update(void) {
|
||||
// When ground pounded by mario, drop by -45 + -20
|
||||
if (!o->oWoodenPostMarioPounding) {
|
||||
if ((o->oWoodenPostMarioPounding = obj_is_mario_ground_pounding_platform())) {
|
||||
PlaySound2(SOUND_GENERAL_POUND_WOOD_POST);
|
||||
if ((o->oWoodenPostMarioPounding = cur_obj_is_mario_ground_pounding_platform())) {
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_POUND_WOOD_POST);
|
||||
o->oWoodenPostSpeedY = -70.0f;
|
||||
}
|
||||
} else if (approach_f32_ptr(&o->oWoodenPostSpeedY, 0.0f, 25.0f)) {
|
||||
// Stay still until mario is done ground pounding
|
||||
o->oWoodenPostMarioPounding = obj_is_mario_ground_pounding_platform();
|
||||
o->oWoodenPostMarioPounding = cur_obj_is_mario_ground_pounding_platform();
|
||||
} else if ((o->oWoodenPostOffsetY += o->oWoodenPostSpeedY) < -190.0f) {
|
||||
// Once pounded, if this is the chain chomp's post, release the chain
|
||||
// chomp
|
||||
@@ -516,7 +516,7 @@ void bhv_wooden_post_update(void) {
|
||||
// coins
|
||||
o->oWoodenPostTotalMarioAngle += (s16)(o->oAngleToMario - o->oWoodenPostPrevAngleToMario);
|
||||
if (absi(o->oWoodenPostTotalMarioAngle) > 0x30000 && o->oTimer < 200) {
|
||||
spawn_object_loot_yellow_coins(o, 5, 20.0f);
|
||||
obj_spawn_loot_yellow_coins(o, 5, 20.0f);
|
||||
set_object_respawn_info_bits(o, 1);
|
||||
}
|
||||
}
|
||||
@@ -529,7 +529,7 @@ void bhv_wooden_post_update(void) {
|
||||
* Init function for chain chomp gate.
|
||||
*/
|
||||
void bhv_chain_chomp_gate_init(void) {
|
||||
o->parentObj = obj_nearest_object_with_behavior(bhvChainChomp);
|
||||
o->parentObj = cur_obj_nearest_object_with_behavior(bhvChainChomp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -537,10 +537,10 @@ void bhv_chain_chomp_gate_init(void) {
|
||||
*/
|
||||
void bhv_chain_chomp_gate_update(void) {
|
||||
if (o->parentObj->oChainChompHitGate) {
|
||||
func_802A3034(SOUND_GENERAL_WALL_EXPLOSION);
|
||||
spawn_mist_particles_with_sound(SOUND_GENERAL_WALL_EXPLOSION);
|
||||
set_camera_shake_from_point(SHAKE_POS_SMALL, o->oPosX, o->oPosY, o->oPosZ);
|
||||
func_802AA618(0, 0x7F, 200.0f);
|
||||
spawn_mist_particles_variable(0, 0x7F, 200.0f);
|
||||
spawn_triangle_break_particles(30, 0x8A, 3.0f, 4);
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
struct Struct8032F754 D_8032F754[] = { { 145, { 0.7f, 1.5f, 0.7f }, 7.0f },
|
||||
{ 235, { 1.2f, 2.0f, 1.2f }, 11.6f } };
|
||||
|
||||
void func_802B8F7C(Vec3f dest, Vec3f src) {
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
}
|
||||
|
||||
void bhv_checkerboard_elevator_group_init(void) {
|
||||
s32 sp3C;
|
||||
s32 sp38;
|
||||
@@ -28,11 +22,11 @@ void bhv_checkerboard_elevator_group_init(void) {
|
||||
sp2C = spawn_object_relative(i, 0, i * sp3C, sp38, o, MODEL_CHECKERBOARD_PLATFORM,
|
||||
bhvCheckerboardPlatformSub);
|
||||
sp2C->oCheckerBoardPlatformUnk1AC = D_8032F754[sp34].unk2;
|
||||
func_802B8F7C(sp2C->header.gfx.scale, D_8032F754[sp34].unk1);
|
||||
vec3f_copy_2(sp2C->header.gfx.scale, D_8032F754[sp34].unk1);
|
||||
}
|
||||
}
|
||||
|
||||
void func_802B9120(UNUSED s32 unused, f32 vel, s32 a2) {
|
||||
void checkerboard_plat_act_move_y(UNUSED s32 unused, f32 vel, s32 a2) {
|
||||
o->oMoveAnglePitch = 0;
|
||||
o->oAngleVelPitch = 0;
|
||||
o->oForwardVel = 0.0f;
|
||||
@@ -41,7 +35,7 @@ void func_802B9120(UNUSED s32 unused, f32 vel, s32 a2) {
|
||||
o->oAction++;
|
||||
}
|
||||
|
||||
void func_802B91A0(s32 a0, s16 a1) {
|
||||
void checkerboard_plat_act_rotate(s32 a0, s16 a1) {
|
||||
o->oVelY = 0.0f;
|
||||
o->oAngleVelPitch = a1;
|
||||
if (o->oTimer + 1 == 0x8000 / absi(a1))
|
||||
@@ -57,7 +51,7 @@ void bhv_checkerboard_platform_loop(void) {
|
||||
f32 sp24 = o->oCheckerBoardPlatformUnk1AC;
|
||||
o->oCheckerBoardPlatformUnkF8 = 0;
|
||||
if (o->oDistanceToMario < 1000.0f)
|
||||
PlaySound(SOUND_ENV_ELEVATOR4);
|
||||
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4);
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
if (o->oBehParams2ndByte == 0)
|
||||
@@ -66,16 +60,16 @@ void bhv_checkerboard_platform_loop(void) {
|
||||
o->oAction = 3;
|
||||
break;
|
||||
case 1:
|
||||
func_802B9120(2, 10.0f, o->oCheckerBoardPlatformUnkFC);
|
||||
checkerboard_plat_act_move_y(2, 10.0f, o->oCheckerBoardPlatformUnkFC);
|
||||
break;
|
||||
case 2:
|
||||
func_802B91A0(3, 512);
|
||||
checkerboard_plat_act_rotate(3, 512);
|
||||
break;
|
||||
case 3:
|
||||
func_802B9120(4, -10.0f, o->oCheckerBoardPlatformUnkFC);
|
||||
checkerboard_plat_act_move_y(4, -10.0f, o->oCheckerBoardPlatformUnkFC);
|
||||
break;
|
||||
case 4:
|
||||
func_802B91A0(1, -512);
|
||||
checkerboard_plat_act_rotate(1, -512);
|
||||
break;
|
||||
}
|
||||
o->oMoveAnglePitch += absi(o->oAngleVelPitch);
|
||||
@@ -88,8 +82,8 @@ void bhv_checkerboard_platform_loop(void) {
|
||||
if (o->oCheckerBoardPlatformUnkF8 == 1) {
|
||||
o->oAngleVelPitch = 0;
|
||||
o->oFaceAnglePitch &= ~0x7FFF;
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
} else
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
load_object_collision_model();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// chuckya.c.inc
|
||||
|
||||
void func_802A8D18(f32 sp28, f32 sp2C, s32 sp30) {
|
||||
void common_anchor_mario_behavior(f32 sp28, f32 sp2C, s32 sp30) {
|
||||
switch (o->parentObj->oChuckyaUnk88) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
func_802A2008(gMarioObject, o);
|
||||
obj_set_gfx_pos_at_obj_pos(gMarioObject, o);
|
||||
break;
|
||||
case 2:
|
||||
gMarioObject->oInteractStatus |= (sp30 + INT_STATUS_MARIO_UNK2);
|
||||
@@ -23,30 +23,30 @@ void func_802A8D18(f32 sp28, f32 sp2C, s32 sp30) {
|
||||
}
|
||||
o->oMoveAngleYaw = o->parentObj->oMoveAngleYaw;
|
||||
if (!o->parentObj->activeFlags)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
void bhv_chuckya_anchor_mario_loop(void) {
|
||||
func_802A8D18(40.0f, 40.0f, 64);
|
||||
common_anchor_mario_behavior(40.0f, 40.0f, 64);
|
||||
}
|
||||
|
||||
s32 Unknown802A8EC8(s32 sp20, f32 sp24, f32 sp28, s32 sp2C) {
|
||||
s32 unknown_chuckya_function(s32 sp20, f32 sp24, f32 sp28, s32 sp2C) {
|
||||
s32 sp1C = 0;
|
||||
if (o->oChuckyaUnkF8 != 4) {
|
||||
if (sp24 < obj_lateral_dist_from_mario_to_home()) {
|
||||
if (obj_lateral_dist_to_home() < 200.0f)
|
||||
if (sp24 < cur_obj_lateral_dist_from_mario_to_home()) {
|
||||
if (cur_obj_lateral_dist_to_home() < 200.0f)
|
||||
sp1C = 0;
|
||||
else {
|
||||
sp1C = 1;
|
||||
o->oAngleToMario = obj_angle_to_home();
|
||||
o->oAngleToMario = cur_obj_angle_to_home();
|
||||
}
|
||||
} else if (o->oDistanceToMario > sp28) {
|
||||
if (gGlobalTimer % (s16) sp2C == 0)
|
||||
o->oAngleToMario = angle_to_object(o, gMarioObject);
|
||||
o->oAngleToMario = obj_angle_to_object(o, gMarioObject);
|
||||
sp1C = 2;
|
||||
} else
|
||||
sp1C = 3;
|
||||
if (sp20 && func_802C5A64(&o->oAngleToMario)) {
|
||||
if (sp20 && update_angle_from_move_flags(&o->oAngleToMario)) {
|
||||
sp1C = 4;
|
||||
o->oChuckyaUnkF8 = 4;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ s32 Unknown802A8EC8(s32 sp20, f32 sp24, f32 sp28, s32 sp2C) {
|
||||
return sp1C;
|
||||
}
|
||||
|
||||
s32 func_802A9050(f32 *arr, f32 spC, f32 sp10) {
|
||||
s32 approach_forward_vel(f32 *arr, f32 spC, f32 sp10) {
|
||||
s32 sp4 = 0;
|
||||
if (arr[0] > spC) {
|
||||
arr[0] -= sp10;
|
||||
@@ -70,18 +70,18 @@ s32 func_802A9050(f32 *arr, f32 spC, f32 sp10) {
|
||||
return sp4;
|
||||
}
|
||||
|
||||
void ActionChuckya0(void) {
|
||||
void chuckya_act_0(void) {
|
||||
s32 sp3C;
|
||||
UNUSED u8 pad[16];
|
||||
s32 sp28;
|
||||
if (o->oTimer == 0)
|
||||
o->oChuckyaUnkFC = 0;
|
||||
o->oAngleToMario = angle_to_object(o, gMarioObject);
|
||||
o->oAngleToMario = obj_angle_to_object(o, gMarioObject);
|
||||
switch (sp28 = o->oSubAction) {
|
||||
case 0:
|
||||
o->oForwardVel = 0;
|
||||
if (obj_lateral_dist_from_mario_to_home() < 2000.0f) {
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 0x400);
|
||||
if (cur_obj_lateral_dist_from_mario_to_home() < 2000.0f) {
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x400);
|
||||
if (o->oChuckyaUnkFC > 40
|
||||
|| abs_angle_diff(o->oMoveAngleYaw, o->oAngleToMario) < 0x1000)
|
||||
o->oSubAction = 1;
|
||||
@@ -89,26 +89,26 @@ void ActionChuckya0(void) {
|
||||
o->oSubAction = 3;
|
||||
break;
|
||||
case 1:
|
||||
func_802A9050(&o->oForwardVel, 30.0f, 4.0f);
|
||||
approach_forward_vel(&o->oForwardVel, 30.0f, 4.0f);
|
||||
if (abs_angle_diff(o->oMoveAngleYaw, o->oAngleToMario) > 0x4000)
|
||||
o->oSubAction = 2;
|
||||
if (obj_lateral_dist_from_mario_to_home() > 2000.0f)
|
||||
if (cur_obj_lateral_dist_from_mario_to_home() > 2000.0f)
|
||||
o->oSubAction = 3;
|
||||
break;
|
||||
case 2:
|
||||
func_802A9050(&o->oForwardVel, 0, 4.0f);
|
||||
approach_forward_vel(&o->oForwardVel, 0, 4.0f);
|
||||
if (o->oChuckyaUnkFC > 48)
|
||||
o->oSubAction = 0;
|
||||
break;
|
||||
case 3:
|
||||
if (obj_lateral_dist_to_home() < 500.0f)
|
||||
if (cur_obj_lateral_dist_to_home() < 500.0f)
|
||||
o->oForwardVel = 0;
|
||||
else {
|
||||
func_802A9050(&o->oForwardVel, 10.0f, 4.0f);
|
||||
o->oAngleToMario = obj_angle_to_home();
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 0x800);
|
||||
approach_forward_vel(&o->oForwardVel, 10.0f, 4.0f);
|
||||
o->oAngleToMario = cur_obj_angle_to_home();
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x800);
|
||||
}
|
||||
if (obj_lateral_dist_from_mario_to_home() < 1900.0f)
|
||||
if (cur_obj_lateral_dist_from_mario_to_home() < 1900.0f)
|
||||
o->oSubAction = 0;
|
||||
break;
|
||||
}
|
||||
@@ -116,16 +116,16 @@ void ActionChuckya0(void) {
|
||||
o->oChuckyaUnkFC = 0;
|
||||
else
|
||||
o->oChuckyaUnkFC++;
|
||||
set_obj_animation_and_sound_state(4);
|
||||
cur_obj_init_animation_with_sound(4);
|
||||
if (o->oForwardVel > 1.0f)
|
||||
PlaySound(SOUND_AIR_CHUCKYA_MOVE);
|
||||
cur_obj_play_sound_1(SOUND_AIR_CHUCKYA_MOVE);
|
||||
print_debug_bottom_up("fg %d", sp3C);
|
||||
print_debug_bottom_up("sp %d", o->oForwardVel);
|
||||
}
|
||||
|
||||
void ActionChuckya1(void) {
|
||||
void chuckya_act_1(void) {
|
||||
if (o->oSubAction == 0) {
|
||||
if (func_802A4AB0(0))
|
||||
if (cur_obj_init_animation_and_check_if_near_end(0))
|
||||
o->oSubAction++;
|
||||
o->oChuckyaUnkFC = RandomFloat() * 30.0f + 10.0f;
|
||||
o->oChuckyaUnk100 = 0;
|
||||
@@ -139,18 +139,18 @@ void ActionChuckya1(void) {
|
||||
o->oAction = 3;
|
||||
o->oInteractStatus &= ~(INT_STATUS_GRABBED_MARIO);
|
||||
} else {
|
||||
set_obj_animation_and_sound_state(1);
|
||||
cur_obj_init_animation_with_sound(1);
|
||||
o->oMoveAngleYaw += INT_STATUS_GRABBED_MARIO;
|
||||
if (o->oChuckyaUnkFC-- < 0)
|
||||
if (func_802B0C54(50.0f, 150.0f) || o->oChuckyaUnkFC < -16) {
|
||||
if (check_if_moving_over_floor(50.0f, 150.0f) || o->oChuckyaUnkFC < -16) {
|
||||
o->oSubAction++;
|
||||
;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
set_obj_animation_and_sound_state(3);
|
||||
if (obj_check_anim_frame(18)) {
|
||||
PlaySound2(SOUND_OBJ_UNKNOWN4);
|
||||
cur_obj_init_animation_with_sound(3);
|
||||
if (cur_obj_check_anim_frame(18)) {
|
||||
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN4);
|
||||
o->oChuckyaUnk88 = 2;
|
||||
o->oAction = 3;
|
||||
o->oInteractStatus &= ~(INT_STATUS_GRABBED_MARIO);
|
||||
@@ -159,50 +159,50 @@ void ActionChuckya1(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionChuckya3(void) {
|
||||
void chuckya_act_3(void) {
|
||||
o->oForwardVel = 0;
|
||||
o->oVelY = 0;
|
||||
set_obj_animation_and_sound_state(4);
|
||||
cur_obj_init_animation_with_sound(4);
|
||||
if (o->oTimer > 100)
|
||||
o->oAction = 0;
|
||||
}
|
||||
|
||||
void ActionChuckya2(void) {
|
||||
void chuckya_act_2(void) {
|
||||
if (o->oMoveFlags & (0x200 | 0x40 | 0x20 | 0x10 | 0x8 | 0x1)) {
|
||||
mark_object_for_deletion(o);
|
||||
spawn_object_loot_yellow_coins(o, 5, 20.0f);
|
||||
func_802A3034(SOUND_OBJ_CHUCKYA_DEATH);
|
||||
obj_mark_for_deletion(o);
|
||||
obj_spawn_loot_yellow_coins(o, 5, 20.0f);
|
||||
spawn_mist_particles_with_sound(SOUND_OBJ_CHUCKYA_DEATH);
|
||||
}
|
||||
}
|
||||
|
||||
void (*sChuckyaActions[])(void) = { ActionChuckya0, ActionChuckya1, ActionChuckya2, ActionChuckya3 };
|
||||
void (*sChuckyaActions[])(void) = { chuckya_act_0, chuckya_act_1, chuckya_act_2, chuckya_act_3 };
|
||||
|
||||
void func_802A97B8(void) {
|
||||
obj_update_floor_and_walls();
|
||||
obj_call_action_function(sChuckyaActions);
|
||||
obj_move_standard(-30);
|
||||
void chuckya_move(void) {
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_call_action_function(sChuckyaActions);
|
||||
cur_obj_move_standard(-30);
|
||||
if (o->oInteractStatus & INT_STATUS_GRABBED_MARIO) {
|
||||
o->oAction = 1;
|
||||
o->oChuckyaUnk88 = 1;
|
||||
PlaySound2(SOUND_OBJ_UNKNOWN3);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_UNKNOWN3);
|
||||
}
|
||||
}
|
||||
|
||||
void bhv_chuckya_loop(void) {
|
||||
f32 sp2C = 20.0f;
|
||||
f32 sp28 = 50.0f;
|
||||
obj_scale(2.0f);
|
||||
cur_obj_scale(2.0f);
|
||||
o->oInteractionSubtype |= INT_SUBTYPE_GRABS_MARIO;
|
||||
switch (o->oHeldState) {
|
||||
case HELD_FREE:
|
||||
func_802A97B8();
|
||||
chuckya_move();
|
||||
break;
|
||||
case HELD_HELD:
|
||||
func_8029FA5C(2, 0);
|
||||
cur_obj_unrender_and_reset_state(2, 0);
|
||||
break;
|
||||
case HELD_THROWN:
|
||||
case HELD_DROPPED:
|
||||
obj_get_thrown_or_placed(sp2C, sp28, 2);
|
||||
cur_obj_get_thrown_or_placed(sp2C, sp28, 2);
|
||||
break;
|
||||
}
|
||||
o->oInteractStatus = 0;
|
||||
|
||||
@@ -14,18 +14,18 @@ struct ObjectHitbox sClamShellHitbox = {
|
||||
|
||||
void clam_act_0(void) {
|
||||
if (func_802F92EC(0, 25)) {
|
||||
PlaySound2(SOUND_GENERAL_CLAM_SHELL3);
|
||||
func_802ADA94();
|
||||
obj_become_tangible();
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_CLAM_SHELL3);
|
||||
spawn_mist_from_global();
|
||||
cur_obj_become_tangible();
|
||||
|
||||
o->oClamUnkF4 = 10;
|
||||
o->oTimer = 0;
|
||||
} else if (o->oTimer > 150 && o->oDistanceToMario < 500.0f) {
|
||||
PlaySound2(SOUND_GENERAL_CLAM_SHELL2);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_CLAM_SHELL2);
|
||||
o->oAction = 1;
|
||||
} else if (o->oClamUnkF4 != 0) {
|
||||
o->oClamUnkF4 -= 1;
|
||||
obj_shake_y(3.0f);
|
||||
cur_obj_shake_y(3.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ void clam_act_1(void) {
|
||||
|
||||
spawn_object_relative(0, val04, 30, val02, o, MODEL_BUBBLE, bhvBubbleMaybe);
|
||||
}
|
||||
} else if (obj_check_anim_frame(30)) {
|
||||
obj_become_intangible();
|
||||
} else if (cur_obj_check_anim_frame(30)) {
|
||||
cur_obj_become_intangible();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ void bhv_rotating_clock_arm_loop(void) {
|
||||
|| marioSurface->type == SURFACE_TTC_PAINTING_2
|
||||
|| marioSurface->type == SURFACE_TTC_PAINTING_3)) {
|
||||
// And this is the minute hand...
|
||||
if (obj_has_behavior(bhvClockMinuteHand)) {
|
||||
if (cur_obj_has_behavior(bhvClockMinuteHand)) {
|
||||
// Set Tick Tick Clock's speed based on the angle of the hand.
|
||||
// The angle actually counting down from 0xFFFF to 0 so
|
||||
// 11 o'clock is a small value and 1 o'clock is a large value.
|
||||
@@ -46,5 +46,5 @@ void bhv_rotating_clock_arm_loop(void) {
|
||||
|
||||
// Only rotate the hands until Mario enters the painting.
|
||||
if (o->oAction < 2)
|
||||
obj_rotate_face_angle_using_vel();
|
||||
cur_obj_rotate_face_angle_using_vel();
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ static void cloud_act_spawn_parts(void) {
|
||||
// Spawn fwoosh's face
|
||||
spawn_object_relative(5, 0, 0, 0, o, MODEL_FWOOSH, bhvCloudPart);
|
||||
|
||||
obj_scale(3.0f);
|
||||
cur_obj_scale(3.0f);
|
||||
|
||||
o->oCloudCenterX = o->oPosX;
|
||||
o->oCloudCenterY = o->oPosY;
|
||||
@@ -48,7 +48,7 @@ static void cloud_act_spawn_parts(void) {
|
||||
*/
|
||||
static void cloud_act_fwoosh_hidden(void) {
|
||||
if (o->oDistanceToMario < 2000.0f) {
|
||||
obj_unhide();
|
||||
cur_obj_unhide();
|
||||
o->oAction = CLOUD_ACT_SPAWN_PARTS;
|
||||
}
|
||||
}
|
||||
@@ -69,10 +69,10 @@ static void cloud_fwoosh_update(void) {
|
||||
o->oCloudBlowing = o->oTimer = 0;
|
||||
} else if (o->oCloudGrowSpeed < -0.1f) {
|
||||
// Start blowing once we start shrinking faster than -0.1
|
||||
PlaySound(SOUND_AIR_BLOW_WIND);
|
||||
func_802C76E0(12, 3.0f, 0.0f, -50.0f, 120.0f);
|
||||
cur_obj_play_sound_1(SOUND_AIR_BLOW_WIND);
|
||||
cur_obj_spawn_strong_wind_particles(12, 3.0f, 0.0f, -50.0f, 120.0f);
|
||||
} else {
|
||||
PlaySound(SOUND_ENV_WIND1);
|
||||
cur_obj_play_sound_1(SOUND_ENV_WIND1);
|
||||
}
|
||||
} else {
|
||||
// Return to normal size
|
||||
@@ -94,7 +94,7 @@ static void cloud_fwoosh_update(void) {
|
||||
o->oCloudCenterY = o->oHomeY;
|
||||
}
|
||||
|
||||
obj_scale(o->header.gfx.scale[0]);
|
||||
cur_obj_scale(o->header.gfx.scale[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,11 +141,11 @@ static void cloud_act_main(void) {
|
||||
*/
|
||||
static void cloud_act_unload(void) {
|
||||
if (o->oBehParams2ndByte != CLOUD_BP_FWOOSH) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
o->oAction = CLOUD_ACT_FWOOSH_HIDDEN;
|
||||
obj_hide();
|
||||
obj_set_pos_to_home();
|
||||
cur_obj_hide();
|
||||
cur_obj_set_pos_to_home();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ void bhv_cloud_update(void) {
|
||||
*/
|
||||
void bhv_cloud_part_update(void) {
|
||||
if (o->parentObj->oAction == CLOUD_ACT_UNLOAD) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
f32 size = 2.0f / 3.0f * o->parentObj->header.gfx.scale[0];
|
||||
s16 angleFromCenter = o->parentObj->oFaceAngleYaw + 0x10000 / 5 * o->oBehParams2ndByte;
|
||||
@@ -185,7 +185,7 @@ void bhv_cloud_part_update(void) {
|
||||
|
||||
f32 cloudRadius;
|
||||
|
||||
obj_scale(size);
|
||||
cur_obj_scale(size);
|
||||
|
||||
// Cap fwoosh's face size
|
||||
if (o->oBehParams2ndByte == 5 && size > 2.0f) {
|
||||
|
||||
@@ -76,14 +76,14 @@ void coffin_act_idle(void) {
|
||||
|
||||
// If the coffin landed...
|
||||
if (obj_face_pitch_approach(0, -o->oAngleVelPitch)) {
|
||||
PlaySound2(SOUND_GENERAL_ELEVATOR_MOVE_2);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_ELEVATOR_MOVE_2);
|
||||
|
||||
// This bit changes the coffin's position,
|
||||
// spawns dust there, then resets the position.
|
||||
obj_perform_position_op(POS_OP_SAVE_POSITION);
|
||||
o->oMoveAngleYaw = o->oFaceAngleYaw - 0x4000;
|
||||
obj_set_dist_from_home(200.0f);
|
||||
func_802ADA94();
|
||||
spawn_mist_from_global();
|
||||
obj_perform_position_op(POS_OP_RESTORE_POSITION);
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ void coffin_act_idle(void) {
|
||||
&& (o->oDistanceToMario > 100.0f || gMarioState->action == ACT_SQUISHED)) {
|
||||
if (gMarioObject->oPosY - o->oPosY < 200.0f && absf(distForwards) < 140.0f) {
|
||||
if (distSideways < 150.0f && distSideways > -450.0f) {
|
||||
PlaySound2(SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_BUTTON_PRESS_2_LOWPRIO);
|
||||
o->oAction = COFFIN_ACT_STAND_UP;
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ void coffin_act_stand_up(void) {
|
||||
o->oFaceAngleRoll = 0;
|
||||
} else if (o->oTimer > 30) {
|
||||
if (gGlobalTimer % 4 == 0) {
|
||||
PlaySound2(SOUND_GENERAL_ELEVATOR_MOVE_2);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_ELEVATOR_MOVE_2);
|
||||
}
|
||||
// Shake the coffin while its standing
|
||||
o->oFaceAngleRoll = 400 * (gGlobalTimer % 2) - 200;
|
||||
@@ -148,7 +148,7 @@ void coffin_act_stand_up(void) {
|
||||
void bhv_coffin_loop(void) {
|
||||
// Gotta save those 6 object slots
|
||||
if (o->parentObj->oAction == COFFIN_SPAWNER_ACT_COFFINS_UNLOADED) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
// Scale the coffin vertically? Must have thought it was too short?
|
||||
o->header.gfx.scale[1] = 1.1f;
|
||||
|
||||
@@ -18,7 +18,7 @@ s16 D_8032F2A4[][2] = { { 0, -150 }, { 0, -50 }, { 0, 50 }, { 0, 150 },
|
||||
s32 bhv_coin_sparkles_init(void) {
|
||||
if (o->oInteractStatus & INT_STATUS_INTERACTED && !(o->oInteractStatus & INTERACT_TEXT)) {
|
||||
spawn_object(o, MODEL_SPARKLES, bhvGoldenCoinSparkles);
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
return 1;
|
||||
}
|
||||
o->oInteractStatus = 0;
|
||||
@@ -26,14 +26,14 @@ s32 bhv_coin_sparkles_init(void) {
|
||||
}
|
||||
|
||||
void bhv_yellow_coin_init(void) {
|
||||
obj_set_behavior(bhvYellowCoin);
|
||||
set_object_hitbox(o, &sYellowCoinHitbox);
|
||||
cur_obj_set_behavior(bhvYellowCoin);
|
||||
obj_set_hitbox(o, &sYellowCoinHitbox);
|
||||
bhv_init_room();
|
||||
obj_update_floor_height();
|
||||
cur_obj_update_floor_height();
|
||||
if (500.0f < absf(o->oPosY - o->oFloorHeight))
|
||||
obj_set_model(MODEL_YELLOW_COIN_NO_SHADOW);
|
||||
cur_obj_set_model(MODEL_YELLOW_COIN_NO_SHADOW);
|
||||
if (o->oFloorHeight < -10000.0f)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
void bhv_yellow_coin_loop(void) {
|
||||
@@ -43,8 +43,8 @@ void bhv_yellow_coin_loop(void) {
|
||||
|
||||
void bhv_temp_coin_loop(void) {
|
||||
o->oAnimState++;
|
||||
if (obj_wait_then_blink(200, 20))
|
||||
mark_object_for_deletion(o);
|
||||
if (cur_obj_wait_then_blink(200, 20))
|
||||
obj_mark_for_deletion(o);
|
||||
bhv_coin_sparkles_init();
|
||||
}
|
||||
|
||||
@@ -52,17 +52,17 @@ void bhv_coin_init(void) {
|
||||
o->oVelY = RandomFloat() * 10.0f + 30 + o->oCoinUnk110;
|
||||
o->oForwardVel = RandomFloat() * 10.0f;
|
||||
o->oMoveAngleYaw = RandomU16();
|
||||
obj_set_behavior(bhvYellowCoin);
|
||||
set_object_hitbox(o, &sYellowCoinHitbox);
|
||||
obj_become_intangible();
|
||||
cur_obj_set_behavior(bhvYellowCoin);
|
||||
obj_set_hitbox(o, &sYellowCoinHitbox);
|
||||
cur_obj_become_intangible();
|
||||
}
|
||||
|
||||
void bhv_coin_loop(void) {
|
||||
struct Surface *sp1C;
|
||||
s16 sp1A;
|
||||
obj_update_floor_and_walls();
|
||||
obj_if_hit_wall_bounce_away();
|
||||
obj_move_standard(-62);
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_if_hit_wall_bounce_away();
|
||||
cur_obj_move_standard(-62);
|
||||
if ((sp1C = o->oFloor) != NULL) {
|
||||
if (o->oMoveFlags & OBJ_MOVE_ON_GROUND)
|
||||
o->oSubAction = 1;
|
||||
@@ -70,70 +70,70 @@ void bhv_coin_loop(void) {
|
||||
o->oBounce = 0;
|
||||
if (sp1C->normal.y < 0.9) {
|
||||
sp1A = atan2s(sp1C->normal.z, sp1C->normal.x);
|
||||
obj_rotate_yaw_toward(sp1A, 0x400);
|
||||
cur_obj_rotate_yaw_toward(sp1A, 0x400);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (o->oTimer == 0)
|
||||
#ifdef VERSION_US
|
||||
PlaySound2(SOUND_GENERAL_COIN_SPURT_2);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_2);
|
||||
#elif VERSION_EU
|
||||
PlaySound2(SOUND_GENERAL_COIN_SPURT_EU);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT_EU);
|
||||
#else
|
||||
PlaySound2(SOUND_GENERAL_COIN_SPURT);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_COIN_SPURT);
|
||||
#endif
|
||||
if (o->oVelY < 0)
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
if (o->oMoveFlags & OBJ_MOVE_LANDED) {
|
||||
#ifndef VERSION_JP
|
||||
if (o->oMoveFlags & (OBJ_MOVE_ABOVE_DEATH_BARRIER | OBJ_MOVE_ABOVE_LAVA))
|
||||
#else
|
||||
if (o->oMoveFlags & OBJ_MOVE_ABOVE_LAVA)
|
||||
#endif
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
#ifndef VERSION_JP
|
||||
if (o->oMoveFlags & OBJ_MOVE_13) {
|
||||
if (o->oCoinUnk1B0 < 5)
|
||||
PlaySound2(0x30364081);
|
||||
cur_obj_play_sound_2(0x30364081);
|
||||
o->oCoinUnk1B0++;
|
||||
}
|
||||
#else
|
||||
if (o->oMoveFlags & OBJ_MOVE_13)
|
||||
PlaySound2(SOUND_GENERAL_COIN_DROP);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_COIN_DROP);
|
||||
#endif
|
||||
if (obj_wait_then_blink(400, 20))
|
||||
mark_object_for_deletion(o);
|
||||
if (cur_obj_wait_then_blink(400, 20))
|
||||
obj_mark_for_deletion(o);
|
||||
bhv_coin_sparkles_init();
|
||||
}
|
||||
|
||||
void bhv_coin_formation_spawn_loop(void) {
|
||||
if (o->oTimer == 0) {
|
||||
obj_set_behavior(bhvYellowCoin);
|
||||
set_object_hitbox(o, &sYellowCoinHitbox);
|
||||
cur_obj_set_behavior(bhvYellowCoin);
|
||||
obj_set_hitbox(o, &sYellowCoinHitbox);
|
||||
bhv_init_room();
|
||||
if (o->oCoinUnkF8) {
|
||||
o->oPosY += 300.0f;
|
||||
obj_update_floor_height();
|
||||
cur_obj_update_floor_height();
|
||||
if (o->oPosY < o->oFloorHeight || o->oFloorHeight < -10000.0f)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
else
|
||||
o->oPosY = o->oFloorHeight;
|
||||
} else {
|
||||
obj_update_floor_height();
|
||||
cur_obj_update_floor_height();
|
||||
if (absf(o->oPosY - o->oFloorHeight) > 250.0f)
|
||||
obj_set_model(MODEL_YELLOW_COIN_NO_SHADOW);
|
||||
cur_obj_set_model(MODEL_YELLOW_COIN_NO_SHADOW);
|
||||
}
|
||||
} else {
|
||||
if (bhv_coin_sparkles_init())
|
||||
o->parentObj->oCoinUnkF4 |= func_802A377C(o->oBehParams2ndByte);
|
||||
o->parentObj->oCoinUnkF4 |= bit_shift_left(o->oBehParams2ndByte);
|
||||
o->oAnimState++;
|
||||
}
|
||||
if (o->parentObj->oAction == 2)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
void func_802AB364(s32 sp50, s32 sp54) {
|
||||
void spawn_coin_in_formation(s32 sp50, s32 sp54) {
|
||||
struct Object *sp4C;
|
||||
Vec3i sp40;
|
||||
s32 sp3C = 1;
|
||||
@@ -187,7 +187,7 @@ void bhv_coin_formation_loop(void) {
|
||||
if (o->oDistanceToMario < 2000.0f) {
|
||||
for (bitIndex = 0; bitIndex < 8; bitIndex++) {
|
||||
if (!(o->oCoinUnkF4 & (1 << bitIndex)))
|
||||
func_802AB364(bitIndex, o->oBehParams2ndByte);
|
||||
spawn_coin_in_formation(bitIndex, o->oBehParams2ndByte);
|
||||
}
|
||||
o->oAction++;
|
||||
}
|
||||
@@ -205,34 +205,34 @@ void bhv_coin_formation_loop(void) {
|
||||
set_object_respawn_info_bits(o, o->oCoinUnkF4 & 0xFF);
|
||||
}
|
||||
|
||||
void ActionCoinInsideBoo1(void) {
|
||||
obj_update_floor_and_walls();
|
||||
obj_if_hit_wall_bounce_away();
|
||||
void coin_inside_boo_act_1(void) {
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_if_hit_wall_bounce_away();
|
||||
if (o->oMoveFlags & OBJ_MOVE_13)
|
||||
PlaySound2(SOUND_GENERAL_COIN_DROP);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_COIN_DROP);
|
||||
if (o->oTimer > 90 || (o->oMoveFlags & OBJ_MOVE_LANDED)) {
|
||||
set_object_hitbox(o, &sYellowCoinHitbox);
|
||||
obj_become_tangible();
|
||||
obj_set_behavior(bhvYellowCoin);
|
||||
obj_set_hitbox(o, &sYellowCoinHitbox);
|
||||
cur_obj_become_tangible();
|
||||
cur_obj_set_behavior(bhvYellowCoin);
|
||||
}
|
||||
obj_move_standard(-30);
|
||||
cur_obj_move_standard(-30);
|
||||
bhv_coin_sparkles_init();
|
||||
if (obj_has_model(MODEL_BLUE_COIN))
|
||||
if (cur_obj_has_model(MODEL_BLUE_COIN))
|
||||
o->oDamageOrCoinValue = 5;
|
||||
if (obj_wait_then_blink(400, 20))
|
||||
mark_object_for_deletion(o);
|
||||
if (cur_obj_wait_then_blink(400, 20))
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
void ActionCoinInsideBoo0(void) {
|
||||
void coin_inside_boo_act_0(void) {
|
||||
s16 sp26;
|
||||
f32 sp20;
|
||||
struct Object *parent = o->parentObj;
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
if (o->oTimer == 0 && gCurrLevelNum == LEVEL_BBH) {
|
||||
obj_set_model(MODEL_BLUE_COIN);
|
||||
obj_scale(0.7);
|
||||
cur_obj_set_model(MODEL_BLUE_COIN);
|
||||
cur_obj_scale(0.7);
|
||||
}
|
||||
copy_object_pos(o, parent);
|
||||
obj_copy_pos(o, parent);
|
||||
if (parent->oBooDeathStatus == BOO_DEATH_STATUS_DYING) {
|
||||
o->oAction = 1;
|
||||
sp26 = gMarioObject->oMoveAngleYaw;
|
||||
@@ -243,14 +243,14 @@ void ActionCoinInsideBoo0(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void (*sCoinInsideBooActions[])(void) = { ActionCoinInsideBoo0, ActionCoinInsideBoo1 };
|
||||
void (*sCoinInsideBooActions[])(void) = { coin_inside_boo_act_0, coin_inside_boo_act_1 };
|
||||
|
||||
void bhv_coin_inside_boo_loop(void) {
|
||||
obj_call_action_function(sCoinInsideBooActions);
|
||||
cur_obj_call_action_function(sCoinInsideBooActions);
|
||||
}
|
||||
|
||||
void bhv_coin_sparkles_loop(void) {
|
||||
obj_scale(0.6f);
|
||||
cur_obj_scale(0.6f);
|
||||
}
|
||||
|
||||
void bhv_golden_coin_sparkles_loop(void) {
|
||||
|
||||
@@ -11,15 +11,15 @@ void bhv_punch_tiny_triangle_loop(void) {
|
||||
if (o->oTimer == 0) {
|
||||
sp1E = o->oMoveAngleYaw;
|
||||
o->oCollisionParticleUnkF4 = 1.28f;
|
||||
obj_set_pos_relative(gMarioObject, 0.0f, 60.0f, 100.0f);
|
||||
o->oMoveAngleYaw = sp1E; // does obj_set_pos_relative modify currentObject?
|
||||
cur_obj_set_pos_relative(gMarioObject, 0.0f, 60.0f, 100.0f);
|
||||
o->oMoveAngleYaw = sp1E;
|
||||
}
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
o->oAnimState = 5;
|
||||
obj_scale(o->oCollisionParticleUnkF4);
|
||||
cur_obj_scale(o->oCollisionParticleUnkF4);
|
||||
o->oCollisionParticleUnkF4 -= 0.2f;
|
||||
if (gDebugInfo[4][0] + 6 < o->oTimer)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
void bhv_punch_tiny_triangle_init(void) {
|
||||
@@ -39,12 +39,12 @@ void bhv_wall_tiny_star_particle_loop(void) {
|
||||
if (o->oTimer == 0) {
|
||||
sp1E = o->oMoveAngleYaw;
|
||||
o->oCollisionParticleUnkF4 = 0.28f;
|
||||
obj_set_pos_relative(gMarioObject, 0.0f, 30.0f, 110.0f);
|
||||
cur_obj_set_pos_relative(gMarioObject, 0.0f, 30.0f, 110.0f);
|
||||
o->oMoveAngleYaw = sp1E;
|
||||
}
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
o->oAnimState = 4;
|
||||
obj_scale(o->oCollisionParticleUnkF4);
|
||||
cur_obj_scale(o->oCollisionParticleUnkF4);
|
||||
o->oCollisionParticleUnkF4 -= 0.015f;
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ void bhv_pound_tiny_star_particle_loop(void) {
|
||||
o->oPosY -= 20.0f;
|
||||
o->oVelY = 14.0f;
|
||||
}
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
o->oAnimState = 4;
|
||||
obj_scale(o->oCollisionParticleUnkF4);
|
||||
cur_obj_scale(o->oCollisionParticleUnkF4);
|
||||
o->oCollisionParticleUnkF4 -= 0.015f;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
static s8 D_80331694 = 0;
|
||||
|
||||
void func_802F3BD8(void) {
|
||||
void controllable_platform_act_1(void) {
|
||||
o->oParentRelativePosY -= 4.0f;
|
||||
if (o->oParentRelativePosY < 41.0f) {
|
||||
o->oParentRelativePosY = 41.0f;
|
||||
@@ -10,7 +10,7 @@ void func_802F3BD8(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802F3C50(void) {
|
||||
void controllable_platform_act_2(void) {
|
||||
if (o->oBehParams2ndByte == D_80331694)
|
||||
return;
|
||||
|
||||
@@ -30,16 +30,16 @@ void bhv_controllable_platform_sub_loop(void) {
|
||||
if (gMarioObject->platform == o) {
|
||||
D_80331694 = o->oBehParams2ndByte;
|
||||
o->oAction = 1;
|
||||
PlaySound2(SOUND_GENERAL_MOVING_PLATFORM_SWITCH);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_MOVING_PLATFORM_SWITCH);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
func_802F3BD8();
|
||||
controllable_platform_act_1();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
func_802F3C50();
|
||||
controllable_platform_act_2();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -70,22 +70,22 @@ void bhv_controllable_platform_init(void) {
|
||||
o->oControllablePlatformUnkFC = o->oPosY;
|
||||
}
|
||||
|
||||
void func_802F3F80(s8 sp1B) {
|
||||
void controllable_platform_hit_wall(s8 sp1B) {
|
||||
o->oControllablePlatformUnkF8 = sp1B;
|
||||
o->oTimer = 0;
|
||||
D_80331694 = 5;
|
||||
|
||||
PlaySound2(SOUND_GENERAL_QUIET_POUND1);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1);
|
||||
}
|
||||
|
||||
void func_802F3FD8(s8 sp1B, s8 sp1C[3], Vec3f sp20, UNUSED Vec3f sp24, Vec3f sp28) {
|
||||
void controllable_platform_check_walls(s8 sp1B, s8 sp1C[3], Vec3f sp20, UNUSED Vec3f sp24, Vec3f sp28) {
|
||||
if (sp1C[1] == 1 || (sp1C[0] == 1 && sp1C[2] == 1))
|
||||
func_802F3F80(sp1B);
|
||||
controllable_platform_hit_wall(sp1B);
|
||||
else {
|
||||
if (sp1C[0] == 1) {
|
||||
if (((sp1B == 1 || sp1B == 2) && (s32) sp20[2] != 0)
|
||||
|| ((sp1B == 3 || sp1B == 4) && (s32) sp20[0] != 0)) {
|
||||
func_802F3F80(sp1B);
|
||||
controllable_platform_hit_wall(sp1B);
|
||||
} else {
|
||||
o->oPosX += sp20[0];
|
||||
o->oPosZ += sp20[2];
|
||||
@@ -95,7 +95,7 @@ void func_802F3FD8(s8 sp1B, s8 sp1C[3], Vec3f sp20, UNUSED Vec3f sp24, Vec3f sp2
|
||||
if (sp1C[2] == 1) {
|
||||
if (((sp1B == 1 || sp1B == 2) && (s32) sp28[2] != 0)
|
||||
|| ((sp1B == 3 || sp1B == 4) && (s32) sp28[0] != 0)) {
|
||||
func_802F3F80(sp1B);
|
||||
controllable_platform_hit_wall(sp1B);
|
||||
} else {
|
||||
o->oPosX += sp28[0];
|
||||
o->oPosZ += sp28[2];
|
||||
@@ -110,7 +110,7 @@ void func_802F3FD8(s8 sp1B, s8 sp1C[3], Vec3f sp20, UNUSED Vec3f sp24, Vec3f sp2
|
||||
}
|
||||
}
|
||||
|
||||
void func_802F4230(void) {
|
||||
void controllable_platform_shake_on_wall_hit(void) {
|
||||
if (o->oControllablePlatformUnkF8 == 1 || o->oControllablePlatformUnkF8 == 2) {
|
||||
o->oFaceAnglePitch = sins(o->oTimer * 0x1000) * 182.04444 * 10.0;
|
||||
o->oPosY = o->oControllablePlatformUnkFC + sins(o->oTimer * 0x2000) * 20.0f;
|
||||
@@ -127,12 +127,12 @@ void func_802F4230(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802F43EC(void) {
|
||||
void controllable_platform_tilt_from_mario(void) {
|
||||
s16 sp1E = gMarioObject->header.gfx.pos[0] - o->oPosX;
|
||||
s16 sp1C = gMarioObject->header.gfx.pos[2] - o->oPosZ;
|
||||
|
||||
if (gMarioObject->platform == o
|
||||
|| gMarioObject->platform == obj_nearest_object_with_behavior(bhvControllablePlatformSub)) {
|
||||
|| gMarioObject->platform == cur_obj_nearest_object_with_behavior(bhvControllablePlatformSub)) {
|
||||
o->oFaceAnglePitch = sp1C * 4;
|
||||
o->oFaceAngleRoll = -sp1E * 4;
|
||||
if (D_80331694 == 6) {
|
||||
@@ -170,7 +170,7 @@ void bhv_controllable_platform_loop(void) {
|
||||
sp54[0] = obj_find_wall_displacement(sp48, o->oPosX + 250.0, o->oPosY, o->oPosZ + 300.0, 50.0f);
|
||||
sp54[1] = obj_find_wall_displacement(sp3C, o->oPosX, o->oPosY, o->oPosZ + 300.0, 50.0f);
|
||||
sp54[2] = obj_find_wall_displacement(sp30, o->oPosX - 250.0, o->oPosY, o->oPosZ + 300.0, 50.0f);
|
||||
func_802F3FD8(2, sp54, sp48, sp3C, sp30);
|
||||
controllable_platform_check_walls(2, sp54, sp48, sp3C, sp30);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
@@ -178,7 +178,7 @@ void bhv_controllable_platform_loop(void) {
|
||||
sp54[0] = obj_find_wall_displacement(sp48, o->oPosX + 250.0, o->oPosY, o->oPosZ - 300.0, 50.0f);
|
||||
sp54[1] = obj_find_wall_displacement(sp3C, o->oPosX, o->oPosY, o->oPosZ - 300.0, 50.0f);
|
||||
sp54[2] = obj_find_wall_displacement(sp30, o->oPosX - 250.0, o->oPosY, o->oPosZ - 300.0, 50.0f);
|
||||
func_802F3FD8(1, sp54, sp48, sp3C, sp30);
|
||||
controllable_platform_check_walls(1, sp54, sp48, sp3C, sp30);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
@@ -186,7 +186,7 @@ void bhv_controllable_platform_loop(void) {
|
||||
sp54[0] = obj_find_wall_displacement(sp48, o->oPosX + 300.0, o->oPosY, o->oPosZ + 250.0, 50.0f);
|
||||
sp54[1] = obj_find_wall_displacement(sp3C, o->oPosX + 300.0, o->oPosY, o->oPosZ, 50.0f);
|
||||
sp54[2] = obj_find_wall_displacement(sp30, o->oPosX + 300.0, o->oPosY, o->oPosZ - 250.0, 50.0f);
|
||||
func_802F3FD8(4, sp54, sp48, sp3C, sp30);
|
||||
controllable_platform_check_walls(4, sp54, sp48, sp3C, sp30);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
@@ -194,11 +194,11 @@ void bhv_controllable_platform_loop(void) {
|
||||
sp54[0] = obj_find_wall_displacement(sp48, o->oPosX - 300.0, o->oPosY, o->oPosZ + 250.0, 50.0f);
|
||||
sp54[1] = obj_find_wall_displacement(sp3C, o->oPosX - 300.0, o->oPosY, o->oPosZ, 50.0f);
|
||||
sp54[2] = obj_find_wall_displacement(sp30, o->oPosX - 300.0, o->oPosY, o->oPosZ - 250.0, 50.0f);
|
||||
func_802F3FD8(3, sp54, sp48, sp3C, sp30);
|
||||
controllable_platform_check_walls(3, sp54, sp48, sp3C, sp30);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
func_802F4230();
|
||||
controllable_platform_shake_on_wall_hit();
|
||||
return;
|
||||
break;
|
||||
|
||||
@@ -209,9 +209,9 @@ void bhv_controllable_platform_loop(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
func_802F43EC();
|
||||
controllable_platform_tilt_from_mario();
|
||||
o->oPosX += o->oVelX;
|
||||
o->oPosZ += o->oVelZ;
|
||||
if (D_80331694 != 0 && D_80331694 != 6)
|
||||
PlaySound(SOUND_ENV_ELEVATOR2);
|
||||
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR2);
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
void bhv_bobomb_bully_death_smoke_init(void) {
|
||||
o->oPosY -= 300.0f;
|
||||
|
||||
obj_scale(10.0f);
|
||||
cur_obj_scale(10.0f);
|
||||
}
|
||||
|
||||
void bhv_bobomb_explosion_bubble_init(void) {
|
||||
scale_object_xyz(o, 2.0f, 2.0f, 1.0f);
|
||||
obj_scale_xyz(o, 2.0f, 2.0f, 1.0f);
|
||||
|
||||
o->oBobombExpBubGfxExpRateX = (s32)(RandomFloat() * 2048.0f) + 0x800;
|
||||
o->oBobombExpBubGfxExpRateY = (s32)(RandomFloat() * 2048.0f) + 0x800;
|
||||
@@ -28,7 +28,7 @@ void bhv_bobomb_explosion_bubble_loop(void) {
|
||||
if (o->oPosY > waterY) {
|
||||
o->activeFlags = 0;
|
||||
o->oPosY += 5.0f;
|
||||
spawn_object(o, MODEL_SPOT_ON_GROUND, bhvWaterSurfaceWhiteWave2);
|
||||
spawn_object(o, MODEL_SMALL_WATER_SPLASH, bhvObjectWaterSplash);
|
||||
}
|
||||
|
||||
if (o->oTimer >= 61)
|
||||
|
||||
@@ -15,7 +15,7 @@ void bhv_rr_cruiser_wing_loop(void) {
|
||||
}
|
||||
#ifndef VERSION_JP
|
||||
if (o->oTimer == 64) {
|
||||
PlaySound2(SOUND_GENERAL_BOAT_ROCK);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_BOAT_ROCK);
|
||||
o->oTimer = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
void bhv_ddd_pole_init(void) {
|
||||
if (!(save_file_get_flags() & (SAVE_FLAG_HAVE_KEY_2 | SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR))) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
o->hitboxDownOffset = 100.0f;
|
||||
o->oDDDPoleMaxOffset = 100.0f * o->oBehParams2ndByte;
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
void bhv_bowsers_sub_loop(void) {
|
||||
if (save_file_get_flags() & (SAVE_FLAG_HAVE_KEY_2 | SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR))
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ddd_warp.c.inc
|
||||
|
||||
void bhv_ddd_warp_loop(void) {
|
||||
if (dddStatus & BOWSERS_SUB_BEATEN)
|
||||
if (gDddPaintingStatus & BOWSERS_SUB_BEATEN)
|
||||
o->collisionData = segmented_to_virtual(inside_castle_seg7_collision_ddd_warp_2);
|
||||
else
|
||||
o->collisionData = segmented_to_virtual(inside_castle_seg7_collision_ddd_warp);
|
||||
|
||||
@@ -27,5 +27,5 @@ void bhv_decorative_pendulum_loop(void) {
|
||||
* actually one sound played twice in rapid succession.
|
||||
*/
|
||||
if (o->oAngleVelRoll == 0x10 || o->oAngleVelRoll == -0x10)
|
||||
PlaySound2(SOUND_GENERAL_BIG_CLOCK);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_BIG_CLOCK);
|
||||
}
|
||||
|
||||
@@ -47,25 +47,25 @@ void bhv_donut_platform_update(void) {
|
||||
& ((1 << o->oBehParams2ndByte) ^ 0xFFFFFFFF);
|
||||
|
||||
if (o->oDistanceToMario > 2500.0f) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
func_802A3C98(150.0f, 1);
|
||||
obj_explode_and_spawn_coins(150.0f, 1);
|
||||
create_sound_spawner(SOUND_GENERAL_DONUT_PLATFORM_EXPLOSION);
|
||||
}
|
||||
} else {
|
||||
if (o->oGravity == 0.0f) {
|
||||
if (gMarioObject->platform == o) {
|
||||
obj_shake_y(4.0f);
|
||||
cur_obj_shake_y(4.0f);
|
||||
if (o->oTimer > 15) {
|
||||
o->oGravity = -0.1f;
|
||||
}
|
||||
} else {
|
||||
obj_set_pos_to_home();
|
||||
cur_obj_set_pos_to_home();
|
||||
o->oTimer = 0;
|
||||
}
|
||||
} else {
|
||||
obj_update_floor_and_walls();
|
||||
obj_move_standard(78);
|
||||
cur_obj_update_floor_and_walls();
|
||||
cur_obj_move_standard(78);
|
||||
}
|
||||
|
||||
load_object_collision_model();
|
||||
|
||||
@@ -12,13 +12,13 @@ s32 D_8032F328[] = { SOUND_GENERAL_OPEN_WOOD_DOOR, SOUND_GENERAL_OPEN_IRON_DOOR
|
||||
|
||||
s32 D_8032F330[] = { SOUND_GENERAL_CLOSE_WOOD_DOOR, SOUND_GENERAL_CLOSE_IRON_DOOR };
|
||||
|
||||
void func_802AC070(s32 sp18) {
|
||||
set_obj_animation_and_sound_state(sp18);
|
||||
if (func_8029F788())
|
||||
void door_animation_and_reset(s32 sp18) {
|
||||
cur_obj_init_animation_with_sound(sp18);
|
||||
if (cur_obj_check_if_near_animation_end())
|
||||
o->oAction = 0;
|
||||
}
|
||||
|
||||
void func_802AC0B8(void) {
|
||||
void set_door_camera_event(void) {
|
||||
if (segmented_to_virtual(bhvDoor) == o->behavior)
|
||||
gPlayerCameraState->cameraEvent = CAM_EVENT_DOOR;
|
||||
else
|
||||
@@ -26,53 +26,53 @@ void func_802AC0B8(void) {
|
||||
gPlayerCameraState->usedObj = o;
|
||||
}
|
||||
|
||||
void func_802AC130(void) {
|
||||
s32 sp1C = obj_has_model(MODEL_HMC_METAL_DOOR);
|
||||
void play_door_open_noise(void) {
|
||||
s32 sp1C = cur_obj_has_model(MODEL_HMC_METAL_DOOR);
|
||||
if (o->oTimer == 0) {
|
||||
PlaySound2(D_8032F328[sp1C]);
|
||||
cur_obj_play_sound_2(D_8032F328[sp1C]);
|
||||
gTimeStopState |= TIME_STOP_MARIO_OPENED_DOOR;
|
||||
}
|
||||
if (o->oTimer == 70) {
|
||||
PlaySound2(D_8032F330[sp1C]);
|
||||
cur_obj_play_sound_2(D_8032F330[sp1C]);
|
||||
}
|
||||
}
|
||||
|
||||
void func_802AC1CC(void) {
|
||||
s32 sp1C = obj_has_model(MODEL_HMC_METAL_DOOR);
|
||||
void play_warp_door_open_noise(void) {
|
||||
s32 sp1C = cur_obj_has_model(MODEL_HMC_METAL_DOOR);
|
||||
if (o->oTimer == 30)
|
||||
PlaySound2(D_8032F330[sp1C]);
|
||||
cur_obj_play_sound_2(D_8032F330[sp1C]);
|
||||
}
|
||||
|
||||
void bhv_door_loop(void) {
|
||||
s32 sp1C = 0;
|
||||
|
||||
while (D_8032F300[sp1C].flag != (u32)~0) {
|
||||
if (obj_clear_interact_status_flag(D_8032F300[sp1C].flag)) {
|
||||
func_802AC0B8();
|
||||
obj_change_action(D_8032F300[sp1C].action);
|
||||
if (cur_obj_clear_interact_status_flag(D_8032F300[sp1C].flag)) {
|
||||
set_door_camera_event();
|
||||
cur_obj_change_action(D_8032F300[sp1C].action);
|
||||
}
|
||||
sp1C++;
|
||||
}
|
||||
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
set_obj_animation_and_sound_state(0);
|
||||
cur_obj_init_animation_with_sound(0);
|
||||
break;
|
||||
case 1:
|
||||
func_802AC070(1);
|
||||
func_802AC130();
|
||||
door_animation_and_reset(1);
|
||||
play_door_open_noise();
|
||||
break;
|
||||
case 2:
|
||||
func_802AC070(2);
|
||||
func_802AC130();
|
||||
door_animation_and_reset(2);
|
||||
play_door_open_noise();
|
||||
break;
|
||||
case 3:
|
||||
func_802AC070(3);
|
||||
func_802AC1CC();
|
||||
door_animation_and_reset(3);
|
||||
play_warp_door_open_noise();
|
||||
break;
|
||||
case 4:
|
||||
func_802AC070(4);
|
||||
func_802AC1CC();
|
||||
door_animation_and_reset(4);
|
||||
play_warp_door_open_noise();
|
||||
break;
|
||||
}
|
||||
if (o->oAction == 0)
|
||||
|
||||
@@ -23,10 +23,10 @@ void dorrie_act_move(void) {
|
||||
|
||||
startYaw = o->oMoveAngleYaw;
|
||||
o->oDorrieNeckAngle = -0x26F4;
|
||||
set_obj_animation_and_sound_state(1);
|
||||
cur_obj_init_animation_with_sound(1);
|
||||
|
||||
if (o->oDorrieForwardDistToMario < 320.0f && o->oDorrieGroundPounded) {
|
||||
PlaySound2(SOUND_OBJ_DORRIE);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_DORRIE);
|
||||
o->collisionData = segmented_to_virtual(dorrie_seg6_collision_0600FBB8);
|
||||
o->oAction = DORRIE_ACT_LOWER_HEAD;
|
||||
o->oForwardVel = 0.0f;
|
||||
@@ -62,7 +62,7 @@ void dorrie_begin_head_raise(s32 liftingMario) {
|
||||
|
||||
void dorrie_act_lower_head(void) {
|
||||
if (func_802F92EC(2, 35)) {
|
||||
func_8029F6F0();
|
||||
cur_obj_reverse_animation();
|
||||
|
||||
#ifdef VERSION_JP
|
||||
if (o->oTimer > 150) {
|
||||
@@ -94,17 +94,17 @@ void dorrie_act_lower_head(void) {
|
||||
|
||||
void dorrie_act_raise_head(void) {
|
||||
o->collisionData = segmented_to_virtual(dorrie_seg6_collision_0600F644);
|
||||
if (func_8029F788()) {
|
||||
if (cur_obj_check_if_near_animation_end()) {
|
||||
o->oAction = DORRIE_ACT_MOVE;
|
||||
} else if (o->oDorrieLiftingMario && o->header.gfx.unk38.animFrame < 74) {
|
||||
if (set_mario_npc_dialog(2) == 2) {
|
||||
o->oDorrieHeadRaiseSpeed += 0x1CC;
|
||||
if (obj_check_anim_frame(73)) {
|
||||
if (cur_obj_check_anim_frame(73)) {
|
||||
set_mario_npc_dialog(0);
|
||||
}
|
||||
dorrie_raise_head();
|
||||
} else {
|
||||
func_8029F6F0();
|
||||
cur_obj_reverse_animation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,10 +119,10 @@ void bhv_dorrie_update(void) {
|
||||
o->oDorrieForwardDistToMario = o->oDistanceToMario * coss(o->oAngleToMario - o->oMoveAngleYaw);
|
||||
|
||||
obj_perform_position_op(0);
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
|
||||
o->oDorrieAngleToHome = obj_angle_to_home();
|
||||
o->oDorrieDistToHome = obj_lateral_dist_to_home();
|
||||
o->oDorrieAngleToHome = cur_obj_angle_to_home();
|
||||
o->oDorrieDistToHome = cur_obj_lateral_dist_to_home();
|
||||
|
||||
// Shift dorrie's bounds to account for her neck
|
||||
boundsShift =
|
||||
@@ -133,7 +133,7 @@ void bhv_dorrie_update(void) {
|
||||
o->oPosZ = o->oHomeZ - o->oDorrieDistToHome * coss(o->oDorrieAngleToHome);
|
||||
}
|
||||
|
||||
o->oDorrieGroundPounded = obj_is_mario_ground_pounding_platform();
|
||||
o->oDorrieGroundPounded = cur_obj_is_mario_ground_pounding_platform();
|
||||
|
||||
if (gMarioObject->platform == o) {
|
||||
maxOffsetY = -17.0f;
|
||||
|
||||
@@ -36,7 +36,7 @@ void bhv_lll_drawbridge_loop(void) {
|
||||
// the game at regular intervals can leave the drawbridge raised indefinitely.
|
||||
if (o->oTimer >= 51 && (globalTimer % 8) == 0) {
|
||||
o->oAction = LLL_DRAWBRIDGE_ACT_LOWER;
|
||||
PlaySound2(SOUND_GENERAL_BOAT_TILT1);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_BOAT_TILT1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ void bhv_lll_drawbridge_loop(void) {
|
||||
// the game at regular intervals can leave the drawbridge lowered indefinitely.
|
||||
if (o->oTimer >= 51 && (globalTimer % 8) == 0) {
|
||||
o->oAction = LLL_DRAWBRIDGE_ACT_RAISE;
|
||||
PlaySound2(SOUND_GENERAL_BOAT_TILT2);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_BOAT_TILT2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// elevator.c.inc
|
||||
|
||||
void func_802AD01C(void) {
|
||||
PlaySound2(SOUND_GENERAL_QUIET_POUND1);
|
||||
ShakeScreen(SHAKE_POS_SMALL);
|
||||
void elevator_starting_shake(void) {
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_QUIET_POUND1);
|
||||
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
||||
}
|
||||
|
||||
void ActionElevator0(void) {
|
||||
void elevator_act_0(void) {
|
||||
o->oVelY = 0;
|
||||
if (o->oElevatorUnk100 == 2) {
|
||||
if (gMarioObject->platform == o) {
|
||||
@@ -25,10 +25,10 @@ void ActionElevator0(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionElevator1(void) {
|
||||
PlaySound(SOUND_ENV_ELEVATOR1);
|
||||
if (o->oTimer == 0 && obj_is_mario_on_platform())
|
||||
func_802AD01C();
|
||||
void elevator_act_1(void) {
|
||||
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR1);
|
||||
if (o->oTimer == 0 && cur_obj_is_mario_on_platform())
|
||||
elevator_starting_shake();
|
||||
approach_f32_signed(&o->oVelY, 10.0f, 2.0f);
|
||||
o->oPosY += o->oVelY;
|
||||
if (o->oPosY > o->oElevatorUnkF8) {
|
||||
@@ -42,11 +42,11 @@ void ActionElevator1(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionElevator2() // Pretty similar code to action 1
|
||||
void elevator_act_2() // Pretty similar code to action 1
|
||||
{
|
||||
PlaySound(SOUND_ENV_ELEVATOR1);
|
||||
if (o->oTimer == 0 && obj_is_mario_on_platform())
|
||||
func_802AD01C();
|
||||
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR1);
|
||||
if (o->oTimer == 0 && cur_obj_is_mario_on_platform())
|
||||
elevator_starting_shake();
|
||||
approach_f32_signed(&o->oVelY, -10.0f, -2.0f);
|
||||
o->oPosY += o->oVelY;
|
||||
if (o->oPosY < o->oElevatorUnkF4) {
|
||||
@@ -62,24 +62,24 @@ void ActionElevator2() // Pretty similar code to action 1
|
||||
}
|
||||
}
|
||||
|
||||
void ActionElevator4() {
|
||||
void elevator_act_4() {
|
||||
o->oVelY = 0;
|
||||
if (o->oTimer == 0) {
|
||||
ShakeScreen(SHAKE_POS_SMALL);
|
||||
PlaySound2(SOUND_GENERAL_METAL_POUND);
|
||||
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_METAL_POUND);
|
||||
}
|
||||
if (!mario_is_in_air_action() && !obj_is_mario_on_platform())
|
||||
if (!mario_is_in_air_action() && !cur_obj_is_mario_on_platform())
|
||||
o->oAction = 1;
|
||||
}
|
||||
|
||||
void ActionElevator3() // nearly identical to action 2
|
||||
void elevator_act_3() // nearly identical to action 2
|
||||
{
|
||||
o->oVelY = 0;
|
||||
if (o->oTimer == 0) {
|
||||
ShakeScreen(SHAKE_POS_SMALL);
|
||||
PlaySound2(SOUND_GENERAL_METAL_POUND);
|
||||
cur_obj_shake_screen(SHAKE_POS_SMALL);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_METAL_POUND);
|
||||
}
|
||||
if (!mario_is_in_air_action() && !obj_is_mario_on_platform())
|
||||
if (!mario_is_in_air_action() && !cur_obj_is_mario_on_platform())
|
||||
o->oAction = 0;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ void bhv_elevator_init(void) {
|
||||
o->oElevatorUnkF4 = D_8032F38C[o->oBehParams2ndByte * 3];
|
||||
o->oElevatorUnkF8 = o->oHomeY;
|
||||
o->oElevatorUnkFC = (o->oElevatorUnkF4 + o->oElevatorUnkF8) / 2;
|
||||
o->oElevatorUnk100 = obj_has_behavior(bhvRrElevatorPlatform);
|
||||
o->oElevatorUnk100 = cur_obj_has_behavior(bhvRrElevatorPlatform);
|
||||
} else {
|
||||
o->oElevatorUnkF4 = D_8032F38C[o->oBehParams2ndByte * 3];
|
||||
o->oElevatorUnkF8 = D_8032F38C[o->oBehParams2ndByte * 3 + 1];
|
||||
@@ -98,8 +98,8 @@ void bhv_elevator_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void (*sElevatorActions[])(void) = { ActionElevator0, ActionElevator1, ActionElevator2, ActionElevator3,
|
||||
ActionElevator4 };
|
||||
void (*sElevatorActions[])(void) = { elevator_act_0, elevator_act_1, elevator_act_2, elevator_act_3,
|
||||
elevator_act_4 };
|
||||
|
||||
struct SpawnParticlesInfo D_8032F3CC = { 3, 20, MODEL_MIST, 20, 10, 5, 0, 0, 0, 30, 30.0f, 1.5f };
|
||||
|
||||
@@ -111,5 +111,5 @@ struct SpawnParticlesInfo D_8032F3FC = { 0, 5, MODEL_WHITE_PARTICLE_DL, 0,
|
||||
2.0f, 2.0f };
|
||||
|
||||
void bhv_elevator_loop(void) {
|
||||
obj_call_action_function(sElevatorActions);
|
||||
cur_obj_call_action_function(sElevatorActions);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ void bhv_end_birds_1_loop(void) {
|
||||
|
||||
switch (gCurrentObject->oAction) {
|
||||
case 0:
|
||||
obj_scale(0.7f);
|
||||
cur_obj_scale(0.7f);
|
||||
gCurrentObject->oIntroLakituUnk110 = -554.f;
|
||||
gCurrentObject->oIntroLakituUnk10C = 3044.f;
|
||||
gCurrentObject->oIntroLakituUnk108 = -1314.f;
|
||||
@@ -19,11 +19,11 @@ void bhv_end_birds_1_loop(void) {
|
||||
if (gCurrentObject->oTimer < 100)
|
||||
obj_rotate_towards_point(gCurrentObject, sp34, 0, 0, 0x20, 0x20);
|
||||
if ((gCurrentObject->oEndBirdUnk104 == 0.f) && (gCurrentObject->oTimer == 0))
|
||||
PlaySound2(SOUND_GENERAL_BIRDS_FLY_AWAY);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_BIRDS_FLY_AWAY);
|
||||
if (gCutsceneTimer == 0)
|
||||
mark_object_for_deletion(gCurrentObject);
|
||||
obj_mark_for_deletion(gCurrentObject);
|
||||
break;
|
||||
}
|
||||
|
||||
func_802A2A38();
|
||||
cur_obj_set_pos_via_transform();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ void bhv_end_birds_2_loop(void) {
|
||||
|
||||
switch (gCurrentObject->oAction) {
|
||||
case 0:
|
||||
obj_scale(0.7f);
|
||||
cur_obj_scale(0.7f);
|
||||
gCurrentObject->oAction += 1;
|
||||
break;
|
||||
case 1:
|
||||
@@ -23,9 +23,9 @@ void bhv_end_birds_2_loop(void) {
|
||||
obj_rotate_towards_point(gCurrentObject, sp3C, 0, 0, 8, 8);
|
||||
|
||||
if ((gCurrentObject->oEndBirdUnk104 == 0.f) && (gCurrentObject->oTimer == 0))
|
||||
PlaySound2(SOUND_GENERAL_BIRDS_FLY_AWAY);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_BIRDS_FLY_AWAY);
|
||||
break;
|
||||
}
|
||||
|
||||
func_802A2A38();
|
||||
cur_obj_set_pos_via_transform();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ static void enemy_lakitu_act_uninitialized(void) {
|
||||
if (o->oDistanceToMario < 2000.0f) {
|
||||
spawn_object_relative_with_scale(CLOUD_BP_LAKITU_CLOUD, 0, 0, 0, 2.0f, o, MODEL_MIST, bhvCloud);
|
||||
|
||||
obj_unhide();
|
||||
cur_obj_unhide();
|
||||
o->oAction = ENEMY_LAKITU_ACT_MAIN;
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ static void enemy_lakitu_update_speed_and_angle(void) {
|
||||
// Change move angle toward mario faster when farther from mario
|
||||
turnSpeed = (s16)(distToMario * 2);
|
||||
clamp_s16(&turnSpeed, 0xC8, 0xFA0);
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, turnSpeed);
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, turnSpeed);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,7 @@ static void enemy_lakitu_update_speed_and_angle(void) {
|
||||
* hold it, then enter the hold spiny sub-action.
|
||||
*/
|
||||
static void enemy_lakitu_sub_act_no_spiny(void) {
|
||||
set_obj_animation_and_sound_state(1);
|
||||
cur_obj_init_animation_with_sound(1);
|
||||
|
||||
if (o->oEnemyLakituSpinyCooldown != 0) {
|
||||
o->oEnemyLakituSpinyCooldown -= 1;
|
||||
@@ -103,8 +103,7 @@ static void enemy_lakitu_sub_act_no_spiny(void) {
|
||||
if (spiny != NULL) {
|
||||
o->prevObj = spiny;
|
||||
spiny->oAction = SPINY_ACT_HELD_BY_LAKITU;
|
||||
|
||||
func_8029EE20(spiny, spiny_egg_seg5_anims_050157E4, 0);
|
||||
obj_init_animation_with_sound(spiny, spiny_egg_seg5_anims_050157E4, 0);
|
||||
|
||||
o->oEnemyLakituNumSpinies += 1;
|
||||
o->oSubAction = ENEMY_LAKITU_SUB_ACT_HOLD_SPINY;
|
||||
@@ -137,11 +136,11 @@ static void enemy_lakitu_sub_act_hold_spiny(void) {
|
||||
*/
|
||||
static void enemy_lakitu_sub_act_throw_spiny(void) {
|
||||
if (func_802F92EC(2, 2)) {
|
||||
PlaySound2(SOUND_OBJ_EVIL_LAKITU_THROW);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_EVIL_LAKITU_THROW);
|
||||
o->prevObj = NULL;
|
||||
}
|
||||
|
||||
if (func_8029F788()) {
|
||||
if (cur_obj_check_if_near_animation_end()) {
|
||||
o->oSubAction = ENEMY_LAKITU_SUB_ACT_NO_SPINY;
|
||||
o->oEnemyLakituSpinyCooldown = random_linear_offset(100, 100);
|
||||
}
|
||||
@@ -151,13 +150,13 @@ static void enemy_lakitu_sub_act_throw_spiny(void) {
|
||||
* Main update function.
|
||||
*/
|
||||
static void enemy_lakitu_act_main(void) {
|
||||
PlaySound(SOUND_AIR_LAKITU_FLY);
|
||||
cur_obj_play_sound_1(SOUND_AIR_LAKITU_FLY);
|
||||
|
||||
obj_update_floor_and_walls();
|
||||
cur_obj_update_floor_and_walls();
|
||||
|
||||
enemy_lakitu_update_speed_and_angle();
|
||||
if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
|
||||
o->oMoveAngleYaw = obj_reflect_move_angle_off_wall();
|
||||
o->oMoveAngleYaw = cur_obj_reflect_move_angle_off_wall();
|
||||
}
|
||||
|
||||
obj_update_blinking(&o->oEnemyLakituBlinkTimer, 20, 40, 4);
|
||||
@@ -174,7 +173,7 @@ static void enemy_lakitu_act_main(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
obj_move_standard(78);
|
||||
cur_obj_move_standard(78);
|
||||
|
||||
// Die and drop held spiny when attacked by mario
|
||||
if (obj_check_attacks(&sEnemyLakituHitbox, o->oAction)) {
|
||||
|
||||
@@ -30,12 +30,12 @@ struct Struct802C0DF0 sExclamationBoxContents[] = { { 0, 0, 0, MODEL_MARIOS_WING
|
||||
{ 14, 0, 5, MODEL_STAR, bhvSpawnedStar },
|
||||
{ 99, 0, 0, 0, NULL } };
|
||||
|
||||
void bhv_rotatin_exclamation_box_loop(void) {
|
||||
void bhv_rotating_exclamation_box_loop(void) {
|
||||
if (o->parentObj->oAction != 1)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
void ActionExclamationBox0(void) {
|
||||
void exclamation_box_act_0(void) {
|
||||
if (o->oBehParams2ndByte < 3) {
|
||||
o->oAnimState = o->oBehParams2ndByte;
|
||||
if ((save_file_get_flags() & D_8032F0C0[o->oBehParams2ndByte])
|
||||
@@ -49,30 +49,30 @@ void ActionExclamationBox0(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionExclamationBox1(void) {
|
||||
obj_become_intangible();
|
||||
void exclamation_box_act_1(void) {
|
||||
cur_obj_become_intangible();
|
||||
if (o->oTimer == 0) {
|
||||
spawn_object(o, MODEL_EXCLAMATION_POINT, bhvRotatingExclamationMark);
|
||||
obj_set_model(MODEL_EXCLAMATION_BOX_OUTLINE);
|
||||
cur_obj_set_model(MODEL_EXCLAMATION_BOX_OUTLINE);
|
||||
}
|
||||
if ((save_file_get_flags() & D_8032F0C0[o->oBehParams2ndByte])
|
||||
|| ((o->oBehParams >> 24) & 0xFF) != 0) {
|
||||
o->oAction = 2;
|
||||
obj_set_model(MODEL_EXCLAMATION_BOX);
|
||||
cur_obj_set_model(MODEL_EXCLAMATION_BOX);
|
||||
}
|
||||
}
|
||||
|
||||
void ActionExclamationBox2(void) {
|
||||
set_object_hitbox(o, &sExclamationBoxHitbox);
|
||||
void exclamation_box_act_2(void) {
|
||||
obj_set_hitbox(o, &sExclamationBoxHitbox);
|
||||
if (o->oTimer == 0) {
|
||||
obj_unhide();
|
||||
obj_become_tangible();
|
||||
cur_obj_unhide();
|
||||
cur_obj_become_tangible();
|
||||
o->oInteractStatus = 0;
|
||||
o->oPosY = o->oHomeY;
|
||||
o->oGraphYOffset = 0.0f;
|
||||
}
|
||||
if (obj_was_attacked_or_ground_pounded()) {
|
||||
obj_become_intangible();
|
||||
if (cur_obj_was_attacked_or_ground_pounded()) {
|
||||
cur_obj_become_intangible();
|
||||
o->oExclamationBoxUnkFC = 0x4000;
|
||||
o->oVelY = 30.0f;
|
||||
o->oGravity = -8.0f;
|
||||
@@ -82,9 +82,9 @@ void ActionExclamationBox2(void) {
|
||||
load_object_collision_model();
|
||||
}
|
||||
|
||||
void ActionExclamationBox3(void) {
|
||||
void exclamation_box_act_3(void) {
|
||||
UNUSED s32 unused;
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
if (o->oVelY < 0.0f) {
|
||||
o->oVelY = 0.0f;
|
||||
o->oGravity = 0.0f;
|
||||
@@ -100,7 +100,7 @@ void ActionExclamationBox3(void) {
|
||||
o->oAction = 4;
|
||||
}
|
||||
|
||||
void func_802C0DF0(struct Struct802C0DF0 *a0, u8 a1) {
|
||||
void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) {
|
||||
struct Object *sp1C = NULL;
|
||||
|
||||
while (a0->unk0 != 99) {
|
||||
@@ -118,28 +118,28 @@ void func_802C0DF0(struct Struct802C0DF0 *a0, u8 a1) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionExclamationBox4(void) {
|
||||
func_802C0DF0(sExclamationBoxContents, o->oBehParams2ndByte);
|
||||
func_802AA618(0, 0, 46.0f);
|
||||
void exclamation_box_act_4(void) {
|
||||
exclamation_box_spawn_contents(sExclamationBoxContents, o->oBehParams2ndByte);
|
||||
spawn_mist_particles_variable(0, 0, 46.0f);
|
||||
spawn_triangle_break_particles(20, 139, 0.3f, o->oAnimState);
|
||||
create_sound_spawner(SOUND_GENERAL_BREAK_BOX);
|
||||
if (o->oBehParams2ndByte < 3) {
|
||||
o->oAction = 5;
|
||||
obj_hide();
|
||||
cur_obj_hide();
|
||||
} else
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
void ActionExclamationBox5(void) {
|
||||
void exclamation_box_act_5(void) {
|
||||
if (o->oTimer > 300)
|
||||
o->oAction = 2;
|
||||
}
|
||||
|
||||
void (*sExclamationBoxActions[])(void) = { ActionExclamationBox0, ActionExclamationBox1,
|
||||
ActionExclamationBox2, ActionExclamationBox3,
|
||||
ActionExclamationBox4, ActionExclamationBox5 };
|
||||
void (*sExclamationBoxActions[])(void) = { exclamation_box_act_0, exclamation_box_act_1,
|
||||
exclamation_box_act_2, exclamation_box_act_3,
|
||||
exclamation_box_act_4, exclamation_box_act_5 };
|
||||
|
||||
void bhv_exclamation_box_loop(void) {
|
||||
obj_scale(2.0f);
|
||||
obj_call_action_function(sExclamationBoxActions);
|
||||
cur_obj_scale(2.0f);
|
||||
cur_obj_call_action_function(sExclamationBoxActions);
|
||||
}
|
||||
|
||||
@@ -22,5 +22,5 @@ void bhv_explosion_loop(void) {
|
||||
|
||||
o->oOpacity -= 14;
|
||||
|
||||
obj_scale((f32) o->oTimer / 9.0f + 1.0);
|
||||
cur_obj_scale((f32) o->oTimer / 9.0f + 1.0);
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
void bhv_wdw_express_elevator_loop(void) {
|
||||
o->oVelY = 0.0f;
|
||||
if (o->oAction == 0) {
|
||||
if (obj_is_mario_on_platform())
|
||||
if (cur_obj_is_mario_on_platform())
|
||||
o->oAction++;
|
||||
} else if (o->oAction == 1) {
|
||||
o->oVelY = -20.0f;
|
||||
o->oPosY += o->oVelY;
|
||||
PlaySound(SOUND_ENV_ELEVATOR4);
|
||||
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4);
|
||||
if (o->oTimer > 132)
|
||||
o->oAction++;
|
||||
} else if (o->oAction == 2) {
|
||||
@@ -17,11 +17,11 @@ void bhv_wdw_express_elevator_loop(void) {
|
||||
} else if (o->oAction == 3) {
|
||||
o->oVelY = 10.0f;
|
||||
o->oPosY += o->oVelY;
|
||||
PlaySound(SOUND_ENV_ELEVATOR4);
|
||||
cur_obj_play_sound_1(SOUND_ENV_ELEVATOR4);
|
||||
if (o->oPosY >= o->oHomeY) {
|
||||
o->oPosY = o->oHomeY;
|
||||
o->oAction++;
|
||||
}
|
||||
} else if (!obj_is_mario_on_platform())
|
||||
} else if (!cur_obj_is_mario_on_platform())
|
||||
o->oAction = 0;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ static void eyerok_boss_act_sleep(void) {
|
||||
eyerok_spawn_hand(-1, MODEL_EYEROK_LEFT_HAND, bhvEyerokHand);
|
||||
eyerok_spawn_hand(1, MODEL_EYEROK_RIGHT_HAND, bhvEyerokHand);
|
||||
} else if (o->oDistanceToMario < 500.0f) {
|
||||
PlaySound2(SOUND_OBJ_EYEROK_EXPLODE);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_EYEROK_EXPLODE);
|
||||
o->oAction = EYEROK_BOSS_ACT_WAKE_UP;
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ static void eyerok_boss_act_wake_up(void) {
|
||||
}
|
||||
|
||||
static void eyerok_boss_act_show_intro_text(void) {
|
||||
if (obj_update_dialog_with_cutscene(2, 0, CUTSCENE_DIALOG, DIALOG_117)) {
|
||||
if (cur_obj_update_dialog_with_cutscene(2, 0, CUTSCENE_DIALOG, DIALOG_117)) {
|
||||
o->oAction = EYEROK_BOSS_ACT_FIGHT;
|
||||
}
|
||||
}
|
||||
@@ -117,14 +117,14 @@ static void eyerok_boss_act_fight(void) {
|
||||
|
||||
static void eyerok_boss_act_die(void) {
|
||||
if (o->oTimer == 60) {
|
||||
if (obj_update_dialog_with_cutscene(2, 0, CUTSCENE_DIALOG, DIALOG_118)) {
|
||||
create_star(0.0f, -900.0f, -3700.0f);
|
||||
if (cur_obj_update_dialog_with_cutscene(2, 0, CUTSCENE_DIALOG, DIALOG_118)) {
|
||||
spawn_default_star(0.0f, -900.0f, -3700.0f);
|
||||
} else {
|
||||
o->oTimer -= 1;
|
||||
}
|
||||
} else if (o->oTimer > 120) {
|
||||
stop_background_music(SEQUENCE_ARGS(4, SEQ_EVENT_BOSS));
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ void bhv_eyerok_boss_loop(void) {
|
||||
|
||||
static s32 eyerok_hand_check_attacked(void) {
|
||||
if (o->oEyerokReceivedAttack != 0 && abs_angle_diff(o->oAngleToMario, o->oFaceAngleYaw) < 0x3000) {
|
||||
PlaySound2(SOUND_OBJ2_EYEROK_SOUND_SHORT);
|
||||
cur_obj_play_sound_2(SOUND_OBJ2_EYEROK_SOUND_SHORT);
|
||||
|
||||
if (--o->oHealth >= 2) {
|
||||
o->oAction = EYEROK_HAND_ACT_ATTACKED;
|
||||
@@ -174,15 +174,15 @@ static s32 eyerok_hand_check_attacked(void) {
|
||||
}
|
||||
|
||||
static void func_8030DBA8(void) {
|
||||
PlaySound2(SOUND_OBJ_POUNDING_LOUD);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_POUNDING_LOUD);
|
||||
set_camera_shake_from_point(SHAKE_POS_SMALL, o->oPosX, o->oPosY, o->oPosZ);
|
||||
func_802ADA94();
|
||||
spawn_mist_from_global();
|
||||
}
|
||||
|
||||
static void eyerok_hand_act_sleep(void) {
|
||||
if (o->parentObj->oAction != EYEROK_BOSS_ACT_SLEEP
|
||||
&& ++o->oEyerokHandWakeUpTimer > -3 * o->oBehParams2ndByte) {
|
||||
if (func_8029F788()) {
|
||||
if (cur_obj_check_if_near_animation_end()) {
|
||||
o->parentObj->oEyerokBossNumHands += 1;
|
||||
o->oAction = EYEROK_HAND_ACT_IDLE;
|
||||
o->collisionData = segmented_to_virtual(&ssl_seg7_collision_07028274);
|
||||
@@ -200,13 +200,13 @@ static void eyerok_hand_act_sleep(void) {
|
||||
o->collisionData = segmented_to_virtual(&ssl_seg7_collision_07028370);
|
||||
}
|
||||
|
||||
func_8029F6F0();
|
||||
cur_obj_reverse_animation();
|
||||
o->oPosX = o->oHomeX + 724.0f * o->oBehParams2ndByte;
|
||||
}
|
||||
}
|
||||
|
||||
static void eyerok_hand_act_idle(void) {
|
||||
set_obj_animation_and_sound_state(2);
|
||||
cur_obj_init_animation_with_sound(2);
|
||||
|
||||
if (o->parentObj->oAction == EYEROK_BOSS_ACT_FIGHT) {
|
||||
if (o->parentObj->oEyerokBossUnk104 != 0) {
|
||||
@@ -267,14 +267,14 @@ static void eyerok_hand_act_open(void) {
|
||||
static void eyerok_hand_act_show_eye(void) {
|
||||
UNUSED s16 val06;
|
||||
|
||||
set_obj_animation_and_sound_state(5);
|
||||
cur_obj_init_animation_with_sound(5);
|
||||
func_802F9378(0, 0, SOUND_OBJ_EYEROK_SHOW_EYE);
|
||||
|
||||
if (!eyerok_hand_check_attacked()) {
|
||||
if (o->parentObj->oEyerokBossActiveHand == 0) {
|
||||
if (o->oAnimState < 3) {
|
||||
o->oAnimState += 1;
|
||||
} else if (func_8029F788()) {
|
||||
} else if (cur_obj_check_if_near_animation_end()) {
|
||||
val06 = (s16)(o->oAngleToMario - o->oFaceAngleYaw) * o->oBehParams2ndByte;
|
||||
o->oAction = EYEROK_HAND_ACT_CLOSE;
|
||||
}
|
||||
@@ -342,19 +342,19 @@ static void eyerok_hand_act_become_active(void) {
|
||||
static void eyerok_hand_act_die(void) {
|
||||
if (func_802F92B0(1)) {
|
||||
o->parentObj->oEyerokBossUnk1AC = 0;
|
||||
func_802A3C98(150.0f, 1);
|
||||
obj_explode_and_spawn_coins(150.0f, 1);
|
||||
create_sound_spawner(SOUND_OBJ2_EYEROK_SOUND_LONG);
|
||||
}
|
||||
|
||||
if (o->oMoveFlags & 0x00000003) {
|
||||
PlaySound2(SOUND_OBJ_POUNDING_LOUD);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_POUNDING_LOUD);
|
||||
o->oForwardVel = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
static void eyerok_hand_act_retreat(void) {
|
||||
f32 distToHome = obj_lateral_dist_to_home();
|
||||
s16 angleToHome = obj_angle_to_home();
|
||||
f32 distToHome = cur_obj_lateral_dist_to_home();
|
||||
s16 angleToHome = cur_obj_angle_to_home();
|
||||
|
||||
if ((distToHome -= 40.0f) < 0.0f) {
|
||||
distToHome = 0.0f;
|
||||
@@ -386,7 +386,7 @@ static void eyerok_hand_act_target_mario(void) {
|
||||
} else {
|
||||
obj_forward_vel_approach(50.0f, 5.0f);
|
||||
approach_f32_ptr(&o->oPosY, o->oHomeY + 300.0f, 20.0f);
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 4000);
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 4000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -493,7 +493,7 @@ void bhv_eyerok_hand_loop(void) {
|
||||
if (o->oAction == EYEROK_HAND_ACT_SLEEP) {
|
||||
eyerok_hand_act_sleep();
|
||||
} else {
|
||||
obj_update_floor_and_walls();
|
||||
cur_obj_update_floor_and_walls();
|
||||
|
||||
switch (o->oAction) {
|
||||
case EYEROK_HAND_ACT_IDLE:
|
||||
@@ -544,7 +544,7 @@ void bhv_eyerok_hand_loop(void) {
|
||||
}
|
||||
|
||||
o->oEyerokReceivedAttack = obj_check_attacks(&sEyerokHitbox, o->oAction);
|
||||
obj_move_standard(-78);
|
||||
cur_obj_move_standard(-78);
|
||||
}
|
||||
|
||||
load_object_collision_model();
|
||||
|
||||
@@ -74,7 +74,7 @@ void bhv_falling_pillar_loop(void) {
|
||||
o->oAction = FALLING_PILLAR_ACT_TURNING;
|
||||
|
||||
// Play the detaching sound.
|
||||
PlaySound2(SOUND_GENERAL_POUND_ROCK);
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_POUND_ROCK);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -106,7 +106,7 @@ void bhv_falling_pillar_loop(void) {
|
||||
|
||||
// Make the camera shake and spawn dust clouds.
|
||||
set_camera_shake_from_point(SHAKE_POS_MEDIUM, o->oPosX, o->oPosY, o->oPosZ);
|
||||
func_802AA618(0, 0, 92.0f);
|
||||
spawn_mist_particles_variable(0, 0, 92.0f);
|
||||
|
||||
// Go invisible.
|
||||
o->activeFlags = 0;
|
||||
@@ -136,7 +136,7 @@ void bhv_falling_pillar_hitbox_loop(void) {
|
||||
o->oPosZ = sins(pitch) * coss(yaw) * yOffset + z;
|
||||
|
||||
// Give these a hitbox so they can collide with Mario.
|
||||
set_object_hitbox(o, &sFallingPillarHitbox);
|
||||
obj_set_hitbox(o, &sFallingPillarHitbox);
|
||||
|
||||
// When the pillar goes inactive, the hitboxes also go inactive.
|
||||
if (o->parentObj->activeFlags == 0)
|
||||
|
||||
@@ -14,7 +14,7 @@ void bhv_bitfs_sinking_platform_loop(void) {
|
||||
|
||||
// TODO: Named incorrectly. fix
|
||||
void bhv_ddd_moving_pole_loop(void) {
|
||||
copy_object_pos_and_angle(o, o->parentObj);
|
||||
obj_copy_pos_and_angle(o, o->parentObj);
|
||||
}
|
||||
|
||||
void bhv_bitfs_sinking_cage_platform_loop(void) {
|
||||
|
||||
@@ -32,7 +32,7 @@ s32 sNumKilledFirePiranhaPlants;
|
||||
|
||||
void bhv_fire_piranha_plant_init(void) {
|
||||
o->oFirePiranhaPlantNeutralScale = D_80331B5C[(u16)(o->oBehParams >> 16)];
|
||||
set_object_hitbox(o, &sFirePiranhaPlantHitbox);
|
||||
obj_set_hitbox(o, &sFirePiranhaPlantHitbox);
|
||||
|
||||
if ((u16)(o->oBehParams >> 16) != 0) {
|
||||
o->oFlags |= 0x00004000;
|
||||
@@ -52,21 +52,21 @@ static void fire_piranha_plant_act_hide(void) {
|
||||
o->oMoveAngleYaw += (s32) o->oFirePiranhaPlantDeathSpinVel;
|
||||
approach_f32_ptr(&o->oFirePiranhaPlantDeathSpinVel, 0.0f, 200.0f);
|
||||
|
||||
if (func_8029F788()) {
|
||||
if (cur_obj_check_if_near_animation_end()) {
|
||||
if (--o->oFirePiranhaPlantDeathSpinTimer == 0) {
|
||||
PlaySound2(SOUND_OBJ_ENEMY_DEFEAT_SHRINK);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_ENEMY_DEFEAT_SHRINK);
|
||||
}
|
||||
}
|
||||
} else if (approach_f32_ptr(&o->oFirePiranhaPlantScale, 0.0f,
|
||||
0.04f * o->oFirePiranhaPlantNeutralScale)) {
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
if (o->oFirePiranhaPlantActive) {
|
||||
sNumActiveFirePiranhaPlants -= 1;
|
||||
o->oFirePiranhaPlantActive = FALSE;
|
||||
|
||||
if ((u16)(o->oBehParams >> 16) != 0 && o->oHealth == 0) {
|
||||
if (++sNumKilledFirePiranhaPlants == 5) {
|
||||
create_star(-6300.0f, -1850.0f, -6300.0f);
|
||||
spawn_default_star(-6300.0f, -1850.0f, -6300.0f);
|
||||
}
|
||||
|
||||
obj_die_if_health_non_positive();
|
||||
@@ -74,20 +74,20 @@ static void fire_piranha_plant_act_hide(void) {
|
||||
}
|
||||
} else if (sNumActiveFirePiranhaPlants < 2 && o->oTimer > 100 && o->oDistanceToMario > 100.0f
|
||||
&& o->oDistanceToMario < 800.0f) {
|
||||
PlaySound2(SOUND_OBJ_PIRANHA_PLANT_APPEAR);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_PIRANHA_PLANT_APPEAR);
|
||||
|
||||
o->oFirePiranhaPlantActive = TRUE;
|
||||
sNumActiveFirePiranhaPlants += 1;
|
||||
|
||||
obj_unhide();
|
||||
cur_obj_unhide();
|
||||
o->oAction = FIRE_PIRANHA_PLANT_ACT_GROW;
|
||||
o->oMoveAngleYaw = o->oAngleToMario;
|
||||
} else {
|
||||
obj_hide();
|
||||
cur_obj_hide();
|
||||
}
|
||||
}
|
||||
|
||||
func_8029F728();
|
||||
cur_obj_extend_animation_if_at_end();
|
||||
}
|
||||
|
||||
static void fire_piranha_plant_act_grow(void) {
|
||||
@@ -96,15 +96,15 @@ static void fire_piranha_plant_act_grow(void) {
|
||||
if (approach_f32_ptr(&o->oFirePiranhaPlantScale, o->oFirePiranhaPlantNeutralScale,
|
||||
0.04f * o->oFirePiranhaPlantNeutralScale)) {
|
||||
if (o->oTimer > 80) {
|
||||
PlaySound2(SOUND_OBJ_PIRANHA_PLANT_SHRINK);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_PIRANHA_PLANT_SHRINK);
|
||||
o->oAction = FIRE_PIRANHA_PLANT_ACT_HIDE;
|
||||
set_obj_animation_and_sound_state(0);
|
||||
cur_obj_init_animation_with_sound(0);
|
||||
} else if (o->oTimer < 50) {
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 0x400);
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x400);
|
||||
} else { // TODO: Check if we can put these conditionals on same line
|
||||
if (obj_is_rendering_enabled()) {
|
||||
if (obj_check_anim_frame(56)) {
|
||||
PlaySound2(SOUND_OBJ_FLAME_BLOWN);
|
||||
if (cur_obj_check_anim_frame(56)) {
|
||||
cur_obj_play_sound_2(SOUND_OBJ_FLAME_BLOWN);
|
||||
obj_spit_fire(0, (s32)(30.0f * o->oFirePiranhaPlantNeutralScale),
|
||||
(s32)(140.0f * o->oFirePiranhaPlantNeutralScale),
|
||||
2.5f * o->oFirePiranhaPlantNeutralScale, MODEL_RED_FLAME_SHADOW,
|
||||
@@ -113,12 +113,12 @@ static void fire_piranha_plant_act_grow(void) {
|
||||
}
|
||||
}
|
||||
} else if (o->oFirePiranhaPlantScale > o->oFirePiranhaPlantNeutralScale / 2) {
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
}
|
||||
}
|
||||
|
||||
void bhv_fire_piranha_plant_update(void) {
|
||||
obj_scale(o->oFirePiranhaPlantScale);
|
||||
cur_obj_scale(o->oFirePiranhaPlantScale);
|
||||
|
||||
switch (o->oAction) {
|
||||
case FIRE_PIRANHA_PLANT_ACT_HIDE:
|
||||
@@ -135,13 +135,13 @@ void bhv_fire_piranha_plant_update(void) {
|
||||
sNumActiveFirePiranhaPlants -= 1;
|
||||
}
|
||||
} else {
|
||||
set_obj_animation_and_sound_state(2);
|
||||
cur_obj_init_animation_with_sound(2);
|
||||
}
|
||||
|
||||
o->oAction = FIRE_PIRANHA_PLANT_ACT_HIDE;
|
||||
o->oFirePiranhaPlantDeathSpinTimer = 10;
|
||||
o->oFirePiranhaPlantDeathSpinVel = 8000.0f;
|
||||
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,16 +20,16 @@ static void fire_spitter_act_spit_fire(void) {
|
||||
if (scaleStatus < 0) {
|
||||
o->oAction = FIRE_SPITTER_ACT_IDLE;
|
||||
} else {
|
||||
PlaySound2(SOUND_OBJ_FLAME_BLOWN);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_FLAME_BLOWN);
|
||||
obj_spit_fire(0, 0, 0, 5.0f, MODEL_RED_FLAME_SHADOW, 20.0f, 15.0f, 0x1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bhv_fire_spitter_update(void) {
|
||||
obj_scale(o->header.gfx.scale[0]);
|
||||
cur_obj_scale(o->header.gfx.scale[0]);
|
||||
o->oGraphYOffset = 40.0f;
|
||||
obj_update_floor_and_walls();
|
||||
cur_obj_update_floor_and_walls();
|
||||
|
||||
switch (o->oAction) {
|
||||
case FIRE_SPITTER_ACT_IDLE:
|
||||
@@ -40,5 +40,5 @@ void bhv_fire_spitter_update(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
obj_move_standard(78);
|
||||
cur_obj_move_standard(78);
|
||||
}
|
||||
|
||||
+230
-113
@@ -1,163 +1,280 @@
|
||||
// fish.c.inc
|
||||
/**
|
||||
* @file fish.inc.c
|
||||
* Implements behaviour and spawning for fish located in the Secret Aquarium and other levels.
|
||||
*/
|
||||
|
||||
void ActionFish0(void) {
|
||||
/**
|
||||
* Spawns fish with settings chosen by the field o->oBehParams2ndByte.
|
||||
* These settings are animations, colour, and spawn quantity.
|
||||
* Fish spawning restricted to within a set distance from Mario.
|
||||
*/
|
||||
void fish_act_spawn(void) {
|
||||
s32 i;
|
||||
s32 sp38;
|
||||
s32 schoolQuantity;
|
||||
s16 model;
|
||||
f32 sp30;
|
||||
struct Animation **sp2C;
|
||||
struct Object *sp28;
|
||||
f32 minDistToMario;
|
||||
struct Animation **fishAnimation;
|
||||
struct Object *fishObject;
|
||||
switch (o->oBehParams2ndByte) {
|
||||
|
||||
// Blue fish with a quanitiy of twenty.
|
||||
case 0:
|
||||
model = MODEL_FISH; sp38 = 20; sp30 = 1500.0f; sp2C = blue_fish_seg3_anims_0301C2B0;
|
||||
model = MODEL_FISH; schoolQuantity = 20; minDistToMario = 1500.0f; fishAnimation = blue_fish_seg3_anims_0301C2B0;
|
||||
break;
|
||||
|
||||
// Blue fish with a quanitiy of five.
|
||||
case 1:
|
||||
model = MODEL_FISH; sp38 = 5; sp30 = 1500.0f; sp2C = blue_fish_seg3_anims_0301C2B0;
|
||||
model = MODEL_FISH; schoolQuantity = 5; minDistToMario = 1500.0f; fishAnimation = blue_fish_seg3_anims_0301C2B0;
|
||||
break;
|
||||
|
||||
// Cyan fish with a quanitiy of twenty.
|
||||
case 2:
|
||||
model = MODEL_CYAN_FISH; sp38 = 20; sp30 = 1500.0f; sp2C = cyan_fish_seg6_anims_0600E264;
|
||||
model = MODEL_CYAN_FISH; schoolQuantity = 20; minDistToMario = 1500.0f; fishAnimation = cyan_fish_seg6_anims_0600E264;
|
||||
break;
|
||||
|
||||
// Cyan fish with a quanitiy of five.
|
||||
case 3:
|
||||
model = MODEL_CYAN_FISH; sp38 = 5; sp30 = 1500.0f; sp2C = cyan_fish_seg6_anims_0600E264;
|
||||
model = MODEL_CYAN_FISH; schoolQuantity = 5; minDistToMario = 1500.0f; fishAnimation = cyan_fish_seg6_anims_0600E264;
|
||||
break;
|
||||
}
|
||||
if (o->oDistanceToMario < sp30 || gCurrLevelNum == LEVEL_SA) {
|
||||
for (i = 0; i < sp38; i++) {
|
||||
sp28 = spawn_object(o, model, bhvFishGroup2);
|
||||
sp28->oBehParams2ndByte = o->oBehParams2ndByte;
|
||||
func_8029EE20(sp28, sp2C, 0);
|
||||
translate_object_xyz_random(sp28, 700.0f);
|
||||
/**
|
||||
* Spawn and animate the schoolQuantity of fish if Mario enters render distance
|
||||
* If the current level is Secret Aquarium, ignore this requirement.
|
||||
* Fish moves at random with a max-range of 700.0f.
|
||||
*/
|
||||
if (o->oDistanceToMario < minDistToMario || gCurrLevelNum == LEVEL_SA) {
|
||||
for (i = 0; i < schoolQuantity; i++) {
|
||||
fishObject = spawn_object(o, model, bhvFish);
|
||||
fishObject->oBehParams2ndByte = o->oBehParams2ndByte;
|
||||
obj_init_animation_with_sound(fishObject, fishAnimation, 0);
|
||||
obj_translate_xyz_random(fishObject, 700.0f);
|
||||
}
|
||||
o->oAction = 1;
|
||||
o->oAction = FISH_ACT_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
void ActionFish1(void) {
|
||||
if (gCurrLevelNum != LEVEL_SA)
|
||||
if (gMarioObject->oPosY - o->oPosY > 2000.0f)
|
||||
o->oAction = 2;
|
||||
/**
|
||||
* If the current level is not Secret Aquarium and the distance from Mario's
|
||||
* Y coordinate is greater than 2000.0f then spawn another fish.
|
||||
*/
|
||||
void fish_act_respawn(void) {
|
||||
if (gCurrLevelNum != LEVEL_SA) {
|
||||
if (gMarioObject->oPosY - o->oPosY > 2000.0f) {
|
||||
o->oAction = FISH_ACT_RESPAWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActionFish2(void) {
|
||||
o->oAction = 0;
|
||||
/**
|
||||
* Sets the next call of sFishActions to spawn a new fish.
|
||||
*/
|
||||
void fish_act_init(void) {
|
||||
o->oAction = FISH_ACT_INIT;
|
||||
}
|
||||
|
||||
void (*sFishActions[])(void) = { ActionFish0, ActionFish1, ActionFish2 };
|
||||
/**
|
||||
* An array of action methods chosen one at a time by bhv_fish_loop
|
||||
*/
|
||||
void (*sFishActions[])(void) = {
|
||||
fish_act_spawn, fish_act_respawn, fish_act_init
|
||||
};
|
||||
|
||||
void bhv_fish_loop(void) {
|
||||
obj_call_action_function(sFishActions);
|
||||
void bhv_large_fish_group_loop(void) {
|
||||
cur_obj_call_action_function(sFishActions);
|
||||
}
|
||||
|
||||
void func_802BF59C(s32 a0) {
|
||||
f32 sp1C = o->parentObj->oPosY;
|
||||
/**
|
||||
* Adjusts the Y coordinate of fish depending on circumstances
|
||||
* such as proximity to other fish.
|
||||
*/
|
||||
void fish_regroup(s32 speed) {
|
||||
// Store parentY for calculating when the fish should move towards oFishPosY.
|
||||
f32 parentY = o->parentObj->oPosY;
|
||||
|
||||
// Sets speed of fish in SA to a leisurely speed of 10 when close to other fish.
|
||||
if (gCurrLevelNum == LEVEL_SA) {
|
||||
if (500.0f < absf(o->oPosY - o->oFishGroupUnkF8))
|
||||
a0 = 10;
|
||||
o->oPosY = approach_f32_symmetric(o->oPosY, o->oFishGroupUnkF8, a0);
|
||||
} else if (sp1C - 100.0f - o->oFishGroupUnk10C < o->oPosY
|
||||
&& o->oPosY < sp1C + 1000.0f + o->oFishGroupUnk10C)
|
||||
o->oPosY = approach_f32_symmetric(o->oPosY, o->oFishGroupUnkF8, a0);
|
||||
if (500.0f < absf(o->oPosY - o->oFishPosY)) {
|
||||
speed = 10;
|
||||
}
|
||||
// Applies movement to fish.
|
||||
o->oPosY = approach_f32_symmetric(o->oPosY, o->oFishPosY, speed);
|
||||
/**
|
||||
* Brings fish Y coordinate towards another fish if they are too far apart.
|
||||
*/
|
||||
} else if (parentY - 100.0f - o->oFishDepthDistance < o->oPosY
|
||||
&& o->oPosY < parentY + 1000.0f + o->oFishDepthDistance) {
|
||||
o->oPosY = approach_f32_symmetric(o->oPosY, o->oFishPosY, speed);
|
||||
}
|
||||
}
|
||||
|
||||
void ActionFishGroup1(void) {
|
||||
f32 sp1C = o->oPosY - gMarioObject->oPosY;
|
||||
if (o->oTimer < 10)
|
||||
func_8029ED98(0, 2.0f);
|
||||
else
|
||||
func_8029ED98(0, 1.0f);
|
||||
/**
|
||||
* Moves fish forward at a random velocity and sets a random rotation.
|
||||
*/
|
||||
void fish_group_act_rotation(void) {
|
||||
f32 fishY = o->oPosY - gMarioObject->oPosY;
|
||||
|
||||
// Alters speed of animation for natural movement.
|
||||
if (o->oTimer < 10) {
|
||||
cur_obj_init_animation_with_accel_and_sound(0, 2.0f);
|
||||
} else {
|
||||
cur_obj_init_animation_with_accel_and_sound(0, 1.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigns oForwardVel, oFishRandomOffset, & oFishRespawnDistance to a random floats.
|
||||
* Determines fish movement.
|
||||
*/
|
||||
if (o->oTimer == 0) {
|
||||
o->oForwardVel = RandomFloat() * 2 + 3.0f;
|
||||
if (gCurrLevelNum == LEVEL_SA)
|
||||
o->oFishGroupUnkFC = RandomFloat() * 700.0f;
|
||||
else
|
||||
o->oFishGroupUnkFC = RandomFloat() * 100.0f;
|
||||
o->oFishGroupUnk104 = RandomFloat() * 500 + 200.0f;
|
||||
if (gCurrLevelNum == LEVEL_SA) {
|
||||
o->oFishRandomOffset = RandomFloat() * 700.0f;
|
||||
} else {
|
||||
o->oFishRandomOffset = RandomFloat() * 100.0f;
|
||||
}
|
||||
o->oFishRespawnDistance = RandomFloat() * 500 + 200.0f;
|
||||
}
|
||||
o->oFishGroupUnkF8 = gMarioObject->oPosY + o->oFishGroupUnkFC;
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 0x400);
|
||||
if (o->oPosY < o->oFishGroupUnkF4 - 50.0f) {
|
||||
if (sp1C < 0.0f)
|
||||
sp1C = 0.0f - sp1C;
|
||||
if (sp1C < 500.0f)
|
||||
func_802BF59C(2);
|
||||
else
|
||||
func_802BF59C(4);
|
||||
|
||||
// Interact with Mario through rotating towards him.
|
||||
o->oFishPosY = gMarioObject->oPosY + o->oFishRandomOffset;
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x400);
|
||||
|
||||
// If fish groups are too close, call fish_regroup()
|
||||
if (o->oPosY < o->oFishWaterLevel - 50.0f) {
|
||||
if (fishY < 0.0f) {
|
||||
fishY = 0.0f - fishY;
|
||||
}
|
||||
if (fishY < 500.0f) {
|
||||
fish_regroup(2);
|
||||
} else {
|
||||
fish_regroup(4);
|
||||
}
|
||||
} else {
|
||||
o->oPosY = o->oFishGroupUnkF4 - 50.0f;
|
||||
if (sp1C > 300.0f)
|
||||
o->oPosY = o->oFishWaterLevel - 50.0f;
|
||||
if (fishY > 300.0f) {
|
||||
o->oPosY = o->oPosY - 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete current fish and create a new one if distance to Mario is
|
||||
* smaller than his distance to oFishRespawnDistance + 150.0f.
|
||||
*/
|
||||
if (o->oDistanceToMario < o->oFishRespawnDistance + 150.0f) {
|
||||
o->oAction = FISH_ACT_RESPAWN;
|
||||
}
|
||||
if (o->oDistanceToMario < o->oFishGroupUnk104 + 150.0f)
|
||||
o->oAction = 2;
|
||||
}
|
||||
|
||||
void ActionFishGroup2(void) {
|
||||
f32 sp1C = o->oPosY - gMarioObject->oPosY;
|
||||
s32 sp18;
|
||||
o->oFishGroupUnkF8 = gMarioObject->oPosY + o->oFishGroupUnkFC;
|
||||
/**
|
||||
* Interactively maneuver fish in relation to its distance from other fish and Mario.
|
||||
*/
|
||||
void fish_group_act_move(void) {
|
||||
f32 fishY = o->oPosY - gMarioObject->oPosY;
|
||||
// Marked unused, but has arithmetic performed on it in a useless manner.
|
||||
UNUSED s32 distance;
|
||||
o->oFishPosY = gMarioObject->oPosY + o->oFishRandomOffset;
|
||||
/**
|
||||
* Set fish variables to random floats when timer reaches zero and plays sound effect.
|
||||
* This allows fish to move in seemingly natural patterns.
|
||||
*/
|
||||
if (o->oTimer == 0) {
|
||||
o->oFishGroupUnk110 = RandomFloat() * 300.0f;
|
||||
o->oFishGroupUnk100 = RandomFloat() * 1024.0f + 1024.0f;
|
||||
o->oFishGroupUnk108 = RandomFloat() * 4.0f + 8.0f + 5.0f;
|
||||
if (o->oDistanceToMario < 600.0f)
|
||||
sp18 = 1;
|
||||
else
|
||||
sp18 = (s32)(1.0 / (o->oDistanceToMario / 600.0));
|
||||
sp18 *= 127;
|
||||
PlaySound2(SOUND_GENERAL_MOVING_WATER);
|
||||
o->oFishActiveDistance = RandomFloat() * 300.0f;
|
||||
o->oFishRandomSpeed = RandomFloat() * 1024.0f + 1024.0f;
|
||||
o->oFishRandomVel = RandomFloat() * 4.0f + 8.0f + 5.0f;
|
||||
if (o->oDistanceToMario < 600.0f) {
|
||||
distance = 1;
|
||||
} else {
|
||||
distance = (s32)(1.0 / (o->oDistanceToMario / 600.0));
|
||||
}
|
||||
distance *= 127;
|
||||
cur_obj_play_sound_2(SOUND_GENERAL_MOVING_WATER);
|
||||
}
|
||||
if (o->oTimer < LEVEL_SA)
|
||||
func_8029ED98(0, 4.0f);
|
||||
else
|
||||
func_8029ED98(0, 1.0f);
|
||||
if (o->oForwardVel < o->oFishGroupUnk108)
|
||||
o->oForwardVel = o->oForwardVel + 0.5;
|
||||
o->oFishGroupUnkF8 = gMarioObject->oPosY + o->oFishGroupUnkFC;
|
||||
obj_rotate_yaw_toward(o->oAngleToMario + 0x8000, o->oFishGroupUnk100);
|
||||
if (o->oPosY < o->oFishGroupUnkF4 - 50.0f) {
|
||||
if (sp1C < 0.0f)
|
||||
sp1C = 0.0f - sp1C;
|
||||
if (sp1C < 500.0f)
|
||||
func_802BF59C(2);
|
||||
else
|
||||
func_802BF59C(4);
|
||||
// Enable fish animation in a natural manner.
|
||||
if (o->oTimer < 20) {
|
||||
cur_obj_init_animation_with_accel_and_sound(0, 4.0f);
|
||||
} else {
|
||||
o->oPosY = o->oFishGroupUnkF4 - 50.0f;
|
||||
if (sp1C > 300.0f)
|
||||
o->oPosY -= 1.0f;
|
||||
cur_obj_init_animation_with_accel_and_sound(0, 1.0f);
|
||||
}
|
||||
// Set randomized forward velocity so fish have differing velocities
|
||||
if (o->oForwardVel < o->oFishRandomVel) {
|
||||
o->oForwardVel = o->oForwardVel + 0.5;
|
||||
}
|
||||
o->oFishPosY = gMarioObject->oPosY + o->oFishRandomOffset;
|
||||
// Rotate fish away from Mario.
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario + 0x8000, o->oFishRandomSpeed);
|
||||
// If fish groups are too close, call fish_regroup()
|
||||
if (o->oPosY < o->oFishWaterLevel - 50.0f) {
|
||||
if (fishY < 0.0f) {
|
||||
fishY = 0.0f - fishY;
|
||||
}
|
||||
if (fishY < 500.0f) {
|
||||
fish_regroup(2);
|
||||
} else {
|
||||
fish_regroup(4);
|
||||
}
|
||||
} else {
|
||||
o->oPosY = o->oFishWaterLevel - 50.0f;
|
||||
if (fishY > 300.0f) {
|
||||
o->oPosY -= 1.0f;
|
||||
}
|
||||
}
|
||||
// If distance to Mario is too great, then set fish to active.
|
||||
if (o->oDistanceToMario > o->oFishActiveDistance + 500.0f) {
|
||||
o->oAction = FISH_ACT_ACTIVE;
|
||||
}
|
||||
if (o->oDistanceToMario > o->oFishGroupUnk110 + 500.0f)
|
||||
o->oAction = 1;
|
||||
}
|
||||
|
||||
void ActionFishGroup0(void) {
|
||||
func_8029ED98(0, 1.0f);
|
||||
/**
|
||||
* Animate fish and alter scaling at random for a magnifying effect from the water.
|
||||
*/
|
||||
void fish_group_act_animate(void) {
|
||||
cur_obj_init_animation_with_accel_and_sound(0, 1.0f);
|
||||
o->header.gfx.unk38.animFrame = (s16)(RandomFloat() * 28.0f);
|
||||
o->oFishGroupUnk10C = RandomFloat() * 300.0f;
|
||||
obj_scale(RandomFloat() * 0.4 + 0.8);
|
||||
o->oAction = 1;
|
||||
o->oFishDepthDistance = RandomFloat() * 300.0f;
|
||||
cur_obj_scale(RandomFloat() * 0.4 + 0.8);
|
||||
o->oAction = FISH_ACT_ACTIVE;
|
||||
}
|
||||
|
||||
void (*sFishGroupActions[])(void) = { ActionFishGroup0, ActionFishGroup1, ActionFishGroup2 };
|
||||
void (*sFishGroupActions[])(void) = {
|
||||
fish_group_act_animate, fish_group_act_rotation, fish_group_act_move
|
||||
};
|
||||
|
||||
void bhv_fish_group_2_loop(void) // TODO rename
|
||||
/**
|
||||
* Main loop for fish
|
||||
*/
|
||||
void bhv_fish_loop(void)
|
||||
{
|
||||
UNUSED s32 unused[4];
|
||||
obj_scale(1.0f);
|
||||
o->oFishGroupUnkF4 = find_water_level(o->oPosX, o->oPosZ);
|
||||
if (gCurrLevelNum == LEVEL_SA)
|
||||
o->oFishGroupUnkF4 = 0.0f;
|
||||
cur_obj_scale(1.0f);
|
||||
|
||||
/**
|
||||
* Tracks water level to delete fish outside of bounds.
|
||||
* In SA oFishWaterLevel is set to zero because fish cannot exit the water.
|
||||
* This prevents accidental deletion.
|
||||
*/
|
||||
o->oFishWaterLevel = find_water_level(o->oPosX, o->oPosZ);
|
||||
if (gCurrLevelNum == LEVEL_SA) {
|
||||
o->oFishWaterLevel = 0.0f;
|
||||
}
|
||||
// Apply hitbox and resolve wall collisions
|
||||
o->oWallHitboxRadius = 30.0f;
|
||||
obj_resolve_wall_collisions();
|
||||
cur_obj_resolve_wall_collisions();
|
||||
|
||||
// Delete fish below the water depth bounds of -10000.0f.
|
||||
if (gCurrLevelNum != LEVEL_UNKNOWN_32) {
|
||||
if (o->oFishGroupUnkF4 < -10000.0f) {
|
||||
mark_object_for_deletion(o);
|
||||
if (o->oFishWaterLevel < -10000.0f) {
|
||||
obj_mark_for_deletion(o);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
o->oFishGroupUnkF4 = 1000.0f;
|
||||
obj_call_action_function(sFishGroupActions);
|
||||
obj_move_using_fvel_and_gravity();
|
||||
if (o->parentObj->oAction == 2)
|
||||
mark_object_for_deletion(o);
|
||||
|
||||
// Unreachable code, perhaps for debugging or testing.
|
||||
} else {
|
||||
o->oFishWaterLevel = 1000.0f;
|
||||
}
|
||||
|
||||
// Call fish action methods and apply physics engine.
|
||||
cur_obj_call_action_function(sFishGroupActions);
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
|
||||
// If the parent object has action set to two, then delete the fish object.
|
||||
if (o->parentObj->oAction == FISH_ACT_RESPAWN) {
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ void bhv_beta_moving_flames_spawn_loop(void) {
|
||||
}
|
||||
|
||||
void bhv_beta_moving_flames_loop(void) {
|
||||
obj_scale(5.0f);
|
||||
cur_obj_scale(5.0f);
|
||||
o->oForwardVel = sins(o->oMovingFlameTimer) * 70.0f;
|
||||
o->oMovingFlameTimer += 0x800;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ void bhv_small_piranha_flame_loop(void) {
|
||||
|
||||
if ((u16)(o->oBehParams >> 16) == 0) {
|
||||
if (o->oTimer > 0) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
sp2C = RandomFloat() - 0.5f;
|
||||
o->header.gfx.scale[1] = o->header.gfx.scale[2] * (1.0f + 0.7f * sp2C);
|
||||
@@ -14,13 +14,13 @@ void bhv_small_piranha_flame_loop(void) {
|
||||
o->oAnimState = RandomU16();
|
||||
}
|
||||
} else {
|
||||
obj_update_floor_and_walls();
|
||||
cur_obj_update_floor_and_walls();
|
||||
if (approach_f32_ptr(&o->oSmallPiranhaFlameUnkF4, o->oSmallPiranhaFlameUnkF8, 0.6f)) {
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 0x200);
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x200);
|
||||
}
|
||||
|
||||
obj_compute_vel_from_move_pitch(o->oSmallPiranhaFlameUnkF4);
|
||||
obj_move_standard(-78);
|
||||
cur_obj_move_standard(-78);
|
||||
spawn_object_with_scale(o, o->oSmallPiranhaFlameUnkFC, bhvSmallPiranhaFlame,
|
||||
0.4f * o->header.gfx.scale[0]);
|
||||
|
||||
@@ -43,11 +43,11 @@ void bhv_small_piranha_flame_loop(void) {
|
||||
}
|
||||
|
||||
void bhv_fly_guy_flame_loop(void) {
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
|
||||
if (approach_f32_ptr(&o->header.gfx.scale[0], 0.0f, 0.6f)) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
}
|
||||
|
||||
obj_scale(o->header.gfx.scale[0]);
|
||||
cur_obj_scale(o->header.gfx.scale[0]);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ void bhv_black_smoke_bowser_loop(void) {
|
||||
|
||||
void bhv_black_smoke_mario_loop(void) {
|
||||
if (o->oTimer == 0) {
|
||||
obj_set_pos_relative(gMarioObject, 0, 0, -30.0f);
|
||||
cur_obj_set_pos_relative(gMarioObject, 0, 0, -30.0f);
|
||||
o->oForwardVel = RandomFloat() * 2 + 0.5;
|
||||
o->oMoveAngleYaw = (gMarioObject->oMoveAngleYaw + 0x7000) + RandomFloat() * 8192.0f;
|
||||
o->oVelY = 8;
|
||||
@@ -27,15 +27,15 @@ void bhv_black_smoke_mario_loop(void) {
|
||||
}
|
||||
|
||||
void bhv_flame_mario_loop(void) {
|
||||
obj_scale(2.0f);
|
||||
cur_obj_scale(2.0f);
|
||||
if (o->oTimer != 0)
|
||||
if (o->oTimer & 1)
|
||||
spawn_object(o, MODEL_BURN_SMOKE, bhvBlackSmokeMario);
|
||||
gMarioObject->prevObj = o; // weird?
|
||||
set_object_parent_relative_pos(o, 40, -120, 0);
|
||||
obj_set_parent_relative_pos(o, 40, -120, 0);
|
||||
if (!(gMarioObject->oMarioParticleFlags & 0x800)) {
|
||||
o->parentObj->oActiveParticleFlags &= ~0x800;
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
gMarioObject->prevObj = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ void bhv_flamethrower_flame_loop(void) {
|
||||
s32 sp18;
|
||||
if (o->oTimer == 0) {
|
||||
o->oAnimState = (s32)(RandomFloat() * 10.0f);
|
||||
translate_object_xyz_random(o, 10.0f);
|
||||
obj_translate_xyz_random(o, 10.0f);
|
||||
}
|
||||
if (o->oBehParams2ndByte == 2)
|
||||
size = o->oTimer * (o->oForwardVel - 6.0f) / 100.0 + 2.0;
|
||||
@@ -15,7 +15,7 @@ void bhv_flamethrower_flame_loop(void) {
|
||||
o->hitboxHeight = 200.0f;
|
||||
o->hitboxDownOffset = 150.0f;
|
||||
o->oVelY = -28.0f;
|
||||
obj_update_floor_height();
|
||||
cur_obj_update_floor_height();
|
||||
if (o->oPosY - 25.0f * size < o->oFloorHeight) {
|
||||
o->oVelY = 0;
|
||||
o->oPosY = o->oFloorHeight + 25.0f * size;
|
||||
@@ -23,13 +23,13 @@ void bhv_flamethrower_flame_loop(void) {
|
||||
sp18 = o->parentObj->oFlameThowerFlameUnk110 / 1.2;
|
||||
} else
|
||||
sp18 = o->parentObj->oFlameThowerFlameUnk110;
|
||||
obj_scale(size);
|
||||
cur_obj_scale(size);
|
||||
if (o->oBehParams2ndByte == 4)
|
||||
o->oPosY += o->oForwardVel; // weird?
|
||||
else
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
if (o->oTimer > sp18)
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
o->oInteractStatus = 0;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ void bhv_flamethrower_loop(void) {
|
||||
o->oFlameThowerUnk110 = sp34;
|
||||
flame = spawn_object_relative(o->oBehParams2ndByte, 0, 0, 0, o, model, bhvFlamethrowerFlame);
|
||||
flame->oForwardVel = flameVel;
|
||||
PlaySound(SOUND_AIR_BLOW_FIRE);
|
||||
cur_obj_play_sound_1(SOUND_AIR_BLOW_FIRE);
|
||||
} else if (o->oTimer > 60)
|
||||
o->oAction = 0;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// floating_platform.c.inc
|
||||
|
||||
f32 func_802F54F8(void) {
|
||||
f32 floating_platform_find_home_y(void) {
|
||||
struct Surface *sp24;
|
||||
f32 sp20;
|
||||
f32 sp1C;
|
||||
@@ -16,7 +16,7 @@ f32 func_802F54F8(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_802F55CC(void) {
|
||||
void floating_platform_act_0(void) {
|
||||
s16 sp6 = (gMarioObject->header.gfx.pos[0] - o->oPosX) * coss(-1*o->oMoveAngleYaw)
|
||||
+ (gMarioObject->header.gfx.pos[2] - o->oPosZ) * sins(-1*o->oMoveAngleYaw);
|
||||
s16 sp4 = (gMarioObject->header.gfx.pos[2] - o->oPosZ) * coss(-1*o->oMoveAngleYaw)
|
||||
@@ -48,7 +48,7 @@ void func_802F55CC(void) {
|
||||
}
|
||||
|
||||
void bhv_floating_platform_loop(void) {
|
||||
o->oHomeY = func_802F54F8();
|
||||
o->oHomeY = floating_platform_find_home_y();
|
||||
if (o->oFloatingPlatformUnkF4 == 0)
|
||||
o->oAction = 0;
|
||||
else
|
||||
@@ -56,7 +56,7 @@ void bhv_floating_platform_loop(void) {
|
||||
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
func_802F55CC();
|
||||
floating_platform_act_0();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
@@ -34,7 +34,7 @@ static void fly_guy_act_idle(void) {
|
||||
if (o->oDistanceToMario >= 25000.0f || o->oDistanceToMario < 2000.0f) {
|
||||
// Turn toward home or Mario
|
||||
obj_face_yaw_approach(o->oAngleToMario, 0x300);
|
||||
if (obj_rotate_yaw_toward(o->oAngleToMario, 0x300)) {
|
||||
if (cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x300)) {
|
||||
o->oAction = FLY_GUY_ACT_APPROACH_MARIO;
|
||||
}
|
||||
} else {
|
||||
@@ -62,7 +62,7 @@ static void fly_guy_act_approach_mario(void) {
|
||||
|
||||
// Turn toward home or Mario
|
||||
obj_face_yaw_approach(o->oAngleToMario, 0x400);
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 0x200);
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 0x200);
|
||||
|
||||
// If facing toward mario and we are either near mario laterally or
|
||||
// far above him
|
||||
@@ -97,7 +97,7 @@ static void fly_guy_act_lunge(void) {
|
||||
|
||||
o->oVelY += o->oFlyGuyLungeYDecel;
|
||||
|
||||
obj_rotate_yaw_toward(o->oFaceAngleYaw, 0x800);
|
||||
cur_obj_rotate_yaw_toward(o->oFaceAngleYaw, 0x800);
|
||||
obj_face_pitch_approach(o->oFlyGuyLungeTargetPitch, 0x400);
|
||||
|
||||
// Range [-0x1000, 0x2000]
|
||||
@@ -149,7 +149,7 @@ static void fly_guy_act_shoot_fire(void) {
|
||||
} else {
|
||||
// We have reached below scale 1.2 in the shrinking portion
|
||||
s16 fireMovePitch = obj_turn_pitch_toward_mario(0.0f, 0);
|
||||
PlaySound2(SOUND_OBJ_FLAME_BLOWN);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_FLAME_BLOWN);
|
||||
clamp_s16(&fireMovePitch, 0x800, 0x3000);
|
||||
|
||||
obj_spit_fire(
|
||||
@@ -179,12 +179,12 @@ void bhv_fly_guy_update(void) {
|
||||
if (!(o->activeFlags & ACTIVE_FLAG_IN_DIFFERENT_ROOM)) {
|
||||
o->oDeathSound = SOUND_OBJ_KOOPA_FLYGUY_DEATH;
|
||||
|
||||
obj_scale(o->header.gfx.scale[0]);
|
||||
cur_obj_scale(o->header.gfx.scale[0]);
|
||||
treat_far_home_as_mario(2000.0f);
|
||||
obj_update_floor_and_walls();
|
||||
cur_obj_update_floor_and_walls();
|
||||
|
||||
if (o->oMoveFlags & OBJ_MOVE_HIT_WALL) {
|
||||
o->oMoveAngleYaw = obj_reflect_move_angle_off_wall();
|
||||
o->oMoveAngleYaw = cur_obj_reflect_move_angle_off_wall();
|
||||
} else if (o->oMoveFlags & OBJ_MOVE_MASK_IN_WATER) {
|
||||
o->oVelY = 6.0f;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ void bhv_fly_guy_update(void) {
|
||||
break;
|
||||
}
|
||||
|
||||
obj_move_standard(78);
|
||||
cur_obj_move_standard(78);
|
||||
obj_check_attacks(&sFlyGuyHitbox, o->oAction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ struct ObjectHitbox sBookSwitchHitbox = {
|
||||
|
||||
void flying_bookend_act_0(void) {
|
||||
if (obj_is_near_to_and_facing_mario(400.0f, 0x3000)) {
|
||||
PlaySound2(SOUND_OBJ_DEFAULT_DEATH);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_DEFAULT_DEATH);
|
||||
o->oAction = 1;
|
||||
o->oBookendUnkF4 = o->oFaceAnglePitch + 0x7FFF;
|
||||
o->oBookendUnkF8 = o->oFaceAngleRoll - 0x7FFF;
|
||||
obj_set_model(MODEL_BOOKEND_PART);
|
||||
cur_obj_set_model(MODEL_BOOKEND_PART);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,24 +64,24 @@ void flying_bookend_act_1(void) {
|
||||
}
|
||||
}
|
||||
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
}
|
||||
|
||||
void flying_bookend_act_2(void) {
|
||||
set_obj_animation_and_sound_state(1);
|
||||
obj_update_floor_and_walls();
|
||||
cur_obj_init_animation_with_sound(1);
|
||||
cur_obj_update_floor_and_walls();
|
||||
|
||||
if (o->oForwardVel == 0.0f) {
|
||||
obj_turn_pitch_toward_mario(120.0f, 1000);
|
||||
o->oFaceAnglePitch = o->oMoveAnglePitch + 0x7FFF;
|
||||
obj_rotate_yaw_toward(o->oAngleToMario, 1000);
|
||||
cur_obj_rotate_yaw_toward(o->oAngleToMario, 1000);
|
||||
|
||||
if (o->oTimer > 30) {
|
||||
obj_compute_vel_from_move_pitch(50.0f);
|
||||
}
|
||||
}
|
||||
|
||||
obj_move_standard(78);
|
||||
cur_obj_move_standard(78);
|
||||
}
|
||||
|
||||
void flying_bookend_act_3(void) {
|
||||
@@ -94,13 +94,13 @@ void flying_bookend_act_3(void) {
|
||||
}
|
||||
|
||||
obj_forward_vel_approach(50.0f, 2.0f);
|
||||
obj_move_using_fvel_and_gravity();
|
||||
cur_obj_move_using_fvel_and_gravity();
|
||||
}
|
||||
|
||||
void bhv_flying_bookend_loop(void) {
|
||||
if (!(o->activeFlags & 0x0008)) {
|
||||
o->oDeathSound = SOUND_OBJ_POUNDING1;
|
||||
obj_scale(o->header.gfx.scale[0]);
|
||||
cur_obj_scale(o->header.gfx.scale[0]);
|
||||
|
||||
switch (o->oAction) {
|
||||
case 0:
|
||||
@@ -135,7 +135,7 @@ void bhv_bookend_spawn_loop(void) {
|
||||
sp1C = spawn_object(o, MODEL_BOOKEND, bhvFlyingBookend);
|
||||
if (sp1C != NULL) {
|
||||
sp1C->oAction = 3;
|
||||
PlaySound2(SOUND_OBJ_DEFAULT_DEATH);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_DEFAULT_DEATH);
|
||||
}
|
||||
o->oTimer = 0;
|
||||
}
|
||||
@@ -177,7 +177,7 @@ void bookshelf_manager_act_2(void) {
|
||||
} else {
|
||||
if (o->oBookSwitchManagerUnkF4 >= 3) {
|
||||
if (o->oTimer > 100) {
|
||||
o->parentObj = obj_nearest_object_with_behavior(bhvHauntedBookshelf);
|
||||
o->parentObj = cur_obj_nearest_object_with_behavior(bhvHauntedBookshelf);
|
||||
o->parentObj->oAction = 1;
|
||||
o->oPosX = o->parentObj->oPosX;
|
||||
o->oAction = 3;
|
||||
@@ -204,7 +204,7 @@ void bookshelf_manager_act_3(void) {
|
||||
|
||||
void bookshelf_manager_act_4(void) {
|
||||
if (o->oBookSwitchManagerUnkF4 >= 3) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
o->oAction = 0;
|
||||
}
|
||||
@@ -240,19 +240,19 @@ void bhv_book_switch_loop(void) {
|
||||
o->header.gfx.scale[1] = 0.9f;
|
||||
|
||||
if (o->parentObj->oAction == 4) {
|
||||
mark_object_for_deletion(o);
|
||||
obj_mark_for_deletion(o);
|
||||
} else {
|
||||
sp3C = obj_check_attacks(&sBookSwitchHitbox, o->oAction);
|
||||
if (o->parentObj->oBookSwitchManagerUnkF8 != 0 || o->oAction == 1) {
|
||||
if (o->oDistanceToMario < 100.0f) {
|
||||
obj_become_tangible();
|
||||
cur_obj_become_tangible();
|
||||
} else {
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
}
|
||||
|
||||
o->oAction = 1;
|
||||
if (o->oBookSwitchUnkF4 == 0.0f) {
|
||||
PlaySound2(SOUND_OBJ_DEFAULT_DEATH);
|
||||
cur_obj_play_sound_2(SOUND_OBJ_DEFAULT_DEATH);
|
||||
}
|
||||
|
||||
if (approach_f32_ptr(&o->oBookSwitchUnkF4, 50.0f, 20.0f)) {
|
||||
@@ -265,7 +265,7 @@ void bhv_book_switch_loop(void) {
|
||||
o->oTimer = 0;
|
||||
}
|
||||
} else {
|
||||
obj_become_intangible();
|
||||
cur_obj_become_intangible();
|
||||
if (approach_f32_ptr(&o->oBookSwitchUnkF4, 0.0f, 20.0f)) {
|
||||
if (o->oAction != 0) {
|
||||
if (o->parentObj->oBookSwitchManagerUnkF4 == o->oBehParams2ndByte) {
|
||||
@@ -298,6 +298,6 @@ void bhv_book_switch_loop(void) {
|
||||
|
||||
o->oPosX += o->parentObj->oForwardVel;
|
||||
o->oPosZ = o->oHomeZ - o->oBookSwitchUnkF4;
|
||||
obj_push_mario_away_from_cylinder(70.0f, 70.0f);
|
||||
cur_obj_push_mario_away_from_cylinder(70.0f, 70.0f);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user