From 5152d504b3539372512453ac8f6ae9f5fc1e7463 Mon Sep 17 00:00:00 2001 From: petrie911 <69443847+petrie911@users.noreply.github.com> Date: Fri, 1 Mar 2024 12:57:44 -0600 Subject: [PATCH] audio_general, audio data import, naming lots of audio functions (#144) * heapsort * suff * load init * split * split data * begone asm * names * names and cleanup * let's try this * woo macros * general * bgm macro * names --- .vscode/settings.json | 8 +- include/audioseq_cmd.h | 524 ++++ include/audiothread_cmd.h | 543 ++++ include/functions.h | 48 - include/global.h | 1 + include/macros.h | 2 + include/prevent_context_reordering.h | 4 +- include/sf64audio_external.h | 141 + include/sf64audio_provisional.h | 541 ++-- include/sf64object.h | 12 +- include/sf64player.h | 69 +- include/variables.h | 15 - linker_scripts/us/symbol_addrs_audio.txt | 218 +- src/main/audio_context.c | 184 ++ src/main/audio_effects.c | 2 + src/main/audio_general.c | 3189 ++++++++++++++++++++-- src/main/audio_heap.c | 59 + src/main/audio_load.c | 143 +- src/main/audio_playback.c | 33 + src/main/audio_seqplayer.c | 32 + src/main/audio_synthesis.c | 27 +- src/main/audio_thread.c | 38 +- src/main/fox_360.c | 38 +- src/main/fox_beam.c | 64 +- src/main/fox_bg.c | 2 +- src/main/fox_boss.c | 4 +- src/main/fox_demo.c | 106 +- src/main/fox_display.c | 24 +- src/main/fox_edisplay.c | 30 +- src/main/fox_effect.c | 208 +- src/main/fox_enmy.c | 121 +- src/main/fox_enmy2.c | 151 +- src/main/fox_game.c | 8 +- src/main/fox_hud.c | 82 +- src/main/fox_load.c | 6 +- src/main/fox_play.c | 193 +- src/main/fox_radio.c | 21 +- src/main/fox_tank.c | 58 +- src/main/fox_versus.c | 40 +- src/main/sys_main.c | 8 +- src/mods/sfxjukebox.c | 18 +- src/overlays/ovl_ending/fox_end1.c | 6 +- src/overlays/ovl_ending/fox_end2.c | 4 +- src/overlays/ovl_i1/fox_co.c | 153 +- src/overlays/ovl_i1/fox_tr.c | 6 +- src/overlays/ovl_i1/fox_tr360.c | 2 +- src/overlays/ovl_i1/fox_ve1.c | 71 +- src/overlays/ovl_i2/fox_me.c | 122 +- src/overlays/ovl_i2/fox_sx.c | 97 +- src/overlays/ovl_i3/fox_a6.c | 112 +- src/overlays/ovl_i3/fox_aq.c | 182 +- src/overlays/ovl_i3/fox_so.c | 212 +- src/overlays/ovl_i3/fox_zo.c | 172 +- src/overlays/ovl_i4/fox_bo.c | 96 +- src/overlays/ovl_i4/fox_fo.c | 80 +- src/overlays/ovl_i4/fox_ka.c | 124 +- src/overlays/ovl_i4/fox_sz.c | 86 +- src/overlays/ovl_i5/fox_ma.c | 336 ++- src/overlays/ovl_i5/fox_ti.c | 171 +- src/overlays/ovl_i5/fox_ti_cs.c | 28 +- src/overlays/ovl_i6/fox_andross.c | 198 +- src/overlays/ovl_i6/fox_i6_4.c | 2 +- src/overlays/ovl_i6/fox_sy.c | 201 +- src/overlays/ovl_i6/fox_ve2.c | 20 +- src/overlays/ovl_menu/fox_map.c | 122 +- src/overlays/ovl_menu/fox_option.c | 138 +- src/overlays/ovl_menu/fox_title.c | 84 +- tools/permuter_settings.toml | 1 + yamls/us/main.yaml | 31 +- 69 files changed, 7151 insertions(+), 2721 deletions(-) create mode 100644 include/audioseq_cmd.h create mode 100644 include/audiothread_cmd.h create mode 100644 include/sf64audio_external.h create mode 100644 src/main/audio_context.c diff --git a/.vscode/settings.json b/.vscode/settings.json index a3656898..087d9bfc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,8 @@ "**/.github": true, "build/**": true, "expected/**": true, - "tools/**": true + "tools/**": true, + "ctx.c" : true }, "defines": [ "_LANGUAGE_C" @@ -63,8 +64,9 @@ "fox_option_assets.h": "c", "mods.h": "c", "i5.h": "c", - "ast_warp_zone.h": "c" - "sf64audio_provisional.h": "c" + "ast_warp_zone.h": "c", + "sf64audio_provisional.h": "c", + "fox_enmy_assets.h": "c" }, "C_Cpp_Runner.msvcBatchPath": "" } \ No newline at end of file diff --git a/include/audioseq_cmd.h b/include/audioseq_cmd.h new file mode 100644 index 00000000..1f2deed3 --- /dev/null +++ b/include/audioseq_cmd.h @@ -0,0 +1,524 @@ +#ifndef SEQCMD_H +#define SEQCMD_H + +void Audio_QueueSeqCmd(s32); + +// ==== Sequence Players ==== + +typedef enum { + /* 0 */ SEQ_PLAYER_BGM, + /* 1 */ SEQ_PLAYER_FANFARE, + /* 2 */ SEQ_PLAYER_SFX, + /* 3 */ SEQ_PLAYER_VOICE +} SequencePlayerId; + +// ==== Primary commands ==== + +#define SEQCMD_OP_MASK 0xF0000000 + +typedef enum { + /* 0x0 */ SEQCMD_OP_PLAY_SEQUENCE, + /* 0x1 */ SEQCMD_OP_STOP_SEQUENCE, + /* 0x2 */ SEQCMD_OP_QUEUE_SEQUENCE, + /* 0x3 */ SEQCMD_OP_UNQUEUE_SEQUENCE, + /* 0x4 */ SEQCMD_OP_SET_SEQPLAYER_VOLUME, + /* 0x5 */ SEQCMD_OP_SET_SEQPLAYER_FREQ, + /* 0x6 */ SEQCMD_OP_SET_CHANNEL_VOLUME, + /* 0x7 */ SEQCMD_OP_SET_SEQPLAYER_IO, + /* 0x8 */ SEQCMD_OP_SET_CHANNEL_IO, + /* 0x9 */ SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK, + /* 0xA */ SEQCMD_OP_SET_CHANNEL_DISABLE_MASK, + /* 0xB */ SEQCMD_OP_TEMPO_CMD, + /* 0xC */ SEQCMD_OP_SETUP_CMD, + /* 0xD */ SEQCMD_OP_SET_CHANNEL_FREQ, + /* 0xE */ SEQCMD_OP_GLOBAL_CMD, + /* 0xF */ SEQCMD_OP_RESET_AUDIO_HEAP +} SeqCmdOp; + +// ==== Secondary commands ==== + +// Subset of `SEQCMD_OP_TEMPO_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_TEMPO_SET, + /* 0x1 */ SEQCMD_SUB_OP_TEMPO_SPEED_UP, + /* 0x2 */ SEQCMD_SUB_OP_TEMPO_SLOW_DOWN, + /* 0x3 */ SEQCMD_SUB_OP_TEMPO_SCALE, + /* 0x4 */ SEQCMD_SUB_OP_TEMPO_RESET +} SeqCmdTempoCmdOp; + +// Subset of `SEQCMD_OP_SETUP_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME, + /* 0x1 */ SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE, + /* 0x2 */ SEQCMD_SUB_OP_SETUP_RESTART_SEQ, + /* 0x3 */ SEQCMD_SUB_OP_SETUP_TEMPO_SCALE, + /* 0x4 */ SEQCMD_SUB_OP_SETUP_TEMPO_RESET, + /* 0x5 */ SEQCMD_SUB_OP_SETUP_PLAY_SEQ, + /* 0x6 */ SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER, + /* 0x7 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED, + /* 0x8 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX, + /* 0x9 */ SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK, + /* 0xA */ SEQCMD_SUB_OP_SETUP_SET_SEQPLAYER_FREQ, + /* 0xE */ SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE = 0xE, + /* 0xF */ SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS +} SeqCmdSetupCmdOp; + +// Subset of `SEQCMD_OP_GLOBAL_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE, + /* 0x1 */ SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES +} SeqCmdSubCmdOp; + +// ==== Audio Sequence Primary Commands ==== + +/** + * Play a sequence on a given seqPlayer + * + * @param seqPlayerIndex the index of the seqPlayer to play the sequence + * @param fadeInDuration effect will depend on seqArg. See below + * @param seqArg no effect: < 0x7F, skip ahead: = 0x7F, will not play: >= 0x80 (see note) + * @param seqId the id of the sequence to play, see `SeqId` + * + * @note seqArg will also be stored in gActiveSeqs.seqId, any check against that seqId must also include seqArg. + * seqArg < 0x7F: fade in the sequence over `fadeInDuration` in units of (1/30th) seconds + * seqArg = 0x7F: start the sequence immediately, but begins `fadeInDuration` number of second into the sequence. + * seqArg >= 0x80: no sequence will play. Intended to load a soundFont asynchronously but was only half implemented + * (inferred from MM). + */ +#define SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, fadeInDuration, seqArg, seqId) \ + Audio_QueueSeqCmd((SEQCMD_OP_PLAY_SEQUENCE << 28) | ((u8)(seqPlayerIndex) << 24) | ((u8)(fadeInDuration) << 16) | \ + ((u8)(seqArg) << 8) | (u16)(seqId)) + +/** + * Stop a sequence on a given seqPlayer + * + * @param seqPlayerIndex the index of the seqPlayer to stop the sequence + * @param fadeOutDuration duration the sequence will fade out over + * + * @note the 0xFF in the command is not read from at all, but is common in all Stop SeqPlayer Commands + */ +#define SEQCMD_STOP_SEQUENCE(seqPlayerIndex, fadeOutDuration) \ + Audio_QueueSeqCmd((SEQCMD_OP_STOP_SEQUENCE << 28) | 0xFF | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(fadeOutDuration) << 16)) + +#define SEQCMD_STOP_SEQUENCE_ALT(seqPlayerIndex, fadeOutDuration) \ + Audio_QueueSeqCmd((SEQCMD_OP_STOP_SEQUENCE << 28) | 0xFF | ((u8)(fadeOutDuration) << 16) | \ + ((u8)(seqPlayerIndex) << 24)) +/** + * Add a sequence to a queue of sequences associated with a given seqPlayer. + * If the sequence is first in queue, play the sequence + * + * @param seqPlayerIndex the index of the seqPlayer to queue the sequence + * @param fadeInDuration if the sequence is played, duration the sequence will fade in over + * @param priority priority in the queue. The highest valued priority will be queued to play first. Also used as `seqArg`. + * @param seqId the id of the sequence to play, see `SeqId` + * + * @note for the next sequence in the queue to play, the current sequence must be unqueued with the unqueue command + * @note for a priority >= 0x7F, similar effects happen as `seqArg` in the play sequence command + */ +#define SEQCMD_QUEUE_SEQUENCE(seqPlayerIndex, fadeInDuration, priority, seqId) \ + Audio_QueueSeqCmd((SEQCMD_OP_QUEUE_SEQUENCE << 28) | ((u8)(seqPlayerIndex) << 24) | ((u8)(fadeInDuration) << 16) | \ + ((u8)(priority) << 8) | (u8)(seqId)) + +/** + * Remove a sequence from a queue of sequences associated with a given seqPlayer. + * If the sequence is first in queue, stop the sequence, and play the next one in queue if any + * + * @param seqPlayerIndex the index of the seqPlayer to queue the sequence + * @param fadeInDuration if the sequence is stopped, duration the sequence will fade out over, and duration the next seq will fade in over + * @param seqId the id of the sequence to remove, see `SeqId` + * + * @note for the next sequence in the queue to play, the current sequence must be unqueued with this command + */ +#define SEQCMD_UNQUEUE_SEQUENCE(seqPlayerIndex, fadeOutInDuration, seqId) \ + Audio_QueueSeqCmd((SEQCMD_OP_UNQUEUE_SEQUENCE << 28) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(fadeOutInDuration) << 16) | (seqId)) + +/** + * Set the volume of an entire sequence on a given seqPlayer. Fade to the volume over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + * @param volume the target volume for the sequence. Ranged from 0-0xFF, with 0x7F mapping to 1.0f + */ +#define SEQCMD_SET_SEQPLAYER_VOLUME(seqPlayerIndex, duration, volume) \ + Audio_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_VOLUME << 28) | ((u8)(seqPlayerIndex) << 24) | ((duration) << 16) | \ + (volume)) + +/** + * Scale the frequency of every channel on a given seqPlayer over a specified duration. + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFFFF, with 1000 mapping to 1.0f + * + * @note 2000 will double the frequency (raise an octave), 500 will halve the frequency (lower an octave). + * Cannot be used with `SEQCMD_SET_CHANNEL_FREQ` as they will overwrite one another. + */ +#define SEQCMD_SET_SEQPLAYER_FREQ(seqPlayerIndex, duration, freqScale) \ + Audio_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_FREQ << 28) | ((u8)(seqPlayerIndex) << 24) | ((duration) << 16) | \ + (freqScale)) + +/** + * Scale the frequency of a specific channel on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFFF, with 1000 mapping to 1.0f + * + * @note a frequency of 2000 will double the frequency (raise an octave), 500 will halve the frequency (lower an octave). + * Cannot be used with `SEQCMD_SET_SEQPLAYER_FREQ` as they will overwrite one another. + */ +#define SEQCMD_SET_CHANNEL_FREQ(seqPlayerIndex, channelIndex, duration, freqScale) \ + Audio_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_FREQ << 28) | ((u8)(seqPlayerIndex) << 24) | ((duration) << 16) | \ + ((channelIndex) << 12) | (freqScale)) + +/** + * Set the volume of a specific channel on a given seqPlayer. Fade to the volume over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param duration duration to transition to the volume + * @param volume the target volume for the sequence. Ranged from 0-0xFF, with 0x7F mapping to 1.0f + */ +#define SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, channelIndex, duration, volume) \ + Audio_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_VOLUME << 28) | ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | \ + ((u8)(channelIndex) << 8) | ((u8)volume)) + +/** + * Write a value that can be read as input directly by the sequence itself. This will be set to the global + * ioPort, which can affect the entire sequence. + * + * @param seqPlayerIndex the index of the seqPlayer to write the input to + * @param ioPort the index of the array to store the input-output value + * @param ioData the value s8 that's written to the input-output array + * + * @note Each seqPlayer has 8 global ioPorts indexed 0-7. + * ioPort 0 and 1 are read-only-once, and will reset after being read by the sequence. + * ioPort 2-7 can be read multiple times. + */ +#define SEQCMD_SET_SEQPLAYER_IO(seqPlayerIndex, ioPort, ioData) \ + Audio_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_IO << 28) | ((u8)(seqPlayerIndex) << 24) | ((u8)(ioPort) << 16) | \ + (u8)(ioData)) + +/** + * Write a value that can be read as input directly by the sequence itself. This will be set to the channel + * ioPort, which will only affect a single channel. + * + * @param seqPlayerIndex the index of the seqPlayer to write the input to + * @param channelIndex the index of the channel to write the input to + * @param ioPort the index of the array to store the input-output value + * @param ioData the value s8 that's written to the input-output array + * + * @note Each channel has 8 channel ioPorts indexed 0-7. + * ioPort 0 and 1 are read-only-once, and will reset after being read by the sequence. + * ioPort 2-7 can be read multiple times. + */ +#define SEQCMD_SET_CHANNEL_IO(seqPlayerIndex, channelIndex, ioPort, ioData) \ + Audio_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_IO << 28) | ((u8)(seqPlayerIndex) << 24) | ((u8)(ioPort) << 16) | \ + ((u8)(channelIndex) << 8) | (u8)(ioData)) + +/** + * Disable (or reenable) specific channels from receiving input set by `SEQCMD_SET_CHANNEL_IO` + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + * + * @note using AUDIOCMD_CHANNEL_SET_IO will bypass this channelMask + */ +#define SEQCMD_SET_CHANNEL_IO_DISABLE_MASK(seqPlayerIndex, channelMask) \ + Audio_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK << 28) | ((u8)(seqPlayerIndex) << 24) | (u16)(channelMask)) + +/** + * Disable (or reenable) specific channels + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + */ +#define SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, channelMask) \ + Audio_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_DISABLE_MASK << 28) | ((u8)(seqPlayerIndex) << 24) | (u16)(channelMask)) + +// ==== Audio Sequence Tempo Commands ==== + +/** + * Set the absolute tempo of a sequence on a given seqPlayer, fading over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoTarget the target tempo for the sequence + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SET_TEMPO(seqPlayerIndex, duration, tempoTarget) \ + Audio_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SET << 12) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16) | (u16)(tempoTarget)) + +/** + * Increase the tempo of a sequence by a relative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoIncrease the change to add to the current tempo + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SPEED_UP_TEMPO(seqPlayerIndex, duration, tempoIncrease) \ + Audio_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SPEED_UP << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u16)(tempoIncrease)) + +/** + * Decrease the tempo of a sequence by a relative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoDecrease the change to subtract to the current tempo + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SLOW_DOWN_TEMPO(seqPlayerIndex, duration, tempoDecrease) \ + Audio_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SLOW_DOWN << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u16)(tempoDecrease)) + +/** + * Scale the tempo of a sequence by a multiplicative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoScale the scaling factor of the tempo, relative to 100 + * + * @note a tempoScale of 200 will go double-time, 50 will go half-time. + * the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SCALE_TEMPO(seqPlayerIndex, duration, tempoScale) \ + Audio_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SCALE << 12) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16) | (u16)(tempoScale)) + +/** + * Reset the tempo of a sequence to the original tempo on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + */ +#define SEQCMD_RESET_TEMPO(seqPlayerIndex, duration) \ + Audio_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_RESET << 12) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16)) + +/** + * ==== Audio Sequence Setup Commands ==== + * + * The setup commands are designed to wait to be executed. + * Up to 8 commands can be queued per `seqPlayerIndex`. + * These commands will only execute once that `seqPlayerIndex` is finished playing and is no longer enabled. + * They will often target a different player (`targetSeqPlayerIndex`) but not always. + */ + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME(setupSeqPlayerIndex, targetSeqPlayerIndex, duration) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | ((u8)(duration) << 8)) + +/** + * Setup a request to unqueue a seqPlayer once that same setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to unqueue once the same seqPlayer is disabled + * + * @bug this command was misimplemented and fails to unqueue. The command relies on `gActiveSeqs.seqId` for + * unqueueing, but seqId is reset before being used to unqueue. A simple fix is to unqueue based on + * `gActiveSeqs.prevSeqId` instead. + */ +#define SEQCMD_SETUP_UNQUEUE_SEQUENCE(setupSeqPlayerIndex) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24)) + +/** + * Setup a request to restart and play an active sequence currently playing on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to restart its active sequence + */ +#define SEQCMD_SETUP_RESTART_SEQUENCE(setupSeqPlayerIndex, targetSeqPlayerIndex) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTART_SEQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16)) + +/** + * Setup a request to scale the tempo of a sequence by a multiplicative value on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoScale the scaling factor of the tempo, relative to 100 + * + * @note a tempoScale of 200 will go double-time, 50 will go half-time. + * the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SETUP_SCALE_TEMPO(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, tempoScale) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_TEMPO_SCALE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | ((u8)(duration) << 8) | \ + (u8)(tempoScale)) + +/** + * Setup a request to reset the tempo of a sequence to the original tempo on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + */ +#define SEQCMD_SETUP_RESET_TEMPO(setupSeqPlayerIndex, targetSeqPlayerIndex, duration) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_TEMPO_RESET << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u8)(duration)) + +/** + * Setup a request to play a sequence on a target seqPlayer once a setup seqPlayer is finished playing and disabled. + * This command is optionally paired with `SEQCMD_SETUP_SET_FADE_IN_TIMER` to set the fade in duration + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to play the sequence + * @param seqId the id of the sequence to play, see `SeqId` + */ +#define SEQCMD_SETUP_PLAY_SEQUENCE(setupSeqPlayerIndex, targetSeqPlayerIndex, seqId) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_PLAY_SEQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u16)(seqId)) + +/** + * This command is an optional command before `SEQCMD_SETUP_PLAY_SEQUENCE` to set the fade in duration + * (see cmd above) + * + * @param targetSeqPlayerIndex the index of the seqPlayer to play the sequence + * @param fadeInDuration duration the sequence will fade in over + */ +#define SEQCMD_SETUP_SET_FADE_IN_TIMER(targetSeqPlayerIndex, fadeInDuration) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER << 20) | \ + ((u8)(targetSeqPlayerIndex) << 24) | ((u8)(fadeInDuration) << 8)) + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled. + * Specifically, it will only restore volume if the number of queued requests on the setup seqPlayer matches + * the number of sequences queued + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + * @param numSeqRequests the number of sequence requests queued that must match the actual number of sequence requests + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, \ + numSeqRequests) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | ((u8)(duration) << 8) | \ + (u8)(numSeqRequests)) + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled. + * Allows `scaleIndex` to be specified. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param scaleIndex the scale index of a seqPlayer + * @param duration duration to transition to the volume + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX(setupSeqPlayerIndex, targetSeqPlayerIndex, scaleIndex, \ + duration) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | \ + (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(scaleIndex) << 8) | (u8)(duration)) + +/** + * Setup a request to disable (or reenable) specific channels on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + */ +#define SEQCMD_SETUP_SET_CHANNEL_DISABLE_MASK(setupSeqPlayerIndex, targetSeqPlayerIndex, channelMask) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u16)(channelMask)) + +/** + * Queue a request to scale the frequency of an entire sequence on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFF, with 100 mapping to 1.0f + * + * @note The base value for frequency, 100, is 10 times smaller than other frequency commands. + * 200 will double the frequency (raise an octave), 50 will halve the frequency (lower an octave). + */ +#define SEQCMD_SETUP_SET_SEQPLAYER_FREQ(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, freqScale) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_SEQPLAYER_FREQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | ((u8)(duration) << 8) | \ + (u8)(freqScale)) + +/** + * Queue a request to discard audio data by popping an entry from the persistent caches on the audio heap, + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param tableTypeFlag All tables with the flag `(tableTypeFlag & (1 << tableType))` will be discarded. Specifically: + * `(tableTypeFlag & 1)` will discard the `SEQUENCE_TABLE` + * `(tableTypeFlag & 2)` will discard the `FONT_TABLE` + * `(tableTypeFlag & 4)` will discard the `SAMPLE_TABLE` + */ +#define SEQCMD_SETUP_POP_PERSISTENT_CACHE(setupSeqPlayerIndex, tableTypeFlag) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)tableTypeFlag)) + +/** + * Discard all setup command requests on a seqPlayerIndex by resetting the setup command queue + * + * @param setupSeqPlayerIndex the index of the seqPlayer to disable all setup commands + */ +#define SEQCMD_RESET_SETUP_CMDS(setupSeqPlayerIndex) \ + Audio_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24)) + +/** + * ==== Audio Sequence Global Commands ==== + * + * The global commands will apply to the entire audio system and all 4 sequence players + */ + +/** + * Change the sound mode of audio + * + * @param soundMode see the `SoundMode` enum + */ +#define SEQCMD_SET_SOUND_MODE(soundMode) \ + Audio_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE << 8) | (u8)(soundMode)) + +/** + * Disable (or reenable) new sequences from starting + * + * @param isDisabled true to disable, false to enable + * + * @note this does not disable the sfx player + */ +#define SEQCMD_DISABLE_PLAY_SEQUENCES(isDisabled) \ + Audio_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES << 8) | \ + (u16)(isDisabled)) + +/** + * Restart the audio heap with the specified settings + * + * @param sfxChannelLayout index for different mappings between the 7 banks and the 16 channels + * @param specId index for the audio specifications to set high-level audio parameters + * + * @note: For sfxChannelLayout, There are 4 possible layouts indexed by 0-3. + * However, only index 0 is properly implemented. Other indices lead to bugs and softlocks. + */ +#define SEQCMD_RESET_AUDIO_HEAP(sfxChannelLayout, specId) \ + Audio_QueueSeqCmd((SEQCMD_OP_RESET_AUDIO_HEAP << 28) | ((u8)(sfxChannelLayout) << 8) | (u8)(specId)) + +#endif diff --git a/include/audiothread_cmd.h b/include/audiothread_cmd.h new file mode 100644 index 00000000..123af3aa --- /dev/null +++ b/include/audiothread_cmd.h @@ -0,0 +1,543 @@ +#ifndef AUDIOTHREAD_CMD_H +#define AUDIOTHREAD_CMD_H + + +void AudioThread_QueueCmd(u32, void**); +void AudioThread_QueueCmdF32(u32, f32); +void AudioThread_QueueCmdS32(u32, u32); +void AudioThread_QueueCmdS8(u32, s8); + +/** + * Audio thread commands to safely transfer information/requests/data + * from the external graph thread to the internal audio thread + */ + +typedef enum { + // Channel Commands + /* 0x00 */ AUDIOCMD_OP_NOOP, + /* 0x01 */ AUDIOCMD_OP_CHANNEL_SET_VOL_SCALE, + /* 0x02 */ AUDIOCMD_OP_CHANNEL_SET_VOL, + /* 0x03 */ AUDIOCMD_OP_CHANNEL_SET_PAN, + /* 0x04 */ AUDIOCMD_OP_CHANNEL_SET_FREQ_SCALE, + /* 0x05 */ AUDIOCMD_OP_CHANNEL_SET_REVERB_VOLUME, + /* 0x06 */ AUDIOCMD_OP_CHANNEL_SET_IO, + /* 0x07 */ AUDIOCMD_OP_CHANNEL_SET_PAN_WEIGHT, + /* 0x08 */ AUDIOCMD_OP_CHANNEL_SET_MUTE, + /* 0x09 */ AUDIOCMD_OP_CHANNEL_SET_MUTE_BEHAVIOR, + /* 0x0A */ AUDIOCMD_OP_CHANNEL_SET_VIBRATO_DEPTH, + /* 0x0B */ AUDIOCMD_OP_CHANNEL_SET_VIBRATO_RATE, + /* 0x0C */ AUDIOCMD_OP_CHANNEL_SET_COMB_FILTER_SIZE, + /* 0x0D */ AUDIOCMD_OP_CHANNEL_SET_COMB_FILTER_GAIN, + /* 0x0E */ AUDIOCMD_OP_CHANNEL_SET_STEREO, + // SeqPlayer Commands + /* 0x41 */ AUDIOCMD_OP_SEQPLAYER_FADE_VOLUME_SCALE = 0x41, + /* 0x46 */ AUDIOCMD_OP_SEQPLAYER_SET_IO = 0x46, + /* 0x47 */ AUDIOCMD_OP_SEQPLAYER_SET_TEMPO, + /* 0x48 */ AUDIOCMD_OP_SEQPLAYER_SET_TRANSPOSITION, + /* 0x49 */ AUDIOCMD_OP_SEQPLAYER_CHANGE_TEMPO, + /* 0x4A */ AUDIOCMD_OP_SEQPLAYER_FADE_TO_SET_VOLUME, + /* 0x4B */ AUDIOCMD_OP_SEQPLAYER_FADE_TO_SCALED_VOLUME, + /* 0x4C */ AUDIOCMD_OP_SEQPLAYER_RESET_VOLUME, + /* 0x4D */ AUDIOCMD_OP_SEQPLAYER_SET_BEND, + /* 0x4E */ AUDIOCMD_OP_SEQPLAYER_CHANGE_TEMPO_SEQTICKS, + // Global Commands + /* 0x81 */ AUDIOCMD_OP_GLOBAL_SYNC_LOAD_SEQ_PARTS = 0x81, + /* 0x82 */ AUDIOCMD_OP_GLOBAL_INIT_SEQPLAYER, + /* 0x83 */ AUDIOCMD_OP_GLOBAL_DISABLE_SEQPLAYER, + /* 0x85 */ AUDIOCMD_OP_GLOBAL_INIT_SEQPLAYER_SKIP_TICKS = 0x85, + /* 0x90 */ AUDIOCMD_OP_GLOBAL_SET_CHANNEL_MASK = 0x90, + /* 0xE0 */ AUDIOCMD_OP_GLOBAL_SET_DRUM_FONT = 0xE0, + /* 0xE1 */ AUDIOCMD_OP_GLOBAL_SET_SFX_FONT, + /* 0xE2 */ AUDIOCMD_OP_GLOBAL_SET_INSTRUMENT_FONT, + /* 0xE3 */ AUDIOCMD_OP_GLOBAL_POP_PERSISTENT_CACHE, + /* 0xF0 */ AUDIOCMD_OP_GLOBAL_SET_SOUND_MODE = 0xF0, + /* 0xF1 */ AUDIOCMD_OP_GLOBAL_MUTE, + /* 0xF2 */ AUDIOCMD_OP_GLOBAL_UNMUTE, + /* 0xF3 */ AUDIOCMD_OP_GLOBAL_SYNC_LOAD_INSTRUMENT, + /* 0xF4 */ AUDIOCMD_OP_GLOBAL_ASYNC_LOAD_SAMPLE_BANK, + /* 0xF5 */ AUDIOCMD_OP_GLOBAL_ASYNC_LOAD_FONT, + /* 0xF6 */ AUDIOCMD_OP_GLOBAL_DISCARD_SEQ_FONTS, + /* 0xF8 */ AUDIOCMD_OP_GLOBAL_STOP_AUDIOCMDS = 0xF8, + /* 0xF9 */ AUDIOCMD_OP_GLOBAL_RESET_AUDIO_HEAP, + /* 0xFA */ AUDIOCMD_OP_GLOBAL_NOOP_1, // used but no code exists for it + /* 0xFB */ AUDIOCMD_OP_GLOBAL_SET_CUSTOM_UPDATE_FUNCTION, + /* 0xFC */ AUDIOCMD_OP_GLOBAL_ASYNC_LOAD_SEQ, + /* 0xFD */ AUDIOCMD_OP_GLOBAL_NOOP_2, // used but no code exists for it + /* 0xFE */ AUDIOCMD_OP_GLOBAL_DISABLE_ALL_SEQPLAYERS +} AudioThreadCmdOp; + +// Pass to a AUDIOCMD_CHANNEL_ command in place of a channelIndex to try and apply to all channels. +// Then uses `threadCmdChannelMask` to determine which channels to apply the command to. +#define AUDIOCMD_ALL_CHANNELS 0xFF + +// ==== Audio Thread Channel Commands ==== + +/** + * Set the volumeMod on a given channel + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param volumeMod (f32) the volume scale for the sequence. No change in volume is 1.0f + */ +#define AUDIOCMD_CHANNEL_SET_VOL_SCALE(seqPlayerIndex, channelIndex, volumeMod) \ + AudioThread_QueueCmdF32(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_VOL_SCALE, seqPlayerIndex, channelIndex, 0), \ + volumeMod) + +/** + * Set the volume on a given channel + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param volume (f32) the target volume for the sequence. Default volume is 1.0f + */ +#define AUDIOCMD_CHANNEL_SET_VOL(seqPlayerIndex, channelIndex, volume) \ + AudioThread_QueueCmdF32(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_VOL, seqPlayerIndex, channelIndex, 0), volume) + +/** + * Set the pan + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param pan (s8) the pan applied to the channel + */ +#define AUDIOCMD_CHANNEL_SET_PAN(seqPlayerIndex, channelIndex, pan) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_PAN, seqPlayerIndex, channelIndex, 0), pan) + +/** + * Set frequency scale + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param freqMod (f32) the scaling factor to shift the pitch. + */ +#define AUDIOCMD_CHANNEL_SET_FREQ_SCALE(seqPlayerIndex, channelIndex, freqMod) \ + AudioThread_QueueCmdF32(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_FREQ_SCALE, seqPlayerIndex, channelIndex, 0), \ + freqMod) + +/** + * Set reverb volume + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param reverbVolume (s8) volume to set the reverb to (dry/wet mix) + */ +#define AUDIOCMD_CHANNEL_SET_REVERB_VOLUME(seqPlayerIndex, channelIndex, reverbVolume) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_REVERB_VOLUME, seqPlayerIndex, channelIndex, 0), \ + reverbVolume) + +/** + * Write a value that can be read as input directly by the sequence itself. This will be set to the channel + * ioPort, which will only affect a single channel + * + * @param seqPlayerIndex the index of the seqPlayer to write the input to + * @param channelIndex the index of the channel to write the input to + * @param ioPort the index of the array to store the input-output value + * @param ioData (s8) the value that's written to the input-output array + */ +#define AUDIOCMD_CHANNEL_SET_IO(seqPlayerIndex, channelIndex, ioPort, ioData) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_IO, (seqPlayerIndex), (channelIndex), (ioPort)), \ + (ioData)) + +/** + * Set the proportion of pan that comes from the channel + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param panChannelWeight (s8) proportion of pan that comes from the channel. + * Set to 0 for layer-only, and 128 for channel-only. + * As the type used is `s8` and internally cast to u8 later, + * pass `-128` to produce 128, or just use 127 instead + */ +#define AUDIOCMD_CHANNEL_SET_PAN_WEIGHT(seqPlayerIndex, channelIndex, panChannelWeight) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_PAN_WEIGHT, seqPlayerIndex, channelIndex, 0), \ + panChannelWeight) + +/** + * Mute a specified channel. How a muted channel behaves will depend on channel mute flags + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param muted (s8) set true to mute + */ +#define AUDIOCMD_CHANNEL_SET_MUTE(seqPlayerIndex, channelIndex, muted) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_MUTE, seqPlayerIndex, channelIndex, 0), muted) + +/** + * Set the muteBehavior for a specified channel + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param muteBehavior (s8) Affected how a muted channel behaves. See `MUTE_BEHAVIOR_` macros + */ +#define AUDIOCMD_CHANNEL_SET_MUTE_BEHAVIOR(seqPlayerIndex, channelIndex, muteBehavior) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_MUTE_BEHAVIOR, seqPlayerIndex, channelIndex, 0), \ + muteBehavior) + +/** + * Set the vibrato depth (also called magnitude/amplitude/extent) + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param vibratoDepthTarget (s8) the vibrato depth scaled down by 1/8th + */ +#define AUDIOCMD_CHANNEL_SET_VIBRATO_DEPTH(seqPlayerIndex, channelIndex, vibratoDepthTarget) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_VIBRATO_DEPTH, seqPlayerIndex, channelIndex, 0), \ + vibratoDepthTarget) + +/** + * Set the vibrato rate (freq/pitch) + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param vibratoRateTarget (s8) the vibrato rate scaled down by 1/32nd + */ +#define AUDIOCMD_CHANNEL_SET_VIBRATO_RATE(seqPlayerIndex, channelIndex, vibratoRateTarget) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_VIBRATO_RATE, seqPlayerIndex, channelIndex, 0), \ + vibratoRateTarget) + +/** + * Set the comb filter size + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param combFilterSize (s8) delay number of sample bytes to offset and add back to itself + */ +#define AUDIOCMD_CHANNEL_SET_COMB_FILTER_SIZE(seqPlayerIndex, channelIndex, combFilterSize) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_COMB_FILTER_SIZE, seqPlayerIndex, channelIndex, 0), \ + combFilterSize) + +/** + * Set the comb filter gain + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param combFilterGain (u16) strength of the signal added back to itself + */ +#define AUDIOCMD_CHANNEL_SET_COMB_FILTER_GAIN(seqPlayerIndex, channelIndex, combFilterGain) \ + AudioThread_QueueCmdU16(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_COMB_FILTER_GAIN, seqPlayerIndex, channelIndex, 0), \ + combFilterGain) + +/** + * Set the stereo bits + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param stereoData (s8) bit-packed stereo information. See `StereoData` + */ +#define AUDIOCMD_CHANNEL_SET_STEREO(seqPlayerIndex, channelIndex, stereoData) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_STEREO, seqPlayerIndex, channelIndex, 0), stereoData) + +// ==== Audio Thread SeqPlayer Commands ==== + +/** + * Set the fade volume scale + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param fadeVolumeMod (f32) multiplicative scaling factor to apply to volume + */ +#define AUDIOCMD_SEQPLAYER_FADE_VOLUME_SCALE(seqPlayerIndex, fadeVolumeMod) \ + AudioThread_QueueCmdF32(AUDIO_MK_CMD(AUDIOCMD_OP_SEQPLAYER_FADE_VOLUME_SCALE, seqPlayerIndex, 0, 0), \ + fadeVolumeMod) + +/** + * Write a value that can be read as input directly by the sequence itself. This will be set to the global + * ioPort, which can affect the entire sequence + * + * @param seqPlayerIndex the index of the seqPlayer to write the input to + * @param ioPort the index of the array to store the input-output value + * @param ioData (s8) the value that's written to the input-output array + */ +#define AUDIOCMD_SEQPLAYER_SET_IO(seqPlayerIndex, unk, ioPort, ioData) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_SEQPLAYER_SET_IO, seqPlayerIndex, unk, ioPort), ioData) + +/** + * Set the tempo (bpm) of a sequence on a given seqPlayer + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param tempo (s32) the tempo for the sequence, in bpm + */ +#define AUDIOCMD_SEQPLAYER_SET_TEMPO(seqPlayerIndex, tempo) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_SEQPLAYER_SET_TEMPO, seqPlayerIndex, 0, 0), tempo) + +/** + * Set the transposition + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param transposition (s8) the number of semitones to increase or decrease by for all notes on the seqPlayer + */ +#define AUDIOCMD_SEQPLAYER_SET_TRANSPOSITION(seqPlayerIndex, transposition) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_SEQPLAYER_SET_TRANSPOSITION, seqPlayerIndex, 0, 0), transposition) + +/** + * Set tempoChange in bpm + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param tempoChange (s32) difference in tempo to change, in bpm + */ +#define AUDIOCMD_SEQPLAYER_CHANGE_TEMPO(seqPlayerIndex, tempoChange) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_SEQPLAYER_CHANGE_TEMPO, seqPlayerIndex, 0, 0), tempoChange) + +/** + * Set tempoChange in seqTicks per minute + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param tempoChange (s32) difference in tempo to change, in seqTicks per minute + */ +#define AUDIOCMD_SEQPLAYER_CHANGE_TEMPO_SEQTICKS(seqPlayerIndex, tempoChange) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_SEQPLAYER_CHANGE_TEMPO_SEQTICKS, seqPlayerIndex, 0, 0), tempoChange) + +/** + * Fade the volume to the target volume requested in the command + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param fadeVolume target volume to fade to + * @param fadeTimer (s32) number of ticks to fade to `fadeVolume` + */ +#define AUDIOCMD_SEQPLAYER_FADE_TO_SET_VOLUME(seqPlayerIndex, fadeVolume, fadeTimer) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_SEQPLAYER_FADE_TO_SET_VOLUME, seqPlayerIndex, fadeVolume, 0), \ + fadeTimer) + +/** + * Fade the volume to the current volume scaled by a scale factor + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param fadeVolumeMod scaling factor to apply to volume to get the targetVolume + * @param fadeTimer (s32) number of ticks to fade to `targetVolume` + */ +#define AUDIOCMD_SEQPLAYER_FADE_TO_SCALED_VOLUME(seqPlayerIndex, fadeVolumeMod, fadeTimer) \ + AudioThread_QueueCmdS32( \ + AUDIO_MK_CMD(AUDIOCMD_OP_SEQPLAYER_FADE_TO_SCALED_VOLUME, seqPlayerIndex, fadeVolumeMod, 0), fadeTimer) + +/** + * Reset to the default volume of the seqPlayer + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param fadeTimer (s32) number of ticks to fade the sequence back to its default volume + */ +#define AUDIOCMD_SEQPLAYER_RESET_VOLUME(seqPlayerIndex, fadeTimer) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_SEQPLAYER_RESET_VOLUME, seqPlayerIndex, 0, 0), fadeTimer) + +/** + * Set the bend + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param bend (f32) ratio relative to 1.0f to scale channel frequencies by + */ +#define AUDIOCMD_SEQPLAYER_SET_BEND(seqPlayerIndex, bend) \ + AudioThread_QueueCmdF32(AUDIO_MK_CMD(AUDIOCMD_OP_SEQPLAYER_SET_BEND, seqPlayerIndex, 0, 0), bend) + +// ==== Audio Thread Global Commands ==== + +/** + * Synchronously load a sequence in parts + * + * @param seqId the id of the sequence to load, see `SeqId` + * @param flags set `& 1` to load the sequence, set `& 2` to load the soundfonts + */ +#define AUDIOCMD_GLOBAL_SYNC_LOAD_SEQ_PARTS(seqId, flags) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SYNC_LOAD_SEQ_PARTS, 0, seqId, flags), 0) + +/** + * Synchronously initialize a sequence player + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param seqId the id of the sequence to play, see `SeqId` + * @param fadeInTimer (s32) number of ticks to fade in the sequence to the requested volume + */ +#define AUDIOCMD_GLOBAL_INIT_SEQPLAYER(seqPlayerIndex, seqId, fadeInTimer) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_INIT_SEQPLAYER, seqPlayerIndex, seqId, 0), fadeInTimer) + +/** + * Disable a sequence player + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param fadeOutTimer (s32) number of ticks to fade out the sequence + */ +#define AUDIOCMD_GLOBAL_DISABLE_SEQPLAYER(seqPlayerIndex, fadeOutTimer) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_DISABLE_SEQPLAYER, seqPlayerIndex, 0, 0), fadeOutTimer) + +/** + * Synchronously initialize a sequence player and skip ticks, + * allowing the sequence to start somewhere other than the beginning of the sequences + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param seqId the id of the sequence to play, see `SeqId` + * @param skipTicks (s32) number of ticks to skip before starting the sequence + */ +#define AUDIOCMD_GLOBAL_INIT_SEQPLAYER_SKIP_TICKS(seqPlayerIndex, seqId, skipTicks) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_INIT_SEQPLAYER_SKIP_TICKS, seqPlayerIndex, seqId, 0), \ + skipTicks) + +/** + * When processing an audio thread channel command on all channels, set which channels to process + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param threadCmdChannelMask (u16) bitfield for 16 channels. Turn bit on to allow audio thread commands of type + * "Channel" to process that channel with `AUDIOCMD_ALL_CHANNELS` set. + */ +#define AUDIOCMD_GLOBAL_SET_CHANNEL_MASK(seqPlayerIndex, threadCmdChannelMask) \ + AudioThread_QueueCmdU16(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_CHANNEL_MASK, seqPlayerIndex, 0, 0), \ + threadCmdChannelMask) + +/** + * Set a drum ptr within a soundfont + * + * @param fontId the id of the soundfont to set the drum in + * @param drumId the id of the drum to set + * @param drumPtr (s32) the ptr to the `Drum` struct + */ +#define AUDIOCMD_GLOBAL_SET_DRUM_FONT(fontId, drumId, drumPtr) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_DRUM_FONT, fontId, drumId, 0), drumPtr) + +/** + * Set a soundeffect ptr within a soundfont + * + * @param fontId the id of the soundfont to set the sound effect in + * @param soundEffectId the id of the sound effect to set + * @param soundEffectPtr (s32) the ptr to the `SoundEffect` struct + */ +#define AUDIOCMD_GLOBAL_SET_SFX_FONT(fontId, soundEffectId, soundEffectPtr) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_SFX_FONT, fontId, soundEffectId, 0), soundEffectPtr) + +/** + * Set an instrument ptr within a soundfont + * + * @param fontId the id of the soundfont to set the instrument in + * @param instId the id of the instrument to set + * @param instPtr (s32) the ptr to the `Instrument` struct + */ +#define AUDIOCMD_GLOBAL_SET_INSTRUMENT_FONT(fontId, instId, instPtr) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_INSTRUMENT_FONT, fontId, instId, 0), instPtr) + +/** + * Pop the persistent cache of the specified table + * + * @param tableType (s32) see the `SampleBankTableType` enum + */ +#define AUDIOCMD_GLOBAL_POP_PERSISTENT_CACHE(tableType) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_POP_PERSISTENT_CACHE, 0, 0, 0), tableType) + +/** + * Change the sound mode of audio + * + * @param soundMode (s32) see the `SoundMode` enum + */ +#define AUDIOCMD_GLOBAL_SET_SOUND_MODE(soundMode) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_SOUND_MODE, 0, 0, 0), soundMode) + +/** + * Mute all sequence players + */ +#define AUDIOCMD_GLOBAL_MUTE() \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_MUTE, 0, 0, 0), 0) + +/** + * Unmute all sequence players + * + * @param restartNotes (s32) if set to 1, then notes with the `MUTE_BEHAVIOR_STOP_SAMPLES` flag set + * are marked as finished for all seqPlayers + */ +#define AUDIOCMD_GLOBAL_UNMUTE(restartNotes) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_UNMUTE, 0, 0, 0), restartNotes) + +/** + * Synchronously load an instrument + * + * @param fontId the id of the soundfont to load + * @param instId If below 0x7F, the id of the instrument to use. If equal to 0x7F, load the drum using the drumId + * @param drumId the id of the drum to use + */ +#define AUDIOCMD_GLOBAL_SYNC_LOAD_INSTRUMENT(fontId, instId, drumId) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SYNC_LOAD_INSTRUMENT, fontId, instId, drumId), 0) + +/** + * Asynchronously load a sample bank + * + * @param sampleBankId the id of the samplebank to load + * @param retData return data from `externalLoadQueue` + */ +#define AUDIOCMD_GLOBAL_ASYNC_LOAD_SAMPLE_BANK(sampleBankId, retData) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_ASYNC_LOAD_SAMPLE_BANK, sampleBankId, 0, retData), 0) + +/** + * Asynchronously load a font + * + * @param fontId the id of the soundfont to load + * @param retData return data from `externalLoadQueue` + */ +#define AUDIOCMD_GLOBAL_ASYNC_LOAD_FONT(fontId, unk, retData) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_ASYNC_LOAD_FONT, fontId, unk, retData), 0) + +/** + * Discard sequence fonts + * + * @param seqId the id of the sequence to discard, see `SeqId` + */ +#define AUDIOCMD_GLOBAL_DISCARD_SEQ_FONTS(seqId) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_DISCARD_SEQ_FONTS, 0, seqId, 0), 0) + +/** + * Stop processing all audio thread commands + */ +#define AUDIOCMD_GLOBAL_STOP_AUDIOCMDS() \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_STOP_AUDIOCMDS, 0, 0, 0), 0) + +/** + * Reset Audio Heap + * + * @param specId (s32) index for the audio specifications to set high-level audio parameters + */ +#define AUDIOCMD_GLOBAL_RESET_AUDIO_HEAP(specId) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_RESET_AUDIO_HEAP, 0, 0, 0), specId) + +/** + * No Operation. No code exists for this OP + * + * @param arg0 No info + * @param arg1 No info + * @param arg2 No info + * @param data (s32) No info + */ +#define AUDIOCMD_GLOBAL_NOOP_1(arg0, arg1, arg2, data) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_NOOP_1, arg0, arg1, arg2), data) + +/** + * Set a custom function that runs every audio thread update, see `AudioCustomUpdateFunction` + * + * @param functionPtr (s32) address of the function to run once every audio frame + */ +#define AUDIOCMD_GLOBAL_SET_CUSTOM_UPDATE_FUNCTION(functionPtr) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_CUSTOM_UPDATE_FUNCTION, 0, 0, 0), functionPtr) + +/** + * Asynchronously load a sequence + * + * @param seqId the id of the sequence to load, see `SeqId` + * @param retData return data from `externalLoadQueue` + */ +#define AUDIOCMD_GLOBAL_ASYNC_LOAD_SEQ(seqId, retData) \ + AudioThread_QueueCmdS8(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_ASYNC_LOAD_SEQ, seqId, 0, retData), 0) + +/** + * No Operation. No code exists for this OP + * + * @param arg0 No info + * @param arg1 No info + * @param arg2 No info + * @param data (s32) No info + */ +#define AUDIOCMD_GLOBAL_NOOP_2(arg0, arg1, arg2, data) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_NOOP_2, arg0, arg1, arg2), data) + +/** + * Disable all sequence players + * + * @param flags (s32) Set `& 1` to discard all sequences. + * + * @note Setting `& 3` will also only discard sampled notes, but the sequences are disabled anyway. + * Not setting `& 1` should make this command useless TODO: Test + */ +#define AUDIOCMD_GLOBAL_DISABLE_ALL_SEQPLAYERS(flags) \ + AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_DISABLE_ALL_SEQPLAYERS, 0, 0, 0), flags) + +#endif diff --git a/include/functions.h b/include/functions.h index 60c6bcda..d993d3ba 100644 --- a/include/functions.h +++ b/include/functions.h @@ -7,54 +7,6 @@ #include "sf64player.h" #include "sf64mesg.h" -// audio -void AudioLoad_Init(void); - -void func_80016A50(void); -void func_800182F4(s32); -void Audio_PlaySfx(u32, f32*, u8, f32*, f32*, s8*); -void func_80019290(s32, void*); -void func_8001A38C(u8, f32*); -void Audio_KillSfx(f32*); -void func_8001A55C(f32*, u32); -void func_8001A838(u32); -void func_8001ACDC(s32); -void func_8001AD00(u32); -void func_8001AE58(void); -s32 func_8001AE78(void); -s32 func_8001AED4(void); -void func_8001AF40(s32); -u8* func_8001C3EC(void); -void func_8001C8B8(u8); -void func_8001CA24(u8); -void func_8001CB80(u8, u8); -void func_8001CCDC(u8, f32 *); -void func_8001CE28(u8, f32 *); -void func_8001CFA8(f32); -void func_8001D034(f32*, s32, u8); -void func_8001D10C(f32*, u32); -void func_8001D15C(u8); -void func_8001D1C8(u8, u32); -void func_8001D2FC(f32*, u16); -void func_8001D3A0(f32*, u16); -void func_8001D400(s8); -void func_8001D410(s32); -void func_8001D444(u8, u16, u8, u8); -void func_8001D4AC(u16, u8, u8, u8); -void func_8001D520(void); -void func_8001D638(u8); -void func_8001D6DC(s32); -void func_8001DA90(u8); -void func_8001DBD0(s32); -void func_8001DC6C(u8, u16); -void func_8001D8A8(u8, u8); -void func_8001D8F4(u8); -void func_8001DCE0(void); -void func_8001DECC(void); - -SPTask* func_8001DF50(void); -void func_8001EE00(void); - // fox_360 void func_8002ED60(Player*); void func_8002E3E0(Actor*); diff --git a/include/global.h b/include/global.h index 18273a67..63e8d666 100644 --- a/include/global.h +++ b/include/global.h @@ -3,6 +3,7 @@ #include "sys.h" +#include "sf64audio_external.h" #include "functions.h" #include "variables.h" #include "context.h" diff --git a/include/macros.h b/include/macros.h index 1fce8c86..be6b20cc 100644 --- a/include/macros.h +++ b/include/macros.h @@ -27,6 +27,8 @@ #define VEC3F_SQ(vec) (SQ((vec).x) + SQ((vec).y) + SQ((vec).z)) #define DOT_XYZ(a, b) ((a).x * (b).x + (a).y * (b).y + (a).z * (b).z) #define ABS(x) ((x) >= 0 ? (x) : -(x)) +#define ABSF(x) ((x) >= 0.0f ? (x) : -(x)) +#define ROUND(float) ((s32)((float)+0.5f)) #define RAD_TO_DEG(radians) (((radians) * 180.0f) / M_PI) #define DEG_TO_RAD(degrees) (((degrees) / 180.0f) * M_PI) diff --git a/include/prevent_context_reordering.h b/include/prevent_context_reordering.h index 29b0c0b7..1bf9bd1f 100644 --- a/include/prevent_context_reordering.h +++ b/include/prevent_context_reordering.h @@ -1,7 +1,7 @@ #ifndef PREVENT_CONTEXT_REORDERING_H #define PREVENT_CONTEXT_REORDERING_H -extern int Dummyhalf; +// extern int Dummyhalf; struct Dummy0 {int x;}; struct Dummy1 {int x;}; struct Dummy2 {int x;}; @@ -74,7 +74,7 @@ struct Dummy68 {int x;}; struct Dummy69 {int x;}; struct Dummy70 {int x;}; struct Dummy71 {int x;}; -struct Dummy72 {int x;}; +// struct Dummy72 {int x;}; // struct Dummy73 {int x;}; // struct Dummy75 { int x; }; // struct Dummy76 { int x; }; diff --git a/include/sf64audio_external.h b/include/sf64audio_external.h new file mode 100644 index 00000000..d6e675ee --- /dev/null +++ b/include/sf64audio_external.h @@ -0,0 +1,141 @@ +#ifndef SF64_AUDIO_EXTERNAL_H +#define SF64_AUDIO_EXTERNAL_H + +#include "sys.h" +#include "audioseq_cmd.h" + +#define AUDIO_PLAY_SFX(sfxId, srcPos, token) (Audio_PlaySfx((sfxId),(srcPos),(token),&gDefaultMod,&gDefaultMod,&gDefaultReverb)) +#define AUDIO_PLAY_BGM(seqId) Audio_PlaySequence(SEQ_PLAYER_BGM, (seqId), 0, -1) + +typedef enum { + SEQ_ID_0, + SEQ_ID_1, + SEQ_ID_2, + SEQ_ID_3, + SEQ_ID_4, + SEQ_ID_5, + SEQ_ID_6, + SEQ_ID_7, + SEQ_ID_8, + SEQ_ID_9, + SEQ_ID_10, + SEQ_ID_11, + SEQ_ID_12, + SEQ_ID_13, + SEQ_ID_14, + SEQ_ID_15, + SEQ_ID_16, + SEQ_ID_17, + SEQ_ID_18, + SEQ_ID_19, + SEQ_ID_20, + SEQ_ID_21, + SEQ_ID_22, + SEQ_ID_23, + SEQ_ID_24, + SEQ_ID_25, + SEQ_ID_26, + SEQ_ID_27, + SEQ_ID_28, + SEQ_ID_29, + SEQ_ID_30, + SEQ_ID_31, + SEQ_ID_32, + SEQ_ID_33, + SEQ_ID_34, + SEQ_ID_35, + SEQ_ID_36, + SEQ_ID_37, + SEQ_ID_38, + SEQ_ID_39, + SEQ_ID_40, + SEQ_ID_41, + SEQ_ID_42, + SEQ_ID_43, + SEQ_ID_44, + SEQ_ID_45, + SEQ_ID_46, + SEQ_ID_47, + SEQ_ID_48, + SEQ_ID_49, + SEQ_ID_50, + SEQ_ID_51, + SEQ_ID_52, + SEQ_ID_53, + SEQ_ID_54, + SEQ_ID_55, + SEQ_ID_56, + SEQ_ID_57, + SEQ_ID_58, + SEQ_ID_59, + SEQ_ID_60, + SEQ_ID_61, + SEQ_ID_62, + SEQ_ID_63, + SEQ_ID_64, + SEQ_ID_65, + SEQ_ID_66, + SEQ_ID_67, + SEQ_ID_68, + SEQ_ID_69, +} BgmSeqIds; + +extern f32 gDefaultSfxSource[]; +extern f32 gDefaultMod; +extern s8 gDefaultReverb; + +void Audio_PlaySfx(u32 sfxId, f32* sfxSource, u8 token, f32* freqMod, f32* volMod, s8* reverbAdd); +void Audio_KillSfxByBank(u8 bankId); +void Audio_StopSfxByBankAndSource(u8 bankId, f32* sfxSource); +void Audio_KillSfxByBankAndSource(u8 bankId, f32* sfxSource); +void Audio_KillSfxBySource(f32* sfxSource); +void Audio_KillSfxBySourceAndId(f32* sfxSource, u32 sfxId); +void Audio_KillSfxByTokenAndId(u8 token, u32 sfxId); +void Audio_KillSfxById(u32 sfxId); +void Audio_PlayVoice(s32 msgId); +void Audio_PlayVoiceWithoutBGM(u32 msgId); +void Audio_ClearVoice(void); +s32 Audio_GetCurrentVoice(void); +s32 Audio_GetCurrentVoiceStatus(void); +void func_8001AF40(u8 unkVoiceParam); +u8* Audio_UpdateFrequencyAnalysis(void); +void func_8001C8B8(u8 playerId); +void func_8001CA24(u8 playerId); +void func_8001CB80(u8 playerId, u8 arg1); +void func_8001CCDC(u8 playerId, f32* sfxSource); +void func_8001CE28(u8 playerId, f32* sfxSource); +void func_8001CF60(f32* sfxSource); +void func_8001CFA8(f32 arg0); +void func_8001D034(f32* sfxSource, u32 sfxId, u8 semitones); +void func_8001D0B4(f32* sfxSource, u32 sfxId, f32 freqMod); +void func_8001D10C(f32* sfxSource, u32 sfxId); +void func_8001D15C(u8 arg0); +void func_8001D1C8(u8 arg0, u8 arg1); +void func_8001D2FC(f32* sfxSource, u16 arg1); +void func_8001D3A0(f32* sfxSource, u16 arg1); +void Audio_SetBaseSfxReverb(s8 reverb); +void Audio_SetBgmParam(s8 bgmParam); +void Audio_PlaySequence(u8 seqPlayId, u16 seqId, u8 fadeinTime, u8 bgmParam); +void Audio_PlayFanfare(u16 seqId, u8 bgmVolume, u8 bgmFadeoutTime, u8 bgmFadeinTime); +void func_8001D520(void); +void func_8001D638(u8 arg0); +void func_8001D6DC(u8 arg0); +void func_8001D8A8(u8 audioType, u8 volume); +void Audio_PlaySoundTest(u8 enable); +void Audio_PlaySequenceDistorted(u8 seqPlayId, u16 seqId, u16 distortion, u8 duration, u8 unused); +void Audio_PlaySoundTestTrack(u8 trackNumber); +void Audio_FadeOutAll(u8 fadeoutTime); +void Audio_KillAllSfx(void); +void Audio_SetAudioSpec(u8 unused, u16 specParam); +void Audio_PlayBgm(u16 seqId); + +// used by sys or related +void AudioLoad_Init(void); +void func_80016A50(void); +void Audio_InitSounds(void); +void Audio_Update(void); +SPTask* func_8001DF50(void); +void func_8001EE00(void); + + +#endif diff --git a/include/sf64audio_provisional.h b/include/sf64audio_provisional.h index 366d11b1..9613fe18 100644 --- a/include/sf64audio_provisional.h +++ b/include/sf64audio_provisional.h @@ -205,7 +205,7 @@ typedef struct { typedef struct { /* 0x00 */ Sample* sample; - /* 0x04 */ f32 tuning; // frequency scale factor + /* 0x04 */ f32 tuning; // frequency modulation factor } TunedSample; // size = 0x8 typedef struct { @@ -314,8 +314,8 @@ typedef struct { /* 0x01C */ f32 fadeVolume; /* 0x020 */ f32 fadeVelocity; /* 0x024 */ f32 volume; - /* 0x028 */ f32 muteVolumeScale; - /* 0x02C */ f32 fadeVolumeScale; + /* 0x028 */ f32 muteVolumeMod; + /* 0x02C */ f32 fadeVolumeMod; /* 0x030 */ f32 appliedFadeVolume; // /* 0x034 */ f32 bend; /* 0x038 */ struct SequenceChannel* channels[16]; @@ -376,7 +376,7 @@ typedef struct { /* 0x01 */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number /* 0x02 */ u8 pan; /* 0x03 */ Stereo stereo; - /* 0x04 */ f32 freqScale; + /* 0x04 */ f32 freqMod; /* 0x08 */ f32 velocity; } NoteAttributes; // size = 0xC @@ -392,7 +392,7 @@ typedef struct SequenceChannel { /* 0x00 */ u8 unused : 1; union { struct { - /* 0x01 */ u8 freqScale : 1; + /* 0x01 */ u8 freqMod : 1; /* 0x01 */ u8 volume : 1; /* 0x01 */ u8 pan : 1; } s; @@ -419,11 +419,11 @@ typedef struct SequenceChannel { /* 0x1C */ s16 instOrWave; // either 0 (none), instrument index + 1, or // 0x80..0x83 for sawtooth/triangle/sine/square waves. /* 0x1E */ s16 transposition; - /* 0x20 */ f32 volumeScale; + /* 0x20 */ f32 volumeMod; /* 0x24 */ f32 volume; /* 0x28 */ s32 pan; /* 0x2C */ f32 appliedVolume; - /* 0x30 */ f32 freqScale; + /* 0x30 */ f32 freqMod; /* 0x34 */ u8 (*dynTable)[][2]; /* 0x38 */ struct Note* noteUnused; /* 0x3C */ struct SequenceLayer* layerUnused; @@ -458,10 +458,10 @@ typedef struct SequenceLayer { /* 0x18 */ AdsrSettings adsr; /* 0x20 */ u16 portamentoTime; /* 0x22 */ s16 transposition; - /* 0x24 */ f32 freqScale; + /* 0x24 */ f32 freqMod; /* 0x28 */ f32 velocitySquare; /* 0x2C */ f32 noteVelocity; - /* 0x30 */ f32 noteFreqScale; + /* 0x30 */ f32 noteFreqMod; /* 0x34 */ u16 shortNoteDefaultDelay; /* 0x36 */ u16 lastDelay; /* 0x38 */ s16 delay; @@ -473,7 +473,7 @@ typedef struct SequenceLayer { /* 0x4C */ SequenceChannel *channel; /* 0x50 */ SeqScriptState state; /* 0x6C */ AudioListItem listItem; - /* 0x7C */ UNK_TYPE pad7C[4]; + /* 0x7C */ char pad7C[4]; } SequenceLayer; //size = 0x80 typedef struct { @@ -522,9 +522,9 @@ typedef struct { /* 0x03 */ u8 fontId; /* 0x04 */ u8 unk_04; /* 0x05 */ u8 stereoHeadsetEffects; - /* 0x06 */ s16 adsrVolScaleUnused; - /* 0x08 */ f32 portamentoFreqScale; - /* 0x0C */ f32 vibratoFreqScale; + /* 0x06 */ s16 adsrVolModUnused; + /* 0x08 */ f32 portamentoFreqMod; + /* 0x0C */ f32 vibratoFreqMod; /* 0x10 */ struct SequenceLayer* prevParentLayer; /* 0x14 */ struct SequenceLayer* parentLayer; /* 0x18 */ struct SequenceLayer* wantedParentLayer; @@ -669,11 +669,12 @@ typedef struct { /* 0x00*/ u32 nextSide; /* 0x04*/ AudioAllocPool pool; /* 0x14*/ AudioCacheEntry entries[2]; -} AudioTemporaryCache; // size = 0x3C +} AudioTemporaryCache; // size = 0x2C typedef struct { /* 0x000*/ AudioPersistentCache persistent; /* 0x194*/ AudioTemporaryCache temporary; + /* 0x1C0*/ char pad[0x10]; } AudioCache; // size = 0x1D0 typedef struct { @@ -797,143 +798,6 @@ typedef struct { /* 0x48 */ char unk_48[0x8]; } AudioTask; // size = 0x50 -typedef struct { - /* 0x0000 */ char unk_0000; - /* 0x0001 */ s8 numSynthesisReverbs; - /* 0x0002 */ u16 unk_2; // reads from audio spec unk_14, never used, always set to 0x7FFF - /* 0x0004 */ u16 unk_4; - /* 0x0006 */ char unk_0006[0x0A]; - /* 0x0010 */ s16* curLoadedBook; - /* 0x0014 */ NoteSubEu* noteSubsEu; - /* 0x0018 */ SynthesisReverb synthesisReverbs[4]; - /* 0x0B38 */ char unk_0B38[0x30]; - /* 0x0B68 */ Sample* usedSamples[128]; - /* 0x0D68 */ AudioPreloadReq preloadSampleStack[128]; - /* 0x1768 */ s32 numUsedSamples; - /* 0x176C */ s32 preloadSampleStackTop; - /* 0x1770 */ AudioAsyncLoad asyncLoads[0x10]; - /* 0x1CF0 */ OSMesgQueue asyncLoadUnkMediumQueue; - /* 0x1D08 */ char unk_1D08[0x40]; - /* 0x1D48 */ AudioAsyncLoad* curUnkMediumLoad; - /* 0x1D4C */ u32 slowLoadPos; - /* 0x1D50 */ AudioSlowLoad slowLoads[2]; - /* 0x1E18 */ OSPiHandle* cartHandle; - /* 0x1E1C */ OSPiHandle* driveHandle; - /* 0x1E20 */ OSMesgQueue externalLoadQueue; - /* 0x1E38 */ OSMesg externalLoadMsgBuf[16]; - /* 0x1E78 */ OSMesgQueue preloadSampleQueue; - /* 0x1E90 */ OSMesg preloadSampleMsgBuf[16]; - /* 0x1ED0 */ OSMesgQueue gCurAudioFrameDmaQueue; - /* 0x1EE8 */ OSMesg curAudioFrameDmaMsgBuf[64]; - /* 0x1FE8 */ OSIoMesg curAudioFrameDmaIoMsgBuf[64]; - /* 0x25E8 */ OSMesgQueue syncDmaQueue; - /* 0x2600 */ OSMesg syncDmaMesg; - /* 0x2604 */ OSIoMesg syncDmaIoMesg; - /* 0x261C */ SampleDma* sampleDmas; - /* 0x2620 */ u32 sampleDmaCount; - /* 0x2624 */ u32 sampleDmaListSize1; - /* 0x2628 */ s32 unused2628; - /* 0x262C */ u8 sampleDmaReuseQueue1[0x100]; // read pos <= write pos, wrapping mod 256 - /* 0x272C */ u8 sampleDmaReuseQueue2[0x100]; - /* 0x282C */ u8 sampleDmaReuseQueue1RdPos; // Read position for short-lived sampleDma - /* 0x282D */ u8 sampleDmaReuseQueue2RdPos; // Read position for long-lived sampleDma - /* 0x282E */ u8 sampleDmaReuseQueue1WrPos; // Write position for short-lived sampleDma - /* 0x282F */ u8 sampleDmaReuseQueue2WrPos; // Write position for long-lived sampleDma - /* 0x2830 */ AudioTable* sequenceTable; - /* 0x2834 */ AudioTable* soundFontTable; - /* 0x2838 */ AudioTable* sampleBankTable; - /* 0x283C */ u8* sequenceFontTable; - /* 0x2840 */ u16 numSequences; - /* 0x2844 */ SoundFont* soundFontList; - /* 0x2848 */ AudioBufferParameters audioBufferParameters; - /* 0x2870 */ f32 unk_2870; - /* 0x2874 */ s32 sampleDmaBufSize1; - /* 0x2874 */ s32 sampleDmaBufSize2; - /* 0x287C */ char unk_287C[0x10]; - /* 0x288C */ s32 sampleDmaBufSize; - /* 0x2890 */ s32 maxAudioCmds; - /* 0x2894 */ s32 numNotes; - /* 0x2898 */ s16 - maxTempo; // Maximum possible tempo (seqTicks per minute), using every tick as a seqTick to process a .seq file - /* 0x289A */ s8 soundMode; - /* 0x289C */ s32 totalTaskCount; // The total number of times the top-level function on the audio thread has run - // since audio was initialized - /* 0x28A0 */ s32 gCurAudioFrameDmaCount; - /* 0x28A4 */ s32 rspTaskIndex; - /* 0x28A8 */ s32 curAiBufIndex; - /* 0x28AC */ Acmd* abiCmdBufs[2]; // Pointer to audio heap where the audio binary interface command lists (for the - // rsp) are stored. Two lists that alternate every frame - /* 0x28B4 */ Acmd* curAbiCmdBuf; // Pointer to the currently active abiCmdBufs - /* 0x28B8 */ AudioTask* curTask; - /* 0x28BC */ char unk_28BC[0x4]; - /* 0x28C0 */ AudioTask rspTask[2]; - /* 0x2960 */ f32 maxTempoTvTypeFactors; // tvType factors that impact maxTempo, in units of milliseconds/frame - /* 0x2964 */ s32 refreshRate; - /* 0x2968 */ s16* aiBuffers[3]; - /* 0x2974 */ s16 aiBufLengths[3]; - /* 0x297C */ u32 audioRandom; - /* 0x2980 */ s32 audioErrorFlags; - /* 0x2984 */ volatile u32 resetTimer; - /* 0x2988 */ char unk_2988[0x8]; - /* 0x2990 */ AudioAllocPool - sessionPool; // A sub-pool to main pool, contains all sub-pools and data that changes every audio reset - /* 0x29A0 */ AudioAllocPool externalPool; // pool allocated externally to the audio heap. Never used in game - /* 0x29B0 */ AudioAllocPool - initPool; // A sub-pool to the main pool, contains all sub-pools and data that persists every audio reset - /* 0x29C0 */ AudioAllocPool miscPool; // A sub-pool to the session pool. - /* 0x29D0 */ char unk_29D0[0x20]; // probably two unused pools - /* 0x29F0 */ AudioAllocPool cachePool; // The common pool for cache entries - /* 0x2A00 */ AudioAllocPool - persistentCommonPool; // A sub-pool to the cache pool, contains caches for data stored persistently - /* 0x2A10 */ AudioAllocPool - temporaryCommonPool; // A sub-pool to the cache pool, contains caches for data stored temporarily - /* 0x2A20 */ AudioCache seqCache; // Cache to store sequences - /* 0x2B30 */ AudioCache fontCache; // Cache to store soundFonts - /* 0x2C40 */ AudioCache sampleBankCache; // Cache for loading entire sample banks - /* 0x2D50 */ AudioAllocPool permanentPool; // Pool to store audio data that is always loaded. Used for sfxs - /* 0x2D60 */ AudioCacheEntry permanentCache[32]; // individual entries to the permanent pool - /* 0x2EE0 */ AudioSampleCache persistentSampleCache; // Stores individual samples persistently - /* 0x3174 */ AudioSampleCache temporarySampleCache; // Stores individual samples temporarily - /* 0x3408 */ AudioSessionPoolSplit sessionPoolSplit; // splits session pool into the cache pool and misc pool - /* 0x3418 */ AudioCachePoolSplit cachePoolSplit; // splits cache pool into the persistent & temporary common pools - /* 0x3420 */ AudioCommonPoolSplit - persistentCommonPoolSplit; // splits persistent common pool into caches for sequences, soundFonts, sample banks - /* 0x342C */ AudioCommonPoolSplit - temporaryCommonPoolSplit; // splits temporary common pool into caches for sequences, soundFonts, sample banks - /* 0x3438 */ u8 sampleFontLoadStatus[0x30]; - /* 0x3468 */ u8 fontLoadStatus[0x30]; - /* 0x3498 */ u8 seqLoadStatus[0x80]; - /* 0x3518 */ volatile u8 resetStatus; - /* 0x3519 */ u8 specId; - /* 0x351C */ s32 audioResetFadeOutFramesLeft; - /* 0x3520 */ f32* adsrDecayTable; // A table on the audio heap that stores decay rates used for adsr - /* 0x3524 */ u8* audioHeap; - /* 0x3528 */ u32 audioHeapSize; - /* 0x352C */ Note* notes; - /* 0x3530 */ SequencePlayer seqPlayers[4]; - /* 0x3AB0 */ SequenceLayer sequenceLayers[64]; - /* 0x5AB0 */ SequenceChannel sequenceChannelNone; - /* 0x5B84 */ s32 noteSubEuOffset; - /* 0x5B88 */ AudioListItem layerFreeList; - /* 0x5B98 */ NotePool noteFreeLists; - /* 0x5BD8 */ u8 threadCmdWritePos; - /* 0x5BD9 */ u8 threadCmdReadPos; - /* 0x5BDA */ u8 threadCmdQueueFinished; - /* 0x5BDC */ u16 threadCmdChannelMask[4]; // bitfield for 16 channels. When processing an audio thread channel - // command on all channels, only process channels with their bit set. - /* 0x5BE4 */ OSMesgQueue* audioResetQueueP; - /* 0x5BE8 */ OSMesgQueue* taskStartQueueP; - /* 0x5BEC */ OSMesgQueue* threadCmdProcQueueP; - /* 0x5BF0 */ OSMesgQueue taskStartQueue; - /* 0x5C08 */ OSMesgQueue threadCmdProcQueue; - /* 0x5C20 */ OSMesgQueue audioResetQueue; - /* 0x5C38 */ OSMesg taskStartMsgBuf[1]; - /* 0x5C3C */ OSMesg audioResetMsgBuf[1]; - /* 0x5C40 */ OSMesg threadCmdProcMsgBuf[4]; - /* 0x5C50 */ AudioCmd threadCmdBuf[0x100]; // Audio thread commands used to transfer audio requests from the graph - // thread to the audio thread -} AudioContext; // size = 0x6450 - typedef struct { /* 0x00 */ u8 reverbVol; /* 0x01 */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number @@ -973,15 +837,10 @@ typedef struct { /* 0x14 */ u32 medium2; } SampleBankRelocInfo; // size = 0x18 -typedef struct { - Drum** drums; - Instrument* instruments[1]; -} SoundFontData; - typedef struct { /* 0x0 */ u8 type; /* 0x1 */ u8 unk_1; - /* 0x2 */ u32 unk_2; + /* 0x2 */ u16 unk_2; /* 0x4 */ u8 unk_4; /* 0x5 */ u8 unk_5; /* 0x6 */ u8 unk_6; @@ -995,6 +854,151 @@ typedef struct { /* 0x5 */ u8 unk_5; } SoundTestTrack; // size: 0x6 +typedef struct { + /* 0x00 */ f32 *xPos; + /* 0x04 */ f32 *yPos; + /* 0x08 */ f32 *zPos; + /* 0x0C */ u8 token; + /* 0x10 */ f32 *freqMod; + /* 0x14 */ f32 *volMod; + /* 0x18 */ s8 *reverbAdd; + /* 0x1C */ f32 distance; + /* 0x20 */ u32 priority; + /* 0x24 */ u32 sfxId; + /* 0x28 */ u8 state; + /* 0x29 */ u8 freshness; + /* 0x2A */ u8 prev; + /* 0x2B */ u8 next; + /* 0x2C */ u8 channelIndex; +} SfxBankEntry; // size = 0x30 + +typedef struct { + /* 0x00 */ u32 sfxId; + /* 0x04 */ f32* pos; + /* 0x08 */ u8 token; + /* 0x0C */ f32* freqMod; + /* 0x10 */ f32* volMod; + /* 0x14 */ s8* reverbAdd; +} SfxRequest; // size = 0x18 + +typedef struct { + /* 0x0 */ u32 priority; // lower is more prioritized + /* 0x4 */ u8 entryIndex; +} ActiveSfx; // size 0x8 + +typedef struct { + /* 0x0 */ u8 seqId; + /* 0x1 */ u8 priority; // higher values have higher priority +} SeqRequest; // size = 0x2 + +typedef struct { + /* 0x0 */ f32 value; + /* 0x4 */ f32 target; + /* 0x8 */ f32 step; + /* 0xC */ u16 timer; +} Modulation; // size 0x10 + +typedef struct { + /* 0x000 */ f32 mod; + /* 0x004 */ f32 target; + /* 0x008 */ f32 step; + /* 0x00C */ u16 timer; + /* 0x00E */ u8 fadeMod[3]; + /* 0x011 */ u8 fadeTimer; + /* 0x012 */ u8 fadeActive; +} FadeModulation; // size 0x14 + +typedef struct { + /* 0x00 */ Modulation volume; + /* 0x10 */ Modulation freq; +} ChannelModulation; // size = 0x20 + +typedef struct { + /* 0x000 */ FadeModulation mainVolume; + /* 0x014 */ u32 tempoCmd; + /* 0x018 */ u16 tempoOriginal; // stores the original tempo before modifying it (to reset back to) + /* 0x01C */ Modulation tempo; + /* 0x02C */ u32 setupCmd[5]; // a queue of cmds to execute once the player is disabled + /* 0x040 */ u8 setupCmdTimer; // only execute setup commands when the timer is at 0. + /* 0x041 */ u8 setupCmdNum; // number of setup commands requested once the player is disabled + /* 0x042 */ u8 setupFadeTimer; + /* 0x044 */ ChannelModulation channelMod[16]; + /* 0x244 */ u16 freqModChannelFlags; + /* 0x246 */ u16 volChannelFlags; + /* 0x248 */ u16 seqId; // active seqId currently playing. Resets when sequence stops + /* 0x24A */ u16 prevSeqId; // last seqId played on a player. Does not reset when sequence stops + /* 0x24C */ u16 channelPortMask; + /* 0x250 */ u32 startSeqCmd; // This name comes from MM + /* 0x254 */ u8 isWaitingForFonts; // This name comes from MM +} ActiveSequence; // size 0x258 + +typedef struct { + /* 0x0 */ f32 volMod; + /* 0x4 */ f32 freqMod; + /* 0x8 */ s8 reverb; + /* 0x9 */ s8 pan; +} SfxChannelState; // size 0xC + +typedef struct { + /* 0x0 */ u32 seqData; + /* 0x4 */ u16 timer; +} DelayedSeqCmd; // size 0x08 + +typedef struct { + /* 0x00 */ f32 value; + /* 0x04 */ f32 target; + /* 0x08 */ u32 timer; + /* 0x0C */ f32 step; + /* 0x10 */ u8 boost; + /* 0x11 */ u8 brake; +} FrequencyLerp; // size 0x14 + +typedef struct { + /* 0x00 */ FrequencyLerp freqMod[5]; + /* 0x64 */ f32 dopplerShift; + /* 0x68 */ f32 totalMod; + /* 0x6C */ u8 form; + /* 0x6D */ s8 reverbAdd; +} PlayerNoiseModulation; // size 0x70 + +#define SEQ_HEX0(seqId) ((seqId) >> 28 & 0xFF) +#define SEQ_HEX1(seqId) (((seqId) & (0xF << 24)) >> 24 & 0xFF) +#define SEQ_BYTE4(seqId) ((seqId) & 0xFF) +#define SEQ_BYTE3(seqId) (((seqId) & (0xFF << 8)) >>8 & 0xFF) +#define SEQ_BYTE2(seqId) (((seqId) & (0xFF << 16)) >>13 & 0xFFFF) + +#define SFX_BANK_MASK(sfxId) ((sfxId) & (0xF << 28)) +#define SFX_STATE_MASK(sfxId) ((sfxId) & (1 << 24)) +#define SFX_RANGE_MASK(sfxId) ((sfxId) & (3 << 16)) +#define SFX_IMPORTANCE_MASK(sfxId) ((sfxId) & (0xFF << 8)) + +#define SFX_BANK_SHIFT(sfxId) (((sfxId) >> 28) & 0xFF) +#define SFX_STATE_SHIFT(sfxId) (((sfxId) >> 24)) +#define SFX_RANGE_SHIFT(sfxId) (((sfxId) >> 16) & 0xFF) +#define SFX_IMPORTANCE_SHIFT(sfxId) (((sfxId) >> 8) & 0xFF) + +#define SFX_BANK(sfxId) SFX_BANK_SHIFT(SFX_BANK_MASK(sfxId)) +#define SFX_STATE(sfxId) SFX_STATE_SHIFT(SFX_STATE_MASK(sfxId)) +#define SFX_BIT04(sfxId) ((sfxId) & (1 << 27)) +#define SFX_BIT05(sfxId) ((sfxId) & (1 << 26)) +#define SFX_BIT06(sfxId) ((sfxId) & (1 << 25)) +#define SFX_BIT08(sfxId) ((sfxId) & (1 << 23)) // adds random variance to freqMod +#define SFX_BIT09(sfxId) ((sfxId) & (1 << 22)) // turns off distance-dependent frequency increase +#define SFX_BIT10(sfxId) ((sfxId) & (1 << 21)) // makes reverb increase with distance +#define SFX_BIT11(sfxId) ((sfxId) & (1 << 20)) // makes priority independent of distance +#define SFX_BIT12(sfxId) ((sfxId) & (1 << 19)) +#define SFX_BIT13(sfxId) ((sfxId) & (1 << 18)) // makes distance ignore z position? probably more +#define SFX_RANGE(sfxId) SFX_RANGE_SHIFT(SFX_RANGE_MASK(sfxId)) +#define SFX_IMPORTANCE(sfxId) SFX_IMPORTANCE_SHIFT(SFX_IMPORTANCE_MASK(sfxId)) +#define SFX_INDEX(sfxId) ((sfxId) & 0xFF) + +#define SFX_PACK(bank, range, importance, index, state, bit4, bit5, bit6, bit8, bit9, bit10, bit11, bit12, bit13) \ + (((bank)<<28)|((range)<<16)|((importance)<<8)|(index)|((state)<<24)|\ + ((bit4)<<27)|((bit5)<<23)|((bit6)<<23)|((bit8)<<23)|((bit9)<<22)|\ + ((bit10)<<21)|((bit11)<<20)|((bit12)<<19)|((bit13)<<18)) + +void func_80008780(f32 *, s32, f32 *); + void AudioHeap_ResetLoadStatus(void); void AudioHeap_DiscardFont(s32 fontId); void AudioHeap_DiscardSequence(s32 seqId); @@ -1065,7 +1069,7 @@ void AudioLoad_Init(void); s32 AudioLoad_SlowLoadSample(s32 fontId, u8 instId, s8* status); Sample* AudioLoad_GetFontSample(s32 fontId, s32 instId); void AudioLoad_Stub_10800(void); -void AudioLoad_FinishSlowLoad(AudioSlowLoad* arg0); +void AudioLoad_FinishSlowLoad(AudioSlowLoad* slowLoad); void AudioLoad_ProcessSlowLoads(s32 resetStatus); void AudioLoad_DmaSlowCopy(AudioSlowLoad* slowLoad, s32 size); void AudioLoad_DmaSlowCopyUnkMedium(u32 devAddr, u8* ramAddr, u32 size, s32 unkMediumParam); @@ -1116,55 +1120,19 @@ void func_80016804(s32); void func_800168BC(void); -void func_80016A50(void); -void func_800182F4(s32); -void func_80019290(s32, void*); -void Audio_PlaySfx(u32, f32*, u8, f32*, f32*, s8*); -void func_8001A38C(u8, f32*); -void func_8001A55C(f32*, u32); -void Audio_KillSfx(f32*); -void func_8001A838(u32); -void func_8001ACDC(s32); -void func_8001AD00(u32); -void func_8001AE58(void); -s32 func_8001AE78(void); -s32 func_8001AED4(void); -void func_8001AF40(s32); -u8* func_8001C3EC(void); -void func_8001C8B8(u8); -void func_8001CA24(u8); -void func_8001CB80(u8, u8); -void func_8001CCDC(u8, f32 *); -void func_8001CE28(u8, f32 *); -void func_8001CFA8(f32); -void func_8001D034(f32*, s32, u8); -void func_8001D10C(f32*, u32); -void func_8001D15C(u8); -void func_8001D1C8(u8, u32); -void func_8001D2FC(f32*, u16); -void func_8001D3A0(f32*, u16); -void func_8001D400(s8); -void func_8001D410(s32); -void func_8001D444(u8, u16, u8, u8); -void func_8001D4AC(u16, u8, u8, u8); -void func_8001D520(void); -void func_8001D638(u8); -void func_8001D6DC(s32); -void func_8001D8A8(u8, u8); -void func_8001D8F4(u8); -void func_8001DA90(u8); -void func_8001DBD0(s32); -void func_8001DC6C(u8, u16); -void func_8001DCE0(void); -void func_8001DECC(void); SPTask* func_8001DF50(void); +void func_8001E920(void); +OSMesg func_8001ECAC(s32 *); +void* func_8001ED14(s32 seqId, u32* outNumFonts); +s32 func_8001ED34(void); +void func_8001ED8C(OSMesg); void func_8001EE00(void); void func_8001EE3C(void); -extern u8 D_800C57E8[4]; +extern u8 gSamplesPerWavePeriod[4]; extern u8 gChannelsPerBank[5][5]; extern u8 gUsedChannelsPerBank[5][5]; @@ -1172,31 +1140,31 @@ extern u8 gSfxRequestWriteIndex; extern u8 gSfxRequestReadIndex; extern u8 gSfxChannelLayout; extern u16 D_800C5D24; -extern f32 gDefaultSfxPos[3]; -extern f32 gDefaultScale; +extern f32 gDefaultSfxSource[3]; +extern f32 gDefaultMod; extern s8 gDefaultReverb; -extern s32 D_800C5D40; +extern s32 gAudioFrameCounter; extern u8 gSeqCmdWritePos; extern u8 gSeqCmdReadPos; extern u8 gStartSeqDisabled; -extern u8 gSoundModeList[3]; -extern u8 D_800C5D54; +extern u8 gSoundModeList[4]; +extern u8 sNewAudioSpecId; extern u8 D_800C5D58; // file split? -extern u8 D_800C5D60; -extern u8 D_800C5D64; -extern u8 D_800C5D68[3]; +extern s8 sBaseReverb; +extern s8 sAudioSpecReverb; +extern u8 sVolumeSettings[3]; extern u8 D_800C5D6C[29][7]; -extern u8 D_800C5E38[29]; -extern s32 D_800C5E58[5]; +extern s8 D_800C5E38[29]; +extern u32 D_800C5E58[5]; // file split? extern u8 D_800C5E70; -extern f32 gSfxVolScale; -extern f32 gSfxFreqScale; +extern f32 gSfxFreqMod; +extern f32 gSfxVolMod; extern u8 gPlaylistIndex; extern s32 gPlaylistTimer; extern u8 gPlaylistCmdIndex; @@ -1207,14 +1175,14 @@ extern PlaylistCmd gPlaylists[][100]; // file split? extern f32 D_800C7380; -extern s32 D_800C7384; -extern s32 D_800C7388; -extern u8 D_800C738C; +extern u32 sNextVoiceId; +extern u32 sCurrentVoiceId; +extern u8 sSetNextVoiceId; extern u8 D_800C7390; -extern u8 D_800C7394; -extern s32 D_800C7398[128]; -extern f32 D_800C7414; -extern f32 D_800C7418[16][2]; +extern u8 sMuteBgmForVoice; +extern s32 D_800C7398[32]; +extern f32 D_800C7418; +extern f32 D_800C741C[32]; extern f32 D_800C749C[13]; @@ -1241,15 +1209,55 @@ extern s32 D_800C7C70; extern u8 gCurCmdReadPos; extern u8 gThreadCmdQueueFinished; +extern s32 D_80145D40; +extern f32 D_80145D48[256]; +extern f32 D_80146148[256]; +extern f32 D_80146548[515]; +extern f32 D_80146D54; +extern f32 D_80146D58; +extern f32 D_80146D5C; +extern f32 D_80146D60; +extern f32 D_80146D64; +extern f32 D_80146D68; +extern f32 D_80146D6C; +extern f32 D_80146D70; + extern s32 D_80146D80; extern AudioSlowLoadBuffer gSlowLoads; -// extern AudioSlowLoad D_80146D94[2]; -extern u64 gAudioContextStart[4]; + +extern SfxRequest gSfxRequests[256]; +extern SfxBankEntry gSfxBanks[5][20]; +extern u8 gSfxBankListEnd[5]; +extern u8 gSfxBankFreeListStart[5]; +extern u8 gSfxBankUnused[5]; +extern ActiveSfx gActiveSfx[5][8]; +extern u8 gCurSfxPlayerChannelIndex; +extern u8 gSfxBankMuted[5]; +extern Modulation gSfxVolumeMods[5]; +extern f32 D_80149AD8[256]; +extern f32 D_80149ED8[256]; +extern f32 D_8014A2D8[384]; +extern f32 D_8014A8D8[32]; +extern u8 D_8014A958[32]; +extern SeqRequest gSeqRequests[4][5]; +extern u8 gNumSeqRequests[4]; +extern s32 gAudioSeqCmds[256]; +extern ActiveSequence gActiveSequences[4]; +extern u16 gDelayedSeqCmdFlags; +extern DelayedSeqCmd gDelayedSeqCmds[16]; +extern SfxChannelState gSfxChannelState[16]; +extern PlayerNoiseModulation gPlayerNoise[4]; +extern f32 D_8014BA10[4]; +extern u8 D_8014BA20[4]; +extern u8 D_8014BA24[4]; +extern s32 D_8014BA28[4]; + +extern u64 gAudioContextStart[]; extern SynthesisReverb gSynthReverbs[4]; -// 0x10 +extern u8 sAudioContextPad10[0x10]; // 0x10 extern u16 D_8014C1B0; extern s8 D_8014C1B2; extern s8 gNumSynthReverbs; @@ -1259,7 +1267,7 @@ extern NoteSubEu* gNoteSubsEu; extern AudioAllocPool gSessionPool; extern AudioAllocPool gInitPool; extern AudioAllocPool gMiscPool; -// 0x20 +extern u8 gAudioContextPad20[0x20]; // 0x20 extern AudioAllocPool gCachePool; extern AudioAllocPool gPersistentCommonPool; extern AudioAllocPool gTemporaryCommonPool; @@ -1283,7 +1291,7 @@ extern u8 gSeqLoadStatus[256]; extern volatile u8 gResetStatus; extern u8 gAudioSpecId; extern s32 gResetFadeoutFramesLeft; -// 0x1000 gap +extern u8 sAudioContextPad1000[0x1000];// 0x1000 gap extern Note* gNotes; // 0x4 extern SequencePlayer gSeqPlayers[4]; @@ -1344,11 +1352,11 @@ extern f32 gMaxTempoTvTypeFactors; extern s32 gRefreshRate; extern u16* gAiBuffers[3]; extern u16 gAiBuffLengths[3]; -extern UNK_TYPE gAudioRandom; +extern u32 gAudioRandom; extern UNK_TYPE D_80155D88; extern volatile u32 gResetTimer; -extern u64 gAudioContextEnd[4]; +extern u64 gAudioContextEnd[]; @@ -1358,12 +1366,83 @@ extern OSMesgQueue sThreadCmdProcQueue; extern OSMesgQueue sAudioUnkQueue; extern OSMesgQueue sAudioResetQueue; extern AudioCmd gThreadCmdBuffer[256]; -extern OSMesg D_80156600[1]; -extern OSMesg D_80156608[4]; -extern OSMesg D_80156618[1]; -extern OSMesg D_8015661C[1]; - +extern OSMesg sAudioTaskStartMsg[1]; +extern OSMesg sThreadCmdProcMsg[4]; +extern OSMesg sAudioUnkMsg[1]; +extern OSMesg sAudioResetMsg[1]; +typedef enum { + SEQ_ID_0, + SEQ_ID_1, + SEQ_ID_2, + SEQ_ID_3, + SEQ_ID_4, + SEQ_ID_5, + SEQ_ID_6, + SEQ_ID_7, + SEQ_ID_8, + SEQ_ID_9, + SEQ_ID_10, + SEQ_ID_11, + SEQ_ID_12, + SEQ_ID_13, + SEQ_ID_14, + SEQ_ID_15, + SEQ_ID_16, + SEQ_ID_17, + SEQ_ID_18, + SEQ_ID_19, + SEQ_ID_20, + SEQ_ID_21, + SEQ_ID_22, + SEQ_ID_23, + SEQ_ID_24, + SEQ_ID_25, + SEQ_ID_26, + SEQ_ID_27, + SEQ_ID_28, + SEQ_ID_29, + SEQ_ID_30, + SEQ_ID_31, + SEQ_ID_32, + SEQ_ID_33, + SEQ_ID_34, + SEQ_ID_35, + SEQ_ID_36, + SEQ_ID_37, + SEQ_ID_38, + SEQ_ID_39, + SEQ_ID_40, + SEQ_ID_41, + SEQ_ID_42, + SEQ_ID_43, + SEQ_ID_44, + SEQ_ID_45, + SEQ_ID_46, + SEQ_ID_47, + SEQ_ID_48, + SEQ_ID_49, + SEQ_ID_50, + SEQ_ID_51, + SEQ_ID_52, + SEQ_ID_53, + SEQ_ID_54, + SEQ_ID_55, + SEQ_ID_56, + SEQ_ID_57, + SEQ_ID_58, + SEQ_ID_59, + SEQ_ID_60, + SEQ_ID_61, + SEQ_ID_62, + SEQ_ID_63, + SEQ_ID_64, + SEQ_ID_65, + SEQ_ID_66, + SEQ_ID_67, + SEQ_ID_68, + SEQ_ID_69, +} BgmSeqIds; #endif diff --git a/include/sf64object.h b/include/sf64object.h index 26f0a8c1..18d90f32 100644 --- a/include/sf64object.h +++ b/include/sf64object.h @@ -137,7 +137,7 @@ typedef struct { /* 0x00 */ Object obj; /* 0x1C */ ObjectInfo info; /* 0x40 */ char unk40[0x8]; - /* 0x48 */ f32 sfxPos[3]; + /* 0x48 */ f32 sfxSource[3]; /* 0x54 */ f32 unk_54; } Object_58; // size = 0x58 @@ -155,7 +155,7 @@ typedef struct { /* 0x5C */ f32 unk_5C; /* 0x60 */ f32 unk_60; /* 0x64 */ Vec3f vel; - /* 0x70 */ f32 sfxPos[3]; + /* 0x70 */ f32 sfxSource[3]; /* 0x7C */ char pad7C[4]; } Object_80; // size = 0x80 @@ -182,7 +182,7 @@ typedef struct { /* 0x50 */ f32 unk_50; /* 0x54 */ f32 unk_54; /* 0x58 */ f32 unk_58; - /* 0x5C */ f32 sfxPos[3]; + /* 0x5C */ f32 sfxSource[3]; /* 0x68 */ f32 scale; } Item; // size 0x6C @@ -206,7 +206,7 @@ typedef struct { /* 0x78 */ s16 unk_78; /* 0x7A */ s16 unk_7A; /* 0x7C */ char pad7C[4]; - /* 0x80 */ f32 sfxPos[3]; + /* 0x80 */ f32 sfxSource[3]; } Effect; // size 0x8C typedef struct { @@ -239,7 +239,7 @@ typedef struct { /* 0x0D8 */ f32 fwork[50]; /* 0x1A0 */ Vec3f vwork[50]; /* 0x3F8 */ f32 unk_3F8; - /* 0x3FC */ f32 sfxPos[3]; + /* 0x3FC */ f32 sfxSource[3]; } Boss; // size = 0x408 #define DMG_BEAM 1 @@ -281,7 +281,7 @@ typedef struct { /* 0x0E6 */ s16 unk_0E6; /* 0x0E8 */ Vec3f vel; /* 0x0F4 */ Vec3f unk_0F4; - /* 0x100 */ f32 sfxPos[3]; + /* 0x100 */ f32 sfxSource[3]; /* 0x10C */ f32 gravity; /* 0x110 */ f32 scale; /* 0x114 */ f32 fwork[30]; diff --git a/include/sf64player.h b/include/sf64player.h index ca311b01..9daa12ff 100644 --- a/include/sf64player.h +++ b/include/sf64player.h @@ -16,6 +16,7 @@ typedef enum PlayerForm { /* 2 */ FORM_BLUE_MARINE, /* 3 */ FORM_ON_FOOT, /* 4 */ FORM_UNK_4, + /*-1 */ FORM_NONE=255, } PlayerForm; typedef enum DrawMode { @@ -53,25 +54,6 @@ typedef enum PlayerState1C8 { /* 13 */ PLAYERSTATE_1C8_13, } PlayerState1C8; -typedef struct { - /* 0x00 */ u8 rightState; - /* 0x01 */ u8 leftState; - /* 0x04 */ f32 unk_04; - /* 0x08 */ f32 unk_08; - /* 0x0C */ f32 unk_0C; - /* 0x10 */ f32 unk_10; - /* 0x14 */ f32 unk_14; - /* 0x18 */ f32 unk_18; - /* 0x1C */ f32 unk_1C; - /* 0x20 */ f32 unk_20; - /* 0x24 */ f32 unk_24; - /* 0x28 */ f32 unk_28; - /* 0x2C */ u8 unk_2C; - /* 0x30 */ f32 unk_30; - /* 0x34 */ f32 unk_34; - /* 0x38 */ f32 unk_38; -} WingInfo; // size = 0x3C - typedef enum { /* 0 */ PLAYERSHOT_0, // single laser? /* 1 */ PLAYERSHOT_1, // twin laser? @@ -99,7 +81,7 @@ typedef struct { /* 0x2C */ f32 unk_2C; /* 0x30 */ f32 unk_30; /* 0x34 */ f32 unk_34; - /* 0x38 */ f32 sfxPos[3]; + /* 0x38 */ f32 sfxSource[3]; /* 0x44 */ f32 unk_44; /* 0x48 */ f32 unk_48; /* 0x4C */ f32 unk_4C; @@ -113,6 +95,38 @@ typedef struct { /* 0x6C */ u8 bonus; } PlayerShot; // size = 0x70 +typedef struct { + /* 0x00 */ u8 rightState; + /* 0x01 */ u8 leftState; + /* 0x04 */ f32 unk_04; + /* 0x08 */ f32 unk_08; + /* 0x0C */ f32 unk_0C; + /* 0x10 */ f32 unk_10; + /* 0x14 */ f32 unk_14; + /* 0x18 */ f32 unk_18; + /* 0x1C */ f32 unk_1C; + /* 0x20 */ f32 unk_20; + /* 0x24 */ f32 unk_24; + /* 0x28 */ f32 unk_28; + /* 0x2C */ u8 unk_2C; + /* 0x30 */ f32 unk_30; + /* 0x34 */ f32 unk_34; + /* 0x38 */ f32 unk_38; +} WingInfo; // size = 0x3C + +typedef struct { + /* 0x00 */ u8 levelType; + /* 0x01 */ u8 form; + /* 0x04 */ f32 *srcPos; + /* 0x08 */ f32 *srcVel; + /* 0x0C */ u8 boost; + /* 0x0D */ u8 brake; + /* 0x10 */ f32 yVel; + /* 0x14 */ u8 bank; + /* 0x18 */ f32 zRot; + /* 0x1C */ u8 roll; +} PlayerSfx; // size = 0x20 + typedef struct Player { /* 0x000 */ f32 unk_000; /* 0x004 */ f32 unk_004; @@ -273,18 +287,9 @@ typedef struct Player { /* 0x2E0 */ Vec3f hit3; /* 0x2EC */ Vec3f hit4; /* 0x2F8 */ Vec3f jointTable[30]; - /* 0x460 */ f32 sfxPos[3]; - /* 0x460 */ f32 sfxVel[3]; - /* 0x478 */ u8 levelType; - /* 0x479 */ u8 form2; - /* 0x47C */ f32 *srcPos; - /* 0x480 */ f32 *srcVel; - /* 0x484 */ s8 boost; - /* 0x485 */ s8 brake; - /* 0x488 */ f32 yVel; - /* 0x48C */ u8 unk_48C; - /* 0x490 */ f32 unk_490; - /* 0x494 */ u8 unk_494; + /* 0x460 */ f32 sfxSource[3]; + /* 0x46C */ f32 sfxVel[3]; + /* 0x478 */ PlayerSfx sfx; /* 0x498 */ s32 timer_498; /* 0x49C */ WingInfo wings; /* 0x4D8 */ f32 unk_4D8; diff --git a/include/variables.h b/include/variables.h index df4016fe..95bf1fd2 100644 --- a/include/variables.h +++ b/include/variables.h @@ -7,21 +7,6 @@ #include "sf64object.h" #include "sf64player.h" -extern f32 gDefaultSfxPos[]; -extern f32 gDefaultScale; -extern s8 gDefaultReverb; -extern s8 gThreadCmdWritePos; -extern s8 gThreadCmdReadPos; -extern OSMesgQueue* gAudioTaskStartQueue; -extern OSMesgQueue* gThreadCmdProcQueue; -extern OSMesgQueue* gAudioUnkQueue; -extern OSMesgQueue* gAudioResetQueue; - -extern OSMesg D_80156600[1]; -extern OSMesg D_80156608[4]; -extern OSMesg D_80156618[1]; -extern OSMesg D_8015661C[1]; - // fox_360 extern s32 D_800C9B4C; diff --git a/linker_scripts/us/symbol_addrs_audio.txt b/linker_scripts/us/symbol_addrs_audio.txt index b5c93972..96d42f8f 100644 --- a/linker_scripts/us/symbol_addrs_audio.txt +++ b/linker_scripts/us/symbol_addrs_audio.txt @@ -7,7 +7,7 @@ gSoundFontTableInitEntries = 0x800C3AA0; gSeqFontTableInit = 0x800C3CB0; // data -D_800C57E8 = 0x800C57E8; +gSamplesPerWavePeriod = 0x800C57E8; // size:4 gChannelsPerBank = 0x800C5CE0; //type:u8 size:0x1C gUsedChannelsPerBank = 0x800C5CFC; //type:u8 size:0x1C @@ -15,27 +15,27 @@ gSfxRequestWriteIndex = 0x800C5D18; gSfxRequestReadIndex = 0x800C5D1C; gSfxChannelLayout = 0x800C5D20; D_800C5D24 = 0x800C5D24; -gDefaultSfxPos = 0x800C5D28; -gDefaultScale = 0x800C5D34; +gDefaultSfxSource = 0x800C5D28; +gDefaultMod = 0x800C5D34; gDefaultReverb = 0x800C5D3C; -D_800C5D40 = 0x800C5D40; +gAudioFrameCounter = 0x800C5D40; gSeqCmdWritePos = 0x800C5D44; gSeqCmdReadPos = 0x800C5D48; gStartSeqDisabled = 0x800C5D4C; gSoundModeList = 0x800C5D50; -D_800C5D54 = 0x800C5D54; +sNewAudioSpecId = 0x800C5D54; D_800C5D58 = 0x800C5D58; -D_800C5D60 = 0x800C5D60; -D_800C5D64 = 0x800C5D64; -D_800C5D68 = 0x800C5D68; +sBaseReverb = 0x800C5D60; +sAudioSpecReverb = 0x800C5D64; +sVolumeSettings = 0x800C5D68; D_800C5D6C = 0x800C5D6C; D_800C5E38 = 0x800C5E38; D_800C5E58 = 0x800C5E58; D_800C5E70 = 0x800C5E70; -gSfxVolScale = 0x800C5E74; -gSfxFreqScale = 0x800C5E78; +gSfxFreqMod = 0x800C5E74; +gSfxVolMod = 0x800C5E78; gPlaylistIndex = 0x800C5E7C; gPlaylistTimer = 0x800C5E80; gPlaylistCmdIndex = 0x800C5E84; @@ -50,8 +50,8 @@ D_800C738C = 0x800C738C; D_800C7390 = 0x800C7390; D_800C7394 = 0x800C7394; D_800C7398 = 0x800C7398; -D_800C7414 = 0x800C7414; D_800C7418 = 0x800C7418; +D_800C741C = 0x800C741C; D_800C749C = 0x800C749C; gAudioSpecs = 0x800C76B8; @@ -76,10 +76,50 @@ gCurCmdReadPos = 0x800C7C74; gThreadCmdQueueFinished = 0x800C7C78; // bss +D_80145D40 = 0x80145D40; +D_80145D48 = 0x80145D48; // size:0x400 +D_80146148 = 0x80146148; // size:0x400 +D_80146548 = 0x80146548; +D_80146D54 = 0x80146D54; +D_80146D58 = 0x80146D58; +D_80146D5C = 0x80146D5C; +D_80146D60 = 0x80146D60; +D_80146D64 = 0x80146D64; +D_80146D68 = 0x80146D68; +D_80146D6C = 0x80146D6C; +D_80146D70 = 0x80146D70; + D_80146D80 = 0x80146D80; gSlowLoads = 0x80146D90; // size:0xC4 +gSfxRequests = 0x80146E60; +gSfxBanks = 0x80148660; //size:0x12C0 +gSfxBankListEnd = 0x80149920; +gSfxBankFreeListStart = 0x80149928; +gSfxBankUnused = 0x80149930; +gActiveSfx = 0x80149938; +gCurSfxPlayerChannelIndex = 0x80149A78; +gSfxBankMuted = 0x80149A7C; +gSfxVolumeMods = 0x80149A88; +D_80149AD8 = 0x80149AD8; +D_80149ED8 = 0x80149ED8; +D_8014A2D8 = 0x8014A2D8; +D_8014A8D8 = 0x8014A8D8; +D_8014A958 = 0x8014A958; +gSeqRequests = 0x8014A978; +gNumSeqRequests = 0x8014A9A0; +gAudioSeqCmds = 0x8014A9A8; +gActiveSequences = 0x8014ADA8; //size:0x960 +gDelayedSeqCmdFlags = 0x8014B708; +gDelayedSeqCmds = 0x8014B710; +gSfxChannelState = 0x8014B790; +gPlayerNoise = 0x8014B850; +D_8014BA10 = 0x8014BA10; +D_8014BA20 = 0x8014BA20; +D_8014BA24 = 0x8014BA24; +D_8014BA28 = 0x8014BA28; + gAudioContextStart = 0x8014BA40; // size:0x10 gSynthReverbs = 0x8014BA50; // size:0x750 D_8014C1B0 = 0x8014C1B0; @@ -175,10 +215,10 @@ sThreadCmdProcQueue = 0x80155DB8; sAudioUnkQueue = 0x80155DD0; sAudioResetQueue = 0x80155DE8; gThreadCmdBuffer = 0x80155E00; -D_80156600 = 0x80156600; -D_80156608 = 0x80156608; -D_80156618 = 0x80156618; -D_8015661C = 0x8015661C; +sAudioTaskStartMsg = 0x80156600; +sThreadCmdProcMsg = 0x80156608; +sAudioUnkMsg = 0x80156618; +sAudioResetMsg = 0x8015661C; // functions @@ -362,71 +402,71 @@ func_800168BC = 0x800168BC; func_80016A50 = 0x80016A50; -func_80016A58 = 0x80016A58; -func_80016BC0 = 0x80016BC0; -func_80016CDC = 0x80016CDC; -func_80016EE4 = 0x80016EE4; -func_80016FF0 = 0x80016FF0; -func_80017360 = 0x80017360; +Audio_GetSfxFalloff = 0x80016A58; +Audio_GetSfxReverb = 0x80016BC0; +Audio_GetSfxPan = 0x80016CDC; +Audio_GetSfxFreqMod = 0x80016EE4; +Audio_SetSfxProperties = 0x80016FF0; +Audio_UpdateDopplerShift = 0x80017360; func_80017494 = 0x80017494; func_80017550 = 0x80017550; -func_80017588 = 0x80017588; -func_80017600 = 0x80017600; -func_80017760 = 0x80017760; -func_800177C8 = 0x800177C8; -func_800182F4 = 0x800182F4; -func_8001831C = 0x8001831C; -func_8001839C = 0x8001839C; -func_80018410 = 0x80018410; -func_80018470 = 0x80018470; -func_800184D4 = 0x800184D4; +Audio_ResetSfxChannelState = 0x80017588; +Audio_StartSequence = 0x80017600; +Audio_StopSequence = 0x80017760; +Audio_ProcessSeqCmd = 0x800177C8; +Audio_QueueSeqCmd = 0x800182F4; +Audio_ProcessSeqCmds = 0x8001831C; +Audio_GetActiveSeqId = 0x8001839C; +Audio_SeqCmdNotQueued = 0x80018410; +Audio_SeqCmdValueNotQueued = 0x80018470; +Audio_ResetSequenceRequests = 0x800184D4; func_800184EC = 0x800184EC; -func_800185A0 = 0x800185A0; -func_800185F8 = 0x800185F8; -func_80018E9C = 0x80018E9C; -func_80018EE0 = 0x80018EE0; +Audio_SetSequenceFade = 0x800185A0; +Audio_UpdateActiveSequences = 0x800185F8; +Audio_SetDelayedSeqCmd = 0x80018E9C; +Audio_UpdateDelayedSeqCmds = 0x80018EE0; func_80018FA4 = 0x80018FA4; -func_80019068 = 0x80019068; -func_800190E4 = 0x800190E4; -func_80019158 = 0x80019158; -func_800191BC = 0x800191BC; +Audio_ResetActiveSequences = 0x80019068; +Audio_ResetActiveSequencesAndVolume = 0x800190E4; +Audio_SetSfxBanksMute = 0x80019158; +Audio_ClearBGMMute = 0x800191BC; Audio_PlaySfx = 0x80019218; -func_80019290 = 0x80019290; -func_80019434 = 0x80019434; -func_800197AC = 0x800197AC; -func_800198C0 = 0x800198C0; -func_8001A01C = 0x8001A01C; -func_8001A290 = 0x8001A290; -func_8001A38C = 0x8001A38C; -func_8001A4B8 = 0x8001A4B8; -Audio_KillSfx = 0x8001A500; -func_8001A55C = 0x8001A55C; -func_8001A6C4 = 0x8001A6C4; -func_8001A838 = 0x8001A838; -func_8001A988 = 0x8001A988; -func_8001A9EC = 0x8001A9EC; -func_8001AA90 = 0x8001AA90; -func_8001AAE4 = 0x8001AAE4; -func_8001AB50 = 0x8001AB50; -func_8001ACDC = 0x8001ACDC; -func_8001AD00 = 0x8001AD00; -func_8001AD44 = 0x8001AD44; -func_8001AE58 = 0x8001AE58; -func_8001AE78 = 0x8001AE78; -func_8001AED4 = 0x8001AED4; +Audio_RemoveMatchingSfxRequests = 0x80019290; +Audio_ProcessSfxRequest = 0x80019434; +Audio_RemoveSfxBankEntry = 0x800197AC; +Audio_ChooseActiveSfx = 0x800198C0; +Audio_PlayActiveSfx = 0x8001A01C; +Audio_KillSfxByBank = 0x8001A290; +Audio_StopSfxByBankAndSource = 0x8001A38C; +Audio_KillSfxByBankAndSource = 0x8001A4B8; +Audio_KillSfxBySource = 0x8001A500; +Audio_KillSfxBySourceAndId = 0x8001A55C; +Audio_KillSfxByTokenAndId = 0x8001A6C4; +Audio_KillSfxById = 0x8001A838; +Audio_ProcessSfxRequests = 0x8001A988; +Audio_SetSfxVolumeMod = 0x8001A9EC; +Audio_UpdateSfxVolumeMod = 0x8001AA90; +Audio_PlayAllSfx = 0x8001AAE4; +Audio_ResetSfx = 0x8001AB50; +Audio_PlayVoice = 0x8001ACDC; +Audio_PlayVoiceWithoutBGM = 0x8001AD00; +Audio_UpdateVoice = 0x8001AD44; +Audio_ClearVoice = 0x8001AE58; +Audio_GetCurrentVoice = 0x8001AE78; +Audio_GetCurrentVoiceStatus = 0x8001AED4; func_8001AF40 = 0x8001AF40; func_8001AF50 = 0x8001AF50; -func_8001AF9C = 0x8001AF9C; -func_8001B014 = 0x8001B014; -func_8001B454 = 0x8001B454; -func_8001B774 = 0x8001B774; -func_8001BA40 = 0x8001BA40; -func_8001BB74 = 0x8001BB74; -func_8001BC20 = 0x8001BC20; -func_8001BC48 = 0x8001BC48; -func_8001BD0C = 0x8001BD0C; +Audio_ResetPlayerFreqMods = 0x8001AF9C; +Audio_UpdateArwingNoise = 0x8001B014; +Audio_UpdateLandmasterNoise = 0x8001B454; +Audio_UpdateBlueMarineNoise = 0x8001B774; +Audio_UpdatePlayerFreqMod = 0x8001BA40; +Audio_UpdatePlayerReverb = 0x8001BB74; +Audio_UpdatePlayerNoise = 0x8001BC20; +Audio_ResetVoicesAndPlayers = 0x8001BC48; +Audio_ProcessPlaylist = 0x8001BD0C; func_8001BFC0 = 0x8001BFC0; -func_8001C3EC = 0x8001C3EC; +Audio_UpdateFrequencyAnalysis = 0x8001C3EC; func_8001C8B8 = 0x8001C8B8; func_8001CA24 = 0x8001CA24; func_8001CB80 = 0x8001CB80; @@ -442,26 +482,26 @@ func_8001D15C = 0x8001D15C; func_8001D1C8 = 0x8001D1C8; func_8001D2FC = 0x8001D2FC; func_8001D3A0 = 0x8001D3A0; -func_8001D400 = 0x8001D400; -func_8001D410 = 0x8001D410; -func_8001D444 = 0x8001D444; -func_8001D4AC = 0x8001D4AC; +Audio_SetBaseSfxReverb = 0x8001D400; +Audio_SetBgmParam = 0x8001D410; +Audio_PlaySequence = 0x8001D444; +Audio_PlayFanfare = 0x8001D4AC; func_8001D520 = 0x8001D520; func_8001D638 = 0x8001D638; func_8001D6DC = 0x8001D6DC; func_8001D780 = 0x8001D780; func_8001D8A8 = 0x8001D8A8; -func_8001D8F4 = 0x8001D8F4; -func_8001D9E0 = 0x8001D9E0; -func_8001DA90 = 0x8001DA90; -func_8001DBD0 = 0x8001DBD0; -func_8001DC2C = 0x8001DC2C; -func_8001DC6C = 0x8001DC6C; -func_8001DCB4 = 0x8001DCB4; -func_8001DCE0 = 0x8001DCE0; +Audio_PlaySoundTest = 0x8001D8F4; +Audio_PlaySequenceDistorted = 0x8001D9E0; +Audio_PlaySoundTestTrack = 0x8001DA90; +Audio_FadeOutAll = 0x8001DBD0; +Audio_KillAllSfx = 0x8001DC2C; +Audio_SetAudioSpec = 0x8001DC6C; +Audio_PlayBgm = 0x8001DCB4; +Audio_InitSounds = 0x8001DCE0; func_8001DD40 = 0x8001DD40; func_8001DE1C = 0x8001DE1C; -func_8001DECC = 0x8001DECC; +Audio_Update = 0x8001DECC; @@ -470,10 +510,10 @@ func_8001E444 = 0x8001E444; func_8001E720 = 0x8001E720; func_8001E778 = 0x8001E778; func_8001E7C8 = 0x8001E7C8; -func_8001E850 = 0x8001E850; -func_8001E8A8 = 0x8001E8A8; -func_8001E8CC = 0x8001E8CC; -func_8001E8F0 = 0x8001E8F0; +AudioThread_QueueCmd = 0x8001E850; +AudioThread_QueueCmdF32 = 0x8001E8A8; +AudioThread_QueueCmdS32 = 0x8001E8CC; +AudioThread_QueueCmdS8 = 0x8001E8F0; func_8001E920 = 0x8001E920; func_8001E998 = 0x8001E998; func_8001E9AC = 0x8001E9AC; diff --git a/src/main/audio_context.c b/src/main/audio_context.c new file mode 100644 index 00000000..f1e30182 --- /dev/null +++ b/src/main/audio_context.c @@ -0,0 +1,184 @@ +#include "sys.h" +#include "sf64audio_provisional.h" + +u64 gAudioContextStart[2]; +SynthesisReverb gSynthReverbs[4]; +u8 sAudioContextPad10[0x10]; // 0x10 +u16 D_8014C1B0; +s8 D_8014C1B2; +s8 gNumSynthReverbs; +s16 D_8014C1B4; +NoteSubEu* gNoteSubsEu; +// 0x4 +AudioAllocPool gSessionPool; +AudioAllocPool gInitPool; +AudioAllocPool gMiscPool; +u8 gAudioContextPad20[0x20]; // 0x20 +AudioAllocPool gCachePool; +AudioAllocPool gPersistentCommonPool; +AudioAllocPool gTemporaryCommonPool; +AudioCache gSeqCache; // seqCache +AudioCache gFontCache; // fontCache +AudioCache gSampleBankCache; // sampleBankCache +PermanentCache gPermanentPool; +AudioSampleCache gPersistentSampleCache; +// 0x4 +AudioSampleCache gTemporarySampleCache; +// 0x4 +AudioSessionPoolSplit gSessionPoolSplit; +AudioCachePoolSplit gCachePoolSplit; +AudioCommonPoolSplit gPersistentCommonPoolSplit; +// 0x4 +AudioCommonPoolSplit gTemporaryCommonPoolSplit; +// 0x4 +u8 gSampleFontLoadStatus[64]; +u8 gFontLoadStatus[64]; +u8 gSeqLoadStatus[256]; +volatile u8 gResetStatus; +u8 gAudioSpecId; +s32 gResetFadeoutFramesLeft; +u8 sAudioContextPad1000[0x1000]; // 0x1000 gap +Note* gNotes; +// 0x4 +SequencePlayer gSeqPlayers[4]; +SequenceChannel gSeqChannels[48]; +SequenceLayer gSeqLayers[64]; +SequenceChannel gSeqChannelNone; +AudioListItem gLayerFreeList; +NotePool gNoteFreeLists; +Sample* gUsedSamples[128]; +AudioPreloadReq gPreloadSampleStack[128]; +s32 gNumUsedSamples; +s32 gPreloadSampleStackTop; +AudioAsyncLoad gAsyncLoads[16]; +OSMesgQueue gExternalLoadQueue; +OSMesg gExternalLoadMsg[16]; +OSMesgQueue gPreloadSampleQueue; +OSMesg gPreloadSampleMsg[16]; +OSMesgQueue gCurAudioFrameDmaQueue; +OSMesg gCurAudioFrameDmaMsg[64]; +OSIoMesg gCurAudioFrameDmaIoMsgBuf[64]; +OSMesgQueue gSyncDmaQueue; +OSMesg gSyncDmaMsg[1]; +// 0x4 +OSIoMesg gSyncDmaIoMsg; +SampleDma gSampleDmas[0x100]; +u32 gSampleDmaCount; +u32 gSampleDmaListSize1; +s32 D_80155A50; +// 0x4 +u8 gSampleDmaReuseQueue1[0x100]; +u8 gSampleDmaReuseQueue2[0x100]; +u8 gSampleDmaReuseQueue1RdPos; +u8 gSampleDmaReuseQueue2RdPos; +u8 gSampleDmaReuseQueue1WrPos; +u8 gSampleDmaReuseQueue2WrPos; +AudioTable* gSequenceTable; +AudioTable* gSoundFontTable; +AudioTable* gSampleBankTable; +u8* gSeqFontTable; +s16 gNumSequences; +SoundFont* gSoundFontList; +// 0x4 +AudioBufferParameters gAudioBufferParams; +s32 gSampleDmaBuffSize; +s32 gMaxAudioCmds; +s32 gNumNotes; +u16 gMaxTempo; +s8 gAudioSoundMode; +volatile s32 gAudioTaskCountQ; +s32 gCurAudioFrameDmaCount; +s32 gAudioTaskIndexQ; +s32 gCurAiBuffIndex; +void* gAbiCmdBuffs[2]; +Acmd* gCurAiCmdBuffer; +AudioTask* gAudioCurTask; +AudioTask gAudioRspTasks[2]; +f32 gMaxTempoTvTypeFactors; +s32 gRefreshRate; +u16* gAiBuffers[3]; +u16 gAiBuffLengths[3]; +u32 gAudioRandom; +UNK_TYPE D_80155D88; +volatile u32 gResetTimer; + +u64 gAudioContextEnd[2]; + +static ReverbSettings D_800C74D0[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x40, 0x4000, 0xD000, 0x3000 } }; +static ReverbSettings D_800C74E0[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x38, 0x6400, 0x1000, 0x1000 } }; +static ReverbSettings D_800C74F0[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x40, 0x4000, 0, 0 } }; +static ReverbSettings D_800C7500[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x5000, 0, 0 } }; +static ReverbSettings D_800C7510[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x40, 0x6000, 0, 0 } }; +static ReverbSettings D_800C7520[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7530[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x5800, 0, 0 } }; +static ReverbSettings D_800C7540[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x5000, 0, 0 } }; +static ReverbSettings D_800C7550[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7560[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x40, 0x6000, 0, 0 } }; +static ReverbSettings D_800C7570[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7580[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x40, 0x4000, 0, 0 } }; +static ReverbSettings D_800C7590[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 2, 0x28, 0x5800, 0, 0 } }; +static ReverbSettings D_800C75A0[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C75B0[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x38, 0x5000, 0, 0 } }; +static ReverbSettings D_800C75C0[3] = { + { 1, 0x30, 0x3000, 0, 0 }, + { 1, 0x38, 0x3000, 0, 0 }, + { 2, 0x48, 0x6000, 0xC000, 0x4000 }, +}; +static ReverbSettings D_800C75D8[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C75E8[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C75F8[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7608[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7618[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7628[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7638[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x6800, 0, 0 } }; +static ReverbSettings D_800C7648[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x18, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7658[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 2, 0x18, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7668[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x18, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7678[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C7688[2] = { { 1, 0x30, 0x3000, 0, 0 }, { 1, 0x30, 0x3000, 0, 0 } }; +static ReverbSettings D_800C76A8[] = { + // unused? + { 1, 0x40, 0x4FFF, 0, 0 }, + { 1, 0x30, 0x4FFF, 0, 0 }, + { 1, 0x30, 0x4FFF, 0, 0 }, + { 1, 0x30, 0x4FFF, 0, 0 }, +}; +AudioSpec gAudioSpecs[] = { + { 0x7D00, 2, 0x16, 2, D_800C74D0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C74E0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C74F0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7500, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7510, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7520, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7530, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7540, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7550, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7560, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7570, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7580, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 1, 0x16, 2, D_800C7590, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x2B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C75A0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C75B0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 3, D_800C75C0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x34000 }, + { 0x7D00, 2, 0x16, 2, D_800C75D8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C75E8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C75F8, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7608, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x16, 2, D_800C7618, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, + { 0x7D00, 2, 0x20, 2, D_800C7628, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0 }, + { 0x7D00, 1, 0x20, 2, D_800C7638, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0 }, + { 0x7D00, 1, 0x20, 2, D_800C7648, 0x7FFF, 0x1200, 0xA000, 0, 0x5B00, 0x1D00, 0, 0, 0 }, + { 0x7D00, 1, 0x16, 2, D_800C7658, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0, 0x60000 }, + { 0x7D00, 2, 0x16, 2, D_800C7668, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0 }, + { 0x7D00, 2, 0x16, 2, D_800C7678, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0 }, + { 0x7D00, 2, 0x20, 2, D_800C7688, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0 }, + { 0x7D00, 2, 0x16, 2, D_800C74D0, 0x7FFF, 0x1200, 0x1100, 0, 0x5000, 0x2400, 0, 0x1B000, 0x35000 }, +}; +s32 D_800C7C28 = 0x20000000; // unused? +s16 gSeqTicksPerBeat = 0x30; +s32 gAudioHeapSize = 0xAFE00; +s32 gInitPoolSize = 0x26000; +u32 gPermanentPoolSize = 0x21000; +u16 gSequenceMedium = 0; +u16 gSoundFontMedium = 0; +u16 gSampleBankMedium = 0; diff --git a/src/main/audio_effects.c b/src/main/audio_effects.c index 1df9e728..e8a154c1 100644 --- a/src/main/audio_effects.c +++ b/src/main/audio_effects.c @@ -1,6 +1,8 @@ #include "sys.h" #include "sf64audio_provisional.h" +static char devstr[] = "Audio:Envp: overflow %f\n"; + #pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_effects/func_80013400.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_effects/func_800135A8.s") diff --git a/src/main/audio_general.c b/src/main/audio_general.c index 4571c3a7..311bcfad 100644 --- a/src/main/audio_general.c +++ b/src/main/audio_general.c @@ -1,208 +1,2995 @@ #include "sys.h" #include "sf64audio_provisional.h" #include "context.h" +#include "audiothread_cmd.h" +#include "audioseq_cmd.h" + +void Audio_ProcessSeqCmd(u32 seqCmd); +void func_8001D0B4(f32* sfxSource, u32 sfxId, f32 freqMod); +void func_8001DD40(void); +s32 Audio_GetCurrentVoice(void); +void Audio_PlaySequence(u8, u16, u8, u8); +void Audio_PlayFanfare(u16, u8, u8, u8); +void func_8001D6DC(u8); +void Audio_PlaySequenceDistorted(u8, u16, u16, u8, u8); +void func_8001DE1C(u8); + +static const char devstr1[] = "preload start (%d): "; +static const char devstr2[] = "%d "; +static const char devstr3[] = "\n"; +static const char devstr4[] = "***** START SEQ : %d *****\n"; +static const char devstr5[] = "spec change finished !!!\n"; +static const char devstr6[] = "interface wait spec change finished !!!\n"; +static const char devstr7[] = "********** SE Interface Buffer SE Stop %08X **********\n"; +static const char devstr8[] = "MedlayStart : \n"; +static const char devstr9[] = "MedlayStart : \n"; +static const char devstr10[] = "MedlayStart(TuneUp) : \n"; +static const char devstr11[] = "MedlayStart(cross) : \n"; +static const char devstr12[] = "MedlayEnd : \n"; +static const char devstr13[] = "MedlayWait : %d\n"; +static const char devstr14[] = "ControlSePicth : %f %f %f \n"; +static const char devstr15[] = "ChangeWarningSePara : %d %d\n"; +static const char devstr16[] = "set Grp 0 port %02x \n"; +static const char devstr17[] = "main BGM start %08X\n"; +static const char devstr18[] = "<<<<< PlayCrossMixBgm pass !!! >>>>>\n"; +static const char devstr19[] = "SetVolumeBallnce %d %d\n"; +static const char devstr20[] = "START HANDLE : %d (old:%d)\n"; +static const char devstr21[] = "All Sound Fade Out time:%d\n"; + +SfxRequest gSfxRequests[256]; +SfxBankEntry gSfxBanks[5][20]; +u8 gSfxBankListEnd[5]; +u8 gSfxBankFreeListStart[5]; +u8 gSfxBankUnused[5]; +ActiveSfx gActiveSfx[5][8]; +u8 gCurSfxPlayerChannelIndex; +u8 gSfxBankMuted[5]; +Modulation gSfxVolumeMods[5]; +f32 D_80149AD8[256]; +f32 D_80149ED8[256]; +f32 D_8014A2D8[384]; +f32 D_8014A8D8[32]; +u8 D_8014A958[32]; +SeqRequest gSeqRequests[4][5]; +u8 gNumSeqRequests[4]; +s32 gAudioSeqCmds[256]; +ActiveSequence gActiveSequences[4]; +u16 gDelayedSeqCmdFlags; +DelayedSeqCmd gDelayedSeqCmds[16]; +SfxChannelState gSfxChannelState[16]; +PlayerNoiseModulation gPlayerNoise[4]; +f32 D_8014BA10[4]; +u8 D_8014BA20[4]; +u8 D_8014BA24[4]; +s32 D_8014BA28[4]; + +u8 gChannelsPerBank[5][5] = { + { 3, 2, 2, 2, 2 }, { 3, 1, 2, 2, 2 }, { 3, 2, 2, 2, 3 }, { 6, 0, 2, 0, 4 }, { 0, 0, 0, 0, 0 }, +}; +u8 gUsedChannelsPerBank[5][5] = { + { 3, 2, 1, 2, 3 }, { 3, 2, 1, 1, 2 }, { 3, 2, 1, 1, 3 }, { 2, 0, 1, 0, 1 }, { 0, 0, 0, 0, 0 }, +}; +u8 gSfxRequestWriteIndex = 0; +u8 gSfxRequestReadIndex = 0; +u8 gSfxChannelLayout = 0; +u16 D_800C5D24 = 0; +f32 gDefaultSfxSource[3] = { 0.0f, 0.0f, 0.0f }; +f32 gDefaultMod = 1.0f; +s32 D_800C5D38 = 0; // unused. perhaps a default pan? +s8 gDefaultReverb = 0; +s32 gAudioFrameCounter = 0; +u8 gSeqCmdWritePos = 0; +u8 gSeqCmdReadPos = 0; +u8 gStartSeqDisabled = 0; +u8 gSoundModeList[4] = { 0, 1, 2, 3 }; +u8 sNewAudioSpecId = 0; +u8 D_800C5D58 = 0; +s32 D_800C5D5C = 0; // unused. file split? +s8 sBaseReverb = 0; +s8 sAudioSpecReverb = 0; +u8 sVolumeSettings[3] = { 99, 99, 99 }; +u8 D_800C5D6C[29][7] = { + { 0, 3, 4, 80, 12, 21, 255 }, { 17, 18, 15, 96, 20, 22, 255 }, { 0, 3, 5, 80, 16, 255, 0 }, + { 17, 18, 15, 96, 20, 22, 255 }, { 0, 3, 4, 80, 12, 21, 255 }, { 17, 18, 15, 96, 20, 22, 255 }, + { 0, 3, 4, 80, 12, 21, 255 }, { 17, 18, 15, 96, 20, 22, 255 }, { 0, 3, 4, 80, 12, 21, 255 }, + { 0, 3, 4, 80, 12, 21, 255 }, { 17, 18, 15, 96, 20, 22, 255 }, { 0, 3, 4, 80, 12, 21, 255 }, + { 17, 18, 95, 96, 41, 255, 0 }, { 17, 18, 15, 96, 20, 22, 255 }, { 0, 3, 5, 80, 16, 255, 0 }, + { 0, 3, 4, 80, 12, 21, 255 }, { 0, 3, 4, 80, 12, 21, 255 }, { 17, 18, 15, 96, 20, 22, 255 }, + { 0, 3, 4, 80, 12, 21, 255 }, { 0, 3, 4, 80, 12, 21, 255 }, { 0, 3, 4, 80, 12, 21, 255 }, + { 255, 0, 0, 0, 0, 0, 0 }, { 255, 0, 0, 0, 0, 0, 0 }, { 255, 0, 0, 0, 0, 0, 0 }, + { 255, 0, 0, 0, 0, 0, 0 }, { 255, 0, 0, 0, 0, 0, 0 }, { 255, 0, 0, 0, 0, 0, 0 }, + { 255, 0, 0, 0, 0, 0, 0 }, { 0, 3, 4, 80, 12, 21, 255 }, +}; +s8 D_800C5E38[29] = { + 10, 0, 25, 0, 25, 0, 10, 0, 10, 35, 0, 10, 40, 0, 25, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; +u32 D_800C5E58[5] = { 20, 16, 10, 10, 20 }; +s32 D_800C5E6C = 0; // unused. file split? +u8 D_800C5E70 = 0; +f32 gSfxFreqMod = 1.0f; +f32 gSfxVolMod = 1.0f; // never modified +u8 gPlaylistIndex = 255; +s32 gPlaylistTimer = 0; +u8 gPlaylistCmdIndex = 0; +u32 D_800C5E88[] = { + 0x1903000D, 0x1903000E, 0x19500015, 0x2903A021, 0x4900000C, 0x19122005, 0x1913204A, 0x2900306A, + 0x29034024, 0x2902306C, 0x19032056, 0x19030057, 0x19033058, 0x19030006, 0x29503032, 0x1903407D, + 0x4900402E, 0x19038072, 0x1903807E, 0x1903807F, 0x19038080, 0x11032081, 0x19031082, +}; +SoundTestTrack D_800C5EE4[] = { + { 35, 22, 255, 0 }, + { 34, 23, 255, 0 }, + { 36, 23, 255, 0 }, + { 60, 280, 255, 0 }, + { 37, 0, 255, 0 }, + { 44, 1, 255, 0 }, + { 45, 1, 255, 0 }, + { 50, 1, 255, 0 }, + { 51, 8, 255, 0 }, + { 0x8000 + 2, 0, 255, 0 }, + { 0x8000 + 3, 1, 255, 0 }, + { 0x8000 + 4, 2, 255, 0 }, + { 0x8000 + 5, 3, 255, 0 }, + { 0x8000 + 6, 4, 255, 0 }, + { 0x8000 + 7, 5, 255, 0 }, + { 0x8000 + 8, 6, 255, 0 }, + { 0x8000 + 9, 7, 255, 0 }, + { 0x8000 + 10, 8, 255, 0 }, + { 0x8000 + 12, 10, 255, 0 }, + { 0x8000 + 13, 11, 255, 0 }, + { 14, 12, 255, 0 }, + { 0x8000 + 58, 1, 255, 0 }, + { 54, 13, 255, 0 }, + { 55, 11, 255, 0 }, + { 0x8000 + 18, 0, 255, 0 }, + { 0x8000 + 19, 1, 0, 0 }, + { 0x8000 + 19, 1, 255, 0 }, + { 0x8000 + 65, 7, 255, 0 }, + { 0x8000 + 28, 10, 255, 0 }, + { 0x8000 + 43, 6, 255, 0 }, + { 38, 0, 255, 0 }, + { 49, 0, 255, 0 }, + { 39, 0, 255, 0 }, + { 40, 25, 255, 0 }, + { 0x8000 + 63, 28, 255, 0 }, + { 0x8000 + 46, 784, 255, 0 }, + { 0x8000 + 47, 785, 255, 0 }, + { 56, 23, 255, 0 }, + { 0x8000 + 62, 6, 0, 0 }, + { 0x8000 + 17, 23, 255, 0 }, + { 0x8000 + 33, 6, 0, 0 }, + { 0x8000 + 33, 6, 255, 0 }, + { 0x8000 + 61, 6, 255, 0 }, + { 0x8000 + 64, 6, 255, 0 }, + { 42, 27, 255, 0 }, +}; +PlaylistCmd gPlaylists[][100] = { + { + { 0, 0, 0x25, 0, 0, 255, 1620 }, + { 0, 0, 0x8002, 0, 0, 255, 2490 }, + { 1, 0, 0x8002, 0, 50, 255, 50 }, + { 0, 0, 0x8012, 0, 0, 255, 1600 }, + { 1, 0, 0x8012, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x32, 0, 0, 255, 838 }, + { 0, 0, 0x8003, 0, 0, 255, 1584 }, + { 1, 0, 0x8003, 0, 50, 255, 50 }, + { 0, 0, 0x8013, 0, 0, 0, 1620 }, + { 1, 0, 0x8013, 0, 1, 255, 50 }, + { 0, 0, 0x8041, 0, 0, 255, 1620 }, + { 1, 0, 0x8041, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x33, 0, 0, 255, 241 }, + { 0, 0, 0x800A, 0, 0, 255, 1632 }, + { 1, 0, 0x800A, 0, 100, 255, 100 }, + { 0, 0, 0x802B, 0, 0, 255, 2120 }, + { 0, 0, 0x800A, 0, 0, 0, 450 }, + { 1, 0, 0x800A, 0, 50, 255, 200 }, + { 0, 0, 0x31, 0, 0, 255, 1604 }, + { 1, 0, 0x31, 0, 100, 255, 100 }, + { 0, 0, 0x2C, 0, 0, 255, 242 }, + { 0, 0, 0x8005, 0, 0, 255, 2291 }, + { 1, 0, 0x8005, 0, 50, 255, 100 }, + { 0, 0, 0x8015, 0, 0, 255, 1600 }, + { 1, 0, 0x8015, 0, 1, 255, 50 }, + { 2, 0, 0x8015, 0, 0, 255, 1600 }, + { 1, 0, 0x8015, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x2D, 0, 0, 255, 542 }, + { 0, 0, 0x8004, 0, 0, 255, 1920 }, + { 1, 0, 0x8004, 0, 50, 255, 50 }, + { 0, 0, 0x8014, 0, 0, 255, 1600 }, + { 1, 0, 0x8014, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x33, 0, 0, 255, 241 }, + { 0, 0, 0x800C, 0, 0, 255, 1177 }, + { 1, 0, 0x800C, 0, 100, 255, 100 }, + { 0, 0, 0x801C, 0, 0, 255, 1115 }, + { 1, 0, 0x801C, 0, 50, 255, 50 }, + { 0, 0, 0x802B, 0, 0, 255, 2120 }, + { 1, 0, 0x802B, 0, 1, 255, 50 }, + { 0, 0, 0x27, 0, 0, 255, 150 }, + { 0, 0, 0x28, 0, 0, 255, 1020 }, + { 1, 0, 0x28, 0, 100, 255, 100 }, + { 255, 0, 0x8002, 0, 50, 255, 50 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + }, + { + { 0, 0, 0x25, 0, 0, 255, 1620 }, + { 0, 0, 0x8002, 0, 0, 255, 2490 }, + { 1, 0, 0x8002, 0, 50, 255, 50 }, + { 0, 0, 0x8030, 0, 0, 255, 1620 }, + { 1, 0, 0x8030, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x2C, 0, 0, 255, 242 }, + { 0, 0, 0x8009, 0, 0, 255, 2096 }, + { 1, 0, 0x8009, 0, 50, 255, 50 }, + { 0, 0, 0x8019, 0, 0, 2, 1600 }, + { 1, 0, 0x8019, 0, 1, 255, 50 }, + { 0, 0, 0x8041, 0, 0, 255, 1600 }, + { 1, 0, 0x8041, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x33, 0, 0, 255, 241 }, + { 0, 0, 0x800D, 0, 0, 255, 2184 }, + { 1, 0, 0x800D, 0, 1, 255, 100 }, + { 0, 0, 0x801D, 0, 0, 1, 1115 }, + { 1, 0, 0x801D, 0, 50, 255, 100 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x33, 0, 0, 255, 250 }, + { 0, 0, 0x800B, 0, 0, 255, 1096 }, + { 3, 0, 0x37, 0, 0, 255, 1000 }, + { 1, 0, 0x800B, 0, 50, 255, 50 }, + { 0, 0, 0x801B, 0, 0, 255, 1600 }, + { 1, 0, 0x801B, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x2C, 0, 0, 255, 260 }, + { 0, 0, 0x8010, 0, 0, 255, 1920 }, + { 1, 0, 0x8010, 0, 50, 255, 50 }, + { 0, 0, 0x8020, 0, 0, 255, 1600 }, + { 1, 0, 0x8020, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x33, 0, 0, 255, 241 }, + { 0, 0, 0x800C, 0, 0, 255, 1177 }, + { 1, 0, 0x800C, 0, 100, 255, 100 }, + { 0, 0, 0x801C, 0, 0, 255, 1115 }, + { 1, 0, 0x801C, 0, 50, 255, 50 }, + { 0, 0, 0x802B, 0, 0, 255, 2120 }, + { 1, 0, 0x802B, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x8008, 0, 0, 255, 1671 }, + { 1, 0, 0x8008, 0, 50, 255, 50 }, + { 0, 0, 0x8018, 0, 0, 255, 1600 }, + { 1, 0, 0x8018, 0, 1, 255, 50 }, + { 0, 0, 0x803E, 0, 0, 0, 176 }, + { 0, 0, 0x8011, 0, 0, 255, 588 }, + { 0, 0, 0x8021, 0, 0, 0, 2420 }, + { 1, 0, 0x8021, 0, 10, 255, 50 }, + { 0, 0, 0x8021, 0, 0, 255, 1200 }, + { 1, 0, 0x8021, 0, 1, 255, 150 }, + { 0, 0, 0x8040, 0, 0, 255, 1091 }, + { 1, 0, 0x8040, 0, 80, 255, 160 }, + { 0, 0, 0x2A, 0, 0, 255, 9500 }, + { 255, 0, 0x8002, 0, 50, 255, 50 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + }, + { + { 0, 0, 0x25, 0, 0, 255, 1620 }, { 0, 0, 0x8002, 0, 0, 255, 2490 }, { 1, 0, 0x8002, 0, 50, 255, 50 }, + { 0, 0, 0x8030, 0, 0, 255, 1620 }, { 1, 0, 0x8030, 0, 1, 255, 50 }, { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, { 0, 0, 0x2C, 0, 0, 255, 260 }, { 0, 0, 0x8009, 0, 0, 255, 2096 }, + { 1, 0, 0x8009, 0, 50, 255, 50 }, { 0, 0, 0x8019, 0, 0, 2, 1590 }, { 1, 0, 0x8019, 0, 1, 255, 50 }, + { 0, 0, 0x8041, 0, 0, 255, 1600 }, { 1, 0, 0x8041, 0, 1, 255, 50 }, { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, { 0, 0, 0x2C, 0, 0, 255, 260 }, { 0, 0, 0xE, 0, 0, 255, 2400 }, + { 1, 0, 0xE, 0, 150, 255, 200 }, { 0, 0, 0x801E, 0, 0, 1, 1590 }, { 1, 0, 0x801E, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, { 1, 0, 0x26, 0, 100, 255, 100 }, { 0, 0, 0x2C, 0, 0, 255, 260 }, + { 0, 0, 0x8006, 0, 0, 255, 1005 }, { 3, 0, 0x36, 0, 0, 255, 1000 }, { 1, 0, 0x8006, 0, 50, 255, 100 }, + { 0, 0, 0x8016, 0, 0, 255, 1600 }, { 1, 0, 0x8016, 0, 1, 255, 50 }, { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, { 0, 0, 0x33, 0, 0, 255, 241 }, { 0, 0, 0x800F, 0, 0, 255, 1632 }, + { 1, 0, 0x800F, 0, 50, 255, 100 }, { 0, 0, 0x801F, 0, 0, 1, 1310 }, { 3, 0, 0x36, 0, 0, 255, 500 }, + { 1, 0, 0x801F, 0, 1, 255, 50 }, { 0, 0, 0x26, 0, 0, 255, 1091 }, { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x33, 0, 0, 255, 241 }, { 0, 0, 0x8007, 0, 0, 255, 1906 }, { 1, 0, 0x8007, 0, 50, 255, 100 }, + { 0, 0, 0x8017, 0, 0, 1, 1590 }, { 1, 0, 0x8017, 0, 1, 255, 50 }, { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, { 0, 0, 0x802B, 0, 0, 255, 2120 }, { 1, 0, 0x802B, 0, 30, 255, 150 }, + { 0, 0, 0x803E, 0, 0, 0, 176 }, { 0, 0, 0x8011, 0, 0, 255, 588 }, { 0, 0, 0x8021, 0, 0, 0, 2392 }, + { 1, 0, 0x8021, 0, 10, 255, 50 }, { 0, 0, 0x803D, 0, 0, 255, 1700 }, { 1, 0, 0x8021, 0, 10, 255, 250 }, + { 0, 0, 0x8017, 0, 0, 255, 1600 }, { 1, 0, 0x8017, 0, 1, 255, 50 }, { 0, 0, 0x8040, 0, 0, 255, 1091 }, + { 1, 0, 0x8040, 0, 80, 255, 160 }, { 0, 0, 0x2A, 0, 0, 255, 9250 }, { 255, 0, 0x8002, 0, 50, 255, 50 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + }, + { + { 0, 0, 0x25, 0, 0, 255, 1620 }, + { 0, 0, 0x8002, 0, 0, 255, 2490 }, + { 1, 0, 0x8002, 0, 50, 255, 50 }, + { 0, 0, 0x8012, 0, 0, 255, 1600 }, + { 1, 0, 0x8012, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x32, 0, 0, 255, 838 }, + { 0, 0, 0x8003, 0, 0, 255, 1584 }, + { 1, 0, 0x8003, 0, 150, 255, 150 }, + { 0, 0, 0x803A, 0, 0, 255, 1635 }, + { 1, 0, 0x803A, 0, 150, 255, 150 }, + { 0, 0, 0x33, 0, 0, 255, 241 }, + { 0, 0, 0x800D, 0, 0, 255, 2184 }, + { 1, 0, 0x800D, 0, 1, 255, 100 }, + { 0, 0, 0x801D, 0, 0, 1, 1115 }, + { 1, 0, 0x801D, 0, 50, 255, 100 }, + { 0, 0, 0x31, 0, 0, 255, 1604 }, + { 1, 0, 0x31, 0, 100, 255, 100 }, + { 0, 0, 0x2C, 0, 0, 255, 242 }, + { 0, 0, 0x8005, 0, 0, 255, 1291 }, + { 3, 0, 0x37, 0, 0, 255, 1000 }, + { 1, 0, 0x8005, 0, 50, 255, 100 }, + { 0, 0, 0x803A, 0, 0, 255, 1635 }, + { 1, 0, 0x803A, 0, 150, 255, 150 }, + { 0, 0, 0x33, 0, 0, 255, 241 }, + { 0, 0, 0x800F, 0, 0, 255, 1632 }, + { 1, 0, 0x800F, 0, 50, 255, 100 }, + { 0, 0, 0x801F, 0, 0, 1, 1115 }, + { 1, 0, 0x801F, 0, 1, 255, 50 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 100, 255, 100 }, + { 0, 0, 0x33, 0, 0, 255, 241 }, + { 0, 0, 0x8007, 0, 0, 255, 1906 }, + { 1, 0, 0x8007, 0, 50, 255, 100 }, + { 0, 0, 0x8017, 0, 0, 1, 1590 }, + { 1, 0, 0x8017, 0, 1, 255, 50 }, + { 0, 0, 0x27, 0, 0, 255, 150 }, + { 0, 0, 0x28, 0, 0, 255, 1020 }, + { 1, 0, 0x28, 0, 100, 255, 100 }, + { 255, 0, 0x8002, 0, 50, 255, 50 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + }, + { + { 0, 0, 0x23, 0, 0, 255, 2926 }, + { 0, 0, 0x22, 0, 0, 255, 1251 }, + { 1, 0, 0x22, 0, 200, 255, 200 }, + { 0, 0, 0x24, 0, 0, 255, 1636 }, + { 1, 0, 0x24, 0, 200, 255, 200 }, + { 0, 0, 0x3C, 0, 0, 255, 1560 }, + { 1, 0, 0x3C, 0, 200, 255, 200 }, + { 0, 0, 0x25, 0, 0, 255, 1618 }, + { 0, 0, 0x2C, 0, 0, 255, 242 }, + { 0, 0, 0x2D, 0, 0, 255, 582 }, + { 0, 0, 0x32, 0, 0, 255, 868 }, + { 0, 0, 0x33, 0, 0, 255, 281 }, + { 0, 0, 0x8002, 0, 0, 255, 2490 }, + { 1, 0, 0x8002, 0, 200, 255, 200 }, + { 0, 0, 0x8003, 0, 0, 255, 1584 }, + { 1, 0, 0x8003, 0, 200, 255, 200 }, + { 0, 0, 0x8004, 0, 0, 255, 1920 }, + { 1, 0, 0x8004, 0, 200, 255, 200 }, + { 0, 0, 0x8005, 0, 0, 255, 2290 }, + { 1, 0, 0x8005, 0, 200, 255, 200 }, + { 0, 0, 0x8006, 0, 0, 255, 2005 }, + { 1, 0, 0x8006, 0, 200, 255, 200 }, + { 0, 0, 0x8007, 0, 0, 255, 1905 }, + { 1, 0, 0x8007, 0, 200, 255, 200 }, + { 0, 0, 0x8008, 0, 0, 255, 1671 }, + { 1, 0, 0x8008, 0, 200, 255, 200 }, + { 0, 0, 0x8009, 0, 0, 255, 2095 }, + { 1, 0, 0x8009, 0, 200, 255, 200 }, + { 0, 0, 0x800A, 0, 0, 255, 1632 }, + { 1, 0, 0x800A, 0, 200, 255, 200 }, + { 0, 0, 0x800D, 0, 0, 255, 2184 }, + { 1, 0, 0x800D, 0, 200, 255, 200 }, + { 0, 0, 0xE, 0, 0, 255, 2400 }, + { 1, 0, 0xE, 0, 200, 255, 200 }, + { 0, 0, 0x803A, 0, 0, 255, 1635 }, + { 1, 0, 0x803A, 0, 200, 255, 200 }, + { 0, 0, 0x36, 0, 0, 255, 389 }, + { 0, 0, 0x37, 0, 0, 255, 268 }, + { 0, 0, 0x8012, 0, 0, 255, 1598 }, + { 1, 0, 0x8012, 0, 200, 255, 200 }, + { 0, 0, 0x8013, 0, 0, 0, 1470 }, + { 1, 0, 0x8013, 0, 200, 255, 200 }, + { 0, 0, 0x8013, 0, 0, 255, 1470 }, + { 1, 0, 0x8013, 0, 200, 255, 200 }, + { 0, 0, 0x8041, 0, 0, 255, 1311 }, + { 1, 0, 0x8041, 0, 200, 255, 200 }, + { 0, 0, 0x801C, 0, 0, 255, 1115 }, + { 1, 0, 0x801C, 0, 200, 255, 200 }, + { 0, 0, 0x802B, 0, 0, 255, 2120 }, + { 1, 0, 0x802B, 0, 200, 255, 200 }, + { 0, 0, 0x26, 0, 0, 255, 1091 }, + { 1, 0, 0x26, 0, 200, 255, 200 }, + { 0, 0, 0x31, 0, 0, 255, 1604 }, + { 1, 0, 0x31, 0, 200, 255, 200 }, + { 0, 0, 0x27, 0, 0, 255, 200 }, + { 0, 0, 0x28, 0, 0, 255, 1020 }, + { 1, 0, 0x28, 0, 200, 255, 200 }, + { 0, 0, 0x803F, 0, 0, 255, 900 }, + { 1, 0, 0x803F, 0, 200, 255, 200 }, + { 0, 0, 0x38, 0, 0, 255, 665 }, + { 1, 0, 0x38, 0, 200, 255, 200 }, + { 0, 0, 0x802E, 0, 0, 255, 1647 }, + { 1, 0, 0x802E, 0, 200, 255, 200 }, + { 0, 0, 0x802F, 0, 0, 255, 1667 }, + { 1, 0, 0x802F, 0, 200, 255, 200 }, + { 0, 0, 0x803E, 0, 0, 0, 176 }, + { 0, 0, 0x8011, 0, 0, 255, 588 }, + { 1, 0, 0x8011, 0, 200, 255, 200 }, + { 0, 0, 0x8021, 0, 0, 0, 2391 }, + { 1, 0, 0x8021, 0, 200, 255, 200 }, + { 0, 0, 0x8021, 0, 0, 255, 2391 }, + { 1, 0, 0x8021, 0, 200, 255, 200 }, + { 0, 0, 0x803D, 0, 0, 255, 1700 }, + { 1, 0, 0x803D, 0, 200, 255, 200 }, + { 0, 0, 0x8040, 0, 0, 255, 1459 }, + { 1, 0, 0x8040, 0, 200, 255, 200 }, + { 0, 0, 0x2A, 0, 0, 255, 9250 }, + { 1, 0, 0x2A, 0, 200, 255, 200 }, + { 255, 0, 0x8002, 0, 50, 255, 50 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0, 0 }, + }, +}; +s32 D_800C737C = 0; // unused. file split? +f32 D_800C7380 = 1.0f; +u32 sNextVoiceId = 0; +u32 sCurrentVoiceId = 0; +u8 sSetNextVoiceId = 0; +u8 D_800C7390 = 0; +u8 sMuteBgmForVoice = 0; void func_80016A50(void) { } -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80016A58.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80016BC0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80016CDC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80016EE4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80016FF0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80017360.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80017494.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80017550.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80017588.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80017600.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80017760.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_800177C8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_800182F4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001831C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001839C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80018410.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80018470.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_800184D4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_800184EC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_800185A0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_800185F8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80018E9C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80018EE0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80018FA4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80019068.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_800190E4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80019158.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_800191BC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/Audio_PlaySfx.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80019290.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_80019434.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_800197AC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_800198C0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001A01C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001A290.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001A38C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001A4B8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/Audio_KillSfx.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001A55C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001A6C4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001A838.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001A988.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001A9EC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AA90.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AAE4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AB50.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001ACDC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AD00.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AD44.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AE58.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AE78.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AED4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AF40.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AF50.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001AF9C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001B014.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001B454.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001B774.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001BA40.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001BB74.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001BC20.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001BC48.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001BD0C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001BFC0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001C3EC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001C8B8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001CA24.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001CB80.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001CCDC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001CE28.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001CEFC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001CF60.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001CFA8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D034.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D0B4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D10C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D15C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D1C8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D2FC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D3A0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D400.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D410.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D444.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D4AC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D520.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D638.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D6DC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D780.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D8A8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D8F4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001D9E0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001DA90.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001DBD0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001DC2C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001DC6C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001DCB4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001DCE0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001DD40.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001DE1C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/func_8001DECC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/D_800C8DD0.s") +f32 Audio_GetSfxFalloff(u8 bankId, u8 entryIndex) { + f32 cutoff; + f32 midDist; + f32 distance; + f32 falloff; + f32 midrange; + f32 range; + + if (SFX_BIT09(gSfxBanks[bankId][entryIndex].sfxId)) { + return 1.0f; + } + distance = gSfxBanks[bankId][entryIndex].distance; + if (distance > 33000.0f) { + falloff = 0.0f; + } else { + switch (SFX_RANGE_MASK(gSfxBanks[bankId][entryIndex].sfxId)) { + default: + range = 1650.0f; + break; + case 1 << 16: + range = 2200.0f; + break; + case 2 << 16: + range = 3142.8572f; + break; + case 3 << 16: + range = 6346.1543f; + break; + } + cutoff = range / 5.0f; + if (distance < range / 5.0f) { + falloff = 1.0f; + } else if (distance < range) { + midDist = range - cutoff; + midrange = distance - cutoff; + falloff = (((midDist - midrange) / midDist) * 0.19f) + 0.81f; + } else { + falloff = (1.0f - ((distance - range) / (33000.0f - range))) * 0.81f; + } + falloff = SQ(falloff); + } + return falloff; +} + +s8 Audio_GetSfxReverb(u8 bankId, u8 entryIndex, u8 channelId) { + s32 totalReverb; + s8 distReverb = 0; + s8 scriptReverb = 0; + + if (!SFX_BIT10(gSfxBanks[bankId][entryIndex].sfxId)) { + if (gSfxBanks[bankId][entryIndex].distance < 8250.0f) { + distReverb = (gSfxBanks[bankId][entryIndex].distance / 8250.0f) * 40.0f; + } else { + distReverb = 40; + } + } + if (gSeqPlayers[SEQ_PLAYER_SFX].channels[channelId] != &gSeqChannelNone) { + scriptReverb = gSeqPlayers[SEQ_PLAYER_SFX].channels[channelId]->seqScriptIO[6]; + } + if (scriptReverb == -1) { + scriptReverb = 0; + } + totalReverb = *gSfxBanks[bankId][entryIndex].reverbAdd + distReverb + scriptReverb + sBaseReverb + sAudioSpecReverb; + totalReverb = MIN(127, totalReverb); + return totalReverb; +} + +s8 Audio_GetSfxPan(f32 xPos, f32 zPos, u8 mode) { + if (gSfxChannelLayout != 3) { + f32 absx = ABSF(xPos); + f32 absz = ABSF(zPos); + f32 pan; + + if ((absx < 1.0f) && (absz < 1.0f)) { + return 64; + } + absx = MIN(1200.0f, absx); + absz = MIN(1200.0f, absz); + + if ((xPos == 0) && (zPos == 0)) { + pan = 0.5f; + } else if ((xPos >= 0.f) && (absz <= absx)) { + pan = 1.0f - ((2400.0f - absx) / (10.0f * (2400.0f - absz))); + } else if ((xPos < 0.0f) && (absz <= absx)) { + pan = (2400.0f - absx) / (10.0f * (2400.0f - absz)); + } else { + pan = (xPos / (2.5f * absz)) + 0.5f; + } + return ROUND(pan * 127.0f); + } else if (mode != 4) { + return ((mode & 1) * 127); + } + return 64; +} + +f32 Audio_GetSfxFreqMod(u8 bankId, u8 entryIndex) { + f32 distance; + f32 freqMod = 1.0f; + + if (SFX_BIT08(gSfxBanks[bankId][entryIndex].sfxId)) { + freqMod -= ((gAudioRandom % 16) / 192.0f); + } + distance = gSfxBanks[bankId][entryIndex].distance; + if (!SFX_BIT09(gSfxBanks[bankId][entryIndex].sfxId)) { + if (distance >= 33000.0f) { + freqMod += 0.2f; + } else { + freqMod += 0.2f * (distance / 33000.0f); + } + } + if ((gSfxChannelLayout != 0) && (gSfxBanks[bankId][entryIndex].token & 2)) { + freqMod *= 1.1f; + } + return freqMod; +} + +void Audio_SetSfxProperties(u8 bankId, u8 entryIndex, u8 channelId) { + f32 volumeMod = 1.0f; + s8 reverb = 0; + f32 freqMod = 1.0f; + s8 pan = 64; + SfxBankEntry* entry = &gSfxBanks[bankId][entryIndex]; + + switch (bankId) { + case 0: + case 1: + case 2: + case 3: + if (entry->state == 2) { + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, channelId, 1, gLevelType); + } + if (SFX_BIT13(entry->sfxId) && (*entry->zPos > 0.0f)) { + f32 yScaled = *entry->yPos / 2.5f; + + entry->distance = SQ(*entry->xPos) + SQ(yScaled); + } + entry->distance = sqrtf(entry->distance); + volumeMod = (Audio_GetSfxFalloff(bankId, entryIndex) * *entry->volMod) * gSfxVolumeMods[bankId].value; + reverb = Audio_GetSfxReverb(bankId, entryIndex, channelId); + freqMod = Audio_GetSfxFreqMod(bankId, entryIndex) * *entry->freqMod; + if ((bankId != 0) || !(*entry->zPos > -200.0f) || !(*entry->zPos < 200.0f) || (gSfxChannelLayout == 3)) { + pan = Audio_GetSfxPan(*entry->xPos, *entry->zPos, entry->token); + } + break; + case 4: + if (gSfxChannelLayout == 3) { + if (entry->token != 4) { + pan = (entry->token & 1) * 127; + } + } + break; + } + if (volumeMod != gSfxChannelState[channelId].volMod) { + AUDIOCMD_CHANNEL_SET_VOL_SCALE(SEQ_PLAYER_SFX, channelId, volumeMod); + gSfxChannelState[channelId].volMod = volumeMod; + } + if (reverb != gSfxChannelState[channelId].reverb) { + AUDIOCMD_CHANNEL_SET_REVERB_VOLUME(SEQ_PLAYER_SFX, channelId, reverb); + gSfxChannelState[channelId].reverb = reverb; + } + if (freqMod != gSfxChannelState[channelId].freqMod) { + AUDIOCMD_CHANNEL_SET_FREQ_SCALE(SEQ_PLAYER_SFX, channelId, freqMod); + gSfxChannelState[channelId].freqMod = freqMod; + } + if (pan != gSfxChannelState[channelId].pan) { + AUDIOCMD_CHANNEL_SET_PAN(SEQ_PLAYER_SFX, channelId, pan); + gSfxChannelState[channelId].pan = pan; + } +} + +f32 Audio_UpdateDopplerShift(f32* srcPos, f32* srcVel, f32 soundSpeed, f32* curDopplerShift) { + f32 xVel; + f32 zVel; + f32 xPos; + f32 zPos; + f32 xzDist; + f32 xPosNext; + f32 zPosNext; + f32 xzDistNext; + f32 step; + f32 newShift; + f32 relativeSpeed; + f32 targetDopplerShift; + s32 pad; + + xPos = srcPos[0]; + zPos = srcPos[2]; + xVel = srcVel[0]; + zVel = srcVel[2]; + xzDist = sqrtf(SQ(xPos) + SQ(zPos)); + xPosNext = xPos + xVel; + zPosNext = zPos + zVel; + xzDistNext = sqrtf(SQ(xPosNext) + SQ(zPosNext)); + relativeSpeed = (xzDist - xzDistNext) / soundSpeed; + targetDopplerShift = 1.0f / (1.0f - relativeSpeed); + + step = targetDopplerShift - *curDopplerShift; + newShift = *curDopplerShift; + if (step != 0.0f) { + if (step > 0.2f) { + newShift += 0.2f; + } else if (step < -0.2f) { + newShift -= 0.2f; + } else { + newShift += step; + } + } + *curDopplerShift = newShift; + + if (newShift > 4.0f) { + newShift = 4.0f; + } else if (newShift < 0.1f) { + newShift = 0.1f; + } + + return newShift; +} + +void func_80017494(void) { + u8 i; + + for (i = 0; D_800C5D6C[sNewAudioSpecId][i] != 0xFF; i++) { + AUDIOCMD_GLOBAL_SYNC_LOAD_INSTRUMENT(0, D_800C5D6C[sNewAudioSpecId][i], 0); + } +} + +void func_80017550(void) { + if (sNewAudioSpecId == 12) { + AUDIOCMD_GLOBAL_SYNC_LOAD_SEQ_PARTS(14, 0); + } +} + +void Audio_ResetSfxChannelState(void) { + u8 i; + + sBaseReverb = 0; + sAudioSpecReverb = D_800C5E38[sNewAudioSpecId]; + for (i = 0; i < 16; i++) { + gSfxChannelState[i].volMod = 1.0f; + gSfxChannelState[i].freqMod = 1.0f; + gSfxChannelState[i].reverb = 0; + gSfxChannelState[i].pan = 64; + } +} + +void Audio_StartSequence(u8 seqPlayId, u8 seqId, u8 seqArgs, u16 fadeInTime) { + u8 i; + s32 pad; + + if (!gStartSeqDisabled || (seqPlayId == SEQ_PLAYER_SFX)) { + AUDIOCMD_GLOBAL_INIT_SEQPLAYER((u32) seqPlayId, (u32) seqId, fadeInTime); + gActiveSequences[seqPlayId].prevSeqId = gActiveSequences[seqPlayId].seqId = seqId | ((seqArgs) << 8); + if (gActiveSequences[seqPlayId].mainVolume.mod != 1.0f) { + AUDIOCMD_SEQPLAYER_FADE_VOLUME_SCALE((u32) seqPlayId, gActiveSequences[seqPlayId].mainVolume.mod); + } + gActiveSequences[seqPlayId].tempo.timer = 0; + gActiveSequences[seqPlayId].tempoOriginal = 0; + gActiveSequences[seqPlayId].tempoCmd = 0; + for (i = 0; i < 16; i++) { + gActiveSequences[seqPlayId].channelMod[i].volume.value = 1.0f; + gActiveSequences[seqPlayId].channelMod[i].volume.timer = 0; + gActiveSequences[seqPlayId].channelMod[i].freq.value = 1.0f; + gActiveSequences[seqPlayId].channelMod[i].freq.timer = 0; + } + gActiveSequences[seqPlayId].volChannelFlags = gActiveSequences[seqPlayId].freqModChannelFlags = 0; + } +} + +void Audio_StopSequence(u8 seqPlayId, u16 fadeOutTime) { + AUDIOCMD_GLOBAL_DISABLE_SEQPLAYER(seqPlayId, fadeOutTime); + gActiveSequences[seqPlayId].seqId = 0xFFFF; +} + +#ifdef NON_MATCHING +void Audio_ProcessSeqCmd(u32 seqCmd) { + u16 flag; + u16 channelDisableMask; + u16 fadeTimer; + u16 val; + s32 priority; + u8 i; // sp63 + u8 specId; + u8 sp61; + u8 ioPort; + u8 channel; + u8 found; + u8 muteFlag; + u8 duration; + u8 seqNumber; + u8 subOp; + u8 seqPlayId; + u8 seqArgs; + u8* tempptr; // sp54 + u8* tempPtr2; + u32 sp4C; + + seqPlayId = (seqCmd & 0x0F000000) >> 0x18; + switch ((seqCmd >> 0x1C) & 0xFF) { + case 0: + seqNumber = seqCmd & 0xFF; + seqArgs = (seqCmd & 0xFF00) >> 8; + fadeTimer = (seqCmd & 0xFF0000) >> 13; + if (gActiveSequences[seqPlayId].isWaitingForFonts == 0) { + if (seqArgs < 0x80) { + Audio_StartSequence(seqPlayId, seqNumber, seqArgs, fadeTimer); + } else { + gActiveSequences[seqPlayId].startSeqCmd = seqCmd & ~0x8000; + gActiveSequences[seqPlayId].isWaitingForFonts = 1; + Audio_StopSequence(seqPlayId, 1); + if (gActiveSequences[seqPlayId].prevSeqId != 0xFFFF) { + tempptr = func_8001ED14(seqNumber, &sp4C); + tempPtr2 = func_8001ED14(gActiveSequences[seqPlayId].prevSeqId & 0xFF, &sp4C); + if (tempptr[0] != tempPtr2[0]) { + AUDIOCMD_GLOBAL_DISCARD_SEQ_FONTS(seqNumber); + } + } + AUDIOCMD_GLOBAL_ASYNC_LOAD_FONT(seqNumber, 20, (seqPlayId + 1) & 0xFF); + // AudioThread_QueueCmdS8(0xF5000000 | ((temp1 & 0xFF) << 0x10) | 0x1400 | ((seqPlayId + 1) & 0xFF), + // 0); + } + } + break; + case 1: + fadeTimer = (seqCmd & 0xFF0000) >> 13; + Audio_StopSequence(seqPlayId, fadeTimer); + return; + case 2: + seqNumber = seqCmd & 0xFF; + seqArgs = (seqCmd & 0xFF00) >> 8; + fadeTimer = (seqCmd & 0xFF0000) >> 13; + priority = seqArgs; + for (i = 0; i < gNumSeqRequests[seqPlayId]; i++) { + if (seqNumber == gSeqRequests[seqPlayId][i].seqId) { + if (i == 0) { + Audio_StartSequence(seqPlayId, seqNumber, seqArgs, fadeTimer); + } + return; + } + } + found = gNumSeqRequests[seqPlayId]; + for (i = 0; i < gNumSeqRequests[seqPlayId]; i++) { + if (seqArgs >= gSeqRequests[seqPlayId][i].priority) { + found = i; + i = gNumSeqRequests[seqPlayId]; + } + } + if ((found != gNumSeqRequests[seqPlayId]) || (found == 0)) { + if (gNumSeqRequests[seqPlayId] < 5) { + gNumSeqRequests[seqPlayId]++; + } + for (i = gNumSeqRequests[seqPlayId] - 1; i != found; i--) { + gSeqRequests[seqPlayId][i].priority = gSeqRequests[seqPlayId][i - 1].priority; + gSeqRequests[seqPlayId][i].seqId = gSeqRequests[seqPlayId][i - 1].seqId; + } + gSeqRequests[seqPlayId][found].priority = seqArgs; + gSeqRequests[seqPlayId][found].seqId = seqNumber; + } + if (found == 0) { + Audio_StartSequence(seqPlayId, seqNumber, seqArgs, fadeTimer); + } + break; + case 3: + fadeTimer = (seqCmd & 0xFF0000) >> 0xD; + found = gNumSeqRequests[seqPlayId]; + for (i = 0; i < gNumSeqRequests[seqPlayId]; i++) { + seqNumber = seqCmd & 0xFF; + if (gSeqRequests[seqPlayId][i].seqId == seqNumber) { + found = i; + i = gNumSeqRequests[seqPlayId]; + } + } + if (found != gNumSeqRequests[seqPlayId]) { + for (i = found; i < gNumSeqRequests[seqPlayId] - 1; i++) { + gSeqRequests[seqPlayId][i].priority = gSeqRequests[seqPlayId][i + 1].priority; + gSeqRequests[seqPlayId][i].seqId = gSeqRequests[seqPlayId][i + 1].seqId; + } + gNumSeqRequests[seqPlayId]--; + } + if (found == 0) { + Audio_StopSequence(seqPlayId, fadeTimer); + if (gNumSeqRequests[seqPlayId] != 0) { + + Audio_StartSequence(seqPlayId, gSeqRequests[seqPlayId][0].seqId, + gSeqRequests[seqPlayId][0].priority, fadeTimer); + } + } + break; + case 4: + val = seqCmd & 0xFF; + duration = (seqCmd & 0xFF0000) >> 0xF; + + if (duration == 0) { + duration++; + } + gActiveSequences[seqPlayId].mainVolume.target = val / 127.0f; + if (gActiveSequences[seqPlayId].mainVolume.mod != gActiveSequences[seqPlayId].mainVolume.target) { + gActiveSequences[seqPlayId].mainVolume.step = + (gActiveSequences[seqPlayId].mainVolume.mod - gActiveSequences[seqPlayId].mainVolume.target) / + duration; + gActiveSequences[seqPlayId].mainVolume.timer = duration; + } + break; + case 5: + val = (seqCmd & 0xFFFF); + duration = (seqCmd & 0xFF0000) >> 0xF; + + if (duration == 0) { + duration++; + } + for (i = 0; i < 16; i++) { + gActiveSequences[seqPlayId].channelMod[i].freq.target = val / 1000.0f; + gActiveSequences[seqPlayId].channelMod[i].freq.step = + (gActiveSequences[seqPlayId].channelMod[i].freq.value - + gActiveSequences[seqPlayId].channelMod[i].freq.target) / + duration; + gActiveSequences[seqPlayId].channelMod[i].freq.timer = duration; + } + gActiveSequences[seqPlayId].freqModChannelFlags = 0xFFFF; + break; + case 6: + val = (seqCmd & 0xFF); + channel = (seqCmd & 0xF00) >> 8; + duration = (seqCmd & 0xFF0000) >> 0xF; + + if (duration == 0) { + duration++; + } + + gActiveSequences[seqPlayId].channelMod[channel].volume.target = val / 127.0f; + if (gActiveSequences[seqPlayId].channelMod[channel].volume.value != + gActiveSequences[seqPlayId].channelMod[channel].volume.target) { + gActiveSequences[seqPlayId].channelMod[channel].volume.step = + (gActiveSequences[seqPlayId].channelMod[channel].volume.value - + gActiveSequences[seqPlayId].channelMod[channel].volume.target) / + duration; + gActiveSequences[seqPlayId].channelMod[channel].volume.timer = duration; + gActiveSequences[seqPlayId].freqModChannelFlags |= 1 << channel; + } + break; + case 7: + val = seqCmd & 0xFF; + ioPort = ((seqCmd & 0xFF0000) >> 0x10); + AUDIOCMD_SEQPLAYER_SET_IO(seqPlayId, ioPort, 0, val); + // AudioThread_QueueCmdS8(((seqPlayId & 0xFF) << 0x10) | 0x46000000 | (temp3 << 8), temp4); + break; + case 8: + val = seqCmd & 0xFF; + channel = (seqCmd & 0xF00) >> 8; + + ioPort = (seqCmd & 0xFF0000) >> 0x10; + if (!(gActiveSequences[seqPlayId].channelPortMask & (1 << channel))) { + AUDIOCMD_CHANNEL_SET_IO(seqPlayId, (u32) channel, ioPort, val); + // AudioThread_QueueCmdS8(((seqPlayId & 0xFF) << 0x10) | 0x06000000 | ((temp_a2_5 & 0xFF) << 8) | temp3, + // temp4); + } + break; + case 9: + channelDisableMask = seqCmd & 0xFFFF; + gActiveSequences[seqPlayId].channelPortMask = channelDisableMask; + break; + case 10: + channelDisableMask = seqCmd & 0xFFFF; + + flag = 1; + for (i = 0; i < 16; i++) { + AUDIOCMD_CHANNEL_SET_MUTE(seqPlayId, (u32) i, (channelDisableMask & flag) ? 1 : 0); + flag <<= 1; + } + break; + case 11: + gActiveSequences[seqPlayId].tempoCmd = seqCmd; + break; + case 12: + subOp = (seqCmd & 0xF00000) >> 20; + if (subOp != 15) { + found = gActiveSequences[seqPlayId].setupCmdNum++; + if (found < 5) { + gActiveSequences[seqPlayId].setupCmd[found] = seqCmd; + gActiveSequences[seqPlayId].setupCmdTimer = 2; + } + } else { + gActiveSequences[seqPlayId].setupCmdNum = 0; + } + break; + case 14: + val = seqCmd & 0xFF; + subOp = (seqCmd & 0xF00) >> 8; + + switch (subOp) { + case 0: + AUDIOCMD_GLOBAL_SET_SOUND_MODE(gSoundModeList[val]); + // AudioThread_QueueCmdS32(0xF0000000, gSoundModeList[temp11]); + break; + case 1: + gStartSeqDisabled = val & 1; + break; + } + break; + case 15: + specId = seqCmd & 0xFF; + val = (seqCmd & 0xFF00) >> 8; + + gSfxChannelLayout = val; + + sp61 = sNewAudioSpecId; + sNewAudioSpecId = specId; + if (sp61 != sNewAudioSpecId) { + func_8001ED8C((OSMesg) (u32) sNewAudioSpecId); + func_8001DE1C(sp61); + AUDIOCMD_GLOBAL_STOP_AUDIOCMDS(); + } else { + Audio_StopSequence(SEQ_PLAYER_BGM, 1); + Audio_StopSequence(SEQ_PLAYER_FANFARE, 1); + } + break; + } +} +#else +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_general/Audio_ProcessSeqCmd.s") +#endif + +void Audio_QueueSeqCmd(s32 seqCmd) { + gAudioSeqCmds[gSeqCmdWritePos] = seqCmd; + gSeqCmdWritePos++; +} + +void Audio_ProcessSeqCmds(void) { + while (gSeqCmdWritePos != gSeqCmdReadPos) { + Audio_ProcessSeqCmd(gAudioSeqCmds[gSeqCmdReadPos++]); + } +} + +u16 Audio_GetActiveSeqId(u8 seqPlayId) { + if (!gSeqPlayers[seqPlayId].enabled) { + return 0xFFFF; + } + return gActiveSequences[seqPlayId].seqId; +} + +s32 Audio_SeqCmdNotQueued(s32 seqCmd) { + s32 notFound = true; + u8 i; + + for (i = gSeqCmdReadPos; i < gSeqCmdWritePos; i++) { + if (seqCmd == gAudioSeqCmds[i]) { + notFound = false; + i = gSeqCmdWritePos; + } + } + return notFound; +} + +s32 Audio_SeqCmdValueNotQueued(s32 cmdVal, s32 cmdMask) { + s32 notFound = true; + u8 i; + + for (i = gSeqCmdReadPos; i < gSeqCmdWritePos; i++) { + if (cmdVal == (gAudioSeqCmds[i] & cmdMask)) { + notFound = false; + i = gSeqCmdWritePos; + } + } + return notFound; +} + +void Audio_ResetSequenceRequests(u8 seqPlayId) { + gNumSeqRequests[seqPlayId] = 0; +} + +void func_800184EC(u8 seqPlayId, u8 setupOpDisable) { + u8 i; + + for (i = 0; i < gActiveSequences[seqPlayId].setupCmdNum; i++) { + u8 setupOp = ((gActiveSequences[seqPlayId].setupCmd[i] & 0xF00000) >> 20); + + if (setupOp == setupOpDisable) { + gActiveSequences[seqPlayId].setupCmd[i] = 0xFF000000; + } + } +} + +void Audio_SetSequenceFade(u8 seqPlayId, u8 fadeModId, u8 fadeMod, u8 fadeTime) { + gActiveSequences[seqPlayId].mainVolume.fadeMod[fadeModId] = fadeMod; + gActiveSequences[seqPlayId].mainVolume.fadeTimer = fadeTime; + gActiveSequences[seqPlayId].mainVolume.fadeActive = true; +} + +void Audio_UpdateActiveSequences(void) { + u8 seqPlayId; + u8 i; + u8 tempoTimer; + u8 channelId; + u16 tempoTarget; + u16 prevTempo; + u16 seqId; + u8 tempoOp; + u8 setupSeqPlayId; + u8 val1; + u8 setupOp; + u8 val2; + u8 temp2; + s32 temp; + u32 cmd; + f32 fadeMod; + s32 sp70; + s32 pad1; + s32 pad2; + + for (seqPlayId = 0; seqPlayId < 4; seqPlayId++) { + if ((gActiveSequences[seqPlayId].isWaitingForFonts != 0)) { + switch ((s32) func_8001ECAC(&sp70)) { + case 1: + case 2: + case 3: + case 4: + gActiveSequences[seqPlayId].isWaitingForFonts = 0; + Audio_ProcessSeqCmd(gActiveSequences[seqPlayId].startSeqCmd); + break; + } + } + if (gActiveSequences[seqPlayId].mainVolume.fadeActive != 0) { + fadeMod = 1.0f; + for (i = 0; i < 3; i++) { + fadeMod *= gActiveSequences[seqPlayId].mainVolume.fadeMod[i] / 127.0f; + } + SEQCMD_SET_SEQPLAYER_VOLUME(seqPlayId, gActiveSequences[seqPlayId].mainVolume.fadeTimer, + (u8) (fadeMod * 127.0f)); + gActiveSequences[seqPlayId].mainVolume.fadeActive = false; + } + if (gActiveSequences[seqPlayId].mainVolume.timer != 0) { + gActiveSequences[seqPlayId].mainVolume.timer--; + if (gActiveSequences[seqPlayId].mainVolume.timer != 0) { + gActiveSequences[seqPlayId].mainVolume.mod -= gActiveSequences[seqPlayId].mainVolume.step; + } else { + gActiveSequences[seqPlayId].mainVolume.mod = gActiveSequences[seqPlayId].mainVolume.target; + } + AUDIOCMD_SEQPLAYER_FADE_VOLUME_SCALE((u32) seqPlayId, gActiveSequences[seqPlayId].mainVolume.mod); + } + if (gActiveSequences[seqPlayId].tempoCmd != 0) { + cmd = gActiveSequences[seqPlayId].tempoCmd; + temp = cmd & 0xFFF; + temp2 = (cmd & 0xFF0000) >> 0xF; + tempoTimer = temp2; + tempoTarget = temp; + + if (temp2 == 0) { + tempoTimer = temp2 + 1; + } + if (gSeqPlayers[seqPlayId].enabled) { + prevTempo = gSeqPlayers[seqPlayId].tempo / 48; + tempoOp = ((cmd & 0xF000) >> 0xC); + + switch (tempoOp) { + case SEQCMD_SUB_OP_TEMPO_SPEED_UP: + tempoTarget = tempoTarget + prevTempo; + break; + case SEQCMD_SUB_OP_TEMPO_SLOW_DOWN: + if (tempoTarget < prevTempo) { + tempoTarget = prevTempo - tempoTarget; + } + break; + case SEQCMD_SUB_OP_TEMPO_SCALE: + tempoTarget = prevTempo * (tempoTarget / 100.0f); + break; + case SEQCMD_SUB_OP_TEMPO_RESET: + if (gActiveSequences[seqPlayId].tempoOriginal != 0) { + tempoTarget = gActiveSequences[seqPlayId].tempoOriginal; + } else { + tempoTarget = prevTempo; + } + break; + } + if (tempoTarget > 300) { + tempoTarget = 300; + } + if (!gActiveSequences[seqPlayId].tempoOriginal) { + gActiveSequences[seqPlayId].tempoOriginal = prevTempo; + } + gActiveSequences[seqPlayId].tempo.target = tempoTarget; + gActiveSequences[seqPlayId].tempo.value = (s32) gSeqPlayers[seqPlayId].tempo / 48; + + gActiveSequences[seqPlayId].tempo.step = + (gActiveSequences[seqPlayId].tempo.value - gActiveSequences[seqPlayId].tempo.target) / tempoTimer; + gActiveSequences[seqPlayId].tempo.timer = tempoTimer; + gActiveSequences[seqPlayId].tempoCmd = 0; + } + } + if (gActiveSequences[seqPlayId].tempo.timer != 0) { + gActiveSequences[seqPlayId].tempo.timer--; + if (gActiveSequences[seqPlayId].tempo.timer != 0) { + gActiveSequences[seqPlayId].tempo.value -= gActiveSequences[seqPlayId].tempo.step; + } else { + gActiveSequences[seqPlayId].tempo.value = gActiveSequences[seqPlayId].tempo.target; + } + AUDIOCMD_SEQPLAYER_SET_TEMPO((u32) seqPlayId, (s32) gActiveSequences[seqPlayId].tempo.value); + } + if (gActiveSequences[seqPlayId].volChannelFlags != 0) { + for (channelId = 0; channelId < 16; channelId++) { + if (gActiveSequences[seqPlayId].channelMod[channelId].volume.timer != 0) { + gActiveSequences[seqPlayId].channelMod[channelId].volume.timer--; + if (gActiveSequences[seqPlayId].channelMod[channelId].volume.timer) { + gActiveSequences[seqPlayId].channelMod[channelId].volume.value -= + gActiveSequences[seqPlayId].channelMod[channelId].volume.step; + } else { + gActiveSequences[seqPlayId].channelMod[channelId].volume.value = + gActiveSequences[seqPlayId].channelMod[channelId].volume.target; + gActiveSequences[seqPlayId].volChannelFlags ^= 1 << channelId; + } + AUDIOCMD_CHANNEL_SET_VOL_SCALE((u32) seqPlayId, (u32) channelId, + gActiveSequences[seqPlayId].channelMod[channelId].volume.value); + } + } + } + if (gActiveSequences[seqPlayId].freqModChannelFlags != 0) { + for (channelId = 0; channelId < 16; channelId++) { + if (gActiveSequences[seqPlayId].channelMod[channelId].freq.timer != 0) { + gActiveSequences[seqPlayId].channelMod[channelId].freq.timer--; + if (gActiveSequences[seqPlayId].channelMod[channelId].freq.timer != 0) { + gActiveSequences[seqPlayId].channelMod[channelId].freq.value -= + gActiveSequences[seqPlayId].channelMod[channelId].freq.step; + } else { + gActiveSequences[seqPlayId].channelMod[channelId].freq.value = + gActiveSequences[seqPlayId].channelMod[channelId].freq.target; + gActiveSequences[seqPlayId].freqModChannelFlags ^= 1 << channelId; + } + AUDIOCMD_CHANNEL_SET_FREQ_SCALE((u32) seqPlayId, (u32) channelId, + gActiveSequences[seqPlayId].channelMod[channelId].freq.value); + } + } + } + if (gActiveSequences[seqPlayId].setupCmdNum == 0) { + continue; + } + if (!Audio_SeqCmdValueNotQueued(SEQCMD_OP_MASK, SEQCMD_OP_RESET_AUDIO_HEAP << 28)) { + gActiveSequences[seqPlayId].setupCmdNum = 0; + break; + } + if (gActiveSequences[seqPlayId].setupCmdTimer != 0) { + gActiveSequences[seqPlayId].setupCmdTimer--; + } else if (!gSeqPlayers[seqPlayId].enabled) { + for (i = 0; i < gActiveSequences[seqPlayId].setupCmdNum; i++) { + setupOp = (gActiveSequences[seqPlayId].setupCmd[i] & 0xF00000) >> 0x14; + + setupSeqPlayId = (gActiveSequences[seqPlayId].setupCmd[i] & 0xF0000) >> 0x10; + val2 = (gActiveSequences[seqPlayId].setupCmd[i] & 0xFF00) >> 8; + val1 = gActiveSequences[seqPlayId].setupCmd[i] & 0xFF; + switch (setupOp) { + case SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME: + Audio_SetSequenceFade(setupSeqPlayId, 1, 127, val2); + break; + case SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE: + SEQCMD_UNQUEUE_SEQUENCE(seqPlayId, 0, gActiveSequences[seqPlayId].seqId); + break; + case SEQCMD_SUB_OP_SETUP_RESTART_SEQ: + SEQCMD_PLAY_SEQUENCE(setupSeqPlayId, 1, 0, gActiveSequences[setupSeqPlayId].seqId); + gActiveSequences[setupSeqPlayId].mainVolume.fadeActive = true; + gActiveSequences[setupSeqPlayId].mainVolume.fadeMod[1] = 127; + break; + case SEQCMD_SUB_OP_SETUP_TEMPO_SCALE: + SEQCMD_SCALE_TEMPO(setupSeqPlayId, val2, val1); + break; + case SEQCMD_SUB_OP_SETUP_TEMPO_RESET: + SEQCMD_RESET_TEMPO(setupSeqPlayId, val1); + break; + case SEQCMD_SUB_OP_SETUP_PLAY_SEQ: + seqId = gActiveSequences[seqPlayId].setupCmd[i] & 0xFFFF; + SEQCMD_PLAY_SEQUENCE(setupSeqPlayId, gActiveSequences[setupSeqPlayId].setupFadeTimer, 0, seqId); + Audio_SetSequenceFade(setupSeqPlayId, 1, 127, 0); + gActiveSequences[setupSeqPlayId].setupFadeTimer = 0; + break; + case SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER: + gActiveSequences[seqPlayId].setupFadeTimer = val2; + break; + } + } + gActiveSequences[seqPlayId].setupCmdNum = 0; + } + } +} + +void Audio_SetDelayedSeqCmd(u32 seqCmd, u16 delay) { + u8 opcode = (seqCmd >> 0x1C); + + gDelayedSeqCmds[opcode].seqData = seqCmd; + gDelayedSeqCmds[opcode].timer = delay; + gDelayedSeqCmdFlags |= 1 << opcode; +} + +void Audio_UpdateDelayedSeqCmds(void) { + u8 opcode = 0; + u16 flag = 1; + u16 delayedCmdFlags = gDelayedSeqCmdFlags; + + while (delayedCmdFlags) { + if (delayedCmdFlags & flag) { + if (gDelayedSeqCmds[opcode].timer != 0) { + gDelayedSeqCmds[opcode].timer--; + } else { + Audio_QueueSeqCmd(gDelayedSeqCmds[opcode].seqData); + gDelayedSeqCmdFlags ^= flag; + } + delayedCmdFlags ^= flag; + } + opcode++; + flag <<= 1; + } +} + +u8 func_80018FA4(void) { + if (D_800C5D58 != 0) { + if (D_800C5D58 == 1) { + if (func_8001ED34() == 1) { + D_800C5D58 = 0; + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_SFX, 0, 0, gSfxChannelLayout); + func_8001DD40(); + } + } else if (D_800C5D58 == 2) { + while (func_8001ED34() != 1) { + ; + } + D_800C5D58 = 0; + AUDIOCMD_SEQPLAYER_SET_IO(SEQ_PLAYER_SFX, 0, 0, gSfxChannelLayout); + func_8001DD40(); + } + } + return D_800C5D58; +} + +void Audio_ResetActiveSequences(void) { + u8 i; + + for (i = 0; i < 4; i++) { + gNumSeqRequests[i] = 0; + gActiveSequences[i].seqId = 0xFFFF; + gActiveSequences[i].prevSeqId = 0xFFFF; + gActiveSequences[i].tempo.timer = 0; + gActiveSequences[i].tempoOriginal = 0; + gActiveSequences[i].tempoCmd = 0; + gActiveSequences[i].channelPortMask = 0; + gActiveSequences[i].setupCmdNum = 0; + gActiveSequences[i].setupFadeTimer = 0; + gActiveSequences[i].freqModChannelFlags = 0; + gActiveSequences[i].volChannelFlags = 0; + gActiveSequences[i].mainVolume.fadeMod[2] = 127; + } +} + +void Audio_ResetActiveSequencesAndVolume(void) { + u8 i; + + for (i = 0; i < 4; i++) { + gActiveSequences[i].mainVolume.mod = 1.0f; + gActiveSequences[i].mainVolume.timer = 0; + gActiveSequences[i].mainVolume.fadeActive = false; + gActiveSequences[i].mainVolume.fadeMod[0] = 127; + gActiveSequences[i].mainVolume.fadeMod[1] = 127; + gActiveSequences[i].mainVolume.fadeMod[2] = 127; + } + Audio_ResetActiveSequences(); +} + +void Audio_SetSfxBanksMute(u16 muteFlags) { + u8 i; + + for (i = 0; i < 5; i++) { + gSfxBankMuted[i] = (muteFlags & 1) ? true : false; + muteFlags = muteFlags >> 1; + } +} + +void Audio_ClearBGMMute(u8 channelIndex) { + D_800C5D24 &= (1 << channelIndex) ^ 0xFFFF; + if (D_800C5D24 == 0) { + Audio_SetSequenceFade(SEQ_PLAYER_BGM, 2, 127, 15); + } +} + +void Audio_PlaySfx(u32 sfxId, f32* sfxSource, u8 token, f32* freqMod, f32* volMod, s8* reverbAdd) { + if (gSfxBankMuted[SFX_BANK_SHIFT(sfxId)] == 0) { + SfxRequest* request = &gSfxRequests[gSfxRequestWriteIndex]; + + request->sfxId = sfxId; + request->pos = sfxSource; + request->token = token; + request->freqMod = freqMod; + request->volMod = volMod; + request->reverbAdd = reverbAdd; + gSfxRequestWriteIndex++; + } +} + +void Audio_RemoveMatchingSfxRequests(u8 aspect, SfxBankEntry* data) { + u8 i = gSfxRequestReadIndex; + + for (i; i != gSfxRequestWriteIndex; i++) { + s32 found = false; + SfxRequest* request = &gSfxRequests[i]; + + switch (aspect) { + case 0: + if (SFX_BANK_MASK(request->sfxId) == SFX_BANK_MASK(data->sfxId)) { + found = true; + } + break; + case 1: + if ((SFX_BANK_MASK(request->sfxId) == SFX_BANK_MASK(data->sfxId)) && (&request->pos[0] == data->xPos)) { + found = true; + } + break; + case 2: + if (&request->pos[0] == data->xPos) { + found = true; + } + break; + case 3: + if ((&request->pos[0] == data->xPos) && (request->sfxId == data->sfxId)) { + found = true; + } + break; + case 4: + if ((request->token == data->token) && (request->sfxId == data->sfxId)) { + found = true; + } + break; + case 5: + if (request->sfxId == data->sfxId) { + found = true; + } + break; + } + if (found) { + request->sfxId = 0; + } + } +} + +void Audio_ProcessSfxRequest(void) { + SfxRequest* request = &gSfxRequests[gSfxRequestReadIndex]; + u8 next; + s32 bankId; + u8 evict; + u32 sfxId; + u8 count; + SfxBankEntry* entry; + + if (request->sfxId == 0) { + return; + } + bankId = SFX_BANK(request->sfxId); + next = gSfxBanks[bankId][0].next; + count = 0; + while ((next != 0xFF) && (next != 0)) { + if (request->pos == gSfxBanks[bankId][next].xPos) { + if (request->sfxId == gSfxBanks[bankId][next].sfxId) { + count = gUsedChannelsPerBank[gSfxChannelLayout][bankId]; + } else { + if (count == 0) { + evict = next; + sfxId = gSfxBanks[bankId][next].sfxId; + } else if (SFX_IMPORTANCE_MASK(gSfxBanks[bankId][next].sfxId) < SFX_IMPORTANCE_MASK(sfxId)) { + evict = next; + sfxId = gSfxBanks[bankId][next].sfxId; + } + count++; + if (count == gUsedChannelsPerBank[gSfxChannelLayout][bankId]) { + if (SFX_IMPORTANCE_MASK(request->sfxId) >= SFX_IMPORTANCE_MASK(sfxId)) { + next = evict; + } else { + next = 0; + } + } + } + if (count == gUsedChannelsPerBank[gSfxChannelLayout][bankId]) { + if (SFX_BIT04(request->sfxId) || SFX_BIT13(request->sfxId) || (next == evict)) { + if (SFX_BIT12(gSfxBanks[bankId][next].sfxId) && (gSfxBanks[bankId][next].state != 1)) { + Audio_ClearBGMMute(gSfxBanks[bankId][next].channelIndex); + } + gSfxBanks[bankId][next].token = request->token; + gSfxBanks[bankId][next].sfxId = request->sfxId; + gSfxBanks[bankId][next].state = SFX_STATE(request->sfxId); + gSfxBanks[bankId][next].freshness = 2; + gSfxBanks[bankId][next].freqMod = request->freqMod; + gSfxBanks[bankId][next].volMod = request->volMod; + gSfxBanks[bankId][next].reverbAdd = request->reverbAdd; + } + next = 0; + } + } + if (next != 0) { + next = gSfxBanks[bankId][next].next; + } + } + if ((gSfxBanks[bankId][gSfxBankFreeListStart[bankId]].next != 0xFF) && (next != 0)) { + next = gSfxBankFreeListStart[bankId]; + entry = &gSfxBanks[bankId][next]; + entry->xPos = &request->pos[0]; + entry->yPos = &request->pos[1]; + entry->zPos = &request->pos[2]; + entry->token = request->token; + entry->freqMod = request->freqMod; + entry->volMod = request->volMod; + entry->reverbAdd = request->reverbAdd; + entry->sfxId = request->sfxId; + entry->state = SFX_STATE(request->sfxId); + entry->freshness = 2; + + entry->prev = gSfxBankListEnd[bankId]; + + gSfxBanks[bankId][gSfxBankListEnd[bankId]].next = gSfxBankFreeListStart[bankId]; + gSfxBankListEnd[bankId] = gSfxBankFreeListStart[bankId]; + gSfxBankFreeListStart[bankId] = gSfxBanks[bankId][gSfxBankFreeListStart[bankId]].next; + gSfxBanks[bankId][gSfxBankFreeListStart[bankId]].prev = 0xFF; + + entry->next = 0xFF; + } +} + +void Audio_RemoveSfxBankEntry(u8 bankId, u8 entryIndex) { + SfxBankEntry* sfxBank = gSfxBanks[bankId]; + s32 pad; + + if (SFX_BIT12(sfxBank[entryIndex].sfxId)) { + Audio_ClearBGMMute(sfxBank[entryIndex].channelIndex); + } + if (entryIndex == gSfxBankListEnd[bankId]) { + gSfxBankListEnd[bankId] = sfxBank[entryIndex].prev; + } else { + sfxBank[sfxBank[entryIndex].next].prev = sfxBank[entryIndex].prev; + } + sfxBank[sfxBank[entryIndex].prev].next = sfxBank[entryIndex].next; + sfxBank[entryIndex].next = gSfxBankFreeListStart[bankId]; + sfxBank[entryIndex].prev = 0xFF; + + sfxBank[gSfxBankFreeListStart[bankId]].prev = entryIndex; + gSfxBankFreeListStart[bankId] = entryIndex; + sfxBank[entryIndex].state = 0; +} + +void Audio_ChooseActiveSfx(u8 bankId) { + u8 numChosenSfx = 0; + u8 numChannels; + u8 k; + u8 i; + SfxBankEntry* entry; + ActiveSfx* activeSfx; + f32 maxRangeSq; + f32 yScaled; + ActiveSfx chosenSfx[8]; + u8 chosenEntryIndex; + u8 j; + u8 entryIndex; + u8 needNewSfx; + s32 importance; + + for (i = 0; i < 8; i++) { + chosenSfx[i].priority = INT32_MAX; + chosenSfx[i].entryIndex = 0xFF; + } + entryIndex = gSfxBanks[bankId]->next; + k = 0; + while (entryIndex != 0xFF) { + if ((gSfxBanks[bankId][entryIndex].state == 1) && + (SFX_BIT04(gSfxBanks[bankId][entryIndex].sfxId) == SFX_BIT04(-1))) { + gSfxBanks[bankId][entryIndex].freshness--; + } + if (gSfxBanks[bankId][entryIndex].freshness == 0) { + Audio_RemoveSfxBankEntry(bankId, entryIndex); + } else if (gSfxBanks[bankId][entryIndex].state != 0) { + entry = &gSfxBanks[bankId][entryIndex]; + + if (&entry->xPos[0] == gDefaultSfxSource) { + entry->distance = 0.0f; + } else { + yScaled = *entry->yPos / 2.5f; + entry->distance = SQ(*entry->xPos) + SQ(yScaled) + SQ(*entry->zPos); + } + importance = SFX_IMPORTANCE(entry->sfxId); + if (SFX_BIT11(entry->sfxId)) { + entry->priority = SQ(0xFF - importance) * SQ(76); + } else { + entry->priority = (u32) entry->distance + SQ(0xFF - importance) * SQ(76); + if (*entry->zPos > 0.0f) { + entry->priority += (s32) (*entry->zPos * 6.0f); + } + } + if (SFX_RANGE(entry->sfxId) != 0) { + maxRangeSq = SQ(33000.0f) / SQ((s32) SFX_RANGE(entry->sfxId)); + } else { + maxRangeSq = SQ(100000.0f); + } + if (entry->distance > maxRangeSq) { + if (entry->state == 4) { + AUDIOCMD_CHANNEL_SET_IO(2, entry->channelIndex, 0, 0); + if (SFX_BIT04(entry->sfxId)) { + Audio_RemoveSfxBankEntry(bankId, entryIndex); + entryIndex = k; + } + } + } else { + numChannels = gChannelsPerBank[gSfxChannelLayout][bankId]; + for (i = 0; i < numChannels; i++) { + if (chosenSfx[i].priority >= entry->priority) { + if (numChosenSfx < gChannelsPerBank[gSfxChannelLayout][bankId]) { + numChosenSfx++; + } + for (j = numChannels - 1; j > i; j--) { + chosenSfx[j].priority = chosenSfx[j - 1].priority; + chosenSfx[j].entryIndex = chosenSfx[j - 1].entryIndex; + } + chosenSfx[i].priority = entry->priority; + chosenSfx[i].entryIndex = entryIndex; + i = numChannels; + } + } + } + k = entryIndex; + } + entryIndex = gSfxBanks[bankId][k].next; + } + + for (i = 0; i < numChosenSfx; i++) { + if (gSfxBanks[bankId][chosenSfx[i].entryIndex].state == 1) { + gSfxBanks[bankId][chosenSfx[i].entryIndex].state = 2; + } else if (gSfxBanks[bankId][chosenSfx[i].entryIndex].state == 4) { + gSfxBanks[bankId][chosenSfx[i].entryIndex].state = 3; + } + } + numChannels = gChannelsPerBank[gSfxChannelLayout][bankId]; + for (i = 0; i < numChannels; i++) { + activeSfx = &gActiveSfx[bankId][i]; + needNewSfx = 0; + if (activeSfx->entryIndex == 0xFF) { + needNewSfx = 1; + } else if (gSfxBanks[bankId][activeSfx->entryIndex].state == 4) { + if (SFX_BIT04(gSfxBanks[bankId][activeSfx->entryIndex].sfxId)) { + Audio_RemoveSfxBankEntry(bankId, activeSfx->entryIndex); + } else { + gSfxBanks[bankId][activeSfx->entryIndex].state = 1; + } + needNewSfx = 1; + } else if (gSfxBanks[bankId][activeSfx->entryIndex].state == 0) { + activeSfx->entryIndex = 0xFF; + needNewSfx = 1; + } else { + for (j = 0; j < numChannels; j++) { + if (activeSfx->entryIndex == chosenSfx[j].entryIndex) { + chosenSfx[j].entryIndex = 0xFF; + j = numChannels; + } + } + numChosenSfx--; + } + + if (needNewSfx == 1) { + for (j = 0; j < numChannels; j++) { + chosenEntryIndex = chosenSfx[j].entryIndex; + if ((chosenEntryIndex != 0xFF) && (gSfxBanks[bankId][chosenEntryIndex].state != 3)) { + for (k = 0; k < numChannels; k++) { + if (chosenEntryIndex == gActiveSfx[bankId][k].entryIndex) { + needNewSfx = 0; + k = numChannels; + } + } + if (needNewSfx == 1) { + activeSfx->entryIndex = chosenEntryIndex; + chosenSfx[j].entryIndex = 0xFF; + j = numChannels + 1; + numChosenSfx--; + } + } + } + if (j == numChannels) { + activeSfx->entryIndex = 0xFF; + } + } + } +} + +void Audio_PlayActiveSfx(u8 bankId) { + u8 i; + + for (i = 0; i < gChannelsPerBank[gSfxChannelLayout][bankId]; i++) { + u8 entryIndex = gActiveSfx[bankId][i].entryIndex; + + if (entryIndex != 0xFF) { + SfxBankEntry* entry = &gSfxBanks[bankId][entryIndex]; + SequenceChannel* channel = gSeqPlayers[SEQ_PLAYER_SFX].channels[gCurSfxPlayerChannelIndex]; + s32 pad; + + if (entry->state == 2) { + entry->channelIndex = gCurSfxPlayerChannelIndex; + if (SFX_BIT12(entry->sfxId)) { + D_800C5D24 |= 1 << gCurSfxPlayerChannelIndex; + Audio_SetSequenceFade(SEQ_PLAYER_BGM, 2, 64, 15); + } + Audio_SetSfxProperties(bankId, entryIndex, gCurSfxPlayerChannelIndex); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, gCurSfxPlayerChannelIndex, 0, 1); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, gCurSfxPlayerChannelIndex, 4, SFX_INDEX(entry->sfxId) & 0xFF); + entry->state = 4; + } else if ((u8) channel->seqScriptIO[7] == 0x80) { + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, gCurSfxPlayerChannelIndex, 7, 0); + Audio_RemoveSfxBankEntry(bankId, entryIndex); + } else if (entry->state == 3) { + Audio_SetSfxProperties(bankId, entryIndex, gCurSfxPlayerChannelIndex); + entry->state = 4; + } + } + gCurSfxPlayerChannelIndex++; + } +} + +void Audio_KillSfxByBank(u8 bankId) { + SfxBankEntry* entry; + u8 next = gSfxBanks[bankId][0].next; + + SfxBankEntry cmp; + + while (next != 0xFF) { + entry = &gSfxBanks[bankId][next]; + if (entry->state >= 3) { + AUDIOCMD_CHANNEL_SET_IO(2, entry->channelIndex, 0, 0); + } + if (entry->state != 0) { + Audio_RemoveSfxBankEntry(bankId, next); + } + next = gSfxBanks[bankId][0].next; + } + cmp.sfxId = bankId << 28; + Audio_RemoveMatchingSfxRequests(0, &cmp); +} + +void Audio_StopSfxByBankAndSource(u8 bankId, f32* sfxSource) { + SfxBankEntry* entry; + u8 curIndex = 0; + u8 nextIndex = gSfxBanks[bankId][0].next; + + while (nextIndex != 0xFF) { + entry = &gSfxBanks[bankId][nextIndex]; + if (entry->xPos == sfxSource) { + if (entry->state >= 3) { + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, entry->channelIndex, 0, 0); + } + if (entry->state != 0) { + Audio_RemoveSfxBankEntry(bankId, nextIndex); + } + } else { + curIndex = nextIndex; + } + nextIndex = gSfxBanks[bankId][curIndex].next; + } +} + +void Audio_KillSfxByBankAndSource(u8 bankId, f32* sfxSource) { + SfxBankEntry sp18; + + Audio_StopSfxByBankAndSource(bankId, sfxSource); + sp18.sfxId = bankId << 0x1C; + sp18.xPos = sfxSource; + Audio_RemoveMatchingSfxRequests(1, &sp18); +} + +void Audio_KillSfxBySource(f32* sfxSource) { + u8 i; + SfxBankEntry sp24; + + for (i = 0; i < 5; i++) { + Audio_StopSfxByBankAndSource(i, sfxSource); + } + sp24.xPos = sfxSource; + Audio_RemoveMatchingSfxRequests(2, &sp24); +} + +void Audio_KillSfxBySourceAndId(f32* sfxSource, u32 sfxId) { + u32 bankId = SFX_BANK(sfxId); + u8 next = gSfxBanks[bankId][0].next; + u8 current = 0; + SfxBankEntry cmp; + + while (next != 0xFF) { + if ((gSfxBanks[bankId][next].xPos == sfxSource) && (gSfxBanks[bankId][next].sfxId == sfxId)) { + if (gSfxBanks[bankId][next].state >= 3) { + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, gSfxBanks[bankId][next].channelIndex, 0, 0); + } + if (gSfxBanks[bankId][next].state != 0) { + Audio_RemoveSfxBankEntry(bankId, next); + } + next = 0xFF; + } else { + current = next; + } + if (next != 0xFF) { + next = gSfxBanks[bankId][current].next; + } + } + cmp.sfxId = sfxId; + cmp.xPos = sfxSource; + Audio_RemoveMatchingSfxRequests(3, &cmp); +} + +void Audio_KillSfxByTokenAndId(u8 token, u32 sfxId) { + u32 bankId = SFX_BANK(sfxId); + u8 next = gSfxBanks[bankId][0].next; + u8 current = 0; + SfxBankEntry cmp; + + while (next != 0xFF) { + if ((gSfxBanks[bankId][next].token == token) && (gSfxBanks[bankId][next].sfxId == sfxId)) { + if (gSfxBanks[bankId][next].state >= 3) { + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, gSfxBanks[bankId][next].channelIndex, 0, 0); + } + if (gSfxBanks[bankId][next].state != 0) { + Audio_RemoveSfxBankEntry(bankId, next); + } + } else { + current = next; + } + if (next != 0xFF) { + next = gSfxBanks[bankId][current].next; + } + } + cmp.token = token; + cmp.sfxId = sfxId; + Audio_RemoveMatchingSfxRequests(4, &cmp); +} + +void Audio_KillSfxById(u32 sfxId) { + u32 bankId = SFX_BANK(sfxId); + u8 next = gSfxBanks[bankId][0].next; + u8 current = 0; + SfxBankEntry cmp; + + while (next != 0xFF) { + if (sfxId == gSfxBanks[bankId][next].sfxId) { + if (gSfxBanks[bankId][next].state >= 3) { + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, gSfxBanks[bankId][next].channelIndex, 0, 0); + } + if (gSfxBanks[bankId][next].state != 0) { + Audio_RemoveSfxBankEntry(bankId, next); + } + } else { + current = next; + } + next = gSfxBanks[bankId][current].next; + } + cmp.sfxId = sfxId; + Audio_RemoveMatchingSfxRequests(5, &cmp); +} + +void Audio_ProcessSfxRequests(void) { + while (gSfxRequestWriteIndex != gSfxRequestReadIndex) { + Audio_ProcessSfxRequest(); + gSfxRequestReadIndex++; + } +} + +void Audio_SetSfxVolumeMod(u8 bankId, u8 target, u16 timer) { + Modulation* scale = &gSfxVolumeMods[bankId]; + + if (timer == 0) { + timer++; + } + + scale->target = target / 127.0f; + scale->timer = timer; + scale->step = (scale->value - scale->target) / timer; +} + +void Audio_UpdateSfxVolumeMod(u8 bankId) { + Modulation* scale = &gSfxVolumeMods[bankId]; + + if (scale->timer != 0) { + scale->timer--; + if (scale->timer != 0) { + scale->value -= scale->step; + } else { + scale->value = scale->target; + } + } +} + +void Audio_PlayAllSfx(void) { + u8 bankId; + + if (gSeqPlayers[SEQ_PLAYER_SFX].channels[0] != &gSeqChannelNone) { + gCurSfxPlayerChannelIndex = 0; + for (bankId = 0; bankId < 5; bankId++) { + Audio_ChooseActiveSfx(bankId); + Audio_PlayActiveSfx(bankId); + Audio_UpdateSfxVolumeMod(bankId); + } + } +} + +void Audio_ResetSfx(void) { + u8 i; + u8 j; + + gSfxRequestWriteIndex = 0; + gSfxRequestReadIndex = 0; + D_800C5D24 = 0; + for (i = 0; i < 5; i++) { + gSfxBankListEnd[i] = 0; + gSfxBankFreeListStart[i] = 1; + gSfxBankUnused[i] = 0; + gSfxBankMuted[i] = 0; + gSfxVolumeMods[i].value = 1.0f; + gSfxVolumeMods[i].timer = 0; + } + for (i = 0; i < 5; i++) { + for (j = 0; j < 8; j++) { + gActiveSfx[i][j].entryIndex = 0xFF; + } + } + for (i = 0; i < 5; i++) { + gSfxBanks[i][0].prev = 0xFF; + gSfxBanks[i][0].next = 0xFF; + for (j = 1; j < 19; j++) { + gSfxBanks[i][j].prev = j - 1; + gSfxBanks[i][j].next = j + 1; + } + gSfxBanks[i][j].prev = j - 1; + gSfxBanks[i][j].next = 0xFF; + } +} + +void Audio_PlayVoice(s32 msgId) { + sCurrentVoiceId = sNextVoiceId = msgId; + sSetNextVoiceId = true; +} + +void Audio_PlayVoiceWithoutBGM(u32 msgId) { + sMuteBgmForVoice = true; + Audio_SetSequenceFade(SEQ_PLAYER_BGM, 2, 64, 15); + Audio_PlayVoice(msgId); +} + +void Audio_UpdateVoice(void) { + s8 voiceBank; + u16 voiceId; + u8 voiceIdHi; + u8 voiceIdLo; + + if (sSetNextVoiceId) { + voiceBank = sNextVoiceId / 1000; + voiceId = sNextVoiceId % 1000; + voiceIdHi = voiceId / 256; + voiceIdLo = voiceId % 256; + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_VOICE, 15, 0, 1); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_VOICE, 15, 4, voiceBank); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_VOICE, 15, 5, voiceIdHi); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_VOICE, 15, 6, voiceIdLo); + sSetNextVoiceId = false; + } else if ((sMuteBgmForVoice) && (Audio_GetCurrentVoice() == 0)) { + Audio_SetSequenceFade(SEQ_PLAYER_BGM, 2, 127, 15); + sMuteBgmForVoice = false; + } +} + +void Audio_ClearVoice(void) { + sCurrentVoiceId = 0; + sNextVoiceId = 1; + sSetNextVoiceId = true; +} + +s32 Audio_GetCurrentVoice(void) { + if (gSeqPlayers[SEQ_PLAYER_VOICE].channels[15] == &gSeqChannelNone) { + return 0; + } + if (gSeqPlayers[SEQ_PLAYER_VOICE].channels[15]->seqScriptIO[1] == 1) { + if (sCurrentVoiceId < 4) { + return 0; + } else { + return sCurrentVoiceId; + } + } + return 0; +} + +s32 Audio_GetCurrentVoiceStatus(void) { + SequenceChannel* channel = gSeqPlayers[SEQ_PLAYER_VOICE].channels[15]; + SequenceLayer* layer = channel->layers[0]; + + if ((channel == &gSeqChannelNone) || (layer == NULL) || (channel->seqScriptIO[1] != 1)) { + return 0; + } + if (layer->note != NULL) { + if (layer != layer->note->playbackState.parentLayer) { + return 2; + } else { + return 1; + } + } + return 0; +} + +void func_8001AF40(u8 unkVoiceParam) { + D_800C7390 = unkVoiceParam; +} + +void func_8001AF50(void) { + if (D_800C7390 != 0xFF) { + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_VOICE, 14, 0, D_800C7390); + D_800C7390 = 0xFF; + } +} + +void Audio_ResetPlayerFreqMods(void) { + u8 i; + u8 j; + + for (i = 0; i < 4; i++) { + for (j = 0; j < 5; j++) { + gPlayerNoise[i].freqMod[j].value = 1.0f; + gPlayerNoise[i].freqMod[j].timer = 0; + gPlayerNoise[i].freqMod[j].boost = 0; + gPlayerNoise[i].freqMod[j].brake = 0; + } + } +} + +void Audio_UpdateArwingNoise(u8 playerId) { + f32 freqMod; + u8 i; + + if (gPlayer[playerId].sfx.boost) { + gPlayerNoise[playerId].freqMod[0].target = 1.5f; + gPlayerNoise[playerId].freqMod[0].timer = 18; + gPlayerNoise[playerId].freqMod[0].step = + (gPlayerNoise[playerId].freqMod[0].target - gPlayerNoise[playerId].freqMod[0].value) / 18; + gPlayerNoise[playerId].freqMod[0].boost = true; + } else if (gPlayerNoise[playerId].freqMod[0].boost) { + gPlayerNoise[playerId].freqMod[0].boost = false; + gPlayerNoise[playerId].freqMod[0].timer = 1; + } + if (gPlayer[playerId].sfx.brake) { + gPlayerNoise[playerId].freqMod[0].target = 0.65f; + gPlayerNoise[playerId].freqMod[0].timer = 20; + gPlayerNoise[playerId].freqMod[0].step = + (gPlayerNoise[playerId].freqMod[0].target - gPlayerNoise[playerId].freqMod[0].value) / 20; + gPlayerNoise[playerId].freqMod[0].brake = true; + } else if (gPlayerNoise[playerId].freqMod[0].brake) { + gPlayerNoise[playerId].freqMod[0].brake = false; + gPlayerNoise[playerId].freqMod[0].timer = 1; + } + if ((gPlayer[playerId].sfx.bank != 0) && (gPlayer[playerId].sfx.zRot < 45.0f)) { + gPlayerNoise[playerId].freqMod[2].target = 1.25f; + gPlayerNoise[playerId].freqMod[2].timer = 10; + gPlayerNoise[playerId].freqMod[2].step = + (gPlayerNoise[playerId].freqMod[2].target - gPlayerNoise[playerId].freqMod[2].value) / 10; + } + if (gPlayer[playerId].sfx.roll != 0) { + Audio_PlaySfx(0x09000012, gPlayer[playerId].sfx.srcPos, playerId, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + gPlayerNoise[playerId].freqMod[1].target = 1.65f; + gPlayerNoise[playerId].freqMod[1].timer = 8; + gPlayerNoise[playerId].freqMod[1].step = + (gPlayerNoise[playerId].freqMod[1].target - gPlayerNoise[playerId].freqMod[1].value) / 8; + } + if (ABS(gPlayer[playerId].sfx.yVel) > 2.0f) { + gPlayerNoise[playerId].freqMod[3].target = 1.25f; + gPlayerNoise[playerId].freqMod[3].timer = 15; + gPlayerNoise[playerId].freqMod[3].step = + (gPlayerNoise[playerId].freqMod[3].target - gPlayerNoise[playerId].freqMod[3].value) / 15; + gPlayerNoise[playerId].freqMod[3].boost = true; + } else if (gPlayerNoise[playerId].freqMod[3].boost) { + gPlayerNoise[playerId].freqMod[3].boost = false; + gPlayerNoise[playerId].freqMod[3].timer = 1; + } + if (gPlayerNoise[playerId].freqMod[4].timer == 0) { + gPlayerNoise[playerId].freqMod[4].target = (((f32) (gAudioRandom % 0x10000) / 32768.0) * 0.15f) + 1.0f - 0.15f; + gPlayerNoise[playerId].freqMod[4].timer = 16 + (gAudioRandom >> 27); + gPlayerNoise[playerId].freqMod[4].step = + (gPlayerNoise[playerId].freqMod[4].target - gPlayerNoise[playerId].freqMod[3].value) / + gPlayerNoise[playerId].freqMod[4].timer; + } + for (i = 0; i < 5; i++) { + if (gPlayerNoise[playerId].freqMod[i].timer != 0) { + gPlayerNoise[playerId].freqMod[i].timer--; + gPlayerNoise[playerId].freqMod[i].value += gPlayerNoise[playerId].freqMod[i].step; + if ((gPlayerNoise[playerId].freqMod[i].timer == 0) && (gPlayerNoise[playerId].freqMod[i].target != 1.0f)) { + gPlayerNoise[playerId].freqMod[i].target = 1.0f; + gPlayerNoise[playerId].freqMod[i].timer = D_800C5E58[i]; + gPlayerNoise[playerId].freqMod[i].step = + (1.0f - gPlayerNoise[playerId].freqMod[i].value) / D_800C5E58[i]; + } + } + } + freqMod = 1.0f; + for (i = 0; i < 5; i++) { + freqMod *= gPlayerNoise[playerId].freqMod[i].value; + } + if (freqMod >= 4.0f) { + freqMod = 4.0f; + } + gPlayerNoise[playerId].totalMod = freqMod; +} + +void Audio_UpdateLandmasterNoise(u8 playerId) { + f32 freqMod; + u8 i; + + if ((gPlayer[playerId].sfx.bank != 0) && (gPlayer[playerId].sfx.zRot < 45.0f)) { + gPlayerNoise[playerId].freqMod[2].timer = 10; + gPlayerNoise[playerId].freqMod[2].target = 1.25f; + gPlayerNoise[playerId].freqMod[2].step = (1.25f - gPlayerNoise[playerId].freqMod[2].value) / 10; + } + if (gPlayer[playerId].sfx.roll != 0) { + gPlayerNoise[playerId].freqMod[1].timer = 8; + gPlayerNoise[playerId].freqMod[1].target = 1.65f; + gPlayerNoise[playerId].freqMod[1].step = (1.65f - gPlayerNoise[playerId].freqMod[1].value) / 8; + } + if (ABS(gPlayer[playerId].sfx.yVel) > 2.0f) { + gPlayerNoise[playerId].freqMod[3].target = 1.25f; + gPlayerNoise[playerId].freqMod[3].timer = 15; + gPlayerNoise[playerId].freqMod[3].boost = true; + gPlayerNoise[playerId].freqMod[3].step = (1.25f - gPlayerNoise[playerId].freqMod[3].value) / 15; + } else if (gPlayerNoise[playerId].freqMod[3].boost) { + gPlayerNoise[playerId].freqMod[3].boost = false; + gPlayerNoise[playerId].freqMod[3].timer = 1; + } + for (i = 0; i < 5; i++) { + if (gPlayerNoise[playerId].freqMod[i].timer != 0) { + gPlayerNoise[playerId].freqMod[i].timer--; + gPlayerNoise[playerId].freqMod[i].value += gPlayerNoise[playerId].freqMod[i].step; + if ((gPlayerNoise[playerId].freqMod[i].timer == 0) && (gPlayerNoise[playerId].freqMod[i].target != 1.0f)) { + gPlayerNoise[playerId].freqMod[i].target = 1.0f; + gPlayerNoise[playerId].freqMod[i].timer = D_800C5E58[i]; + gPlayerNoise[playerId].freqMod[i].step = + (1.0f - gPlayerNoise[playerId].freqMod[i].value) / D_800C5E58[i]; + } + } + } + freqMod = 1.0f; + for (i = 0; i < 5; i++) { + freqMod *= gPlayerNoise[playerId].freqMod[i].value; + } + if (ABS(gPlayer[playerId].pos.y) < 600.0f) { + freqMod += (gPlayer[playerId].pos.y / 600.0f); + } else { + freqMod += 1.0f; + } + if (gPlayer[playerId].unk_0D0 > 25.0f) { + freqMod += 0.5f; + } else if (gPlayer[playerId].unk_0D0 < 5.0f) { + freqMod -= 0.5f; + } else { + freqMod += (gPlayer[playerId].unk_0D0 - 15.0f) * 0.05f; + } + if (freqMod > 2.0f) { + freqMod = 2.0f; + } + gPlayerNoise[playerId].totalMod = freqMod; +} + +void Audio_UpdateBlueMarineNoise(u8 playerId) { + u8 i; + f32 freqMod; + + if ((gPlayer[playerId].sfx.bank != 0) && (gPlayer[playerId].sfx.zRot < 45.0f)) { + gPlayerNoise[playerId].freqMod[2].timer = 10; + gPlayerNoise[playerId].freqMod[2].target = 1.1f; + gPlayerNoise[playerId].freqMod[2].step = (1.1f - gPlayerNoise[playerId].freqMod[2].value) / 10; + } + if (gPlayer[playerId].sfx.roll != 0) { + Audio_PlaySfx(0x09000017, gPlayer[playerId].sfx.srcPos, playerId, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + gPlayerNoise[playerId].freqMod[1].timer = 8; + gPlayerNoise[playerId].freqMod[1].target = 1.2f; + gPlayerNoise[playerId].freqMod[1].step = (1.2f - gPlayerNoise[playerId].freqMod[1].value) / 8; + } + if (ABS(gPlayer[playerId].sfx.yVel) > 2.0f) { + gPlayerNoise[playerId].freqMod[3].timer = 15; + gPlayerNoise[playerId].freqMod[3].boost = true; + gPlayerNoise[playerId].freqMod[3].target = 1.12f; + gPlayerNoise[playerId].freqMod[3].step = (1.12f - gPlayerNoise[playerId].freqMod[3].value) / 15; + } else if (gPlayerNoise[playerId].freqMod[3].boost) { + gPlayerNoise[playerId].freqMod[3].boost = false; + gPlayerNoise[playerId].freqMod[3].timer = 1; + } + for (i = 0; i < 5; i++) { + if (gPlayerNoise[playerId].freqMod[i].timer != 0) { + gPlayerNoise[playerId].freqMod[i].timer--; + gPlayerNoise[playerId].freqMod[i].value += gPlayerNoise[playerId].freqMod[i].step; + if ((gPlayerNoise[playerId].freqMod[i].timer == 0) && (gPlayerNoise[playerId].freqMod[i].target != 1.0f)) { + gPlayerNoise[playerId].freqMod[i].target = 1.0f; + gPlayerNoise[playerId].freqMod[i].timer = D_800C5E58[i]; + gPlayerNoise[playerId].freqMod[i].step = + (1.0f - gPlayerNoise[playerId].freqMod[i].value) / D_800C5E58[i]; + } + } + } + freqMod = 1.0f; + + for (i = 0; i < 5; i++) { + freqMod *= gPlayerNoise[playerId].freqMod[i].value; + } + if (freqMod > 2.0f) { + freqMod = 2.0f; + } + gPlayerNoise[playerId].totalMod = freqMod; +} + +void Audio_UpdatePlayerFreqMod(void) { + u8 playerId; + + for (playerId = 0; playerId < 4; playerId++) { + switch (gPlayerNoise[playerId].form) { + case FORM_ARWING: + Audio_UpdateArwingNoise(playerId); + gPlayerNoise[playerId].totalMod *= + Audio_UpdateDopplerShift(gPlayer[playerId].sfx.srcPos, gPlayer[playerId].sfx.srcVel, 150.0f, + &gPlayerNoise[playerId].dopplerShift); + break; + case FORM_LANDMASTER: + Audio_UpdateLandmasterNoise(playerId); + break; + case FORM_BLUE_MARINE: + Audio_UpdateBlueMarineNoise(playerId); + break; + case FORM_NONE: + break; + } + } +} + +void Audio_UpdatePlayerReverb(void) { + u8 playerId; + + for (playerId = 0; playerId < 4; playerId++) { + if ((gPlayerNoise[playerId].form == FORM_ARWING) && (gPlayer[playerId].sfx.levelType == LEVELTYPE_PLANET)) { + if (gPlayer[playerId].pos.y < 150.0f) { + gPlayerNoise[playerId].reverbAdd = (150.0f - gPlayer[playerId].pos.y) * 0.53f; + } else { + gPlayerNoise[playerId].reverbAdd = 0; + } + } + } +} + +void Audio_UpdatePlayerNoise(void) { + Audio_UpdatePlayerFreqMod(); + Audio_UpdatePlayerReverb(); +} + +void Audio_ResetVoicesAndPlayers(void) { + u8 playerId; + + Audio_ResetPlayerFreqMods(); + for (playerId = 0; playerId < 4; playerId++) { + gPlayerNoise[playerId].form = FORM_NONE; + gPlayerNoise[playerId].reverbAdd = 0; + gPlayerNoise[playerId].totalMod = 1.0f; + gPlayerNoise[playerId].dopplerShift = 1.0f; + D_8014BA24[playerId] = 0; + D_8014BA28[playerId] = 0; + } + gSfxFreqMod = 1.0f; + gSfxVolMod = 1.0f; + sNextVoiceId = 0; + sCurrentVoiceId = 0; + sSetNextVoiceId = 0; + sMuteBgmForVoice = 0; + gPlaylistIndex = 0xFF; +} + +void Audio_ProcessPlaylist(void) { + PlaylistCmd* cmd; + u32 temp; + u32 temp2; + u32 temp1; + u32 temp5; + + if (gPlaylistIndex != 0xFF) { + if (gPlaylistTimer == 0) { + cmd = &gPlaylists[gPlaylistIndex][gPlaylistCmdIndex]; + switch (cmd->type) { + case 0: + Audio_PlaySequence(cmd->unk_1, cmd->unk_2 & 0xFF, 0, cmd->unk_6); + gPlaylistTimer = gPlaylists[gPlaylistIndex][gPlaylistCmdIndex].unk_8; + gPlaylistCmdIndex++; + break; + case 1: + SEQCMD_STOP_SEQUENCE_ALT(cmd->unk_1, cmd->unk_5); + gPlaylistTimer = gPlaylists[gPlaylistIndex][gPlaylistCmdIndex].unk_8; + gPlaylistCmdIndex++; + break; + case 2: + Audio_PlaySequenceDistorted(cmd->unk_1, cmd->unk_2 & 0xFF, 1121, 25, cmd->unk_6); + gPlaylistTimer = gPlaylists[gPlaylistIndex][gPlaylistCmdIndex].unk_8; + gPlaylistCmdIndex++; + break; + case 3: + Audio_PlayFanfare(cmd->unk_2 & 0xFF, 20, 10, 10); + gPlaylistTimer = gPlaylists[gPlaylistIndex][gPlaylistCmdIndex].unk_8; + gPlaylistCmdIndex++; + break; + case 0xFF: + gPlaylistIndex = 0xFF; + break; + } + } else { + gPlaylistTimer--; + } + } +} + +void func_8001BFC0(f32* buffer0, f32* buffer1, s32 length, f32* buffer2) { + f32 temp_ft0; + f32 var_fs0; + f32* buff0fromStart; + f32* buf2half2; + f32* buf2half3; + f32* buff1half1; + f32* buff0FromEnd; + f32* buff1half2; + s32 half; + s32 i; + s32 size; + + size = 1 << length; + half = size >> 1; + + // Initialize buffer 2 if it is the wrong size for this calculation + if (size != (s32) buffer2[0]) { + buf2half2 = &buffer2[half]; + buf2half3 = &buf2half2[half]; + var_fs0 = 0.0f; + temp_ft0 = D_PI / (2 * size); + for (i = 0; i < half; i++) { + *buf2half2++ = (__cosf(var_fs0) - __sinf(var_fs0)) * 0.707107f; + *buf2half3++ = (__cosf(var_fs0) + __sinf(var_fs0)) * 0.707107f; + var_fs0 += temp_ft0; + } + } + + buff0fromStart = buffer0; + buff0FromEnd = &buffer0[size - 1]; + buff1half1 = buffer1; + buff1half2 = &buffer1[half]; + + // Copy even entries of buffer 0 into the first half of buffer 1. Copy odd entries into the second half in reverse + // order + for (i = 0; i < half; i++) { + *buff1half1++ = *buff0fromStart; + *buff1half2++ = *buff0FromEnd; + buff0fromStart += 2; + buff0FromEnd -= 2; + } + + // reset the buffer pointers + buff0FromEnd = &buffer0[size - 1]; + buff0fromStart = buffer0; + buf2half2 = &buffer2[half]; + buf2half3 = &buf2half2[half]; + buff1half1 = buffer1; + + // FFT buffer 1 using buffer 2 + func_80008780(buffer1, length, buffer2); + + // handle i = 0 case + buff0fromStart[0] = buff1half1[0]; + buff0fromStart[half] = buff1half1[half]; + + // advance buffer pointers + buf2half2++; + buf2half3++; + buff0fromStart++; + buff1half1++; + + // seconnd half of buffer 1 in reverse order this time + buff1half2 = &buffer1[size - 1]; + + // convert to real amplitudes + for (i = 1; i < half; i++) { + *buff0fromStart++ = (*buf2half2 * *buff1half1) + (*buf2half3 * *buff1half2); + *buff0FromEnd-- = (*buf2half3 * *buff1half1) - (*buf2half2 * *buff1half2); + buff1half1++; + buf2half3++; + buf2half2++; + buff1half2--; + } +} + +u8* Audio_UpdateFrequencyAnalysis(void) { + s32 temp2; + s32 i; + s32 j; + s32 k; + s32 l; + s32 m; + s16* temp; + f32* test; + static s32 sFreqBins[] = { + 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 14, 16, 19, 22, + 26, 31, 37, 44, 54, 68, 88, 108, 138, 163, 188, 208, 222, 234, 242, 246, + }; + static f32 sFreqGain = 17.0f; + static f32 sFreqAmplitudes[32] = { + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + }; + + Audio_ProcessPlaylist(); + // clang-format off + temp = gAiBuffers[gCurAiBuffIndex];\ + for(l = 0; l < 256; l++) {\ + D_80149AD8[l] = *temp++; + } + // clang-format on + func_8001BFC0(D_80149AD8, D_80149ED8, 8, D_8014A2D8); + j = 0; + for (i = 0; i < 32; i++) { + temp2 = sFreqBins[i] + 1; + for (m = j; m < temp2; m++) { + if (D_80149AD8[m] > 0.0f) { + D_8014A8D8[i] += D_80149AD8[m]; + } else { + D_8014A8D8[i] -= D_80149AD8[m]; + } + } + j = m; + } + for (k = 0; k < 32; k++) { + D_8014A8D8[k] /= 8; + } + for (l = 0; l < 32; l++) { + D_8014A8D8[l] = (D_8014A8D8[l] / 32768.0f) * sFreqGain; + if (D_8014A8D8[l] > 1.0f) { + D_8014A8D8[l] = 1.0f; + } + sFreqAmplitudes[l] = sFreqAmplitudes[l] * 0.75f + 0.25f * D_8014A8D8[l]; + D_8014A958[l] = sFreqAmplitudes[l] * 255.0f; + } + return D_8014A958; +} + +void func_8001C8B8(u8 playerId) { + u32 sfxId = 0x00000000; + + gPlayerNoise[playerId].form = gPlayer[playerId].sfx.form; + Audio_ResetPlayerFreqMods(); + switch (gPlayerNoise[playerId].form) { + case FORM_ARWING: + if (gPlayer[playerId].sfx.levelType == LEVELTYPE_SPACE) { + sfxId = 0x0100F020; + } else { + sfxId = 0x0100F005; + } + break; + case FORM_LANDMASTER: + sfxId = 0x0100F006; + break; + case FORM_BLUE_MARINE: + sfxId = 0x0100F022; + Audio_PlaySfx(0x1100802C, gPlayer[playerId].sfx.srcPos, playerId, &gDefaultMod, &gDefaultMod, + &gPlayerNoise[playerId].reverbAdd); + break; + } + if (sfxId != 0) { + Audio_PlaySfx(sfxId, gPlayer[playerId].sfx.srcPos, playerId, &gPlayerNoise[playerId].totalMod, &gDefaultMod, + &gPlayerNoise[playerId].reverbAdd); + } +} + +void func_8001CA24(u8 playerId) { + u32 sfxId = 0x00000000; + + switch (gPlayerNoise[playerId].form) { + case FORM_ARWING: + if (gPlayer[playerId].sfx.levelType == LEVELTYPE_SPACE) { + sfxId = 0x0100F020; + } else { + sfxId = 0x0100F005; + } + Audio_KillSfxBySourceAndId(gPlayer[playerId].sfx.srcPos, 0x1100000B); + break; + case FORM_LANDMASTER: + sfxId = 0x0100F006; + break; + case FORM_BLUE_MARINE: + sfxId = 0x0100F022; + Audio_KillSfxBySourceAndId(gPlayer[playerId].sfx.srcPos, 0x1100802C); + break; + } + gPlayerNoise[playerId].form = FORM_NONE; + if (sfxId != 0) { + Audio_KillSfxBySourceAndId(gPlayer[playerId].sfx.srcPos, sfxId); + } +} + +void func_8001CB80(u8 playerId, u8 arg1) { + D_8014BA28[playerId] = gAudioFrameCounter; + switch (arg1) { + case 1: + D_8014BA10[playerId] = 1.0f; + D_8014BA20[playerId] = 1; + break; + case 2: + D_8014BA10[playerId] = 1.5f; + D_8014BA20[playerId] = 2; + break; + default: + case 0: + D_8014BA10[playerId] = 0.75f; + D_8014BA20[playerId] = 0; + break; + } + if (D_8014BA24[playerId] != 1) { + Audio_PlaySfx(0x01008008, gPlayer[playerId].sfx.srcPos, playerId, &D_8014BA10[playerId], &gDefaultMod, + &gPlayerNoise[playerId].reverbAdd); + D_8014BA24[playerId] = 1; + } +} + +void func_8001CCDC(u8 playerId, f32* sfxSource) { + if (D_8014BA24[playerId] != 0) { + switch (D_8014BA20[playerId]) { + case 1: + D_8014BA10[playerId] = 1.2f; + break; + case 2: + D_8014BA10[playerId] = 1.5f; + break; + default: + case 0: + D_8014BA10[playerId] = 1.0f; + break; + } + Audio_KillSfxBySourceAndId(gPlayer[playerId].sfx.srcPos, 0x01008008); + Audio_PlaySfx(0x09001001, sfxSource, playerId, &D_8014BA10[playerId], &gDefaultMod, + &gPlayerNoise[playerId].reverbAdd); + D_8014BA24[playerId] = 2; + } +} + +void func_8001CE28(u8 playerId, f32* sfxSource) { + u32 sfxId; + + if (D_8014BA24[playerId] != 0) { + switch (D_8014BA20[playerId]) { + case 1: + sfxId = 0x0903A00A; + break; + case 2: + sfxId = 0x0901A00B; + break; + default: + case 0: + sfxId = 0x0901A009; + break; + } + Audio_KillSfxByTokenAndId(playerId, 0x09001001); + Audio_PlaySfx(sfxId, sfxSource, playerId, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + D_8014BA24[playerId] = 0; + } +} + +void func_8001CEFC(f32* sfxSource) { + u32 sfxId = (gPlayer[0].sfx.levelType == LEVELTYPE_SPACE) ? 0x31000040 : 0x3100000C; + + Audio_PlaySfx(sfxId, sfxSource, 0, &gDefaultMod, &gDefaultMod, &gDefaultReverb); +} + +void func_8001CF60(f32* sfxSource) { + u32 sfxId = (gPlayer[0].sfx.levelType == LEVELTYPE_SPACE) ? 0x31000040 : 0x3100000C; + + Audio_KillSfxBySourceAndId(sfxSource, sfxId); +} + +void func_8001CFA8(f32 arg0) { + f32 var_fv0 = ABS(arg0); + + if (var_fv0 < 6.0f) { + var_fv0 = 6.0f; + } else if (var_fv0 > 30.0f) { + var_fv0 = 30.0f; + } + + gSfxFreqMod = ((var_fv0 - 18.0f) / 24.0f) + 1.0f; +} + +void func_8001D034(f32* sfxSource, u32 sfxId, u8 semitones) { + f32 semitoneMods[] = { + 1.0f, 1.059f, 1.122f, 1.189f, 1.26f, 1.335f, 1.414f, 1.498f, 1.587f, 1.682f, 1.782f, 1.888f, 2.0f, + }; + + if (semitones > 12) { + semitones = 12; + } + func_8001D0B4(sfxSource, sfxId, semitoneMods[semitones]); +} + +void func_8001D0B4(f32* sfxSource, u32 sfxId, f32 freqMod) { + gSfxFreqMod = freqMod; + Audio_PlaySfx(sfxId, sfxSource, 0, &gSfxFreqMod, &gDefaultMod, &gDefaultReverb); +} + +void func_8001D10C(f32* sfxSource, u32 sfxId) { + Audio_PlaySfx(sfxId, sfxSource, 0, &gSfxFreqMod, &gSfxVolMod, &gDefaultReverb); +} + +void func_8001D15C(u8 arg0) { + if (arg0 < 12) { + gSfxFreqMod = (arg0 / 11.0f) + 0.5f; + } else { + gSfxFreqMod = 1.5f; + } +} + +void func_8001D1C8(u8 arg0, u8 arg1) { + u8 temp1; + u8 temp2; + + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, 9, 2, 8 + (arg0 >> 2)); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, 10, 2, 8 + (arg0 >> 2)); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, 11, 2, 8 + (arg0 >> 2)); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, 9, 1, 19 - (arg1 * 3)); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, 10, 1, 19 - (arg1 * 3)); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, 11, 1, 19 - (arg1 * 3)); + temp1 = 68 - (arg0 >> 3); + temp2 = 80 - (arg1 * 10); + if (temp1 < temp2) { + temp1 = temp2; + } + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, 9, 3, temp1); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, 10, 3, temp1); + AUDIOCMD_CHANNEL_SET_IO(SEQ_PLAYER_SFX, 11, 3, temp1); +} + +void func_8001D2FC(f32* sfxSource, u16 arg1) { + if ((D_800C5E88[arg1] & 0xF0000000) != 0x40000000) { + Audio_PlaySfx(D_800C5E88[arg1], sfxSource, 0, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + } else { + Audio_PlaySfx(D_800C5E88[arg1], gDefaultSfxSource, 0, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + } +} + +void func_8001D3A0(f32* sfxSource, u16 arg1) { + if ((D_800C5E88[arg1] & 0xF0000000) != 0x40000000) { + Audio_KillSfxBySourceAndId(sfxSource, D_800C5E88[arg1]); + } else { + Audio_KillSfxBySourceAndId(gDefaultSfxSource, D_800C5E88[arg1]); + } +} + +void Audio_SetBaseSfxReverb(s8 reverb) { + sBaseReverb = reverb; +} + +void Audio_SetBgmParam(s8 bgmParam) { + SEQCMD_SET_SEQPLAYER_IO(SEQ_PLAYER_BGM, 0, bgmParam); +} + +void Audio_PlaySequence(u8 seqPlayId, u16 seqId, u8 fadeinTime, u8 bgmParam) { + SEQCMD_SET_SEQPLAYER_IO(seqPlayId, 0, bgmParam); + SEQCMD_PLAY_SEQUENCE(seqPlayId, fadeinTime, 0, seqId); +} + +void Audio_PlayFanfare(u16 seqId, u8 bgmVolume, u8 bgmFadeoutTime, u8 bgmFadeinTime) { + if (Audio_GetActiveSeqId(SEQ_PLAYER_BGM) != 39) { + Audio_SetSequenceFade(SEQ_PLAYER_BGM, 1, bgmVolume, bgmFadeoutTime); + SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME(SEQ_PLAYER_FANFARE, SEQ_PLAYER_BGM, bgmFadeinTime); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, 0, seqId); + } +} + +void func_8001D520(void) { + u8 i; + + if (sNewAudioSpecId == 24) { + Audio_ClearVoice(); + func_8001D6DC(0); + Audio_PlaySfx(0x0903F004, gDefaultSfxSource, 4, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + SEQCMD_SET_SEQPLAYER_VOLUME(SEQ_PLAYER_BGM, 5, 30); + SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME(SEQ_PLAYER_FANFARE, SEQ_PLAYER_BGM, 30); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_FANFARE, 0, 0, 39); + } else { + for (i = 0; i < 5; i++) { + Audio_KillSfxByBank(i); + } + AUDIOCMD_GLOBAL_UNMUTE(true); + Audio_PlaySfx(0x0903F004, gDefaultSfxSource, 4, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 0); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM, 0, 0, 39); + } +} + +void func_8001D638(u8 arg0) { + if (arg0) { + Audio_PlaySfx(0x4900F000, gDefaultSfxSource, 4, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + AUDIOCMD_GLOBAL_MUTE(); + } else { + Audio_PlaySfx(0x4900F000, gDefaultSfxSource, 4, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + AUDIOCMD_GLOBAL_UNMUTE(false); + } +} + +void func_8001D6DC(u8 arg0) { + if (arg0) { + Audio_PlaySfx(0x49000019, gDefaultSfxSource, 4, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + AUDIOCMD_GLOBAL_MUTE(); + } else { + Audio_PlaySfx(0x4900101A, gDefaultSfxSource, 4, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + AUDIOCMD_GLOBAL_UNMUTE(false); + } +} + +void func_8001D780(u8 audioType) { + s8 volume = ((sVolumeSettings[audioType] * 127) / 99) % 128U; + u8 i; + + switch (audioType) { + case 0: + Audio_SetSequenceFade(SEQ_PLAYER_BGM, 0, volume, 1); + Audio_SetSequenceFade(SEQ_PLAYER_FANFARE, 0, volume, 1); + break; + case 2: + for (i = 0; i < 15; i++) { + AUDIOCMD_CHANNEL_SET_VOL(SEQ_PLAYER_SFX, (u32) i, volume / 127.0f); + } + break; + case 1: + AUDIOCMD_CHANNEL_SET_VOL(SEQ_PLAYER_VOICE, 15, volume / 127.0f); + break; + } +} + +void func_8001D8A8(u8 audioType, u8 volume) { + if (volume > 99) { + volume = 99; + } + sVolumeSettings[audioType] = volume; + func_8001D780(audioType); +} + +void Audio_PlaySoundTest(u8 enable) { + switch (enable) { + case false: + Audio_PlaySequence(0, 36, 0, 255); + Audio_PlayVoice(1); + Audio_KillSfxById(0x0100001F); + Audio_KillSfxById(0x0100F005); + break; + case true: + Audio_PlaySequence(0, 46, 0, 255); + Audio_PlayVoice(2); + Audio_PlaySfx(0x0100001F, gDefaultSfxSource, 0, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + Audio_PlaySfx(0x0100F005, gDefaultSfxSource, 0, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + break; + } +} + +void Audio_PlaySequenceDistorted(u8 seqPlayId, u16 seqId, u16 distortion, u8 fadeinTime, u8 unused) { + u8 tempoDistortion = (distortion / 10); + + Audio_PlaySequence(seqPlayId, seqId & ~0x8000, 0, 255); + SEQCMD_SET_SEQPLAYER_FREQ(seqPlayId, fadeinTime, distortion); + SEQCMD_SCALE_TEMPO(seqPlayId, fadeinTime, tempoDistortion); +} + +void Audio_PlaySoundTestTrack(u8 trackNumber) { + u16 sp26; + u8 sp25; + + if ((trackNumber >= 45) && (trackNumber < 50)) { + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); + gPlaylistIndex = trackNumber - 45; + gPlaylistCmdIndex = 0; + gPlaylistTimer = 0; + } else if (trackNumber >= 50) { + Audio_PlaySfx(0x4900100A, gDefaultSfxSource, 4, &gDefaultMod, &gDefaultMod, &gDefaultReverb); + } else { + gPlaylistIndex = 0xFF; + sp26 = D_800C5EE4[trackNumber].unk_0 & 0xFF; + sp25 = D_800C5EE4[trackNumber].unk_4; + SEQCMD_STOP_SEQUENCE(D_800C5E70 ^ 1, 5); + Audio_PlaySequence(D_800C5E70, sp26, 0, sp25); + D_800C5E70 ^= 1; + } +} + +void Audio_FadeOutAll(u8 fadeoutTime) { + SEQCMD_SET_SEQPLAYER_VOLUME(SEQ_PLAYER_BGM, fadeoutTime, 0); + SEQCMD_SET_SEQPLAYER_VOLUME(SEQ_PLAYER_FANFARE, fadeoutTime, 0); + SEQCMD_SET_SEQPLAYER_VOLUME(SEQ_PLAYER_SFX, fadeoutTime, 0); + SEQCMD_SET_SEQPLAYER_VOLUME(SEQ_PLAYER_VOICE, fadeoutTime, 0); +} + +void Audio_KillAllSfx(void) { + u8 i; + + for (i = 0; i < 5; i++) { + Audio_KillSfxByBank(i); + } +} + +void Audio_SetAudioSpec(u8 unused, u16 specParam) { + u8 sfxChannelLayout = ((specParam & 0xFF00) >> 8); + u8 specId = specParam & 0xFF; + + SEQCMD_RESET_AUDIO_HEAP(sfxChannelLayout, specId); +} + +// unused despite being equivalent to AUDIO_PLAY_BGM +void Audio_PlayBgm(u16 seqId) { + SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM, 1, 0, seqId); +} + +void Audio_InitSounds(void) { + Audio_ResetVoicesAndPlayers(); + Audio_ResetSfxChannelState(); + Audio_ResetActiveSequencesAndVolume(); + Audio_ResetSfx(); + Audio_StartSequence(SEQ_PLAYER_VOICE, 1, 0xFF, 1); + Audio_StartSequence(SEQ_PLAYER_SFX, 0, 0xFF, 10); +} + +void func_8001DD40(void) { + s32 pad1; + s32 pad2; + u16 sp1E = 1; + + Audio_StartSequence(SEQ_PLAYER_VOICE, 1, 0xFF, 1); + if (sNewAudioSpecId == 12) { + sp1E = 360; + } else if (sNewAudioSpecId < 23) { + sp1E = 90; + } + Audio_StartSequence(SEQ_PLAYER_SFX, 0, 0xFF, sp1E); + func_80017494(); + func_80017550(); + SEQCMD_SET_SEQPLAYER_VOLUME(SEQ_PLAYER_SFX, 0, 127); + SEQCMD_SET_SEQPLAYER_VOLUME(SEQ_PLAYER_VOICE, 0, 127); + func_8001E920(); + AUDIOCMD_GLOBAL_STOP_AUDIOCMDS(); + AUDIOCMD_GLOBAL_STOP_AUDIOCMDS(); + AUDIOCMD_GLOBAL_STOP_AUDIOCMDS(); + func_8001D780(0); + func_8001D780(2); + func_8001D780(1); +} + +void func_8001DE1C(u8 oldSpecId) { + if (oldSpecId == 16) { + if ((sNewAudioSpecId == 22) || (sNewAudioSpecId == 23)) { + D_800C5D58 = 2; + } + } else if ((oldSpecId == 28) && (sNewAudioSpecId == 23)) { + D_800C5D58 = 2; + } else { + D_800C5D58 = 1; + } + AUDIOCMD_GLOBAL_UNMUTE(true); + Audio_ResetVoicesAndPlayers(); + Audio_ResetSfxChannelState(); + Audio_ResetActiveSequences(); + Audio_ResetSfx(); +} + +void Audio_Update(void) { + if (func_80018FA4() == 0) { + Audio_ProcessSfxRequests(); + Audio_ProcessSeqCmds(); + Audio_PlayAllSfx(); + Audio_UpdatePlayerNoise(); + Audio_UpdateVoice(); + func_8001AF50(); + Audio_UpdateActiveSequences(); + Audio_UpdateDelayedSeqCmds(); + func_8001E920(); + } + gAudioFrameCounter++; +} diff --git a/src/main/audio_heap.c b/src/main/audio_heap.c index 00875f11..42a485f8 100644 --- a/src/main/audio_heap.c +++ b/src/main/audio_heap.c @@ -11,6 +11,65 @@ void* AudioHeap_SearchRegularCaches(s32 tableType, s32 cache, s32 id); void* AudioHeap_SearchPermanentCache(s32 tableType, s32 id); SampleCacheEntry* AudioHeap_AllocPersistentSampleCacheEntry(u32); +s32 D_80146D80; + +static char devstr00[] = "Warning:Kill Note %x \n"; +static char devstr01[] = "Kill Voice %d (ID %d) %d\n"; +static char devstr02[] = "Warning: Running Sequence's data disappear!\n"; +static char devstr03[] = "%x %x %x\n"; +static char devstr04[] = "Audio:Memory:Heap OverFlow : Not Allocate %d!\n"; +static char devstr05[] = "%x %x %x\n"; +static char devstr06[] = "Audio:Memory:Heap OverFlow : Not Allocate %d!\n"; +static char devstr07[] = "Audio:Memory:DataHeap Not Allocate \n"; +static char devstr08[] = "StayHeap Not Allocate %d\n"; +static char devstr09[] = "AutoHeap Not Allocate %d\n"; +static char devstr10[] = "Status ID0 : %d ID1 : %d\n"; +static char devstr11[] = "id 0 is Stopping\n"; +static char devstr12[] = "id 0 is Stop\n"; +static char devstr13[] = "id 1 is Stopping\n"; +static char devstr14[] = "id 1 is Stop\n"; +static char devstr15[] = "WARNING: NO FREE AUTOSEQ AREA.\n"; +static char devstr16[] = "WARNING: NO STOP AUTO AREA.\n"; +static char devstr17[] = " AND TRY FORCE TO STOP SIDE \n"; +static char devstr18[] = "Check ID0 (seq ID %d) Useing ...\n"; +static char devstr19[] = "Check ID1 (seq ID %d) Useing ...\n"; +static char devstr20[] = "No Free Seq area.\n"; +static char devstr21[] = "CH %d: ID %d\n"; +static char devstr22[] = "TWO SIDES ARE LOADING... ALLOC CANCELED.\n"; +static char devstr23[] = "WARNING: Before Area Overlaid After."; +static char devstr24[] = "WARNING: After Area Overlaid Before."; +static char devstr25[] = "MEMORY:SzHeapAlloc ERROR: sza->side %d\n"; +static char devstr26[] = "Audio:MEMORY:SzHeap Overflow error. (%d bytes)\n"; +static char devstr27[] = "Auto Heap Unhit for ID %d\n"; +static char devstr28[] = "Heap Reconstruct Start %x\n"; +static char devstr29[] = "---------------------------------------TEMPO %d %f\n"; +static char devstr30[] = "%f \n"; +static char devstr31[] = "%f \n"; +static char devstr32[] = "AHPBASE %x\n"; +static char devstr33[] = "AHPCUR %x\n"; +static char devstr34[] = "HeapTop %x\n"; +static char devstr35[] = "SynoutRate %d / %d \n"; +static char devstr36[] = "FXSIZE %d\n"; +static char devstr37[] = "FXCOMP %d\n"; +static char devstr38[] = "FXDOWN %d\n"; +static char devstr39[] = "WaveCacheLen: %d\n"; +static char devstr40[] = "SpecChange Finished\n"; +static char devstr41[] = "Warning:Emem Over,not alloc %d\n"; +static char devstr42[] = "Single AutoSize %d\n"; +static char devstr43[] = "Single Ptr %x\n"; +static char devstr44[] = "Request--------Single-Auto, %d\n"; +static char devstr45[] = "Retry %x, %x, len %x\n"; +static char devstr46[] = "DMAing list %d is killed.\n"; +static char devstr47[] = "Try Kill %d \n"; +static char devstr48[] = "Try Kill %x %x\n"; +static char devstr49[] = "Try Kill %x %x %x\n"; +static char devstr50[] = "Rom back %x %x \n"; +static char devstr51[] = "Error sw NULL \n"; +static char devstr52[] = "Request--------Single-Stay, %d\n"; +static char devstr53[] = "Try Kill %d \n"; +static char devstr54[] = "Try Kill %x %x\n"; +static char devstr55[] = "Try Kill %x %x %x\n"; + void AudioHeap_ResetLoadStatus(void) { s32 i; diff --git a/src/main/audio_load.c b/src/main/audio_load.c index 64740f1a..9e21c972 100644 --- a/src/main/audio_load.c +++ b/src/main/audio_load.c @@ -2,12 +2,6 @@ #include "sf64dma.h" #include "sf64audio_provisional.h" -extern char D_800C4F6C[]; -extern char D_800C50E8[]; -extern char D_800C50F4[]; -extern char D_800C52F4[]; -extern char D_800C53AC[]; - extern AudioTable gSampleBankTableInit; // extern AudioTableEntry gSampleBankTableInitEntries[]; extern AudioTable gSeqTableInit; @@ -16,6 +10,73 @@ extern AudioTable gSoundFontTableInit; // extern AudioTableEntry gSoundFontTableInitEntries[]; extern u8 gSeqFontTableInit[]; +static char devstr00[] = "CAUTION:WAVE CACHE FULL %d"; +static char D_800C4F6C[] = "SUPERDMA"; +static char devstr02[] = "Bank Change... top %d lba %d\n"; +static char devstr03[] = "BankCount %d\n"; +static char devstr04[] = "BANK LOAD MISS! FOR %d\n"; +static char devstr05[] = "BankCount %d\n"; +static char devstr06[] = "Flush Start\n"; +static char devstr07[] = "%d ->%d\n"; +static char devstr08[] = "useflag %d\n"; +static char devstr09[] = "BankCount %d\n"; +static char devstr10[] = "%2x "; +static char devstr11[] = "StartSeq (Group %d,Seq %d) Process finish\n"; +static char devstr12[] = "LoadCtrl, Ptr %x and Media is %d\n"; +static char devstr13[] = "Load Bank, Type %d , ID %d\n"; +static char devstr14[] = "get auto\n"; +static char devstr15[] = "get s-auto %x\n"; +static char devstr16[] = "Seq %d Write ID OK %d!\n"; +static char devstr17[] = "Banknumber %d\n"; +static char devstr18[] = "Bank Offset %x %d %d\n"; +static char devstr19[] = "PEP Touch %x \n"; +static char D_800C50E8[] = "FastCopy"; +static char D_800C50F4[] = "FastCopy"; +static char devstr22[] = "Error: Cannot DMA Media [%d]\n"; +static char devstr23[] = "Warning: size not align 16 %x (%s)\n"; +static char devstr24[] = "Load Bank BG, Type %d , ID %d\n"; +static char devstr25[] = "get auto\n"; +static char devstr26[] = "get s-auto %x\n"; +static char devstr27[] = "Clear Workarea %x -%x size %x \n"; +static char devstr28[] = "AudioHeap is %x\n"; +static char devstr29[] = "Heap reset.Synth Change %x \n"; +static char devstr30[] = "Heap %x %x %x\n"; +static char devstr31[] = "Main Heap Initialize.\n"; +static char devstr32[] = "%d :WaveA %d WaveB %d Inst %d,Perc %d\n"; +static char devstr33[] = "---------- Init Completed. ------------\n"; +static char devstr34[] = " Syndrv :[%6d]\n"; +static char devstr35[] = " Seqdrv :[%6d]\n"; +static char devstr36[] = " audiodata :[%6d]\n"; +static char devstr37[] = "---------------------------------------\n"; +static char devstr38[] = "Entry--- %d %d\n"; +static char devstr39[] = "---Block LPS here\n"; +static char devstr40[] = "===Block LPS end\n"; +static char D_800C52F4[] = "SLOWCOPY"; +static char devstr42[] = "Req: Src %x Dest %x Len %x,media %d,retcode %d\n"; +static char devstr43[] = "Remain Size %d\n"; +static char devstr44[] = "---Block BG here\n"; +static char devstr45[] = "===Block BG end\n"; +static char devstr46[] = "Retcode %x\n"; +static char devstr47[] = "Other Type: Not Write ID.\n"; +static char devstr48[] = "BGLOAD:Error: dma length 0\n"; +static char D_800C53AC[] = "BGCOPY"; +static char devstr50[] = "Error: Already wavetable is touched %x.\n"; +static char devstr51[] = "Touch Warning: Length zero %x\n"; +static char devstr52[] = "It's busy now!!!!! %d\n"; +static char devstr53[] = "BG LOAD BUFFER is OVER.\n"; +static char devstr54[] = "Warning: Length zero %x\n"; +static char devstr55[] = "Wave Load %d \n"; +static char devstr56[] = "Total Bg Wave Load %d \n"; +static char devstr57[] = "Receive %d\n"; +static char devstr58[] = "============Error: Magic is Broken after loading.\n"; +static char devstr59[] = "Remain DMA: %d\n"; +static char devstr60[] = "N start %d\n"; +static char devstr61[] = "============Error: Magic is Broken: %x\n"; +static char devstr62[] = "Error: No Handle.\n"; +static char devstr63[] = "Success: %x\n"; + +AudioSlowLoadBuffer gSlowLoads; + void AudioLoad_DecreaseSampleDmaTtls(void) { SampleDma* dma; u32 i; @@ -171,7 +232,7 @@ void AudioLoad_InitTable(AudioTable* table, u8* romAddr, u16 unkMediumParam) { table->romAddr = romAddr; for (i = 0; i < table->numEntries; i++) { - if ((table->entries[i].size != 0) && (table->entries[i].medium == 2)) { + if ((table->entries[i].size != 0) && (table->entries[i].medium == MEDIUM_CART)) { table->entries[i].romAddr += (u32) romAddr; } } @@ -212,12 +273,12 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) { if (sampleAddr == NULL) { return -1; } - if (sample->medium == 1) { + if (sample->medium == MEDIUM_UNK) { AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleAddr, sample->size, gSampleBankTable->unkMediumParam); } else { AudioLoad_SyncDma(sample->sampleAddr, sampleAddr, sample->size, sample->medium); } - sample->medium = 0; + sample->medium = MEDIUM_RAM; sample->sampleAddr = sampleAddr; } } @@ -366,7 +427,7 @@ void* AudioLoad_SyncLoadSampleBank(u32 sampleBankId, s32* outMedium) { if (gSampleFontLoadStatus[sampleBankId] != 5) { gSampleFontLoadStatus[sampleBankId] = 2; } - *outMedium = 0; + *outMedium = MEDIUM_RAM; return ramAddr; } cachePolicy = sampleBankTable->entries[sampleBankId].cachePolicy; @@ -376,7 +437,7 @@ void* AudioLoad_SyncLoadSampleBank(u32 sampleBankId, s32* outMedium) { } ramAddr = AudioLoad_SyncLoad(2, sampleBankId, &noLoad); if (ramAddr != NULL) { - *outMedium = 0; + *outMedium = MEDIUM_RAM; return ramAddr; } *outMedium = sampleBankTable->entries[sampleBankId].medium; @@ -466,7 +527,7 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) { } *didAllocate = true; - if (medium == 1) { + if (medium == MEDIUM_UNK) { AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, table->unkMediumParam); } else { AudioLoad_SyncDma(romAddr, ramAddr, size, medium); @@ -474,17 +535,17 @@ void* AudioLoad_SyncLoad(u32 tableType, u32 id, s32* didAllocate) { loadStatus = (cachePolicy == 0) ? 5 : 2; } switch (tableType) { - case 0: + case SEQUENCE_TABLE: if (gSeqLoadStatus[id] != 5) { gSeqLoadStatus[id] = loadStatus; } break; - case 1: + case FONT_TABLE: if (gFontLoadStatus[id] != 5) { gFontLoadStatus[id] = loadStatus; } break; - case 2: + case SAMPLE_TABLE: if (gSampleFontLoadStatus[id] != 5) { gSampleFontLoadStatus[id] = loadStatus; } @@ -520,13 +581,13 @@ AudioTable* AudioLoad_GetLoadTable(s32 tableType) { AudioTable* table; switch (tableType) { - case 0: + case SEQUENCE_TABLE: table = gSequenceTable; break; - case 1: + case FONT_TABLE: table = gSoundFontTable; break; - case 2: + case SAMPLE_TABLE: table = gSampleBankTable; break; default: @@ -621,11 +682,11 @@ s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, u32 devAddr, void OSMesgQueue* retQueue, s32 medium, const char* dmaType) { OSPiHandle* handle; - switch (medium) { /* irregular */ - case 2: + switch (medium) { + case MEDIUM_CART: handle = osCartRomInit(); break; - case 3: + case MEDIUM_DISK_DRIVE: handle = func_8001EE60(); break; default: @@ -851,7 +912,7 @@ s32 AudioLoad_SlowLoadSample(s32 fontId, u8 instId, s8* status) { *status = 0; return -1; } - if (sample->medium == 0) { + if (sample->medium == MEDIUM_RAM) { *status = 2; return 0; } @@ -864,7 +925,7 @@ s32 AudioLoad_SlowLoadSample(s32 fontId, u8 instId, s8* status) { slowLoad->curRamAddr = AudioHeap_AllocTemporarySampleCache(sample->size, fontId, sample->sampleAddr, sample->medium); if (slowLoad->curRamAddr == NULL) { - if ((sample->medium == 1) || (sample->codec == 2)) { + if ((sample->medium == MEDIUM_UNK) || (sample->codec == 2)) { *status = 0; return -1; } else { @@ -907,13 +968,13 @@ Sample* AudioLoad_GetFontSample(s32 fontId, s32 instId) { void AudioLoad_Stub_10800(void) { } -void AudioLoad_FinishSlowLoad(AudioSlowLoad* arg0) { - Sample* sample = AudioLoad_GetFontSample(arg0->seqOrFontId, arg0->instId); +void AudioLoad_FinishSlowLoad(AudioSlowLoad* slowLoad) { + Sample* sample = AudioLoad_GetFontSample(slowLoad->seqOrFontId, slowLoad->instId); if (sample != NULL) { - arg0->sample = *sample; - sample->sampleAddr = arg0->ramAddr; - sample->medium = 0; + slowLoad->sample = *sample; + sample->sampleAddr = slowLoad->ramAddr; + sample->medium = MEDIUM_RAM; } } @@ -938,7 +999,7 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) { slowLoad->state = 3; *slowLoad->status = 1; } else if (slowLoad->bytesRemaining < 0x1000) { - if (slowLoad->medium == 1) { + if (slowLoad->medium == MEDIUM_UNK) { AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, slowLoad->curRamAddr, slowLoad->bytesRemaining, sampleBankTable->unkMediumParam); } else { @@ -946,7 +1007,7 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) { } slowLoad->bytesRemaining = 0; } else { - if (slowLoad->medium == 1) { + if (slowLoad->medium == MEDIUM_UNK) { AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, slowLoad->curRamAddr, 0x1000, sampleBankTable->unkMediumParam); } else { @@ -1091,7 +1152,7 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) { osSendMesg(asyncLoad->retQueue, asyncLoad->retMsg, 0); } else { if (asyncLoad->bytesRemaining < asyncLoad->chunkSize) { - if (asyncLoad->medium == 1) { + if (asyncLoad->medium == MEDIUM_UNK) { AudioLoad_AsyncDmaUnkMedium(asyncLoad->curDevAddr, asyncLoad->curRamAddr, asyncLoad->bytesRemaining, sp5C->unkMediumParam); } else { @@ -1099,7 +1160,7 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) { } asyncLoad->bytesRemaining = 0; } else { - if (asyncLoad->medium == 1) { + if (asyncLoad->medium == MEDIUM_UNK) { AudioLoad_AsyncDmaUnkMedium(asyncLoad->curDevAddr, asyncLoad->curRamAddr, asyncLoad->chunkSize, sp5C->unkMediumParam); } else { @@ -1132,23 +1193,23 @@ void AudioLoad_RelocateSample(TunedSample* tSample, u32 fontDataAddr, SampleBank void* reloc; Sample* sample; - if ((u32) tSample->sample < 0x80000001U) { + if ((u32) tSample->sample <= 0x80000000) { sample = tSample->sample = reloc = (u32) tSample->sample + fontDataAddr; // arg0->sample = temp_v1; if ((sample->size != 0) && (sample->isRelocated != 1)) { sample->loop = reloc = (u32) sample->loop + fontDataAddr; sample->book = reloc = (u32) sample->book + fontDataAddr; switch (sample->medium) { /* irregular */ - case 0: + case MEDIUM_RAM: sample->sampleAddr = reloc = sample->sampleAddr + relocInfo->baseAddr1; sample->medium = relocInfo->medium1; break; - case 1: + case MEDIUM_UNK: sample->sampleAddr = reloc = sample->sampleAddr + relocInfo->baseAddr2; sample->medium = relocInfo->medium2; break; - case 2: - case 3: + case MEDIUM_CART: + case MEDIUM_DISK_DRIVE: break; } sample->isRelocated = true; @@ -1214,15 +1275,15 @@ s32 AudioLoad_RelocateFontAndPreloadSamples(s32 fontId, u32 fontDataAddr, Sample } switch (isAsync) { case 0: - if (sample->medium == 1) { + if (sample->medium == MEDIUM_UNK) { AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleRamAddr, sample->size, gSampleBankTable->unkMediumParam); sample->sampleAddr = sampleRamAddr; - sample->medium = 0; + sample->medium = MEDIUM_RAM; } else { AudioLoad_SyncDma(sample->sampleAddr, sampleRamAddr, sample->size, sample->medium); sample->sampleAddr = sampleRamAddr; - sample->medium = 0; + sample->medium = MEDIUM_RAM; } break; case 1: @@ -1276,7 +1337,7 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) { key = sample->sampleAddr + sample->size + sample->medium; if (key == gPreloadSampleStack[preloadIndex].endAndMediumKey) { sample->sampleAddr = gPreloadSampleStack[preloadIndex].ramAddr; - sample->medium = 0; + sample->medium = MEDIUM_RAM; } gPreloadSampleStack[preloadIndex].isFree = 1; } diff --git a/src/main/audio_playback.c b/src/main/audio_playback.c index 0eb80391..ba146d8d 100644 --- a/src/main/audio_playback.c +++ b/src/main/audio_playback.c @@ -1,6 +1,39 @@ #include "sys.h" #include "sf64audio_provisional.h" +static char devstr00[] = "Audio: setvol: volume minus %f\n"; +static char devstr01[] = "Audio: setvol: volume overflow %f\n"; +static char devstr02[] = "Audio: setpitch: pitch zero or minus %f\n"; +static char devstr03[] = "Audio: voiceman: No bank error %d\n"; +static char devstr04[] = "Audio: voiceman: progNo. overflow %d,%d\n"; +static char devstr05[] = "ptr2 %x\n"; +static char devstr06[] = "Audio: voiceman: progNo. undefined %d,%d\n"; +static char devstr07[] = "Audio: voiceman: No bank error %d\n"; +static char devstr08[] = "Audio: voiceman: Percussion Overflow %d,%d\n"; +static char devstr09[] = "Audio: voiceman: Percussion table pointer (bank %d) is irregular %x.\n"; +static char devstr10[] = "Audio: voiceman: Percpointer NULL %d,%d\n"; +static char devstr11[] = "--4 %x\n"; +static char devstr12[] = "----------------------Double-Error CH: %x %f\n"; +static char devstr13[] = "----------------------Double-Error NT: %x\n"; +static char devstr14[] = "CAUTION:SUB IS SEPARATED FROM GROUP\n"; +static char devstr15[] = "CAUTION:PAUSE EMERGENCY\n"; +static char devstr16[] = "Error:Wait Track disappear\n"; +static char devstr17[] = "NoteOff Comes during wait release %x (note %x)\n"; +static char devstr18[] = "Slow Release Batting\n"; + +u8 gSamplesPerWavePeriod[] = { 64, 32, 16, 8 }; + +static char devstr19[] = "Audio:Wavemem: Bad voiceno (%d)\n"; +static char devstr20[] = "Audio: C-Alloc : Dealloc voice is NULL\n"; +static char devstr21[] = "Alloc Error:Dim voice-Alloc %d"; +static char devstr22[] = "Error:Same List Add\n"; +static char devstr23[] = "Already Cut\n"; +static char devstr24[] = "Audio: C-Alloc : lowerPrio is NULL\n"; +static char devstr25[] = "Intterupt UseStop %d (Kill %d)\n"; +static char devstr26[] = "Intterupt RelWait %d (Kill %d)\n"; +static char devstr27[] = "Drop Voice (Prio %x)\n"; +// static char devstr28[] = ""; + #pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_playback/func_80011890.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_playback/func_80011C58.s") diff --git a/src/main/audio_seqplayer.c b/src/main/audio_seqplayer.c index 79b03a22..34dbf416 100644 --- a/src/main/audio_seqplayer.c +++ b/src/main/audio_seqplayer.c @@ -1,6 +1,38 @@ #include "sys.h" #include "sf64audio_provisional.h" +static char devstr00[] = "Audio:Track:Warning: No Free Notetrack\n"; +static char devstr01[] = "SUBTRACK DIM\n"; +static char devstr02[] = "Audio:Track: Warning :SUBTRACK had been stolen by other Group.\n"; +static char devstr03[] = "SEQID %d,BANKID %d\n"; +static char devstr04[] = "ERR:SUBTRACK %d NOT ALLOCATED\n"; +static char devstr05[] = "Stop Release\n"; +static char devstr06[] = "Error:Same List Add\n"; +static char devstr07[] = "Wait Time out!\n"; +static char devstr08[] = "Macro Level Over Error!\n"; +static char devstr09[] = "Macro Level Over Error!\n"; +static char devstr10[] = "WARNING: NPRG: cannot change %d\n"; +static char devstr11[] = "Audio:Track:NOTE:UNDEFINED NOTE COM. %x\n"; +static char devstr12[] = "Audio: Note:Velocity Error %d\n"; +static char devstr13[] = "Error: Subtrack no prg.\n"; +static char devstr14[] = "ERR %x\n"; +static char devstr15[] = "Error: Your assignchannel is stolen.\n"; +static char devstr16[] = "Audio:Track :Call Macro Level Over Error!\n"; +static char devstr17[] = "Audio:Track :Loops Macro Level Over Error!\n"; +static char devstr18[] = "SUB:ERR:BANK %d NOT CACHED.\n"; +static char devstr19[] = "SUB:ERR:BANK %d NOT CACHED.\n"; +static char devstr20[] = "Audio:Track: CTBLCALL Macro Level Over Error!\n"; +static char devstr21[] = "Set Noise %d\n"; +static char devstr22[] = "[%2x] \n"; +static char devstr23[] = "Err :Sub %x ,address %x:Undefined SubTrack Function %x"; +static char devstr24[] = "VoiceLoad Error Bank:%d,Prog:%d\n"; +static char devstr25[] = "Disappear Sequence or Bank %d\n"; +static char devstr26[] = "[FIN] group.\n"; +static char devstr27[] = "Macro Level Over Error!\n"; +static char devstr28[] = "Macro Level Over Error!\n"; +static char devstr29[] = "Group:Undefine upper C0h command (%x)\n"; +static char devstr30[] = "Group:Undefined Command\n"; + #pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_seqplayer/func_80013EA0.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_seqplayer/func_80013FC4.s") diff --git a/src/main/audio_synthesis.c b/src/main/audio_synthesis.c index 94261189..2d588d41 100644 --- a/src/main/audio_synthesis.c +++ b/src/main/audio_synthesis.c @@ -1,4 +1,29 @@ -#include "common.h" +#include "sys.h" +#include "sf64audio_provisional.h" + +s32 D_80145D40; +f32 D_80145D48[256]; +f32 D_80146148[256]; +f32 D_80146548[515]; +f32 D_80146D54; +f32 D_80146D58; +f32 D_80146D5C; +f32 D_80146D60; +f32 D_80146D64; +f32 D_80146D68; +f32 D_80146D6C; +f32 D_80146D70; + +static char devstr0[] = "Table Remake\n"; +static char devstr1[] = "-------------------Undefined Ctype \n"; +static char devstr2[] = "Error? Limit OVER %d in %d\n"; +static char devstr3[] = ""; +static char devstr4[] = "Get %x %x\n"; +static char devstr5[] = "Break %x %d %d \n"; +static char devstr6[] = "Terminate-Canceled Channel %d,Phase %d\n"; +static char devstr7[] = "S->W\n"; +static char devstr8[] = "W->S\n"; +static char devstr9[] = "S-Resample Pitch %x (old %d -> delay %d)\n"; #pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_synthesis/func_800080C0.s") diff --git a/src/main/audio_thread.c b/src/main/audio_thread.c index 4bf099b6..75af8927 100644 --- a/src/main/audio_thread.c +++ b/src/main/audio_thread.c @@ -1,6 +1,28 @@ #include "sys.h" #include "sf64audio_provisional.h" +OSMesgQueue sAudioTaskStartQueue; +OSMesgQueue sThreadCmdProcQueue; +OSMesgQueue sAudioUnkQueue; +OSMesgQueue sAudioResetQueue; +AudioCmd gThreadCmdBuffer[256]; +OSMesg sAudioTaskStartMsg[1]; +OSMesg sThreadCmdProcMsg[4]; +OSMesg sAudioUnkMsg[1]; +OSMesg sAudioResetMsg[1]; + +s8 gThreadCmdWritePos = 0; +s8 gThreadCmdReadPos = 0; +OSMesgQueue* gAudioTaskStartQueue = &sAudioTaskStartQueue; +OSMesgQueue* gThreadCmdProcQueue = &sThreadCmdProcQueue; +OSMesgQueue* gAudioUnkQueue = &sAudioUnkQueue; +OSMesgQueue* gAudioResetQueue = &sAudioResetQueue; +s32 gMaxAbiCmdCnt = 128; +AudioTask* gWaitingAudioTask = NULL; +s32 D_800C7C70 = 0; +u8 gCurCmdReadPos = 0; +u8 gThreadCmdQueueFinished = 0; + #pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/func_8001DF50.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/func_8001E444.s") @@ -12,19 +34,19 @@ void func_8001E7C8(void) { gThreadCmdWritePos = 0; gThreadCmdReadPos = 0; - osCreateMesgQueue(gAudioTaskStartQueue, D_80156600, 1); - osCreateMesgQueue(gThreadCmdProcQueue, D_80156608, 4); - osCreateMesgQueue(gAudioUnkQueue, D_80156618, 1); - osCreateMesgQueue(gAudioResetQueue, D_8015661C, 1); + osCreateMesgQueue(gAudioTaskStartQueue, sAudioTaskStartMsg, 1); + osCreateMesgQueue(gThreadCmdProcQueue, sThreadCmdProcMsg, 4); + osCreateMesgQueue(gAudioUnkQueue, sAudioUnkMsg, 1); + osCreateMesgQueue(gAudioResetQueue, sAudioResetMsg, 1); } -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/func_8001E850.s") +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/AudioThread_QueueCmd.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/func_8001E8A8.s") +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/AudioThread_QueueCmdF32.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/func_8001E8CC.s") +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/AudioThread_QueueCmdS32.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/func_8001E8F0.s") +#pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/AudioThread_QueueCmdS8.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/main/audio_thread/func_8001E920.s") diff --git a/src/main/fox_360.c b/src/main/fox_360.c index afd26c9a..ab1af016 100644 --- a/src/main/fox_360.c +++ b/src/main/fox_360.c @@ -96,7 +96,7 @@ void func_8002E548(void) { func_8008E51C(D_8015F930, D_8015F944); if ((D_8015F930[0] == 0) && (sp24 != D_8015F930[1]) && (D_8015F930[1] < 15)) { - Audio_PlaySfx(0x4900C02A, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900C02A, gDefaultSfxSource, 4); } } } @@ -194,7 +194,7 @@ void func_8002E700(Player* player) { } else { gRightWingHealth[0] = gLeftWingHealth[0] = 60; } - Audio_PlaySfx(0x4900200E, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900200E, gDefaultSfxSource, 4); player->unk_1D0++; } break; @@ -207,7 +207,7 @@ void func_8002E700(Player* player) { player->unk_0D0 = D_80161A54; player->unk_1D0++; - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); } break; case 4: @@ -382,12 +382,12 @@ void func_8002F180(void) { } actor->iwork[11] = 1; if (actor->unk_0E4 < 4) { - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_800CC01C); actor->info.unk_1C = 0.0f; actor->info.bonus = 0; } else { - Audio_PlaySfx(0x31000011, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000011, actor->sfxSource, 4); } } } @@ -421,9 +421,9 @@ void func_8002F3E0(void) { } Object_SetInfo(&actor->info, actor->obj.id); if (gCurrentLevel == LEVEL_VENOM_2) { - Audio_PlaySfx(0x31004006, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31004006, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x31004005, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31004005, actor->sfxSource, 4); } } } @@ -455,8 +455,8 @@ void func_8002F69C(Actor* actor) { } if (((D_8015F928 + 100) == (0, D_800C9B4C)) && (gCurrentLevel != LEVEL_VENOM_2)) { // fake? - func_800182F4(0x101E00FF); - func_800182F4(0x111E00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 30); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 30); } if (D_8015F928 == D_800C9B4C) { func_8002F3E0(); @@ -465,7 +465,7 @@ void func_8002F69C(Actor* actor) { if ((gCurrentLevel == LEVEL_VENOM_2) || (gCurrentLevel == LEVEL_BOLSE)) { gPlayer[0].unk_034 = 20.0f; } - func_8001D444(0, 0x802B, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_43 | 0x8000); func_8002EE34(); if ((gCurrentLevel == LEVEL_FORTUNA) || (gCurrentLevel == LEVEL_VENOM_2)) { gPlayer[0].camEye.x = 4500.0f; @@ -634,7 +634,7 @@ void func_8002FEF0(Actor* actor) { newActor->obj.pos.x = 200.0f; newActor->obj.pos.y = -500.0f; newActor->obj.pos.z = 0.0f; - Audio_PlaySfx(0x09000002, newActor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, newActor->sfxSource, 0); newActor->timer_0C2 = 50; } else { newActor->obj.pos.x = 0.0f; @@ -661,7 +661,7 @@ void func_8002FEF0(Actor* actor) { void func_8003010C(Actor* actor) { if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_4) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_6)) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); return; } D_8015F928++; @@ -861,7 +861,7 @@ void func_8003088C(Actor* actor) { actor->obj.status = OBJ_DYING; actor->fwork[23] = 0.0f; func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 4.0f); - Audio_PlaySfx(0x2903700B, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903700B, actor->sfxSource, 4); actor->timer_0C2 = 10; actor->timer_0BE = 0; actor->timer_04C = RAND_INT(2.9f); @@ -980,7 +980,7 @@ void func_8003088C(Actor* actor) { } } else { if (var_a1) { - Audio_PlaySfx(0x29001062, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29001062, actor->sfxSource, 4); actor->iwork[7] = 3; actor->iwork[18] = 5; actor->iwork[8] = 15; @@ -996,9 +996,9 @@ void func_8003088C(Actor* actor) { actor->iwork[8] = 20; } if (actor->unk_0E4 == 200) { - Audio_PlaySfx(0x29034003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, actor->sfxSource, 4); } else if (actor->iwork[7] == 0) { - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); } func_8007D10C(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 1.5f); if (actor->unk_0E4 < 100) { @@ -1330,7 +1330,7 @@ void func_800319AC(Actor* this) { this->fwork[29] = 5.0f; this->fwork[7] = 360.0f; this->fwork[8] = 0.0f; - Audio_PlaySfx(0x09000002, this->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, this->sfxSource, 0); this->unk_046 = 0; } gTeamShields[this->unk_0E4] = -1; @@ -1354,13 +1354,13 @@ void func_800319AC(Actor* this) { (fabsf(this->obj.pos.z - D_800C9B50[this->unk_046].z) < 800.0f)) { this->unk_046++; if (this->unk_046 >= 4) { - Object_Kill(&this->obj, this->sfxPos); + Object_Kill(&this->obj, this->sfxSource); } } } else { this->fwork[5] = 20000.0f; if (this->obj.pos.y > 3000.0f) { - Object_Kill(&this->obj, this->sfxPos); + Object_Kill(&this->obj, this->sfxSource); } } sp104 = 2; diff --git a/src/main/fox_beam.c b/src/main/fox_beam.c index 6c82d2e9..f2489109 100644 --- a/src/main/fox_beam.c +++ b/src/main/fox_beam.c @@ -52,7 +52,7 @@ void func_80035E78(PlayerShot* shot) { shot->unk_5C = 1; shot->unk_64 = 30; shot->unk_58 = 150; - func_8001CE28(shot->playerNum, shot->sfxPos); + func_8001CE28(shot->playerNum, shot->sfxSource); D_Timer_80161A60 = 4; if (shot->obj.pos.y < (gGroundLevel + 450.0f)) { D_80178480 = 15; @@ -119,7 +119,7 @@ void func_80036318(PlayerShot* shot) { s32 i; if (shot->obj.id == PLAYERSHOT_4) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); return; } shot->obj.pos.z = D_80178498; // strange order on the globals @@ -172,7 +172,7 @@ void func_80036528(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 x effect->unk_46 = 80; effect->timer_50 = time; Object_SetInfo(&effect->info, effect->obj.id); - func_800A6070(effect->sfxPos, 0x29000000); + func_800A6070(effect->sfxSource, 0x29000000); } void func_800365E4(f32 xPos, f32 yPos, f32 zPos, f32 arg3, f32 arg4, f32 arg5, f32 yRot, f32 xRot, f32 scale, s32 unk44, @@ -201,7 +201,7 @@ void func_800366CC(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 s effect->scale2 = scale * 0.5f; effect->timer_50 = 80; Object_SetInfo(&effect->info, effect->obj.id); - func_800A6070(effect->sfxPos, 0x29000000); + func_800A6070(effect->sfxSource, 0x29000000); } void func_80036770(f32 xPos, f32 yPos, f32 zPos, f32 yRot, f32 scale) { @@ -294,7 +294,7 @@ s32 func_80036874(PlayerShot* shot, f32* hitboxData, Object* obj) { (fabsf(hitbox->x.offset + obj->pos.x - shotPx) < (hitbox->x.size + xySizeMod)) && (fabsf(hitbox->y.offset + obj->pos.y - shotPy) < (hitbox->y.size + xySizeMod))) { if (shot->obj.id == PLAYERSHOT_4) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); return 0; } if ((obj->id < 176) || (obj->id >= 292)) { @@ -602,7 +602,7 @@ bool func_8003774C(PlayerShot* shot, ObjectId objId, Object* obj) { if (!useCol2) { if (func_800998FC(&sp64, &sp58, &sp38, objId, &sp4C, sp44) > 0) { if (shot->obj.id == PLAYERSHOT_4) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); return false; } func_80036318(shot); @@ -625,7 +625,7 @@ bool func_8003774C(PlayerShot* shot, ObjectId objId, Object* obj) { } } else if (func_800A3690(&sp64, &sp58, objId, &sp4C)) { if (shot->obj.id == PLAYERSHOT_4) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); return false; } func_80036318(shot); @@ -705,7 +705,7 @@ void func_80037CF4(PlayerShot* shot, Actor* actor, s32 hitIndex) { shot->obj.pos.z += shot->vel.z * 5.0f; actor->timer_0C2 = 3; func_80078E50(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 8.0f); - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); func_800A668C(D_8017849C, D_801784A0, D_80178498); } } else { @@ -745,7 +745,7 @@ void func_80038140(PlayerShot* shot) { if (effect->info.unk_19 == 2) { effect->unk_44 = 1; } else { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -852,7 +852,7 @@ void func_80038140(PlayerShot* shot) { shot->obj.pos.y += 2.0f * shot->vel.y; shot->obj.pos.z += 2.0f * shot->vel.z; shot->unk_64 = 5; - Audio_PlaySfx(0x09007011, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09007011, player->sfxSource, 0); func_80078E50(player->pos.x, player->pos.y, player->unk_138, 8.0f); } else { func_80036318(shot); @@ -949,11 +949,11 @@ void func_80038140(PlayerShot* shot) { temp_fv0 = fabsf(boss->obj.pos.z - shot->obj.pos.z) * 0.8333333f; if (sqrtf(SQ(temp_fv1) + SQ(temp_fa0) + SQ(temp_fv0)) < 1500.0f) { if (shot->obj.id == PLAYERSHOT_4) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); } else { boss->dmgType = DMG_BEAM; func_80036318(shot); - Audio_PlaySfx(0x29001062, shot->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29001062, shot->sfxSource, 4); } } } else { @@ -963,11 +963,11 @@ void func_80038140(PlayerShot* shot) { temp_fv0 = fabsf(boss->obj.pos.z - shot->obj.pos.z); if (sqrtf(SQ(temp_fv1) + SQ(temp_fa0) + SQ(temp_fv0)) < 2700.0f) { if (shot->obj.id == PLAYERSHOT_4) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); } else { boss->dmgType = DMG_BEAM; boss->dmgPart = 100; - Audio_PlaySfx(0x29121007, shot->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, shot->sfxSource, 4); func_80036318(shot); } } @@ -975,7 +975,7 @@ void func_80038140(PlayerShot* shot) { temp_v0 = func_80036874(shot, boss->info.hitbox, &boss->obj); if (temp_v0 != 0) { if (shot->obj.id == PLAYERSHOT_4) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); } else if (!((boss->obj.id == OBJ_BOSS_316) && (shot->playerNum != 0))) { boss->dmgType = DMG_BEAM; if (shot->obj.id == PLAYERSHOT_3) { @@ -1035,7 +1035,7 @@ void func_80038F34(PlayerShot* shot) { } if (!sp48) { if (!gVersusMode) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); return; } } else { @@ -1217,7 +1217,7 @@ void func_80039A50(PlayerShot* shot) { } if (!sp104) { if ((shot->obj.id != PLAYERSHOT_3) && (shot->unk_64 < 10) && !gVersusMode) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); } } else { if ((shot->obj.id == PLAYERSHOT_5) || (shot->obj.id == PLAYERSHOT_6) || (shot->obj.id == PLAYERSHOT_7)) { @@ -1482,7 +1482,7 @@ void func_8003AF88(PlayerShot* shot) { void func_8003AFD8(PlayerShot* shot) { shot->unk_60++; if (shot->unk_60 > 2) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); } } @@ -1558,13 +1558,13 @@ void func_8003B00C(PlayerShot* shot, Player* player) { } if ((fabsf(shot->obj.pos.x - shot->unk_48) < 200.0f) && (fabsf(shot->obj.pos.y - shot->unk_4C) < 200.0f) && (fabsf(shot->obj.pos.z - shot->unk_50) < 200.0f)) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); return; } break; } if (shot->unk_64 == 0) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); } if (shot->unk_5C == 1) { if (shot->obj.pos.y < gGroundLevel) { @@ -1614,7 +1614,7 @@ void func_8003B55C(PlayerShot* shot, s32 index) { } } if (D_80161A88 == 2) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); return; } if (gCurrentLevel == LEVEL_FORTUNA) { @@ -1635,7 +1635,7 @@ void func_8003B55C(PlayerShot* shot, s32 index) { } } if (shot->unk_64 == 0) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); return; } else if ((shot->playerNum < 110) || (shot->unk_64 & 1)) { func_80038140(shot); @@ -1687,10 +1687,10 @@ bool func_8003BB4C(PlayerShot* shot) { (fabsf(shot->obj.pos.y - (actor->obj.pos.y + actor->info.unk_1C)) <= var_fa0) && (fabsf(shot->obj.pos.z - actor->obj.pos.z) <= var_fa0))) { actor->timer_0CA[shot->playerNum] = 20; - func_80060F30(gPlayer[shot->playerNum].sfxPos, 0x49008027, shot->playerNum); + func_80060F30(gPlayer[shot->playerNum].sfxSource, 0x49008027, shot->playerNum); for (j = 0; j < ARRAY_COUNT(gPlayerShots); j++) { if (gPlayerShots[j].obj.id == PLAYERSHOT_4) { - Object_Kill(&gPlayerShots[j].obj, gPlayerShots[j].sfxPos); + Object_Kill(&gPlayerShots[j].obj, gPlayerShots[j].sfxSource); } } D_801615B8[shot->playerNum] = 3.0f; @@ -1708,10 +1708,10 @@ bool func_8003BB4C(PlayerShot* shot) { D_80177B00[0][shot->playerNum] = D_80177B00[1][shot->playerNum] = D_80177B00[2][shot->playerNum] = D_80177B00[3][shot->playerNum] = 0; D_80177B00[i][shot->playerNum] = 20; - func_80060F30(gPlayer[shot->playerNum].sfxPos, 0x49008027, shot->playerNum); + func_80060F30(gPlayer[shot->playerNum].sfxSource, 0x49008027, shot->playerNum); for (j = 0; j < ARRAY_COUNT(gPlayerShots); j++) { if (gPlayerShots[j].obj.id == PLAYERSHOT_4) { - Object_Kill(&gPlayerShots[j].obj, gPlayerShots[j].sfxPos); + Object_Kill(&gPlayerShots[j].obj, gPlayerShots[j].sfxSource); } } D_801615B8[shot->playerNum] = 3.0f; @@ -1727,12 +1727,12 @@ void func_8003BEF4(PlayerShot* shot) { if (gVersusMode) { if ((shot->obj.pos.y < gGroundLevel) || func_8003BB4C(shot) || !(gControllerHold[shot->playerNum].button & A_BUTTON) || (shot->unk_64 == 0)) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); } } else { if ((shot->obj.pos.y < gGroundLevel) || func_8003BB4C(shot) || !(gControllerHold[gMainController].button & A_BUTTON) || (shot->unk_64 == 0)) { - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); } } func_80038140(shot); @@ -1932,7 +1932,7 @@ void func_8003C4D0(PlayerShot* shot, s32 damage) { sp60 = effect->obj.pos.z - shot->obj.pos.z; if (sqrtf(SQ(sp68) + SQ(sp64) + SQ(sp60)) < temp_fs2) { if (effect->info.unk_16 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } if (effect->info.unk_16 == 2) { effect->obj.pos.x += sp68 * 0.03f; @@ -2038,7 +2038,7 @@ void func_8003CC08(PlayerShot* shot) { shot->unk_58 -= 8; if (shot->unk_58 < 0) { shot->unk_58 = 0; - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); D_8017812C = 0; } } @@ -2219,7 +2219,7 @@ void func_8003D54C(PlayerShot* shot, s32 index) { } } } - Object_Kill(&shot->obj, shot->sfxPos); + Object_Kill(&shot->obj, shot->sfxSource); func_8007A6F0(&shot->obj.pos, 0x0903502E); } else if (gCurrentLevel == LEVEL_AQUAS) { func_i3_801ABA40(shot); @@ -2292,7 +2292,7 @@ void func_8003DA0C(void) { Matrix_Pop(&gGfxMatrix); } if (D_80161410 > 0) { - func_8005F290(gPlayerShots[i].sfxPos, &D_8015F950); + func_8005F290(gPlayerShots[i].sfxSource, &D_8015F950); } } } diff --git a/src/main/fox_bg.c b/src/main/fox_bg.c index a214151b..f9714035 100644 --- a/src/main/fox_bg.c +++ b/src/main/fox_bg.c @@ -1,4 +1,4 @@ -#include "prevent_bss_reordering.h" +// #include "prevent_bss_reordering.h" #include "global.h" extern f32 D_i3_801C4188; diff --git a/src/main/fox_boss.c b/src/main/fox_boss.c index eee3ee45..43c3c018 100644 --- a/src/main/fox_boss.c +++ b/src/main/fox_boss.c @@ -96,8 +96,8 @@ void func_80043188(Boss* boss) { } void func_8004319C(Player* player, f32 arg1, f32 arg2, f32 arg3) { - func_800182F4(0x105000FF); - func_800182F4(0x115000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 80); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 80); gCsFrameCount = 0; D_80178448 = arg3 + D_80177D20; diff --git a/src/main/fox_demo.c b/src/main/fox_demo.c index e4cadc15..2fed5c65 100644 --- a/src/main/fox_demo.c +++ b/src/main/fox_demo.c @@ -194,12 +194,12 @@ void func_80048CC4(Actor* actor, s32 arg1) { Object_SetInfo(&actor->info, actor->obj.id); if (arg1 == 3) { - Audio_PlaySfx(0x11030010U, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31024059U, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010U, actor->sfxSource, 0); + AUDIO_PLAY_SFX(0x31024059U, actor->sfxSource, 0); actor->unk_0B6 = 1; } else { actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } } @@ -225,7 +225,7 @@ void func_80048E40(Player* player) { switch (player->unk_1D0) { case 0: player->unk_4DC = 0; - func_8001A38C(1, player->sfxPos); + Audio_StopSfxByBankAndSource(1, player->sfxSource); player->unk_1D0++; D_80177A48[0] = 0.0f; D_80177A48[1] = 0.0f; @@ -286,7 +286,7 @@ void func_80048E40(Player* player) { break; case 450: - Audio_PlaySfx(0x09000002U, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0); player->unk_194 = 5.0f; player->unk_190 = 5.0f; @@ -300,7 +300,7 @@ void func_80048E40(Player* player) { player->unk_190 = 2.0f; if (gCsFrameCount == 530) { - func_8001DBD0(0x32); + Audio_FadeOutAll(50); } if (gCsFrameCount > 540) { @@ -377,7 +377,7 @@ void func_80049630(Actor* actor) { case 1: actor->state = 2; - Audio_PlaySfx(0x09000002U, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor->sfxSource, 0); actor->timer_0BC = 0x96; actor->fwork[29] = 5.0f; @@ -385,7 +385,7 @@ void func_80049630(Actor* actor) { actor->iwork[11] = 2; actor->fwork[0] += 2.0f; if (actor->timer_0BC == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -431,7 +431,7 @@ void func_80049968(Actor* actor, s32 arg1) { actor->vel.z = gPlayer[0].vel.z; Object_SetInfo(&actor->info, actor->obj.id); actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } void func_80049A9C(Effect* effect, f32 x, f32 y, f32 z) { @@ -541,7 +541,7 @@ void func_80049C0C(Player* player) { if (player->timer_1F8 <= 100) { if (player->timer_1F8 == 100) { - func_800A6028(player->sfxPos, 0x0940802AU); + func_800A6028(player->sfxSource, 0x0940802AU); player->unk_194 = 5.0f; player->unk_190 = 5.0f; } @@ -560,24 +560,24 @@ void func_80049C0C(Player* player) { if ((player->timer_1F8 == 0x5F) && (gTeamShields[1] > 0)) { gActors[0].state = var_v0; - Audio_PlaySfx(0x0940802AU, gActors[0].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x0940802AU, gActors[0].sfxSource, 0); } if ((player->timer_1F8 == 0x5A) && (gTeamShields[3] > 0)) { gActors[2].state = var_v0; - Audio_PlaySfx(0x0940802AU, gActors[2].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x0940802AU, gActors[2].sfxSource, 0); } if ((player->timer_1F8 == 85) && (gTeamShields[2] > 0)) { gActors[1].state = var_v0; - Audio_PlaySfx(0x0940802AU, gActors[1].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x0940802AU, gActors[1].sfxSource, 0); } if (player->timer_1F8 == 60) { gActors[3].state = var_v0; - Audio_PlaySfx(0x0940802AU, gActors[3].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + AUDIO_PLAY_SFX(0x0940802AU, gActors[3].sfxSource, 0); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); } if (player->timer_1F8 == 50) { @@ -608,7 +608,7 @@ void func_80049C0C(Player* player) { player->unk_234 = 1; D_8017827C = 1; D_800CA230 = 0.15f; - Audio_PlaySfx(0x11407079U, gDefaultSfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11407079U, gDefaultSfxSource, 0); func_800AB334(); } } @@ -636,8 +636,8 @@ void func_80049C0C(Player* player) { } if (player->timer_1F8 == 30) { - D_80178410 = 0x12C; - func_8001D444(0, 0x803AU, 0, 0xFFU); + D_80178410 = 300; + AUDIO_PLAY_BGM(SEQ_ID_58 | 0x8000); } if (player->timer_1F8 == 0) { @@ -757,7 +757,7 @@ void func_8004A700(Actor* actor, s32 arg1) { actor->obj.rot.z = D_800CA074[arg1]; actor->iwork[11] = 1; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } void func_8004A840(s32 actor) { @@ -833,13 +833,13 @@ void func_8004AAF4(Player* player) { D_80177E84 = 1; if (gCurrentLevel == LEVEL_VENOM_ANDROSS) { Radio_PlayMessage(gMsg_ID_19466, RCID_FOX); - func_8001D444(0, 0x803DU, 0, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_61 | 0x8000); } else if (gCurrentLevel != LEVEL_TRAINING) { Radio_PlayMessage(gMsg_ID_20180, RCID_FOX); if (gCurrentLevel == LEVEL_SECTOR_Y) { - func_8001D444(0, D_800C9E90[gCurrentLevel], 0, 2); + Audio_PlaySequence(SEQ_PLAYER_BGM, D_800C9E90[gCurrentLevel], 0, 2); } else { - func_8001D444(0, D_800C9E90[gCurrentLevel], 0, 0xFF); + AUDIO_PLAY_BGM(D_800C9E90[gCurrentLevel]); } } } @@ -858,7 +858,7 @@ void func_8004AAF4(Player* player) { switch (player->unk_1D0) { case 0: - func_8001ACDC(0); + Audio_PlayVoice(0); D_80177A48[0] = 0.005f; D_80177A48[1] = 0.0f; D_80177A48[2] = 60.0f; @@ -885,11 +885,11 @@ void func_8004AAF4(Player* player) { } if (gCsFrameCount == 0x8A) { - Audio_PlaySfx(0x09000007U, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000007U, player->sfxSource, 0); } if (gCsFrameCount == 0xBE) { - Audio_PlaySfx(0x09000013U, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000013U, player->sfxSource, 0); } if (D_80177A48[1] > 350.0f) { @@ -899,7 +899,7 @@ void func_8004AAF4(Player* player) { player->unk_194 = 10.0f; player->unk_190 = 10.0f; - Audio_PlaySfx(0x09000002U, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0); D_801779A8[player->num] = 70.0f; @@ -1307,7 +1307,7 @@ void func_8004B368(Player* player) { player->state_1C8 = PLAYERSTATE_1C8_6; player->timer_1F8 = 0; D_8017837C = 4; - func_8001DBD0(0xA); + Audio_FadeOutAll(10); D_800D3180[gCurrentLevel] = Play_CheckMedalStatus(150) + 1; } break; @@ -1325,9 +1325,9 @@ void func_8004B368(Player* player) { case 1255: player->unk_1D0 = 3; player->timer_1F8 = 0xA; - func_800A6028(player->sfxPos, 0x09000002U); - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + func_800A6028(player->sfxSource, 0x09000002U); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); break; } @@ -1421,7 +1421,7 @@ void func_8004C930(Player* player) { func_800AA800(player); } else { if (gCsFrameCount == 170) { - func_8001D444(0, 0x26U, 0, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_38); } func_8004B368(player); func_800AA800(player); @@ -1532,7 +1532,7 @@ void func_8004CCC0(Player* player) { player->unk_12C = -180.0f; } player->unk_1D0 = 3; - func_800A5FA0(player->sfxPos, 0x09000002U, player->num); + func_800A5FA0(player->sfxSource, 0x09000002U, player->num); player->unk_194 = 7.0f; player->unk_190 = 7.0f; } @@ -1629,8 +1629,8 @@ void func_8004D440(Player* player) { s32 teamId; func_8001CA24(player->num); - func_8001A55C(player->sfxPos, 0x0900C010U); - func_800A5FA0(player->sfxPos, 0x0903F004U, player->num); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x0900C010U); + func_800A5FA0(player->sfxSource, 0x0903F004U, player->num); player->state_1C8 = PLAYERSTATE_1C8_6; player->timer_1F8 = 0x46; player->timer_224 = 0x14; @@ -1745,7 +1745,7 @@ void func_8004D828(Player* player) { player->vel.y = 10.0f; player->unk_1D0 = 1; - func_800A6070(player->sfxPos, 0x29000000U); + func_800A6070(player->sfxSource, 0x29000000U); if ((gCurrentLevel == LEVEL_CORNERIA) || (gCurrentLevel == LEVEL_FORTUNA)) { func_80062C38(player->pos.x, player->pos.z); @@ -1854,7 +1854,7 @@ void func_8004DEF8(Player* player) { player->timer_220 = 0; player->vel.y = 10.0f; player->unk_1D0 = 1; - func_800A6070(player->sfxPos, 0x29000000U); + func_800A6070(player->sfxSource, 0x29000000U); if (gCurrentLevel == LEVEL_CORNERIA) { func_80062C38(player->pos.x, player->pos.z); } @@ -1964,7 +1964,7 @@ void func_8004E4D4(Actor* actor) { actor->state = 2; actor->timer_0BC = 0x32; actor->fwork[9] = 2.0f; - Audio_PlaySfx(0x09000002U, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor->sfxSource, 0); actor->fwork[29] = 5.0f; /* fallthrough */ @@ -1978,7 +1978,7 @@ void func_8004E4D4(Actor* actor) { actor->iwork[11] = 2; actor->fwork[9] *= 1.2f; if (actor->timer_0BC == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; @@ -1986,7 +1986,7 @@ void func_8004E4D4(Actor* actor) { actor->state = 0xB; actor->timer_0BC = 0x96; actor->timer_0BE = 0x28; - Audio_PlaySfx(0x09000002U, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor->sfxSource, 0); actor->fwork[29] = 5.0f; /* fallthrough */ case 11: @@ -2015,7 +2015,7 @@ void func_8004E4D4(Actor* actor) { } if (actor->timer_0BC == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; @@ -2041,7 +2041,7 @@ void func_8004E4D4(Actor* actor) { break; case 31: - Audio_PlaySfx(0x09000002U, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor->sfxSource, 0); actor->state += 1; actor->fwork[29] = 5.0f; /* fallthrough */ @@ -2126,7 +2126,7 @@ void func_8004EBD0(Actor* actor) { if (actor->timer_0BC == 0) { actor->state++; actor->timer_0BC = 10; - func_800A6028(actor->sfxPos, 0x09000002); + func_800A6028(actor->sfxSource, 0x09000002); actor->fwork[29] = 5.0f; } break; @@ -2161,7 +2161,7 @@ void func_8004EBD0(Actor* actor) { if (actor->timer_0BC == 0) { func_80078E50(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 30.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -2198,15 +2198,14 @@ void func_8004F05C(Actor* actor) { case 1: actor->state = 2; actor->timer_0BC = 0x64; - Audio_PlaySfx(0x09000002U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor->sfxSource, 0U); actor->fwork[29] = 5.0f; case 2: actor->iwork[11] = 2; actor->vel.z -= 5.0f; if (actor->timer_0BC == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -2214,14 +2213,14 @@ void func_8004F05C(Actor* actor) { case 31: if (actor->timer_0BC == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; case 32: actor->obj.rot.z += actor->unk_0F4.z; if (actor->timer_0BC == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; @@ -2249,13 +2248,13 @@ void func_8004F05C(Actor* actor) { } } } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; case 43: if (actor->timer_0BC == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -2350,7 +2349,7 @@ void func_8004F798(Actor* actor) { actor->fwork[29] = 10.0f; actor->vel.z -= 100.0f; if ((actor->obj.pos.z + D_80177D20) < -15000.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -2418,8 +2417,7 @@ void func_8004F8AC(Actor* actor) { actor->state = 1; actor->timer_0BC = 0x32; actor->iwork[0] = 255; - Audio_PlaySfx(0x2902F026U, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902F026U, actor->sfxSource, 0); } break; diff --git a/src/main/fox_display.c b/src/main/fox_display.c index 7ed8554b..ecb57b7d 100644 --- a/src/main/fox_display.c +++ b/src/main/fox_display.c @@ -69,7 +69,7 @@ void func_80051B30(void) { } switch (sp7C) { case 0: - if (D_800CA234->sfxPos[0] > 0.0f) { + if (D_800CA234->sfxSource[0] > 0.0f) { sp78 = 20.0f; sp74 = M_PI / 2; } else { @@ -1440,17 +1440,17 @@ void func_80057814(Player* player) { sp20.x = player->pos.x; sp20.y = player->pos.y; sp20.z = player->unk_138; - sp2C.x = player->sfxPos[0]; - sp2C.y = player->sfxPos[1]; - sp2C.z = player->sfxPos[2]; - func_8005F0E8(player->sfxPos, &sp20); - player->sfxVel[0] = player->sfxPos[0] - sp2C.x; - player->sfxVel[1] = player->sfxPos[1] - sp2C.y; - player->sfxVel[2] = player->sfxPos[2] - sp2C.z; - player->srcVel = player->sfxVel; - player->srcPos = player->sfxPos; - player->yVel = player->vel.y; - player->unk_490 = player->unk_0F8; + sp2C.x = player->sfxSource[0]; + sp2C.y = player->sfxSource[1]; + sp2C.z = player->sfxSource[2]; + func_8005F0E8(player->sfxSource, &sp20); + player->sfxVel[0] = player->sfxSource[0] - sp2C.x; + player->sfxVel[1] = player->sfxSource[1] - sp2C.y; + player->sfxVel[2] = player->sfxSource[2] - sp2C.z; + player->sfx.srcVel = player->sfxVel; + player->sfx.srcPos = player->sfxSource; + player->sfx.yVel = player->vel.y; + player->sfx.zRot = player->unk_0F8; } void func_800578C4(Player* player) { diff --git a/src/main/fox_edisplay.c b/src/main/fox_edisplay.c index 8be01c7f..314931a9 100644 --- a/src/main/fox_edisplay.c +++ b/src/main/fox_edisplay.c @@ -1,4 +1,4 @@ -#include "prevent_bss_reordering.h" +// #include "prevent_bss_reordering.h" #include "global.h" Vec3f D_801615D0; @@ -994,10 +994,10 @@ void Actor_Draw2(Actor* actor) { } if (actor->info.drawType == 0) { gSPDisplayList(gMasterDisp++, actor->info.dList); - func_8005F1EC(actor->sfxPos); + func_8005F1EC(actor->sfxSource); } else { actor->info.draw(&actor->obj); - func_8005F1EC(actor->sfxPos); + func_8005F1EC(actor->sfxSource); if (((actor->obj.id == OBJ_ACTOR_198) || ((actor->obj.id == OBJ_ACTOR_203) && (actor->unk_0B6 > 0))) && (D_80161410 > 0)) { Matrix_MultVec3f(gGfxMatrix, &sp34, &D_80177E98[actor->unk_0E4]); @@ -1090,7 +1090,7 @@ void Actor_Draw1(Actor* actor) { if (D_801615EC == 0) { actor->timer_0CA[gPlayerNum] = 0; if ((actor->obj.id == OBJ_ACTOR_189) || (actor->obj.id == OBJ_ACTOR_286)) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } for (var_v1 = 0; var_v1 < gCamCount; var_v1++) { @@ -1102,7 +1102,7 @@ void Actor_Draw1(Actor* actor) { } } } - func_8005F290(actor->sfxPos, &D_801615E0); + func_8005F290(actor->sfxSource, &D_801615E0); actor->iwork[24] = D_801615EC; } @@ -1122,7 +1122,7 @@ void Boss_Draw(Boss* boss, s32 arg1) { func_8005D1F0(&boss->obj, boss->info.drawType); } Matrix_MultVec3f(&D_801615F0, &sp30, &D_801615D0); - func_8005F290(boss->sfxPos, &D_801615D0); + func_8005F290(boss->sfxSource, &D_801615D0); if ((boss->obj.id == OBJ_BOSS_316) || (boss->obj.id == OBJ_BOSS_317)) { var_fa1 = 6000.0f; var_fv0 = 6000.0f; @@ -1218,9 +1218,9 @@ void Effect_Draw2(Effect* effect) { } } } - func_8005F290(effect->sfxPos, &sp40); + func_8005F290(effect->sfxSource, &sp40); if ((sp3B == 0) && (effect->obj.id != OBJ_EFFECT_352) && (effect->obj.id != OBJ_EFFECT_373) && (!gVersusMode)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -1250,10 +1250,10 @@ void Item_Draw(Item* item, s32 arg1) { } } } - func_8005F290(item->sfxPos, &sp38); + func_8005F290(item->sfxSource, &sp38); if ((var_v0 == 0) && (gLevelMode == LEVELMODE_ALL_RANGE) && (gCamCount == 1) && (item->obj.id < 336) && (gCurrentLevel != LEVEL_VENOM_ANDROSS)) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } } @@ -1531,9 +1531,9 @@ void Object_DrawAll(s32 arg0) { for (i = 0, obj58 = gObjects58; i < 200; i++, obj58++) { if ((obj58->obj.status == OBJ_ACTIVE) && (obj58->obj.id != OBJ_80_147)) { if (gCurrentLevel == LEVEL_BOLSE) { - spAC.x = obj58->sfxPos[0]; - spAC.y = obj58->sfxPos[1]; - spAC.z = obj58->sfxPos[2]; + spAC.x = obj58->sfxSource[0]; + spAC.y = obj58->sfxSource[1]; + spAC.z = obj58->sfxSource[2]; Matrix_MultVec3fNoTranslate(&D_i4_8019EE80, &spAC, &obj58->obj.pos); obj58->obj.rot.y = gBosses[0].obj.rot.y + (*obj58).unk_54; } @@ -1552,7 +1552,7 @@ void Object_DrawAll(s32 arg0) { Matrix_Push(&gGfxMatrix); Object_80_Draw(obj80, arg0); Matrix_Pop(&gGfxMatrix); - func_8005F1EC(obj80->sfxPos); + func_8005F1EC(obj80->sfxSource); } } } @@ -1672,7 +1672,7 @@ void func_8006046C(s32 arg0) { Matrix_Push(&gGfxMatrix); Effect_Draw1(effect, arg0); Matrix_Pop(&gGfxMatrix); - func_8005F1EC(effect->sfxPos); + func_8005F1EC(effect->sfxSource); if (effect->obj.id == OBJ_EFFECT_374) { Matrix_Push(&gGfxMatrix); func_8005ECD8(i, &effect->obj); diff --git a/src/main/fox_effect.c b/src/main/fox_effect.c index ec973a9e..f519693f 100644 --- a/src/main/fox_effect.c +++ b/src/main/fox_effect.c @@ -570,7 +570,7 @@ void func_80078EBC(Effect* effect) { effect->scale1 -= 0.25f; } if (effect->scale1 <= 0.0f) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -692,14 +692,14 @@ void func_80079618(f32 xPos, f32 yPos, f32 zPos, f32 scale2) { void func_8007968C(Effect* effect) { if ((gCurrentLevel != LEVEL_MACBETH) || (effect->unk_44 != 7)) { if ((effect->timer_50 == 0) || (effect->obj.pos.y < gGroundLevel)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } else { if (!(gGameFrameCount & 3)) { func_8007D2C8(effect->obj.pos.x, effect->obj.pos.y + 550.0f, effect->obj.pos.z, 10.0f); } if ((effect->timer_50 == 0) || (effect->obj.pos.y < (gGroundLevel - 100.0f))) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -920,7 +920,7 @@ void func_8007A28C(Effect* effect) { effect->unk_44 -= 2; if (effect->unk_44 < 0) { effect->unk_44 = 0; - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); D_8017812C = 0; } } @@ -951,7 +951,7 @@ void func_8007A4B8(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 scale1) { effect->obj.pos.y = yPos; effect->obj.pos.z = zPos; - Audio_PlaySfx(0x2940F026, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940F026, effect->sfxSource, 4); Object_SetInfo(&effect->info, effect->obj.id); } @@ -979,12 +979,12 @@ void func_8007A5F8(Effect* effect, Vec3f* pos, u32 sfxId) { effect->timer_50 = 50; if ((sfxId == 0x1903400F) || (sfxId == 0x11000055)) { - Audio_PlaySfx(sfxId, effect->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(sfxId, effect->sfxSource, 0); if (sfxId == 0x11000055) { effect->timer_50 = 300; } } else { - Audio_PlaySfx(sfxId, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(sfxId, effect->sfxSource, 4); } Object_SetInfo(&effect->info, effect->obj.id); } @@ -1002,7 +1002,7 @@ void func_8007A6F0(Vec3f* pos, s32 sfxId) { void func_8007A748(Effect* effect) { if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -1063,7 +1063,7 @@ void func_8007A994(Effect* effect) { effect->unk_44 -= effect->unk_46; if (effect->unk_44 < 0x15) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->unk_4A++; } @@ -1086,13 +1086,13 @@ void func_8007AB50(Effect* effect) { Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 10.0f, 0.0f); effect->unk_44 -= 20; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } else { Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 10.0f, 0.0f); effect->unk_44 -= 10; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -1199,7 +1199,7 @@ void func_8007B040(Effect* effect) { D_801782EC[sp28 - 1] = effect->scale1 * 0.7f; } if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -1208,7 +1208,7 @@ void func_8007B0F4(Effect* effect) { effect->unk_44 -= 13; effect->obj.rot.y = 180.0f - effect->obj.rot.y; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -1224,7 +1224,7 @@ void func_8007B180(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 scale1) { effect->unk_44 = 0xFF; effect->scale1 = scale1; Object_SetInfo(&effect->info, effect->obj.id); - Audio_PlaySfx(0x1100000C, effect->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1100000C, effect->sfxSource, 0); } void func_8007B228(f32 xPos, f32 yPos, f32 zPos, f32 scale1) { @@ -1287,7 +1287,7 @@ void func_8007B3B8(Effect* effect) { effect->unk_44 -= var_v0; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -1329,7 +1329,7 @@ void func_8007B5C0(Effect* effect) { Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 10.0f, 0.1f); effect->unk_44 -= effect->unk_46; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -1337,7 +1337,7 @@ void func_8007B62C(Effect* effect) { if (effect->timer_50 == 0) { effect->unk_46 -= 4; if (effect->unk_46 <= 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -1357,7 +1357,7 @@ void func_8007B67C(Effect* effect) { if (effect->unk_46 >= 9) { effect->unk_48++; if (effect->unk_48 >= 10) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -1376,7 +1376,7 @@ void func_8007B758(Effect* effect) { Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 10.0f, 0.1f); effect->unk_44 -= 2; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } func_8007A774(gPlayer, effect, effect->scale2 * 20.0f); } @@ -1419,7 +1419,7 @@ void func_8007B960(Effect* effect) { effect->scale2 += 0.07f; effect->unk_4A -= effect->unk_46; if (effect->unk_4A < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.z += effect->unk_48; effect->vel.y += 0.2f; @@ -1508,7 +1508,7 @@ void func_8007BCE8(Effect* effect) { effect->unk_4A -= effect->unk_46; if (effect->unk_4A < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.z += effect->unk_48; effect->vel.y += 0.2f; @@ -1518,7 +1518,7 @@ void func_8007BDE0(Effect* effect) { effect->scale2 += 0.04f; effect->unk_4A -= 2; if (effect->unk_4A < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.z += effect->unk_48; effect->vel.y += effect->scale1; @@ -1528,7 +1528,7 @@ void func_8007BE54(Effect* effect) { effect->scale2 += 0.02f; effect->unk_4A -= 3; if (effect->unk_4A < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->vel.z = gPlayer[0].vel.z + 7.0f; effect->obj.rot.z += effect->unk_48; @@ -1605,7 +1605,7 @@ void func_8007C1AC(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel, f for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { if (gEffects[i].obj.status == OBJ_FREE) { func_8007BF64(&gEffects[i], xPos, yPos, zPos, xVel, yVel, zVel, scale2, timer50); - func_800A6070(gEffects[i].sfxPos, 0x29000000); + func_800A6070(gEffects[i].sfxSource, 0x29000000); break; } } @@ -1633,7 +1633,7 @@ void func_8007C250(Effect* effect) { func_8007D0E0(effect->obj.pos.x + randX, effect->obj.pos.y + randY, effect->obj.pos.z, effect->scale2 * randOther); if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -1682,7 +1682,7 @@ void func_8007C50C(Effect* effect) { func_8007C484(effect->obj.pos.x + randX, effect->obj.pos.y + randY, effect->obj.pos.z, effect->vel.x, effect->vel.y, effect->vel.z, effect->scale2 * randOther, 0); if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -1774,7 +1774,7 @@ void func_8007C8C4(Effect* effect) { func_8007C85C(effect->obj.pos.x + randX, effect->obj.pos.y + randY, effect->obj.pos.z, effect->scale2 * randOther); if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -1784,7 +1784,7 @@ void func_8007C9E0(Effect* effect) { effect->scale2 *= 1.03f; effect->unk_4A -= 3; if (effect->unk_4A < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.z += effect->unk_48; effect->vel.y += 0.3f; @@ -1793,7 +1793,7 @@ void func_8007C9E0(Effect* effect) { effect->scale2 *= 1.03f; effect->unk_4A -= 7; if (effect->unk_4A < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.z += effect->unk_48; effect->vel.y += 0.3f; @@ -2000,7 +2000,7 @@ void func_8007D2F4(Effect* effect) { effect->timer_50 = 5; } if (effect->unk_4C > 20) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } else { @@ -2017,7 +2017,7 @@ void func_8007D2F4(Effect* effect) { effect->timer_50 = 2; } if (effect->unk_4C > 20) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -2026,7 +2026,7 @@ void func_8007D2F4(Effect* effect) { effect->unk_4C++; effect->timer_50 = effect->unk_46; if (effect->unk_4C > 13) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } effect->unk_44 -= 15; @@ -2103,7 +2103,7 @@ void func_8007D748(Effect* effect) { effect->unk_4C = effect->unk_4C + 2; } if (effect->unk_4C > 20) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } else { @@ -2111,7 +2111,7 @@ void func_8007D748(Effect* effect) { effect->unk_4C++; effect->timer_50 = 0; if (effect->unk_4C > 13) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } effect->unk_44 -= 15; @@ -2138,7 +2138,7 @@ void func_8007D8A8(Effect* effect) { effect->unk_4C++; effect->timer_50 = 2; if (effect->unk_4C >= 20) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } if (effect->unk_4C >= 16) { @@ -2180,7 +2180,7 @@ void func_8007DA58(Effect* effect) { } effect->obj.rot.y += effect->unk_60.y; if (effect->scale2 < 0.01f) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -2208,7 +2208,7 @@ void func_8007DB70(Effect* effect) { effect->unk_44 = 192; effect->scale2 = 2.5f; effect->scale1 = 2.5f; - Audio_PlaySfx(0x2903B009, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, effect->sfxSource, 4); func_8007D0E0(effect->obj.pos.x, effect->obj.pos.y + 30.0f, effect->obj.pos.z, 7.0f); func_8007BFFC(effect->obj.pos.x, effect->obj.pos.y + 30.0f, effect->obj.pos.z, 0.0f, 0.0f, 0.0f, 4.0f, 5); @@ -2226,7 +2226,7 @@ void func_8007DB70(Effect* effect) { effect->scale1 -= 0.3f; effect->unk_44 -= 20; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } effect->obj.rot.y = 180.0f - effect->obj.rot.y; @@ -2285,14 +2285,14 @@ void func_8007E014(Effect* effect) { (fabsf(effect->obj.pos.z - gEffects[i].obj.pos.z) < 20.0f) && (fabsf(effect->obj.pos.x - gEffects[i].obj.pos.x) < 20.0f) && (fabsf(effect->obj.pos.y - gEffects[i].obj.pos.y) < 20.0f)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } void func_8007E258(Effect* effect) { if ((gCamCount != 1) && (effect->timer_50 == 0)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -2301,7 +2301,7 @@ void func_8007E298(Effect* effect) { effect->scale2 *= 1.035f; effect->unk_4A -= 8; if (effect->unk_4A < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } effect->obj.rot.z += effect->unk_48; @@ -2324,7 +2324,7 @@ void func_8007E3E4(Effect* effect) { effect->scale2 += 0.02f; effect->unk_4A -= 4; if (effect->unk_4A < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.z += effect->unk_48; effect->vel.y += 0.05f; @@ -2338,7 +2338,7 @@ void func_8007E45C(Effect* effect) { effect->unk_44 -= 10; effect->obj.rot.z += effect->scale1; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; } @@ -2347,7 +2347,7 @@ void func_8007E45C(Effect* effect) { effect->unk_44 -= 1; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.z += effect->scale1; @@ -2360,7 +2360,7 @@ void func_8007E45C(Effect* effect) { effect->unk_44 -= 10; effect->obj.rot.z += effect->scale1; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; } @@ -2377,7 +2377,7 @@ void func_8007E648(Effect* effect) { Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.05f, 100.0f, 0.0f); effect->unk_44 -= 2; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -2422,7 +2422,7 @@ void func_8007E6B8(Effect* effect, u32 objId, f32 xPos, f32 yPos, f32 zPos, f32 } if (objId == OBJ_EFFECT_356) { - Audio_PlaySfx(0x31000025, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000025, effect->sfxSource, 4); } if (objId == OBJ_EFFECT_376) { @@ -2433,10 +2433,10 @@ void func_8007E6B8(Effect* effect, u32 objId, f32 xPos, f32 yPos, f32 zPos, f32 } if ((objId == OBJ_EFFECT_355) || (objId == OBJ_EFFECT_377)) { - Audio_PlaySfx(0x31000025, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000025, effect->sfxSource, 4); return; } - Audio_PlaySfx(0x29002002, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29002002, effect->sfxSource, 4); } void func_8007E93C(Effect* effect, u32 objId, f32 xPos, f32 yPos, f32 zPos, f32 arg5) { @@ -2479,7 +2479,7 @@ void func_8007E93C(Effect* effect, u32 objId, f32 xPos, f32 yPos, f32 zPos, f32 } if (objId == OBJ_EFFECT_356) { - Audio_PlaySfx(0x31000025, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000025, effect->sfxSource, 4); } if (objId == OBJ_EFFECT_376) { @@ -2490,10 +2490,10 @@ void func_8007E93C(Effect* effect, u32 objId, f32 xPos, f32 yPos, f32 zPos, f32 } if ((objId == OBJ_EFFECT_355) || (objId == OBJ_EFFECT_377)) { - Audio_PlaySfx(0x31000025, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000025, effect->sfxSource, 4); return; } - Audio_PlaySfx(0x29002002, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29002002, effect->sfxSource, 4); } void func_8007EBB8(Effect* effect, ObjectId objId, f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel, @@ -2514,9 +2514,9 @@ void func_8007EBB8(Effect* effect, ObjectId objId, f32 xPos, f32 yPos, f32 zPos, effect->scale2 = scale2; if (objId == OBJ_EFFECT_355) { - Audio_PlaySfx(0x31000025, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000025, effect->sfxSource, 4); } else { - Audio_PlaySfx(0x29002002, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29002002, effect->sfxSource, 4); } Object_SetInfo(&effect->info, effect->obj.id); } @@ -2561,7 +2561,7 @@ void func_8007ED54(Effect* effect, ObjectId objId, f32 xPos, f32 yPos, f32 zPos, effect->scale2 = scale2; if (effect->obj.id != OBJ_EFFECT_380) { - Audio_PlaySfx(0x29002002, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29002002, effect->sfxSource, 4); } Object_SetInfo(&effect->info, effect->obj.id); } @@ -2633,11 +2633,11 @@ void func_8007F20C(ObjectId objId, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { void func_8007F2FC(Effect* effect) { if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } if ((effect->obj.pos.y < gGroundLevel) && (gLevelType == LEVELTYPE_PLANET)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } if (gLevelType == LEVELTYPE_PLANET) { @@ -2680,7 +2680,7 @@ void func_8007F438(Effect* effect) { } if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } else { effect->obj.rot.z += 3.5f; @@ -2688,7 +2688,7 @@ void func_8007F438(Effect* effect) { effect->vel.y += 0.2f; } if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -2705,7 +2705,7 @@ void func_8007F5AC(Effect* effect) { if (!(gGameFrameCount & 1)) { effect->unk_44--; if (effect->unk_44 < 20) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -2733,7 +2733,7 @@ void func_8007F6B0(Effect* effect) { effect->unk_44 -= 2; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } if (!(gGameFrameCount & 3) && (effect->state == 0)) { @@ -2779,7 +2779,7 @@ void func_8007F958(Effect* effect) { effect->unk_44 -= 9; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); return; } @@ -2821,7 +2821,7 @@ void func_8007FBE0(Effect* effect) { effect->unk_44 -= 6; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } if (!(gGameFrameCount & 1)) { @@ -2868,12 +2868,12 @@ void func_8007FE88(Effect* effect) { f32 var_fa0 = 0.0f; if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); return; } if (func_8007FD84(effect) != 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); return; } @@ -2897,7 +2897,7 @@ void func_8007FE88(Effect* effect) { effect->vel.y = destVelocity.y; effect->vel.z = destVelocity.z; gPlayer[0].unk_2C4 += 1; - Audio_PlaySfx(0x09007011, effect->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09007011, effect->sfxSource, 0); } if ((gPlayer[0].unk_280 == 0) && (gPlayer[0].timer_498 == 0)) { @@ -2912,17 +2912,17 @@ void func_8007FE88(Effect* effect) { gPlayer[0].unk_0D8.y *= -1.0f; } } - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } if (D_801784AC == 4) { if (func_i5_801B6AEC(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z + D_80177D20) != 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } else if (effect->obj.pos.y < gGroundLevel) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); if (D_80161A88 != 2) { effect->obj.pos.y = gGroundLevel; func_8007D074(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 2.0f); @@ -2936,11 +2936,11 @@ void func_8007FE88(Effect* effect) { if (gCurrentLevel != LEVEL_MACBETH) { if (func_8006351C(1000, &effect->obj.pos, &velocity, 2) != 0) { func_8007D10C(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 2.0f); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } else if (func_i5_801A55D4(1000, &effect->obj.pos, &velocity, 0) != 0) { func_8007D10C(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 2.0f); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -3001,12 +3001,12 @@ void func_8008040C(Effect* effect) { case 1: effect->obj.rot.z = 360.0f - effect->obj.rot.z; if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); return; } if (func_8007FD84(effect) != 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); return; } @@ -3030,7 +3030,7 @@ void func_8008040C(Effect* effect) { effect->vel.y = destVelocity.y; effect->vel.z = destVelocity.z; gPlayer[0].unk_2C4++; - Audio_PlaySfx(0x09007011, effect->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09007011, effect->sfxSource, 0); } if ((gPlayer[0].unk_280 == 0) && (gPlayer[0].timer_498 == 0)) { @@ -3043,16 +3043,16 @@ void func_8008040C(Effect* effect) { if (effect->vel.y < 0.0f) { gPlayer[0].unk_0D8.y *= -1.0f; } - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } if (D_801784AC == 4) { if (func_i5_801B6AEC(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z + D_80177D20) != 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } else if (effect->obj.pos.y < gGroundLevel) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); if (D_80161A88 != 2) { effect->obj.pos.y = gGroundLevel; func_8007D074(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 2.0f); @@ -3065,7 +3065,7 @@ void func_8008040C(Effect* effect) { if (func_8006351C(1000, &effect->obj.pos, &sp3C, 2) != 0) { func_8007D10C(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 2.0f); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } break; @@ -3119,7 +3119,7 @@ void func_80080ACC(Effect* effect) { effect->unk_48 = 0xFF; } if (effect->unk_48 < 0x20) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; @@ -3129,7 +3129,7 @@ void func_80080ACC(Effect* effect) { effect->vel.y += 0.2f; effect->unk_44 += effect->unk_46; if (effect->unk_44 < 10) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; @@ -3138,7 +3138,7 @@ void func_80080ACC(Effect* effect) { effect->obj.rot.y += effect->unk_60.y; effect->obj.rot.z += effect->unk_60.z; if ((effect->unk_44 == 0) && (effect->obj.pos.y < gGroundLevel)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } if (effect->unk_44 != 0) { effect->unk_44--; @@ -3194,7 +3194,7 @@ void func_80080D04(Effect* effect) { } if (alpha < 32) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } else { gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, alpha); gSPDisplayList(gMasterDisp++, effect->unk_74); @@ -3394,7 +3394,7 @@ void func_8008165C(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 scale2, s32 case 10: effect->timer_50 = 10; - Audio_PlaySfx(0x31405094, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31405094, effect->sfxSource, 4); break; case 11: @@ -3415,7 +3415,7 @@ void func_8008165C(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 scale2, s32 effect->obj.pos.y = yPos; effect->obj.pos.z = zPos; - Audio_PlaySfx(0x2940F026, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940F026, effect->sfxSource, 4); D_Timer_80177BD0[0] = 60; break; } @@ -3509,7 +3509,7 @@ void func_80081C5C(Effect* effect) { switch (effect->state) { case 0: if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); break; } @@ -3522,14 +3522,14 @@ void func_80081C5C(Effect* effect) { if (func_8006351C(effect->index, &effect->obj.pos, &velocity, 1) != 0) { func_8007B344(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 3.0f, 7); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } sp84 = 50.0f; break; case 1: if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); break; } @@ -3548,14 +3548,14 @@ void func_80081C5C(Effect* effect) { } if (func_8006351C(effect->index, &effect->obj.pos, &velocity, 1) != 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); func_8007D0E0(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 1.0f); } break; case 2: if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); break; } @@ -3574,7 +3574,7 @@ void func_80081C5C(Effect* effect) { case 3: Math_SmoothStepToF(&effect->scale2, 0.0f, 0.1f, 10.0f, 0.0001f); if (effect->scale2 < 0.3f) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; } @@ -3587,7 +3587,7 @@ void func_80081C5C(Effect* effect) { } if (func_8006351C(effect->index, &effect->obj.pos, &velocity, 1) != 0) { func_8007B344(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 3.0f, 7); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } sp84 = 50.0f; break; @@ -3595,11 +3595,11 @@ void func_80081C5C(Effect* effect) { case 3: effect->info.unk_19 = 2; if (effect->unk_44 != 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); func_8007D0E0(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 5.0f); } else if (fabsf(gPlayer[0].unk_138 - effect->obj.pos.z) < 1000.0f) { func_8006F0D8(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 15.0f); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } sp84 = 50.0f; break; @@ -3610,7 +3610,7 @@ void func_80081C5C(Effect* effect) { effect->obj.rot.z += 3.0f; effect->vel.y += 0.2f; if (effect->unk_4A < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; @@ -3622,7 +3622,7 @@ void func_80081C5C(Effect* effect) { effect->obj.rot.z += effect->unk_44; effect->vel.y -= 2.0f; if ((effect->unk_4A < 0) || (effect->timer_50 == 0)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; @@ -3630,7 +3630,7 @@ void func_80081C5C(Effect* effect) { effect->unk_4A -= effect->unk_46; Math_SmoothStepToF(&effect->scale2, 0.0f, 0.1f, 1.0f, 0.00001f); if ((effect->unk_4A < 0) || (effect->timer_50 == 0)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; @@ -3645,7 +3645,7 @@ void func_80081C5C(Effect* effect) { effect->obj.rot.z += effect->unk_60.z; effect->vel.y -= 0.5f; if ((effect->timer_50 == 0) || (effect->obj.pos.y < gGroundLevel)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; @@ -3666,7 +3666,7 @@ void func_80081C5C(Effect* effect) { effect->obj.pos.z)) || (effect->timer_50 == 0)) { func_8007B228(effect->obj.pos.x, posYOut, effect->obj.pos.z, effect->scale2); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; } @@ -3727,7 +3727,7 @@ void func_80081C5C(Effect* effect) { if (effect->timer_50 == 0) { Math_SmoothStepToF(&effect->scale2, 0.0f, 1.0f, 10.0f, 0.00001f); if (effect->scale2 == 0.0f) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } else { Math_SmoothStepToF(&effect->scale2, 8.0f, 0.1f, 1.0f, 0.00001f); @@ -3761,7 +3761,7 @@ void func_80081C5C(Effect* effect) { Math_SmoothStepToF(&effect->vel.z, -70.0f, 0.01f, 0.1f, 0.0f); Math_SmoothStepToF(&effect->scale2, 0.0f, 0.1f, 0.5f, 0.00001f); if (effect->scale2 == 0.0f) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; @@ -3853,7 +3853,7 @@ void func_80081C5C(Effect* effect) { Math_SmoothStepToF(&effect->scale1, 0.0f, 0.1f, 100.0f, 0.00001f); if ((effect->scale1 < 1.0f) || (effect->timer_50 == 0)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; @@ -4065,7 +4065,7 @@ void func_800837EC(Effect* effect) { Math_SmoothStepToF(&effect->unk_60.x, effect->scale2 * 1.3f, 0.1f, 0.5f, 0.0001f); effect->unk_44 -= 35; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; } @@ -4154,7 +4154,7 @@ void func_80083D2C(f32 xPos, f32 yPos, f32 zPos, f32 srcZ) { if (gEffects[j].obj.status == OBJ_FREE) { func_80083C70(&gEffects[j], xPos, yPos, zPos, dest.x, dest.y, dest.z, i * 60.0f, i); if (i == 0) { - Audio_PlaySfx(0x3103109B, gEffects[j].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3103109B, gEffects[j].sfxSource, 4); } break; } @@ -4167,7 +4167,7 @@ void func_80083FA8(Effect* effect) { Vec3f dest; if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); return; } diff --git a/src/main/fox_enmy.c b/src/main/fox_enmy.c index 88562c1e..418d0f92 100644 --- a/src/main/fox_enmy.c +++ b/src/main/fox_enmy.c @@ -63,15 +63,15 @@ void func_80060F30(f32* pos, u32 sfxId, s32 arg2) { (void) "center_X %f\n"; (void) "Enm->obj.pos.x %f\n"; if (!gVersusMode) { - Audio_PlaySfx(sfxId, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(sfxId, gDefaultSfxSource, 4); } else { - Audio_PlaySfx(sfxId, pos, arg2, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(sfxId, pos, arg2); } } void Object_Kill(Object* obj, f32* sfxSrc) { obj->status = OBJ_FREE; - Audio_KillSfx(sfxSrc); + Audio_KillSfxBySource(sfxSrc); } bool func_80060FE4(Vec3f* arg0, f32 arg1) { @@ -996,10 +996,10 @@ void Object_Init(s32 index, ObjectId objId) { func_8007A6F0(&gObjects4C[index].obj.pos, 0x11000055); break; case OBJ_ACTOR_234: - Audio_PlaySfx(0x11030010, gActors[index].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, gActors[index].sfxSource, 0); break; case OBJ_80_54: - Audio_PlaySfx(0x11000000, gObjects80[index].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11000000, gObjects80[index].sfxSource, 0); break; case OBJ_ACTOR_198: func_80092D48(&gActors[index]); @@ -1112,7 +1112,7 @@ void Object_Init(s32 index, ObjectId objId) { break; case OBJ_ACTOR_252: if (gPlayer[0].pos.z < gActors[index].obj.pos.z) { - Object_Kill(&gActors[index].obj, gActors[index].sfxPos); + Object_Kill(&gActors[index].obj, gActors[index].sfxSource); } break; case OBJ_ACTOR_239: @@ -1154,7 +1154,7 @@ void Object_Init(s32 index, ObjectId objId) { break; case OBJ_ACTOR_190: case OBJ_ACTOR_191: - Audio_PlaySfx(0x31000012, gActors[index].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000012, gActors[index].sfxSource, 4); break; case OBJ_ACTOR_192: gActors[index].unk_0C9 = 1; @@ -1206,7 +1206,7 @@ void Object_Init(s32 index, ObjectId objId) { /* fallthrough */ case OBJ_ACTOR_176: gActors[index].health = 24; - Audio_PlaySfx(0x31000016, gActors[index].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000016, gActors[index].sfxSource, 4); break; case OBJ_BOSS_297: func_i2_80188A40(&gBosses[index]); @@ -1527,7 +1527,7 @@ void func_800656D4(Actor* actor) { gActors[spC4].unk_0D4 = 2; func_8007A6F0(&actor->obj.pos, 0x2903A008); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 5.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } Math_Vec3fFromAngles(&sp98, actor->obj.rot.x, actor->obj.rot.y, actor->fwork[5]); @@ -1553,7 +1553,7 @@ void func_800656D4(Actor* actor) { } if ((D_801784AC == 4) && func_i5_801B6AEC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + D_80177D20)) { func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 5.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } sp8C.x = actor->vel.x; sp8C.y = actor->vel.y; @@ -1561,7 +1561,7 @@ void func_800656D4(Actor* actor) { if ((func_8006351C(actor->index, &actor->obj.pos, &sp8C, 1) != 0) || (actor->unk_0D0 != 0) || (actor->obj.pos.y < (gGroundLevel + 10.0f)) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7)) { func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 3.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); if (actor->unk_0D0 != 0) { actor->unk_044 = 2; if ((gCurrentLevel == LEVEL_CORNERIA)) { @@ -1583,7 +1583,7 @@ void func_800656D4(Actor* actor) { actor->iwork[10] = 1; } if (gPlayer[0].camEye.z < (actor->obj.pos.z + D_80177D20)) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } } @@ -1608,10 +1608,10 @@ void func_800660F0(Actor* actor) { } if ((item->obj.id >= OBJ_ITEM_GOLD_RING) || (item->obj.id == OBJ_ITEM_1UP)) { item->unk_50 = 90.0f; - Audio_PlaySfx(0x4900000C, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900000C, gDefaultSfxSource, 4); item->timer_48 = 1000; if (item->obj.id == OBJ_ITEM_WING_REPAIR) { - Audio_PlaySfx(0x1900302B, item->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900302B, item->sfxSource, 0); } } break; @@ -1666,7 +1666,7 @@ void func_80066254(Actor* actor) { } } func_800660F0(actor); - Audio_PlaySfx(0x4900000C, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900000C, gDefaultSfxSource, 4); } else if (actor->unk_044 == 24) { if (gTeamShields[3] > 0) { Radio_PlayMessage(gMsg_ID_20261, RCID_PEPPY); @@ -1735,7 +1735,7 @@ void func_8006654C(Actor* actor) { actor->vel.z = -15.0f; actor->gravity = 0.5f; func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y + 30.0f, actor->obj.pos.z, 13.0f); - Audio_PlaySfx(0x2903A008, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903A008, actor->sfxSource, 4); } } @@ -1747,10 +1747,10 @@ void func_8006684C(Actor* actor) { actor->vel.x = 0.0f; actor->vel.y = 0.0f; if (actor->timer_0BE == 1) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); actor->unk_044 = 1; func_80066254(actor); - Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 4); BonusText_Display(actor->obj.pos.x, actor->obj.pos.y + 250.0f, actor->obj.pos.z, 3); gHitCount += 3; D_80177850 = 15; @@ -1768,7 +1768,7 @@ void func_8006684C(Actor* actor) { void func_800669A0(Actor* actor) { if (actor->timer_0BC != 0) { if (actor->timer_0BC == 1) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } else { actor->obj.rot.y += 5.0f; @@ -1828,7 +1828,7 @@ void func_80066D5C(Object_80* obj80) { case 1: func_80066C00(obj80); obj80->state++; - Audio_PlaySfx(0x2900300F, obj80->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900300F, obj80->sfxSource, 4); break; case 2: obj80->vel.x += 0.05f; @@ -1839,7 +1839,7 @@ void func_80066D5C(Object_80* obj80) { func_80066A8C(obj80); obj80->state = 0; D_80178480 = 25; - Audio_PlaySfx(0x19130003, obj80->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19130003, obj80->sfxSource, 4); } break; case 0: @@ -1868,7 +1868,7 @@ void func_80066EF0(Item* item) { f32 var_fa1; if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_0)) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } if ((gLevelMode == LEVELMODE_ON_RAILS) && (D_80161680 == 0)) { var_fa1 = 900.0f; @@ -1999,7 +1999,7 @@ void func_8006753C(Actor* actor) { RAND_FLOAT_CENTERED(40.0f)); func_800794CC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 0.6f); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } gUnkEntities28[63].unk_00 = 1; @@ -2028,7 +2028,7 @@ void func_80067874(Actor* actor) { } void func_80067A40(void) { - Audio_PlaySfx(0x09008023, gPlayer[0].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09008023, gPlayer[0].sfxSource, 0); if (gPlayer[0].wings.rightState <= WINGSTATE_BROKEN) { D_80177D40[0] = 1050; gPlayer[0].wings.rightState = WINGSTATE_INTACT; @@ -2048,14 +2048,14 @@ void func_80067B1C(Item* item) { func_80066EF0(item); func_800671D0(item); if (item->collected) { - Object_Kill(&item->obj, item->sfxPos); - func_80060F30(gPlayer[item->playerNum].sfxPos, 0x4900C024, item->playerNum); + Object_Kill(&item->obj, item->sfxSource); + func_80060F30(gPlayer[item->playerNum].sfxSource, 0x4900C024, item->playerNum); if (gCurrentLevel != LEVEL_TRAINING) { gLifeCount[item->playerNum]++; } } if (item->timer_48 == 1) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } } @@ -2072,8 +2072,8 @@ void func_80067BEC(Item* item) { item->timer_48 = 20; item->unk_50 = 60.0f; gBombCount[item->playerNum]++; - func_80060F30(gPlayer[item->playerNum].sfxPos, 0x49002005, item->playerNum); - func_80060F30(gPlayer[item->playerNum].sfxPos, 0x49002006, item->playerNum); + func_80060F30(gPlayer[item->playerNum].sfxSource, 0x49002005, item->playerNum); + func_80060F30(gPlayer[item->playerNum].sfxSource, 0x49002006, item->playerNum); } break; case OBJ_ITEM_LASERS: @@ -2087,7 +2087,7 @@ void func_80067BEC(Item* item) { if (gLaserStrength[item->playerNum] > LASERS_HYPER) { gLaserStrength[item->playerNum] = LASERS_HYPER; } - func_80060F30(gPlayer[item->playerNum].sfxPos, 0x49002004, item->playerNum); + func_80060F30(gPlayer[item->playerNum].sfxSource, 0x49002004, item->playerNum); if (gExpertMode) { gRightWingHealth[item->playerNum] = gLeftWingHealth[item->playerNum] = 10; } else { @@ -2108,7 +2108,7 @@ void func_80067BEC(Item* item) { } item->obj.pos.z += (gPlayer[item->playerNum].unk_138 - item->obj.pos.z) * 0.5f; if (item->timer_48 == 0) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } } } @@ -2119,7 +2119,7 @@ void func_80067F6C(Item* item) { item->obj.id = OBJ_ITEM_WING_REPAIR; Object_SetInfo(&item->info, item->obj.id); item->timer_48 = 2000; - Audio_PlaySfx(0x1900302B, item->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900302B, item->sfxSource, 0); } else { func_80067BEC(item); } @@ -2139,13 +2139,13 @@ void func_80068020(Item* item) { item->timer_48 = 50; if (item->obj.id == OBJ_ITEM_SILVER_RING) { gPlayer[item->playerNum].heal += 0x20; - func_80060F30(gPlayer[item->playerNum].sfxPos, 0x4900200E, item->playerNum); + func_80060F30(gPlayer[item->playerNum].sfxSource, 0x4900200E, item->playerNum); } else if (item->obj.id == OBJ_ITEM_GOLD_RING) { gGoldRingCount[0]++; if (gGoldRingCount[0] == 3) { - func_80060F30(gPlayer[item->playerNum].sfxPos, 0x49008015, item->playerNum); + func_80060F30(gPlayer[item->playerNum].sfxSource, 0x49008015, item->playerNum); } else if (gGoldRingCount[0] == 6) { - func_80060F30(gPlayer[item->playerNum].sfxPos, 0x4900C024, item->playerNum); + func_80060F30(gPlayer[item->playerNum].sfxSource, 0x4900C024, item->playerNum); if (gCurrentLevel != LEVEL_TRAINING) { gLifeCount[item->playerNum]++; } @@ -2154,15 +2154,15 @@ void func_80068020(Item* item) { gPlayer[item->playerNum].unk_138, BONUS_TEXT_1UP); } else { gPlayer[item->playerNum].heal += 0x20; - func_80060F30(gPlayer[item->playerNum].sfxPos, 0x49003013, item->playerNum); + func_80060F30(gPlayer[item->playerNum].sfxSource, 0x49003013, item->playerNum); } } else { gPlayer[item->playerNum].heal += 0x80; - func_80060F30(gPlayer[item->playerNum].sfxPos, 0x4900200D, item->playerNum); + func_80060F30(gPlayer[item->playerNum].sfxSource, 0x4900200D, item->playerNum); } } if ((item->obj.id == OBJ_ITEM_GOLD_RING) && (item->timer_48 == 1)) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } break; case 1: @@ -2186,7 +2186,7 @@ void func_80068020(Item* item) { Math_SmoothStepToAngle(&item->obj.rot.y, Math_RadToDeg(-gPlayer[item->playerNum].unk_058), 0.2f, 10.0f, 0.0f); if (item->timer_48 == 0) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } if (item->scale > 0.3f) { Matrix_RotateY(gCalcMatrix, item->obj.rot.y * M_DTOR, 0); @@ -2214,10 +2214,10 @@ void func_80068618(Item* item) { func_800671D0(item); if (item->collected) { func_80067A40(); - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } if (item->timer_48 == 1) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } } @@ -2236,7 +2236,7 @@ void func_80068688(Item* item) { } item->unk_44 -= 10; if (item->unk_44 < 0) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } } else { item->scale = 100.0f; @@ -2247,8 +2247,7 @@ void func_80068688(Item* item) { item->state = 1; item->unk_44 = 255; gPlayer[item->playerNum].timer_27C = 100; - Audio_PlaySfx(D_800CFF54[D_80177E80], gPlayer[0].sfxPos, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(D_800CFF54[D_80177E80], gPlayer[0].sfxSource, 0); if (D_80177E80 == 0) { gPlayer[0].unk_110 = 0.0f; } @@ -2256,7 +2255,7 @@ void func_80068688(Item* item) { if (D_80177E80 >= 7) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_8; gPlayer[0].unk_1D0 = 0; - Audio_PlaySfx(0x1900602A, gDefaultSfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900602A, gDefaultSfxSource, 0); D_80177930 = 2; D_800D3180[gCurrentLevel] = 1; } @@ -2288,7 +2287,7 @@ void func_80068914(Item* item) { Math_SmoothStepToF(&item->unk_54, 4.0f, 0.1f, 0.2f, 0.01f); } if (item->scale <= 6.5f) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } } else { item->unk_44 = 2; @@ -2308,14 +2307,14 @@ void func_80068914(Item* item) { for (i = 1; i < 4; i++) { gSavedTeamShields[i] = gTeamShields[i]; } - Audio_PlaySfx(0x4900400F, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900400F, gDefaultSfxSource, 4); } } } void func_80068C48(Item* item) { if (item->collected) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); D_80177E80++; } } @@ -2323,15 +2322,15 @@ void func_80068C48(Item* item) { void func_80068C88(Item* item) { D_80161680 = item->obj.id; if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_3) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } else if (((gCurrentLevel == LEVEL_METEO) || (gCurrentLevel == LEVEL_SECTOR_X)) && (D_8017827C == 1)) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_7; gPlayer[0].unk_1D0 = 0; - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } else if (gCurrentLevel == LEVEL_TRAINING) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_9; gPlayer[0].unk_1D0 = 0; - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } else if (item->state == 0) { if (((item->obj.pos.z + D_80177D20) > -2700.0f) && (fabsf(item->obj.pos.x - gPlayer[0].pos.x) < 1000.0f)) { switch (item->obj.id) { @@ -2351,7 +2350,7 @@ void func_80068C88(Item* item) { } } if (item->collected) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); gPlayer[0].unk_0B4 = 0.0f; gPlayer[0].timer_210 = item->scale * 0.05f; switch (item->obj.id) { @@ -2436,11 +2435,11 @@ void func_800690D0(s32 index, ObjectId objId) { func_i2_80187B08(&gActors[index]); break; case OBJ_ACTOR_181: - Object_Kill(&gActors[index].obj, gActors[index].sfxPos); + Object_Kill(&gActors[index].obj, gActors[index].sfxSource); func_8007D2C8(gActors[index].obj.pos.x, gActors[index].obj.pos.y, gActors[index].obj.pos.z, 20.0f); break; case OBJ_ACTOR_182: - Object_Kill(&gActors[index].obj, gActors[index].sfxPos); + Object_Kill(&gActors[index].obj, gActors[index].sfxSource); func_8007D2C8(gActors[index].obj.pos.x, gActors[index].obj.pos.y, gActors[index].obj.pos.z, 10.0f); func_80066254(&gActors[index]); break; @@ -2480,7 +2479,7 @@ void func_800693E8(Actor* actor) { ((gPlayer[0].unk_0B0 + var_fv0) < actor->obj.pos.y) || ((gPlayer[0].unk_0AC + var_fv0) < actor->obj.pos.x) || (actor->obj.pos.x < (gPlayer[0].unk_0AC - var_fv0))) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); switch (actor->obj.id) { case OBJ_ACTOR_236: D_801784A4 = 0; @@ -2513,7 +2512,7 @@ void func_80069658(Boss* boss) { boss->vel.y -= boss->gravity; if ((D_80161AB8 != 0) && ((boss->obj.pos.z + D_80177D20) > (boss->info.unk_10 - gPlayer[0].camEye.z))) { if (gPlayer[0].camEye.z) {} // fake - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); } } @@ -2521,7 +2520,7 @@ void func_800696F8(Object_80* obj80) { if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_2) { obj80->obj.pos.z += obj80->unk_60; if (obj80->info.unk_10 < obj80->obj.pos.z) { - Object_Kill(&obj80->obj, obj80->sfxPos); + Object_Kill(&obj80->obj, obj80->sfxSource); } } else if ((gLevelMode == LEVELMODE_ON_RAILS) && (gBossActive != 2)) { f32 temp_fv0 = fabsf(obj80->obj.pos.x - gPlayer[0].camEye.x); @@ -2536,7 +2535,7 @@ void func_800696F8(Object_80* obj80) { } temp_fv0 -= gPlayer[0].camEye.z; if ((obj80->info.unk_10 - temp_fv0) < (obj80->obj.pos.z + D_80177D20)) { - Object_Kill(&obj80->obj, obj80->sfxPos); + Object_Kill(&obj80->obj, obj80->sfxSource); } } } @@ -2564,10 +2563,10 @@ void func_80069924(Effect* effect) { effect->obj.pos.z += effect->vel.z; if (D_80161AB8 != 0) { if ((gPlayer[0].camEye.z + effect->info.unk_10) < (effect->obj.pos.z + D_80177D20)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } else if ((fabsf(effect->obj.pos.y - gPlayer[0].camEye.y) > 25000.0f) || (fabsf(effect->obj.pos.x - gPlayer[0].camEye.x) > 25000.0f)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -2577,7 +2576,7 @@ void func_80069A10(Item* item) { f32 temp = (0.0f - gPlayer[0].camEye.z); if ((item->info.unk_10 - temp) < (item->obj.pos.z + D_80177D20)) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); if ((item->obj.id == OBJ_ITEM_METEO_WARP) && (item->state == 0)) { D_80177E80 = -1; } diff --git a/src/main/fox_enmy2.c b/src/main/fox_enmy2.c index 02af1506..d706b385 100644 --- a/src/main/fox_enmy2.c +++ b/src/main/fox_enmy2.c @@ -197,14 +197,14 @@ void func_8006AD18(Actor* actor) { func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y + 180.0f, actor->obj.pos.z, 10.0f); func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y + 180.0f, actor->obj.pos.z, actor->vel.x, actor->vel.y, actor->vel.z, 8.0f, 30); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A008); gHitCount += actor->info.bonus; D_80177850 = 15; } else { actor->unk_0D0 = 0; actor->timer_0C6 = 20; - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); func_8007D1E0(actor->obj.pos.x, actor->obj.pos.y + 180.0f, actor->obj.pos.z, 5.0f); } } @@ -259,11 +259,11 @@ void func_8006B0A0(Actor* actor) { D_80176B98[actor->unk_046][temp_hi], 4.0f); } - Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 4); actor->unk_04A++; if (actor->unk_04A > 15) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); D_80176550[actor->unk_046] = 0; gHitCount += actor->info.bonus; D_80177850 = 15; @@ -334,7 +334,7 @@ void func_8006B95C(Object_80* obj80) { if (obj80->obj.pos.y < gGroundLevel + 40.0f) { obj80->obj.pos.y = gGroundLevel + 40.0f; - Audio_PlaySfx(0x19130003, obj80->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19130003, obj80->sfxSource, 0); obj80->state = 2; obj80->vel.y = 0.0f; } @@ -461,7 +461,7 @@ void func_8006BB78(Actor* actor) { if ((actor->unk_0D0 != 0) && (actor->unk_0B6 != 0)) { func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 0.0f, actor->vel.y, 0.0f, 3.0f, 5); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); actor->unk_044 = 1; func_80066254(actor); } @@ -512,12 +512,10 @@ void func_8006C008(Actor* actor) { if (actor->unk_04A & 4) { switch (actor->unk_046) { case 2: - Audio_PlaySfx(0x19000024, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000024, actor->sfxSource, 4); break; case 25: - Audio_PlaySfx(0x29003031, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x29003031, actor->sfxSource, 4); break; } } @@ -596,7 +594,7 @@ void func_8006C008(Actor* actor) { if ((actor->iwork[1] == 1) && ((actor->unk_048 == 8) || (actor->unk_048 == 9))) { func_8007D2C8(actor->obj.pos.x, sp48 + 20.0f, actor->obj.pos.z, 8.0f); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; @@ -610,7 +608,7 @@ void func_8006C008(Actor* actor) { (actor->obj.pos.y < (gGroundLevel + 10.0f))) && (actor->timer_0BE == 0)) { func_8007B8F8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 50.0f, actor->scale * 10.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A008); } break; @@ -621,7 +619,7 @@ void func_8006C008(Actor* actor) { (actor->obj.pos.y < (gGroundLevel + 10.0f))) && (actor->timer_0BE == 0)) { func_8007B8F8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 50.0f, actor->scale * 10.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A008); } break; @@ -642,7 +640,7 @@ void func_8006C008(Actor* actor) { (actor->obj.pos.y < (gGroundLevel + 10.0f))) && (actor->timer_0BE == 0)) { func_8007B8F8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 50.0f, actor->scale * 10.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A008); } break; @@ -653,7 +651,7 @@ void func_8006C008(Actor* actor) { (actor->timer_0BE == 0)) { func_8007B8F8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 70.0f, actor->scale * 20.0f); func_8007B8F8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 70.0f, actor->scale * 20.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A008); } break; @@ -670,7 +668,7 @@ void func_8006C008(Actor* actor) { actor->vel.x *= -0.7f; } if (actor->obj.pos.y < gGroundLevel) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; @@ -716,26 +714,26 @@ void func_8006C008(Actor* actor) { if (actor->state == 0x46) { if ((actor->timer_0BC == 0) || (func_8006351C(actor->index, &actor->obj.pos, &D_800D0030, 1) != 0) || (actor->obj.pos.y < (gGroundLevel + 10.0f))) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } else if (actor->state == 0x27) { if (((actor->timer_0BC == 0) || (func_8006351C(actor->index, &actor->obj.pos, &D_800D0030, 1) != 0) || (actor->obj.pos.y < (gGroundLevel + 10.0f))) && (actor->timer_0BE == 0)) { func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A008); } } else if (((actor->state >= 0x29) && (actor->state < 0x2D)) || (actor->state == 0x3B)) { if (((actor->timer_0BC == 0) || (func_8006351C(actor->index, &actor->obj.pos, &D_800D0030, 1) != 0)) && (actor->timer_0BE == 0)) { func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 2.0f * actor->scale); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A008); } if (func_800A73E4(&sp44, &sp40, actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z)) { func_8007B228(actor->obj.pos.x, sp44, actor->obj.pos.z, 2.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } else if (actor->state >= 0xA) { if (!(actor->timer_0BC & 3)) { @@ -746,7 +744,7 @@ void func_8006C008(Actor* actor) { (actor->timer_0BE == 0)) { func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, actor->vel.x, actor->vel.y, actor->vel.z, actor->scale * 1.5f, 4); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A008); } } else { @@ -757,7 +755,7 @@ void func_8006C008(Actor* actor) { (actor->obj.pos.y < (gGroundLevel + 10.0f))) { if (gLevelType == LEVELTYPE_SPACE) { func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 2.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); return; } @@ -766,7 +764,7 @@ void func_8006C008(Actor* actor) { actor->iwork[0]++; if (actor->iwork[0] >= 2) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } if ((actor->state != 2) && (actor->state != 4)) { @@ -783,14 +781,14 @@ void func_8006C008(Actor* actor) { if (actor->state == 4) { if ((gCurrentLevel == LEVEL_KATINA) && (actor->timer_0BC == 0)) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } else { if (actor->timer_0BC & 1) { func_8007D24C(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 1.0f); } if ((gLevelType == LEVELTYPE_SPACE) && (actor->timer_0BC == 0)) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } } @@ -1035,7 +1033,7 @@ void func_8006D36C(Actor* actor) { break; case 0xD000: - Audio_KillSfx(actor->sfxPos); + Audio_KillSfxBySource(actor->sfxSource); actor->unk_0B4 = temp_s1[actor->unk_0E6 + 1]; if (actor->unk_0B4 == 40) { @@ -1070,15 +1068,14 @@ void func_8006D36C(Actor* actor) { D_80176B98[i][j] = actor->obj.pos.z; } if (actor->unk_0B4 == 200) { - Audio_PlaySfx(0x11032049, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x11032049, actor->sfxSource, 4); } break; } } if (actor->unk_046 == 100) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -1093,10 +1090,10 @@ void func_8006D36C(Actor* actor) { if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3) { if (actor->unk_0B4 == 86) { - func_8001D4AC(0x36, 0x14, 0xA, 0xA); + Audio_PlayFanfare(SEQ_ID_54, 20, 10, 10); } if (actor->unk_0B4 == 85) { - func_8001D4AC(0x37, 0x14, 0xA, 0xA); + Audio_PlayFanfare(SEQ_ID_55, 20, 10, 10); } } @@ -1128,27 +1125,26 @@ void func_8006D36C(Actor* actor) { case 1: if ((gCurrentLevel != LEVEL_SOLAR) && (actor->unk_0B4 != 6) && ((gCurrentLevel != LEVEL_CORNERIA) || (actor->unk_0B4 != 8))) { - Audio_PlaySfx(0x31000011, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000011, actor->sfxSource, 4); } break; case 2: - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); break; case 3: - Audio_PlaySfx(0x11030010, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, actor->sfxSource, 0); break; case 4: - Audio_PlaySfx(0x31012039, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31012039, actor->sfxSource, 4); break; case 5: - Audio_PlaySfx(0x1900302B, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900302B, actor->sfxSource, 0); break; case 6: - Audio_PlaySfx(0x31000014, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000014, actor->sfxSource, 4); break; case 7: - Audio_PlaySfx(0x31000015, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000015, actor->sfxSource, 4); break; } @@ -1232,7 +1228,7 @@ void func_8006D36C(Actor* actor) { break; case 0xEC00: - func_8001D400(temp_s1[actor->unk_0E6 + 1]); + Audio_SetBaseSfxReverb(temp_s1[actor->unk_0E6 + 1]); actor->unk_0E6 += 2; func_8006D36C(actor); break; @@ -1248,7 +1244,7 @@ void func_8006D36C(Actor* actor) { case 0xEE00: if ((D_80161A88 == 2) && (temp_s1[actor->unk_0E6 + 1] != 2)) { - func_8001A55C(gPlayer[0].sfxPos, 0x1100000B); + Audio_KillSfxBySourceAndId(gPlayer[0].sfxSource, 0x1100000B); } D_80161A88 = temp_s1[actor->unk_0E6 + 1]; actor->unk_0E6 += 2; @@ -1270,20 +1266,20 @@ void func_8006D36C(Actor* actor) { break; case 0x7400: - func_8001D2FC(actor->sfxPos, temp_s1[actor->unk_0E6 + 1]); + func_8001D2FC(actor->sfxSource, temp_s1[actor->unk_0E6 + 1]); actor->unk_0E6 += 2; func_8006D36C(actor); break; case 0x7600: - func_8001D3A0(actor->sfxPos, temp_s1[actor->unk_0E6 + 1]); + func_8001D3A0(actor->sfxSource, temp_s1[actor->unk_0E6 + 1]); actor->unk_0E6 += 2; func_8006D36C(actor); break; case 0xF400: - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); actor->unk_0E6 += 2; func_8006D36C(actor); break; @@ -1557,7 +1553,7 @@ void func_8006EAC4(Effect* effect, f32 xPos, f32 yPos, f32 zPos) { effect->timer_50 = 20; Object_SetInfo(&effect->info, effect->obj.id); - Audio_PlaySfx(0x2900201D, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900201D, effect->sfxSource, 4); } void func_8006EB64(f32 xPos, f32 yPos, f32 zPos) { @@ -1582,7 +1578,7 @@ void func_8006EBC0(Actor* actor, f32 xPos, f32 yPos, f32 zPos) { Object_SetInfo(&actor->info, actor->obj.id); actor->info.unk_16 = 2; - Audio_PlaySfx(0x2900201D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900201D, actor->sfxSource, 4); } void func_8006EC60(f32 xPos, f32 yPos, f32 zPos) { @@ -1626,17 +1622,17 @@ void func_8006ECBC(PlayerShotId objId, PlayerShot* shot, s32 unk0E4, f32 xPos, f if (gLevelMode == LEVELMODE_ALL_RANGE) { if (unk0E4 + 100 < 104) { - Audio_PlaySfx(0x2900000D, shot->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900000D, shot->sfxSource, 4); } else { - Audio_PlaySfx(0x29002002, shot->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29002002, shot->sfxSource, 4); } } else if ((unk0E4 < 60) && (gActors[unk0E4].obj.id == OBJ_ACTOR_200) && (gActors[unk0E4].iwork[12] > 0)) { - Audio_PlaySfx(0x2900000D, shot->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900000D, shot->sfxSource, 4); } else if (unk0E4 + 100 == 200) { shot->playerNum = 100; - Audio_PlaySfx(0x19030037, shot->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19030037, shot->sfxSource, 0); } else { - Audio_PlaySfx(0x29002002, shot->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29002002, shot->sfxSource, 4); } } @@ -1836,7 +1832,7 @@ void func_8006F40C(Actor* actor) { } else { func_8006F0D8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 40.0f); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; case 10: @@ -1845,20 +1841,20 @@ void func_8006F40C(Actor* actor) { } else { func_8006F0D8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 15.0f); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; case 11: func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, actor->vel.x, actor->vel.y, actor->vel.z, actor->scale * 3.0f, 15); func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903B009); break; case 12: func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; case 13: @@ -1937,8 +1933,8 @@ void func_8006FE28(Actor* actor) { (fabsf(actor->obj.pos.y - gPlayer[0].pos.y) < 100.0f) && (fabsf(actor->obj.pos.z - gPlayer[0].unk_138) < 50.0f)) { func_80067A40(); - func_8001A55C(actor->sfxPos, 0x1900302B); - Object_Kill(&actor->obj, actor->sfxPos); + Audio_KillSfxBySourceAndId(actor->sfxSource, 0x1900302B); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -1957,11 +1953,11 @@ void func_8006FEEC(Actor* actor) { } actor->unk_044 = 0; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x29018036); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 4.0f); } else { - Audio_PlaySfx(0x29033037, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29033037, actor->sfxSource, 4); } } } @@ -2031,9 +2027,9 @@ void func_800701E0(Actor* actor) { if (actor->unk_0B4 != 83) { if ((actor->unk_0B4 == 6) && (gCurrentLevel == LEVEL_SOLAR)) { - Audio_PlaySfx(0x29018036, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29018036, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x2903700B, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903700B, actor->sfxSource, 4); } actor->obj.status = OBJ_DYING; @@ -2121,18 +2117,18 @@ void func_800701E0(Actor* actor) { } if (actor->unk_0B4 == 0x52) { - Audio_PlaySfx(0x11000055, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11000055, actor->sfxSource, 0); actor->unk_0D0 = 1; func_8007C688(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 3.0f, 0x3C); } } else { actor->timer_0C6 = 20; if ((actor->unk_0B4 == 6) && (gCurrentLevel == LEVEL_SOLAR)) { - Audio_PlaySfx(0x29033037, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29033037, actor->sfxSource, 4); } else if (actor->health < 20) { - Audio_PlaySfx(0x2943500F, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2943500F, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); } if ((actor->unk_0B4 != 0xD) && (actor->unk_0B4 != 0x3D) && (actor->unk_0B4 != 0x53)) { @@ -2217,14 +2213,14 @@ void func_80070BA8(Actor* actor) { func_8007C120(actor->unk_0D8.x, actor->unk_0D8.y, actor->unk_0D8.z, actor->vel.x, actor->vel.y, actor->vel.z, 0.2f, 10); actor->health -= actor->damage; - Audio_PlaySfx(0x29033064, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29033064, actor->sfxSource, 4); if (actor->health <= 0) { BonusText_Display(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, actor->info.bonus); gHitCount += actor->info.bonus + 1; D_80177850 = 15; } } else { - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } } } @@ -2786,7 +2782,7 @@ void func_80071DC0(Actor* actor) { } if (!(gGameFrameCount & 0xF)) { - Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 4); } actor->vel.y -= 0.1f; @@ -2822,9 +2818,9 @@ void func_800720E8(Actor* actor) { if (actor->health <= 0) { actor->unk_046 = 1; actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6032408); - Audio_PlaySfx(0x1900000D, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900000D, actor->sfxSource, 0); } else { - Audio_PlaySfx(0x2903300E, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 0); } actor->unk_0D0 = 0; } @@ -2929,7 +2925,7 @@ void func_80072594(Actor* actor) { Vec3f spA0; if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) || (D_8017828C != 0)) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); return; } @@ -2968,7 +2964,7 @@ void func_80072594(Actor* actor) { actor->timer_0C6 = 20; actor->health -= actor->damage; - Audio_PlaySfx(0x29034041, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034041, actor->sfxSource, 4); if (actor->health <= 0) { actor->timer_0C6 = 200; @@ -3359,9 +3355,9 @@ void func_80072594(Actor* actor) { (actor->unk_0B4 != 0x31) && (actor->unk_0B4 != 0x32)) { actor->unk_0D0 = 0; if (gCurrentLevel == LEVEL_METEO) { - Audio_PlaySfx(0x2902107D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902107D, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } } @@ -3404,8 +3400,7 @@ void func_80072594(Actor* actor) { spF0 = 350.0f; if (!(gGameFrameCount & 3)) { func_8007240C(actor->obj.pos.x, spEC, actor->obj.pos.z, actor->obj.rot.y); - Audio_PlaySfx(0x19800017, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19800017, actor->sfxSource, 4); } } @@ -4113,7 +4108,7 @@ void func_800763A4(Actor* actor) { actor->vel.y = 0.0f; if (actor->timer_0BE == 1) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_80066254(actor); if (gLevelMode == LEVELMODE_ALL_RANGE) { diff --git a/src/main/fox_game.c b/src/main/fox_game.c index 18ada9a9..7bec4e8f 100644 --- a/src/main/fox_game.c +++ b/src/main/fox_game.c @@ -106,7 +106,7 @@ void Game_SetGameState(void) { D_80178348 = D_80178350 = D_80178354 = 255; } else { D_80178348 = D_80178350 = D_80178354 = 0; - func_8001DBD0(1); + Audio_FadeOutAll(1); } D_80178340 = 255; D_80178380[0] = 0; @@ -114,8 +114,8 @@ void Game_SetGameState(void) { D_80178428 = 0.0f; gBlurAlpha = 255; gDrawMode = DRAWMODE_0; - func_8001AE58(); - func_8001D400(0); + Audio_ClearVoice(); + Audio_SetBaseSfxReverb(0); } bool func_800A1B6C(void) { @@ -425,7 +425,7 @@ void Game_Update(void) { var_v0_3 = 0; break; } - func_800182F4(var_v0_3 | 0xE0000000); + Audio_QueueSeqCmd(var_v0_3 | 0xE0000000); gVolumeSettings[0] = gSaveFile.save.data.musicVolume; gVolumeSettings[1] = gSaveFile.save.data.voiceVolume; gVolumeSettings[2] = gSaveFile.save.data.sfxVolume; diff --git a/src/main/fox_hud.c b/src/main/fox_hud.c index fcadbc72..24dc9f3a 100644 --- a/src/main/fox_hud.c +++ b/src/main/fox_hud.c @@ -852,7 +852,7 @@ void func_80086DCC(void) { } if ((D_80177840 == 92) || (D_80177840 == 87) || (D_80177840 == 82) || (D_80177840 == 77)) { - Audio_PlaySfx(0x49008031U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49008031U, gDefaultSfxSource, 4U); } } else { if (D_80177840 <= 100) { @@ -879,9 +879,9 @@ void func_80086DCC(void) { if ((D_80177840 == 80) || (D_80177840 == 72) || (D_80177840 == 64) || (D_80177840 == 56)) { if (!boolTemp) { - Audio_PlaySfx(0x49008034U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49008034U, gDefaultSfxSource, 4U); } else { - Audio_PlaySfx(0x49008031U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49008031U, gDefaultSfxSource, 4U); } } } @@ -1108,7 +1108,7 @@ void func_80087B5C(void) { f32 y6; if (D_80177830 == 0) { - func_8001A838(0x41007012U); + Audio_KillSfxById(0x41007012U); D_801617C0[0] = 0; } @@ -1138,20 +1138,20 @@ void func_80087B5C(void) { if (((gTeamShields[1] > 0) && (gTeamShields[1] < 255)) && ((gTeamShields[2] > 0) && (gTeamShields[2] < 255)) && ((gTeamShields[3] > 0) && (gTeamShields[3] < 255))) { - Audio_PlaySfx(0x41007012U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x41007012U, gDefaultSfxSource, 4U); } D_801617C0[0] = 2; case 2: if ((D_801617C0[5] == 0) && (D_801617C0[4] == 0)) { - func_8001A838(0x41007012U); + Audio_KillSfxById(0x41007012U); D_801617C0[0] = 3; D_801617E8[0] = 30; break; } if (D_801617C0[5] > 0) { - Audio_PlaySfx(0x49004007U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49004007U, gDefaultSfxSource, 4U); if (D_801617C0[5] >= 100) { D_801617C0[5] -= 100; @@ -1190,7 +1190,7 @@ void func_80087B5C(void) { if ((D_801617C0[i] == 0) || (temp == 0)) { D_801617C0[4] = 0; - func_8001A838(0x41007012U); + Audio_KillSfxById(0x41007012U); } } break; @@ -1209,7 +1209,7 @@ void func_80087B5C(void) { D_801617C0[0]++; } else { if (!(gGameFrameCount & 1)) { - Audio_PlaySfx(0x4900C024U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900C024U, gDefaultSfxSource, 4U); D_801617C0[3]++; } } @@ -1481,7 +1481,7 @@ void func_80088970(void) { D_80161838[0] = 0; if (((ret > 0) && (D_80161810[1] == 1)) || ((ret < 0) && (D_80161810[1] == 0))) { D_80161810[1] ^= 1; - Audio_PlaySfx(0x49000002U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002U, gDefaultSfxSource, 4U); } } @@ -1510,7 +1510,7 @@ void func_80088970(void) { } func_8001CA24(gPlayer[0].num); - func_8001AE58(); + Audio_ClearVoice(); gRadioState = 0; @@ -1875,7 +1875,7 @@ void func_80089D28(void) { if ((gb == 10) || (gb == 0)) { // clang-format off //! FAKE: Probably a MACRO - if (1) {Audio_PlaySfx(0x4900001c, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb);} + if (1) {AUDIO_PLAY_SFX(0x4900001c, gDefaultSfxSource, 4);} // clang-format on } @@ -2307,7 +2307,7 @@ void func_8008B044(void) { return; } - Audio_PlaySfx(0x49002018, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49002018, gDefaultSfxSource, 4); if (D_800CFF90 != 0) { func_8001AF40(1); @@ -2320,7 +2320,7 @@ void func_8008B044(void) { D_80161790++; if (D_80161790 >= 7) { if (D_80161794 & 1) { - Audio_PlaySfx(0x49002018, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49002018, gDefaultSfxSource, 4); } D_80161790 = 0; D_80161794++; @@ -2330,7 +2330,7 @@ void func_8008B044(void) { D_800CFF90 = 0; D_80161790 = 0; D_80161798 = 0; - func_8001A838(0x49002018); + Audio_KillSfxById(0x49002018); } break; } @@ -3125,7 +3125,7 @@ void func_8008DE68(void) { if ((gShowBossHealth == 1) && (gTeamShields[2] > 0)) { if ((gBossHealthBar >= 0) && (D_801616BC == -1.0f)) { - Audio_PlaySfx(0x4900C028, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900C028, gDefaultSfxSource, 4); D_801616BC = 255.0f; } @@ -3769,10 +3769,10 @@ s32 func_80090200(Boss* boss) { switch (boss->swork[1]) { case 0: - Audio_PlaySfx(0x11000011U, boss->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x3140402EU, boss->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + AUDIO_PLAY_SFX(0x11000011U, boss->sfxSource, 0U); + AUDIO_PLAY_SFX(0x3140402EU, boss->sfxSource, 0U); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); player->camEye.x = boss->fwork[4] = boss->obj.pos.x; player->camEye.y = boss->fwork[5] = boss->obj.pos.y + 500.0f; @@ -3980,7 +3980,7 @@ bool func_80090A00(Actor* actor) { actor->fwork[4] = gPlayer[0].pos.x - 1000.0f; actor->iwork[2]++; if (actor->iwork[2] == actor->iwork[3]) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -4163,7 +4163,7 @@ bool func_80091368(Actor* actor) { } if (actor->obj.pos.y > 3000.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -4363,7 +4363,7 @@ bool func_80091CF8(Actor* actor) { if (actor->iwork[1] != 0) { if (actor->fwork[10] < 0.1f) { actor->fwork[10] = 20.0f; - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); actor->fwork[29] = 5.0f; } actor->iwork[1] = 0; @@ -4412,7 +4412,7 @@ bool func_80091F00(Actor* actor) { } actor->timer_0C6 = 20; - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); func_8007D10C(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 1.5f); Matrix_RotateY(gCalcMatrix, actor->unk_0F4.y * M_DTOR, 0); @@ -4744,14 +4744,14 @@ void func_80092D48(Actor* actor) { actor->unk_0C9 = 1; } - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); if (((D_800D1970 & 3) == 2) && (gCurrentLevel == LEVEL_SECTOR_X)) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } if (gTeamShields[actor->unk_0E4] <= 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -4890,7 +4890,7 @@ void func_80093310(void) { if (1) {} this->obj.id = OBJ_ACTOR_195; Object_SetInfo(&this->info, this->obj.id); - Audio_PlaySfx(0x11030010, this->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, this->sfxSource, 0); } void func_800933D8(f32 x, f32 y, f32 z, f32 arg3) { @@ -5160,7 +5160,7 @@ void func_800935E8(Player* player) { func_i3_801BDF14(); - func_8001D444(0U, 0x2DU, 0U, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_45); case 3: D_8017835C = 16; @@ -5194,7 +5194,7 @@ void func_800935E8(Player* player) { } if (player->timer_1F8 == 774) { - Audio_PlaySfx(0x01038026U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x01038026U, player->sfxSource, 0U); D_80177A10[9] = 40; } @@ -5293,7 +5293,7 @@ void func_800935E8(Player* player) { D_80177AC8 = 0; D_80178358 = 0; - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); player->camEye.z = gCsCamEyeZ = 800.0f; player->camAt.z = gCsCamAtZ = 0.0f; @@ -5331,9 +5331,9 @@ void func_800935E8(Player* player) { player->timer_1F8 = 0; D_80178488 = 1; - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); - func_8001D444(0U, 0xEU, 0U, 0xFFU); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); + AUDIO_PLAY_BGM(SEQ_ID_14); } func_i3_801AC8A8(player->pos.x + RAND_FLOAT_CENTERED(10.0f), player->pos.y + RAND_FLOAT_CENTERED(10.0f), @@ -5401,7 +5401,7 @@ void func_80094954(Effect* effect) { } if ((effect->state == 1) && (effect->unk_4A <= 0)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->vel.y += effect->scale1; @@ -5429,7 +5429,7 @@ void func_80094954(Effect* effect) { if ((effect->unk_4A < 0) || ((player->state_1C8 == PLAYERSTATE_1C8_2) && (gCurrentLevel == LEVEL_AQUAS) && (player->unk_1D0 == 5))) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.z += effect->unk_48; } @@ -5926,14 +5926,14 @@ void func_80095604(Player* player) { D_800D3180[LEVEL_AQUAS] = Play_CheckMedalStatus(150) + 1; player->state_1C8 = PLAYERSTATE_1C8_6; player->timer_1F8 = 0; - func_8001DBD0(10); + Audio_FadeOutAll(10); D_8017837C = 4; } } if (gCsFrameCount == 1310) { - func_800182F4(0x105000FF); - func_800182F4(0x115000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 80); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 80); } break; @@ -5947,7 +5947,7 @@ void func_80095604(Player* player) { break; case 400: - func_8001D444(0U, 0x26U, 0U, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_38); break; case 440: @@ -6114,7 +6114,7 @@ void func_80096A74(Player* player) { player->unk_190 = player->unk_194 = 10.0f; player->unk_1D0 = 2; D_80177A48[1] = 400.0f; - Audio_PlaySfx(0x09004002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09004002U, player->sfxSource, 0U); } break; diff --git a/src/main/fox_load.c b/src/main/fox_load.c index 7786dd77..3c741358 100644 --- a/src/main/fox_load.c +++ b/src/main/fox_load.c @@ -100,7 +100,7 @@ u8 Overlay_Load(u8 ovlSetup, u8 ovlStage) { case OVL_SETUP_TITLE: changeOvl = Overlay_Init(&sOvlmenu_Title[ovlStage]); if (changeOvl == true) { - func_8001DC6C(0, 0x16); + Audio_SetAudioSpec(0, 0x16); } break; case OVL_SETUP_MENU: @@ -175,13 +175,13 @@ u8 Overlay_Load(u8 ovlSetup, u8 ovlStage) { case OVL_SETUP_VERSUS: changeOvl = Overlay_Init(&sOvli2_Versus[ovlStage]); if (changeOvl == true) { - func_8001DC6C(3, 0x310); + Audio_SetAudioSpec(3, 0x310); } break; case OVL_SETUP_LOGO: changeOvl = Overlay_Init(&sNoOvl_Logo[ovlStage]); // Logo does not load an overlay file if (changeOvl == true) { - func_8001DC6C(0, 0xE); + Audio_SetAudioSpec(0, 0xE); } break; case OVL_SETUP_CREDITS: diff --git a/src/main/fox_play.c b/src/main/fox_play.c index fa83f1dd..5f1f032d 100644 --- a/src/main/fox_play.c +++ b/src/main/fox_play.c @@ -233,11 +233,11 @@ void func_800A4C40(Player* player) { if ((sp30.y < gGroundLevel + 80.0f) || (sp3C.y < gGroundLevel + 80.0f)) { if (D_80161A64 == 0) { D_80161A64 = 1; - Audio_PlaySfx(0x1100000B, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1100000B, player->sfxSource, 0); } } else { D_80161A64 = 0; - func_8001A55C(player->sfxPos, 0x1100000B); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x1100000B); } } } @@ -476,8 +476,8 @@ void func_800A594C(void) { if (D_8017782C == 0) { if (gCurrentLevel == LEVEL_SOLAR) { func_8001D1C8(0xFF, 1); - Audio_PlaySfx(0x4100C023, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_8001A55C(gPlayer[0].sfxPos, 0x3140807E); + AUDIO_PLAY_SFX(0x4100C023, gDefaultSfxSource, 4); + Audio_KillSfxBySourceAndId(gPlayer[0].sfxSource, 0x3140807E); } } else if (gCurrentLevel == LEVEL_AQUAS) { sEnvSettings = SEGMENTED_TO_VIRTUAL(D_602E584); @@ -551,18 +551,18 @@ void func_800A5EBC(void) { void func_800A5FA0(f32* sfxSrc, u32 sfxId, s32 mode) { if (!gVersusMode) { - Audio_PlaySfx(sfxId, sfxSrc, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(sfxId, sfxSrc, 0); } else { - Audio_PlaySfx(sfxId, sfxSrc, mode, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(sfxId, sfxSrc, mode); } } void func_800A6028(f32* sfxSrc, u32 sfxId) { - Audio_PlaySfx(sfxId, sfxSrc, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(sfxId, sfxSrc, 0); } void func_800A6070(f32* sfxSrc, u32 sfxId) { - Audio_PlaySfx(sfxId, sfxSrc, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(sfxId, sfxSrc, 4); } void BonusText_Initialize(BonusText* bonus) { @@ -606,30 +606,30 @@ void func_800A6148(void) { func_800A60E8(&gUnkEntities30[i]); } for (i = 0; i < ARRAY_COUNT(gObjects80); i++) { - Object_Kill(&gObjects80[i].obj, gObjects80[i].sfxPos); + Object_Kill(&gObjects80[i].obj, gObjects80[i].sfxSource); Object_80_Initialize(&gObjects80[i]); } for (i = 0; i < ARRAY_COUNT(gObjects4C); i++) { Object_4C_Initialize(&gObjects4C[i]); } for (i = 0; i < ARRAY_COUNT(gActors); i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); Actor_Initialize(&gActors[i]); } for (i = 0; i < ARRAY_COUNT(gBosses); i++) { - Object_Kill(&gBosses[i].obj, gBosses[i].sfxPos); + Object_Kill(&gBosses[i].obj, gBosses[i].sfxSource); Boss_Initialize(&gBosses[i]); } for (i = 0; i < ARRAY_COUNT(gEffects); i++) { - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); Effect_Initialize(&gEffects[i]); } for (i = 0; i < ARRAY_COUNT(gItems); i++) { - Object_Kill(&gItems[i].obj, gItems[i].sfxPos); + Object_Kill(&gItems[i].obj, gItems[i].sfxSource); Item_Initialize(&gItems[i]); } for (i = 0; i < ARRAY_COUNT(gPlayerShots); i++) { - Object_Kill(&gPlayerShots[i].obj, gPlayerShots[i].sfxPos); + Object_Kill(&gPlayerShots[i].obj, gPlayerShots[i].sfxSource); PlayerShot_Initialize(&gPlayerShots[i]); } D_801782B8 = D_801782BC = D_801782C0 = D_801782D0 = gBossActive = D_8017828C = D_8017812C = D_80177E70 = @@ -764,7 +764,7 @@ void Player_DamageWings(Player* player, s32 side, s32 damage) { player->wings.rightState = WINGSTATE_BROKEN; func_8007D0E0(player->hit1.x, player->hit1.y, player->hit1.z, 2.0f); D_80177D70[player->num] = 50; - func_800A5FA0(player->sfxPos, 0x0900A02C, player->num); + func_800A5FA0(player->sfxSource, 0x0900A02C, player->num); if (D_8015F90C == 0) { D_8015F90C = 1000; } @@ -779,7 +779,7 @@ void Player_DamageWings(Player* player, s32 side, s32 damage) { player->wings.leftState = WINGSTATE_BROKEN; func_8007D0E0(player->hit2.x, player->hit2.y, player->hit2.z, 2.0f); D_80177D88[player->num] = 50; - func_800A5FA0(player->sfxPos, 0x0900A02C, player->num); + func_800A5FA0(player->sfxSource, 0x0900A02C, player->num); if (D_8015F90C == 0) { D_8015F90C = 1000; } @@ -820,22 +820,22 @@ void Player_ApplyDamage(Player* player, s32 direction, s32 damage) { player->timer_498 = 20; } if (D_80177AD0[player->num] != 0) { - func_800A5FA0(player->sfxPos, 0x0903900E, player->num); + func_800A5FA0(player->sfxSource, 0x0903900E, player->num); D_80177AE8[player->num] = 5; D_80177AB8[player->num] = 2.0f; player->damage = 0; } else { if (player->shields != 0) { if (player->shields < 50) { - Audio_PlaySfx(0x49008011, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49008011, gDefaultSfxSource, 4); } else if (player->shields < 100) { - Audio_PlaySfx(0x49008010, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49008010, gDefaultSfxSource, 4); } } if (damage < 25) { - func_800A5FA0(player->sfxPos, 0x0903900E, player->num); + func_800A5FA0(player->sfxSource, 0x0903900E, player->num); } else { - func_800A5FA0(player->sfxPos, 0x0903A00F, player->num); + func_800A5FA0(player->sfxSource, 0x0903A00F, player->num); } } Matrix_RotateY(gCalcMatrix, player->unk_114 * M_DTOR, 0); @@ -1741,8 +1741,7 @@ void func_800A8BA4(Player* player) { player->unk_23C = 80; } if (player->unk_22C == 0) { - Audio_PlaySfx(0x19000001, obj80->sfxPos, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000001, obj80->sfxSource, 0); } player->unk_22C += 2; if (player->unk_22C >= 4) { @@ -1750,8 +1749,7 @@ void func_800A8BA4(Player* player) { } } else if (obj80->obj.id == OBJ_80_54) { if (player->unk_22C == 0) { - Audio_PlaySfx(0x19832019, obj80->sfxPos, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19832019, obj80->sfxSource, 0); } player->unk_22C += 2; if (player->unk_22C >= 4) { @@ -1846,8 +1844,7 @@ void func_800A8BA4(Player* player) { if (temp_v0 != 0) { if (temp_v0 < 0) { if (player->unk_22C == 0) { - Audio_PlaySfx(0x19000001, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000001, boss->sfxSource, 0); } player->unk_22C += 2; if (player->unk_22C >= 4) { @@ -1908,15 +1905,12 @@ void func_800A8BA4(Player* player) { if (D_80177E80 == 3) { Radio_PlayMessage(gMsg_ID_5504, RCID_FALCO); } - Audio_PlaySfx(D_800CFF54[D_80177E80], gPlayer[0].sfxPos, 0, &gDefaultScale, - &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x49008025, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(D_800CFF54[D_80177E80], gPlayer[0].sfxSource, 0); + AUDIO_PLAY_SFX(0x49008025, gDefaultSfxSource, 4); } } else if (temp_v0 < 0) { if (player->unk_22C == 0) { - Audio_PlaySfx(0x19000001, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000001, actor->sfxSource, 0); } player->unk_22C += 2; if (player->unk_22C >= 4) { @@ -1948,8 +1942,7 @@ void func_800A8BA4(Player* player) { if (temp_v0 != 0) { if (temp_v0 < 0) { if (player->unk_22C == 0) { - Audio_PlaySfx(0x19000001, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000001, actor->sfxSource, 0); } player->unk_22C += 2; if (player->unk_22C >= 4) { @@ -2345,18 +2338,18 @@ void func_800AB334(void) { switch (gCurrentLevel) { case LEVEL_TRAINING: - func_8001DC6C(0, 28); + Audio_SetAudioSpec(0, 28); D_8017796C = -1; break; case LEVEL_VENOM_1: - func_8001DC6C(0, 6); + Audio_SetAudioSpec(0, 6); break; case LEVEL_VENOM_2: - func_8001DC6C(0, 6); + Audio_SetAudioSpec(0, 6); break; case LEVEL_VENOM_ANDROSS: - func_8001DC6C(0, 15); - func_8001D400(0); + Audio_SetAudioSpec(0, 15); + Audio_SetBaseSfxReverb(0); D_8017796C = -1; break; } @@ -2520,8 +2513,8 @@ void func_800ABAB4(void) { D_80177C70 = 0; D_800CA234 = NULL; D_Timer_800CA238 = 0; - func_8001A838(0x11403076); - func_8001A838(0x49000014); + Audio_KillSfxById(0x11403076); + Audio_KillSfxById(0x49000014); Memory_FreeAll(); D_80177C78 = D_80177C8C = gShowBossHealth = D_8015F908 = D_8015F90C = D_8015F910 = 0; D_800CA220 = 0; @@ -2791,7 +2784,7 @@ void func_800ACA40(Player* player) { for (i = 0; i < ARRAY_COUNT(gPlayerShots) - 1; i++) { if (gPlayerShots[i].obj.status == 0) { func_800AC650(player, &gPlayerShots[i], PLAYERSHOT_5, 100.0f); - func_800A5FA0(player->sfxPos, 0x09000014, player->num); + func_800A5FA0(player->sfxSource, 0x09000014, player->num); player->unk_1A0 = 2; break; } @@ -2810,7 +2803,7 @@ void func_800ACABC(Player* player) { for (i = 0; i < ARRAY_COUNT(gPlayerShots) - 1; i++) { if (gPlayerShots[i].obj.status == 0) { func_800AC290(player, &gPlayerShots[i], 0.0f, 0.0f, PLAYERSHOT_0, 400.0f / 3.0f); - func_800A5FA0(player->sfxPos, 0x09400000, player->num); + func_800A5FA0(player->sfxSource, 0x09400000, player->num); D_80177AA0[player->num] = 0.5f; break; } @@ -2822,10 +2815,10 @@ void func_800ACABC(Player* player) { if (gPlayerShots[i].obj.status == 0) { func_800AC290(player, &gPlayerShots[i], 0.0f, -10.0f, PLAYERSHOT_1, 400.0f / 3.0f); if (laser == LASERS_TWIN) { - func_800A5FA0(player->sfxPos, 0x0940800C, player->num); + func_800A5FA0(player->sfxSource, 0x0940800C, player->num); D_80177AA0[player->num] = 0.5f; } else { - func_800A5FA0(player->sfxPos, 0x0940802B, player->num); + func_800A5FA0(player->sfxSource, 0x0940802B, player->num); D_80177AA0[player->num] = 0.75f; } break; @@ -2853,7 +2846,7 @@ void func_800ACC7C(Player* player) { gPlayerShots[ARRAY_COUNT(gPlayerShots) - 1].unk_48 = 30.0f; gPlayerShots[ARRAY_COUNT(gPlayerShots) - 1].unk_60 = 0; func_8001CB80(player->num, 1); - func_8001CCDC(player->num, gPlayerShots[ARRAY_COUNT(gPlayerShots) - 1].sfxPos); + func_8001CCDC(player->num, gPlayerShots[ARRAY_COUNT(gPlayerShots) - 1].sfxSource); } } @@ -2908,7 +2901,7 @@ void func_800AD094(Player* player) { for (i = 0; i < ARRAY_COUNT(gPlayerShots); i++) { if (gPlayerShots[i].obj.status == 0) { func_800ACDC0(player, &gPlayerShots[i], PLAYERSHOT_6); - func_800A5FA0(player->sfxPos, 0x09000014, player->num); + func_800A5FA0(player->sfxSource, 0x09000014, player->num); player->timer_1F8 = 2; player->unk_180 = 10.0f; break; @@ -2947,7 +2940,7 @@ bool func_800AD1F4(Player* player) { gChargeTimers[player->num] = 21; } if (gChargeTimers[player->num] == 20) { - func_80060F30(player->sfxPos, 0x0900302D, player->num); + func_80060F30(player->sfxSource, 0x0900302D, player->num); } if ((!(gInputHold->button & R_TRIG) || !(gInputHold->button & Z_TRIG) || (player->form != FORM_ARWING) || (player->state_1C8 != PLAYERSTATE_1C8_3)) && @@ -2983,7 +2976,7 @@ bool func_800AD1F4(Player* player) { } else { func_800AC650(player, &gPlayerShots[14 - player->num], PLAYERSHOT_8, 70.0f); } - func_80060F30(player->sfxPos, 0x09007029, player->num); + func_80060F30(player->sfxSource, 0x09007029, player->num); D_Timer_80177BD0[player->num] = 5; return true; } @@ -3000,7 +2993,7 @@ bool func_800AD1F4(Player* player) { } else { func_800AC650(player, &gPlayerShots[14 - player->num], PLAYERSHOT_8, 70.0f); } - func_80060F30(player->sfxPos, 0x09007029, player->num); + func_80060F30(player->sfxSource, 0x09007029, player->num); gChargeTimers[player->num] = 0; D_Timer_80177BD0[player->num] = 5; return true; @@ -3034,7 +3027,7 @@ bool func_800AD1F4(Player* player) { gPlayerShots[ARRAY_COUNT(gPlayerShots) - 1].unk_48 = 30.0f; gPlayerShots[ARRAY_COUNT(gPlayerShots) - 1].unk_60 = 0; func_8001CB80(player->num, 1); - func_8001CCDC(player->num, gPlayerShots[ARRAY_COUNT(gPlayerShots) - 1].sfxPos); + func_8001CCDC(player->num, gPlayerShots[ARRAY_COUNT(gPlayerShots) - 1].sfxSource); return true; } } @@ -3133,23 +3126,23 @@ void func_800ADA28(Player* player) { } Math_SmoothStepToF(&player->unk_12C, sp3C, sp38, 10.0f, 0.f); if (gInputPress->button & Z_TRIG) { - player->unk_48C = 1; + player->sfx.bank = 1; if (player->timer_1E0 != 0) { player->unk_1DC = 1; player->timer_1E8 = 10; player->unk_1EC = player->unk_1F0 = 30; - player->unk_494 = 1; + player->sfx.roll = 1; } else { player->timer_1E0 = 10; } } if (gInputPress->button & R_TRIG) { - player->unk_48C = 1; + player->sfx.bank = 1; if (player->timer_1E4 != 0) { player->unk_1DC = 1; player->timer_1E8 = 10; player->unk_1EC = player->unk_1F0 = -30; - player->unk_494 = 1; + player->sfx.roll = 1; } else { player->timer_1E4 = 10; } @@ -4304,24 +4297,24 @@ void func_800B0F50(Player* playerx) { player->unk_234 = 1; switch (gCurrentLevel) { case LEVEL_CORNERIA: - func_8001D444(0, 0x25, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_37); break; case LEVEL_METEO: - func_8001D444(0, 0x32, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_50); break; case LEVEL_FORTUNA: case LEVEL_BOLSE: case LEVEL_VENOM_2: - func_8001D444(0, 0x33, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_51); break; case LEVEL_VENOM_1: - func_8001D444(0, 0x8008, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_8 | 0x8000); break; case LEVEL_KATINA: - func_8001D444(0, 0x33, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_51); break; case LEVEL_TITANIA: - func_8001D444(0, 0x2D, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_45); break; case LEVEL_ZONESS: case LEVEL_SECTOR_X: @@ -4329,7 +4322,7 @@ void func_800B0F50(Player* playerx) { case LEVEL_TRAINING: case LEVEL_MACBETH: default: - func_8001D444(0, 0x2C, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_44); break; case LEVEL_AREA_6: case LEVEL_SECTOR_Y: @@ -4339,7 +4332,7 @@ void func_800B0F50(Player* playerx) { break; } } else if (!gVersusMode && (D_80177C90 != 0xFFFF) && ((gLevelMode != LEVELMODE_ALL_RANGE) || (D_8015F924 == 0))) { - func_8001D444(0, D_80177C90, 0, 0xFF); + AUDIO_PLAY_BGM(D_80177C90); } D_80177840 = gBossHealthBar = D_80177850 = 0; @@ -4370,8 +4363,8 @@ void func_800B0F50(Player* playerx) { if ((gCurrentLevel == LEVEL_TRAINING)) { D_80177824 = 1; } - player->levelType = gLevelType; - player->form2 = player->form; + player->sfx.levelType = gLevelType; + player->sfx.form = player->form; func_80057814(player); if (!gVersusMode && (((gCurrentLevel != LEVEL_TITANIA) && (gCurrentLevel != LEVEL_SOLAR)) || gVersusMode || (player->state_1C8 != PLAYERSTATE_1C8_2))) { @@ -4561,7 +4554,7 @@ void func_800B2574(Player* player) { sp28 = 1.5f; sp2C = 0.35f; } - player->boost = 0; + player->sfx.boost = 0; var = gInputPress->stick_y; // fake? if (D_Timer_80177A70[gPlayerNum] != 0) { D_Timer_80177A70[gPlayerNum]--; @@ -4622,7 +4615,7 @@ void func_800B2574(Player* player) { if ((gInputHold->button & gBoostButton[player->num]) && !(gInputHold->button & gBrakeButton[player->num]) && (player->state_1C8 != PLAYERSTATE_1C8_5) && !player->unk_2B4) { if (player->unk_2BC == 0.0f) { - func_800A5FA0(player->sfxPos, 0x09000002, player->num); + func_800A5FA0(player->sfxSource, 0x09000002, player->num); player->unk_194 = 5.0f; player->unk_190 = 5.0f; if (gBoostButton[player->num] & gInputPress->button) { @@ -4651,7 +4644,7 @@ void func_800B2574(Player* player) { player->unk_110 = 30.0f; } Math_SmoothStepToF(&player->unk_08C, -400.0f, 0.1f, 30.0f, 0.0f); - player->boost = 1; + player->sfx.boost = 1; Math_SmoothStepToF(&D_801779A8[player->num], 50.0f, 1.0f, 10.0f, 0.0f); } else { if (player->unk_2BC > 0.0f) { @@ -4687,7 +4680,7 @@ void func_800B2C00(Player* player) { sp30 = 1.5f; sp34 = 0.35f; } - player->brake = 0; + player->sfx.brake = 0; var = gInputPress->stick_y; // fake? if (D_Timer_80177A00[gPlayerNum] != 0) { D_Timer_80177A00[gPlayerNum]--; @@ -4716,7 +4709,7 @@ void func_800B2C00(Player* player) { if ((gInputHold->button & gBrakeButton[player->num]) && !(gInputHold->button & gBoostButton[player->num]) && (player->state_1C8 != PLAYERSTATE_1C8_5) && !player->unk_2B4) { if (player->unk_2BC == 0.0f) { - func_800A5FA0(player->sfxPos, 0x09000003, player->num); + func_800A5FA0(player->sfxSource, 0x09000003, player->num); if ((gLevelMode == LEVELMODE_ALL_RANGE) && (gInputPress->button & gBrakeButton[player->num])) { D_Timer_80177A38[gPlayerNum] = 5; } @@ -4738,7 +4731,7 @@ void func_800B2C00(Player* player) { player->unk_110 = -20.0f; } Math_SmoothStepToF(&player->unk_08C, 180.0f, 0.1f, 10.0f, 0.0f); - player->brake = 1; + player->sfx.brake = 1; Math_SmoothStepToF(&D_801779A8[player->num], 25.0f, 1.0f, 5.0f, 0.0f); } else if (player->unk_2BC > 0.0f) { player->unk_2BC -= sp34; @@ -4774,7 +4767,7 @@ void func_800B3010(Player* player) { if (player->unk_2BC == 0.0f) { player->unk_194 = 4.0f; player->unk_190 = 4.0f; - func_800A5FA0(player->sfxPos, 0x09000002, player->num); + func_800A5FA0(player->sfxSource, 0x09000002, player->num); } Math_SmoothStepToF(&D_801779A8[player->num], 30.0f, 1.0f, 10.0f, 0.0f); player->unk_190 = 2.0f; @@ -4787,7 +4780,7 @@ void func_800B3010(Player* player) { } if ((gInputHold->button & gBrakeButton[player->num]) && !player->unk_2B4) { if (player->unk_2BC == 0.0f) { - func_800A5FA0(player->sfxPos, 0x09000003, player->num); + func_800A5FA0(player->sfxSource, 0x09000003, player->num); } Math_SmoothStepToF(&D_801779A8[player->num], 20.0f, 1.0f, 10.0f, 0.0f); sp2C = 5.0f; @@ -4807,7 +4800,7 @@ void func_800B3314(Player* player) { player->unk_0D4 = 3.0f; if ((gInputHold->button & Z_TRIG) && !player->unk_2B4) { if (player->unk_2BC == 0.0f) { - func_800A5FA0(player->sfxPos, 0x09000002, player->num); + func_800A5FA0(player->sfxSource, 0x09000002, player->num); } player->unk_188 = 0.0f; player->unk_12C += 4.0f; @@ -4835,7 +4828,7 @@ void func_800B3314(Player* player) { } if ((gInputHold->button & R_TRIG) && !player->unk_2B4) { if (player->unk_2BC == 0.0f) { - func_800A5FA0(player->sfxPos, 0x09000002, player->num); + func_800A5FA0(player->sfxSource, 0x09000002, player->num); } player->unk_188 = 0.0f; player->unk_12C -= 4.0f; @@ -5028,7 +5021,7 @@ void func_800B40AC(Player* player) { if (player->shields >= Play_GetMaxShields()) { player->shields = Play_GetMaxShields(); player->heal = 0; - func_8001A838(0x41007012); + Audio_KillSfxById(0x41007012); } } } @@ -5047,7 +5040,7 @@ void func_800B415C(Player* player) { var_v0 = 0xF; } if (!(gGameFrameCount & var_v0)) { - func_80060F30(player->sfxPos, 0x49001026, player->num); + func_80060F30(player->sfxSource, 0x49001026, player->num); } } } @@ -5058,15 +5051,15 @@ void func_800B41E0(Player* player) { void func_800B41EC(Player* player) { player->state_1C8 = PLAYERSTATE_1C8_4; if (!gVersusMode) { - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); - func_8001D444(0, 0x27, 0, 0xFF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); + AUDIO_PLAY_BGM(SEQ_ID_39); } if (gCurrentLevel == LEVEL_SOLAR) { - func_8001A838(0x4100C023); + Audio_KillSfxById(0x4100C023); } func_8001CA24(player->num); - func_800A5FA0(player->sfxPos, 0x0900C010, player->num); + func_800A5FA0(player->sfxSource, 0x0900C010, player->num); player->shields = 0; player->unk_1D0 = 0; player->unk_1F4 = 0; @@ -5293,7 +5286,7 @@ void func_800B48BC(Player* player) { } Math_SmoothStepToVec3fArray(sp58, player->jointTable, 1, sp1C4, 0.1f, 1.3f, 0.0f); } - player->unk_48C = player->unk_494 = 0; + player->sfx.bank = player->sfx.roll = 0; sp1C4 = player->unk_22C; if (sp1C4 != 0) { player->unk_22C--; @@ -5323,9 +5316,9 @@ void func_800B48BC(Player* player) { if ((!gVersusMode || (D_80177E7C != 0)) && (player->unk_4DC == 0) && (gInputPress->button & U_CBUTTONS) && ((player->form == FORM_ARWING) || (gVersusMode && (player->form == FORM_LANDMASTER)))) { if (player->unk_238 = 1 - player->unk_238) { - Audio_PlaySfx(0x4900002C, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900002C, gDefaultSfxSource, 4); } else { - Audio_PlaySfx(0x4900002D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900002D, gDefaultSfxSource, 4); if (gLevelMode == LEVELMODE_ON_RAILS) { player->unk_034 = 0.0f; } @@ -5355,7 +5348,7 @@ void func_800B48BC(Player* player) { if (D_80177E7C == 1) { D_80177E7C += 1; for (i = 0; i < 4; i++) { - func_800A5FA0(gPlayer[i].sfxPos, 0x09000002, gPlayer[i].num); + func_800A5FA0(gPlayer[i].sfxSource, 0x09000002, gPlayer[i].num); gPlayer[i].unk_190 = gPlayer[i].unk_194 = 5.0f; } } @@ -5439,7 +5432,7 @@ void func_800B48BC(Player* player) { func_800B0F50(player); func_800B44C4(player); func_800B7184(player, 1); - func_800A5FA0(player->sfxPos, 0x09000002, player->num); + func_800A5FA0(player->sfxSource, 0x09000002, player->num); player->unk_190 = player->unk_194 = 5.0f; } else if (player->unk_288 >= 0) { if (player->unk_288 == 0) { @@ -5477,8 +5470,8 @@ void func_800B48BC(Player* player) { D_80177D20 = gPlayer[0].unk_144 = 0.0f; D_80178380[0] = 0; D_8015F93C = gRadioState = 0; - func_8001AE58(); - func_8001D400(0); + Audio_ClearVoice(); + Audio_SetBaseSfxReverb(0); D_80161A94[0] = gGoldRingCount[0]; if (gCurrentLevel == LEVEL_VENOM_ANDROSS) { if (1) {} @@ -6160,7 +6153,7 @@ void func_800B79B0(void) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_8; gPlayer[0].unk_1D0 = 0; gOverlayStage = 1; - Audio_PlaySfx(0x1900602A, gDefaultSfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900602A, gDefaultSfxSource, 0); D_80177930 = 2; D_800D3180[gCurrentLevel] = 1; } @@ -6214,9 +6207,9 @@ void func_800B79B0(void) { } if (gPlayer[0].heal == 0) { if (gPlayer[0].shields == 50) { - Audio_PlaySfx(0x49008011, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49008011, gDefaultSfxSource, 4); } else if (gPlayer[0].shields == 100) { - Audio_PlaySfx(0x49008010, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49008010, gDefaultSfxSource, 4); } } } @@ -6400,11 +6393,11 @@ void func_800B86CC(void) { if ((gControllerPress[gMainController].button & START_BUTTON) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_2) && gSaveFile.save.data.planet[D_800D2F6C[gCurrentLevel]].normalClear) { - func_8001AE58(); - func_8001D400(0); + Audio_ClearVoice(); + Audio_SetBaseSfxReverb(0); func_800A6148(); for (i = 0; i < gCamCount; i++) { - Audio_KillSfx(gPlayer[i].sfxPos); + Audio_KillSfxBySource(gPlayer[i].sfxSource); func_8001CA24(i); } D_80177854 = 1; @@ -6429,18 +6422,18 @@ void func_800B86CC(void) { if ((gControllerPress[gMainController].button & R_TRIG) && (gPlayer[0].form != FORM_BLUE_MARINE) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_0)) { if (D_800D2860[0] = 1 - D_800D2860[0]) { - Audio_PlaySfx(0x49000019, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000019, gDefaultSfxSource, 4); } else { - Audio_PlaySfx(0x4900101A, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900101A, gDefaultSfxSource, 4); } } } else { for (i = 0; i < 4; i++) { if ((gControllerPress[i].button & R_TRIG) && (gPlayer[i].form != FORM_ON_FOOT)) { if (D_800D2860[i] = 1 - D_800D2860[i]) { - func_80060F30(gPlayer[i].sfxPos, 0x49000019, i); + func_80060F30(gPlayer[i].sfxSource, 0x49000019, i); } else { - func_80060F30(gPlayer[i].sfxPos, 0x4900101A, i); + func_80060F30(gPlayer[i].sfxSource, 0x4900101A, i); } } } diff --git a/src/main/fox_radio.c b/src/main/fox_radio.c index 76646d8b..ee8b3fc1 100644 --- a/src/main/fox_radio.c +++ b/src/main/fox_radio.c @@ -128,7 +128,7 @@ void Radio_PlayMessage(u16* msg, RadioCharacterId character) { } D_801782E8 = Message_IdFromPtr(msg); - func_8001ACDC(D_801782E8); + Audio_PlayVoice(D_801782E8); } void func_800BAAE8(void) { @@ -547,10 +547,10 @@ void func_800BB5D0(void) { break; case 32: - if (func_8001AE78() == 0) { + if (Audio_GetCurrentVoice() == 0) { D_80178724++; D_80178308 = D_80178720[D_80178724]; - func_8001ACDC(Message_IdFromPtr(D_80178308)); + Audio_PlayVoice(Message_IdFromPtr(D_80178308)); D_801782D8 = 0; D_8017874C = 0; D_Timer_801782AC = 80; @@ -560,7 +560,7 @@ void func_800BB5D0(void) { break; case 4: - if ((func_8001AE78() == 0) && (D_Timer_801782AC == 0)) { + if ((Audio_GetCurrentVoice() == 0) && (D_Timer_801782AC == 0)) { D_Timer_801782AC = 10; D_801782A4 = (s32) D_80177D68; gRadioState = 6; @@ -577,10 +577,10 @@ void func_800BB5D0(void) { } if (!(fakeTemp)) { - temp_v0 = func_8001AED4(); + temp_v0 = Audio_GetCurrentVoiceStatus(); if (D_801782D8 < 60) { - if (D_80178308[D_801782D8 + 1] == 15) { + if (D_80178308[D_801782D8 + 1] == MSGCHAR_NPF) { if (temp_v0 == 0) { gRadioState = 31; } @@ -593,8 +593,7 @@ void func_800BB5D0(void) { if ((D_801782E8 >= 23000) && (D_801782E8 < 23033)) { if (D_801782F8 != 0) { D_Timer_801782B4 = 2; - Audio_PlaySfx(0x49000017, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000017, gDefaultSfxSource, 4); } } else if (temp_v0 == 1) { D_Timer_801782B4 = 2; @@ -617,9 +616,9 @@ void func_800BB5D0(void) { case 6: if (D_Timer_801782AC == 0) { if (gGameState == GSTATE_CREDITS) { - func_8001AE58(); + Audio_ClearVoice(); } else { - func_8001ACDC(0); + Audio_PlayVoice(0); } gRadioState++; } @@ -817,7 +816,7 @@ void func_800BC040(void) { case 6: if (D_Timer_801782AC == 0) { - func_8001ACDC(0); + Audio_PlayVoice(0); gRadioState++; } diff --git a/src/main/fox_tank.c b/src/main/fox_tank.c index 5254f2d0..906e1c3d 100644 --- a/src/main/fox_tank.c +++ b/src/main/fox_tank.c @@ -323,7 +323,7 @@ void func_800444BC(Player* player) { } if ((player->pos.y - sp30) < sp38) { if (player->vel.y < -10.0f) { - Audio_PlaySfx(0x09008015, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09008015, player->sfxSource, 0); } player->unk_1D4 = 1; if (player->vel.y < -20.0f) { @@ -331,7 +331,7 @@ void func_800444BC(Player* player) { } if (D_80177BAC != 0) { D_80177BAC = 0; - func_8001D444(0, 0x8004, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_4 | 0x8000); func_8001C8B8(0); } @@ -508,27 +508,27 @@ void func_80045130(Player* player) { Math_SmoothStepToF(&player->unk_170, 0.0f, 1.0f, 0.2f, 0.0f); Math_SmoothStepToF(&player->unk_16C, 0.0f, 1.0f, 0.2f, 0.0f); if (gInputPress->button & Z_TRIG) { - player->unk_48C = 1; + player->sfx.bank = 1; if ((player->timer_1E0 != 0) && (player->unk_12C > 0.0f) && (player->unk_2BC < 10.0f)) { player->unk_1DC = 1; player->timer_1E8 = 15; player->unk_1F0 = 20; player->unk_1EC = 20; - player->unk_494 = 1; - Audio_PlaySfx(0x1100000A, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + player->sfx.roll = 1; + AUDIO_PLAY_SFX(0x1100000A, player->sfxSource, 0); } else { player->timer_1E0 = 10; } } if (gInputPress->button & R_TRIG) { - player->unk_48C = 1; + player->sfx.bank = 1; if ((player->timer_1E4 != 0) && (player->unk_12C < 0.0f) && (player->unk_2BC < 10.0f)) { player->unk_1DC = 1; player->timer_1E8 = 15; player->unk_1F0 = -20; player->unk_1EC = -20; - player->unk_494 = 1; - Audio_PlaySfx(0x1100000A, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + player->sfx.roll = 1; + AUDIO_PLAY_SFX(0x1100000A, player->sfxSource, 0); } else { player->timer_1E4 = 10; } @@ -552,7 +552,7 @@ void func_80045348(Player* player) { sp2E = true; if (D_800C9F24 == 0.0f) { player->unk_190 = player->unk_194 = 4.0f; - Audio_PlaySfx(0x0900402F, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x0900402F, player->sfxSource, 0); } else { player->unk_190 = 2.0f; } @@ -594,13 +594,13 @@ void func_80045678(Player* player) { player->unk_0D4 = 3.0f; if (!(gInputHold->button & Z_TRIG)) { - func_8001A55C(player->sfxPos, 0x01008016); - func_8001A55C(player->sfxPos, 0x1100000A); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x01008016); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x1100000A); } if ((gInputHold->button & Z_TRIG) && !player->unk_2B4) { D_800C9F14++; if (D_800C9F20 == 0.0f) { - Audio_PlaySfx(0x01004024, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x01004024, player->sfxSource, 0); } player->unk_188 = 0.0f; player->unk_12C += 4.0f; @@ -624,13 +624,13 @@ void func_80045678(Player* player) { D_800C9F20 = 0.0f; } if (!(gInputHold->button & R_TRIG)) { - func_8001A55C(player->sfxPos, 0x01008016); - func_8001A55C(player->sfxPos, 0x1100000A); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x01008016); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x1100000A); } if ((gInputHold->button & R_TRIG) && !player->unk_2B4) { D_800C9F14++; if (player->unk_2C0 == 0.0f) { - Audio_PlaySfx(0x01004024, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x01004024, player->sfxSource, 0); } player->unk_188 = 0.0f; player->unk_12C -= 4.0f; @@ -657,9 +657,9 @@ void func_80045678(Player* player) { if ((player->unk_16C > 0.2f) && (player->unk_170 > 0.2f) && (player->timer_220 == 0)) { if (D_800C9F3C == 0) { D_800C9F3C = 1; - func_8001A55C(player->sfxPos, 0x1100000A); - func_8001A55C(player->sfxPos, 0x01004024); - Audio_PlaySfx(0x01008016, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x1100000A); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x01004024); + AUDIO_PLAY_SFX(0x01008016, player->sfxSource, 0); } player->unk_12C += ((__cosf(gGameFrameCount * M_DTOR * 8.0f) * 10.0f) - player->unk_12C) * 0.1f; temp = -gInputPress->stick_y; @@ -743,7 +743,7 @@ void func_80045E7C(Player* player) { } if (player->unk_1EC == 0) { player->unk_1DC = 0; - func_8001A55C(player->sfxPos, 0x1100000A); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x1100000A); } } if ((player->timer_1E8 >= 5) && (player->unk_1F4 == 0) && (player->unk_1DC != 9)) { @@ -938,7 +938,7 @@ void func_80046704(Player* player) { player->unk_0D0 = -(D_800C9F00 * 1.5f); player->vel.z = D_800C9F00 * 1.5f; D_800C9F00 = 12; - Audio_PlaySfx(0x09008015, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09008015, player->sfxSource, 0); break; } if (obj80->obj.id == OBJ_80_59) { @@ -1117,14 +1117,14 @@ void func_80047504(Player* player) { if (player->unk_2BC > 90.0f) { player->unk_2BC = 90.0f; player->unk_2B4 = true; - func_8001A55C(player->sfxPos, 0x01004024); - func_8001A55C(player->sfxPos, 0x01008016); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x01004024); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x01008016); } } else { if (player->unk_2BC > 0.0f) { player->unk_2B4 = true; - func_8001A55C(player->sfxPos, 0x01004024); - func_8001A55C(player->sfxPos, 0x01008016); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x01004024); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x01008016); } } } else { @@ -1249,7 +1249,7 @@ void func_80047D38(Player* player, f32 arg1) { } if ((player->pos.y - 5.0f) < arg1) { if (player->vel.y < -10.0f) { - Audio_PlaySfx(0x09008015, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09008015, player->sfxSource, 0); player->unk_1F4 = 10; } D_800C9F04 = 1; @@ -1296,7 +1296,7 @@ void func_80047FBC(Player* player) { Math_SmoothStepToF(&player->unk_0EC, -((player->vel.z / 5.0f) * 4.0f), 0.4f, 8.0f, 0.01f); if (player->unk_0EC >= 3.0f) { if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_7) { - Audio_PlaySfx(0x19000065, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000065, player->sfxSource, 0); } D_800C9F08 |= 1; } @@ -1361,16 +1361,14 @@ void func_800481F4(Player* player) { D_80178578 = 20; player->unk_23C = 80; if (player->unk_22C == 0) { - Audio_PlaySfx(0x19000001, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000001, player->sfxSource, 0); } player->unk_22C += 2; if (player->unk_22C >= 4) { player->unk_22C = 4; } } else if (temp_v0 == -2) { - Audio_PlaySfx(0x19000001, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000001, player->sfxSource, 0); } } else { Player_ApplyDamage(player, temp_v0, obj80->info.damage); diff --git a/src/main/fox_versus.c b/src/main/fox_versus.c index a96b7eb2..3f79739f 100644 --- a/src/main/fox_versus.c +++ b/src/main/fox_versus.c @@ -53,7 +53,7 @@ void func_800BC760(void) { func_800A6148(); for (i = 0; i < gCamCount; i++) { - Audio_KillSfx(gPlayer[i].sfxPos); + Audio_KillSfxBySource(gPlayer[i].sfxSource); func_8001CA24(i); } @@ -333,7 +333,7 @@ void func_800BDE44(void) { } else { D_80178810[i] = 0; } - Audio_PlaySfx(0x49004007U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49004007U, gDefaultSfxSource, 4U); } } @@ -362,12 +362,12 @@ s32 func_800BE078(void) { if ((D_80178768[1] -= temp) >= 0) { if ((D_80178768[0] == 0) && (D_80178768[1] < 15) && (D_80178768[1] >= 0)) { - Audio_PlaySfx(0x4900C02AU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900C02AU, gDefaultSfxSource, 4U); } break; } // clang-format off - if (D_80178768[0] == 0) { Audio_PlaySfx(0x4900D036U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); } + if (D_80178768[0] == 0) { AUDIO_PLAY_SFX(0x4900D036U, gDefaultSfxSource, 4U); } // clang-format on D_80178768[1] *= -1; temp = (D_80178768[1] / 60) + 1; @@ -463,19 +463,19 @@ s32 func_800BE564(void) { } if ((sUnlockLandmaster) && (D_80178780[i] == 0) && (gControllerPress[i].button & B_BUTTON)) { - Audio_PlaySfx(0x49000003U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003U, gDefaultSfxSource, 4U); D_80178780[i] = 2; } if ((sUnlockOnFoot) && (D_80178780[i] == 0) && ((gControllerPress[i].button & L_CBUTTONS) || (gControllerPress[i].button & D_CBUTTONS) || (gControllerPress[i].button & U_CBUTTONS) || (gControllerPress[i].button & R_CBUTTONS))) { - Audio_PlaySfx(0x49000003U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003U, gDefaultSfxSource, 4U); D_80178780[i] = 3; } if ((D_80178780[i] == 0) && (gControllerPress[i].button & A_BUTTON)) { - Audio_PlaySfx(0x49000003U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003U, gDefaultSfxSource, 4U); D_80178780[i] = 1; } @@ -598,10 +598,10 @@ s32 func_800BEF00(void) { if (D_80178794 == 0) { D_80178790--; if (D_80178790 != 0) { - Audio_PlaySfx(0x49000008U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000008U, gDefaultSfxSource, 4U); ret = 0; } else { - Audio_PlaySfx(0x49000009U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000009U, gDefaultSfxSource, 4U); ret = 1; } D_80178794 = 30; @@ -1129,7 +1129,7 @@ s32 func_800C07C4(void) { } // clang-format off - if (ret != 0) { Audio_PlaySfx(0x49000002U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); } + if (ret != 0) { AUDIO_PLAY_SFX(0x49000002U, gDefaultSfxSource, 4U); } // clang-format on return ret; @@ -1255,7 +1255,7 @@ bool func_800C0D10(void) { if (cont == 4) { D_800D4A90 = 2; } else { - Audio_PlaySfx(0x49004007U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49004007U, gDefaultSfxSource, 4U); } break; @@ -1306,7 +1306,7 @@ s32 func_800C0E78(void) { bool func_800C107C(s32 arg0) { D_80178798++; if (D_80178798 == 10) { - Audio_PlaySfx(0x49004007U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49004007U, gDefaultSfxSource, 4U); D_801787B8++; D_80178798 = 0; } @@ -1492,7 +1492,7 @@ bool func_800C176C(void) { break; } if (func_800C16A0(30)) { - func_8001D444(0, D_80177C90, 0, 0xFF); + AUDIO_PLAY_BGM(D_80177C90); D_80178754 = 2; func_800C1690(); } @@ -1527,7 +1527,7 @@ bool func_800C176C(void) { case 4: if ((D_800D4A9C == 1) && (D_800D4AA0 == 0)) { - func_8001D444(0, 0x802F, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_47 | 0x8000); D_800D4AA0 = 1; } @@ -1540,8 +1540,8 @@ bool func_800C176C(void) { } if (func_800BF9AC()) { - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); if (D_801778AC == 2) { D_80178778 = 11; } else { @@ -1564,11 +1564,11 @@ bool func_800C176C(void) { case 2: case 3: - func_8001D444(0, 0x26, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_38); break; case 99: - func_8001D444(0, 0x31, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_49); break; default: @@ -1656,8 +1656,8 @@ bool func_800C176C(void) { break; } - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); } break; diff --git a/src/main/sys_main.c b/src/main/sys_main.c index 322ad48e..61ad33c1 100644 --- a/src/main/sys_main.c +++ b/src/main/sys_main.c @@ -2,8 +2,8 @@ void AudioLoad_Init(void); SPTask* func_8001DF50(void); -void func_8001DCE0(void); -void func_8001DECC(void); +void Audio_InitSounds(void); +void Audio_Update(void); s32 sGammaMode = 1; @@ -108,7 +108,7 @@ void Audio_ThreadEntry(void* arg0) { SPTask* task; AudioLoad_Init(); - func_8001DCE0(); + Audio_InitSounds(); task = func_8001DF50(); if (task != NULL) { task->msgQueue = &gAudioTaskMsgQueue; @@ -287,7 +287,7 @@ void Graphics_ThreadEntry(void* arg0) { osRecvMesg(&gGfxVImsgQueue, NULL, OS_MESG_BLOCK); } - func_8001DECC(); + Audio_Update(); } } diff --git a/src/mods/sfxjukebox.c b/src/mods/sfxjukebox.c index c5f0071c..4f56f631 100644 --- a/src/mods/sfxjukebox.c +++ b/src/mods/sfxjukebox.c @@ -79,31 +79,31 @@ void Option_ExpertSoundUpdate(void) { sfx |= sfxId & 0xFF; if (prevSfx != sfx) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); prevSfx = sfx; } decimalToHex(sfx, hexString, sizeof(hexString)); if (gControllerPress[gMainController].button & A_BUTTON) { - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); - Audio_PlaySfx(sfx, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); + AUDIO_PLAY_SFX(sfx, gDefaultSfxSource, 4); D_menu_801B9320 = true; } if (gControllerPress[gMainController].button & B_BUTTON) { if (!D_menu_801B9320) { - func_8001D444(0, 36, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_36); gDrawMode = DRAWMODE_0; D_menu_801B9124 = 1000; D_menu_801B912C = 0; D_menu_801B9244 = 1; } else { - Audio_PlaySfx(0x4900101D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_KillSfx(gDefaultSfxPos); - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + AUDIO_PLAY_SFX(0x4900101D, gDefaultSfxSource, 4); + Audio_KillSfxBySource(gDefaultSfxSource); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); D_menu_801B9320 = false; } } diff --git a/src/overlays/ovl_ending/fox_end1.c b/src/overlays/ovl_ending/fox_end1.c index 306bf0e2..e16e2b2a 100644 --- a/src/overlays/ovl_ending/fox_end1.c +++ b/src/overlays/ovl_ending/fox_end1.c @@ -435,12 +435,12 @@ void func_ending_8018845C(void); s32 func_ending_80188634(void) { if (D_80161690 != 0) { if ((D_ending_80196F90 % 14) == 0) { - Audio_PlaySfx(0x49002018, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49002018, gDefaultSfxSource, 4); } D_ending_80196F90++; D_80161690--; if (D_80161690 == 0) { - func_8001A838(0x49002018); + Audio_KillSfxById(0x49002018); } } else { D_ending_80196F90 = 0; @@ -631,7 +631,7 @@ void func_ending_80189108(void) { D_ending_80196D08[4].unk_34 = 0; D_ending_80196D08[4].unk_38 = 1; gCsFrameCount = 0; - func_8001A838(0x49002018); + Audio_KillSfxById(0x49002018); D_ending_80196F90 = 0; D_80161690 = 0; } diff --git a/src/overlays/ovl_ending/fox_end2.c b/src/overlays/ovl_ending/fox_end2.c index 93bdbc4d..b50fc552 100644 --- a/src/overlays/ovl_ending/fox_end2.c +++ b/src/overlays/ovl_ending/fox_end2.c @@ -712,7 +712,7 @@ void func_ending_80190CF0(u32 arg0, AssetInfo* asset) { } if (arg0 == asset->unk_0C) { - Audio_PlaySfx(0x1940306EU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306EU, gDefaultSfxSource, 4U); } RCP_SetupDL(&gMasterDisp, asset->unk_08); @@ -1036,7 +1036,7 @@ void func_ending_801926D4(void) { } else { D_ending_80198590.rightState = D_ending_80198590.leftState = 2; } - func_8001D444(0, 0x2A, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_42); } if ((2790 <= D_ending_80192E70) && (D_ending_80192E70 < 3000)) { diff --git a/src/overlays/ovl_i1/fox_co.c b/src/overlays/ovl_i1/fox_co.c index 6580443b..5de605a2 100644 --- a/src/overlays/ovl_i1/fox_co.c +++ b/src/overlays/ovl_i1/fox_co.c @@ -96,10 +96,10 @@ void func_i1_801878D8(Boss* boss) { if (gPlayer[0].state_1C8 == 3) { gPlayer[0].state_1C8 = 9; gPlayer[0].unk_1D0 = 0; - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); } - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); return; } @@ -153,15 +153,15 @@ void func_i1_80187AC8(Boss* boss) { boss->swork[10] = 1000; boss->info.hitbox[1 + 0] = 100000.0f; func_i1_8018798C(boss, D_i1_8019B6D8[62], D_i1_8019B6D8[63], D_i1_8019B6D8[64], 10.0f); - Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09A, boss->sfxSource, 4); D_Timer_80161A60 = 8; if (fabsf(boss->obj.rot.x) < 20.0f) { boss->swork[32] = 1; } boss->state = 7; boss->timer_050 = 100; - func_800182F4(0x105000FF); - func_800182F4(0x115000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 80); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 80); gCsFrameCount = 0; if ((gPlayer[0].state_1C8 == 3) || (gPlayer[0].state_1C8 == 5)) { @@ -221,7 +221,7 @@ void func_i1_80187AC8(Boss* boss) { func_i1_8018798C(boss, D_i1_8019B6D8[0], D_i1_8019B6D8[1], D_i1_8019B6D8[2], 7.0f); } } else if ((boss->dmgPart == 4) || (boss->dmgPart == 5)) { - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); boss->swork[23] = 200; if (boss->dmgPart == 4) { boss->swork[24] -= boss->damage; @@ -451,7 +451,7 @@ void func_i1_80188C7C(Boss* boss) { if (boss->unk_044 == 0) { boss->unk_044++; boss->fwork[12] *= -0.2f; - Audio_PlaySfx(0x19030004, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19030004, boss->sfxSource, 4); func_80062B60(D_i1_8019B6D8[56], D_i1_8019B6D8[58], 0, 30.0f); boss->swork[18] = 13; boss->swork[19] = 15; @@ -483,7 +483,7 @@ void func_i1_80188D50(Boss* boss) { (fabsf(boss->obj.pos.z - gPlayer[0].unk_138) < 200.0f) && (gPlayer[0].unk_4D8 > 180.0f)) { boss->swork[36]++; D_i1_801997E0 = 20; - Audio_PlaySfx(0x49008025, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49008025, gDefaultSfxSource, 4); if ((gTeamShields[1] > 0) || (gTeamShields[2] > 0) || (gTeamShields[3] > 0)) { do { do { @@ -862,13 +862,13 @@ void func_i1_80189058(Boss* boss) { boss->swork[24] = boss->swork[25] = boss->swork[26] = boss->swork[27] = boss->swork[28] = 0; if (boss->timer_050 == 12) { - Object_Kill(&gEffects[0].obj, gEffects[0].sfxPos); + Object_Kill(&gEffects[0].obj, gEffects[0].sfxSource); func_8007D0E0(D_i1_8019B6D8[62], D_i1_8019B6D8[63] - 100.0f, D_i1_8019B6D8[64], 25.0f); } if (boss->timer_050 == 10) { for (sp218 = 0; sp218 < 50; sp218++) { if (gEffects[sp218].obj.status != OBJ_FREE) { - Object_Kill(&gEffects[sp218].obj, gEffects[sp218].sfxPos); + Object_Kill(&gEffects[sp218].obj, gEffects[sp218].sfxSource); } } func_8007A568(D_i1_8019B6D8[62], D_i1_8019B6D8[63] - 100.0f, D_i1_8019B6D8[64], 40.0f); @@ -913,7 +913,7 @@ void func_i1_80189058(Boss* boss) { } } if (boss->timer_050 == 0) { - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); } Animation_GetFrameData(&D_602BC18, 0, sp84); break; @@ -936,7 +936,7 @@ void func_i1_80189058(Boss* boss) { boss->swork[31] = 0; } if ((boss->state != 0) && ((boss->unk_04C == 0) || (boss->unk_04C == 52))) { - Audio_PlaySfx(0x29022019U, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29022019U, boss->sfxSource, 4); } if ((gPlayer[0].unk_4DC != 0) && (boss->state != 0)) { boss->state = 0; @@ -1130,7 +1130,7 @@ void func_i1_8018ACE0(Actor* actor) { if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; if (actor->unk_0D2 == 0) { - Audio_PlaySfx(0x29034003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, actor->sfxSource, 4); func_8007C120(actor->obj.pos.x, actor->obj.pos.y + 200.0f, actor->obj.pos.z, actor->vel.x, actor->vel.y, actor->vel.z, 0.1f, 20); actor->timer_0C6 = 15; @@ -1273,7 +1273,7 @@ void func_i1_8018B15C(Actor* actor) { obj80->vel.x = sp48.x; obj80->vel.y = sp48.y; obj80->vel.z = sp48.z; - Audio_PlaySfx(0x2902401C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902401C, actor->sfxSource, 4); } break; } @@ -1347,7 +1347,7 @@ void func_i1_8018B58C(Actor* actor) { actor->obj.pos.z + 50.0f + RAND_FLOAT(50.0f), 3.0f); func_8007C120(actor->obj.pos.x, actor->obj.pos.y + 200.0f, actor->obj.pos.z, actor->vel.x, actor->vel.y, actor->vel.z, 0.1f, 10); - Audio_PlaySfx(0x2903A008, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903A008, actor->sfxSource, 4); } if (actor->timer_0BC == 0) { @@ -1373,7 +1373,7 @@ void func_i1_8018B58C(Actor* actor) { if (actor->timer_0BC == 8) { func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y + 200.0f, actor->obj.pos.z + 50.0f, 0.0f, 0.0f, 0.0f, 5.0f, 30); - Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 4); } break; case 101: @@ -1483,7 +1483,7 @@ void func_i1_8018BE7C(Boss* boss) { if (fabsf(gPlayer[0].unk_0AC) < 1.0f) { boss->timer_05A = 30000; boss->obj.pos.z = (gPlayer[0].camEye.z - D_80177D20) - 2000.0f; - Audio_PlaySfx(0x31038018, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31038018, boss->sfxSource, 4); D_i1_8019B6D0 = 0; } else { D_i1_8019B6D0 = 1; @@ -1492,7 +1492,7 @@ void func_i1_8018BE7C(Boss* boss) { boss->obj.pos.z = gPlayer[0].unk_138 + 2000.0f; boss->fwork[7] = boss->obj.pos.x; boss->fwork[5] = 30.0f; - Audio_PlaySfx(0x31038018, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31038018, boss->sfxSource, 4); boss->swork[10] = 3; boss->swork[8] = 3; } @@ -1572,9 +1572,9 @@ void func_i1_8018C19C(Boss* boss) { Matrix_RotateZ(gCalcMatrix, boss->obj.rot.z * M_DTOR, 1); if (D_i1_8019B6D0 == 0) { if (boss->obj.pos.x > 6000.0f) { - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); for (i = 1; i < ARRAY_COUNT(gBosses); i++) { - Object_Kill(&gBosses[i].obj, gBosses[i].sfxPos); + Object_Kill(&gBosses[i].obj, gBosses[i].sfxSource); } return; } @@ -1633,13 +1633,13 @@ void func_i1_8018C19C(Boss* boss) { boss->health -= boss->damage; if (boss->health < 120) { boss->fwork[17] = 2.8f; - Audio_PlaySfx(0x2943500F, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2943500F, boss->sfxSource, 4); } else { - Audio_PlaySfx(0x29034003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, boss->sfxSource, 4); } } } else { - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); } } boss->vel.z = boss->fwork[18]; @@ -1704,8 +1704,8 @@ void func_i1_8018C19C(Boss* boss) { case 0: boss->fwork[3] = gPlayer[0].unk_138 + 1500.0f; if (boss->timer_050 == 350) { - func_800182F4(0x102800FF); - func_800182F4(0x112800FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 40); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); Radio_PlayMessage(gMsg_ID_2290, RCID_BOSS_CORNERIA2); } if (boss->timer_050 == 180) { @@ -1720,7 +1720,7 @@ void func_i1_8018C19C(Boss* boss) { boss->fwork[6] = 800.0f; boss->fwork[3] = gPlayer[0].camEye.z - D_80177D20 - 2500.0f; boss->fwork[18] = -D_80161A54; - func_8001D444(0, 0x8030, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_48 | 0x8000); boss->timer_050 = 40; } break; @@ -1753,7 +1753,7 @@ void func_i1_8018C19C(Boss* boss) { boss->state = boss->swork[0]; boss->timer_050 = 60; boss->fwork[8] = 0.0f; - Audio_PlaySfx(0x2940201A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940201A, boss->sfxSource, 4); } break; case 4: @@ -1765,7 +1765,7 @@ void func_i1_8018C19C(Boss* boss) { boss->timer_050 = 20; boss->fwork[8] = 0.0f; if (gBosses[1].state == 0) { - Audio_PlaySfx(0x2940201A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940201A, boss->sfxSource, 4); } if ((boss->swork[5] == 0) && ((gBosses[2].state == 0) || (gBosses[3].state == 0))) { Radio_PlayMessage(gMsg_ID_2292, RCID_BOSS_CORNERIA2); @@ -1783,13 +1783,13 @@ void func_i1_8018C19C(Boss* boss) { boss->fwork[13] = 20.0f; if ((boss->fwork[0] > 60.0f) && (gBosses[2].state == 0) && (boss->swork[1] == 0)) { func_i1_8018BDD4(boss, sp84[1].x, sp84[1].y + 50.0f, sp84[1].z, 45.0f, 0, 0); - Audio_PlaySfx(0x2903201B, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903201B, boss->sfxSource, 4); func_i1_8018BDD4(boss, sp84[1].x, sp84[1].y - 50.0f, sp84[1].z, 40.0f, 0, 0); boss->swork[1] = 1; } if ((boss->fwork[1] > 60.0f) && (gBosses[3].state == 0) && (boss->swork[2] == 0)) { func_i1_8018BDD4(boss, sp84[2].x, sp84[2].y + 50.0f, sp84[2].z, 35.0f, 0, 0); - Audio_PlaySfx(0x2903201B, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903201B, boss->sfxSource, 4); func_i1_8018BDD4(boss, sp84[2].x, sp84[2].y - 50.0f, sp84[2].z, 30.0f, 0, 0); boss->swork[2] = 1; } @@ -1811,7 +1811,7 @@ void func_i1_8018C19C(Boss* boss) { boss->swork[4]++; boss->swork[4] &= 3; if ((gBosses[3].state == 0) && (gBosses[2].state == 0)) { - Audio_PlaySfx(0x2940201A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940201A, boss->sfxSource, 4); } } break; @@ -1837,7 +1837,7 @@ void func_i1_8018C19C(Boss* boss) { boss->fwork[8] = 0.0f; if ((boss->swork[3] != 1) || (boss->swork[3] != 3)) { - func_8001A55C(boss->sfxPos, 0x31034025); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x31034025); boss->swork[9] = 0; } } @@ -1847,7 +1847,7 @@ void func_i1_8018C19C(Boss* boss) { if ((boss->obj.rot.y < 20.0f) && (boss->obj.rot.y > -20.0f)) { if (boss->swork[9] == 0) { boss->swork[9]++; - Audio_PlaySfx(0x31034025, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31034025, boss->sfxSource, 4); if (boss->swork[6] == 0) { Radio_PlayMessage(gMsg_ID_2293, RCID_BOSS_CORNERIA2); } @@ -1885,10 +1885,10 @@ void func_i1_8018C19C(Boss* boss) { } if (boss->health < 2) { D_8017796C = -1; - func_8001A55C(boss->sfxPos, 0x31034025); - func_800182F4(0x102800FF); - func_800182F4(0x112800FF); - Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x31034025); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 40); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); + AUDIO_PLAY_SFX(0x2940D09A, boss->sfxSource, 4); D_Timer_80161A60 = 8; gShowBossHealth = false; Radio_PlayMessage(gMsg_ID_2294, RCID_BOSS_CORNERIA2); @@ -1997,7 +1997,7 @@ void func_i1_8018C19C(Boss* boss) { } if (boss->timer_050 == 0) { func_8007A568(boss->obj.pos.x, boss->obj.pos.y + 500.0f, boss->obj.pos.z, 120.0f); - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); } break; } @@ -2018,7 +2018,7 @@ void func_i1_8018C19C(Boss* boss) { boss->fwork[16] = 4.0f; if ((boss->swork[10] == 0) && (boss->state < 6)) { boss->fwork[17] = 1.8f; - Audio_PlaySfx(0x11020084, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11020084, boss->sfxSource, 4); boss->timer_058 = 71; boss->state = 6; boss->fwork[12] = 0.0f; @@ -2056,7 +2056,7 @@ void func_i1_8018DDAC(Boss* boss) { if (boss->health != 0) { boss->timer_05C = 15; boss->health -= boss->damage; - Audio_PlaySfx(0x29034003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, boss->sfxSource, 4); if (boss->health <= 0) { gBosses[0].swork[8]--; if (gBosses[0].swork[8] != 0) { @@ -2067,8 +2067,7 @@ void func_i1_8018DDAC(Boss* boss) { boss->info.unk_10 = 300.0f; gBosses[0].fwork[14] = 25.0f; gBosses[0].fwork[15] = 0.0f; - Audio_PlaySfx(0x2940C027, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940C027, boss->sfxSource, 4); if (gBosses[0].swork[10] != 0) { gBosses[0].swork[10]--; } @@ -2088,7 +2087,7 @@ void func_i1_8018DDAC(Boss* boss) { } } } else { - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); } } boss->obj.rot.x = gBosses[0].obj.rot.x; @@ -2123,7 +2122,7 @@ void func_i1_8018DDAC(Boss* boss) { boss->swork[0] = 1; boss->gravity = 0.0f; func_i1_8018C0B0(boss); - Audio_PlaySfx(0x19000014, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000014, boss->sfxSource, 4); } } else { boss->obj.rot.z -= 2.0f; @@ -2151,7 +2150,7 @@ void func_i1_8018E290(Boss* boss) { if (boss->health != 0) { boss->timer_05C = 15; boss->health -= boss->damage; - Audio_PlaySfx(0x29034003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, boss->sfxSource, 4); if (boss->health <= 0) { gBosses[0].swork[8]--; if (gBosses[0].swork[8] != 0) { @@ -2163,8 +2162,7 @@ void func_i1_8018E290(Boss* boss) { gBosses[0].fwork[15] = 0.0f; gBosses[0].fwork[14] = 335.0f; boss->health = 0; - Audio_PlaySfx(0x2940C027, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940C027, boss->sfxSource, 4); if (gBosses[0].swork[10] != 0) { gBosses[0].swork[10]--; } @@ -2182,7 +2180,7 @@ void func_i1_8018E290(Boss* boss) { } } } else { - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); } } boss->obj.rot.x = gBosses[0].obj.rot.x; @@ -2217,7 +2215,7 @@ void func_i1_8018E290(Boss* boss) { boss->swork[0] = 1; boss->gravity = 0.0f; func_i1_8018C0B0(boss); - Audio_PlaySfx(0x19000014, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000014, boss->sfxSource, 4); } } else { boss->obj.rot.z -= 2.0f; @@ -2245,7 +2243,7 @@ void func_i1_8018E76C(Boss* boss) { if (boss->health != 0) { boss->timer_05C = 15; boss->health -= boss->damage; - Audio_PlaySfx(0x29034003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, boss->sfxSource, 4); if (boss->health <= 0) { gBosses[0].swork[8]--; if (gBosses[0].swork[8] != 0) { @@ -2257,8 +2255,7 @@ void func_i1_8018E76C(Boss* boss) { gBosses[0].fwork[15] = 0.0f; gBosses[0].fwork[14] = 335.0f; boss->health = 0; - Audio_PlaySfx(0x2940C027, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940C027, boss->sfxSource, 4); if (gBosses[0].swork[10] != 0) { gBosses[0].swork[10]--; } @@ -2279,7 +2276,7 @@ void func_i1_8018E76C(Boss* boss) { } } } else { - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); } } boss->obj.rot.x = gBosses[0].obj.rot.x; @@ -2311,7 +2308,7 @@ void func_i1_8018E76C(Boss* boss) { boss->swork[0] = 1; boss->gravity = 0.0f; func_i1_8018C0B0(boss); - Audio_PlaySfx(0x19000014, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000014, boss->sfxSource, 4); } } else { boss->obj.rot.z -= 2.0f; @@ -2410,10 +2407,10 @@ void func_i1_8018F044(Object_80* obj80) { if (obj80->unk_44 >= 3) { obj80->state = 1; obj80->info.hitbox = SEGMENTED_TO_VIRTUAL(&D_603E924); - Audio_PlaySfx(0x1900000D, obj80->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900000D, obj80->sfxSource, 0); return; } - Audio_PlaySfx(0x2903300E, obj80->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, obj80->sfxSource, 0); } } break; @@ -2550,7 +2547,7 @@ void func_i1_8018F6F8(Actor* actor, s32 arg1) { actor->unk_0C9 = 1; actor->iwork[11] = 1; actor->info.unk_10 = 200.0f; - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } extern Gfx D_30184D8[]; @@ -2699,10 +2696,10 @@ void func_i1_8018F880(Player* player) { Radio_PlayMessage(gMsg_ID_2005, RCID_FOX); } if (player->timer_1F8 == 180) { - Audio_PlaySfx(0x09000007, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000007, player->sfxSource, 0); } if (player->timer_1F8 == 120) { - Audio_PlaySfx(0x09000013, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000013, player->sfxSource, 0); } if ((player->timer_1F8 < 190) && (player->timer_1F8 >= 151)) { Math_SmoothStepToF(&player->wings.unk_24, 2.0f, 0.2f, 0.5f, 0.0f); @@ -2891,19 +2888,19 @@ void func_i1_8018F880(Player* player) { } if (player->timer_1F8 == 70) { actor0->state = 1; - func_800A6028(player->sfxPos, 0x09000002); + func_800A6028(player->sfxSource, 0x09000002); } if (player->timer_1F8 == 50) { actor1->state = 2; - func_800A6028(player->sfxPos, 0x09000002); + func_800A6028(player->sfxSource, 0x09000002); } if (player->timer_1F8 == 30) { actor2->state = 3; - func_800A6028(player->sfxPos, 0x09000002); + func_800A6028(player->sfxSource, 0x09000002); } if (player->timer_1F8 == 0) { player->unk_1D0 = 9; - func_800A6028(player->sfxPos, 0x09000002); + func_800A6028(player->sfxSource, 0x09000002); player->timer_1F8 = 3; player->unk_194 = 5.0f; player->unk_190 = 5.0f; @@ -2924,10 +2921,10 @@ void func_i1_8018F880(Player* player) { D_80178348 = D_80178350 = D_80178354 = 0xFF; } if (D_80178340 == 0xFF) { - func_8001D444(0, D_80177C90, 0, 0xFF); - Object_Kill(&actor0->obj, actor0->sfxPos); - Object_Kill(&actor1->obj, actor1->sfxPos); - Object_Kill(&actor2->obj, actor2->sfxPos); + AUDIO_PLAY_BGM(D_80177C90); + Object_Kill(&actor0->obj, actor0->sfxSource); + Object_Kill(&actor1->obj, actor1->sfxSource); + Object_Kill(&actor2->obj, actor2->sfxSource); D_80177838 = 80; player->pos.y = 350.0f; @@ -3017,7 +3014,7 @@ void func_i1_80190F74(Actor* actor, s32 arg1) { actor->obj.rot.z = D_i1_80199B2C[arg1]; Object_SetInfo(&actor->info, actor->obj.id); actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } void func_i1_80191160(Player* player) { @@ -3049,7 +3046,7 @@ void func_i1_80191160(Player* player) { switch (player->unk_1D0) { case 0: - func_8001A38C(1, player->sfxPos); + Audio_StopSfxByBankAndSource(1, player->sfxSource); sp54 = player->camEye.x - D_i1_8019B6D8[62]; sp4C = player->camEye.z - D_i1_8019B6D8[64]; @@ -3143,9 +3140,9 @@ void func_i1_80191160(Player* player) { Math_SmoothStepToF(&D_80177A48[4], 0.0f, 1.0f, 0.003f, 0); } if (gCsFrameCount == 1270) { - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); player->unk_1D0++; player->unk_0D0 = 2.0f; player->unk_194 = 5.0f; @@ -3162,7 +3159,7 @@ void func_i1_80191160(Player* player) { player->unk_190 = 2.0f; } if (gCsFrameCount == 1290) { - func_8001DBD0(50); + Audio_FadeOutAll(50); } if (gCsFrameCount >= 1301) { D_80178358 = 0xFF; @@ -3186,7 +3183,7 @@ void func_i1_80191160(Player* player) { D_80177830 = 0; break; case 240: - func_8001D444(0, 0x26, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_38); break; case 330: D_80177840 = 100; @@ -3232,7 +3229,7 @@ void func_i1_80191160(Player* player) { gActors[0].state = 1; gActors[0].fwork[9] = 2.0f; gActors[0].timer_0BC = 50; - Audio_PlaySfx(0x09000002, gActors[0].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, gActors[0].sfxSource, 0); gActors[0].fwork[29] = 5.0f; } break; @@ -3241,7 +3238,7 @@ void func_i1_80191160(Player* player) { gActors[1].state = 1; gActors[1].fwork[9] = 2.0f; gActors[1].timer_0BC = 50; - Audio_PlaySfx(0x09000002, gActors[1].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, gActors[1].sfxSource, 0); gActors[1].fwork[29] = 5.0f; } break; @@ -3250,7 +3247,7 @@ void func_i1_80191160(Player* player) { gActors[2].state = 1; gActors[2].fwork[9] = 2.0f; gActors[2].timer_0BC = 50; - Audio_PlaySfx(0x09000002, gActors[2].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, gActors[2].sfxSource, 0); gActors[2].fwork[29] = 5.0f; } break; diff --git a/src/overlays/ovl_i1/fox_tr.c b/src/overlays/ovl_i1/fox_tr.c index 7541376f..9a91dbfe 100644 --- a/src/overlays/ovl_i1/fox_tr.c +++ b/src/overlays/ovl_i1/fox_tr.c @@ -24,7 +24,7 @@ void func_i1_80198968(Item* item) { if (item->obj.pos.z > (gPlayer[0].unk_138 + var_fv0)) { item->unk_44 = 1; PRINTF("♪:リング未通過音\n"); // Ring not passed sound - Audio_PlaySfx(0x4900402F, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900402F, gDefaultSfxSource, 4); D_80177E80 = 0; } } @@ -33,7 +33,7 @@ void func_i1_80198968(Item* item) { item->timer_48 = 50; item->info.unk_10 = 10000.0f; PRINTF("♪:リング通過音\n"); // Ring passing sound - Audio_PlaySfx(0x49008025, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49008025, gDefaultSfxSource, 4); D_80177E80++; if ((item->obj.rot.x != 0.0f) && (D_80177E80 >= 100)) { Radio_PlayMessage(gMsg_ID_20330, RCID_ROB64); @@ -52,7 +52,7 @@ void func_i1_80198968(Item* item) { Math_SmoothStepToAngle(&item->obj.rot.y, Math_RadToDeg(-gPlayer[item->playerNum].unk_058), 0.2f, 10.0f, 0.0f); if (item->timer_48 == 0) { - Object_Kill(&item->obj, item->sfxPos); + Object_Kill(&item->obj, item->sfxSource); } break; } diff --git a/src/overlays/ovl_i1/fox_tr360.c b/src/overlays/ovl_i1/fox_tr360.c index 665b8832..c9986277 100644 --- a/src/overlays/ovl_i1/fox_tr360.c +++ b/src/overlays/ovl_i1/fox_tr360.c @@ -200,7 +200,7 @@ void func_i1_8019949C(void) { actor->unk_0C9 = actor->iwork[11] = 1; actor->timer_0C2 = 30; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); if ((i + 10) == 10) { actor->unk_0E6 = 0; actor->health = 50; diff --git a/src/overlays/ovl_i1/fox_ve1.c b/src/overlays/ovl_i1/fox_ve1.c index 12c2414f..433bd459 100644 --- a/src/overlays/ovl_i1/fox_ve1.c +++ b/src/overlays/ovl_i1/fox_ve1.c @@ -415,7 +415,7 @@ void func_i1_80192518(Actor* actor) { } actor->timer_0BC = actor->iwork[2]; - Audio_PlaySfx(0x1903205B, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1903205B, actor->sfxSource, 0); actor->state = 2; case 2: @@ -670,7 +670,7 @@ void func_i1_80192CD4(Actor* actor) { func_i1_80192AA4(actor); actor->iwork[1] = 5; actor->obj.rot.x = 90.0f; - Audio_PlaySfx(0x1903205C, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1903205C, actor->sfxSource, 0); actor->state++; } break; @@ -723,7 +723,7 @@ void func_i1_80192EB0(Actor* actor) { actor->fwork[1] = 1237.0f - (var_ft4 - actor->obj.pos.y); actor->obj.pos.y = var_ft4 + 1.0f; actor->timer_0BC = actor->iwork[1]; - Audio_PlaySfx(0x1903205B, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1903205B, actor->sfxSource, 0); actor->state = 2; case 2: @@ -798,11 +798,11 @@ void func_i1_801933DC(Actor* actor) { if (actor->unk_0D0 == 1) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 0); } if ((actor->unk_0B6 == 38) || (actor->unk_0B6 == 58)) { - Audio_PlaySfx(0x1903005A, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1903005A, actor->sfxSource, 0); } Animation_GetFrameData(&D_900D098, actor->unk_0B6, actor->vwork); @@ -875,7 +875,7 @@ void func_i1_801935CC(Boss* boss) { } boss->swork[29] = boss->swork[30] = var_v0 + 100; Animation_GetFrameData(D_i1_8019ACD4[boss->swork[5]], 0, boss->vwork); - func_8001D444(0, 0x8018, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_24 | 0x8000); } bool func_i1_801937F4(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* thisx) { @@ -1280,8 +1280,8 @@ void func_i1_80194398(Boss* boss) { D_i1_8019B838[is4].unk_02[0] = 16; D_i1_8019B838[is4].unk_02[1] = D_i1_8019A820[spF4].unk_0C; D_i1_8019B838[is4].unk_7C |= 4; - Audio_PlaySfx(0x2903A008, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x19030059, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903A008, boss->sfxSource, 4); + AUDIO_PLAY_SFX(0x19030059, boss->sfxSource, 4); } is4 = D_i1_8019A820[spF4].unk_0A; if (is4 != -1) { @@ -1567,28 +1567,28 @@ void func_i1_80194398(Boss* boss) { D_i1_8019B838[is4].unk_02[2] = 15; if (D_i1_8019B838[is4].unk_00 <= 0) { - Audio_PlaySfx(0x2903A008, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x19030059, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903A008, boss->sfxSource, 4); + AUDIO_PLAY_SFX(0x19030059, boss->sfxSource, 4); D_i1_8019B838[is4].unk_00 = -1; D_i1_8019B838[is4].unk_02[0] = 16; D_i1_8019B838[is4].unk_02[1] = 0; D_i1_8019B838[is4].unk_7C |= 0xC; } else { - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); if (is4 == 14) { D_i1_8019B838[is4].unk_7C |= 8; } } } else { - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); } } else { - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); } break; case 2: if (D_i1_8019A500[boss->dmgPart] == 15) { - Audio_PlaySfx(0x31034064, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31034064, boss->sfxSource, 4); D_i1_8019B838[15].unk_02[2] = 10; D_i1_8019B838[15].unk_02[3] = 0; D_i1_8019B838[15].unk_7C |= 0x80; @@ -1600,12 +1600,12 @@ void func_i1_80194398(Boss* boss) { D_Timer_80161A60 = 8; D_8017796C = -1; D_8017828C = 1; - Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09A, boss->sfxSource, 4); boss->health = 0; } } } else { - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); } break; } @@ -1623,8 +1623,8 @@ void func_i1_80194398(Boss* boss) { D_i1_8019B838[is4].unk_02[0] = 16; D_i1_8019B838[is4].unk_02[1] = 0; D_i1_8019B838[is4].unk_7C |= 0xC; - Audio_PlaySfx(0x2903A008, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x19030059, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903A008, boss->sfxSource, 4); + AUDIO_PLAY_SFX(0x19030059, boss->sfxSource, 4); } else if (is4 == 14) { D_i1_8019B838[is4].unk_7C |= 8; } @@ -1637,7 +1637,7 @@ void func_i1_80194398(Boss* boss) { if (!(gGameFrameCount & 3) && (boss->timer_05A == 0)) { for (spF4 = 0; spF4 < 33U; spF4++) { if ((D_i1_8019A500[spF4] == 15) && (D_i1_8019B7F0[spF4] != 0)) { - Audio_PlaySfx(0x31034064, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31034064, boss->sfxSource, 4); D_i1_8019B838[15].unk_02[3] = 10; D_i1_8019B838[15].unk_02[4] = 0; D_i1_8019B838[15].unk_7C |= 0x80; @@ -1648,8 +1648,7 @@ void func_i1_80194398(Boss* boss) { D_Timer_80161A60 = 8; D_8017796C = -1; D_8017828C = 1; - Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09A, boss->sfxSource, 4); boss->health = 0; } } @@ -1740,7 +1739,7 @@ void func_i1_80194398(Boss* boss) { boss->swork[10] = 16; D_80178480 = 40; boss->swork[23] = RAND_FLOAT(5.0f); - Audio_PlaySfx(0x29034082, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034082, boss->sfxSource, 4); spB8 = 3; boss->swork[28] = 5; } @@ -1806,13 +1805,13 @@ void func_i1_80194398(Boss* boss) { switch (boss->swork[27]) { case 0: if (boss->fwork[10] > 14.0f) { - Audio_PlaySfx(0x29032080, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29032080, boss->sfxSource, 4); boss->swork[27]++; } break; case 1: if (boss->fwork[10] > 45.0f) { - Audio_PlaySfx(0x29032080, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29032080, boss->sfxSource, 4); boss->swork[27]++; } break; @@ -1851,7 +1850,7 @@ void func_i1_80194398(Boss* boss) { case 122: D_80178480 = 20; boss->swork[28] = 7; - Audio_PlaySfx(0x29405084, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29405084, boss->sfxSource, 4); D_i1_8019B838[2].unk_60 = 5.0f; D_i1_8019B838[2].unk_7C |= 0x800; D_i1_8019B838[5].unk_7C |= 0x800; @@ -1867,7 +1866,7 @@ void func_i1_80194398(Boss* boss) { case 118: D_80178480 = 30; boss->swork[28] = 7; - Audio_PlaySfx(0x29405084, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29405084, boss->sfxSource, 4); D_i1_8019B838[8].unk_7C |= 0x800; D_i1_8019B838[8].unk_60 = 10.0f; break; @@ -1876,11 +1875,11 @@ void func_i1_80194398(Boss* boss) { break; case 91: boss->swork[28] = 7; - Audio_PlaySfx(0x29405084, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29405084, boss->sfxSource, 4); break; case 78: boss->swork[28] = 7; - Audio_PlaySfx(0x29405084, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29405084, boss->sfxSource, 4); D_80178480 = 20; D_i1_8019B838[10].unk_7C |= 0x800; D_i1_8019B838[10].unk_60 = 10.0f; @@ -1890,7 +1889,7 @@ void func_i1_80194398(Boss* boss) { break; case 66: boss->swork[28] = 7; - Audio_PlaySfx(0x29405084, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29405084, boss->sfxSource, 4); D_i1_8019B838[11].unk_7C |= 0x20; break; case 65: @@ -1932,7 +1931,7 @@ void func_i1_80194398(Boss* boss) { func_80042EC0(boss); gShowBossHealth = 0; boss->swork[28] = 9; - Audio_PlaySfx(0x29405084, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29405084, boss->sfxSource, 4); boss->swork[26] = 1; boss->info.hitbox = D_800CBF34; boss->unk_05E = 0; @@ -1957,7 +1956,7 @@ void func_i1_80194398(Boss* boss) { boss->swork[11] |= 1; break; case 1: - Audio_PlaySfx(0x31030083, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31030083, boss->sfxSource, 4); D_80178480 = 40; boss->swork[28] = 5; spB8 = spB4 = 1; @@ -1975,7 +1974,7 @@ void func_i1_80194398(Boss* boss) { break; case 1: spB4 = 1; - Audio_PlaySfx(0x31030083, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31030083, boss->sfxSource, 4); D_80178480 = 40; boss->swork[28] = 5; spB8 = 2; @@ -2168,7 +2167,7 @@ void func_i1_80194398(Boss* boss) { } break; case 4: - Audio_PlaySfx(0x29033081, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29033081, boss->sfxSource, 4); boss->swork[7] = 1; boss->fwork[10] = 0; boss->gravity = 0; @@ -2205,8 +2204,8 @@ void func_i1_80194398(Boss* boss) { boss->swork[2] = 0; boss->swork[6] = 4; - func_800182F4(0x100000FF); - func_800182F4(0x110000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 0); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 0); } if ((spB4 == 1) || (spB4 == 2)) { effect = func_8007783C(OBJ_EFFECT_394); @@ -2370,7 +2369,7 @@ void func_i1_80198414(void) { D_80177CBC = gRightWingHealth[0]; D_80177CC4 = gLeftWingHealth[0]; func_8001CA24(0); - Audio_KillSfx(gPlayer[0].sfxPos); + Audio_KillSfxBySource(gPlayer[0].sfxSource); } void func_i1_80198594(Boss* boss) { diff --git a/src/overlays/ovl_i2/fox_me.c b/src/overlays/ovl_i2/fox_me.c index af8db336..2c9f5916 100644 --- a/src/overlays/ovl_i2/fox_me.c +++ b/src/overlays/ovl_i2/fox_me.c @@ -102,7 +102,7 @@ void func_i2_80187650(Actor* actor) { if (actor->unk_0D0 != 0) { func_8007A6F0(&actor->obj.pos, 0x2903A008); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } if (actor->timer_0C2 == 0) { @@ -139,7 +139,7 @@ void func_i2_801877C4(Actor* actor) { if (actor->unk_0D0 != 0) { func_80066254(actor); func_8007A6F0(&actor->obj.pos, 0x2903A008); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y + 30.0f, actor->obj.pos.z, 5.0f); func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y + 30.0f, actor->obj.pos.z, 0.0f, 0.0f, 0.0f, 3.0f, 10); } @@ -162,7 +162,7 @@ void func_i2_8018795C(Actor* actor) { if (actor->unk_0D0 != 0) { func_80066254(actor); func_8007A6F0(&actor->obj.pos, 0x2903A008); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007D0E0(actor->obj.pos.x - actor->vel.x, actor->obj.pos.y, actor->obj.pos.z - actor->vel.z, 8.0f); func_8007BFFC(actor->obj.pos.x - actor->vel.x, actor->obj.pos.y + 30.0f, actor->obj.pos.z - actor->vel.z, 0.0f, 0.0f, 0.0f, 4.0f, 10); @@ -197,7 +197,7 @@ void func_i2_80187B08(Actor* actor) { if ((actor->unk_0D0 != 0) || (actor->timer_0BC == 0)) { func_8007A6F0(&actor->obj.pos, 0x2903A008); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007D0E0(actor->obj.pos.x - actor->vel.x, actor->obj.pos.y, actor->obj.pos.z - actor->vel.z, 8.0f); func_8007BFFC(actor->obj.pos.x - actor->vel.x, actor->obj.pos.y + 30.0f, actor->obj.pos.z - actor->vel.z, 0.0f, 0.0f, 0.0f, 4.0f, 10); @@ -260,7 +260,7 @@ void func_i2_80187E38(f32 x, f32 y, f32 z, f32 arg3) { for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { if (gEffects[i].obj.status == OBJ_FREE) { func_i2_80187D98(&gEffects[i], x, y, z, arg3, 0); - Audio_PlaySfx(0x31037057U, gEffects[i].sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31037057U, gEffects[i].sfxSource, 4U); break; } } @@ -308,7 +308,7 @@ void func_i2_80188088(Boss* boss) { for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { if (gEffects[i].obj.status == OBJ_FREE) { func_i2_80187FF8(&gEffects[i], boss->obj.pos.x + 700.0f, boss->obj.pos.y, boss->obj.pos.z + 1235.0f); - Audio_PlaySfx(0x19006035U, gEffects[i].sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19006035U, gEffects[i].sfxSource, 4U); break; } } @@ -353,7 +353,7 @@ void func_i2_80188298(f32 x, f32 y, f32 z, f32 zRot) { for (i = ARRAY_COUNT(gEffects) - 1; i >= 0; i--) { if (gEffects[i].obj.status == OBJ_FREE) { func_i2_801881A8(&gEffects[i], x, y, z, zRot, -1); - Audio_PlaySfx(0x3102705CU, gEffects[i].sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3102705CU, gEffects[i].sfxSource, 4); break; } } @@ -399,7 +399,7 @@ void func_i2_80188344(Boss* boss) { boss->timer_054 = 5; boss->swork[0] += 32; - func_8001D034(boss->sfxPos, 0x3103605B, boss->unk_04A); + func_8001D034(boss->sfxSource, 0x3103605B, boss->unk_04A); boss->unk_04A++; if (boss->unk_04A >= 8) { @@ -408,7 +408,7 @@ void func_i2_80188344(Boss* boss) { if (boss->swork[0] >= 0xFF) { boss->unk_04A = 0; - Audio_KillSfx(boss->sfxPos); + Audio_KillSfxBySource(boss->sfxSource); if (boss->swork[1] == 0) { boss->swork[1]++; Radio_PlayMessage(gMsg_ID_3315, RCID_PEPPY); @@ -449,8 +449,8 @@ void func_i2_80188344(Boss* boss) { boss->info.unk_10 = 1000.0f; - func_8001A55C(boss->sfxPos, 0x3103605B); - Audio_PlaySfx(0x3102405DU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x3103605B); + AUDIO_PLAY_SFX(0x3102405DU, boss->sfxSource, 4U); } break; @@ -507,7 +507,7 @@ void func_i2_801887D0(Boss* boss) { void func_i2_80188A40(Boss* boss) { s32 i; - func_8001D444(0, D_800C9E90[gCurrentLevel], 0, 255); + AUDIO_PLAY_BGM(D_800C9E90[gCurrentLevel]); gBossActive = 1; @@ -534,7 +534,7 @@ void func_i2_80188A40(Boss* boss) { Object_SetInfo(&gBosses[i].info, gBosses[i].obj.id); Radio_PlayMessage(gMsg_ID_3300, RCID_BOSS_METEO); - Audio_PlaySfx(0x3102505AU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3102505AU, boss->sfxSource, 4U); } void func_i2_80188B84(Effect* effect, f32 x, f32 y, f32 z, f32 xRot, f32 yRot, f32 arg6, f32 arg7) { @@ -609,7 +609,7 @@ void func_i2_80188CAC(Effect* effect) { func_i2_80188C2C(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, effect->obj.rot.x, effect->obj.rot.y, effect->unk_60.z, 1.0f); } else if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } func_8007A774(gPlayer, effect, 90.0f); @@ -673,7 +673,7 @@ void func_i2_80188FAC(Effect* effect) { } else { effect->unk_44 -= 8; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } func_8007A774(gPlayer, effect, 60.0f); @@ -681,7 +681,7 @@ void func_i2_80188FAC(Effect* effect) { void func_i2_80189114(Effect* effect) { if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->scale2 += 0.5f; @@ -848,27 +848,27 @@ void func_i2_8018978C(Boss* boss) { if (boss->swork[0] > 5) { boss->swork[0]--; if (boss->swork[0] == 5) { - func_8001A55C(boss->sfxPos, 0x3102505AU); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x3102505AU); } } if (boss->swork[1] > 5) { boss->swork[1] = boss->swork[1] - 1; if (boss->swork[1] == 5) { - func_8001A55C(boss->sfxPos, 0x3102505AU); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x3102505AU); } } if (boss->dmgType != 0) { boss->dmgType = 0; if ((boss->dmgPart != 7) && (boss->dmgPart >= 5) && (boss->dmgPart != 5)) { - Audio_PlaySfx(0x29121007U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007U, boss->sfxSource, 4U); } if ((boss->state >= 2) && (boss->state < 20)) { if ((boss->dmgPart < 5) && (boss[0].fwork[17 + boss->dmgPart] > 0.5f)) { if (boss[0].swork[boss->dmgPart + 2] != 0) { - Audio_PlaySfx(0x29034003U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003U, boss->sfxSource, 4U); boss[0].swork[9 + boss->dmgPart] = 20; boss[0].swork[2 + boss->dmgPart] -= boss->damage; @@ -888,14 +888,14 @@ void func_i2_8018978C(Boss* boss) { } } } else { - Audio_PlaySfx(0x29121007U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007U, boss->sfxSource, 4U); } } if (boss->state >= 9) { if (boss->dmgPart == 5) { if ((boss->swork[7] != 0) && (boss->fwork[22] > 0.8f)) { - Audio_PlaySfx(0x2943500FU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2943500FU, boss->sfxSource, 4U); boss->swork[14] = 20; boss->swork[7] -= boss->damage; if (boss->swork[7] <= 0) { @@ -903,13 +903,13 @@ void func_i2_8018978C(Boss* boss) { func_i2_801892F0(boss, boss->dmgPart); } } else { - Audio_PlaySfx(0x29121007U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007U, boss->sfxSource, 4U); } } if (boss->dmgPart == 7) { if ((boss->swork[8] != 0) && (boss->fwork[23] > 0.8f)) { - Audio_PlaySfx(0x2943500FU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2943500FU, boss->sfxSource, 4U); boss->swork[15] = 20; boss->swork[8] -= boss->damage; if (boss->swork[8] <= 0) { @@ -917,7 +917,7 @@ void func_i2_8018978C(Boss* boss) { func_i2_801892F0(boss, boss->dmgPart); } } else { - Audio_PlaySfx(0x29121007U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007U, boss->sfxSource, 4U); } } @@ -938,9 +938,9 @@ void func_i2_8018978C(Boss* boss) { gCsFrameCount = 0; } - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); - Audio_PlaySfx(0x2940D09AU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); + AUDIO_PLAY_SFX(0x2940D09AU, boss->sfxSource, 4U); D_Timer_80161A60 = 8; } } @@ -1044,7 +1044,7 @@ void func_i2_8018978C(Boss* boss) { id = 190; } - Audio_PlaySfx(0x2903201BU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903201BU, boss->sfxSource, 4U); src.x = 0.0f; src.y = 330.0f; @@ -1147,7 +1147,7 @@ void func_i2_8018978C(Boss* boss) { boss->timer_052 = 80; } else if (boss->vel.z < -50.0f) { if (boss->swork[0] == 5) { - Audio_PlaySfx(0x3102505AU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3102505AU, boss->sfxSource, 4U); } if (boss->swork[0] < 10) { @@ -1194,7 +1194,7 @@ void func_i2_8018978C(Boss* boss) { if ((boss->timer_050 == 0) && (gBosses[boss->unk_044].state == 2)) { boss->fwork[2] = 90.0f; boss->timer_050 = D_i2_80195520[var_v0] + 45; - Audio_PlaySfx(0x19030036U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19030036U, boss->sfxSource, 4U); } if (boss->fwork[2] > 0.0f) { @@ -1228,7 +1228,7 @@ void func_i2_8018978C(Boss* boss) { boss->obj.rot.z += ((0.0f - boss->obj.rot.z) * 0.02f); if (boss->timer_050 == 1) { - Audio_PlaySfx(0x31016056U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31016056U, boss->sfxSource, 4U); } if (boss->timer_050 == 0) { @@ -1279,7 +1279,7 @@ void func_i2_8018978C(Boss* boss) { } if (boss->timer_050 == 0) { boss->state = 7; - Audio_PlaySfx(0x29038058U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29038058U, boss->sfxSource, 4U); } func_i2_80189624(); } @@ -1294,7 +1294,7 @@ void func_i2_8018978C(Boss* boss) { boss->fwork[11] -= 2.0f; if (boss->fwork[11] <= 0.0f) { boss->fwork[11] = 0.0f; - Audio_KillSfx(boss->sfxPos); + Audio_KillSfxBySource(boss->sfxSource); if (boss->swork[6] == 0) { boss->state = 8; @@ -1306,8 +1306,8 @@ void func_i2_8018978C(Boss* boss) { boss->fwork[23] = 0.0f; gCsFrameCount = 0; Radio_PlayMessage(gMsg_ID_3322, RCID_BOSS_METEO); - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); } else { boss->state = 5; boss->timer_050 = 70; @@ -1327,7 +1327,7 @@ void func_i2_8018978C(Boss* boss) { } if (gCsFrameCount == 400) { - func_8001D444(0U, 0x8041U, 0U, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_65 | 0x8000); if (gTeamShields[1] > 0) { Radio_PlayMessage(gMsg_ID_3345, RCID_BOSS_METEO); } else { @@ -1344,7 +1344,7 @@ void func_i2_8018978C(Boss* boss) { if (boss->timer_052 != 0) { if (boss->swork[0] == 5) { - Audio_PlaySfx(0x3102505AU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3102505AU, boss->sfxSource, 4U); } if (boss->swork[0] < 10) { boss->swork[0] += 2; @@ -1358,7 +1358,7 @@ void func_i2_8018978C(Boss* boss) { boss->state = 9; boss->timer_050 = 0; boss->fwork[15] = 8.0f; - Audio_PlaySfx(0x11015034U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11015034U, boss->sfxSource, 4U); } } break; @@ -1405,7 +1405,7 @@ void func_i2_8018978C(Boss* boss) { boss->state = 9; boss->timer_050 = 70; boss->fwork[15] = 8.0f; - Audio_PlaySfx(0x11015034U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11015034U, boss->sfxSource, 4U); } else if ((boss->timer_050 & 1) == 1) { func_i2_80188088(boss); } @@ -1440,15 +1440,15 @@ void func_i2_8018978C(Boss* boss) { if (boss->timer_050 == 0) { func_8007D2C8(boss->obj.pos.x, boss->obj.pos.y, boss->obj.pos.z, 40.0f); - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); } if (boss->timer_050 == 20) { func_8007A568(boss->obj.pos.x, boss->obj.pos.y, boss->obj.pos.z, 80.0f); - Audio_PlaySfx(0x2940F026U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940F026U, boss->sfxSource, 4U); D_Timer_80177BD0[0] = 60; for (i = 0; i < ARRAY_COUNT(gActors); i++) { if (gActors[i].obj.id == 0xC6) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } } @@ -1789,12 +1789,12 @@ void func_i2_8018C77C(Actor* actor, s32 arg1) { if (actor->unk_0B6 == 0) { actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); return; } - Audio_PlaySfx(0x11030010U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31024059U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010U, actor->sfxSource, 0U); + AUDIO_PLAY_SFX(0x31024059U, actor->sfxSource, 0U); } void func_i2_8018C8F4(Actor* actor1, Actor* actor2) { @@ -2049,7 +2049,7 @@ void func_i2_8018CD8C(Player* player) { gActors[player->unk_1D8].obj.pos.z, 10.0f); gActors[player->unk_1D8].obj.status = OBJ_FREE; func_i2_8018CCF8(&gActors[player->unk_1D8]); - Object_Kill(&gPlayerShots[0].obj, gPlayerShots[0].sfxPos); + Object_Kill(&gPlayerShots[0].obj, gPlayerShots[0].sfxSource); } } break; @@ -2065,7 +2065,7 @@ void func_i2_8018CD8C(Player* player) { Math_SmoothStepToF(D_80177A48, 1.0f, 1.0f, 0.01f, 0.0f); if (player->timer_1F8 == 0) { - func_8001D444(0, D_80177C90, 0, 0xFF); + AUDIO_PLAY_BGM(D_80177C90); D_80177838 = 80; player->state_1C8 = PLAYERSTATE_1C8_3; player->unk_1D0 = 0; @@ -2079,7 +2079,7 @@ void func_i2_8018CD8C(Player* player) { player->camAt.z = player->unk_138; for (i = 0; i < 4; i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } D_80178488 = 1; @@ -2197,12 +2197,12 @@ void func_i2_8018DF08(Actor* actor, s32 idx) { Object_SetInfo(&actor->info, actor->obj.id); if (idx == 3) { - Audio_PlaySfx(0x11030010U, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31024059U, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010U, actor->sfxSource, 0); + AUDIO_PLAY_SFX(0x31024059U, actor->sfxSource, 0); actor->unk_0B6 = 1; } else { actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } } @@ -2224,7 +2224,7 @@ void func_i2_8018E084(Player* player) { switch (player->unk_1D0) { case 0: - func_8001A38C(1, player->sfxPos); + Audio_StopSfxByBankAndSource(1, player->sfxSource); player->unk_1D0++; D_80177A48[0] = 0.0f; @@ -2274,7 +2274,7 @@ void func_i2_8018E084(Player* player) { Math_SmoothStepToF(&D_80177A48[3], 1.0f, 1.0f, 0.01f, 0.0f); } if (player->timer_1F8 == 50) { - func_8001D444(0, 0x26U, 0, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_38); } Math_SmoothStepToF(&D_80177A48[1], 1080.0f, 0.01f, D_80177A48[3], 0.0f); @@ -2320,7 +2320,7 @@ void func_i2_8018E084(Player* player) { player->unk_190 = 2.0f; if (gCsFrameCount == 1465) { - func_8001DBD0(20); + Audio_FadeOutAll(20); } if (gCsFrameCount > 1465) { @@ -2344,9 +2344,9 @@ void func_i2_8018E084(Player* player) { switch (gCsFrameCount) { case 350: - Object_Kill(&gActors[0].obj, gActors[0].sfxPos); - Object_Kill(&gActors[1].obj, gActors[1].sfxPos); - Object_Kill(&gActors[2].obj, gActors[2].sfxPos); + Object_Kill(&gActors[0].obj, gActors[0].sfxSource); + Object_Kill(&gActors[1].obj, gActors[1].sfxSource); + Object_Kill(&gActors[2].obj, gActors[2].sfxSource); if (gTeamShields[1] > 0) { func_i2_8018DF08(&gActors[0], 0); @@ -2431,7 +2431,7 @@ void func_i2_8018E084(Player* player) { break; case 1390: - Audio_PlaySfx(0x09000002U, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0); player->unk_194 = 5.0f; player->unk_190 = 5.0f; break; @@ -2494,7 +2494,7 @@ void func_i2_8018ED9C(Actor* actor) { case 1: actor->state = 2; - Audio_PlaySfx(0x09000002U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor->sfxSource, 0U); actor->timer_0BC = 0x96; actor->fwork[29] = 5.0f; @@ -2503,7 +2503,7 @@ void func_i2_8018ED9C(Actor* actor) { actor->fwork[0] += 2.0f; actor->unk_0F4.x += 0.1f; if (actor->timer_0BC == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } diff --git a/src/overlays/ovl_i2/fox_sx.c b/src/overlays/ovl_i2/fox_sx.c index 037ebd1d..12f4cfe2 100644 --- a/src/overlays/ovl_i2/fox_sx.c +++ b/src/overlays/ovl_i2/fox_sx.c @@ -33,7 +33,6 @@ extern s32 D_800C9E90[]; extern void func_i2_8018F030(void); extern s32 func_i2_80192AF0(s32, Gfx**, Vec3f*, Vec3f*, void*); extern void func_i2_80193208(s32, Vec3f*, void*); -extern void func_8001D9E0(s32, u16, s32, s32, s32); extern void func_800B5D30(Player*, s32); void func_i2_8018F030(void) { @@ -158,7 +157,7 @@ void func_i2_8018F330(Actor* actor) { func_800B5D30(gPlayer, 1); } D_80161A44 = 12800.0f; - Object_Kill(&gActors[50].obj, gActors[50].sfxPos); + Object_Kill(&gActors[50].obj, gActors[50].sfxSource); } break; @@ -250,7 +249,7 @@ void func_i2_8018FBBC(Vec3f* pos) { (actor->scale < 0.0f) && func_80062DBC(pos, actor->info.hitbox, &actor->obj, actor->vwork[29].x, actor->vwork[29].y, actor->vwork[29].z + actor->unk_0F4.z)) { - func_800A6028(actor->sfxPos, 0x09000004); + func_800A6028(actor->sfxSource, 0x09000004); actor->state = 1000; xRot = Math_Atan2F(actor->obj.pos.x - pos->x, actor->obj.pos.z - pos->z); yRot = -Math_Atan2F(actor->obj.pos.y - pos->y, @@ -418,7 +417,7 @@ void func_i2_80190078(Boss* boss) { boss->dmgType = 0; if (boss->swork[0] == 1) { if ((boss->dmgPart == 0) && ((boss->fwork[4] < 45.0f) || (boss->fwork[4] > 315.0f))) { - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); boss->swork[3] -= boss->damage; boss->timer_054 = 20; func_8007C120(boss->obj.pos.x, boss->obj.pos.y + 334.0f, -237.0f + boss->obj.pos.z, boss->vel.x, @@ -445,11 +444,11 @@ void func_i2_80190078(Boss* boss) { boss->swork[4] = 1; boss->health = 1; boss->swork[7] = 1; - func_8001A55C(D_i2_80195D88, 0x31032061); - func_8001A55C(D_i2_80195D98, 0x31032061); + Audio_KillSfxBySourceAndId(D_i2_80195D88, 0x31032061); + Audio_KillSfxBySourceAndId(D_i2_80195D98, 0x31032061); boss->info.hitbox = SEGMENTED_TO_VIRTUAL(D_603265C); - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); boss->timer_052 = 40; D_Timer_80161A60 = 5; } @@ -464,7 +463,7 @@ void func_i2_80190078(Boss* boss) { if (boss->dmgPart == 0) { boss->health -= boss->damage; - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); if (boss->health <= 0) { D_8017796C = -1; @@ -488,11 +487,11 @@ void func_i2_80190078(Boss* boss) { boss->swork[4] = 2; - Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09A, boss->sfxSource, 4); D_Timer_80161A60 = 8; - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); func_80042EC0(boss); boss->info.hitbox = D_800CBF34; } @@ -510,8 +509,8 @@ void func_i2_80190078(Boss* boss) { if (((boss->state != 8) && (boss->state != 20)) && (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_3)) { boss->state = 8; boss->fwork[0] = 0.0f; - func_8001A55C(D_i2_80195D88, 0x31032061); - func_8001A55C(D_i2_80195D98, 0x31032061); + Audio_KillSfxBySourceAndId(D_i2_80195D88, 0x31032061); + Audio_KillSfxBySourceAndId(D_i2_80195D98, 0x31032061); } boss->vel.z = -20.0f; @@ -533,7 +532,7 @@ void func_i2_80190078(Boss* boss) { boss->health = 300; boss->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6032550); gBossActive = 1; - func_8001D444(0, D_800C9E90[gCurrentLevel], 0, 255); + AUDIO_PLAY_BGM(D_800C9E90[gCurrentLevel]); boss->swork[6] = 1; boss->fwork[44] = 5.0f; boss->fwork[43] = 5.0f; @@ -542,7 +541,7 @@ void func_i2_80190078(Boss* boss) { case 90: if ((boss->timer_050 == 110) || (boss->timer_050 == 66)) { - Audio_PlaySfx(0x29433022, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29433022, boss->sfxSource, 4); } if (fabsf(Math_SmoothStepToF(&boss->fwork[16], 0.0f, 0.1f, 10.0f, 0)) < 8.0f) { @@ -564,7 +563,7 @@ void func_i2_80190078(Boss* boss) { if (boss->timer_050 == 0) { boss->state = 100; boss->fwork[0] = 0.0f; - Audio_PlaySfx(0x29400023, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29400023, boss->sfxSource, 4); } boss->fwork[43] = boss->fwork[44] = 5.0f; boss->fwork[42] = 30.0f; @@ -583,7 +582,7 @@ void func_i2_80190078(Boss* boss) { boss->unk_04C = 0; boss->state = 1; boss->fwork[0] = 0.0f; - Audio_PlaySfx(0x29402024, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29402024, boss->sfxSource, 4); } boss->fwork[43] = boss->fwork[44] = 5.0f; @@ -630,7 +629,7 @@ void func_i2_80190078(Boss* boss) { } if (boss->unk_04C == 60) { - Audio_PlaySfx(0x2902401C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902401C, boss->sfxSource, 4); boss->fwork[42] = 0.0f; } @@ -666,7 +665,7 @@ void func_i2_80190078(Boss* boss) { } if (boss->unk_04C == 60) { - Audio_PlaySfx(0x2902401C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902401C, boss->sfxSource, 4); boss->fwork[42] = 0.0f; } @@ -724,14 +723,14 @@ void func_i2_80190078(Boss* boss) { sp74.z = boss->fwork[10] + boss->obj.pos.z; func_8005F0E8(D_i2_80195D88, &sp74); - Audio_PlaySfx(0x31032061, D_i2_80195D88, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31032061, D_i2_80195D88, 4); sp74.x = boss->fwork[11] + boss->obj.pos.x; sp74.y = boss->fwork[12] + boss->obj.pos.y; sp74.z = boss->fwork[13] + boss->obj.pos.z; func_8005F0E8(D_i2_80195D98, &sp74); - Audio_PlaySfx(0x31032061, D_i2_80195D98, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31032061, D_i2_80195D98, 4); Math_SmoothStepToF(&boss->fwork[27], 30.0f, 0.05f, 1.0f, 0); Math_SmoothStepToF(&boss->fwork[28], -30.0f, 0.05f, 1.0f, 0); @@ -806,15 +805,15 @@ void func_i2_80190078(Boss* boss) { case 6: // Arms come back to robot if ((boss->timer_050 == 20) || (boss->timer_050 == 30)) { - Audio_PlaySfx(0x29433022, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29433022, boss->sfxSource, 4); } if (boss->timer_050 == 0) { boss->unk_04C = 0; boss->state = 1; boss->swork[1] = 1; - func_8001A55C(D_i2_80195D88, 0x31032061); - func_8001A55C(D_i2_80195D98, 0x31032061); + Audio_KillSfxBySourceAndId(D_i2_80195D88, 0x31032061); + Audio_KillSfxBySourceAndId(D_i2_80195D98, 0x31032061); boss->fwork[0] = 0.0f; boss->fwork[44] = 0.0f; boss->fwork[43] = 0.0f; @@ -859,7 +858,7 @@ void func_i2_80190078(Boss* boss) { boss->fwork[0] = 0.0f; boss->unk_04C = 0; boss->health = 300; - func_8001D9E0(0, D_800C9E90[gCurrentLevel], 1121, 25, 255); + Audio_PlaySequenceDistorted(0, D_800C9E90[gCurrentLevel], 1121, 25, 255); Radio_PlayMessage(gMsg_ID_19205, RCID_FOX); boss->timer_052 = 100; } @@ -914,7 +913,7 @@ void func_i2_80190078(Boss* boss) { } } if (boss->unk_04C == 60) { - Audio_PlaySfx(0x2902401C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902401C, boss->sfxSource, 4); } } else if (boss->timer_050 == 1) { Radio_PlayMessage(gMsg_ID_20267, RCID_PEPPY); @@ -949,7 +948,7 @@ void func_i2_80190078(Boss* boss) { if (boss->unk_04C == 70) { func_i2_8018FA04(boss->fwork[11] + boss->obj.pos.x, boss->fwork[12] + boss->obj.pos.y, boss->fwork[13] + boss->obj.pos.z); - Audio_PlaySfx(0x2902401C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902401C, boss->sfxSource, 4); } break; @@ -965,7 +964,7 @@ void func_i2_80190078(Boss* boss) { boss->unk_04C++; if (!(boss->unk_04C & 15)) { - Audio_PlaySfx(0x2902401C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902401C, boss->sfxSource, 4); } if (boss->unk_04C >= Animation_GetFrameCount(&D_60158C4)) { @@ -1004,13 +1003,13 @@ void func_i2_80190078(Boss* boss) { boss->fwork[3] = -1000.0f; boss->fwork[1] = -2500.0f; if (!(gGameFrameCount & 15)) { - Audio_PlaySfx(0x2902401C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902401C, boss->sfxSource, 4); } } else if (boss->timer_050 > 100) { boss->fwork[3] = 0; boss->fwork[1] = -500.0f; if (!(gGameFrameCount & 0xF)) { - Audio_PlaySfx(0x2902401C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902401C, boss->sfxSource, 4); } } else { boss->fwork[3] = 0; @@ -1096,7 +1095,7 @@ void func_i2_80190078(Boss* boss) { gPlayer[0].unk_1D0 = 0; gPlayer[0].unk_234 = 1; } - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); D_80177930 = boss->swork[6]; } break; @@ -1443,7 +1442,7 @@ void func_i2_80193800(Actor* actor, s32 arg1) { actor->obj.rot.x = 15.0f; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x31000011, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000011, actor->sfxSource, 4); } void func_i2_801938D8(Actor* actor, s32 arg1) { @@ -1463,8 +1462,8 @@ void func_i2_801938D8(Actor* actor, s32 arg1) { actor->obj.rot.z = -20.0f; } Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); } void func_i2_80193A30(Player* player) { @@ -1517,12 +1516,12 @@ void func_i2_80193A30(Player* player) { xyzDeg, xzDeg, 0.0f); } if (gCsFrameCount == 143) { - Object_Kill(&gPlayerShots[0].obj, gPlayerShots[0].sfxPos); + Object_Kill(&gPlayerShots[0].obj, gPlayerShots[0].sfxSource); func_8007BFFC(gActors[5].obj.pos.x, gActors[5].obj.pos.y, gActors[5].obj.pos.z, 0.0f, 0.0f, 0.0f, 3.0f, 40); func_8007D2C8(gActors[5].obj.pos.x, gActors[5].obj.pos.y, gActors[5].obj.pos.z, 6.0f); func_8007B344(gActors[5].obj.pos.x, gActors[5].obj.pos.y, gActors[5].obj.pos.z, 5.0f, 5); - Object_Kill(&gActors[5].obj, gActors[5].sfxPos); + Object_Kill(&gActors[5].obj, gActors[5].sfxSource); for (i = 0; i < 20; i++) { func_80079618(gActors[5].obj.pos.x, gActors[5].obj.pos.y, gActors[5].obj.pos.z, 0.5f); } @@ -1543,9 +1542,9 @@ void func_i2_80193A30(Player* player) { player->unk_0D0 = 30.0f; player->unk_0EC = -80.0f; player->unk_0E4 = -20.0f; - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); for (i = 6; i < 10; i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } D_80177A48[0] = 0.0f; } @@ -1611,7 +1610,7 @@ void func_i2_80193A30(Player* player) { if (player->timer_1F8 == 0) { player->unk_0D0 = D_80161A54; - func_8001D444(0, D_80177C90, 0, 255); + AUDIO_PLAY_BGM(D_80177C90); D_80177838 = 80; player->state_1C8 = PLAYERSTATE_1C8_3; player->unk_1D0 = player->timer_1F8 = player->timer_1FC = 0; @@ -1622,7 +1621,7 @@ void func_i2_80193A30(Player* player) { player->camAt.x = player->camEye.x = player->pos.x; D_80178488 = 1; for (i = 0; i < 3; i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } break; @@ -1690,7 +1689,7 @@ void func_i2_801944D4(Actor* actor, s32 arg1) { actor->obj.rot.z = D_i2_80195770[arg1]; actor->iwork[11] = 1; actor->iwork[14] = D_i2_8019577C[arg1]; - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } } @@ -1714,7 +1713,7 @@ void func_i2_80194728(Player* player) { switch (player->unk_1D0) { case 0: - func_8001A38C(1, player->sfxPos); + Audio_StopSfxByBankAndSource(1, player->sfxSource); player->unk_1D0 += 1; D_80177A48[1] = 0.05f; D_80177A48[0] = 0.02f; @@ -1766,7 +1765,7 @@ void func_i2_80194728(Player* player) { } if (gCsFrameCount == 1195) { - func_8001DBD0(10); + Audio_FadeOutAll(10); } if (gCsFrameCount >= 1196) { @@ -1805,7 +1804,7 @@ void func_i2_80194728(Player* player) { break; case 30: - func_8001D444(0, 38, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_38); break; case 60: @@ -1819,7 +1818,7 @@ void func_i2_80194728(Player* player) { case 920: gActors[1].iwork[14] = gActors[2].iwork[14] = gActors[3].iwork[14] = 0; func_i2_801944D4(&gActors[0], 3); - Audio_PlaySfx(0x11030010, gActors[0].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, gActors[0].sfxSource, 0); break; case 1050: @@ -1835,9 +1834,9 @@ void func_i2_80194728(Player* player) { break; case 1160: - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); player->unk_1D0 = 2; player->timer_1F8 = 40; player->unk_194 = 5.0f; diff --git a/src/overlays/ovl_i3/fox_a6.c b/src/overlays/ovl_i3/fox_a6.c index 2db0a85f..a2629c92 100644 --- a/src/overlays/ovl_i3/fox_a6.c +++ b/src/overlays/ovl_i3/fox_a6.c @@ -523,9 +523,9 @@ void func_i3_80187754(Boss* bossA6) { A6_HIT_1(bossA6, 0)->z.size = A6_HIT_1(bossA6, 1)->z.size = A6_HIT_1(bossA6, 2)->z.size = 195.0f; A6_HIT_1(bossA6, 0)->y.size = A6_HIT_1(bossA6, 1)->y.size = A6_HIT_1(bossA6, 2)->y.size = 147.0f; A6_HIT_1(bossA6, 0)->x.size = A6_HIT_1(bossA6, 1)->x.size = A6_HIT_1(bossA6, 2)->x.size = 153.0f; - func_800182F4(0x102800FF); - func_800182F4(0x112800FF); - Audio_PlaySfx(0x11002050, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 40); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); + AUDIO_PLAY_SFX(0x11002050, bossA6->sfxSource, 4); } #ifdef NON_MATCHING @@ -570,9 +570,9 @@ void func_i3_80187944(Boss* bossA6) { bossA6->health -= bossA6->damage; if (bossA6->health < 390) { - Audio_PlaySfx(0x2943500F, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2943500F, bossA6->sfxSource, 4); } else { - Audio_PlaySfx(0x29034003, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, bossA6->sfxSource, 4); } if (bossA6->health <= 0) { bossA6->health = 0; @@ -580,10 +580,10 @@ void func_i3_80187944(Boss* bossA6) { Radio_PlayMessage(gMsg_ID_15252, RCID_SLIPPY); D_8017796C = -1; D_8015F984 = (D_80177D20 * 0.00004f) + 0.5f; - Audio_PlaySfx(0x2940D09A, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09A, bossA6->sfxSource, 4); gShowBossHealth = 0; - func_800182F4(0x102800FF); - func_800182F4(0x112800FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 40); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); bossA6->fwork[A6_FWK_5] = 5.0f; bossA6->fwork[A6_FWK_3] = -20000.0f; bossA6->fwork[A6_FWK_1] = 170.0f; @@ -601,8 +601,8 @@ void func_i3_80187944(Boss* bossA6) { bossA6->swork[A6_SWK_33 + 0] = bossA6->swork[A6_SWK_33 + 1] = bossA6->swork[A6_SWK_33 + 2] = 0; D_Timer_80161A60 = 4; bossA6->state = 11; - Audio_PlaySfx(0x2940C00A, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x3143402E, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940C00A, bossA6->sfxSource, 4); + AUDIO_PLAY_SFX(0x3143402E, bossA6->sfxSource, 4); } } if (((bossA6->dmgPart == 4) || (bossA6->dmgPart == 5) || (bossA6->dmgPart == 6)) && @@ -614,7 +614,7 @@ void func_i3_80187944(Boss* bossA6) { func_i3_8018A2C4(bossA6); } if (bossA6->dmgPart >= 7) { - Audio_PlaySfx(0x29121007, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossA6->sfxSource, 4); } } for (i = 0; i < 3; i++) { @@ -777,8 +777,8 @@ void func_i3_80187944(Boss* bossA6) { Math_SmoothStepToF(&D_i3_801C22F0.unk_24, 0.0f, 0.1f, 1.0f, 0); if (D_i3_801C22F0.unk_24 < 1.0f) { D_i3_801C22F0.unk_24 = 0.0f; - Audio_KillSfx(bossA6->sfxPos); - Audio_PlaySfx(0x19004051, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Audio_KillSfxBySource(bossA6->sfxSource); + AUDIO_PLAY_SFX(0x19004051, bossA6->sfxSource, 4); bossA6->timer_050 = 20; bossA6->obj.pos.z = gPlayer[0].camEye.z - D_80177D20 + bossA6->fwork[A6_FWK_3]; bossA6->fwork[A6_FWK_6] = bossA6->obj.pos.x = gPlayer[0].camEye.x; @@ -788,7 +788,7 @@ void func_i3_80187944(Boss* bossA6) { bossA6->vel.y = 0.0f; bossA6->vel.z = -40.0f; - Audio_PlaySfx(0x39408092, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39408092, bossA6->sfxSource, 4); } } break; @@ -798,7 +798,7 @@ void func_i3_80187944(Boss* bossA6) { Math_SmoothStepToAngle(&bossA6->obj.rot.z, 0.0f, 1.0f, 10.0f, 0.0001f); if (bossA6->obj.rot.z < 1.0f) { if (D_i3_801C2250[A6_BSS_27] == 0) { - Audio_PlaySfx(0x39408091, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39408091, bossA6->sfxSource, 4); D_i3_801C2250[A6_BSS_27] = 1; } bossA6->obj.rot.z = 0.0f; @@ -831,7 +831,7 @@ void func_i3_80187944(Boss* bossA6) { bossA6->timer_050 = 50; bossA6->state = 2; D_i3_801C2250[A6_BSS_8] = 0; - Audio_PlaySfx(0x39408092, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39408092, bossA6->sfxSource, 4); } } break; @@ -886,7 +886,7 @@ void func_i3_80187944(Boss* bossA6) { if ((D_i3_801C2250[A6_BSS_6] == 0) || (D_i3_801C2250[A6_BSS_0] == 0)) { bossA6->fwork[A6_FWK_1] = 90.0f; bossA6->fwork[A6_FWK_2] = 2.0f; - Audio_PlaySfx(0x31404066, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31404066, bossA6->sfxSource, 4); bossA6->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6028578); D_i3_801C2250[A6_BSS_7] = 0; } @@ -895,9 +895,9 @@ void func_i3_80187944(Boss* bossA6) { break; case 3: if (bossA6->timer_050 == 1) { - Audio_KillSfx(bossA6->sfxPos); + Audio_KillSfxBySource(bossA6->sfxSource); if (D_i3_801C2250[A6_BSS_7] == 0) { - Audio_PlaySfx(0x31008069, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31008069, bossA6->sfxSource, 4); D_i3_801C2250[A6_BSS_7] = 1; } } @@ -928,8 +928,8 @@ void func_i3_80187944(Boss* bossA6) { bossA6->fwork[A6_FWK_2] = 1.0f; bossA6->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6028454); D_i3_801C2250[A6_BSS_6] = 1; - Audio_KillSfx(bossA6->sfxPos); - Audio_PlaySfx(0x31404067, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Audio_KillSfxBySource(bossA6->sfxSource); + AUDIO_PLAY_SFX(0x31404067, bossA6->sfxSource, 4); bossA6->swork[A6_SWK_30 + 0] = bossA6->swork[A6_SWK_30 + 1] = bossA6->swork[A6_SWK_30 + 2] = 0; } else if (bossA6->swork[A6_SWK_30 + 0] == 0) { func_i3_8018A1B0(bossA6, 0); @@ -948,7 +948,7 @@ void func_i3_80187944(Boss* bossA6) { } bossA6->fwork[A6_FWK_3] = RAND_FLOAT_CENTERED(1000.0f) + -3700.0f; if (D_i3_801C2250[A6_BSS_28] == 0) { - Audio_PlaySfx(0x39404068, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39404068, bossA6->sfxSource, 4); } } Math_SmoothStepToF(&bossA6->fwork[A6_FWK_29], 255.0f, 1.0f, 10.0f, 0.0001f); @@ -976,12 +976,12 @@ void func_i3_80187944(Boss* bossA6) { bossA6->timer_050 = 30; bossA6->fwork[A6_FWK_8] = bossA6->fwork[A6_FWK_9] = 0; bossA6->fwork[A6_FWK_2] = 2.0f; - Audio_PlaySfx(0x31404066, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31404066, bossA6->sfxSource, 4); bossA6->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6028578); D_i3_801C2250[A6_BSS_7] = bossA6->swork[A6_SWK_37] = 0; bossA6->state = 3; if (D_i3_801C2250[A6_BSS_6] == 0) { - func_8001D444(0, 0x8017, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_23 | 0x8000); } } } else if (bossA6->swork[A6_SWK_38] != 0) { @@ -998,7 +998,7 @@ void func_i3_80187944(Boss* bossA6) { case 5: if (bossA6->timer_050 == 1) { func_i3_80187704(); - Audio_PlaySfx(0x39033093, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39033093, bossA6->sfxSource, 4); D_i3_801C2250[A6_BSS_33] = 120; } if (D_i3_801C2250[A6_BSS_33] != 0) { @@ -1056,7 +1056,7 @@ void func_i3_80187944(Boss* bossA6) { D_i3_801C22F0.unk_28[0] = D_i3_801C22F0.unk_28[2] = D_i3_801C22F0.unk_28[1] = 255.0f; bossA6->state = 1; D_i3_801C2250[A6_BSS_27] = 0; - Object_Kill(&temp_s0_3->obj, temp_s0_3->sfxPos); + Object_Kill(&temp_s0_3->obj, temp_s0_3->sfxSource); } } break; @@ -1066,13 +1066,13 @@ void func_i3_80187944(Boss* bossA6) { bossA6->timer_052 = 300; bossA6->timer_054 = 0; bossA6->state = 9; - Audio_PlaySfx(0x11002050, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11002050, bossA6->sfxSource, 4); } break; case 9: if (bossA6->timer_052 == 0) { - Audio_KillSfx(bossA6->sfxPos); - Audio_PlaySfx(0x19004051, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Audio_KillSfxBySource(bossA6->sfxSource); + AUDIO_PLAY_SFX(0x19004051, bossA6->sfxSource, 4); bossA6->timer_054 = 0; bossA6->state = 10; } else { @@ -1149,7 +1149,7 @@ void func_i3_80187944(Boss* bossA6) { } if (bossA6->timer_052 == 0) { gShowBossHealth = 0; - Object_Kill(&bossA6->obj, bossA6->sfxPos); + Object_Kill(&bossA6->obj, bossA6->sfxSource); } break; } @@ -1633,7 +1633,7 @@ void func_i3_8018B9BC(Boss* bossA6) { D_i3_801C2250[A6_BSS_25] = 20; } } - Audio_PlaySfx(0x29033064, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29033064, bossA6->sfxSource, 4); if (bossA6->swork[A6_SWK_0 + j] <= 0) { bossA6->swork[A6_SWK_0 + j] = 0; Matrix_MultVec3f(gCalcMatrix, &bossA6->vwork[A6_VWK_1 + i], &sp94); @@ -1648,7 +1648,7 @@ void func_i3_8018B9BC(Boss* bossA6) { } if ((bossA6->swork[A6_SWK_15] == 0) && (bossA6->swork[A6_SWK_16] == 0) && (bossA6->swork[A6_SWK_17] == 0)) { - Audio_KillSfx(bossA6->sfxPos); + Audio_KillSfxBySource(bossA6->sfxSource); if (bossA6->swork[A6_SWK_25] != 0) { bossA6->swork[A6_SWK_25]--; if (bossA6->swork[A6_SWK_25] != 0) { @@ -1902,7 +1902,7 @@ void func_i3_8018C54C(Boss* bossA6) { if (bossA6->swork[A6_SWK_25] != 0) { j = bossA6->swork[A6_SWK_25] - 1; if ((bossA6->timer_058 != 0) && !(bossA6->timer_058 & 3)) { - Audio_PlaySfx(0x29034003, bossA6->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, bossA6->sfxSource, 4); } if (bossA6->timer_058 == 1) { if (bossA6->swork[A6_SWK_25] == 2) { @@ -1996,7 +1996,7 @@ void func_i3_8018D3CC(s32 arg0, f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel gPlayerShots[i].unk_64 = 150; gPlayerShots[i].playerNum = 100; - Audio_PlaySfx(0x2900000D, gPlayerShots[i].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900000D, gPlayerShots[i].sfxSource, 4); break; } } @@ -2008,7 +2008,7 @@ void func_i3_8018D4E0(Actor* actor) { func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 0.0f, 0.0f, 0.0f, 4.0f, 0x14); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 7.0f); func_8007B344(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 6.0f, 5); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); for (i = 0; i < 15; i++) { func_800794CC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 1.0f); } @@ -2028,7 +2028,7 @@ void func_i3_8018D5C8(void) { gActors[i].fwork[0] = 0.0f; gActors[i].obj.id = OBJ_ACTOR_195; Object_SetInfo(&gActors[i].info, gActors[i].obj.id); - Audio_PlaySfx(0x11030010, gActors[i].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, gActors[i].sfxSource, 0); } void func_i3_8018D694(Actor* actor, s32 arg1) { @@ -2052,7 +2052,7 @@ void func_i3_8018D694(Actor* actor, s32 arg1) { actor->fwork[8] = RAND_FLOAT_SEEDED(360.0f); actor->fwork[9] = RAND_FLOAT_SEEDED(360.0f); Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x31000011, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000011, actor->sfxSource, 4); } void func_i3_8018D804(Actor* actor, s32 arg1) { @@ -2073,7 +2073,7 @@ void func_i3_8018D804(Actor* actor, s32 arg1) { actor->iwork[11] = 1; actor->fwork[0] = 0.0f; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } void func_i3_8018D920(Vec3f* arg0) { @@ -2126,7 +2126,7 @@ void func_i3_8018DA58(Actor* actor) { case 11: case 16: actor->state++; - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); actor->fwork[29] = 5.0f; /* fallthrough */ case 7: @@ -2274,7 +2274,7 @@ void func_i3_8018DF74(Player* player) { if (gCsFrameCount == 460) { player->unk_190 = 2.0f; player->unk_194 = 5.0f; - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); } if (gCsFrameCount >= 460) { Math_SmoothStepToF(&player->unk_0D0, 50.0f, 0.1f, 3.0f, 0.01f); @@ -2292,14 +2292,14 @@ void func_i3_8018DF74(Player* player) { player->unk_1D0 = 0; player->timer_1F8 = 0; - func_8001D444(0, 0x8007, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_7 | 0x8000); player->state_1C8 = PLAYERSTATE_1C8_3; } break; } switch (gCsFrameCount) { case 280: - func_8001D444(0, 0x33, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_51); break; case 40: Radio_PlayMessage(gMsg_ID_7005, RCID_CAIMAN_AREA6); @@ -2418,8 +2418,8 @@ void func_i3_8018EB3C(Actor* actor) { actor->state = 100; actor->fwork[0] = 0.0f; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x11030010, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31024059, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, actor->sfxSource, 0); + AUDIO_PLAY_SFX(0x31024059, actor->sfxSource, 0); } void func_i3_8018EC38(Actor* actor, s32 arg1) { @@ -2444,7 +2444,7 @@ void func_i3_8018EC38(Actor* actor, s32 arg1) { actor->iwork[14] = arg1 + 2; } Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } } @@ -2467,7 +2467,7 @@ void func_i3_8018ED78(Player* player) { player->unk_194 = 5.0f; player->unk_190 = 2.0f; player->unk_0D0 = 60.0f; - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); D_80177A48[3] = 0.0f; /* fallthrough */ case 1: @@ -2529,7 +2529,7 @@ void func_i3_8018ED78(Player* player) { D_80178348 = D_80178350 = D_80178354 = D_80178340 = 0; } if ((gCsFrameCount == 146) || (gCsFrameCount == 150)) { - Audio_PlaySfx(0x2940F026, gActors[5].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940F026, gActors[5].sfxSource, 4); } if (gCsFrameCount > 146) { actor4->iwork[3] -= 4; @@ -2630,10 +2630,10 @@ void func_i3_8018ED78(Player* player) { player->camEye.z = gCsCamEyeZ = sp6C.z; if (gCsFrameCount == 1076) { - Object_Kill(&gActors[0].obj, gActors[0].sfxPos); + Object_Kill(&gActors[0].obj, gActors[0].sfxSource); player->unk_190 = 2.0f; player->unk_194 = 5.0f; - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); } if (gCsFrameCount >= 1090) { D_80178348 = D_80178350 = D_80178354 = 0; @@ -2653,7 +2653,7 @@ void func_i3_8018ED78(Player* player) { } D_80161A94[0] = gGoldRingCount[0]; func_8001CA24(0); - Audio_KillSfx(player->sfxPos); + Audio_KillSfxBySource(player->sfxSource); func_800A6148(); gNextGameState = GSTATE_PLAY; gNextLevel = LEVEL_VENOM_2; @@ -2661,14 +2661,14 @@ void func_i3_8018ED78(Player* player) { } } if (gCsFrameCount == 1040) { - func_800182F4(0x105000FF); - func_800182F4(0x115000FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 80); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 80); } break; } switch (gCsFrameCount) { case 380: - func_8001D444(0, 38, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_38); break; case 550: D_80177840 = 100; @@ -2684,15 +2684,15 @@ void func_i3_8018ED78(Player* player) { break; case 1070: gActors[1].fwork[29] = 5.0f; - Audio_PlaySfx(0x09000002, gActors[1].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, gActors[1].sfxSource, 0); break; case 1072: gActors[2].fwork[29] = 5.0f; - Audio_PlaySfx(0x09000002, gActors[2].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, gActors[2].sfxSource, 0); break; case 1074: gActors[3].fwork[29] = 5.0f; - Audio_PlaySfx(0x09000002, gActors[3].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, gActors[3].sfxSource, 0); break; } if (gCsFrameCount >= 1070) { diff --git a/src/overlays/ovl_i3/fox_aq.c b/src/overlays/ovl_i3/fox_aq.c index 1b44ec01..b17a1532 100644 --- a/src/overlays/ovl_i3/fox_aq.c +++ b/src/overlays/ovl_i3/fox_aq.c @@ -664,7 +664,7 @@ void func_i3_801A9ED0(Player* player) { } } if ((sp8C != D_i3_801C4190[4]) && (D_i3_801C41B8[5] == 3.0f)) { - Audio_PlaySfx(0x4900001B, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900001B, gDefaultSfxSource, 4); D_i3_801C41B8[5] = 20.0f; } } @@ -740,23 +740,23 @@ void func_i3_801AA4BC(Player* player) { Math_SmoothStepToF(&player->unk_12C, sp3C, sp38, 10.0f, 0); } if ((gInputPress->button & Z_TRIG) && (player->unk_230 == 0)) { - player->unk_48C = 1; + player->sfx.bank = 1; if (player->timer_1E0 != 0) { player->unk_1DC = 1; player->timer_1E8 = 10; player->unk_1EC = player->unk_1F0 = 30; - player->unk_494 = 1; + player->sfx.roll = 1; } else { player->timer_1E0 = 10; } } if ((gInputPress->button & R_TRIG) && (player->unk_230 == 0)) { - player->unk_48C = 1; + player->sfx.bank = 1; if (player->timer_1E4 != 0) { player->unk_1DC = 1; player->timer_1E8 = 10; player->unk_1EC = player->unk_1F0 = -30; - player->unk_494 = 1; + player->sfx.roll = 1; } else { player->timer_1E4 = 10; } @@ -927,7 +927,7 @@ void func_i3_801AACF8(Player* player) { sp58 = 0.0f; D_80177968 = 2.0f; if (D_i3_801C4190[7] == 0) { - Audio_PlaySfx(0x9404028, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x9404028, player->sfxSource, 0); D_i3_801C4190[7] = 1; } } @@ -1147,7 +1147,7 @@ void func_i3_801AC09C(Player* player) { for (i = 15, shot = &gPlayerShots[15]; i < 16; i++, shot++) { if (shot->obj.status == OBJ_FREE) { func_800AC290(player, shot, 0.0f, 0.0f, PLAYERSHOT_8, 50.0f); - Audio_PlaySfx(0x1000025, shot->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1000025, shot->sfxSource, 0); D_i3_801C4190[5] = i + 1; D_i3_801C4454 = 300; D_i3_801C4458 = -100.0f; @@ -1165,9 +1165,9 @@ void func_i3_801AC18C(Player* player) { if (gPlayerShots[i].obj.status == OBJ_FREE) { func_800AC290(player, &gPlayerShots[i], 0.0f, -10.0f, PLAYERSHOT_0, 120.0f); if (gLaserStrength[gPlayerNum] == LASERS_SINGLE) { - Audio_PlaySfx(0x9400021, gPlayerShots[i].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x9400021, gPlayerShots[i].sfxSource, 0); } else { - Audio_PlaySfx(0x9400027, gPlayerShots[i].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x9400027, gPlayerShots[i].sfxSource, 0); } break; } @@ -1232,7 +1232,7 @@ void func_i3_801AC274(Player* player) { } if ((D_i3_801C4190[0] != temp) && (D_i3_801C41B8[5] == 3.0f)) { - Audio_PlaySfx(0x4900001B, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900001B, gDefaultSfxSource, 4); D_i3_801C41B8[5] = 20.0f; } if (D_i3_801C4190[0] != 0) { @@ -1318,7 +1318,7 @@ void func_i3_801AC918(Effect* effect) { effect->vel.y += 0.1f; } if (effect->unk_46 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->scale1 += 33.0f; temp_fs0 = COS_DEG(effect->scale1) * 1.5f; @@ -1327,7 +1327,7 @@ void func_i3_801AC918(Effect* effect) { break; case 1: if (effect->unk_46 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->unk_60.x += 0.07f; effect->scale1 += 33.0f; @@ -1342,7 +1342,7 @@ void func_i3_801AC918(Effect* effect) { effect->vel.y += 0.2f; } if (effect->unk_46 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->scale1 += 55.0f; temp_fs0 = COS_DEG(effect->scale1) * 2.5f; @@ -1389,7 +1389,7 @@ void func_i3_801ACE50(Player* player) { Vec3f sp54; Vec3f sp48; - player->boost = 0; + player->sfx.boost = 0; if (player->timer_27C != 0) { player->timer_27C--; player->unk_110 += 0.3f; @@ -1427,7 +1427,7 @@ void func_i3_801ACE50(Player* player) { if ((gBoostButton[player->num] & gInputHold->button) && (player->unk_230 == 0) && (player->state_1C8 != PLAYERSTATE_1C8_5) && (player->unk_2B4 == 0)) { if (player->unk_2BC == 0) { - Audio_PlaySfx(0x9004030, player->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x9004030, player->sfxSource, 4); } player->unk_2BC += 3.0f; if (player->unk_2BC > 90.0f) { @@ -1440,7 +1440,7 @@ void func_i3_801ACE50(Player* player) { } Math_SmoothStepToF(&D_i3_801C41B8[27], 10.0f, 0.1f, 2.0f, 0.00001f); Math_SmoothStepToF(&player->unk_08C, -200.0f, 0.1f, D_i3_801C41B8[27], 0.00001f); - player->boost = 1; + player->sfx.boost = 1; Math_SmoothStepToF(&D_801779A8[0], 50.0f, 1.0f, 10.0f, 0.0f); } else { D_i3_801C41B8[27] = 0.0f; @@ -1463,11 +1463,11 @@ void func_i3_801ACE50(Player* player) { } void func_i3_801AD328(Player* player) { - player->brake = 0; + player->sfx.brake = 0; if ((gBrakeButton[player->num] & gInputHold->button) && (player->unk_230 == 0) && (player->state_1C8 != PLAYERSTATE_1C8_5) && (player->unk_2B4 == 0)) { if (player->unk_2BC == 0) { - Audio_PlaySfx(0x9004031, player->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x9004031, player->sfxSource, 4); } player->unk_2BC += 3.0f; if (player->unk_2BC > 90.0f) { @@ -1480,7 +1480,7 @@ void func_i3_801AD328(Player* player) { } Math_SmoothStepToF(&D_i3_801C41B8[28], 10.0f, 1.0f, 2.0f, 0.00001f); Math_SmoothStepToF(&player->unk_08C, 180.0f, 0.1f, D_i3_801C41B8[28], 0.0f); - player->brake = 1; + player->sfx.brake = 1; Math_SmoothStepToF(&D_801779A8[0], 25.0f, 1.0f, 5.0f, 0.0f); } else { if (player->unk_2BC > 0.0f) { @@ -1548,7 +1548,7 @@ void func_i3_801AD6C0(Actor* actor) { actor->vel.z = 0.0f; } if ((gPlayer[0].unk_138 + 500.0f) <= actor->obj.pos.z) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } actor->unk_04E++; if (actor->unk_04E >= 50) { @@ -1562,7 +1562,7 @@ void func_i3_801AD6C0(Actor* actor) { actor->unk_0F4.z = Math_ModF(actor->unk_0F4.z, 360.0f); } else { actor->health = 30; - Audio_PlaySfx(0x31000047, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000047, actor->sfxSource, 4); actor->state++; } break; @@ -1572,14 +1572,14 @@ void func_i3_801AD6C0(Actor* actor) { actor->unk_0D0 = 0; actor->timer_0C6 = 15; actor->health -= actor->damage; - Audio_PlaySfx(0x29034045, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034045, actor->sfxSource, 4); if (actor->health <= 0) { actor->timer_0C2 = 30000; actor->state = 2; actor->vel.y = 0.0f; actor->vel.x = 0.0f; actor->vel.z = 0.0f; - Audio_PlaySfx(0x2902A046, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902A046, actor->sfxSource, 4); } } } @@ -1654,11 +1654,11 @@ void func_i3_801AD6C0(Actor* actor) { actor->unk_044 = 0; actor->unk_0D4 = 2; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } actor->timer_0BC = 4; func_8007D0E0(D_i3_801C27C0->pos.x, D_i3_801C27C0->pos.y, D_i3_801C27C0->pos.z, 3.0f); - Audio_PlaySfx(0x29018049, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29018049, actor->sfxSource, 4); } break; } @@ -1781,7 +1781,7 @@ void func_i3_801AE3D8(Actor* actor) { actor->timer_0C6 = 30; actor->iwork[1] = 0; D_i3_801C4308[79] -= 5.0f; - Audio_PlaySfx(0x29036050, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29036050, actor->sfxSource, 4); if (D_i3_801C4308[79] <= -28.0f) { D_i3_801C4308[79] = -28.0f; } @@ -1814,8 +1814,7 @@ void func_i3_801AE3D8(Actor* actor) { actor->health = 0; actor->timer_0C6 = 300; actor->fwork[2] = actor->scale; - Audio_PlaySfx(0x19000033, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000033, actor->sfxSource, 4); actor->state++; } } @@ -1856,7 +1855,7 @@ void func_i3_801AE3D8(Actor* actor) { func_8007BC7C(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 50.0f); func_8007BC7C(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 50.0f); func_8007BC7C(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 50.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); D_i3_801C42A0[23]--; gBosses[0].swork[AQ_SWK_0] = 3; gBosses[0].swork[AQ_SWK_19] = 30; @@ -2033,7 +2032,7 @@ void func_i3_801AFA5C(Actor* actor) { if ((gBosses[0].state >= 10) && (actor->health != 0) && (actor->damage == 31)) { actor->timer_0BE = 70; actor->health -= actor->damage; - Audio_PlaySfx(0x2903604CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903604CU, actor->sfxSource, 4U); if (actor->timer_0C6 == 0) { actor->timer_0C6 = 70; } @@ -2048,7 +2047,7 @@ void func_i3_801AFA5C(Actor* actor) { } } if (D_i3_801C42A0[23] == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } if (actor->timer_0C6 & 1) { func_8007C120(actor->obj.pos.x, actor->obj.pos.y + 100.0f, actor->obj.pos.z + RAND_FLOAT(500.0f), actor->vel.x, @@ -2101,7 +2100,7 @@ void func_i3_801AFA5C(Actor* actor) { i = -1; } if ((actor->iwork[1] == 13) && (i < 0)) { - Audio_PlaySfx(0x29022048U, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29022048U, actor->sfxSource, 4U); for (i = 0, sp48 = gActors; i < 60; i++, sp48++) { if (sp48->obj.status == OBJ_FREE) { Actor_Initialize(sp48); @@ -2152,7 +2151,7 @@ void func_i3_801AFA5C(Actor* actor) { actor->state = 5; actor->vel.y = 10.0f; actor->vel.z = 5.0f; - Audio_PlaySfx(0x1902102FU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1902102FU, actor->sfxSource, 4U); break; case 5: if (actor->obj.pos.y > (gGroundLevel + 70.0f)) { @@ -2183,10 +2182,10 @@ void func_i3_801AFA5C(Actor* actor) { } if (actor->vel.z != 0) { actor->vel.y = actor->vel.z = 0.0f; - Audio_PlaySfx(0x19402031U, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19402031U, actor->sfxSource, 4U); } if (actor->timer_0C0 == 1) { - Audio_PlaySfx(0x19003030U, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19003030U, actor->sfxSource, 4U); } if (actor->timer_0C0 == 0) { if (actor->timer_0BE == 0) { @@ -2208,7 +2207,7 @@ void func_i3_801AFA5C(Actor* actor) { gBosses[0].swork[AQ_SWK_19] = 30; } } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } } @@ -2307,7 +2306,7 @@ void func_i3_801B0B60(Actor* actor) { actor->unk_0D4 = 2; func_80066254(actor); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_800815DC(); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 50.0f, 5.0f); func_8007A6F0(&actor->obj.pos, 0x29018049); @@ -2406,7 +2405,7 @@ void func_i3_801B10F8(Boss* bossAQ) { bossAQ->info.hitbox[119] = 1028.0f; bossAQ->info.hitbox[169] = 800.0f; bossAQ->swork[AQ_SWK_8] = bossAQ->swork[AQ_SWK_9] = 2; - Audio_PlaySfx(0x3140904D, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3140904D, bossAQ->sfxSource, 4); } // OBJ_BOSS_AQ action @@ -2454,14 +2453,14 @@ void func_i3_801B134C(Boss* bossAQ) { } } bossAQ->swork[AQ_SWK_21] = 1; - func_800182F4(0x102800FF); - func_800182F4(0x112800FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 40); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); Radio_PlayMessage(gMsg_ID_15100, RCID_FOX); } if (fabsf(bossAQ->obj.pos.z - gPlayer[0].unk_138) <= 3000.0f) { D_i3_801C4190[6] = 1; bossAQ->timer_056 = 20; - func_8001D444(0, 32798, 0, 1); + Audio_PlaySequence(SEQ_PLAYER_BGM, SEQ_ID_30 | 0x8000, 0, 1); bossAQ->state = 1; } break; @@ -2471,7 +2470,7 @@ void func_i3_801B134C(Boss* bossAQ) { D_i3_801C4308[12] = D_i3_801C4308[13] = 0.0f; bossAQ->timer_056 = 20; bossAQ->state = 2; - Audio_PlaySfx(0x1900002E, bossAQ->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900002E, bossAQ->sfxSource, 0); } break; case 2: @@ -2561,7 +2560,7 @@ void func_i3_801B134C(Boss* bossAQ) { break; case 14: if (bossAQ->timer_056 == 58) { - Audio_PlaySfx(0x29408055, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29408055, bossAQ->sfxSource, 4); } if ((bossAQ->timer_056 == 0) && (D_i3_801C4308[12] <= -44.0f)) { bossAQ->swork[AQ_SWK_2] = bossAQ->swork[AQ_SWK_3] = 20; @@ -2699,7 +2698,7 @@ void func_i3_801B134C(Boss* bossAQ) { bossAQ->timer_052 = 0; bossAQ->swork[AQ_SWK_19] = 500; D_i3_801C4308[79] = 0.0f; - Audio_PlaySfx(0x29408054, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29408054, bossAQ->sfxSource, 4); if (bossAQ->state < 14) { for (i3 = 0, actor = gActors; i3 < 60; i3++, actor++) { if ((actor->obj.id == OBJ_ACTOR_260) && (actor->obj.status == OBJ_ACTIVE)) { @@ -2709,7 +2708,7 @@ void func_i3_801B134C(Boss* bossAQ) { bossAQ->timer_058 = 30; bossAQ->swork[AQ_SWK_0] = 4; D_80178480 = 50; - Audio_PlaySfx(0x1900002D, bossAQ->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900002D, bossAQ->sfxSource, 0); func_80062B60(bossAQ->obj.pos.x, bossAQ->obj.pos.z + 800.0f, 0, 100.0f); var_fs3 = 80.0f; for (i2 = 0; i2 < 3; i2++, var_fs3 += 10.0f) { @@ -2758,24 +2757,21 @@ void func_i3_801B134C(Boss* bossAQ) { D_i3_801C42A0[22] = 0; bossAQ->swork[AQ_SWK_12]--; bossAQ->swork[AQ_SWK_13] = 70; - Audio_PlaySfx(0x2940604C, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940604C, bossAQ->sfxSource, 4); } } else if (bossAQ->state >= 10) { - Audio_PlaySfx(0x29121007, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossAQ->sfxSource, 4); } break; case 14: if (bossAQ->damage == 31) { if (D_i3_801C42A0[23] != 0) { - Audio_PlaySfx(0x29121007, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossAQ->sfxSource, 4); } else if ((bossAQ->state >= 15) && (bossAQ->swork[AQ_SWK_8] != 0)) { D_i3_801C42A0[1] = 50; sBossAQlimbTimers[AQ_LIMB_7] = 50; bossAQ->swork[AQ_SWK_8]--; - Audio_PlaySfx(0x2903604C, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903604C, bossAQ->sfxSource, 4); if (bossAQ->swork[AQ_SWK_8] == 0) { spD4.x = D_i3_801C4308[73]; spD4.y = D_i3_801C4308[74]; @@ -2789,14 +2785,12 @@ void func_i3_801B134C(Boss* bossAQ) { case 15: if (bossAQ->damage == 31) { if (D_i3_801C42A0[23] != 0) { - Audio_PlaySfx(0x29121007, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossAQ->sfxSource, 4); } else if ((bossAQ->state >= 15) && (bossAQ->swork[AQ_SWK_9] != 0)) { D_i3_801C42A0[2] = 50; sBossAQlimbTimers[AQ_LIMB_8] = 50; bossAQ->swork[AQ_SWK_9]--; - Audio_PlaySfx(0x2903604C, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903604C, bossAQ->sfxSource, 4); if (bossAQ->swork[AQ_SWK_9] == 0) { spD4.x = D_i3_801C4308[76]; spD4.y = D_i3_801C4308[77]; // 76? @@ -2810,8 +2804,7 @@ void func_i3_801B134C(Boss* bossAQ) { case 16: if (bossAQ->damage == 31) { if (D_i3_801C42A0[23] != 0) { - Audio_PlaySfx(0x29121007, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossAQ->sfxSource, 4); } else if (bossAQ->state >= 15) { D_i3_801C42A0[4] = 75; } @@ -2820,8 +2813,7 @@ void func_i3_801B134C(Boss* bossAQ) { case 17: if (bossAQ->damage == 31) { if (D_i3_801C42A0[23] != 0) { - Audio_PlaySfx(0x29121007, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossAQ->sfxSource, 4); } else if (bossAQ->state >= 15) { D_i3_801C42A0[5] = 75; } @@ -2831,8 +2823,7 @@ void func_i3_801B134C(Boss* bossAQ) { if ((bossAQ->damage == 31) && (bossAQ->swork[AQ_SWK_1] != 2) && (bossAQ->swork[AQ_SWK_12] == 0) && (bossAQ->state == 15) && (bossAQ->health != 0)) { if (D_i3_801C42A0[23] != 0) { - Audio_PlaySfx(0x29121007, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossAQ->sfxSource, 4); } else { for (i7 = 0; i7 < AQ_LIMB_MAX; i7++) { sBossAQlimbTimers[i7] = 50; @@ -2842,16 +2833,15 @@ void func_i3_801B134C(Boss* bossAQ) { bossAQ->swork[AQ_SWK_13] = 40; bossAQ->swork[AQ_SWK_1] = 2; - Audio_PlaySfx(0x2940804E, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940804E, bossAQ->sfxSource, 4); bossAQ->health -= bossAQ->damage; if ((bossAQ->swork[AQ_SWK_25] == 0) || (bossAQ->swork[AQ_SWK_25] == 2)) { Radio_PlayMessage(gMsg_ID_7086, RCID_SLIPPY); } bossAQ->swork[AQ_SWK_25]++; if (bossAQ->health <= 0) { - func_800182F4(0x102800FF); - func_800182F4(0x112800FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 40); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); func_80042EC0(bossAQ); Radio_PlayMessage(gMsg_ID_15252, RCID_SLIPPY); D_8017796C = -1; @@ -2869,8 +2859,7 @@ void func_i3_801B134C(Boss* bossAQ) { bossAQ->swork[AQ_SWK_13] = 40; bossAQ->swork[AQ_SWK_1] = 2; bossAQ->timer_056 = 50; - Audio_PlaySfx(0x2940A04F, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940A04F, bossAQ->sfxSource, 4); gShowBossHealth = false; bossAQ->state = 16; } @@ -2881,15 +2870,14 @@ void func_i3_801B134C(Boss* bossAQ) { case 20: if (bossAQ->damage == 31) { if (D_i3_801C42A0[23] != 0) { - Audio_PlaySfx(0x29121007, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossAQ->sfxSource, 4); } else if (bossAQ->state >= 15) { D_i3_801C42A0[6] = 50; } } break; default: - Audio_PlaySfx(0x29121007, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossAQ->sfxSource, 4); break; } } @@ -3142,7 +3130,7 @@ void func_i3_801B134C(Boss* bossAQ) { Math_SmoothStepToF(&D_i3_801C4308[61], 0.0f, 0.3f, 0.5f, 0.0f); bossAQ->info.hitbox[119] = -10000.0f; if (bossAQ->swork[AQ_SWK_13] == 1) { - Audio_PlaySfx(0x29409051, bossAQ->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29409051, bossAQ->sfxSource, 4); } } else if ((bossAQ->health != 0) || (bossAQ->state < 16)) { Math_SmoothStepToF(&D_i3_801C4308[54], 1.0f, 0.3f, 0.5f, 0.0f); @@ -3656,7 +3644,7 @@ void func_i3_801B50E8(Actor* actor) { actor->unk_044 = 0; func_80066254(actor); func_800815DC(); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 6.0f); break; } @@ -3875,8 +3863,8 @@ void func_i3_801B638C(Actor* actor) { actor->unk_044 = 14; } func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); - Audio_PlaySfx(0x1903001D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Object_Kill(&actor->obj, actor->sfxSource); + AUDIO_PLAY_SFX(0x1903001D, actor->sfxSource, 4); func_8007A6F0(&actor->obj.pos, 0x29038090); } actor->fwork[5] = (actor->obj.pos.y * 0.01f) + 2.5f; @@ -3926,7 +3914,7 @@ void func_i3_801B638C(Actor* actor) { } if (actor->iwork[15] != 0) { if ((gPlayer[0].unk_138 + 300.0f) < actor->obj.pos.z) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } else { if (!(gGameFrameCount & 1)) { @@ -3986,7 +3974,7 @@ void func_i3_801B638C(Actor* actor) { if ((actor->health != 0) && (actor->unk_0D2 == 0)) { actor->health -= actor->damage; actor->timer_0C6 = 30; - Audio_PlaySfx(0x2903408F, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903408F, actor->sfxSource, 4); if (actor->health <= 0) { actor->health = 0; BonusText_Display(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 200.0f, 3); @@ -4044,7 +4032,7 @@ void func_i3_801B6FF8(Actor* actor) { func_800815DC(); func_8007D0E0(actor->vwork[i].x, actor->vwork[i].y, actor->vwork[i].z + 100.0f, 6.0f); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x29038090); } switch (actor->state) { @@ -4124,7 +4112,7 @@ void func_i3_801B6FF8(Actor* actor) { actor->unk_0D8.y + RAND_FLOAT_CENTERED(70.0f), actor->unk_0D8.z + RAND_FLOAT_CENTERED(70.0f), 1.0f, 1); } - Audio_PlaySfx(0x2903408F, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903408F, actor->sfxSource, 4); if (actor->health <= -100) { actor->health = -100; BonusText_Display(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 200.0f, 3); @@ -4287,7 +4275,7 @@ void func_i3_801B7C78(Actor* actor) { func_8007D0E0(actor->vwork[7].x, actor->vwork[7].y, actor->vwork[7].z, 5.0f); actor->unk_044 = 4; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x29038090); } if (actor->state != 6) { @@ -4365,14 +4353,14 @@ void func_i3_801B7C78(Actor* actor) { func_80081B24(actor->vwork[20 + i].x, actor->vwork[20 + i].y, actor->vwork[20 + i].z, 0.1f) + 1; } actor->timer_0C0 = 10; - Audio_PlaySfx(0x2900208D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900208D, actor->sfxSource, 4); actor->state = 4; } break; case 4: actor->iwork[5]++; if (actor->timer_0C0 == 0) { - Audio_KillSfx(actor->sfxPos); + Audio_KillSfxBySource(actor->sfxSource); actor->unk_0B6++; if (Animation_GetFrameCount(&D_602AC28) < actor->unk_0B6) { actor->unk_0B6 = Animation_GetFrameCount(&D_6024F80) - 1; @@ -4401,7 +4389,7 @@ void func_i3_801B7C78(Actor* actor) { effect->unk_44 = 2; effect->timer_50 = 100; actor->iwork[3] = 0; - Audio_PlaySfx(0x2900308C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900308C, actor->sfxSource, 4); } else { effect->obj.pos.x = actor->vwork[21].x; effect->obj.pos.y = actor->vwork[21].y; @@ -4499,7 +4487,7 @@ void func_i3_801B7C78(Actor* actor) { actor->info.bonus = 1; actor->timer_0C6 = 30; actor->health -= actor->damage; - Audio_PlaySfx(0x2903408F, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903408F, actor->sfxSource, 4); } else { actor->timer_0BC = 50; } @@ -4650,7 +4638,7 @@ void func_i3_801B91A4(Actor* actor) { RAND_FLOAT_CENTERED(10.0f), 53, actor->scale, 200, i); func_8007BC7C(actor->vwork[0 + i].x, actor->vwork[0 + i].y, actor->vwork[0 + i].z + 100.0f, 6.0f); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_800815DC(); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 5.0f); func_8007A6F0(&actor->obj.pos, 0x29038090); @@ -4768,7 +4756,7 @@ void func_i3_801B91A4(Actor* actor) { if ((actor->health != 0) && (actor->state != 0)) { actor->timer_0C6 = 15; actor->health -= actor->damage; - Audio_PlaySfx(0x2903408F, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903408F, actor->sfxSource, 4); if (actor->health <= 0) { actor->health = 0; if (actor->scale > 1.0f) { @@ -4967,7 +4955,7 @@ void func_i3_801BA6A4(Actor* actor) { actor->fwork[1] += 10.0f; actor->vel.x = SIN_DEG(actor->fwork[1]) * 10.0f; if (actor->obj.pos.y < (gGroundLevel + 30.0f)) { - Audio_PlaySfx(0x19400007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19400007, actor->sfxSource, 4); actor->iwork[1] = 1; actor->vel.x = actor->vel.y = actor->vel.z = 0.0f; actor->gravity = 0.0f; @@ -4991,7 +4979,7 @@ void func_i3_801BA6A4(Actor* actor) { actor->vel.y = 0.0f; } actor->iwork[1] = 1; - Audio_PlaySfx(0x19400007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19400007, actor->sfxSource, 4); func_8007B8F8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 100.0f, actor->scale * 30.0f); } } else { @@ -5037,7 +5025,7 @@ void func_i3_801BA6A4(Actor* actor) { func_8007BC7C(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 130.0f, actor->scale * 30.0f); func_8007BC7C(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 130.0f, actor->scale * 30.0f); func_8007BC7C(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z + 130.0f, actor->scale * 30.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A008); } } @@ -5082,7 +5070,7 @@ void func_i3_801BADF8(Actor* actor) { RAND_FLOAT(5.0f), RAND_FLOAT_CENTERED(10.0f), 55, actor->scale, 200, i); func_8007BC7C(actor->vwork[0 + i].x, actor->vwork[0 + i].y, actor->vwork[0 + i].z + 100.0f, 6.0f); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; } } @@ -5496,7 +5484,7 @@ void func_i3_801BB79C(Actor* actor) { } if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x2903408F, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903408F, actor->sfxSource, 4); if (actor->damage != 31) { actor->timer_0C0 = actor->timer_0C6 = 40; } else { @@ -5626,7 +5614,7 @@ void func_i3_801BC9A0(Actor* actor) { actor->unk_0D0 = 0; if ((actor->health != 0) && (actor->iwork[3] == 0) && (actor->damage == 31)) { actor->health -= actor->damage; - Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 4); if (actor->health <= 0) { actor->health = 0; actor->state = 3; @@ -5639,7 +5627,7 @@ void func_i3_801BC9A0(Actor* actor) { for (j = 0; j < 60; j++) { if ((gActors[j].obj.status == OBJ_ACTIVE) && (gActors[j].obj.id == OBJ_ACTOR_189) && (gActors[j].state == 58)) { - Object_Kill(&gActors[j].obj, gActors[j].sfxPos); + Object_Kill(&gActors[j].obj, gActors[j].sfxSource); break; } } @@ -5697,7 +5685,7 @@ void func_i3_801BC9A0(Actor* actor) { actor->obj.pos.z = actor->vwork[4].z; actor->unk_044 = D_i3_801C04C4[actor->iwork[1]]; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x19021078); } break; @@ -5815,7 +5803,7 @@ void func_i3_801BD54C(Actor* actor) { if (fabsf(actor->fwork[5] - actor->obj.pos.z) >= var_fs0) { actor->state = 3; if (actor->iwork[0] == 0) { - Audio_PlaySfx(0x19400077, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19400077, actor->sfxSource, 4); } } else { // needed to match @@ -5940,7 +5928,7 @@ void func_i3_801BD54C(Actor* actor) { actor->iwork[2] = 1; func_i3_801BD3B0(actor, sp5C, sp58, sp54); if ((gPlayer[0].unk_138 + 1000.0f) < actor->obj.pos.z) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -6034,7 +6022,7 @@ void func_i3_801BE034(Actor* actor) { actor->iwork[0] = 0; } if (gPlayer[0].unk_1D0 >= 5) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } diff --git a/src/overlays/ovl_i3/fox_so.c b/src/overlays/ovl_i3/fox_so.c index 8a1bf0ec..5c315854 100644 --- a/src/overlays/ovl_i3/fox_so.c +++ b/src/overlays/ovl_i3/fox_so.c @@ -245,8 +245,8 @@ void func_i3_8019EA7C(Actor* actor) { } if ((actor->unk_046 == 0) || (actor->unk_046 == 1)) { actor->unk_046 = 3; - func_8005F0E8(actor->sfxPos, &actor->obj.pos); - Audio_PlaySfx(0x11002052, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + func_8005F0E8(actor->sfxSource, &actor->obj.pos); + AUDIO_PLAY_SFX(0x11002052, actor->sfxSource, 0); } if (func_800A73E4(&sp34, &sp30, actor->obj.pos.x, -100.0f, actor->obj.pos.z)) { D_801782EC[sp30] = actor->fwork[0]; @@ -291,7 +291,7 @@ void func_i3_8019EA7C(Actor* actor) { func_i3_801A8DB8(&actor->obj.pos, 0x11002052, actor->vel.z); /* fallthrough */ case 2: - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; } } @@ -316,7 +316,7 @@ void func_i3_8019EF30(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 if (gBossActive != 0) { actor->info.bonus = 0; } - Audio_PlaySfx(0x29000071, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29000071, actor->sfxSource, 0); } void func_i3_8019F038(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel) { @@ -347,7 +347,7 @@ void func_i3_8019F0B0(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 if (gBossActive != 0) { actor->info.bonus = 0; } - Audio_PlaySfx(0x29000071, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29000071, actor->sfxSource, 0); } void func_i3_8019F194(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel) { @@ -412,12 +412,12 @@ void func_i3_8019F20C(Actor* actor) { RAND_FLOAT(10.0f) + 10.0f, 0.0f, actor->scale * 5.0f, 1); } actor->timer_0C2 = 5; - Audio_PlaySfx(0x29000071, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29000071, actor->sfxSource, 0); break; case 2: actor->gravity = 0.5f; if (func_800A73E4(&sp8C, &sp88, actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z)) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x29000072); for (i = 0; i < 4; i++) { func_i3_8019E9F4(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, D_i3_801BF8E0[i], @@ -431,7 +431,7 @@ void func_i3_8019F20C(Actor* actor) { } if ((actor->unk_0D0 != 0) || ((actor->obj.id == OBJ_ACTOR_277) && (actor->vel.y < 0.0f))) { func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, actor->scale * 4.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); if (actor->obj.id == OBJ_ACTOR_277) { for (i = 0; i < 4; i++) { func_i3_8019F038(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, @@ -651,8 +651,8 @@ void func_i3_801A003C(Actor* actor) { actor->state = 0; actor->timer_0BE = 50; actor->unk_04E = 0; - func_8005F0E8(actor->sfxPos, &actor->obj.pos); - Audio_PlaySfx(0x19035053, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + func_8005F0E8(actor->sfxSource, &actor->obj.pos); + AUDIO_PLAY_SFX(0x19035053, actor->sfxSource, 4); } break; } @@ -687,13 +687,13 @@ void func_i3_801A0120(Effect* effect) { func_8007A774(&gPlayer[0], effect, effect->scale2 * 12.0f); } if (effect->unk_60.x > 190.0f) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } sp48 = effect->unk_48; if (func_800A73E4(&sp5C, &sp4C, effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z)) { effect->unk_48 = 1; if (effect->scale2 == 20.0f) { - Audio_PlaySfx(0x19035054, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19035054, effect->sfxSource, 4); } } else { effect->unk_48 = 0; @@ -719,7 +719,7 @@ void func_i3_801A0120(Effect* effect) { effect->unk_4C++; if (effect->unk_4C >= 6) { effect->unk_4C = 0; - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } if (effect->scale2 > 10.0f) { @@ -730,7 +730,7 @@ void func_i3_801A0120(Effect* effect) { break; case 2: if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } Math_SmoothStepToF(&effect->scale2, 0.0f, 0.1f, 0.2f, 0.0f); effect->obj.rot.z += 3.0f; @@ -740,7 +740,7 @@ void func_i3_801A0120(Effect* effect) { Math_SmoothStepToF(&effect->obj.rot.z, -190.0f, 1.0f, 10.0f, 0.0f); effect->vel.y -= 0.3f; if (effect->obj.rot.z <= -180.0f) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; case 4: @@ -754,7 +754,7 @@ void func_i3_801A0120(Effect* effect) { func_8007A774(&gPlayer[0], effect, effect->scale2 * 12.0f); } if (effect->obj.pos.y < -20.0f) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.z += 6.0f; if (effect->obj.rot.z >= 360.0f) { @@ -764,7 +764,7 @@ void func_i3_801A0120(Effect* effect) { if (func_800A73E4(&sp5C, &sp4C, effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z)) { effect->unk_48 = 1; if (effect->scale2 == 20.0f) { - Audio_PlaySfx(0x19035054, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19035054, effect->sfxSource, 4); } } else { effect->unk_48 = 0; @@ -794,12 +794,12 @@ void func_i3_801A0120(Effect* effect) { if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_7) { func_8007A774(&gPlayer[0], effect, effect->scale2 * 18.0f); if ((effect->unk_4C == 0) && ((effect->scale2 >= 9.8f) || (effect->scale2 <= 4.4f))) { - Audio_PlaySfx(0x31033078, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31033078, effect->sfxSource, 4); } } else { effect->vel.z += 65.0f; if (fabsf(gBosses[0].obj.pos.z - effect->obj.pos.z) >= 2000.0f) { - func_8001A55C(effect->sfxPos, 0x31033078); + Audio_KillSfxBySourceAndId(effect->sfxSource, 0x31033078); } } break; @@ -818,10 +818,10 @@ void func_i3_801A0120(Effect* effect) { if (gPlayer[0].state_1C8 != PLAYERSTATE_1C8_7) { func_8007A774(&gPlayer[0], effect, effect->scale2 * 18.0f); if ((effect->unk_4C == 0) && ((effect->scale2 >= 9.8f) || (effect->scale2 <= 4.4f))) { - Audio_PlaySfx(0x31033078, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31033078, effect->sfxSource, 4); } } else if (fabsf(gBosses[0].obj.pos.z - effect->obj.pos.z) >= 2000.0f) { - func_8001A55C(effect->sfxPos, 0x31033078); + Audio_KillSfxBySourceAndId(effect->sfxSource, 0x31033078); } break; } @@ -922,8 +922,8 @@ void func_i3_801A0DF8(f32 xPos, f32 zPos, f32 yRot, s32 index, f32 yPos) { gActors[sp2C].timer_0BE = 50; gActors[sp2C].unk_04E = 0; gActors[sp2C].obj.pos.y = -1.0f * yPos; - func_8005F0E8(gActors[sp2C].sfxPos, &gActors[sp2C].obj.pos); - Audio_PlaySfx(0x19035053, gActors[sp2C].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + func_8005F0E8(gActors[sp2C].sfxSource, &gActors[sp2C].obj.pos); + AUDIO_PLAY_SFX(0x19035053, gActors[sp2C].sfxSource, 4); } } @@ -942,7 +942,7 @@ void func_i3_801A0FD4(Actor* actor, s32 index) { actor->obj.rot.x = 0.0f; actor->obj.rot.y = 180.0f; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } } @@ -981,7 +981,7 @@ void func_i3_801A10F4(Player* player) { D_80178340 = 255; D_80178358 = 0; func_i3_801A0DF8(-750.0f, -2600.0f, 300.0f, 2, 1.0f); - Audio_PlaySfx(0x3140807E, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3140807E, player->sfxSource, 0); break; case 1: D_80177CE8 += 30.0f; @@ -992,13 +992,13 @@ void func_i3_801A10F4(Player* player) { func_i3_801A0DF8(-1730.0f, -2300.0f, 250.0f, 1, 1.0f); } if (gCsFrameCount == 100) { - Object_Kill(&gActors[4].obj, gActors[4].sfxPos); + Object_Kill(&gActors[4].obj, gActors[4].sfxSource); } if (gCsFrameCount == 240) { - Object_Kill(&gActors[5].obj, gActors[5].sfxPos); + Object_Kill(&gActors[5].obj, gActors[5].sfxSource); } if (gCsFrameCount == 380) { - Object_Kill(&gActors[6].obj, gActors[6].sfxPos); + Object_Kill(&gActors[6].obj, gActors[6].sfxSource); } if (gCsFrameCount < 3) { D_80178340 = 255; @@ -1016,7 +1016,7 @@ void func_i3_801A10F4(Player* player) { } if (gCsFrameCount == 380) { for (i = 0; i < 100; i++) { - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); } func_i3_801A0DF8(400.0f, -2800.0f, 340.0f, 1, 1.0f); } @@ -1041,8 +1041,8 @@ void func_i3_801A10F4(Player* player) { func_i3_801A0FD4(&gActors[2], 2); gCsCamAtZ = -3000.0f; gCsCamEyeZ = -3400.0f; - func_8001A55C(player->sfxPos, 0x3140807E); - func_8001D444(0, 0x33, 0, 0xFF); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x3140807E); + AUDIO_PLAY_BGM(SEQ_ID_51); func_80057814(player); func_8001C8B8(gPlayerNum); D_80177A48[0] = 0.01f; @@ -1057,7 +1057,7 @@ void func_i3_801A10F4(Player* player) { Radio_PlayMessage(gMsg_ID_10010, RCID_FOX); } if (gCsFrameCount == 550) { - Object_Kill(&gActors[5].obj, gActors[5].sfxPos); + Object_Kill(&gActors[5].obj, gActors[5].sfxSource); func_i3_801A0DF8(30.0f, -1500.0f, 160.0f, 3, 2.0f); } if (player->camEye.z <= -2465.0f) { @@ -1076,7 +1076,7 @@ void func_i3_801A10F4(Player* player) { RAND_FLOAT_CENTERED(2000.0f) + 500.0f + D_80177D20, RAND_FLOAT(20.0f) + 20.0f); } if (gCsFrameCount == 615) { - func_800A6028(player->sfxPos, 0x09000002); + func_800A6028(player->sfxSource, 0x09000002); gActors[0].fwork[29] = gActors[1].fwork[29] = gActors[2].fwork[29] = 5.0f; gActors[0].state = 3; gActors[1].state = 2; @@ -1103,7 +1103,7 @@ void func_i3_801A10F4(Player* player) { D_80178348 = D_80178350 = D_80178354 = 255; } if (D_80178340 == 255) { - func_8001D444(0, 0x800B, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_11 | 0x8000); player->pos.z = 0.0f; player->unk_0D0 = D_80161A54; func_800A6148(); @@ -1122,7 +1122,7 @@ void func_i3_801A10F4(Player* player) { D_80177950 = 1.0f; func_8001D1C8(0xFF, 3); - Audio_PlaySfx(0x4100C023, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4100C023, gDefaultSfxSource, 4); D_80178488 = 1; D_80178358 = 0; player->timer_1F8 = 15; @@ -1204,8 +1204,8 @@ void func_i3_801A1F80(Boss* bossSO) { bossSO->unk_3F8 = 5.5f; } if (bossSO->health == 0) { - func_800182F4(0x101400FF); - func_800182F4(0x111400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 20); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 20); gBossActive = 1; gBossFrameCount = 0; bossSO->health = 600; @@ -1249,14 +1249,14 @@ void func_i3_801A1F80(Boss* bossSO) { gFogBlue--; } if (gBossFrameCount == 30) { - func_8001D444(0, 0x801B, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_27 | 0x8000); } if (gBossFrameCount <= 60) { Math_SmoothStepToF(&D_801779A8[gMainController], 120.0f, 1.0f, 3.5f, 0.0f); } if (gBossFrameCount == 60) { gActors[10].unk_0D0 = 3; - Audio_PlaySfx(0x19036053, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19036053, bossSO->sfxSource, 4); } if (bossSO->timer_050 == 100) { bossSO->unk_04C = 0; @@ -1316,11 +1316,11 @@ void func_i3_801A23F4(Boss* bossSO) { bossSO->info.hitbox[42] = 110.0f; } if (bossSO->unk_04C == 29) { - func_8005F0E8(bossSO->sfxPos, &bossSO->obj.pos); - Audio_PlaySfx(0x19035053, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + func_8005F0E8(bossSO->sfxSource, &bossSO->obj.pos); + AUDIO_PLAY_SFX(0x19035053, bossSO->sfxSource, 4); } if (bossSO->unk_04C == 80) { - Audio_PlaySfx(0x29432077, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29432077, bossSO->sfxSource, 4); } if (bossSO->unk_04C >= 94) { bossSO->info.hitbox[38] = 220.0f; @@ -1343,11 +1343,11 @@ void func_i3_801A23F4(Boss* bossSO) { bossSO->info.hitbox[24] = 275.0f; } if (bossSO->unk_04C == 10) { - func_8005F0E8(bossSO->sfxPos, &bossSO->obj.pos); - Audio_PlaySfx(0x19035053, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + func_8005F0E8(bossSO->sfxSource, &bossSO->obj.pos); + AUDIO_PLAY_SFX(0x19035053, bossSO->sfxSource, 4); } if (bossSO->unk_04C == 50) { - Audio_PlaySfx(0x29432077, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29432077, bossSO->sfxSource, 4); } if (bossSO->unk_04C >= 85) { bossSO->info.hitbox[20] = 220.0f; @@ -1397,10 +1397,10 @@ void func_i3_801A23F4(Boss* bossSO) { } if (bossSO->obj.rot.y >= 360.0f) { bossSO->obj.rot.y -= 360.0f; - Audio_PlaySfx(0x39033079, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39033079, bossSO->sfxSource, 4); } if (bossSO->unk_04C == 1) { - Audio_PlaySfx(0x39033079, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39033079, bossSO->sfxSource, 4); } if (bossSO->unk_04C >= 100) { Math_SmoothStepToAngle(&bossSO->obj.rot.y, 0.0f, 1.0f, 2.0f, 1.0f); @@ -1435,11 +1435,11 @@ void func_i3_801A23F4(Boss* bossSO) { bossSO->info.hitbox[24] = 110.0f; } if (bossSO->unk_04C == 5) { - func_8005F0E8(bossSO->sfxPos, &bossSO->obj.pos); - Audio_PlaySfx(0x19035053, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + func_8005F0E8(bossSO->sfxSource, &bossSO->obj.pos); + AUDIO_PLAY_SFX(0x19035053, bossSO->sfxSource, 4); } if (bossSO->unk_04C == 20) { - Audio_PlaySfx(0x29432077, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29432077, bossSO->sfxSource, 4); } if (bossSO->unk_04C > 36) { bossSO->info.hitbox[20] = 220.0f; @@ -1489,7 +1489,7 @@ void func_i3_801A2C98(Boss* bossSO) { } if (bossSO->unk_04C == 20) { gActors[10].unk_0D0 = 3; - Audio_PlaySfx(0x19036054, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19036054, bossSO->sfxSource, 4); } if (bossSO->unk_04C == 0) { bossSO->state++; @@ -1523,7 +1523,7 @@ void func_i3_801A2C98(Boss* bossSO) { } if (bossSO->swork[SO_SWK_11] == 50) { gActors[9].unk_0D0 = 3; - Audio_PlaySfx(0x19036053, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19036053, bossSO->sfxSource, 4); } } } @@ -1550,7 +1550,7 @@ void func_i3_801A3128(Boss* bossSO) { } if (bossSO->unk_04C == 40) { gActors[10].unk_0D0 = 3; - Audio_PlaySfx(0x19036054, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19036054, bossSO->sfxSource, 4); } if (bossSO->unk_04C == 0) { bossSO->state++; @@ -1600,7 +1600,7 @@ void func_i3_801A3128(Boss* bossSO) { } if (bossSO->swork[SO_SWK_11] == 50) { gActors[9].unk_0D0 = 3; - Audio_PlaySfx(0x19036053, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19036053, bossSO->sfxSource, 4); } } } @@ -1641,11 +1641,11 @@ void func_i3_801A3510(Boss* bossSO) { } } if (bossSO->unk_04C == 29) { - func_8005F0E8(bossSO->sfxPos, &bossSO->obj.pos); - Audio_PlaySfx(0x19035053, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + func_8005F0E8(bossSO->sfxSource, &bossSO->obj.pos); + AUDIO_PLAY_SFX(0x19035053, bossSO->sfxSource, 4); } if (bossSO->unk_04C == 80) { - Audio_PlaySfx(0x29432077, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29432077, bossSO->sfxSource, 4); } if (bossSO->unk_04C == 94) { func_i3_801A0DF8(bossSO->fwork[SO_FWK_13], bossSO->fwork[SO_FWK_15], RAND_FLOAT_CENTERED(60.0f), 4, @@ -1660,11 +1660,11 @@ void func_i3_801A3510(Boss* bossSO) { } Math_SmoothStepToAngle(&bossSO->obj.rot.x, 20.0f, 0.1f, 10.0f, 0.1f); if (bossSO->unk_04C == 10) { - func_8005F0E8(bossSO->sfxPos, &bossSO->obj.pos); - Audio_PlaySfx(0x19035053, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + func_8005F0E8(bossSO->sfxSource, &bossSO->obj.pos); + AUDIO_PLAY_SFX(0x19035053, bossSO->sfxSource, 4); } if (bossSO->unk_04C == 50) { - Audio_PlaySfx(0x29432077, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29432077, bossSO->sfxSource, 4); } if (bossSO->unk_04C == 60) { func_i3_801A0D90(bossSO->obj.pos.x, bossSO->obj.pos.z + 1600.0f, 80.0f, 2); @@ -1692,7 +1692,7 @@ void func_i3_801A3510(Boss* bossSO) { break; case 8: if (bossSO->unk_04C == 65) { - Audio_PlaySfx(0x31033078, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31033078, bossSO->sfxSource, 4); bossSO->timer_050 = 30; } if (bossSO->timer_050 != 0) { @@ -1705,7 +1705,7 @@ void func_i3_801A3510(Boss* bossSO) { bossSO->fwork[SO_FWK_6] + 300.0f); } if (bossSO->unk_04C == 75) { - func_8001A55C(bossSO->sfxPos, 0x31033078); + Audio_KillSfxBySourceAndId(bossSO->sfxSource, 0x31033078); } if (bossSO->unk_04C == 99) { bossSO->swork[SO_SWK_1] = 5; @@ -1715,7 +1715,7 @@ void func_i3_801A3510(Boss* bossSO) { case 9: bossSO->unk_04C++; if (bossSO->unk_04C == 66) { - Audio_PlaySfx(0x31033078, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31033078, bossSO->sfxSource, 4); bossSO->timer_050 = 30; } if (bossSO->timer_050 != 0) { @@ -1730,7 +1730,7 @@ void func_i3_801A3510(Boss* bossSO) { bossSO->fwork[SO_FWK_6] + 300.0f); } if (bossSO->unk_04C == 76) { - func_8001A55C(bossSO->sfxPos, 0x31033078); + Audio_KillSfxBySourceAndId(bossSO->sfxSource, 0x31033078); } if (bossSO->unk_04C >= 99) { func_i3_801A30CC(bossSO); @@ -1738,7 +1738,7 @@ void func_i3_801A3510(Boss* bossSO) { break; } if (bossSO->timer_050 == 0) { - Object_Kill(&gActors[6].obj, gActors[6].sfxPos); + Object_Kill(&gActors[6].obj, gActors[6].sfxSource); } else { Math_SmoothStepToF(&gActors[6].obj.pos.x, gPlayer[0].pos.x, 0.1f, 10.0f, 0.1f); } @@ -1756,13 +1756,13 @@ void func_i3_801A3C4C(Boss* bossSO) { bossSO->swork[SO_SWK_10] = 20; if (bossSO->health > 0.0f) { - Audio_PlaySfx(0x29433074, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29433074, bossSO->sfxSource, 4); } if (bossSO) {} } bossSO->timer_058 = 20; if ((bossSO->dmgPart >= 1) && (bossSO->dmgPart <= 3) && (bossSO->swork[SO_SWK_2] != 0)) { - Audio_PlaySfx(0x29433074, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29433074, bossSO->sfxSource, 4); bossSO->swork[SO_SWK_2] -= bossSO->damage; if (bossSO->swork[SO_SWK_2] < 0) { bossSO->swork[SO_SWK_2] = 0; @@ -1778,7 +1778,7 @@ void func_i3_801A3C4C(Boss* bossSO) { } } if ((bossSO->dmgPart >= 4) && (bossSO->dmgPart <= 6) && (bossSO->swork[SO_SWK_3] != 0)) { - Audio_PlaySfx(0x29433074, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29433074, bossSO->sfxSource, 4); bossSO->swork[SO_SWK_3] -= bossSO->damage; if (bossSO->swork[SO_SWK_3] < 0) { bossSO->swork[SO_SWK_3] = 0; @@ -1807,10 +1807,10 @@ void func_i3_801A3C4C(Boss* bossSO) { gCsFrameCount = 0; D_80137E84[gMainController] = 1; D_Timer_80177BD0[gMainController] = 10; - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); - func_8001A838(0x4100C023); - Audio_PlaySfx(0x2940D09A, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); + Audio_KillSfxById(0x4100C023); + AUDIO_PLAY_SFX(0x2940D09A, bossSO->sfxSource, 4); if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_7; gPlayer[0].timer_1F8 = 0; @@ -1871,7 +1871,7 @@ void func_i3_801A4214(Boss* bossSO) { bossSO->unk_04C = 50; bossSO->state++; gShowBossHealth = false; - Audio_PlaySfx(0x39439076, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39439076, bossSO->sfxSource, 4); func_i3_801A1E14(bossSO->fwork[SO_FWK_4], bossSO->fwork[SO_FWK_5] + 300.0f, bossSO->fwork[SO_FWK_6], bossSO->fwork[SO_FWK_1], bossSO->fwork[SO_FWK_2], 73.0f, RAND_FLOAT_CENTERED(50.0f), 80.0f, 40.0f, 8); @@ -1934,7 +1934,7 @@ void func_i3_801A4214(Boss* bossSO) { D_i3_801C2768[13] = 0.0f; } if (gCsFrameCount == 230) { - Audio_PlaySfx(0x2940F026, gActors[5].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940F026, gActors[5].sfxSource, 4); D_801779A8[gMainController] = 120.0f; } if (gCsFrameCount == 250) { @@ -1942,7 +1942,7 @@ void func_i3_801A4214(Boss* bossSO) { bossSO->obj.pos.y = -1600.0f; for (i = 0; i < 2; i++) { if (gEffects[i].obj.status != OBJ_FREE) { - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); } } bossSO->timer_058 = 100; @@ -1950,9 +1950,9 @@ void func_i3_801A4214(Boss* bossSO) { break; case 4: if (bossSO->timer_058 == 1) { - func_800182F4(0x105000FF); - func_800182F4(0x115000FF); - Object_Kill(&bossSO->obj, bossSO->sfxPos); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 80); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 80); + Object_Kill(&bossSO->obj, bossSO->sfxSource); } break; } @@ -1961,7 +1961,7 @@ void func_i3_801A4214(Boss* bossSO) { void func_i3_801A48B8(Boss* bossSO) { s32 i; - Audio_PlaySfx(0x29434075, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29434075, bossSO->sfxSource, 4); D_80137E84[gMainController] = 1; D_Timer_80177BD0[gMainController] = 10; if (bossSO->swork[SO_SWK_0] != 6) { @@ -2016,11 +2016,11 @@ void func_i3_801A4A34(Boss* bossSO) { } switch (bossSO->unk_04C) { case 30: - Audio_PlaySfx(0x29433074, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29433074, bossSO->sfxSource, 4); /* fallthrough */ case 35: case 97: - Audio_PlaySfx(0x29434075, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29434075, bossSO->sfxSource, 4); break; } if (bossSO->unk_04C == 119) { @@ -2060,13 +2060,13 @@ void func_i3_801A4EF8(Boss* bossSO) { bossSO->unk_04C = 56; } if (bossSO->obj.rot.y == 0.0f) { - Audio_PlaySfx(0x39033079, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39033079, bossSO->sfxSource, 4); } bossSO->fwork[SO_FWK_31] += 0.5f; bossSO->obj.rot.y += bossSO->fwork[SO_FWK_31]; if (bossSO->obj.rot.y >= 360.0f) { bossSO->obj.rot.y -= 360.0f; - Audio_PlaySfx(0x39033079, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39033079, bossSO->sfxSource, 4); } bossSO->unk_078.y = bossSO->obj.rot.y; break; @@ -2075,7 +2075,7 @@ void func_i3_801A4EF8(Boss* bossSO) { bossSO->unk_04C = 56; if (bossSO->obj.rot.y >= 360.0f) { bossSO->obj.rot.y -= 360.0f; - Audio_PlaySfx(0x39033079, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39033079, bossSO->sfxSource, 4); } if (bossSO->swork[SO_SWK_11] <= 45) { Math_SmoothStepToF(&bossSO->obj.pos.y, -1000.0f, 0.1f, 20.0f, 0.1f); @@ -2125,7 +2125,7 @@ void func_i3_801A4EF8(Boss* bossSO) { bossSO->unk_04C = 98; bossSO->unk_078.y += bossSO->fwork[SO_FWK_31]; if (bossSO->swork[SO_SWK_11] == 170) { - Audio_PlaySfx(0x29432073, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29432073, bossSO->sfxSource, 4); bossSO->obj.pos.y = -500.0f; gActors[9].unk_0D0 = 2; } @@ -2372,7 +2372,7 @@ void func_i3_801A5B3C(Boss* bossSO) { case 0: bossSO->unk_04C++; if (bossSO->unk_04C == 75) { - Audio_PlaySfx(0x29432073, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29432073, bossSO->sfxSource, 4); } if (bossSO->unk_04C >= Animation_GetFrameCount(&D_601388C)) { if (bossSO->health != 0) { @@ -2418,7 +2418,7 @@ void func_i3_801A5B3C(Boss* bossSO) { case 9: bossSO->unk_04C++; if ((bossSO->unk_04C == 45) && (bossSO->health != 0)) { - Audio_PlaySfx(0x29432073, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29432073, bossSO->sfxSource, 4); } if (bossSO->unk_04C >= Animation_GetFrameCount(&D_6012C00_Anim)) { bossSO->unk_04C = 0; @@ -2475,7 +2475,7 @@ void func_i3_801A5B3C(Boss* bossSO) { Math_SmoothStepToVec3fArray(sp50, bossSO->vwork, 1, sp1BC, bossSO->fwork[SO_FWK_0], 100.0f, 0.0f); if ((bossSO->dmgType != DMG_NONE) && (bossSO->health > 0)) { bossSO->dmgType = DMG_NONE; - Audio_PlaySfx(0x29121007, bossSO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossSO->sfxSource, 4); if (!((bossSO->swork[SO_SWK_0] == 0) || (bossSO->swork[SO_SWK_0] == 2) || (bossSO->swork[SO_SWK_0] == 3) || (bossSO->swork[SO_SWK_0] == 6) || ((bossSO->swork[SO_SWK_0] == 7) && (bossSO->state == 2)))) { func_i3_801A3C4C(bossSO); @@ -2794,7 +2794,7 @@ void func_i3_801A7750(void) { actor->state = 1; Object_SetInfo(&actor->info, actor->obj.id); actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } } @@ -2825,12 +2825,12 @@ void func_i3_801A7930(Player* player) { gCsCamAtZ = player->camAt.z; for (i = 10; i < 60; i++) { if (gActors[i].unk_0B6 == 0) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } - Object_Kill(&gActors[2].obj, gActors[2].sfxPos); - Object_Kill(&gActors[3].obj, gActors[3].sfxPos); - Object_Kill(&gActors[4].obj, gActors[4].sfxPos); + Object_Kill(&gActors[2].obj, gActors[2].sfxSource); + Object_Kill(&gActors[3].obj, gActors[3].sfxSource); + Object_Kill(&gActors[4].obj, gActors[4].sfxSource); player->unk_1D0 = 1; D_80177A48[0] = 0.1f; if (Rand_ZeroOne() > 0.5f) { @@ -2868,14 +2868,14 @@ void func_i3_801A7930(Player* player) { D_80178348 = D_80178354 = D_80178350 = 255; } if (gCsFrameCount == 230) { - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); } if (gCsFrameCount == 400) { player->unk_1D0++; func_800A6148(); func_8001CA24(0); - Audio_KillSfx(player->sfxPos); + Audio_KillSfxBySource(player->sfxSource); D_80178340 = 250; player->timer_1F8 = 20; player->unk_0D0 = 0.0f; @@ -2893,7 +2893,7 @@ void func_i3_801A7930(Player* player) { player->unk_1D0++; player->wings.unk_2C = 1; func_8001C8B8(0); - func_8001D444(0, 0x26, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_38); D_80177A98 = 1; func_800A6148(); D_80177A48[1] = 0.0f; @@ -2906,8 +2906,8 @@ void func_i3_801A7930(Player* player) { player->camAt.y = gCsCamAtY = 200.0f; player->camAt.z = gCsCamAtZ = player->pos.z + D_80177D20; D_80177A48[0] = 0.0f; - Object_Kill(&gActors[4].obj, gActors[4].sfxPos); - Object_Kill(&gActors[5].obj, gActors[5].sfxPos); + Object_Kill(&gActors[4].obj, gActors[4].sfxSource); + Object_Kill(&gActors[5].obj, gActors[5].sfxSource); } break; case 3: @@ -2925,10 +2925,10 @@ void func_i3_801A7930(Player* player) { func_i3_801A0DF8(1400.0f, -(D_80177D20 + 3250.0f), -90.0f, 3, 1.0f); break; case 550: - Object_Kill(&gActors[4].obj, gActors[4].sfxPos); + Object_Kill(&gActors[4].obj, gActors[4].sfxSource); break; case 645: - Object_Kill(&gActors[5].obj, gActors[5].sfxPos); + Object_Kill(&gActors[5].obj, gActors[5].sfxSource); break; case 700: player->unk_1D0++; @@ -3015,7 +3015,7 @@ void func_i3_801A7930(Player* player) { D_8017835C = 8; if (D_80178340 == 255) { func_8001CA24(0); - func_8001DBD0(10); + Audio_FadeOutAll(10); player->state_1C8 = PLAYERSTATE_1C8_6; player->timer_1F8 = 0; D_8017837C = 4; @@ -3077,7 +3077,7 @@ void func_i3_801A7930(Player* player) { D_80177830 = 0; break; case 1460: - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); player->unk_190 = player->unk_194 = 5.0f; break; case 1400: @@ -3086,8 +3086,8 @@ void func_i3_801A7930(Player* player) { } break; case 1500: - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); break; case 1420: if (gTeamShields[2] > 0) { @@ -3142,7 +3142,7 @@ void func_i3_801A8BE8(Actor* actor) { break; case 2: actor->state = 3; - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); actor->fwork[29] = 5.0f; /* fallthrough */ case 3: diff --git a/src/overlays/ovl_i3/fox_zo.c b/src/overlays/ovl_i3/fox_zo.c index ae3b8b7f..edb9e4ee 100644 --- a/src/overlays/ovl_i3/fox_zo.c +++ b/src/overlays/ovl_i3/fox_zo.c @@ -713,7 +713,7 @@ void func_i3_801904CC(Actor* actor) { } actor->unk_044 = 0; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 4.0f); func_8007A6F0(&actor->obj.pos, 0x29018036); break; @@ -727,7 +727,7 @@ void func_i3_801904CC(Actor* actor) { if (actor->state > 0) { actor->timer_0C6 = 15; actor->health -= actor->damage; - Audio_PlaySfx(0x29033037, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29033037, actor->sfxSource, 4); if (actor->health <= 0) { actor->health = 0; actor->state = 1; @@ -791,16 +791,16 @@ void func_i3_80190A00(Actor* actor) { func_800A73E4(&sp2C, &sp28, actor->obj.pos.x, actor->obj.pos.y - 50.0f, actor->obj.pos.z)) { func_8008377C(actor->obj.pos.x, sp2C, actor->obj.pos.z + 150.0f, 0.0f, 1.7f); if (actor->vel.y >= 0.0f) { - Audio_PlaySfx(0x1983201A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1983201A, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x19832019, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19832019, actor->sfxSource, 4); } actor->timer_0C0 = 30; } func_i3_80190790(actor); if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } } @@ -933,14 +933,14 @@ void func_i3_80191010(Actor* actor) { actor->obj.rot.x = 0.0f; actor->gravity = 0.0f; actor->vel.y = 0.0f; - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } if (func_800A73E4(&sp7C, &sp70, actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z) && (actor->iwork[0] < 2) && (actor->timer_0C0 == 0)) { if (var_fs0 == 5.0f) { - Audio_PlaySfx(0x1983201A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1983201A, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x19832019, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19832019, actor->sfxSource, 4); } actor->timer_0C0 = 10; actor->iwork[0] += 1; @@ -955,8 +955,8 @@ void func_i3_80191010(Actor* actor) { actor->unk_044 = 4; func_80066254(actor); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 3.0f); - Audio_PlaySfx(0x2903A008, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Object_Kill(&actor->obj, actor->sfxPos); + AUDIO_PLAY_SFX(0x2903A008, actor->sfxSource, 4); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x29018036); break; } @@ -1023,12 +1023,12 @@ void func_i3_80191680(Actor* actor) { actor->unk_0D0 = 0; actor->timer_0C6 = 15; actor->health -= actor->damage; - Audio_PlaySfx(0x29033037, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29033037, actor->sfxSource, 4); if (actor->health <= 0) { actor->health = actor->unk_044 = 0; func_80066254(actor); actor->state = 1; - Audio_PlaySfx(0x29018036, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29018036, actor->sfxSource, 4); } } actor->unk_0B6++; @@ -1106,12 +1106,12 @@ void func_i3_80191BC4(Actor* actor) { if ((actor->vel.y != 0.0f) && (actor->iwork[1] == 0)) { actor->iwork[1] = 1; - Audio_PlaySfx(0x2900201D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900201D, actor->sfxSource, 4); } if (func_800A73E4(&sp4C, &sp48, actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z) && (actor->state == 0)) { func_8007B344(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 20.0f, 7); func_8007C120(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 0.0f, 0.0f, 0.0f, 0.5f, 50); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); actor->iwork[0] = 0; func_8007A6F0(&actor->obj.pos, 0x1903001D); } @@ -1202,9 +1202,9 @@ void func_i3_80192094(Actor* actor) { func_8008377C(actor->obj.pos.x, spB8, actor->obj.pos.z + 100.0f, 0.0f, 1.5f); actor->iwork[0] += 1; if (actor->vel.y >= 0.0f) { - Audio_PlaySfx(0x1983201A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1983201A, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x19832019, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19832019, actor->sfxSource, 4); } } switch (actor->state) { @@ -1219,7 +1219,7 @@ void func_i3_80192094(Actor* actor) { actor->unk_0B6 = 64; Math_SmoothStepToF(&actor->vel.z, 0.0f, 1.0f, 100.0f, 0.00001f); if (actor->obj.pos.y < -500.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } if (actor->unk_0B6 == 25) { @@ -1281,7 +1281,7 @@ void func_i3_80192094(Actor* actor) { } actor->unk_044 = 5; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); break; } @@ -1354,7 +1354,7 @@ void func_i3_80192834(Actor* actor) { actor->iwork[0] = 0; } if (actor->obj.pos.y < -50.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } if (actor->vel.y > 0.0f) { if (actor->unk_0B6 < 17) { @@ -1383,7 +1383,7 @@ void func_i3_80192834(Actor* actor) { } actor->unk_044 = 0; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 3.0f); func_8007A6F0(&actor->obj.pos, 0x29018036); break; @@ -1393,9 +1393,9 @@ void func_i3_80192834(Actor* actor) { actor->iwork[0]++; func_8008377C(actor->obj.pos.x, sp74, actor->obj.pos.z, 0.0f, 0.7f); if (actor->vel.y >= 0.0f) { - Audio_PlaySfx(0x1983201A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1983201A, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x19832019, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19832019, actor->sfxSource, 4); } } } @@ -1500,7 +1500,7 @@ void func_i3_80192E64(Actor* actor) { } actor->unk_044 = 7; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); break; } @@ -1514,7 +1514,7 @@ void func_i3_80192E64(Actor* actor) { actor->state = 3; } } else { - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } actor->unk_0D0 = 0; } @@ -1600,8 +1600,8 @@ void func_i3_801932AC(Boss* bossZO) { gActors[i].obj.pos.z = bossZO->obj.pos.z; Object_SetInfo(&gActors[i].info, gActors[i].obj.id); } - func_800182F4(0x102800FF); - func_800182F4(0x112800FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 40); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); ZO_HIT_3(bossZO)->b.z.offset = ZO_HIT_4(bossZO)->b.z.offset = -561.6f; ZO_HIT_8(bossZO, 0)->z.offset = ZO_HIT_8(bossZO, 1)->z.offset = -213.2f; @@ -2164,7 +2164,7 @@ void func_i3_80194A84(Boss* bossZO) { sp100 = 5.0f; spFC = 3.0f; if (sZoSwork[ZO_BSS_55] == 0) { - func_8001D444(0, 0x8016, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_22 | 0x8000); sZoSwork[ZO_BSS_55] = 1; } func_8008377C(sZoFwork[ZO_BSF_43_X], sp134, sZoFwork[ZO_BSF_43_Z] + 100.0f, 5.0f, 3.0f); @@ -2172,9 +2172,9 @@ void func_i3_80194A84(Boss* bossZO) { } func_8008377C(sZoFwork[ZO_BSF_43_X], sp134, sZoFwork[ZO_BSF_43_Z] + 100.0f, sp100, spFC); if (bossZO->timer_050 == 43) { - Audio_PlaySfx(0x1983201A, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1983201A, bossZO->sfxSource, 4); } else { - Audio_PlaySfx(0x19832019, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19832019, bossZO->sfxSource, 4); } bossZO->swork[ZO_SWK_12]++; } @@ -2399,7 +2399,7 @@ void func_i3_80194A84(Boss* bossZO) { if (sZoFwork[ZO_BSF_17] > -400.0f) { sZoFwork[ZO_BSF_17] -= 10.0f; } else { - Audio_KillSfx(bossZO->sfxPos); + Audio_KillSfxBySource(bossZO->sfxSource); if (bossZO->obj.rot.z > 359.0f) { if (sZoSwork[ZO_BSS_13] != 0) { func_i3_8019907C(bossZO); @@ -2414,7 +2414,7 @@ void func_i3_80194A84(Boss* bossZO) { if (sZoFwork[ZO_BSF_18] > -400.0f) { sZoFwork[ZO_BSF_18] -= 10.0f; } else { - Audio_KillSfx(bossZO->sfxPos); + Audio_KillSfxBySource(bossZO->sfxSource); if (bossZO->obj.rot.z < 1.0f) { if (sZoSwork[ZO_BSS_13] != 0) { func_i3_8019907C(bossZO); @@ -2565,7 +2565,7 @@ void func_i3_80194A84(Boss* bossZO) { RAND_FLOAT_CENTERED(3000.0f) + bossZO->obj.pos.z, 5.0f, 2.0f); } if ((bossZO->timer_050 == 0) || (bossZO->obj.pos.y < -800.0f)) { - Object_Kill(&bossZO->obj, bossZO->sfxPos); + Object_Kill(&bossZO->obj, bossZO->sfxSource); } break; case 8: @@ -2785,7 +2785,7 @@ void func_i3_80194A84(Boss* bossZO) { dmgType = bossZO->dmgType; bossZO->dmgType = DMG_NONE; if (dmgType == DMG_BEAM) { - Audio_PlaySfx(0x29121007, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, bossZO->sfxSource, 4); } switch (bossZO->dmgPart) { case 0: @@ -2870,19 +2870,19 @@ void func_i3_80194A84(Boss* bossZO) { sZoLimbTimers[ZO_LIMB_25] = sZoLimbTimers[ZO_LIMB_36] = 15; bossZO->health -= bossZO->damage; if (bossZO->health < 150) { - Audio_PlaySfx(0x2943500F, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2943500F, bossZO->sfxSource, 4); } else { - Audio_PlaySfx(0x29034003, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, bossZO->sfxSource, 4); } if (bossZO->health <= 0) { D_8017796C = -1; - func_800182F4(0x102800FF); - func_800182F4(0x112800FF); - Audio_KillSfx(bossZO->sfxPos); - Audio_PlaySfx(0x2940D09A, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 40); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 40); + Audio_KillSfxBySource(bossZO->sfxSource); + AUDIO_PLAY_SFX(0x2940D09A, bossZO->sfxSource, 4); sZoSwork[ZO_BSS_8] = bossZO->health = sZoSwork[ZO_BSS_24] = 0; bossZO->timer_050 = 100; - Audio_PlaySfx(0x2940D09A, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09A, bossZO->sfxSource, 4); sZoFwork[ZO_BSF_27] = 20.0f; sZoFwork[ZO_BSF_26] = 50.0f; sZoFwork[ZO_BSF_28] = -2600.0f; @@ -3150,7 +3150,7 @@ void func_i3_801986FC(Boss* bossZO, s32 arg1, f32 xOff, f32 yOff, f32 zOff, f32 newActor->vel.z = bossZO->vel.z + sp54.z; Object_SetInfo(&newActor->info, newActor->obj.id); sZoFwork[ZO_BSF_35 + arg1] = 40.0f; - Audio_PlaySfx(0x2903203B, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903203B, bossZO->sfxSource, 4); for (sp50 = 0; sp50 < 4; sp50++) { func_i3_80193C5C(newActor->obj.pos.x + (sp54.x * 4.3f), newActor->obj.pos.y + (sp54.y * 4.3f), newActor->obj.pos.z + (sp54.z * 4.3f) + 100.0f, 30.0f); @@ -3191,7 +3191,7 @@ void func_i3_801989FC(Boss* bossZO) { newActor->vel.x = sp64.x; newActor->vel.z = bossZO->vel.z + sp64.z; Object_SetInfo(&newActor->info, newActor->obj.id); - Audio_PlaySfx(0x2903101B, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903101B, bossZO->sfxSource, 4); break; } } @@ -3207,7 +3207,7 @@ void func_i3_80198BE8(Boss* bossZO, s32 arg1) { if ((sZoSwork[ZO_BSS_2 + arg1] == 0) && (sZoSwork[ZO_BSS_39 + arg1] == 0)) { if ((arg1 == 0) && (sZoSwork[ZO_BSS_41] == 0)) { - Audio_PlaySfx(0x31034025, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31034025, bossZO->sfxSource, 4); } sZoSwork[ZO_BSS_2 + arg1] = 2; sZoSwork[ZO_BSS_41 + arg1]++; @@ -3215,7 +3215,7 @@ void func_i3_80198BE8(Boss* bossZO, s32 arg1) { sZoSwork[ZO_BSS_41 + arg1] = 0; sZoSwork[ZO_BSS_39 + arg1] = 30; if (arg1 == 1) { - func_8001A55C(bossZO->sfxPos, 0x31034025); + Audio_KillSfxBySourceAndId(bossZO->sfxSource, 0x31034025); } } for (var_s1 = 0, effect = gEffects; var_s1 < 100; var_s1++, effect++) { @@ -3349,7 +3349,7 @@ void func_i3_80199394(Boss* bossZO, s32 arg1) { bossZO->timer_050 = 20; sZoFwork[ZO_BSF_17 + arg1] = sZoFwork[ZO_BSF_77] = 0.0f; sZoSwork[ZO_BSS_16] = 3; - Audio_PlaySfx(0x29433022, bossZO->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29433022, bossZO->sfxSource, 4); } void func_i3_80199470(Boss* bossZO, s32 arg1) { @@ -3404,7 +3404,7 @@ void func_i3_8019969C(Actor* actor) { actor->unk_0D4 = 2; actor->obj.pos.z -= 100.0f; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A008); } actor->unk_0D0 = 0; @@ -3476,7 +3476,7 @@ void func_i3_80199A28(Actor* actor) { (actor->iwork[1] == 0)) { func_8008377C(actor->obj.pos.x, sp3C, actor->obj.pos.z, 0.0f, 0.5f); actor->iwork[1]++; - Audio_PlaySfx(0x19000020, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000020, actor->sfxSource, 4); } Math_SmoothStepToF(&actor->vel.y, -60.0f, 0.5f, 5.0f, 0.00001f); if (actor->obj.pos.y < -30.0f) { @@ -3505,12 +3505,12 @@ void func_i3_80199A28(Actor* actor) { actor->unk_0D4 = 2; actor->obj.pos.y += 200.0f; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x1903400F); } else { if ((fabsf(actor->obj.pos.z - gPlayer[0].unk_138) < 800.0f) || (actor->unk_0D0 != 0)) { func_i3_801999CC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903B009); } } @@ -3522,7 +3522,7 @@ void func_i3_80199A28(Actor* actor) { actor->unk_0D4 = 2; actor->obj.pos.y += 200.0f; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -3547,7 +3547,7 @@ void func_i3_80199F10(Actor* actor) { Math_SmoothStepToF(&actor->fwork[0], -500.0f, 1.0f, 100.0f, 0.00001f); actor->obj.pos.z = sZoFwork[ZO_BSF_60_Z]; if (actor->obj.pos.y < -400.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } switch (actor->state) { /* irregular */ @@ -3557,12 +3557,12 @@ void func_i3_80199F10(Actor* actor) { switch (sZoSwork[ZO_BSS_16]) { /* switch 1; irregular */ case 1: actor->fwork[1] = sZoFwork[ZO_BSF_68_Y] - sZoFwork[ZO_BSF_60_Y]; - Audio_PlaySfx(0x3100503E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100503E, actor->sfxSource, 4); actor->state++; break; case 2: actor->fwork[1] = sZoFwork[ZO_BSF_71_Y] - sZoFwork[ZO_BSF_60_Y]; - Audio_PlaySfx(0x3100503E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100503E, actor->sfxSource, 4); actor->state++; break; } @@ -3587,7 +3587,7 @@ void func_i3_80199F10(Actor* actor) { func_i3_80199E9C(actor, 0.0f, 10.0f); } else { actor->state = 0; - Audio_KillSfx(actor->sfxPos); + Audio_KillSfxBySource(actor->sfxSource); } break; } @@ -3596,7 +3596,7 @@ void func_i3_80199F10(Actor* actor) { } if (actor->unk_0D0 != 0) { if (actor->unk_0D0 == 1) { - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } actor->unk_0D0 = 0; } @@ -3669,7 +3669,7 @@ void func_i3_8019A5D4(Actor* actor) { f32 var_fv1; if ((gBosses[0].state == 6) || (gBosses[0].state == 7)) { - Audio_KillSfx(actor->sfxPos); + Audio_KillSfxBySource(actor->sfxSource); actor->state = 10; actor->vel.z = 40.0f; } @@ -3697,7 +3697,7 @@ void func_i3_8019A5D4(Actor* actor) { actor->timer_0BC = (s32) ((fabsf(sZoFwork[ZO_BSF_28] - -2600.0f) / 100.0f) + 30.0f); actor->timer_0C0 = 3; - Audio_PlaySfx(0x2900403D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900403D, actor->sfxSource, 4); actor->state++; } break; @@ -3713,7 +3713,7 @@ void func_i3_8019A5D4(Actor* actor) { actor->fwork[5] = actor->vel.y * -3.0f; if (actor->obj.pos.y < -150.0f) { actor->gravity = 0.0f; - Audio_PlaySfx(0x19003021, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19003021, actor->sfxSource, 4); actor->state++; } } @@ -3736,7 +3736,7 @@ void func_i3_8019A5D4(Actor* actor) { } if (func_80062DBC(&actor->obj.pos, gBosses[0].info.hitbox, &gBosses[0].obj, 0.0f, 0.0f, 0.0f) != 0) { actor->fwork[6] = 50.0f; - Audio_PlaySfx(0x19030003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19030003, actor->sfxSource, 4); } actor->vel.z += actor->fwork[6] * 0.8f; actor->vel.y += actor->fwork[6] * 1.4f; @@ -3746,8 +3746,8 @@ void func_i3_8019A5D4(Actor* actor) { } if ((sp4C <= 30.0f) && (sp48 <= 30.0f)) { actor->state = 0; - Audio_KillSfx(actor->sfxPos); - Audio_PlaySfx(0x29433022, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Audio_KillSfxBySource(actor->sfxSource); + AUDIO_PLAY_SFX(0x29433022, actor->sfxSource, 4); actor->timer_0BC = 40; sZoFwork[ZO_BSF_74] = sZoFwork[ZO_BSF_75] = 0.0f; sZoSwork[ZO_BSS_19] = 1; @@ -3758,7 +3758,7 @@ void func_i3_8019A5D4(Actor* actor) { func_i3_8018FF50(actor); if (actor->unk_0D0 != 0) { if (actor->unk_0D0 == 1) { - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } actor->unk_0D0 = 0; } @@ -3767,9 +3767,9 @@ void func_i3_8019A5D4(Actor* actor) { func_8008377C(actor->obj.pos.x, sp44, actor->obj.pos.z, 0.0f, 0.7f); actor->iwork[0]++; if (actor->vel.y >= 0.0f) { - Audio_PlaySfx(0x1983201A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1983201A, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x19832019, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19832019, actor->sfxSource, 4); } } } @@ -3930,7 +3930,7 @@ void func_i3_8019B1F0(Actor* actor) { } } actor->obj.rot.x = 0.0f; - Audio_PlaySfx(0x3100203A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100203A, actor->sfxSource, 4); } void func_i3_8019B548(Actor* actor) { @@ -4002,7 +4002,7 @@ void func_i3_8019B854(Actor* actor) { actor->unk_0D0 = 0; actor->timer_0C6 = 15; actor->health -= actor->damage; - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); } switch (actor->state) { case 0: @@ -4049,7 +4049,7 @@ void func_i3_8019B854(Actor* actor) { actor->unk_044 = 0; func_80066254(actor); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x1903901C); break; } @@ -4154,7 +4154,7 @@ void func_i3_8019BE48(Actor* actor) { newActor->iwork[0] = 777; func_8008377C(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 5.0f, 0.7f); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y + 50.0f, actor->obj.pos.z, 5.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x29038033); break; } @@ -4237,7 +4237,7 @@ void func_i3_8019C454(Actor* actor) { Math_SmoothStepToAngle(&actor->fwork[6], 10.0f, 0.1f, 1.0f, 0.01f); Math_SmoothStepToAngle(&actor->obj.rot.y, actor->fwork[5], 1.0f, actor->fwork[6], 0.01f); if (actor->fwork[5] != actor->obj.rot.y) { - Audio_PlaySfx(0x1900001B, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900001B, actor->sfxSource, 4); } if (1) {} } @@ -4392,7 +4392,7 @@ void func_i3_8019CBEC(Actor* actor) { if (actor->fwork[1] < 0.6f) { Math_SmoothStepToF(&actor->fwork[2], 0.0f, 0.5f, 5.0f, 0.01f); if (actor->fwork[2] == 0.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } break; @@ -4465,15 +4465,15 @@ void func_i3_8019D15C(Actor* actor) { if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; if (actor->unk_0D2 < 2) { - Audio_PlaySfx(0x1903001E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1903001E, actor->sfxSource, 4); if ((actor->obj.pos.y + 268.0f) < actor->unk_0D8.y) { actor->fwork[1] = 20.0f; } else { actor->fwork[1] = -20.0f; } - Audio_PlaySfx(0x1903001F, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1903001F, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } } if (actor->unk_046 != 0) { @@ -4486,7 +4486,7 @@ void func_i3_8019D15C(Actor* actor) { actor->fwork[0] += actor->fwork[1]; Math_SmoothStepToF(&actor->fwork[1], 0.0f, 1.0f, 1.0f, 0.0f); if (actor->fwork[1] == 0.0f) { - Audio_KillSfx(actor->sfxPos); + Audio_KillSfxBySource(actor->sfxSource); } } } @@ -4557,7 +4557,7 @@ void func_i3_8019D428(Player* player) { } gControllerHold[gMainController].button = sp2C; if (gCsFrameCount >= 270) { - func_8001D444(0, 0x8006, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_6 | 0x8000); D_80177838 = 80; player->state_1C8 = PLAYERSTATE_1C8_3; player->unk_1D0 = 0; @@ -4598,12 +4598,12 @@ void func_i3_8019D76C(Player* player) { gCsCamAtZ = player->camAt.z; for (i = 10; i < 60; i++) { if (gActors[i].unk_0B6 == 0) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } - Object_Kill(&gActors[2].obj, gActors[2].sfxPos); - Object_Kill(&gActors[3].obj, gActors[3].sfxPos); - Object_Kill(&gActors[4].obj, gActors[4].sfxPos); + Object_Kill(&gActors[2].obj, gActors[2].sfxSource); + Object_Kill(&gActors[3].obj, gActors[3].sfxSource); + Object_Kill(&gActors[4].obj, gActors[4].sfxSource); player->unk_1D0 = 1; D_80177A48[0] = 0.05f; if (Rand_ZeroOne() > 0.5f) { @@ -4637,7 +4637,7 @@ void func_i3_8019D76C(Player* player) { player->unk_1D0++; func_800A6148(); func_8001CA24(0); - Audio_KillSfx(player->sfxPos); + Audio_KillSfxBySource(player->sfxSource); D_80178340 = 250; player->timer_1F8 = 20; player->wings.unk_2C = 1; @@ -4655,7 +4655,7 @@ void func_i3_8019D76C(Player* player) { player->pos.z = -(D_80177D20 + 1500.0f); player->unk_1D0++; func_8001C8B8(0); - func_8001D444(0, 38, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_38); D_80177A98 = 1; func_800A6148(); func_i3_801A7750(); @@ -4727,7 +4727,7 @@ void func_i3_8019D76C(Player* player) { D_8017835C = 8; if (D_80178340 == 255) { func_8001CA24(0); - func_8001DBD0(10); + Audio_FadeOutAll(10); player->state_1C8 = PLAYERSTATE_1C8_6; player->timer_1F8 = 0; D_8017837C = 4; @@ -4797,12 +4797,12 @@ void func_i3_8019D76C(Player* player) { D_80177830 = 0; break; case 1180: - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); player->unk_190 = player->unk_194 = 5.0f; break; case 1240: - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); break; case 1120: if (gTeamShields[3] > 0) { @@ -4871,7 +4871,7 @@ void func_i3_8019E5F0(Actor* actor) { break; case 2: actor->state = 3; - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); actor->fwork[29] = 5.0f; /* fallthrough */ case 3: diff --git a/src/overlays/ovl_i4/fox_bo.c b/src/overlays/ovl_i4/fox_bo.c index d87f24c8..65de412f 100644 --- a/src/overlays/ovl_i4/fox_bo.c +++ b/src/overlays/ovl_i4/fox_bo.c @@ -80,7 +80,7 @@ void func_i4_8018BD60(Actor* actor) { actorPtr->unk_044 = 2; actorPtr->unk_0E4 = i; Object_SetInfo(&actorPtr->info, actorPtr->obj.id); - Audio_PlaySfx(0x3100000CU, actorPtr->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actorPtr->sfxSource, 4U); break; } } @@ -108,7 +108,7 @@ void func_i4_8018BEF8(Actor* actor, s32 arg1) { } else { actorPtr->obj.pos.x = D_i4_8019EEE4[actor->unk_04E]; actorPtr->obj.pos.y = 50.0f; - Audio_PlaySfx(0x2903305FU, actorPtr->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903305FU, actorPtr->sfxSource, 4U); actorPtr->timer_0BC = 5; actorPtr->timer_0C2 = 100; actorPtr->unk_0F4.x = 90.0f; @@ -150,7 +150,7 @@ void func_i4_8018BEF8(Actor* actor, s32 arg1) { } Object_SetInfo(&actorPtr->info, actorPtr->obj.id); - Audio_PlaySfx(0x3100000CU, actorPtr->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actorPtr->sfxSource, 4U); actor->unk_04E++; if (actor->unk_04E >= 5) { @@ -224,8 +224,8 @@ void func_i4_8018C158(Actor* actor) { } if (gBosses[2].state == 10) { - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3) || (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_5)) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_7; gPlayer[0].timer_1F8 = 30; @@ -234,8 +234,8 @@ void func_i4_8018C158(Actor* actor) { } func_8002EE34(); actor->state = 6; - Audio_PlaySfx(0x31009063U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x2940D09AU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31009063U, actor->sfxSource, 0U); + AUDIO_PLAY_SFX(0x2940D09AU, actor->sfxSource, 4U); D_Timer_80161A60 = 8; for (actorPtr = &gActors[10], i = 0; i < 20; i++, actorPtr++) { @@ -251,7 +251,7 @@ void func_i4_8018C158(Actor* actor) { actor->state = 10; actor->timer_0BC = 150; gPlayer[0].state_1C8 = PLAYERSTATE_1C8_0; - func_8001D444(0U, 0x801CU, 0U, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_28 | 0x8000); func_8002EE34(); gPlayer[0].camEye.x = 400.0f; gPlayer[0].camEye.y = 50.0f; @@ -260,7 +260,7 @@ void func_i4_8018C158(Actor* actor) { gPlayer[0].camAt.y = 0.0f; gPlayer[0].camAt.z = 0.0f; for (i = 10; i < 30; i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } else if ((D_8015F924 == 1) && (((gHitCount - actor->iwork[1]) >= 5) || (D_i4_801A0530 == 0xFA0))) { D_8015F924 = 2; @@ -309,7 +309,7 @@ void func_i4_8018C158(Actor* actor) { case 10: if (gBosses[1].obj.status != 0) { if (fabsf(Math_SmoothStepToF(&gBosses[1].unk_3F8, 0.0f, 1.0f, 0.05f, 0.001f)) < 0.05f) { - Object_Kill(&gBosses[1].obj, gBosses[i].sfxPos); + Object_Kill(&gBosses[1].obj, gBosses[i].sfxSource); gLight1R = 100; gLight1G = 100; gLight1B = 80; @@ -350,7 +350,7 @@ void func_i4_8018C158(Actor* actor) { player->state_1C8 = PLAYERSTATE_1C8_3; func_800B7184(player, 1); player->unk_014 = 0.0f; - Audio_KillSfx(gBosses[1].sfxPos); + Audio_KillSfxBySource(gBosses[1].sfxSource); actor->iwork[1] = gHitCount; } break; @@ -591,7 +591,7 @@ bool func_i4_8018D278(Actor* actor) { actor->unk_044 = 1; func_80066254(actor); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); actor->info.bonus = 0; actor->timer_0CA[0] = 0; @@ -664,7 +664,7 @@ bool func_i4_8018D584(Actor* actor) { if ((actor->unk_0D2 < 2) && (actor->state == 0)) { actor->timer_0C6 = 20; actor->unk_0D0 = 0; - Audio_PlaySfx(0x29024003U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29024003U, actor->sfxSource, 0U); actor->health += actor->damage; if (actor->health < 100) { @@ -688,8 +688,8 @@ bool func_i4_8018D584(Actor* actor) { func_8007B344(actor->obj.pos.x, actor->obj.pos.y + 730.0f, actor->obj.pos.z, 10.0f, 5); actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6011BA4); - func_8001A55C(actor->sfxPos, 0x11000028U); - Audio_PlaySfx(0x2903B009U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Audio_KillSfxBySourceAndId(actor->sfxSource, 0x11000028U); + AUDIO_PLAY_SFX(0x2903B009U, actor->sfxSource, 0U); } else { func_8007A6F0(&actor->obj.pos, 0x29121007); } @@ -1002,7 +1002,7 @@ void func_i4_8018EAEC(Actor* actor, s32 index) { actor->unk_0F4.y = D_i4_8019F018[index]; Object_SetInfo(&actor->info, actor->obj.id); actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } void func_i4_8018EC1C(void) { @@ -1050,7 +1050,7 @@ void func_i4_8018ED44(void) { actor->unk_0B6 = 31; actor->vel.z = 200.0f; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x29002002U, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29002002U, actor->sfxSource, 4U); break; } } @@ -1074,7 +1074,7 @@ void func_i4_8018EE4C(f32 x, f32 y) { actor->obj.rot.z = RAND_FLOAT_CENTERED(120.0f); actor->unk_0F4.z = RAND_FLOAT_CENTERED(1.0f); Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x29002002U, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29002002U, actor->sfxSource, 4U); break; } } @@ -1270,7 +1270,7 @@ void func_i4_8018EF6C(Player* player) { actor->state = 3; actor->timer_0BC = 80; } - func_8001D444(0, D_80177C90, 0, 0xFF); + AUDIO_PLAY_BGM(D_80177C90); D_80177838 = 80; } break; @@ -1316,7 +1316,7 @@ void func_i4_8018F83C(Actor* actor, s32 arg1) { actor->vel.z = -gPlayer[0].unk_0D0; Object_SetInfo(&actor->info, actor->obj.id); actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } void func_i4_8018F94C(Player* player) { @@ -1335,7 +1335,7 @@ void func_i4_8018F94C(Player* player) { switch (player->unk_1D0) { case 0: - func_8001A38C(1, player->sfxPos); + Audio_StopSfxByBankAndSource(1, player->sfxSource); gCsFrameCount = 0; D_i4_801A03D0 = 100.0f; D_i4_801A03D4 = 100.0f; @@ -1348,7 +1348,7 @@ void func_i4_8018F94C(Player* player) { if (player->timer_1F8 == 0) { player->unk_1D0 = 1; player->timer_1F8 = 200; - Audio_PlaySfx(0x09000002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0U); player->unk_194 = 5.0f; player->unk_190 = 5.0f; D_80161A44 = 30000.0f; @@ -1371,7 +1371,7 @@ void func_i4_8018F94C(Player* player) { player->unk_1D0 = 5; player->timer_1F8 = 1000; func_8001CA24(0); - Audio_KillSfx(player->sfxPos); + Audio_KillSfxBySource(player->sfxSource); func_800A6148(); for (i = 0; i < 200; i++) { @@ -1410,13 +1410,13 @@ void func_i4_8018F94C(Player* player) { gCsCamAtY = gPlayer[0].pos.y; gCsCamAtZ = gPlayer[0].pos.z; D_80178340 = D_80178358 = 255; - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); gCsFrameCount = 0; gGroundLevel = -10000.0f; player->unk_240 = 1; player->wings.unk_2C = 1; - Audio_PlaySfx(0x31009063U, actor50->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31009063U, actor50->sfxSource, 0U); func_8001C8B8(0); } break; @@ -1454,7 +1454,7 @@ void func_i4_8018F94C(Player* player) { switch (gCsFrameCount) { case 160: - func_8001D444(0, 0x26, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_38); break; case 92: @@ -1462,11 +1462,11 @@ void func_i4_8018F94C(Player* player) { break; case 95: - Audio_KillSfx(actor50->sfxPos); - Audio_PlaySfx(0x2902F026U, gActors[0].sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Audio_KillSfxBySource(actor50->sfxSource); + AUDIO_PLAY_SFX(0x2902F026U, gActors[0].sfxSource, 0U); for (i = 0; i < ARRAY_COUNT(gEffects); i++) { - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); } func_8007B344(actor50->obj.pos.x, actor50->obj.pos.y, actor50->obj.pos.z, 400.0f, 4); @@ -1567,7 +1567,7 @@ void func_i4_8018F94C(Player* player) { player->timer_1F8 = 0x32; player->unk_194 = 5.0f; player->unk_190 = 5.0f; - Audio_PlaySfx(0x09000002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0U); break; } break; @@ -1581,7 +1581,7 @@ void func_i4_8018F94C(Player* player) { player->unk_0D0 += 5; if (player->timer_1F8 == 30) { - func_8001DBD0(30); + Audio_FadeOutAll(30); } if (player->timer_1F8 == 0) { @@ -1592,7 +1592,7 @@ void func_i4_8018F94C(Player* player) { gNextGameState = GSTATE_PLAY; gNextLevel = LEVEL_VENOM_1; func_8001CA24(0); - Audio_KillSfx(player->sfxPos); + Audio_KillSfxBySource(player->sfxSource); D_800D3180[LEVEL_BOLSE] = Play_CheckMedalStatus(150) + 1; for (i = 1; i < 6; i++) { @@ -1721,7 +1721,7 @@ void func_i4_80190D98(Effect* effect, f32 xPos, f32 yPos, f32 zPos, f32 xRot, f3 effect->vel.y = dest.y; effect->vel.z = dest.z; effect->timer_50 = 60; - Audio_PlaySfx(0x31000013U, effect->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000013U, effect->sfxSource, 4U); Object_SetInfo(&effect->info, effect->obj.id); } @@ -1771,12 +1771,12 @@ void func_i4_80191054(Effect* effect) { Math_SmoothStepToF(&effect->scale2, 30.0f, 1.0f, 10.0f, 0.0f); if (effect->timer_50 == 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } if (effect->obj.pos.y < gGroundLevel + 50.0f) { func_i4_80190FE8(effect->obj.pos.x, gGroundLevel + 50.0f, effect->obj.pos.z, 3.0f); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; @@ -1784,7 +1784,7 @@ void func_i4_80191054(Effect* effect) { Math_SmoothStepToF(&effect->scale2, effect->scale1, 0.1f, 20.0f, 0.0f); effect->unk_44 -= 20; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; } @@ -1838,7 +1838,7 @@ void func_i4_801912FC(Boss* boss) { boss->state = 2; Radio_PlayMessage(gMsg_ID_11150, RCID_PEPPY); boss->timer_050 = 1000; - Audio_PlaySfx(0x19034041U, boss->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19034041U, boss->sfxSource, 0U); } break; @@ -1849,7 +1849,7 @@ void func_i4_801912FC(Boss* boss) { if (boss->timer_050 == 1) { boss->timer_050 = 2000; Radio_PlayMessage(gMsg_ID_11160, RCID_PEPPY); - func_8001A55C(boss->sfxPos, 0x19034041); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x19034041); } break; @@ -1880,7 +1880,7 @@ void func_i4_801912FC(Boss* boss) { boss->swork[boss->dmgPart] -= boss->damage; if (boss->swork[boss->dmgPart] <= 0) { boss->swork[24 + boss->dmgPart] = 30; - Audio_PlaySfx(0x2903B009U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009U, boss->sfxSource, 4U); boss->swork[36]--; if (boss->swork[36] <= 0) { boss->state = 10; @@ -1891,7 +1891,7 @@ void func_i4_801912FC(Boss* boss) { boss->obj.pos.y -= 300.0f; } else { boss->swork[12 + boss->dmgPart] = 20; - Audio_PlaySfx(0x29034003U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003U, boss->sfxSource, 4U); } } } @@ -2017,8 +2017,8 @@ void func_i4_80191BAC(Boss* boss) { boss->timer_052 = 130; boss->state = 1; Radio_PlayMessage(gMsg_ID_11050, RCID_FOX); - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); } break; @@ -2026,7 +2026,7 @@ void func_i4_80191BAC(Boss* boss) { Math_SmoothStepToF(&gBosses[0].fwork[1], 0.0f, 1.0f, 0.01f, 0.001f); if (boss->timer_052 == 0) { boss->state = 2; - Audio_PlaySfx(0x19401048U, boss->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19401048U, boss->sfxSource, 0U); } break; } @@ -2079,9 +2079,9 @@ void func_i4_80191ED8(void) { Object_58_Initialize(obj58); obj58->obj.status = OBJ_ACTIVE; obj58->obj.id = D_80178310[i].id; - obj58->sfxPos[0] = obj58->obj.pos.x = D_80178310[i].xPos; - obj58->sfxPos[1] = obj58->obj.pos.y = D_80178310[i].yPos; - obj58->sfxPos[2] = obj58->obj.pos.z = -D_80178310[i].zPos1; + obj58->sfxSource[0] = obj58->obj.pos.x = D_80178310[i].xPos; + obj58->sfxSource[1] = obj58->obj.pos.y = D_80178310[i].yPos; + obj58->sfxSource[2] = obj58->obj.pos.z = -D_80178310[i].zPos1; obj58->unk_54 = obj58->obj.rot.y = D_80178310[i].rot.y; Object_SetInfo(&obj58->info, obj58->obj.id); obj58++; @@ -2097,7 +2097,7 @@ void func_i4_80191ED8(void) { actor->obj.status = OBJ_INIT; actor->obj.id = D_80178310[i].id; if ((actor->obj.id == OBJ_ACTOR_271) && (D_8015F924 == 0)) { - Audio_PlaySfx(0x11000028U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11000028U, actor->sfxSource, 0U); } actor->fwork[10] = actor->obj.pos.x = D_80178310[i].xPos; actor->fwork[11] = actor->obj.pos.y = D_80178310[i].yPos; diff --git a/src/overlays/ovl_i4/fox_fo.c b/src/overlays/ovl_i4/fox_fo.c index 0a3a416b..a7c7330c 100644 --- a/src/overlays/ovl_i4/fox_fo.c +++ b/src/overlays/ovl_i4/fox_fo.c @@ -54,7 +54,7 @@ void func_i4_801875F0(Actor* actor) { actorPtr->unk_0C9 = actorPtr->iwork[11] = 1; actorPtr->unk_044 = 2; Object_SetInfo(&actorPtr->info, actorPtr->obj.id); - Audio_PlaySfx(0x31000011U, actorPtr->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000011U, actorPtr->sfxSource, 4); break; } } @@ -85,7 +85,7 @@ void func_i4_80187884(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { actor->iwork[11] = 1; actor->unk_0F4.x = 0.0f; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x31004005U, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31004005U, actor->sfxSource, 4U); } Vec3f D_i4_8019EDF8[] = { { -300.0f, 1000.0f, 13000.0f }, { 300.0f, 700.0f, 14000.0f }, { 1000.0f, 300.0f, 0.0f } }; @@ -118,8 +118,8 @@ void func_i4_80187960(Actor* actor) { if ((D_8015F928 + 240) == (0, D_800C9B4C)) { Radio_PlayMessage(gMsg_ID_9375, RCID_ROB64); - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); } if ((D_8015F928 + 100) == (0, D_800C9B4C)) { @@ -131,7 +131,7 @@ void func_i4_80187960(Actor* actor) { } if (D_8015F928 == 7000) { - Audio_PlaySfx(0x11030016U, gBosses[0].sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030016U, gBosses[0].sfxSource, 4U); func_8002EE34(); Radio_PlayMessage(gMsg_ID_9390, RCID_ROB64); D_8015F944 = 1.0f; @@ -147,7 +147,7 @@ void func_i4_80187960(Actor* actor) { if (D_8015F928 == 8540) { Radio_PlayMessage(gMsg_ID_9400, RCID_ROB64); - func_8001D444(0, 0x800A, 0, 0); + Audio_PlaySequence(SEQ_PLAYER_BGM, SEQ_ID_10 | 0x8000, 0, 0); gActors[1].unk_0E6 = gActors[2].unk_0E6 = gActors[3].unk_0E6 = gActors[4].unk_0E6 = gActors[5].unk_0E6 = gActors[6].unk_0E6 = gActors[7].unk_0E6 = -1; } @@ -173,7 +173,7 @@ void func_i4_80187960(Actor* actor) { actor->fwork[0] = 0.0f; func_8002EE34(); for (i = 4; i < 8; i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } @@ -193,7 +193,7 @@ void func_i4_80187960(Actor* actor) { func_8002EE34(); for (i = 4; i < 8; i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } if ((D_80177CD0[0] == 0) && (D_80177CD0[1] == 0) && (D_80177CD0[2] == 0) && (D_80177CD0[3] == 0)) { @@ -202,9 +202,9 @@ void func_i4_80187960(Actor* actor) { gPlayer[0].timer_1F8 = 50; player->unk_190 = 5.0f; player->unk_194 = 5.0f; - Audio_PlaySfx(0x09000002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_800182F4(0x101E00FF); - func_800182F4(0x111E00FF); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0U); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 30); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 30); } else { D_80177930 = 0; gPlayer[0].timer_1F8 = 30; @@ -258,7 +258,7 @@ void func_i4_80187960(Actor* actor) { actor->state = 2; player->state_1C8 = 3; player->unk_014 = 0.0001f; - func_8001D444(0, D_80177C90, 0, 0xFF); + AUDIO_PLAY_BGM(D_80177C90); D_80177838 = 80; } }; @@ -348,7 +348,7 @@ void func_i4_80187960(Actor* actor) { D_80161708 = 0; for (i = 4; i < 8; i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } D_8015F93C = 1; @@ -491,7 +491,7 @@ void func_i4_80188AD0(Actor* actor) { actor->info.unk_1C = 0.0f; actor->timer_0CA[0] = 0; actor->info.bonus = 0; - Audio_PlaySfx(0x2903B009U, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009U, actor->sfxSource, 4U); } } @@ -614,14 +614,14 @@ void func_i4_801890EC(Actor* actor, s32 arg1) { if (arg1 < 3) { actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } else { actor->obj.pos.z = -9500.0f; actor->unk_0B6 = 1; actor->vel.z = 22.0f; - Audio_PlaySfx(0x11030010U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31024059U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010U, actor->sfxSource, 0U); + AUDIO_PLAY_SFX(0x31024059U, actor->sfxSource, 0U); } } @@ -721,7 +721,7 @@ void func_i4_8018927C(Player* player) { } player->unk_194 = 5.0f; player->unk_190 = 5.0f; - Audio_PlaySfx(0x09000002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0U); } break; @@ -742,13 +742,13 @@ void func_i4_8018927C(Player* player) { player->unk_1D0 = 2; player->timer_1F8 = 1000; for (i = 0; i < ARRAY_COUNT(gActors); i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } //! FAKE: if (((&dest) && (&dest)) && (&dest)) {} func_8001CA24(0); - Audio_KillSfx(player->sfxPos); + Audio_KillSfxBySource(player->sfxSource); player->unk_234 = 0; D_80178340 = 255; D_80178358 = 255; @@ -763,7 +763,7 @@ void func_i4_8018927C(Player* player) { D_8017835C = 8; } if (player->timer_1F8 == 810) { - Audio_KillSfx(gBosses[0].sfxPos); + Audio_KillSfxBySource(gBosses[0].sfxSource); } if (player->timer_1F8 == 830) { D_80178358 = 255; @@ -821,8 +821,8 @@ void func_i4_8018927C(Player* player) { gCsFrameCount = 0; player->wings.unk_2C = 1; player->unk_204 = 1; - func_800182F4(0x106400FF); - func_800182F4(0x116400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 100); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 100); func_8001C8B8(0); if (D_80177930 == 0) { func_i4_801890EC(actor0, 3); @@ -867,9 +867,9 @@ void func_i4_8018927C(Player* player) { if (gCsFrameCount == 200) { if (D_80177930 == 0) { - func_8001D444(0, 0x31, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_49); } else { - func_8001D444(0, 0x26, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_38); } } @@ -1016,11 +1016,11 @@ void func_i4_8018927C(Player* player) { D_80177A48[4] = 1.0f; actor2->vel.y = 0.1f; actor1->vel.y = 0.1f; - Audio_PlaySfx(0x09000002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0U); player->unk_194 = 5.0f; player->unk_190 = 5.0f; - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); } } break; @@ -1036,7 +1036,7 @@ void func_i4_8018927C(Player* player) { if (gTeamShields[1] > 0) { if (player->timer_1F8 == 980) { - Audio_PlaySfx(0x09000002U, actor3->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor3->sfxSource, 0U); actor3->vel.y = 1.0f; actor3->fwork[29] = 5.0f; } @@ -1049,7 +1049,7 @@ void func_i4_8018927C(Player* player) { } if ((gTeamShields[3] > 0) && (player->timer_1F8 == 960)) { - Audio_PlaySfx(0x09000002U, actor2->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor2->sfxSource, 0U); actor2->vel.y = 1.0f; actor2->fwork[29] = 5.0f; } @@ -1063,7 +1063,7 @@ void func_i4_8018927C(Player* player) { if (gTeamShields[2] > 0) { if (player->timer_1F8 == 940) { - Audio_PlaySfx(0x09000002U, actor1->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor1->sfxSource, 0U); actor1->vel.y = 1.0f; actor1->fwork[29] = 5.0f; } @@ -1092,7 +1092,7 @@ void func_i4_8018927C(Player* player) { player->state_1C8 = PLAYERSTATE_1C8_6; player->timer_1F8 = 0; D_8017837C = 4; - func_8001DBD0(10); + Audio_FadeOutAll(10); for (i = 0; i < 6; i++) { D_80177CF0[i] = D_80177CD0[i]; } @@ -1187,7 +1187,7 @@ void func_i4_8018927C(Player* player) { switch (gCsFrameCount) { case 140: - func_8001D444(0, 0x26, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_38); break; case 450: D_80177840 = 100; @@ -1273,7 +1273,7 @@ void func_i4_8018927C(Player* player) { case 1240: if (gTeamShields[1] > 0) { - Audio_PlaySfx(0x09000002U, actor3->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor3->sfxSource, 0U); actor3->fwork[29] = 5.0f; actor3->iwork[11] = 2; } @@ -1281,7 +1281,7 @@ void func_i4_8018927C(Player* player) { case 1260: if (gTeamShields[2] > 0) { - Audio_PlaySfx(0x09000002U, actor1->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor1->sfxSource, 0U); actor1->fwork[29] = 5.0f; actor1->iwork[11] = 2; } @@ -1289,7 +1289,7 @@ void func_i4_8018927C(Player* player) { case 1280: if (gTeamShields[3] > 0) { - Audio_PlaySfx(0x09000002U, actor2->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor2->sfxSource, 0U); actor2->fwork[29] = 5.0f; actor2->iwork[11] = 2; } @@ -1297,14 +1297,14 @@ void func_i4_8018927C(Player* player) { break; case 1300: - Audio_PlaySfx(0x09000002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0U); player->unk_190 = 2.0f; player->unk_194 = 5.0f; break; case 1350: - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); break; } @@ -1315,7 +1315,7 @@ void func_i4_8018927C(Player* player) { player->state_1C8 = PLAYERSTATE_1C8_6; player->timer_1F8 = 0; D_8017837C = 4; - func_8001DBD0(10); + Audio_FadeOutAll(10); // clang-format off for (i = 0; i < 6; i++) { \ diff --git a/src/overlays/ovl_i4/fox_ka.c b/src/overlays/ovl_i4/fox_ka.c index 5069d404..e06d9e6f 100644 --- a/src/overlays/ovl_i4/fox_ka.c +++ b/src/overlays/ovl_i4/fox_ka.c @@ -116,7 +116,7 @@ void func_i4_80192984(Effect* effect) { if ((fabsf(effect->obj.pos.x - gBosses[1].obj.pos.x) <= 30.0f) && (fabsf(effect->obj.pos.z - gBosses[1].obj.pos.z) <= 30.0f)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -189,7 +189,7 @@ void func_i4_80192C8C(void) { actor->unk_0C9 = 1; actor->iwork[11] = 1; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x31000011U, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000011U, actor->sfxSource, 4); } } } @@ -276,11 +276,11 @@ void func_i4_80192E20(Player* player) { player->camEye.x = gCsCamEyeX = 100.0f; player->camEye.z = gCsCamEyeZ = 7000.0f; if (gCsFrameCount == 240) { - Object_Kill(&gActors[4].obj, gActors[4].sfxPos); - Object_Kill(&gActors[6].obj, gActors[6].sfxPos); + Object_Kill(&gActors[4].obj, gActors[4].sfxSource); + Object_Kill(&gActors[6].obj, gActors[6].sfxSource); player->state_1C8 = PLAYERSTATE_1C8_3; player->unk_014 = 0.0001f; - func_8001D444(0, D_80177C90, 0, 255); + AUDIO_PLAY_BGM(D_80177C90); D_80177838 = 80; for (actor = &gActors[1], i = 1; i < 4; i += 1, actor++) { actor->timer_0BC = 0; @@ -332,7 +332,7 @@ void func_i4_80192E20(Player* player) { break; case 47: - Object_Kill(&gActors[5].obj, gActors[5].sfxPos); + Object_Kill(&gActors[5].obj, gActors[5].sfxSource); break; } Matrix_RotateY(gCalcMatrix, (player->unk_0E8 + player->unk_114 + 180.0f) * M_DTOR, 0); @@ -409,7 +409,7 @@ void func_i4_80193718(Boss* boss) { } if (boss->dmgType != DMG_NONE) { boss->dmgType = DMG_NONE; - Audio_PlaySfx(0x29121007U, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007U, boss->sfxSource, 4U); } } @@ -466,7 +466,7 @@ void func_i4_80193EF0(Boss* boss) { s32 pad; Vec3f src; Vec3f dest; - Vec3f sfxPos; + Vec3f sfxSource; f32 y; if (boss->dmgType != DMG_NONE) { @@ -484,10 +484,10 @@ void func_i4_80193EF0(Boss* boss) { if (boss->swork[10 + boss->dmgPart] > 0) { boss->swork[00 + boss->dmgPart] = 20; boss->swork[10 + boss->dmgPart] -= boss->damage; - sfxPos.x = (boss->vwork[1 + boss->dmgPart].x * 1.3f) + boss->obj.pos.x; - sfxPos.y = (boss->vwork[1 + boss->dmgPart].y * 1.3f) + boss->obj.pos.y; - sfxPos.z = (boss->vwork[1 + boss->dmgPart].z * 1.3f) + boss->obj.pos.z; - func_8007A6F0(&sfxPos, 0x29034003); + sfxSource.x = (boss->vwork[1 + boss->dmgPart].x * 1.3f) + boss->obj.pos.x; + sfxSource.y = (boss->vwork[1 + boss->dmgPart].y * 1.3f) + boss->obj.pos.y; + sfxSource.z = (boss->vwork[1 + boss->dmgPart].z * 1.3f) + boss->obj.pos.z; + func_8007A6F0(&sfxSource, 0x29034003); if (boss->swork[10 + boss->dmgPart] <= 0) { boss->swork[10 + boss->dmgPart] = 0; func_i4_80193CE4(boss, boss->dmgPart); @@ -523,12 +523,12 @@ void func_i4_80193EF0(Boss* boss) { func_800794CC(boss->obj.pos.x + dest.x, boss->obj.pos.y - 1200.0f + y, boss->obj.pos.z + dest.z, 1.6f); } - Audio_PlaySfx(0x2940D09AU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09AU, boss->sfxSource, 4U); D_Timer_80161A60 = 8; boss->state = 20; boss->timer_050 = 50; - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); Radio_PlayMessage(gMsg_ID_18066, RCID_BILL); boss->obj.pos.y -= 1000.0f; func_80042EC0(boss); @@ -597,7 +597,7 @@ void func_i4_80194458(Boss* boss, Vec3f* pos, f32 arg2) { actor->timer_0C2 = 30; actor->timer_0C4 = 400; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x2903305FU, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903305FU, actor->sfxSource, 4); actor->info.action = (ObjectFunc) func_i4_80198AA0; actor->info.draw = (ObjectFunc) func_i4_801995B4; break; @@ -665,7 +665,7 @@ void func_i4_801946C4(Boss* boss) { boss->state = 1; boss->vwork[0].y = 2000.0f; boss->unk_05E = 1; - Audio_PlaySfx(0x11000011U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11000011U, boss->sfxSource, 0); D_i4_801A0548 = 100.0f; D_i4_801A0544 = 100.0f; D_i4_801A0550 = 70.0f; @@ -675,7 +675,7 @@ void func_i4_801946C4(Boss* boss) { boss->fwork[12] = 0.4f; boss->fwork[10] = 10.0f; Radio_PlayMessage(gMsg_ID_18030, RCID_BILL); - Audio_PlaySfx(0x11037025U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11037025U, boss->sfxSource, 0); } } break; @@ -701,8 +701,8 @@ void func_i4_801946C4(Boss* boss) { for (i = 1; i < 4; i++) { gSavedTeamShields[i] = gTeamShields[i]; } - func_800182F4(0x100A00FF); - func_800182F4(0x110A00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 10); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 10); } } break; @@ -735,14 +735,14 @@ void func_i4_801946C4(Boss* boss) { gLight1R = 50; gLight1G = 35; gLight1B = 25; - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); boss->timer_050 = 80; boss->fwork[12] = 0.0f; boss->obj.rot.y = 217.0f; for (i = 10; i < ARRAY_COUNT(gActors); i++) { if (gActors[i].unk_0B6 == 0) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } } @@ -752,7 +752,7 @@ void func_i4_801946C4(Boss* boss) { if (boss->timer_050 == 0) { boss->state++; boss->timer_050 = 60; - Audio_PlaySfx(0x1903203FU, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1903203FU, boss->sfxSource, 0); boss->fwork[5] = 30.0f; boss->fwork[6] = 30.0f; boss->fwork[7] = 30.0f; @@ -765,13 +765,13 @@ void func_i4_801946C4(Boss* boss) { boss->state++; boss->timer_050 = 100; boss->timer_052 = 310; - Audio_PlaySfx(0x19034042U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19034042U, boss->sfxSource, 0); } break; case 5: if (boss->timer_050 == 1) { - func_8001D444(0, 32797, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_29 | 0x8000); } if ((boss->timer_050 == 0) && !(boss->timer_052 & 15)) { @@ -779,7 +779,7 @@ void func_i4_801946C4(Boss* boss) { } if (boss->timer_052 == 0) { - Audio_PlaySfx(0x19032040U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19032040U, boss->sfxSource, 0); boss->state++; if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_0) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_3; @@ -804,7 +804,7 @@ void func_i4_801946C4(Boss* boss) { case 6: if (boss->timer_052 == 1) { - Audio_PlaySfx(0x19034042U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19034042U, boss->sfxSource, 0); } if (boss->timer_050 == 0) { @@ -816,7 +816,7 @@ void func_i4_801946C4(Boss* boss) { if ((en_count < 30) || (boss->timer_056 == 0)) { boss->state = 7; boss->timer_050 = 300; - Audio_PlaySfx(0x1903203FU, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1903203FU, boss->sfxSource, 0); boss->fwork[12] = 0.0f; boss->fwork[8] = 30.0f; boss->fwork[7] = 30.0f; @@ -833,7 +833,7 @@ void func_i4_801946C4(Boss* boss) { } if (boss->timer_050 == 240) { - Audio_PlaySfx(0x19034042U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19034042U, boss->sfxSource, 0); } if (boss->timer_050 == 0) { @@ -844,15 +844,15 @@ void func_i4_801946C4(Boss* boss) { boss->fwork[5] = 0.0f; boss->timer_056 = 1920; boss->timer_052 = 70; - Audio_PlaySfx(0x19032040U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19032040U, boss->sfxSource, 0); } break; case 10: if (boss->timer_050 == 0) { boss->fwork[9] = 200.0f; - Audio_PlaySfx(0x19032041U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_8001A55C(boss->sfxPos, 0x11037025U); + AUDIO_PLAY_SFX(0x19032041U, boss->sfxSource, 0); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x11037025U); boss->state = 11; boss->timer_050 = 100; Radio_PlayMessage(gMsg_ID_18050, RCID_BILL); @@ -866,11 +866,11 @@ void func_i4_801946C4(Boss* boss) { case 11: if (boss->timer_050 == 0) { - Audio_PlaySfx(0x19034042U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19034042U, boss->sfxSource, 0); boss->state = 12; boss->timer_050 = 1928; Radio_PlayMessage(gMsg_ID_18055, RCID_BILL); - Audio_PlaySfx(0x11034043U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11034043U, boss->sfxSource, 0); } break; @@ -894,8 +894,8 @@ void func_i4_801946C4(Boss* boss) { boss->fwork[12] = 0.0f; boss->fwork[10] = 0.0f; - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); gPlayer[0].state_1C8 = PLAYERSTATE_1C8_0; gPlayer[0].unk_034 = 0.0f; gPlayer[0].camEye.x = boss->obj.pos.x; @@ -950,8 +950,8 @@ void func_i4_801946C4(Boss* boss) { D_i4_801A054C = 70.0f; D_i4_801A0558 = 50.0f; D_i4_801A0554 = 50.0f; - func_8001A55C(boss->sfxPos, 0x11034043U); - Audio_PlaySfx(0x19406044U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x11034043U); + AUDIO_PLAY_SFX(0x19406044U, boss->sfxSource, 0); } break; @@ -996,16 +996,16 @@ void func_i4_801946C4(Boss* boss) { if ((boss->timer_052 == 700) || (boss->timer_052 == 697)) { i = gGameFrameCount & 63; - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); func_8007B344(boss->obj.pos.x, boss->obj.pos.y - 600.0f, boss->obj.pos.z, 90.0f, 0); - Audio_PlaySfx(0x1140B045U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1140B045U, boss->sfxSource, 0); } if (boss->timer_052 == 690) { boss->state = 17; for (i = 0; i < ARRAY_COUNT(gEffects); i++) { if (gEffects[i].obj.id == OBJ_EFFECT_358) { - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); } } gPlayer[0].camEye.x = boss->obj.pos.x; @@ -1031,7 +1031,7 @@ void func_i4_801946C4(Boss* boss) { gBosses[0].state = 1; boss->state = 18; boss->timer_050 = 50; - Audio_PlaySfx(0x11038046U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11038046U, boss->sfxSource, 0); } break; @@ -1049,7 +1049,7 @@ void func_i4_801946C4(Boss* boss) { gPlayer[0].unk_234 = 1; gCsFrameCount = 200; func_8001CA24(0); - Audio_KillSfx(&gPlayer[0].sfxPos[0]); + Audio_KillSfxBySource(&gPlayer[0].sfxSource[0]); gPlayer[0].timer_1F8 = 50; gPlayer[0].unk_0D0 = 0.0f; gPlayer[0].unk_114 = 0.0f; @@ -1081,9 +1081,9 @@ void func_i4_801946C4(Boss* boss) { boss->obj.rot.y = 30.0f; boss->obj.pos.x = -4000.0f; boss->unk_078.z = 7.0f; - Audio_PlaySfx(0x11404016U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11404016U, boss->sfxSource, 0); for (i = 0; i < ARRAY_COUNT(gEffects); i++) { - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); } } break; @@ -1093,7 +1093,7 @@ void func_i4_801946C4(Boss* boss) { Matrix_RotateX(gCalcMatrix, boss->obj.rot.x * M_DTOR, 1); boss->obj.pos.z += boss->unk_078.z; if (boss->timer_050 == 820) { - Audio_PlaySfx(0x19408047U, boss->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19408047U, boss->sfxSource, 0); } if (boss->timer_050 >= 821) { @@ -1343,7 +1343,7 @@ void func_i4_80196E30(Actor* actor, s32 idx) { Object_SetInfo(&actor->info, actor->obj.id); actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } void func_i4_80196F40(Actor* actor, s32 idx) { @@ -1361,7 +1361,7 @@ void func_i4_80196F40(Actor* actor, s32 idx) { Object_SetInfo(&actor->info, actor->obj.id); actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } void func_i4_80197024(void) { @@ -1395,7 +1395,7 @@ void func_i4_80197024(void) { } Object_SetInfo(&actor->info, actor->obj.id); actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4); } } } @@ -1415,7 +1415,7 @@ void func_i4_80197290(Player* player) { D_80177A48[0] = 1.0f; switch (player->unk_1D0) { case 0: - func_8001A38C(1, &player->sfxPos[0]); + Audio_StopSfxByBankAndSource(1, &player->sfxSource[0]); gCsFrameCount = 0; player->unk_234 = 1; player->pos.x = boss->obj.pos.x; @@ -1432,7 +1432,7 @@ void func_i4_80197290(Player* player) { gCsCamAtZ = boss->obj.pos.z; for (i = 10; i < 60; i++) { if (gActors[i].unk_0B6 == 0) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } player->unk_1D0 += 1; @@ -1486,7 +1486,7 @@ void func_i4_80197290(Player* player) { player->unk_1D0 = 2; func_800A6148(); func_8001CA24(0); - Audio_KillSfx(&player->sfxPos[0]); + Audio_KillSfxBySource(&player->sfxSource[0]); player->timer_1F8 = 50; player->unk_0D0 = 0.0f; player->unk_0E4 = 0.0f; @@ -1504,9 +1504,9 @@ void func_i4_80197290(Player* player) { player->unk_1D0 = 3; func_8001C8B8(0); if (D_80177930 != 0) { - func_8001D444(0, 38, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_38); } else { - func_8001D444(0, 49, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_49); } D_80177A98 = 0; D_80177A48[1] = 0.0f; @@ -1546,7 +1546,7 @@ void func_i4_80197290(Player* player) { } if (gCsFrameCount == 1050) { - func_8001DBD0(50); + Audio_FadeOutAll(50); } if (gCsFrameCount >= 1101) { @@ -1574,7 +1574,7 @@ void func_i4_80197290(Player* player) { break; case 1010: - Audio_PlaySfx(0x09000002U, &player->sfxPos[0], 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, &player->sfxSource[0], 0); player->unk_190 = player->unk_194 = 5.0f; break; @@ -1688,7 +1688,7 @@ void func_i4_80197F10(Actor* actor) { case 2: actor->state = 3; - Audio_PlaySfx(0x09000002U, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor->sfxSource, 0); actor->fwork[29] = 5.0f; case 3: @@ -1770,7 +1770,7 @@ void func_i4_801981F8(Actor* actor) { if (actor_it->unk_0B6 == 1) { actor_it->info.unk_1C = 0.0f; actor_it->info.bonus = 0; - Audio_PlaySfx(0x3100000C, actor_it->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor_it->sfxSource, 4); } actor_it->info.action = (ObjectFunc) func_i4_80198AA0; actor_it->info.draw = (ObjectFunc) func_i4_801995B4; @@ -1801,7 +1801,7 @@ void func_i4_8019848C(void) { Object_SetInfo(&actor->info, actor->obj.id); actor->info.unk_1C = 0.0f; actor->info.bonus = 0; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4); } void func_i4_80198594(Actor* actor) { @@ -1820,11 +1820,11 @@ void func_i4_80198594(Actor* actor) { gBosses[1].obj.pos.x = 0.0f; gBosses[1].obj.pos.z = 0.0f; gBosses[1].obj.pos.y = 2000.0f; - Audio_PlaySfx(0x11037025U, gBosses[1].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11037025U, gBosses[1].sfxSource, 0); D_8015F928 = 20000; gBosses[1].swork[16] = 5760; D_8015F920 = 1; - func_8001D444(0, 32797, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_29 | 0x8000); } func_i4_8019848C(); diff --git a/src/overlays/ovl_i4/fox_sz.c b/src/overlays/ovl_i4/fox_sz.c index 6981d3bb..abf71e8d 100644 --- a/src/overlays/ovl_i4/fox_sz.c +++ b/src/overlays/ovl_i4/fox_sz.c @@ -26,7 +26,7 @@ void func_i4_80199900(Actor* actor, s32 arg1) { D_Timer_80161A60 = 8; - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x2903A060); for (i = 0; i < 20; i++) { @@ -46,10 +46,10 @@ void func_i4_80199900(Actor* actor, s32 arg1) { gPlayer[0].unk_1D0 = 1000; gActors[0].state = 6; gPlayer[0].timer_1F8 = 30; - Audio_PlaySfx(0x11030010U, gActors[0].sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31024059U, gActors[0].sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + AUDIO_PLAY_SFX(0x11030010U, gActors[0].sfxSource, 0U); + AUDIO_PLAY_SFX(0x31024059U, gActors[0].sfxSource, 0U); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); } if ((D_i4_801A0560 == 3) && (D_800D3180[LEVEL_ZONESS] != 0)) { @@ -191,7 +191,7 @@ void func_i4_80199FCC(Actor* actor, s32 arg1) { actor->fwork[1] = 25.0f; actor->fwork[29] = 2.0f; - Audio_PlaySfx(0x3103A061U, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3103A061U, actor->sfxSource, 4U); } void func_i4_8019A0F8(Actor* actor, s32 arg1) { @@ -238,7 +238,7 @@ void func_i4_8019A1D0(void) { actor->info.unk_1C = 0.0f; - Audio_PlaySfx(0x31000011U, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000011U, actor->sfxSource, 4U); } void func_i4_8019A2F4(Actor* actor) { @@ -249,7 +249,7 @@ void func_i4_8019A2F4(Actor* actor) { actor->state = 3; gPlayer[0].state_1C8 = PLAYERSTATE_1C8_0; - func_8001D4AC(0x36U, 0x14U, 0xAU, 0xAU); + Audio_PlayFanfare(SEQ_ID_54, 20, 10, 10); func_8002EE34(); gPlayer[0].camEye.x = 250.0f; @@ -377,7 +377,7 @@ void func_i4_8019A3E8(Actor* actor) { actorPtr->unk_044 = 2; actorPtr->timer_0C2 = 30; Object_SetInfo(&actorPtr->info, actorPtr->obj.id); - Audio_PlaySfx(0x31000011U, actorPtr->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000011U, actorPtr->sfxSource, 4U); actor->unk_04E++; break; } @@ -434,7 +434,7 @@ void func_i4_8019A3E8(Actor* actor) { actor->timer_0BC = 10000; D_80178340 = D_80178358 = 255; D_80178348 = D_80178350 = D_80178354 = 0; - func_8001D444(0U, 0x801FU, 0U, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_31 | 0x8000); break; } @@ -571,7 +571,7 @@ void func_i4_8019AB8C(Actor* actor) { D_80178340 = D_80178358 = 0; switch (actor->timer_0BC) { case 9800: - Audio_PlaySfx(0x09000002U, gActors[10].sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, gActors[10].sfxSource, 0U); gActors[10].fwork[29] = 12.0f; break; @@ -679,7 +679,7 @@ void func_i4_8019B568(void) { actor->unk_0B6 = 1; actor->vel.x = -20.0f; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x11030010U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010U, actor->sfxSource, 0U); } Vec3f D_i4_8019F57C[] = { { 150.0f, 150.0f, 50.0f }, { -150.0f, -150.0f, 50.0f }, { -150.0f, 150.0f, 50.0f }, { 150.0f, -150.0f, 50.0f } @@ -706,7 +706,7 @@ void func_i4_8019B630(Actor* actor, s32 index) { actor->unk_0B6 = 26; actor->iwork[11] = 1; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x31000011U, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000011U, actor->sfxSource, 4U); } Vec3f D_i4_8019F5BC[] = { @@ -729,8 +729,8 @@ void func_i4_8019B75C(Actor* actor, s32 arg1) { Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x09000002U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); + AUDIO_PLAY_SFX(0x09000002U, actor->sfxSource, 0U); actor->fwork[29] = 5.0f; } @@ -759,7 +759,7 @@ void func_i4_8019B888(void) { actor->unk_0F4.y = 270.0f; actor->health = 255; actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_800CC01C); actor->info.unk_16 = 0; actor->info.unk_1C = 0.0f; @@ -859,14 +859,14 @@ void func_i4_8019BA64(Player* player) { D_80178340 = 255; for (i = 0; i < 4; i++) { - Object_Kill(&gActors[i + 30].obj, gActors[i + 30].sfxPos); + Object_Kill(&gActors[i + 30].obj, gActors[i + 30].sfxSource); } player->pos.x = actor->obj.pos.x + 200.0f; player->pos.y = actor->obj.pos.y - 480.0f; player->pos.z = actor->obj.pos.z; - func_8001D444(0U, 0x33U, 0U, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_51); } break; @@ -913,17 +913,17 @@ void func_i4_8019BA64(Player* player) { if (gCsFrameCount == 800) { for (i = 0; i < ARRAY_COUNT(gActors); i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } func_i4_8019EA68(); func_i4_8019B888(); } if (gCsFrameCount == 0x334) { - func_8001A838(0x49000014U); + Audio_KillSfxById(0x49000014U); player->state_1C8 = PLAYERSTATE_1C8_3; player->unk_01C = player->unk_018 = player->unk_014 = 0.f; - func_8001D444(0U, D_80177C90, 0U, 0xFFU); + AUDIO_PLAY_BGM(D_80177C90); D_80177838 = 0x32; } break; @@ -931,7 +931,7 @@ void func_i4_8019BA64(Player* player) { switch (gCsFrameCount) { case 20: - Audio_PlaySfx(0x49000014U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000014U, gDefaultSfxSource, 4U); break; case 330: @@ -985,7 +985,7 @@ void func_i4_8019BA64(Player* player) { player->unk_114 = 90.0f; player->unk_0D0 = D_80161A54; player->unk_234 = 1; - Audio_PlaySfx(0x09000002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0U); break; } @@ -1045,13 +1045,13 @@ void func_i4_8019C574(Actor* actor, s32 index) { if (index < 3) { actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } else { actor->unk_0B6 = 1; actor->fwork[0] = 20.0f; - Audio_PlaySfx(0x11030010U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31024059U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010U, actor->sfxSource, 0U); + AUDIO_PLAY_SFX(0x31024059U, actor->sfxSource, 0U); } } @@ -1081,7 +1081,7 @@ void func_i4_8019C70C(void) { actor->timer_0BC = 130; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } void func_i4_8019C85C(Player* player) { @@ -1109,7 +1109,7 @@ void func_i4_8019C85C(Player* player) { if (player->timer_1F8 == 0) { player->unk_1D0 = 1001; player->timer_1F8 = 100; - Audio_PlaySfx(0x09000002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0U); player->unk_194 = 5.0f; player->unk_190 = 5.0f; D_80161A44 = 30000.0f; @@ -1177,9 +1177,9 @@ void func_i4_8019C85C(Player* player) { D_80178340 = D_80178358; for (i = 0; i < ARRAY_COUNT(gActors); i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } - Audio_PlaySfx(0x31024059U, boss0->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31024059U, boss0->sfxSource, 0U); break; case 1: @@ -1195,7 +1195,7 @@ void func_i4_8019C85C(Player* player) { Math_SmoothStepToF(&boss0->fwork[3], 0.7f, 1.0f, 0.7f, 0.0f); if ((gCsFrameCount == 100) && (D_80177B8C != 0)) { - func_8001D444(0U, 0x26U, 0U, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_38); } if ((gCsFrameCount == 210) && (D_80177B8C != 0)) { @@ -1222,8 +1222,8 @@ void func_i4_8019C85C(Player* player) { if (player->timer_1F8 == 0) { if (D_80177B8C == 0) { - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); } gCsFrameCount = 1280; @@ -1232,7 +1232,7 @@ void func_i4_8019C85C(Player* player) { player->timer_1F8 = 1000; func_8001CA24(0U); - Audio_KillSfx(player->sfxPos); + Audio_KillSfxBySource(player->sfxSource); func_800A6148(); player->pos.x = 0.0f; @@ -1333,7 +1333,7 @@ void func_i4_8019C85C(Player* player) { gCsCamAtZ = actor0->obj.pos.z + 2430.0f - 250.0f; if (gCsFrameCount == 2660) { - func_8001DBD0(50); + Audio_FadeOutAll(50); } if (gCsFrameCount > 2710) { @@ -1478,7 +1478,7 @@ void func_i4_8019C85C(Player* player) { if (D_80177B8C != 0) { D_80177930 = 1; } else { - func_8001D444(0U, 0x31U, 0U, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_49); D_80177930 = 0; } break; @@ -1506,7 +1506,7 @@ void func_i4_8019C85C(Player* player) { break; case 2510: - Audio_PlaySfx(0x09000002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0U); player->unk_190 = player->unk_194 = 5.0f; break; @@ -1570,7 +1570,7 @@ void func_i4_8019DD20(Actor* actor) { switch (actor->state) { case 1: actor->state = 2; - Audio_PlaySfx(0x09000002U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor->sfxSource, 0U); actor->fwork[29] = 5.0f; case 2: @@ -1612,7 +1612,7 @@ void func_i4_8019DD20(Actor* actor) { break; case 430: - Audio_PlaySfx(0x09000002U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, actor->sfxSource, 0U); actor->fwork[29] = 8.0f; break; @@ -1671,7 +1671,7 @@ void func_i4_8019E234(Actor* actor) { actor->timer_0C6 = 20; actor->unk_0D0 = 0; actor->health -= actor->damage; - Audio_PlaySfx(0x2903300EU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300EU, actor->sfxSource, 4U); if (actor->health <= 0) { func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 0.0f, 0.0f, 0.0f, 5.0f, 10); func_80066254(actor); @@ -1681,7 +1681,7 @@ void func_i4_8019E234(Actor* actor) { for (i = 0; i < 6; i++) { func_800794CC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 1.0f); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007A6F0(&actor->obj.pos, 0x1903400F); } } @@ -1714,7 +1714,7 @@ void func_i4_8019E454(Boss* boss) { boss->timer_050 = 10; boss->timer_052 = 60; boss->state = 1; - Audio_PlaySfx(0x1900404FU, boss->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900404FU, boss->sfxSource, 0U); } if (boss->timer_050 == 1) { @@ -1847,5 +1847,5 @@ void func_i4_8019EA68(void) { boss->obj.id = OBJ_BOSS_313; Object_SetInfo(&boss->info, boss->obj.id); - Audio_PlaySfx(0x11030010U, boss->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010U, boss->sfxSource, 0U); } diff --git a/src/overlays/ovl_i5/fox_ma.c b/src/overlays/ovl_i5/fox_ma.c index 8a909c4f..68e7b57d 100644 --- a/src/overlays/ovl_i5/fox_ma.c +++ b/src/overlays/ovl_i5/fox_ma.c @@ -530,7 +530,7 @@ void func_i5_8019A198(Actor* actor) { } else { func_8001CFA8(actor->vel.z); } - func_8001D10C(actor->sfxPos, 0x31078085); + func_8001D10C(actor->sfxSource, 0x31078085); D_i5_801BE310 = actor->iwork[5]; } D_i5_801BA1E0 = actor->obj.pos.z; @@ -559,7 +559,7 @@ void func_i5_8019A2F4(Actor* actor) { } D_i5_801BE2F0[0] = var_a0; if (D_i5_801BA1E4 != D_i5_801BA1EC[var_a0 - 1].unk_04) { - Audio_PlaySfx(0x1940205E, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940205E, actor->sfxSource, 0); } D_i5_801BA1E4 = D_i5_801BA1EC[var_a0 - 1].unk_04; var_fa1 = D_i5_801BA1EC[var_a0 - 1].unk_08; @@ -640,13 +640,13 @@ void func_i5_8019A728(Actor* actor) { void func_i5_8019A830(Actor* actor) { if ((gPlayer[0].unk_138 - actor->obj.pos.z) < -20000.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } void func_i5_8019A87C(Actor* actor) { if ((gPlayer[0].unk_138 - actor->obj.pos.z) < -2000.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -676,7 +676,7 @@ void func_i5_8019A8C8(Actor* actor, s16 arg1) { RAND_FLOAT(360.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), (s32) (RAND_FLOAT(50.0f) + 70.0f), arg1, RAND_FLOAT(0.8f) + 0.3f); } - Audio_PlaySfx(0x2940C00A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940C00A, actor->sfxSource, 4); } void func_i5_8019AF34(Actor* actor) { @@ -705,7 +705,7 @@ void func_i5_8019AF34(Actor* actor) { RAND_FLOAT(360.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), (s32) (RAND_FLOAT(50.0f) + 70.0f), 1, RAND_FLOAT(0.8f) + 0.3f); } - Audio_PlaySfx(0x2940C00A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940C00A, actor->sfxSource, 4); } void func_i5_8019B580(Actor* actor, s32* arg1) { @@ -813,7 +813,7 @@ bool func_i5_8019C4EC(Actor* actor) { if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; if (actor->unk_0D2 == 1) { - Audio_PlaySfx(0x29034003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, actor->sfxSource, 4); actor->unk_0D0 = 0; actor->iwork[7] = 15; D_i5_801BE320[22] = 0; @@ -821,7 +821,7 @@ bool func_i5_8019C4EC(Actor* actor) { D_i5_801BE320[21] = 2; return true; } - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } return false; @@ -891,7 +891,7 @@ void func_i5_8019C778(Actor* actor) { break; case 1: if (actor->timer_0BC == 1) { - Audio_PlaySfx(0x1900000D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900000D, actor->sfxSource, 4); } if (actor->timer_0BC <= 0) { Math_SmoothStepToF(&actor->fwork[2], -60.0f, 0.4f, 10.0f, 0.01f); @@ -903,7 +903,7 @@ void func_i5_8019C778(Actor* actor) { actor->timer_0BC = 200; D_i5_801BE320[19] = 0; actor->state++; - Audio_PlaySfx(0x1900000E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900000E, actor->sfxSource, 4); } } break; @@ -912,7 +912,7 @@ void func_i5_8019C778(Actor* actor) { if ((actor->timer_0BC <= 0) && (D_i5_801BE320[25] == 1)) { actor->timer_0BC = 60; actor->state++; - Audio_PlaySfx(0x1900000D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900000D, actor->sfxSource, 4); } break; case 3: @@ -925,7 +925,7 @@ void func_i5_8019C778(Actor* actor) { D_i5_801BE320[30] = 0; D_i5_801BE320[25] = 0; } - Audio_PlaySfx(0x1900000E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900000E, actor->sfxSource, 4); } if (actor->timer_0BC <= 0) { D_i5_801BE320[30]++; @@ -935,7 +935,7 @@ void func_i5_8019C778(Actor* actor) { } actor->timer_0BC = 100; actor->state--; - Audio_PlaySfx(0x1900000E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900000E, actor->sfxSource, 4); } if (actor->timer_0BC == 30) { func_i5_8019C5B8(actor); @@ -966,22 +966,22 @@ void func_i5_8019C778(Actor* actor) { D_80178480 = 25; } if (actor->timer_0BC == 100) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_7; gPlayer[0].unk_1D0 = 0; D_80177930 = 0; } actor->state++; - func_8001A55C(gPlayer[0].sfxPos, 0x1100000A); - func_8001A55C(gPlayer[0].sfxPos, 0x01004024); + Audio_KillSfxBySourceAndId(gPlayer[0].sfxSource, 0x1100000A); + Audio_KillSfxBySourceAndId(gPlayer[0].sfxSource, 0x01004024); } break; } if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } if (D_i5_801BE320[4] > 0) { @@ -1008,7 +1008,7 @@ void func_i5_8019C778(Actor* actor) { actor->state = 4; } if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) && (gCsFrameCount > 630)) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -1052,7 +1052,7 @@ void func_i5_8019CE88(Actor* actor) { func_i5_801A015C(actor); Math_SmoothStepToF(&actor->scale, 0.0f, 0.02f, 10.0f, 0.01f); if (actor->timer_0BC <= 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -1189,7 +1189,7 @@ void func_i5_8019D700(Actor* actor) { func_i5_801A015C(actor); Math_SmoothStepToF(&actor->scale, 0.0f, 0.02f, 10.0f, 0.01f); if (actor->timer_0BC <= 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -1204,7 +1204,7 @@ void func_i5_8019D910(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 if (((actor->unk_0D0 != 0) && (arg3 == actor->unk_0D2)) || ((D_i5_801BE2F0[1] - 1 == actor->iwork[5]) && (actor->iwork[5] < D_i5_801BE2F0[3])) || (((D_i5_801BE2F0[1] + 1) == actor->iwork[5]) && (D_i5_801BE2F0[3] < actor->iwork[5]))) { - Audio_PlaySfx(0x29034003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, actor->sfxSource, 4); actor->unk_0D0 = 0; func_8007C120(actor->obj.pos.x + arg4, actor->obj.pos.y + 200.0f, actor->obj.pos.z + arg5, actor->vel.x, actor->vel.y, actor->vel.z, 0.15f, 20); @@ -1217,7 +1217,7 @@ void func_i5_8019D910(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 } } else if ((actor->unk_0D0 != 0) && (actor->unk_0D2 == 0)) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } break; case 1: @@ -1232,7 +1232,7 @@ void func_i5_8019D910(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 RAND_FLOAT_CENTERED(30.0f), (s32) (RAND_FLOAT(50.0f) + 70.0f), 3, (RAND_FLOAT(0.8f) + 0.3f) * 2.0f); } - Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 4); *arg7 = 1; *arg2 = 20; (*arg1)++; @@ -1242,7 +1242,7 @@ void func_i5_8019D910(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 ((D_i5_801BE2F0[1] - 1 == actor->iwork[5]) && (actor->iwork[5] < D_i5_801BE2F0[3])) || (((D_i5_801BE2F0[1] + 1) == actor->iwork[5]) && (D_i5_801BE2F0[3] < actor->iwork[5])) || ((actor->obj.id == OBJ_ACTOR_209) && (arg3 == 2))) { - Audio_PlaySfx(0x29034003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, actor->sfxSource, 4); actor->unk_0D0 = 0; func_8007C120(actor->obj.pos.x + arg4, actor->obj.pos.y + 200.0f, actor->obj.pos.z + arg5, actor->vel.x, actor->vel.y, actor->vel.z, 0.15f, 0x14); @@ -1257,7 +1257,7 @@ void func_i5_8019D910(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 } } else if ((actor->unk_0D0 != 0) && (actor->unk_0D2 == 0)) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } break; case 3: @@ -1273,7 +1273,7 @@ void func_i5_8019D910(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 (s32) (RAND_FLOAT(50.0f) + 70.0f), 2, (RAND_FLOAT(0.8f) + 0.3f) * 1.5f); } } - Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 4); *arg7 = 2; var_v0 = arg3; if (var_v0 == 3) { @@ -1355,7 +1355,7 @@ void func_i5_8019E410(Actor* actor) { func_i5_801A015C(actor); Math_SmoothStepToF(&actor->scale, 0.0f, 0.02f, 10.0f, 0.01f); if (actor->timer_0BC <= 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -1367,7 +1367,7 @@ void func_i5_8019E624(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 if (((actor->unk_0D0 != 0) && (arg3 == actor->unk_0D2)) || ((D_i5_801BE2F0[1] - 1 == actor->iwork[5]) && (actor->iwork[5] < D_i5_801BE2F0[3])) || (((D_i5_801BE2F0[1] + 1) == actor->iwork[5]) && (D_i5_801BE2F0[3] < actor->iwork[5]))) { - Audio_PlaySfx(0x29034003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, actor->sfxSource, 4); actor->unk_0D0 = 0; func_8007C120(actor->obj.pos.x + arg4, actor->obj.pos.y + 200.0f, actor->obj.pos.z + arg5, actor->vel.x, actor->vel.y, actor->vel.z, 0.15f, 10); @@ -1380,7 +1380,7 @@ void func_i5_8019E624(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 } } else if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } func_i5_8019B580(actor, arg2); break; @@ -1394,7 +1394,7 @@ void func_i5_8019E624(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 if (((actor->unk_0D0 != 0) && (arg3 == actor->unk_0D2)) || ((D_i5_801BE2F0[1] - 1 == actor->iwork[5]) && (actor->iwork[5] < D_i5_801BE2F0[3])) || (((D_i5_801BE2F0[1] + 1) == actor->iwork[5]) && (D_i5_801BE2F0[3] < actor->iwork[5]))) { - Audio_PlaySfx(0x29034003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, actor->sfxSource, 4); actor->unk_0D0 = 0; func_8007C120(actor->obj.pos.x + arg4, actor->obj.pos.y + 200.0f, actor->obj.pos.z + arg5, actor->vel.x, actor->vel.y, actor->vel.z, 0.2f, 10); @@ -1409,7 +1409,7 @@ void func_i5_8019E624(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 } else { if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } } break; @@ -1461,7 +1461,7 @@ void func_i5_8019EA60(Actor* actor) { func_i5_801A015C(actor); Math_SmoothStepToF(&actor->scale, 0.0f, 0.02f, 10.0f, 0.01f); if (actor->timer_0BC <= 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -1473,7 +1473,7 @@ void func_i5_8019EBF8(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 if (((actor->unk_0D0 != 0) && (arg3 == actor->unk_0D2)) || ((D_i5_801BE2F0[1] - 1 == actor->iwork[5]) && (actor->iwork[5] < D_i5_801BE2F0[3])) || (((D_i5_801BE2F0[1] + 1) == actor->iwork[5]) && (D_i5_801BE2F0[3] < actor->iwork[5]))) { - Audio_PlaySfx(0x29034003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, actor->sfxSource, 4); actor->unk_0D0 = 0; func_8007C120(actor->obj.pos.x + arg4, actor->obj.pos.y + 200.0f, actor->obj.pos.z + arg5, actor->vel.x, actor->vel.y, actor->vel.z, 0.15f, 10); @@ -1487,7 +1487,7 @@ void func_i5_8019EBF8(Actor* actor, s32* arg1, s32* arg2, s32 arg3, f32 arg4, f3 } } else if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } func_i5_8019B580(actor, arg2); return; @@ -1551,7 +1551,7 @@ void func_i5_8019EE68(Actor* actor) { func_i5_801A015C(actor); Math_SmoothStepToF(&actor->scale, 0.0f, 0.02f, 10.0f, 0.01f); if (actor->timer_0BC <= 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -1632,7 +1632,7 @@ void func_i5_8019F164(Actor* actor) { if (sp44 != 0) { sp60.x -= 60.0f; func_8007EE68(OBJ_EFFECT_378, &sp60, &sp54, &sp48, &D_i5_801BA714, 1.0f); - Audio_PlaySfx(0x2903101B, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903101B, actor->sfxSource, 4); actor->iwork[4]++; } else if ((D_i5_801BE310 == actor->iwork[5]) || ((gPlayer[0].pos.x - actor->obj.pos.x > 300.0f) && @@ -1644,7 +1644,7 @@ void func_i5_8019F164(Actor* actor) { (actor->health != 0)) { sp60.x -= 60.0f; func_8007EE68(OBJ_EFFECT_378, &sp60, &sp54, &sp48, &D_i5_801BA714, 1.0f); - Audio_PlaySfx(0x2903101B, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903101B, actor->sfxSource, 4); actor->iwork[4]++; } } @@ -1667,7 +1667,7 @@ void func_i5_8019F164(Actor* actor) { case 3: if ((actor->timer_0BC == 0) && (actor->health != 0)) { func_8007EE68(OBJ_EFFECT_378, &sp60, &sp54, &sp48, &D_i5_801BA714, 1.0f); - Audio_PlaySfx(0x2903101B, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903101B, actor->sfxSource, 4); actor->iwork[4]++; } break; @@ -1690,7 +1690,7 @@ void func_i5_8019F164(Actor* actor) { if ((actor->timer_0BC == 0) && (actor->health != 0)) { sp60.x += 60.0f; func_8007EE68(OBJ_EFFECT_378, &sp60, &sp54, &sp48, &D_i5_801BA714, 1.0f); - Audio_PlaySfx(0x2903101B, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903101B, actor->sfxSource, 4); actor->iwork[4]++; } break; @@ -1720,7 +1720,7 @@ void func_i5_8019FC54(Actor* actor, s32* arg1, s32* arg2, s32 arg3, s32 arg4, f3 if (((actor->unk_0D0 != 0) && (actor->unk_0D2 >= arg3) && (arg4 >= actor->unk_0D2)) || ((D_i5_801BE2F0[1] - 1 == actor->iwork[5]) && (actor->iwork[5] < D_i5_801BE2F0[3])) || (((D_i5_801BE2F0[1] + 1) == actor->iwork[5]) && (D_i5_801BE2F0[3] < actor->iwork[5]))) { - Audio_PlaySfx(0x29034003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, actor->sfxSource, 4); actor->unk_0D0 = 0; func_8007C120(actor->obj.pos.x + arg5, actor->obj.pos.y + 200.0f, actor->obj.pos.z + arg6, actor->vel.x, actor->vel.y, actor->vel.z, 0.15f, 10); @@ -1737,7 +1737,7 @@ void func_i5_8019FC54(Actor* actor, s32* arg1, s32* arg2, s32 arg3, s32 arg4, f3 } } else if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } func_i5_8019B580(actor, arg2); break; @@ -1799,7 +1799,7 @@ void func_i5_8019FF9C(Actor* actor) { func_i5_801A015C(actor); Math_SmoothStepToF(&actor->scale, 0.0f, 0.02f, 10.0f, 0.01f); if (actor->timer_0BC <= 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -2024,13 +2024,13 @@ void func_i5_801A0BD8(Object_80* obj80) { break; case 1: if (obj80->timer_4C == 1) { - Audio_PlaySfx(0x01004024, gPlayer[0].sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x01004024, gPlayer[0].sfxSource, 0); } if (obj80->timer_4C <= 0) { Math_SmoothStepToF(&obj80->vel.x, 1751.0f, 0.2f, 80.0f, 1.0f); if (obj80->vel.x >= 1750.0) { - Audio_PlaySfx(0x1940807B, obj80->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_8001A55C(gPlayer[0].sfxPos, 0x01004024); + AUDIO_PLAY_SFX(0x1940807B, obj80->sfxSource, 0); + Audio_KillSfxBySourceAndId(gPlayer[0].sfxSource, 0x01004024); obj80->timer_4C = 5; obj80->state = 2; } @@ -2379,14 +2379,14 @@ void func_i5_801A23AC(Object_80* obj80) { case OBJ_80_94: case OBJ_80_97: if ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_7) && ((gPlayer[0].unk_138 - obj80->obj.pos.z) < -2500.0f)) { - Object_Kill(&obj80->obj, obj80->sfxPos); + Object_Kill(&obj80->obj, obj80->sfxSource); } gSPDisplayList(gMasterDisp++, D_6026860); break; case OBJ_80_95: case OBJ_80_98: if ((gPlayer[0].state_1C8 != PLAYERSTATE_1C8_7) && ((gPlayer[0].unk_138 - obj80->obj.pos.z) < -2500.0f)) { - Object_Kill(&obj80->obj, obj80->sfxPos); + Object_Kill(&obj80->obj, obj80->sfxSource); } gSPDisplayList(gMasterDisp++, D_602FBF0); break; @@ -2482,7 +2482,7 @@ void func_i5_801A2A78(Object_80* obj80) { void func_i5_801A2B24(Object_80* obj80) { if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_7) { - Object_Kill(&obj80->obj, obj80->sfxPos); + Object_Kill(&obj80->obj, obj80->sfxSource); } RCP_SetupDL(&gMasterDisp, 0x39); switch (obj80->obj.id) { @@ -2556,7 +2556,7 @@ void func_i5_801A2DD8(Object_80* obj80) { RAND_FLOAT_CENTERED(5.0f), RAND_FLOAT_CENTERED(5.0f), (s32) (RAND_FLOAT(50.0f) + 70.0f), i + 12, 1.0f); } - Object_Kill(&obj80->obj, obj80->sfxPos); + Object_Kill(&obj80->obj, obj80->sfxSource); break; } } @@ -2849,21 +2849,21 @@ void func_i5_801A3E70(Actor* actor) { void func_i5_801A3E98(Actor* actor) { if ((gPlayer[0].unk_138 - actor->obj.pos.z) < -500.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } switch (actor->state) { case 0: if ((actor->unk_0D0 != 0) && (actor->unk_0D0 != 3)) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x1903205F, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1903205F, actor->sfxSource, 0); actor->state = 1; } break; case 1: Math_SmoothStepToF(&actor->fwork[1], -181.0f, 0.6f, 20.0f, 0.0f); if (actor->fwork[1] <= -180.0f) { - Audio_PlaySfx(0x19033008, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19033008, actor->sfxSource, 0); actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_603648C); actor->iwork[0] = 2; actor->state = 2; @@ -2884,16 +2884,16 @@ void func_i5_801A3E98(Actor* actor) { break; } if (actor->unk_0D0 != 0) { - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); actor->unk_0D0 = 0; } Math_SmoothStepToF(actor->fwork, 30.0f, 0.4f, 10.0f, 0.0f); Math_SmoothStepToF(&actor->fwork[4], 30.0f, 0.4f, 10.0f, 0.0f); if (actor->fwork[0] < 31.0f) { if (actor->state >= 3) { - Audio_PlaySfx(0x19020060, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19020060, actor->sfxSource, 0); } else { - Audio_PlaySfx(0x19020061, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19020061, actor->sfxSource, 0); } actor->fwork[0] = 255.0f; actor->fwork[4] = 170.0f; @@ -2957,7 +2957,7 @@ void func_i5_801A4660(Actor* actor) { void func_i5_801A46A0(Actor* actor) { if ((gPlayer[0].unk_138 - actor->obj.pos.z) < -500.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } switch (actor->state) { @@ -2967,7 +2967,7 @@ void func_i5_801A46A0(Actor* actor) { Math_SmoothStepToF(&actor->gravity, 5.0f, 0.08f, 1.0f, 0.0f); if (actor->obj.pos.y < 80.0f) { if (actor->unk_046 != 0) { - Audio_PlaySfx(0x19030006, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19030006, actor->sfxSource, 0); actor->obj.pos.y = 80.0f; if (actor->vel.y < 0) { actor->vel.y = -actor->vel.y * (actor->unk_046 * 0.07f); @@ -3011,14 +3011,14 @@ void func_i5_801A46A0(Actor* actor) { break; case 2: func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; } } void func_i5_801A49B8(Actor* actor) { if (actor->unk_0D0 != 0) { - Audio_PlaySfx(0x29024003, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29024003, actor->sfxSource, 0); actor->timer_0C6 = 15; actor->health -= actor->damage; if (actor->health <= 0) { @@ -3058,7 +3058,7 @@ void func_i5_801A4B24(Actor* actor) { if (D_i5_801BE2F0[5] == 0) { Radio_PlayMessage(gMsg_ID_17170, RCID_PEPPY); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } switch (actor->state) { @@ -3118,13 +3118,13 @@ void func_i5_801A4B24(Actor* actor) { D_80177930 = 1; actor->timer_0BC = 5; actor->state = 6; - func_8001A55C(gPlayer[0].sfxPos, 0x1100000A); - func_8001A55C(gPlayer[0].sfxPos, 0x01004024); + Audio_KillSfxBySourceAndId(gPlayer[0].sfxSource, 0x1100000A); + Audio_KillSfxBySourceAndId(gPlayer[0].sfxSource, 0x01004024); } break; case 6: if (actor->timer_0BC == 1) { - Audio_PlaySfx(0x1940405D, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940405D, actor->sfxSource, 0); } if (actor->timer_0BC == 0) { Math_SmoothStepToF(&actor->fwork[7], -41.0f, 0.2f, 5.0f, 0.01f); @@ -3143,7 +3143,7 @@ void func_i5_801A4B24(Actor* actor) { } if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } Math_SmoothStepToF(actor->fwork, 30, 0.4f, actor->fwork[1], 0.0f); Math_SmoothStepToF(&actor->fwork[4], 30, 0.4f, actor->fwork[1], 0.0f); @@ -3242,7 +3242,7 @@ void func_i5_801A57D0(Effect* effect) { Vec3f sp38; if ((gPlayer[0].unk_138 - effect->obj.pos.z) < -2000.0f) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.x = 0.0f; effect->obj.rot.y = 0.0f; @@ -3263,7 +3263,7 @@ void func_i5_801A57D0(Effect* effect) { effect->vel.x = sp44.x; effect->vel.y = sp44.y; effect->vel.z = sp44.z; - Audio_PlaySfx(0x09007011, effect->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09007011, effect->sfxSource, 4); } if ((gPlayer[0].unk_280 == 0) && (gPlayer[0].timer_498 == 0)) { Player_ApplyDamage(&gPlayer[0], 0, effect->info.damage); @@ -3271,13 +3271,13 @@ void func_i5_801A57D0(Effect* effect) { if (effect->vel.x < 0.0f) { gPlayer[0].unk_0D8.x *= -1.0f; } - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } if (effect->obj.pos.y < gGroundLevel) { func_i5_801ADCEC(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 999.9f, -10.0f, 5.0f); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); if (D_80161A88 != 2) { effect->obj.pos.y = gGroundLevel; } @@ -3287,7 +3287,7 @@ void func_i5_801A57D0(Effect* effect) { sp38.z = effect->vel.z; if (func_i5_801A55D4(1000, &effect->obj.pos, &sp38, 0) != 0) { func_i5_801ADCEC(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 999.9f, -10.0f, 5.0f); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -3299,7 +3299,7 @@ void func_i5_801A5AF0(Effect* effect) { void func_i5_801A5B4C(Effect* effect) { if ((gPlayer[0].unk_138 - effect->obj.pos.z) < -2000.0f) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } effect->obj.rot.x = 20.0f; if (effect->scale2 < 10.0f) { @@ -3320,10 +3320,10 @@ void func_i5_801A5B4C(Effect* effect) { if (effect->vel.y < 0.0f) { gPlayer[0].unk_0D8.y *= -1.0f; } - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } if (effect->obj.pos.y < (gGroundLevel - 100.0f)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } if (effect->unk_44 < 235) { @@ -3349,18 +3349,18 @@ void func_i5_801A5E2C(Actor* actor) { void func_i5_801A5E54(Actor* actor) { if ((gPlayer[0].unk_138 - actor->obj.pos.z) < -500.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } if ((D_i5_801BA1E0 - actor->obj.pos.z) < -800.0f) { if (actor->iwork[0] == 0) { - Audio_PlaySfx(0x11001063, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11001063, actor->sfxSource, 0); actor->iwork[0]++; } Math_SmoothStepToF(&actor->obj.pos.x, actor->fwork[0] + (actor->fwork[2] * 400.0f), 0.1f, 4.0f, 0.01f); } if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } } @@ -3373,18 +3373,18 @@ void func_i5_801A5FC4(s32 arg0) { void func_i5_801A5FD0(Actor* actor) { if (gPlayer[0].unk_138 - actor->obj.pos.z < -500.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } if (gPlayer[0].unk_138 - actor->obj.pos.z < actor->fwork[2]) { if (actor->iwork[0] == 0) { - Audio_PlaySfx(0x19001062, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19001062, actor->sfxSource, 0); actor->iwork[0] += 1; } Math_SmoothStepToF(&actor->obj.pos.y, actor->fwork[1] + 356.0f, 0.4f, 20.0f, 0.01f); } if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } } @@ -3400,7 +3400,7 @@ void func_i5_801A6144(Actor* actor) { s16 i; if ((gPlayer[0].unk_138 - actor->obj.pos.z) < -500.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } switch (actor->state) { @@ -3408,14 +3408,14 @@ void func_i5_801A6144(Actor* actor) { if (actor->unk_0D0 != 0) { func_8007C120(actor->obj.pos.x, actor->obj.pos.y + 100.0f, actor->obj.pos.z, actor->vel.x, actor->vel.y, actor->vel.z, 0.15f, 20); - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); actor->health -= actor->damage; actor->timer_0C6 = 15; if ((gPlayer[0].unk_138 - 20.0f) < actor->obj.pos.z) { actor->health = 0; } if (actor->health <= 0) { - Audio_PlaySfx(0x2903B009, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 0); func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y + 100.0f, actor->obj.pos.z, 0.0f, 0.0f, 0.0f, 14.0f, 5); for (i = 0; i < 20; i++) { @@ -3435,7 +3435,7 @@ void func_i5_801A6144(Actor* actor) { case 1: Math_SmoothStepToF(&actor->obj.rot.x, -90.0f, 0.5f, 5.0f, 0.01f); if (actor->timer_0BC == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -3479,7 +3479,7 @@ void func_i5_801A67BC(s32 arg0) { void func_i5_801A67C8(Actor* actor) { if ((gPlayer[0].unk_138 - actor->obj.pos.z) < -300.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } if ((actor->unk_0D0 != 0) && (actor->unk_0D2 == -1)) { actor->unk_0D0 = 0; @@ -3491,7 +3491,7 @@ void func_i5_801A67C8(Actor* actor) { func_i5_8019D670(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, (RAND_FLOAT(2.0f) + 20.0f) * actor->iwork[4], 0.0f, actor->iwork[4] * -34.0f, 0.0f, 2, 3); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -3885,7 +3885,7 @@ void func_i5_801A7E7C(Actor* actor) { func_i5_8019A830(actor); func_i5_8019A728(actor); if (actor->iwork[1] != 0) { - func_8001D444(0, 0x8020, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_32 | 0x8000); actor->state = 1; } func_i5_801A6984(actor); @@ -3989,8 +3989,7 @@ void func_i5_801A7E7C(Actor* actor) { D_i5_801BE320[2] = 5; D_i5_801BE320[31] = 30; actor->timer_0BC = 100; - Audio_PlaySfx(0x19022067, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19022067, actor->sfxSource, 4); actor->state = 12; } } else if ((D_i5_801BE320[26] != 0) && (D_i5_801BE320[10] > 0)) { @@ -4060,7 +4059,7 @@ void func_i5_801A7E7C(Actor* actor) { D_i5_801BE320[3] = (s16) (D_i5_801BE320[3] + 1); if ((D_i5_801BE320[3] == 26) && (D_i5_801BE320[10] > 0)) { actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6036818); - Audio_PlaySfx(0x2902405E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902405E, actor->sfxSource, 4); } } else { actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_800CBF34); @@ -4108,7 +4107,7 @@ void func_i5_801A7E7C(Actor* actor) { case 8: func_i5_8019A198(actor); if (!(gGameFrameCount & 0xF)) { - Audio_PlaySfx(0x29036099, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29036099, actor->sfxSource, 4); } func_i5_801A74C4(actor); func_i5_801A6984(actor); @@ -4136,10 +4135,10 @@ void func_i5_801A7E7C(Actor* actor) { actor->iwork[9] = 15; D_i5_801BE320[29] -= actor->damage; if (D_i5_801BE320[29] <= 0) { - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); D_80178348 = D_80178350 = D_80178354 = D_80178340 = 255; - Audio_PlaySfx(0x2940D09A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09A, actor->sfxSource, 4); Radio_PlayMessage(gMsg_ID_17450, RCID_BOSS_MACBETH); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); func_i5_801AD624(actor->vwork[2].x, actor->vwork[2].y, actor->vwork[2].z, @@ -4157,9 +4156,9 @@ void func_i5_801A7E7C(Actor* actor) { D_i5_801BE368[13] = 30.0f; if (D_i5_801BE320[29] > 0) { if (D_i5_801BE320[29] > 100) { - Audio_PlaySfx(0x29034003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x2943500F, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2943500F, actor->sfxSource, 4); } } } @@ -4224,7 +4223,7 @@ void func_i5_801A7E7C(Actor* actor) { } break; case 10: - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; case 11: Math_SmoothStepToAngle(&actor->obj.rot.y, 0.0f, 0.1f, 20.0f, 0.01f); @@ -4308,7 +4307,7 @@ void func_i5_801A7E7C(Actor* actor) { func_i5_801A72DC(actor); func_i5_801A6984(actor); if (D_i5_801BE320[9] <= 0) { - func_8001A55C(actor->sfxPos, 0x19022067); + Audio_KillSfxBySourceAndId(actor->sfxSource, 0x19022067); actor->state = 14; actor->vel.y = -20.0f; } @@ -4328,7 +4327,7 @@ void func_i5_801A7E7C(Actor* actor) { } } if (actor->timer_0BC == 0) { - func_8001A55C(actor->sfxPos, 0x19022067); + Audio_KillSfxBySourceAndId(actor->sfxSource, 0x19022067); D_i5_801BE320[3] = 0; D_i5_801BE320[2] = 6; D_i5_801BE320[31] = 30; @@ -4350,7 +4349,7 @@ void func_i5_801A7E7C(Actor* actor) { D_i5_801BE320[5] = 0; D_i5_801BE320[7] = 0; if (actor->timer_0BC == 60) { - Audio_PlaySfx(0x19023068, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19023068, actor->sfxSource, 4); D_i5_801BE320[24] = 0; spC6 = RAND_INT(5.0f); @@ -4407,7 +4406,7 @@ void func_i5_801A7E7C(Actor* actor) { func_i5_801A6984(actor); if (actor->timer_0BC < 100) { if (actor->timer_0BC == 98) { - Audio_PlaySfx(0x19022069, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19022069, actor->sfxSource, 4); } Matrix_RotateY(gCalcMatrix, RAND_FLOAT(2.0f) * (M_DTOR * 180.0f), 0); sp360.x = 0.0f; @@ -4439,7 +4438,7 @@ void func_i5_801A7E7C(Actor* actor) { } actor->timer_0BC = D_i5_801BE320[27]; actor->state = 16; - func_8001A55C(actor->sfxPos, 0x19022069); + Audio_KillSfxBySourceAndId(actor->sfxSource, 0x19022069); } break; case 16: @@ -4456,11 +4455,11 @@ void func_i5_801A7E7C(Actor* actor) { if (actor->timer_0BC < (D_i5_801BE320[27] - 40)) { if ((actor->timer_0BC + 42) == D_i5_801BE320[27]) { - actor->sfxPos[0] = actor->vwork[2].x; - Audio_PlaySfx(0x19006035, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - actor->sfxPos[0] = actor->vwork[4].x; - Audio_PlaySfx(0x19006035, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - actor->sfxPos[0] = actor->obj.pos.x; + actor->sfxSource[0] = actor->vwork[2].x; + AUDIO_PLAY_SFX(0x19006035, actor->sfxSource, 4); + actor->sfxSource[0] = actor->vwork[4].x; + AUDIO_PLAY_SFX(0x19006035, actor->sfxSource, 4); + actor->sfxSource[0] = actor->obj.pos.x; } if (!(gGameFrameCount & 1) && (D_i5_801BE320[15] == 0)) { actor->vwork[6].x = actor->vwork[2].x + 80.0f; @@ -4525,7 +4524,7 @@ void func_i5_801A7E7C(Actor* actor) { func_i5_801A78B0(actor); } if (actor->timer_0BC == 0) { - func_8001A55C(actor->sfxPos, 0x19006035); + Audio_KillSfxBySourceAndId(actor->sfxSource, 0x19006035); actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_603677C); D_i5_801BE320[3] = 0; D_i5_801BE320[2] = 1; @@ -4597,12 +4596,12 @@ void func_i5_801A7E7C(Actor* actor) { RAND_FLOAT_CENTERED(10.0f), (s32) (RAND_FLOAT(50.0f) + 70.0f), 11, 1.0f); D_80137E84[gMainController] = 1; D_Timer_80177BD0[gMainController] = 15; - Audio_PlaySfx(0x2940C00A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940C00A, actor->sfxSource, 4); actor->state = 21; } break; case 21: - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; default: break; @@ -4610,7 +4609,7 @@ void func_i5_801A7E7C(Actor* actor) { if ((actor->unk_0D0 != 0) && (actor->state >= 2)) { actor->unk_0D0 = 0; if ((actor->unk_0D2 == 0) && (D_i5_801BE320[9] > 0) && ((gPlayer[0].unk_138 - actor->obj.pos.z) > 200.0f)) { - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); actor->iwork[7] = 15; D_i5_801BE320[9] -= actor->damage; func_i5_801AD624(actor->obj.pos.x, actor->obj.pos.y + 80, actor->obj.pos.z + 50.0f, @@ -4619,7 +4618,7 @@ void func_i5_801A7E7C(Actor* actor) { RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), (s32) (RAND_FLOAT(50.0f) + 70.0f), 3, RAND_FLOAT(1.0f)); if (D_i5_801BE320[9] <= 0) { - Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 4); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y + 80.0f, actor->obj.pos.z + 50.0f, 5.0f); for (i = 0; i < 2; i++) { func_i5_801AD624(actor->obj.pos.x, actor->obj.pos.y + 80.0f, actor->obj.pos.z + 50.0f, @@ -4636,7 +4635,7 @@ void func_i5_801A7E7C(Actor* actor) { } } else if ((actor->unk_0D2 == 1) && (D_i5_801BE320[10] > 0) && ((gPlayer[0].unk_138 - actor->obj.pos.z) > 200.0f)) { - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); actor->iwork[8] = 16; D_i5_801BE320[10] -= actor->damage; func_i5_801AD624(actor->obj.pos.x, actor->obj.pos.y - 30.0f, actor->obj.pos.z, RAND_FLOAT_CENTERED(10.0f), @@ -4644,7 +4643,7 @@ void func_i5_801A7E7C(Actor* actor) { RAND_FLOAT(360.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), RAND_FLOAT_CENTERED(30.0f), (s32) (RAND_FLOAT(50.0f) + 70.0f), 3, RAND_FLOAT(1.0f)); if (D_i5_801BE320[10] <= 0) { - Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 4); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y - 30.0f, actor->obj.pos.z, 6.0f); for (i = 0; i < 10; i++) { @@ -4661,7 +4660,7 @@ void func_i5_801A7E7C(Actor* actor) { (s32) (RAND_FLOAT(50.0f) + 70.0f), 9, 1.0f); } } else { - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } } if (D_i5_801BE320[4] != 0) { @@ -4942,7 +4941,7 @@ void func_i5_801AC438(Actor* actor) { func_i5_8019A728(actor); if (actor->iwork[1] != 0) { Radio_PlayMessage(gMsg_ID_17420, RCID_BOSS_MACBETH); - Audio_PlaySfx(0x19034066, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19034066, actor->sfxSource, 4); actor->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6035A94); actor->state += 1; } @@ -4957,7 +4956,7 @@ void func_i5_801AC438(Actor* actor) { } if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } } @@ -4985,7 +4984,7 @@ void func_i5_801AC6B4(Actor* actor) { actor->obj.pos.z = 0.0f; actor->obj.rot.y = 180.0f; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x11030010, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, actor->sfxSource, 0); actor->unk_0B6 = 1; } @@ -5082,7 +5081,7 @@ void func_i5_801AC754(Player* player) { } break; case 3: - func_8001D444(0, 0x8010, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_16 | 0x8000); D_80177838 = 50; player->state_1C8 = PLAYERSTATE_1C8_3; player->unk_1D0 = player->timer_1F8 = player->timer_1FC = player->unk_240 = 0; @@ -5274,7 +5273,7 @@ void func_i5_801AD6F0(Actor* actor) { Vec3f sp4C = { 0.0f, -10.0f, 0.0f }; if ((gPlayer[0].unk_138 - actor->obj.pos.z) < -500.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } switch (actor->state) { @@ -5293,7 +5292,7 @@ void func_i5_801AD6F0(Actor* actor) { actor->unk_046 = 192; actor->scale = 2.5f; actor->fwork[0] = 2.5f; - Audio_PlaySfx(0x2903B009, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, actor->sfxSource, 4); func_8007D0E0(actor->obj.pos.x, actor->obj.pos.y + 30.0f, actor->obj.pos.z, 7.0f); func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y + 30.0f, actor->obj.pos.z, 0.0f, 0.0f, 0.0f, 4.0f, 5); if (actor->obj.pos.y < (gGroundLevel + 10.0f)) { @@ -5310,7 +5309,7 @@ void func_i5_801AD6F0(Actor* actor) { actor->fwork[0] -= 0.3f; actor->unk_046 -= 20; if (actor->unk_046 < 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } actor->obj.rot.y = 180.0f - actor->obj.rot.y; @@ -5362,7 +5361,7 @@ void func_i5_801ADC08(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 actor->vel.z = zVel; actor->timer_0BC = 0; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x2900201D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900201D, actor->sfxSource, 4); } void func_i5_801ADCEC(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel) { @@ -5381,7 +5380,7 @@ void func_i5_801ADD68(Actor* actor) { s32 var_v0; if ((gPlayer[0].unk_138 - actor->obj.pos.z) < -500.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } switch (actor->state) { @@ -5420,7 +5419,7 @@ void func_i5_801ADD68(Actor* actor) { } if ((func_8006351C(actor->index, &actor->obj.pos, &sp3C, 1) != 0) || (actor->obj.pos.y < (gGroundLevel + 200.0f))) { - Audio_PlaySfx(0x19032064, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19032064, actor->sfxSource, 4); D_80137E84[gMainController] = 1; D_Timer_80177BD0[gMainController] = 5; actor->vel.x = 0.0f; @@ -5460,9 +5459,9 @@ void func_i5_801ADD68(Actor* actor) { actor->obj.pos.z, 7.0f); func_8007D2C8(actor->obj.pos.x + RAND_FLOAT_CENTERED(20.0f), actor->obj.pos.y + 400.0f, actor->obj.pos.z, 7.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } else { - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); } } break; @@ -5524,7 +5523,7 @@ void func_i5_801AE4CC(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 arg4, f32 } actor->health = 30; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x2900201D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900201D, actor->sfxSource, 4); } void func_i5_801AE610(f32 xPos, f32 yPos, f32 zPos, f32 arg3, f32 yVel, f32 arg5, s16 arg6) { @@ -5619,10 +5618,10 @@ void func_i5_801AE87C(Effect* effect) { if (effect->unk_44 < 240) { effect->unk_44 += 15; } else { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } if ((fabsf(effect->obj.pos.x - sp34) <= 30.0f) && (fabsf(effect->obj.pos.z - sp2C) <= 30.0f)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } @@ -5643,7 +5642,7 @@ void func_i5_801AEAA0(Effect* effect) { void func_i5_801AEC04(Actor* actor) { if ((gPlayer[0].unk_138 - actor->obj.pos.z) < -300.0f) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } switch (actor->state) { @@ -5658,7 +5657,7 @@ void func_i5_801AEC04(Actor* actor) { } actor->state = 1; actor->timer_0BC = 200; - Audio_PlaySfx(0x11000028, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11000028, actor->sfxSource, 4); } break; case 1: @@ -5687,14 +5686,14 @@ void func_i5_801AEC04(Actor* actor) { actor->fwork[1] = 32.0f; } if ((actor->unk_0D0 != 0) && (actor->unk_0D2 == 0)) { - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); actor->unk_0D0 = 0; actor->health -= actor->damage; actor->timer_0C6 = 15; if (actor->health <= 0) { func_8007A6F0(&actor->obj.pos, 0x29000000); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 8.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } } @@ -5727,7 +5726,7 @@ void func_i5_801AF134(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 actor->fwork[0] = 1.0f; actor->fwork[2] = 1.0f; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x2900201D, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900201D, actor->sfxSource, 4); } void func_i5_801AF200(f32 xPos, f32 yPos, f32 zPos, f32 xVel, f32 yVel, f32 zVel) { @@ -5770,12 +5769,12 @@ void func_i5_801AF27C(Actor* actor, s32 arg1) { actor->unk_0C9 = 1; actor->fwork[3] = D_i5_801BA820[arg1]; actor->state = 30; - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } else { actor->unk_0B6 = 1; actor->state = 21; actor->obj.rot.z = 32.5f; - Audio_PlaySfx(0x11030010, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, actor->sfxSource, 0); actor->fwork[9] = 20.0f; } } @@ -5807,7 +5806,7 @@ void func_i5_801AF44C(void) { actor->state = 15; actor->fwork[3] = D_i5_801BA820[4]; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } static Vec3f D_i5_801BA834[2] = { @@ -5894,8 +5893,8 @@ void func_i5_801AF8F4(Player* player) { gCsFrameCount = 0; D_80178488 = 1; player->unk_234 = 0; - func_800182F4(0x101E00FF); - func_800182F4(0x111E00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 30); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 30); player->unk_1D0 = 1; D_80177A48[0] = 0.0f; D_80177A48[4] = -60.0f; @@ -6028,9 +6027,8 @@ void func_i5_801AF8F4(Player* player) { player->camAt.z = gCsCamAtZ = 1900.0f; player->unk_114 = 0.0f; D_i5_801BA1DC = -100.0f; - func_8001A838(0x31078085); - Audio_PlaySfx(0x31408095, gActors[D_i5_801BE314].sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + Audio_KillSfxById(0x31078085); + AUDIO_PLAY_SFX(0x31408095, gActors[D_i5_801BE314].sfxSource, 4); D_i5_801BE313 = 0; } break; @@ -6120,9 +6118,8 @@ void func_i5_801AF8F4(Player* player) { D_80177D20 = player->unk_144; D_80177CE8 += player->unk_140; if (gCsFrameCount == 630) { - func_8001A55C(gActors[D_i5_801BE314].sfxPos, 0x31408095); - Audio_PlaySfx(0x2940C00A, gActors[D_i5_801BE314].sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + Audio_KillSfxBySourceAndId(gActors[D_i5_801BE314].sfxSource, 0x31408095); + AUDIO_PLAY_SFX(0x2940C00A, gActors[D_i5_801BE314].sfxSource, 4); player->unk_1D0++; player->vel.z = 0.0f; player->unk_140 = 0.0f; @@ -6261,8 +6258,7 @@ void func_i5_801AF8F4(Player* player) { D_80178348 = D_80178350 = D_80178354 = 255; D_80178358 = 255; D_8017835C = 20; - Audio_PlaySfx(0x2940F026, gActors[D_i5_801BE314].sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940F026, gActors[D_i5_801BE314].sfxSource, 4); gBossActive = D_80178488 = 0; } if (gCsFrameCount == 940) { @@ -6296,7 +6292,7 @@ void func_i5_801AF8F4(Player* player) { player->vel.y = -3.0f; player->unk_1DC = player->unk_2B4 = player->unk_2BC = player->unk_184 = player->unk_108 = player->unk_10C = player->unk_0E8 = player->unk_0E4 = player->unk_104 = 0.0f; - player->timer_1E0 = player->unk_48C = 0; + player->timer_1E0 = player->sfx.bank = 0; } break; case 7: @@ -6378,7 +6374,7 @@ void func_i5_801AF8F4(Player* player) { D_80177A48[5] = 360.0f; break; case 910: - func_8001D444(0, 0x26, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_38); break; case 1040: Radio_PlayMessage(gMsg_ID_20010, RCID_FOX); @@ -6457,7 +6453,7 @@ void func_i5_801AF8F4(Player* player) { D_i5_801BA86C = -0.5f; break; case 1810: - Object_Kill(&gActors[8].obj, gActors[8].sfxPos); + Object_Kill(&gActors[8].obj, gActors[8].sfxSource); gOverlayStage = 1; break; case 1817: @@ -6483,14 +6479,14 @@ void func_i5_801AF8F4(Player* player) { D_80161A44 = 30000.0f; player->unk_240 = 1; func_8001CA24(0); - Audio_PlaySfx(0x01008016, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x01008016, player->sfxSource, 0); break; case 2310: gActors[3].state++; break; case 2440: - func_800182F4(0x103C00FF); - func_800182F4(0x113C00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 60); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 60); break; } @@ -6520,7 +6516,7 @@ void func_i5_801AF8F4(Player* player) { player->state_1C8 = PLAYERSTATE_1C8_6; D_8017837C = 4; func_800A6148(); - func_8001DBD0(10); + Audio_FadeOutAll(10); D_800D3180[LEVEL_MACBETH] = Play_CheckMedalStatus(150) + 1; } } @@ -6557,7 +6553,7 @@ void func_i5_801B28BC(Actor* actor) { Math_SmoothStepToF(&actor->obj.pos.z, actor->fwork[2] + player->unk_138, 0.03f, 10.0f, 0.0f); break; case 11: - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); actor->timer_0BC = 10; actor->state++; actor->fwork[29] = 5.0f; @@ -6612,7 +6608,7 @@ void func_i5_801B28BC(Actor* actor) { Math_SmoothStepToAngle(&actor->obj.rot.z, 62.0f, 1.0f, 0.5f, 0); if (actor->fwork[0] > 180.0f) { actor->state++; - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); actor->timer_0BC = 160; actor->fwork[29] = 5.0f; } @@ -6664,7 +6660,7 @@ void func_i5_801B28BC(Actor* actor) { Math_SmoothStepToF(&actor->obj.pos.z, actor->fwork[2] + player->unk_138, 0.03f, 10.0f, 0.0f); break; case 31: - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); actor->unk_0C9 = 0; actor->timer_0BC = 20; actor->state++; @@ -6721,12 +6717,12 @@ void func_i5_801B3554(Actor* actor, s32 arg1) { actor->unk_0C9 = 1; actor->fwork[3] = D_i5_801BA8F0[arg1]; actor->state = 30; - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); return; } actor->unk_0B6 = 1; actor->state = 20; - Audio_PlaySfx(0x11030010, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, actor->sfxSource, 0); actor->fwork[9] = 20.0f; } @@ -6757,7 +6753,7 @@ void func_i5_801B3718(void) { actor->state = 10; actor->fwork[3] = D_i5_801BA900; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } void func_i5_801B38E0(void) { @@ -6774,7 +6770,7 @@ void func_i5_801B38E0(void) { for (i = 0; i < 50; i++) { if (gObjects80[i].obj.id <= OBJ_80_91 || gObjects80[i].obj.id >= OBJ_80_97) { - Object_Kill(&gObjects80[i].obj, gObjects80[i].sfxPos); + Object_Kill(&gObjects80[i].obj, gObjects80[i].sfxSource); Object_80_Initialize(&gObjects80[i]); } } @@ -6785,27 +6781,27 @@ void func_i5_801B38E0(void) { } for (i = 0; i < 60; i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); Actor_Initialize(&gActors[i]); } for (i = 0; i < 4; i++) { - Object_Kill(&gBosses[i].obj, gBosses[i].sfxPos); + Object_Kill(&gBosses[i].obj, gBosses[i].sfxSource); Boss_Initialize(&gBosses[i]); } for (i = 0; i < 100; i++) { - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); Effect_Initialize(&gEffects[i]); } for (i = 0; i < 20; i++) { - Object_Kill(&gItems[i].obj, gItems[i].sfxPos); + Object_Kill(&gItems[i].obj, gItems[i].sfxSource); Item_Initialize(&gItems[i]); } for (i = 0; i < 16; i++) { - Object_Kill(&gPlayerShots[i].obj, gPlayerShots[i].sfxPos); + Object_Kill(&gPlayerShots[i].obj, gPlayerShots[i].sfxSource); PlayerShot_Initialize(&gPlayerShots[i]); } @@ -6965,7 +6961,7 @@ void func_i5_801B3D04(Player* player) { D_80177830 = 0; break; case 50: - func_8001D444(0, 0x26, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_38); break; case 100: D_80177840 = 100; @@ -7053,7 +7049,7 @@ void func_i5_801B3D04(Player* player) { break; case 1158: if (D_800D3180[LEVEL_ZONESS] != 0) { - Object_Kill(&gActors[8].obj, gActors[8].sfxPos); + Object_Kill(&gActors[8].obj, gActors[8].sfxSource); } /* fallthrough */ case 1195: @@ -7076,8 +7072,8 @@ void func_i5_801B3D04(Player* player) { func_i5_801ACF6C(); } if (gCsFrameCount == 1220) { - func_800182F4(0x103C00FF); - func_800182F4(0x113C00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 60); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 60); } if (gCsFrameCount > 1280) { D_80178348 = D_80178350 = D_80178354 = 0; @@ -7086,7 +7082,7 @@ void func_i5_801B3D04(Player* player) { player->state_1C8 = PLAYERSTATE_1C8_6; D_8017837C = 4; func_800A6148(); - func_8001DBD0(10); + Audio_FadeOutAll(10); D_800D3180[LEVEL_MACBETH] = Play_CheckMedalStatus(150) + 1; } } diff --git a/src/overlays/ovl_i5/fox_ti.c b/src/overlays/ovl_i5/fox_ti.c index 2c4ca779..26a5b1c2 100644 --- a/src/overlays/ovl_i5/fox_ti.c +++ b/src/overlays/ovl_i5/fox_ti.c @@ -101,7 +101,7 @@ void func_i5_80188F60(Effect* effect) { if (effect->timer_50 == 0) { effect->unk_44 -= 16; if (effect->unk_44 < 17) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -235,7 +235,7 @@ void func_i5_801895B8(Actor* actor) { actor->iwork[2]++; switch (actor->state) { case 0: - Audio_PlaySfx(0x31000017, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000017, actor->sfxSource, 4); if (actor->obj.rot.z > 1.0f) { actor->iwork[0] = 1; } @@ -314,7 +314,7 @@ void func_i5_801895B8(Actor* actor) { func_8007C120(actor->obj.pos.x, actor->obj.pos.y + 30.0f, actor->obj.pos.z, actor->vel.x, actor->vel.y, actor->vel.z, 0.1f, 30); func_8007A6F0(&actor->obj.pos, 0x2903A008); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -358,7 +358,7 @@ void func_i5_80189CC8(Actor* actor) { actor->health -= actor->damage; if (actor->health <= 0) { actor->health = 0; - Audio_PlaySfx(0x2903A008, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903A008, actor->sfxSource, 4); actor->timer_0CA[0] = actor->unk_044 = 0; actor->info.unk_1C = 0.0f; func_80066254(actor); @@ -413,7 +413,7 @@ void func_i5_80189CC8(Actor* actor) { } } } else if (!(gGameFrameCount & 7) && (Rand_ZeroOne() < 0.5f)) { - Audio_PlaySfx(0x11000027, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11000027, actor->sfxSource, 4); func_8007C120(actor->fwork[0], actor->fwork[1], actor->fwork[2], 0.0f, 0.0f, 0.0f, 0.1f, 7); actor->timer_0C6 = 4; } @@ -496,7 +496,7 @@ void func_i5_8018A544(Actor* actor) { actor->unk_0C9 = 1; if ((actor->scale != 1.0f) && (actor->unk_0D0 == 3)) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } if (actor->unk_0D0 != 0) { actor->unk_0D0 = 0; @@ -518,10 +518,10 @@ void func_i5_8018A544(Actor* actor) { func_80066254(actor); actor->info.bonus = 0; } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } else { func_8007A900(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 8.0f, 0xFF, 8, 1); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); if ((Actor*) actor->iwork[0] != NULL) { ((Actor*) actor->iwork[0])->iwork[actor->iwork[1]] = 0; @@ -548,7 +548,7 @@ void func_i5_8018A544(Actor* actor) { actor->obj.pos.y = sp44 + temp_fv1; if (actor->unk_046 == 0) { if (actor->vel.y < -6.0f) { - Audio_PlaySfx(0x19020006, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19020006, actor->sfxSource, 4); } if (actor->vel.y < 0.0f) { actor->vel.y = -actor->vel.y * 0.2f; @@ -609,7 +609,7 @@ void func_i5_8018AB44(Actor* actor) { actor->gravity = 1.0f; func_i5_801B6E20(actor->obj.pos.x, actor->obj.pos.z + D_80177D20, &sp3C, &sp34, &sp38); if (actor->obj.pos.y <= (sp34 + 3.0f)) { - Audio_PlaySfx(0x19000024, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000024, actor->sfxSource, 4); actor->obj.pos.y = sp34 + 3.0f; actor->obj.rot.x = sp3C * (M_RTOD); actor->obj.rot.z = sp38 * (M_RTOD); @@ -624,7 +624,7 @@ void func_i5_8018AB44(Actor* actor) { switch (actor->unk_0D0) { case 1: - Audio_PlaySfx(0x29022086, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29022086, actor->sfxSource, 4); break; case 2: actor->unk_044 = 0; @@ -632,7 +632,7 @@ void func_i5_8018AB44(Actor* actor) { actor->info.bonus = 0; func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y + 10.0f, actor->obj.pos.z, 6.0f); func_8007A6F0(&actor->obj.pos, 0x2903B009); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; case 3: func_8007A6F0(&actor->obj.pos, 0x2903B009); @@ -645,7 +645,7 @@ void func_i5_8018AB44(Actor* actor) { if (actor->obj.pos.x < gPlayer[0].pos.x) { gPlayer[0].unk_1EC = -20; } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; } actor->unk_0D0 = 0; @@ -695,9 +695,9 @@ void func_i5_8018ADC4(Actor* actor) { actor->health = 40; if (k < 2) { for (i = 0; i < k; i++) { - Object_Kill(&gActors[actor->iwork[k]].obj, gActors[actor->iwork[k]].sfxPos); + Object_Kill(&gActors[actor->iwork[k]].obj, gActors[actor->iwork[k]].sfxSource); } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -819,7 +819,7 @@ void func_i5_8018B268(Actor* actor) { sp38->vel.y = 0.0f; sp38->vel.z = 0.0f; } else if (actor->unk_0B6 == 57) { - Audio_PlaySfx(0x29000028, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29000028, actor->sfxSource, 4); sp4C.x = 0.0f; sp4C.y = actor->fwork[1]; sp4C.z = 20.0f; @@ -904,7 +904,7 @@ void func_i5_8018B720(Actor* actor) { actorPtr->iwork[0] = (uintptr_t) NULL; actor->iwork[1] = (uintptr_t) NULL; } - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } void func_i5_8018B96C(Actor* actor) { @@ -936,7 +936,7 @@ void func_i5_8018B9D0(Actor* actor) { sp3C = gPlayer[0].pos.z - actor->obj.pos.z; if (actor->timer_0BE == 7) { actor->iwork[0] = 2; - Audio_PlaySfx(0x19000032, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000032, actor->sfxSource, 0); } if (actor->timer_0BE == 0) { temp_fa1 = SQ(sp44) + SQ(sp40) + SQ(sp3C); @@ -946,8 +946,7 @@ void func_i5_8018B9D0(Actor* actor) { if (temp_fa1 < 360000.0f) { actor->timer_0BE = 0; if (actor->timer_0BC == 0) { - Audio_PlaySfx(0x19000029, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000029, actor->sfxSource, 4); actor->iwork[0] = 1 - actor->iwork[0]; actor->timer_0BC = 5; } @@ -958,7 +957,7 @@ void func_i5_8018B9D0(Actor* actor) { } if (actor->timer_0BE == 1) { func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); Player_ApplyDamage(gPlayer, 0, 60); gPlayer[0].vel.y = 20.0f; gPlayer[0].pos.y += 15.0f; @@ -980,7 +979,7 @@ void func_i5_8018B9D0(Actor* actor) { func_80066254(actor); func_8007A6F0(&actor->obj.pos, 0x2903B009); func_8007D2C8(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 10.0f); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; } @@ -1001,7 +1000,7 @@ void func_i5_8018B9D0(Actor* actor) { } actor->obj.rot.x = (var_fa0 / 130.0f) * 90.0f; if (actor->unk_0D0 == 1) { - Audio_PlaySfx(0x19020008, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19020008, actor->sfxSource, 4); sp44 = actor->obj.pos.x - actor->unk_0D8.x; sp40 = fabsf(sp44); actor->unk_0D0 = 0; @@ -1064,7 +1063,7 @@ void func_i5_8018BFB0(Actor* actor) { } } if (i == 3) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); return; } @@ -1232,7 +1231,7 @@ void func_i5_8018C72C(Actor* actor) { f32 sp30; actor->state = 8; - Audio_PlaySfx(0x29030098, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29030098, actor->sfxSource, 4); for (i = 0; i < 9; i++) { D_i5_801BD738[actor->iwork[0]][i].unk_18 |= 2; @@ -1293,7 +1292,7 @@ void func_i5_8018C8A8(Actor* actor) { if ((actor->health > 0) && (actor->unk_0D2 >= 0) && (actor->unk_0D2 < 3)) { actor->iwork[5] = 10; if (actor->state == 4) { - func_8001A55C(actor->sfxPos, 0x31030043); + Audio_KillSfxBySourceAndId(actor->sfxSource, 0x31030043); actor->timer_0BC = 20; actor->fwork[24] = 1.0f; actor->fwork[23] = actor->unk_0B6; @@ -1309,7 +1308,7 @@ void func_i5_8018C8A8(Actor* actor) { actor->unk_0B6 = 0; actor->fwork[15] = 0.0f; } else { - Audio_PlaySfx(0x29034041, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034041, actor->sfxSource, 4); } } else if (actor->unk_0D0 == 1) { func_8007A6F0(&actor->obj.pos, 0x29121007); @@ -1321,7 +1320,7 @@ void func_i5_8018C8A8(Actor* actor) { switch (actor->state) { case 0: - Audio_PlaySfx(0x29023020, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29023020, actor->sfxSource, 4); actor->unk_0F4.y = actor->obj.rot.y; actor->obj.rot.y = 180.0f; actor->obj.pos.y += 125.0f; @@ -1347,7 +1346,7 @@ void func_i5_8018C8A8(Actor* actor) { Math_SmoothStepToAngle(&actor->obj.rot.y, actor->unk_0F4.y, 0.2f, 10.0f, 0.01f); } if ((actor->obj.pos.y + actor->fwork[7] + actor->fwork[26]) <= sp9C) { - Audio_PlaySfx(0x29034021, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034021, actor->sfxSource, 4); actor->fwork[16] = actor->obj.pos.y = sp9C; actor->unk_0F4.x = spA0 * M_RTOD; actor->unk_0F4.z = sp98 * M_RTOD; @@ -1403,7 +1402,7 @@ void func_i5_8018C8A8(Actor* actor) { if (actor->timer_0BC == 0) { actor->timer_0BC = 15; actor->state++; - Audio_PlaySfx(0x31030043, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31030043, actor->sfxSource, 4); } Math_SmoothStepToF(&actor->fwork[26], -60.0f, actor->fwork[15], 500.0f, 0.01f); break; @@ -1439,7 +1438,7 @@ void func_i5_8018C8A8(Actor* actor) { if (actor->timer_0BC == 0) { if (((actor->unk_0B6 == 0x28) || (actor->unk_0B6 == 0x50)) && (actor->timer_0BC == 0)) { - Audio_PlaySfx(0x2902201F, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902201F, actor->sfxSource, 4); } Math_SmoothStepToF(&actor->fwork[0xF], 1.0f, 0.7f, 0.1f, 0.01f); actor->unk_0B6++; @@ -1461,7 +1460,7 @@ void func_i5_8018C8A8(Actor* actor) { } actor->unk_0B6 = actor->fwork[23]; if (actor->timer_0BC == 1) { - Audio_PlaySfx(0x31030043, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31030043, actor->sfxSource, 4); } } Animation_GetFrameData(&D_70067C4, actor->unk_0B6, spA4); @@ -1478,7 +1477,7 @@ void func_i5_8018C8A8(Actor* actor) { actor->unk_0B6 = 0; actor->timer_0BC = 30; actor->fwork[15] = 0.0f; - Audio_PlaySfx(0x29030098, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29030098, actor->sfxSource, 4); } break; case 5: @@ -1530,7 +1529,7 @@ void func_i5_8018C8A8(Actor* actor) { Matrix_MultVec3f(gCalcMatrix, (Vec3f*) &actor->fwork[6], &sp158); func_8007A900(actor->obj.pos.x + sp158.x, actor->obj.pos.y + sp158.y, actor->obj.pos.z + sp158.z, 20.0f, 0xFF, 8, 0); - Audio_PlaySfx(0x19030003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19030003, actor->sfxSource, 4); } if (!(actor->timer_0BC & 7)) { Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); @@ -1562,7 +1561,7 @@ void func_i5_8018C8A8(Actor* actor) { for (i = 0; i < 9; i++) { D_i5_801BD738[actor->iwork[0]][i].unk_18 |= 1; } - Audio_PlaySfx(0x2940C00A, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940C00A, actor->sfxSource, 4); D_80178480 = 20; D_Timer_80177BD0[0] = 16; Matrix_RotateY(gCalcMatrix, actor->obj.rot.y * M_DTOR, 0); @@ -1635,7 +1634,7 @@ void func_i5_8018C8A8(Actor* actor) { break; case 5: D_i5_801B750C[actor->iwork[0]] = false; - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); break; } break; @@ -1703,7 +1702,7 @@ void func_i5_8018E3CC(Actor* actor) { } } if (i == 60) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -1809,7 +1808,7 @@ void func_i5_8018E5F8(Actor* actor) { actor->iwork[7] = (s32) (spA4 / 200.0f); actor->iwork[8] = (s32) ((5000.0f - spA4) / 714.0f); } - Audio_PlaySfx(0x19130003, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19130003, actor->sfxSource, 4); actor->vel.y = 0.0f; actor->gravity = 0.0f; actor->obj.pos.y = 94.0f + sp7C; @@ -1924,7 +1923,7 @@ void func_i5_8018E5F8(Actor* actor) { temp_v0_4->obj.pos.z = sp54; temp_v0_4->timer_50 = 2; actor->iwork[5] = (uintptr_t) temp_v0_4; - Audio_PlaySfx(0x3100001E, temp_v0_4->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100001E, temp_v0_4->sfxSource, 4); } } else { temp_v0_3->obj.pos.x = sp5C; @@ -2110,7 +2109,7 @@ void func_i5_8018F4D8(Object_80* obj80) { D_Timer_80177BD0[0] = 7; D_80178480 = 12; func_i5_8018F134(obj80); - Audio_PlaySfx(0x19130003, obj80->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19130003, obj80->sfxSource, 4); } break; case 1: @@ -2120,7 +2119,7 @@ void func_i5_8018F4D8(Object_80* obj80) { D_Timer_80177BD0[0] = 7; D_80178480 = 12; func_i5_8018F134(obj80); - Audio_PlaySfx(0x19130003, obj80->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19130003, obj80->sfxSource, 4); obj80->state++; } break; @@ -2131,7 +2130,7 @@ void func_i5_8018F4D8(Object_80* obj80) { D_Timer_80177BD0[0] = 7; D_80178480 = 12; func_i5_8018F134(obj80); - Audio_PlaySfx(0x19130003, obj80->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19130003, obj80->sfxSource, 4); obj80->state++; } break; @@ -3148,15 +3147,15 @@ void func_i5_80192118(Boss* boss) { switch (D_i5_801B8C0C[boss->dmgPart]) { case 0: D_i5_801BBEF0[30] = 15; - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); break; case 1: D_i5_801BBEF0[33] = 15; - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); break; case 2: D_i5_801BBEF0[34] = 15; - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); break; } } @@ -3202,7 +3201,7 @@ void func_i5_80192118(Boss* boss) { D_i5_801BBEF0[38] = 2; gPlayer[0].unk_19C = 0; boss->swork[1] = 3; - func_8001D444(0, 0x8014, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_20 | 0x8000); } break; case 3: @@ -3229,19 +3228,19 @@ void func_i5_80192118(Boss* boss) { D_i5_801BBEF0[30] = 15; D_i5_801BBEF0[27] -= boss->damage; - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); break; case 1: D_i5_801BBEF0[33] = 15; D_i5_801BBEF0[27] -= boss->damage; - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); break; case 2: D_i5_801BBEF0[34] = 15; D_i5_801BBEF0[27] -= boss->damage; - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); break; } boss->dmgType = DMG_NONE; @@ -3386,8 +3385,8 @@ void func_i5_80192118(Boss* boss) { D_i5_801BBEF4[53] = -350.0f; D_i5_801BBEF4[63] = 0.0f; D_i5_801BBEF4[55] = D_i5_801BBEF4[63]; - Audio_PlaySfx(0x2900502A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900502A, boss->sfxSource, 4); + AUDIO_PLAY_SFX(0x2940802C, boss->sfxSource, 4); boss->swork[1] = 4; boss->timer_050 = 120; D_i5_801BBEF0[22] = 0; @@ -3740,7 +3739,7 @@ void func_i5_80193DF0(Boss* boss) { } } D_i5_801BBF00[i].unk_26 = 4; - Audio_PlaySfx(0x2903B009, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, boss->sfxSource, 4); } } if (boss->fwork[38] != 0.0f) { @@ -3836,7 +3835,7 @@ void func_i5_80193DF0(Boss* boss) { if ((boss->state >= 7) && (boss->state < 0xE) && (boss->dmgType == DMG_BEAM) && (D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] == 2) && (D_i5_801BBEF0[8] == 0)) { - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); boss->dmgType = DMG_NONE; } if ((boss->state >= 7) && (boss->state < 0xE)) { @@ -3850,7 +3849,7 @@ void func_i5_80193DF0(Boss* boss) { } if (D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] != 0) { - Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940802C, boss->sfxSource, 4); boss->swork[D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] + 4] = 0x14; if (boss->swork[D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] + 8] > 0) { boss->swork[D_i5_801BAA78[D_i5_801B7904[boss->dmgPart]] + 8] -= boss->damage; @@ -3882,9 +3881,9 @@ void func_i5_80193DF0(Boss* boss) { D_8017796C = -1; boss->swork[21] = 0; D_Timer_80161A60 = 8; - Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09A, boss->sfxSource, 4); } else { - Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940802C, boss->sfxSource, 4); if (boss->swork[21] < 0xB) { D_i5_801BBEF0[1] = 15; @@ -3900,7 +3899,7 @@ void func_i5_80193DF0(Boss* boss) { boss->swork[37] |= 4; D_i5_801BBEF0[43] = 0; } else { - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); } } if ((boss->dmgType == DMG_BOMB) && (boss->dmgPart == 1) && (D_i5_801BBEF0[8] == 0)) { @@ -3913,7 +3912,7 @@ void func_i5_80193DF0(Boss* boss) { case 1: case 2: case 3: - Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940802C, boss->sfxSource, 4); boss->swork[boss->dmgPart + 5] = 0x14; if (boss->swork[boss->dmgPart + 9] <= 0) { break; @@ -3943,15 +3942,15 @@ void func_i5_80193DF0(Boss* boss) { break; case 4: if ((gBossHealthBar > 0) && (boss->swork[29] != 0) && (boss->swork[21] > 0)) { - Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940802C, boss->sfxSource, 4); boss->swork[21] -= boss->damage; if (boss->swork[21] <= 0) { boss->swork[21] = 0; D_Timer_80161A60 = 8; D_8017796C = -1; - Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09A, boss->sfxSource, 4); } else { - Audio_PlaySfx(0x2940802C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940802C, boss->sfxSource, 4); if (boss->swork[21] < 0xB) { D_i5_801BBEF0[1] = 0xF; @@ -3988,8 +3987,8 @@ void func_i5_80193DF0(Boss* boss) { D_i5_801BBEF4[2] = 0.0f; D_i5_801BBEF4[1] = 20.0f; boss->swork[28]++; - Audio_PlaySfx(0x2900803F, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x11003023, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900803F, boss->sfxSource, 4); + AUDIO_PLAY_SFX(0x11003023, boss->sfxSource, 4); break; case 3: D_i5_801BBEF4[2] += D_i5_801BBEF4[1]; @@ -4001,7 +4000,7 @@ void func_i5_80193DF0(Boss* boss) { D_i5_801BBEF4[4] = 20.0f; boss->swork[29] = 1; boss->swork[37] |= 1; - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); } break; case 4: @@ -4031,14 +4030,14 @@ void func_i5_80193DF0(Boss* boss) { D_i5_801BBEF4[2] += D_i5_801BBEF4[1]; D_i5_801BBEF4[1] -= 3.0; if (D_i5_801BBEF4[2] <= 0.0f) { - func_8001A55C(boss->sfxPos, 0x11003023); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x11003023); boss->swork[29] = 0; D_i5_801BBEF4[2] = 0.0f; boss->swork[28]++; } break; case 8: - Audio_PlaySfx(0x11033022, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11033022, boss->sfxSource, 4); for (i = 0; i < 0x21; i++) { actor = func_800A3608(0xBD); @@ -4089,7 +4088,7 @@ void func_i5_80193DF0(Boss* boss) { actor->obj.rot.z += 20.0f; if (sp9C <= 25.0f) { D_i5_801BBF00[D_i5_801B8198[i].unk_00].unk_26 = 8; - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); D_i5_801B8198[i].actor = NULL; } } else if (D_i5_801B8198[i].unk_0C > 0) { @@ -4204,7 +4203,7 @@ void func_i5_80193DF0(Boss* boss) { case 6: boss->fwork[47] = (f32) boss->unk_04C / (f32) (Animation_GetFrameCount(&D_900FC4C) * 2); if ((boss->unk_04C == 0) || (boss->unk_04C == 0x44) || (boss->unk_04C == 0x60) || (boss->unk_04C == 0x95)) { - Audio_PlaySfx(0x2900502A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900502A, boss->sfxSource, 4); } temp_f = gPlayer[0].unk_138 - boss->obj.pos.z - 530.0f; if (temp_f < 0.0f) { @@ -4236,7 +4235,7 @@ void func_i5_80193DF0(Boss* boss) { Math_SmoothStepToVec3fArray(D_i5_801BC978, D_i5_801BCDC8, 1, 0x5C, boss->fwork[0], 360.0f, 0.01f); boss->unk_04C++; if (boss->unk_04C >= (Animation_GetFrameCount(&D_900FC4C) * 2)) { - Audio_PlaySfx(0x2940702B, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940702B, boss->sfxSource, 4); gPlayer[0].unk_19C = 0; boss->unk_04C = 0; boss->fwork[48] = 0; @@ -4315,7 +4314,7 @@ void func_i5_80193DF0(Boss* boss) { D_i5_801BBEF4[12] = 0.0f; } if ((boss->unk_04C == 0x16) || (boss->unk_04C == 0x50)) { - Audio_PlaySfx(0x2940702B, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940702B, boss->sfxSource, 4); } if (((boss->unk_04C >= 0) && (boss->unk_04C < 0x12)) || ((boss->unk_04C >= 0x3E) && (boss->unk_04C < 0x50))) { @@ -4385,7 +4384,7 @@ void func_i5_80193DF0(Boss* boss) { D_i5_801BBEF0[17]--; } if (boss->unk_04C == 0) { - Audio_PlaySfx(0x39435830, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x39435830, boss->sfxSource, 4); } if (boss->unk_04C == 0xF) { D_i5_801BBEF0[16] = 0x19; @@ -4401,7 +4400,7 @@ void func_i5_80193DF0(Boss* boss) { D_i5_801BBEF0[7] = 0; } if (boss->unk_04C == 0x2D) { - Audio_PlaySfx(0x3143102F, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3143102F, boss->sfxSource, 4); boss->swork[32] = 0; boss->fwork[42] = 0.0f; boss->fwork[41] = 40.0f; @@ -4431,7 +4430,7 @@ void func_i5_80193DF0(Boss* boss) { } boss->swork[32] = 0; - func_8001A55C(boss->sfxPos, 0x3143102F); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x3143102F); boss->swork[25] = 0; boss->fwork[41] = 0.0f; boss->fwork[42] = 0.0f; @@ -4505,7 +4504,7 @@ void func_i5_80193DF0(Boss* boss) { boss->fwork[41] = 0.0f; boss->fwork[42] = 0.0f; boss->swork[24] = 0; - func_8001A55C(boss->sfxPos, 0x39435830); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x39435830); } } Math_SmoothStepToF(boss->fwork, 0.5f, 1.0f, 0.02f, 0.0f); @@ -4547,7 +4546,7 @@ void func_i5_80193DF0(Boss* boss) { } D_i5_801BBEF0[6] = 2; if (boss->unk_04C == 0x1E) { - func_8001A55C(boss->sfxPos, 0x11003023); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x11003023); D_i5_801BBEF0[7] = 0; boss->obj.status = OBJ_DYING; D_i5_801BBEF4[12] = 0.0f; @@ -4665,11 +4664,11 @@ void func_i5_80193DF0(Boss* boss) { boss->swork[1] = 0xD; boss->unk_04C = 0; if (boss->swork[25] != 0) { - func_8001A55C(boss->sfxPos, 0x3143102F); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x3143102F); boss->swork[25] = 0; } if (boss->swork[24] != 0) { - func_8001A55C(boss->sfxPos, 0x39435830); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x39435830); boss->swork[24] = 0; } } @@ -4710,14 +4709,14 @@ void func_i5_80193DF0(Boss* boss) { } } if ((boss->state == 6) && ((boss->unk_04C == 0x86) || (boss->unk_04C == 0xBC))) { - Audio_PlaySfx(0x29406029, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29406029, boss->sfxSource, 4); boss->swork[39] = 4; D_80178480 = 7; } if (boss->state >= 7) { if (((boss->fwork[0xF] > 0.0f) && (boss->fwork[9] <= 0.0f)) || ((boss->fwork[0xC] > 0.0f) && (boss->fwork[6] <= 0.0f))) { - Audio_PlaySfx(0x29406029, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29406029, boss->sfxSource, 4); if (boss->state == 0xC) { boss->swork[39] = 4; D_80178480 = 0x14; @@ -4750,7 +4749,7 @@ void func_i5_80197A94(Boss* boss) { boss->swork[38]++; if ((boss->dmgType != 0) && (((boss->state >= 0) && (boss->state <= 1)) || ((boss->state >= 4) && (boss->state <= 6)))) { - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); boss->dmgType = DMG_NONE; } if ((gPlayer[0].unk_1D4 != 0) && (boss->swork[39] > 0)) { @@ -4829,8 +4828,8 @@ void func_i5_80197A94(Boss* boss) { break; case 1: if (boss->swork[31] == 1) { - func_800182F4(0x105A00FF); - func_800182F4(0x115A00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 90); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 90); } break; case 2: @@ -5183,9 +5182,9 @@ void func_i5_801990DC(Boss* boss) { Actor* actor; if (boss->unk_044 == 0) { - Audio_PlaySfx(0x2940902D, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + AUDIO_PLAY_SFX(0x2940902D, boss->sfxSource, 4); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); func_8007A568(boss->obj.pos.x, boss->obj.pos.y + 250.0f, boss->obj.pos.z, 40.0f); func_80042EC0(boss); gShowBossHealth = 0; @@ -5306,7 +5305,7 @@ void func_i5_801990DC(Boss* boss) { break; } if ((boss->timer_050 == 0) && (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3)) { - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); gPlayer[0].state_1C8 = PLAYERSTATE_1C8_7; gPlayer[0].unk_1D0 = 0; } diff --git a/src/overlays/ovl_i5/fox_ti_cs.c b/src/overlays/ovl_i5/fox_ti_cs.c index 9d8356c6..93fd697b 100644 --- a/src/overlays/ovl_i5/fox_ti_cs.c +++ b/src/overlays/ovl_i5/fox_ti_cs.c @@ -19,7 +19,7 @@ void func_i5_80187530(Actor* actor) { actor->obj.rot.y = 180.0f; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x11030010U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010U, actor->sfxSource, 0U); actor->unk_0B6 = 1; } @@ -35,7 +35,7 @@ void func_i5_801875D0(Actor* actor, s32 arg1) { actor->obj.rot.y = 180.0f; actor->iwork[11] = 1; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } void func_i5_8018769C(Player* player) { @@ -94,7 +94,7 @@ void func_i5_8018769C(Player* player) { if (gCsFrameCount == 430) { player->unk_1D0 = 2; player->timer_1F8 = 10; - Audio_PlaySfx(0x09000002U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002U, player->sfxSource, 0U); } gCsCamAtX = player->pos.x; gCsCamAtY = player->pos.y; @@ -206,14 +206,14 @@ void func_i5_8018769C(Player* player) { if (D_80177A10[0] == 0) { D_80177A10[0]++; - Audio_PlaySfx(0x01008016U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x01008016U, player->sfxSource, 0U); } } if (player->pos.y < 100.0f) { func_8007A900(RAND_FLOAT_CENTERED(30.0f) + player->pos.x, 30.0f, RAND_FLOAT_CENTERED(30.0f) + player->unk_138, RAND_FLOAT(2.0f) + 3.5f, 255, 12, 1); - Object_Kill(&gActors[3].obj, gActors[3].sfxPos); + Object_Kill(&gActors[3].obj, gActors[3].sfxSource); } Math_SmoothStepToF(&player->unk_0F0, SIN_DEG(gGameFrameCount * 5.0f) * 10.0f, 0.1f, 100.0f, 0.0f); @@ -228,7 +228,7 @@ void func_i5_8018769C(Player* player) { func_800A594C(); D_8017782C = 0; if ((gControllerHold[player->num].button & Z_TRIG) && (gControllerHold[player->num].button & R_TRIG)) { - func_8001A55C(player->sfxPos, 0x01008016); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x01008016); } } break; @@ -273,11 +273,11 @@ void func_i5_80188108(Actor* actor, s32 arg1) { actor->unk_0C9 = 1; actor->fwork[3] = D_i5_801B7348[arg1]; actor->state = 30; - Audio_PlaySfx(0x3100000CU, actor->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000CU, actor->sfxSource, 4U); } else { actor->unk_0B6 = 1; actor->state = 20; - Audio_PlaySfx(0x11030010U, actor->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010U, actor->sfxSource, 0U); actor->fwork[9] = 20.0f; } } @@ -313,7 +313,7 @@ void func_i5_801882CC(Player* player) { func_i5_80188108(&gActors[2], 2); } - func_8001A55C(player->sfxPos, 0x01004024U); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x01004024U); case 1: Math_SmoothStepToF(D_80177A48, 0.1f, 1.0f, 0.01f, 0.0f); @@ -422,7 +422,7 @@ void func_i5_801882CC(Player* player) { break; case 50: - func_8001D444(0U, 0x26U, 0U, 0xFFU); + AUDIO_PLAY_BGM(SEQ_ID_38); break; case 80: @@ -499,7 +499,7 @@ void func_i5_801882CC(Player* player) { D_80161A44 = 30000.0f; player->unk_240 = 1; func_8001CA24(0); - Audio_PlaySfx(0x01008016U, player->sfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x01008016U, player->sfxSource, 0U); break; } @@ -513,8 +513,8 @@ void func_i5_801882CC(Player* player) { player->camAt.y += camAtY; if (gCsFrameCount == 1380) { - func_800182F4(0x103C00FF); - func_800182F4(0x113C00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 60); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 60); } if (gCsFrameCount > 1440) { @@ -525,7 +525,7 @@ void func_i5_801882CC(Player* player) { player->state_1C8 = PLAYERSTATE_1C8_6; D_8017837C = 4; func_800A6148(); - func_8001DBD0(10); + Audio_FadeOutAll(10); D_800D3180[LEVEL_TITANIA] = Play_CheckMedalStatus(150) + 1; } } diff --git a/src/overlays/ovl_i6/fox_andross.c b/src/overlays/ovl_i6/fox_andross.c index 3128b350..b57ad15f 100644 --- a/src/overlays/ovl_i6/fox_andross.c +++ b/src/overlays/ovl_i6/fox_andross.c @@ -325,7 +325,7 @@ void func_i6_80188468(void) { actor->iwork[14] = 1; actor->obj.id = OBJ_ACTOR_199; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } void func_i6_80188528(Actor* actor) { @@ -334,10 +334,10 @@ void func_i6_80188528(Actor* actor) { Math_SmoothStepToF(&actor->vel.z, 0.0f, 0.2f, 0.5f, 0.0f); if (actor->unk_0D0 != 0) { func_8007A6F0(&actor->obj.pos, 0x2903A008); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_8007B344(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 3.0f, 5); } else if (actor->timer_0BC == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } actor->obj.rot.y = RAD_TO_DEG(-gPlayer[0].unk_058); actor->obj.rot.x = RAD_TO_DEG(gPlayer[0].unk_05C); @@ -405,7 +405,7 @@ void func_i6_801888F4(Actor* actor) { } func_8007A6F0(&actor->obj.pos, 0x2903B009); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); BonusText_Display(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 5); gHitCount += 6; D_80177850 = 15; @@ -430,12 +430,11 @@ void func_i6_80188A4C(Boss* boss) { if (boss->swork[4] == 0) { boss->swork[2] = 10; boss->swork[3] = 15; - Audio_PlaySfx(0x2943500FU, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2943500FU, boss->sfxSource, 4); boss->health -= boss->damage; if ((boss->health != 0) && (boss->health <= 0)) { D_Timer_80161A60 = 8; - Audio_PlaySfx(0x2940D09AU, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940D09AU, boss->sfxSource, 4); func_80042EC0(boss); gPlayer[0].state_1C8 = PLAYERSTATE_1C8_0; boss->state = 20; @@ -445,10 +444,10 @@ void func_i6_80188A4C(Boss* boss) { D_80177A48[0] = 0.0f; D_80177A48[1] = 0.1f; gCsFrameCount = 0; - func_8001A55C(boss->sfxPos, 0x11034074U); - func_8001A55C(boss->sfxPos, 0x31408097U); - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x11034074U); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x31408097U); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); } } break; @@ -461,8 +460,7 @@ void func_i6_80188A4C(Boss* boss) { boss->timer_050 = 50; boss->fwork[3] = gPlayer[0].pos.x; boss->fwork[5] = gPlayer[0].unk_138; - Audio_PlaySfx(0x2940B096U, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940B096U, boss->sfxSource, 4); } } break; @@ -614,7 +612,7 @@ void func_i6_8018933C(Actor* actor) { if ((fabsf(actor->obj.pos.x - gPlayer[0].pos.x) < 1000.0f) && (fabsf(actor->obj.pos.z - gPlayer[0].unk_138) < 1000.0f)) { D_Timer_80177B44 = 50; - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } @@ -650,14 +648,14 @@ void func_i6_80189470(Actor* actor) { (fabsf(actor->obj.pos.z - gPlayer[0].unk_138) < 9000.0f)) { D_80177AB0 = 7; Radio_PlayMessage(gMsg_ID_19370, RCID_JAMES); - func_800182F4(0x101400FF); - func_800182F4(0x111400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 20); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 20); } if ((gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3) && (fabsf(actor->obj.pos.x - gPlayer[0].pos.x) < 500.0f) && (fabsf(actor->obj.pos.z - gPlayer[0].unk_138) < 500.0f)) { - func_8001A838(0x11403076); - func_8001D400(0); + Audio_KillSfxById(0x11403076); + Audio_SetBaseSfxReverb(0); gCurrentLevel = LEVEL_VENOM_2; D_8017827C = 1; D_800D2F68 = 1; @@ -766,7 +764,7 @@ void func_i6_80189B00(f32 xPos, f32 yPos, f32 zPos, f32 scale2) { } extern f32 D_800C9C30; -extern u16 D_800C9E90[][2]; +extern s32 D_800C9E90[]; void func_i6_801876FC(void); @@ -800,7 +798,7 @@ void func_i6_80189B70(Boss* boss) { (fabsf(boss->obj.pos.z - gPlayer[0].unk_138) < 300.0f) && (boss->state < 11) && (boss->timer_05A == 0)) { boss->state = 11; boss->timer_050 = 150; - Audio_PlaySfx(0x31408097, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31408097, boss->sfxSource, 4); } switch (boss->state) { @@ -812,7 +810,7 @@ void func_i6_80189B70(Boss* boss) { func_i6_80189098(boss); boss->swork[5] = 300; boss->state++; - Audio_PlaySfx(0x11034074, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11034074, boss->sfxSource, 4); boss->fwork[21] = 255.0f; boss->fwork[22] = 255.0f; boss->fwork[23] = 0.0f; @@ -883,7 +881,7 @@ void func_i6_80189B70(Boss* boss) { gPlayer[0].unk_238 = 1; Math_SmoothStepToF(&D_800CA230, 0.15f, 0.2f, 0.004f, 0.0f); if (boss->timer_050 == 120) { - Audio_PlaySfx(0x1940306E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306E, boss->sfxSource, 4); } if (boss->timer_050 == 0) { gPlayer[0].unk_0D0 = D_80161A54; @@ -897,7 +895,7 @@ void func_i6_80189B70(Boss* boss) { } else { boss->state = 3; } - func_8001A55C(boss->sfxPos, 0x31408097); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x31408097); } break; case 3: @@ -924,7 +922,7 @@ void func_i6_80189B70(Boss* boss) { boss->obj.pos.z = boss->fwork[5] + sp64.z; boss->unk_078.y = Math_RadToDeg(Math_Atan2F(xDisplacement, zDisplacement)); boss->state = 13; - Audio_PlaySfx(0x1940306E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306E, boss->sfxSource, 4); boss->timer_054 = 90; } break; @@ -982,7 +980,7 @@ void func_i6_80189B70(Boss* boss) { for (i = 0; i < ARRAY_COUNT(gActors); i++) { if ((gActors[i].obj.status == OBJ_ACTIVE) && (gActors[i].obj.id == OBJ_ACTOR_286)) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } D_80177AB0 = 4; @@ -1045,8 +1043,8 @@ void func_i6_80189B70(Boss* boss) { gPlayer[0].unk_014 = 1.0f; func_800B7184(gPlayer, 1); func_8001C8B8(0); - func_8001D444(0, D_800C9E90[gCurrentLevel][1], 0, 0xFF); - Audio_PlaySfx(0x11403076, gDefaultSfxPos, 0U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_BGM(D_800C9E90[gCurrentLevel]); + AUDIO_PLAY_SFX(0x11403076, gDefaultSfxSource, 0); D_80177CA4 = gHitCount; break; @@ -1054,7 +1052,7 @@ void func_i6_80189B70(Boss* boss) { Radio_PlayMessage(gMsg_ID_19340, RCID_JAMES); break; case 1000: - func_8001D400(0); + Audio_SetBaseSfxReverb(0); break; case 1300: Radio_PlayMessage(gMsg_ID_19355, RCID_JAMES); @@ -1142,10 +1140,10 @@ void func_i6_80189B70(Boss* boss) { if (boss->swork[5] != 0) { boss->swork[5]--; if (boss->swork[5] == 0) { - Audio_PlaySfx(0x11032075, gActors[10].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x11032075, gActors[11].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x3103108B, gActors[10].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x3103108B, gActors[11].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11032075, gActors[10].sfxSource, 4); + AUDIO_PLAY_SFX(0x11032075, gActors[11].sfxSource, 4); + AUDIO_PLAY_SFX(0x3103108B, gActors[10].sfxSource, 4); + AUDIO_PLAY_SFX(0x3103108B, gActors[11].sfxSource, 4); } gActors[10].obj.pos.x = boss->obj.pos.x + 200.0f; gActors[10].obj.pos.y = boss->obj.pos.y - 200.0f; @@ -1498,7 +1496,7 @@ void func_i6_8018CAD4(Effect* effect) { effect->vel.z = vel.z - D_80177D08; if ((fabsf(effect->obj.pos.x - gBosses[0].obj.pos.x) <= 100.0f) && (fabsf(effect->obj.pos.z - (gBosses[0].obj.pos.z - 100.0f)) <= 100.0f)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } else { effect->info.unk_10 = 100.0f; @@ -1509,7 +1507,7 @@ void func_i6_8018CAD4(Effect* effect) { if (effect->unk_44 != 0) { func_8007D0E0(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 10.0f); func_8007A6F0(&effect->obj.pos, 0x2903A008); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } effect->unk_44 = 0; @@ -1519,7 +1517,7 @@ void func_i6_8018CAD4(Effect* effect) { if (effect->unk_44 != 0) { func_8007D0E0(effect->obj.pos.x, effect->obj.pos.y, effect->obj.pos.z, 10.0f); func_8007A6F0(&effect->obj.pos, 0x2903A008); - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); if (Rand_ZeroOne() < 0.1f) { item = gItems; for (i = 0; i < 20; i++, item++) { @@ -1550,7 +1548,7 @@ void func_i6_8018CAD4(Effect* effect) { Math_SmoothStepToF(&effect->vel.x, 0.0f, 0.05f, 0.5f, 0.0f); effect->unk_44 -= 10; if (effect->unk_44 < 0) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } break; } @@ -1588,7 +1586,7 @@ void func_i6_8018D0D8(Boss* boss) { } void func_i6_8018D16C(Boss* boss) { - func_8001D400(0x18); + Audio_SetBaseSfxReverb(0x18); D_i6_801A7F5C = D_i6_801A7F64 = D_i6_801A7F6C = D_i6_801A7F74 = D_i6_801A7F7C = D_i6_801A8430 = 0.0f; D_800C9C30 = 0.0f; boss->health = 100; @@ -1607,7 +1605,7 @@ void func_i6_8018D16C(Boss* boss) { D_80177AB0 = 1; boss->info.hitbox[16] = 200.0f; boss->info.hitbox[22] = 200.0f; - func_8001D444(0, 0x8021, 0, 0); + Audio_PlaySequence(SEQ_PLAYER_BGM, SEQ_ID_33 | 0x8000, 0, 0); } void func_i6_8018D2B0(Boss* boss) { @@ -1623,25 +1621,25 @@ void func_i6_8018D2B0(Boss* boss) { if ((boss->state == 9) || (boss->state == 10)) { if (boss->health <= 0) { D_Timer_80161A60 = 8; - Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31009063, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x19403070, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_8001A55C(boss->sfxPos, 0x11030073); - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + AUDIO_PLAY_SFX(0x2940D09A, boss->sfxSource, 4); + AUDIO_PLAY_SFX(0x31009063, boss->sfxSource, 4); + AUDIO_PLAY_SFX(0x19403070, boss->sfxSource, 4); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x11030073); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); boss->state = 31; boss->timer_050 = 200; gPlayer[0].state_1C8 = PLAYERSTATE_1C8_7; gPlayer[0].unk_1D0 = 0; } else if (boss->health < 50) { - Audio_PlaySfx(0x2943500F, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2943500F, boss->sfxSource, 4); } else { - Audio_PlaySfx(0x29034003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, boss->sfxSource, 4); } } else if (boss->health <= 0) { - Audio_PlaySfx(0x19403070, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + AUDIO_PLAY_SFX(0x19403070, boss->sfxSource, 4); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); if (D_8017827C == 0) { boss->state = 30; } else { @@ -1652,7 +1650,7 @@ void func_i6_8018D2B0(Boss* boss) { gCsFrameCount = 0; boss->timer_05C = 100; } else { - Audio_PlaySfx(0x29034003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, boss->sfxSource, 4); } } } @@ -1662,14 +1660,14 @@ void func_i6_8018D2B0(Boss* boss) { if (boss->state < 11) { boss->swork[6] -= boss->damage; boss->swork[0] = 30; - Audio_PlaySfx(0x29034003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, boss->sfxSource, 4); if (boss->swork[6] <= 0) { boss->swork[6] = 100; boss->state = 12; boss->timer_050 = 120; boss->unk_04C = 0; boss->fwork[9] = 0.0f; - Audio_PlaySfx(0x1940306F, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306F, boss->sfxSource, 4); } } break; @@ -1677,14 +1675,14 @@ void func_i6_8018D2B0(Boss* boss) { if (boss->state < 12) { boss->swork[6] -= boss->damage; boss->swork[1] = 30; - Audio_PlaySfx(0x29034003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, boss->sfxSource, 4); if (boss->swork[6] <= 0) { boss->swork[6] = 100; boss->state = 13; boss->timer_050 = 120; boss->unk_04C = 0; boss->fwork[9] = 0.0f; - Audio_PlaySfx(0x1940306F, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306F, boss->sfxSource, 4); } } break; @@ -1788,7 +1786,7 @@ void func_i6_8018DA94(Boss* boss, Vec3f* arg1) { RAND_FLOAT(0.5f) + 1.0f); } func_8007B344(arg1->x, arg1->y, arg1->z, 10.0f, 5); - Audio_PlaySfx(0x2903B009, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903B009, boss->sfxSource, 4); } extern Animation D_C00208C; @@ -1948,7 +1946,7 @@ void func_i6_8018DBF0(Boss* boss) { case 1: boss->timer_05A = 100; if (boss->timer_054 == 65) { - Audio_PlaySfx(0x1940306E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306E, boss->sfxSource, 4); } if (boss->timer_050 != 0) { boss->fwork[6] = -3000.0f; @@ -2018,7 +2016,7 @@ void func_i6_8018DBF0(Boss* boss) { boss->fwork[0] = player->pos.x; boss->fwork[3] = player->pos.y + 1000.0f; if (boss->unk_04C == 60) { - Audio_PlaySfx(0x1940306A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306A, boss->sfxSource, 4); } if (boss->unk_04C > 60) { if (boss->unk_04C == 76) { @@ -2066,7 +2064,7 @@ void func_i6_8018DBF0(Boss* boss) { boss->fwork[0] = player->pos.x; boss->fwork[3] = player->pos.y; if (boss->unk_04C == 55) { - Audio_PlaySfx(0x1940306A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306A, boss->sfxSource, 4); } if (boss->unk_04C > 55) { boss->fwork[6] = -1500.0f; @@ -2121,7 +2119,7 @@ void func_i6_8018DBF0(Boss* boss) { Math_SmoothStepToF(&boss->fwork[1], 2.0f, 1.0f, 1.0f, 0); Math_SmoothStepToF(&boss->fwork[4], 2.0f, 1.0f, 1.0f, 0); if (boss->unk_04C == 5) { - Audio_PlaySfx(0x1940306B, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306B, boss->sfxSource, 4); } boss->swork[7] = 1; boss->fwork[14] = 100.0f; @@ -2139,7 +2137,7 @@ void func_i6_8018DBF0(Boss* boss) { func_i6_8018D9C0(boss); } else { if (boss->timer_050 == 1) { - Audio_PlaySfx(0x1940306C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306C, boss->sfxSource, 4); } if (boss->timer_050 != 0) { boss->fwork[6] = -4000.0f; @@ -2167,7 +2165,7 @@ void func_i6_8018DBF0(Boss* boss) { Math_SmoothStepToF(&boss->fwork[13], 80.0f, 1.0f, 15.0f, 0); } if (boss->unk_04C == 25) { - Audio_PlaySfx(0x09008015, D_i6_801A67B8, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09008015, D_i6_801A67B8, 4); } } Math_SmoothStepToF(&boss->fwork[9], 1.0f, 1.0f, 0.01f, 0); @@ -2183,7 +2181,7 @@ void func_i6_8018DBF0(Boss* boss) { func_i6_8018D9C0(boss); } else { if (boss->unk_04C == 48) { - Audio_PlaySfx(0x3103108B, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3103108B, boss->sfxSource, 4); } if (boss->unk_04C > 48) { func_i6_8018D0D8(boss); @@ -2316,10 +2314,10 @@ void func_i6_8018DBF0(Boss* boss) { boss->fwork[3] = 0.0f; Math_SmoothStepToF(&boss->fwork[9], 1.0f, 1.0f, 0.01f, 0); if (boss->unk_04C == 15) { - Audio_PlaySfx(0x29022088, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29022088, boss->sfxSource, 4); } if ((boss->unk_04C > 35) && (boss->unk_04C < 150) && !(boss->unk_04C & 0x1F)) { - Audio_PlaySfx(0x29022089, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29022089, boss->sfxSource, 4); if (player->state_1C8 == PLAYERSTATE_1C8_11) { D_Timer_80177BD0[0] = 10; } @@ -2328,7 +2326,7 @@ void func_i6_8018DBF0(Boss* boss) { player->unk_234 = 0; for (i = 0; i < ARRAY_COUNT(gEffects); i++) { if (gEffects[i].obj.id == OBJ_EFFECT_396) { - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); } } } @@ -2377,7 +2375,7 @@ void func_i6_8018DBF0(Boss* boss) { limbCount = Animation_GetFrameData(&D_C023B54, boss->unk_04C, spD0); Math_SmoothStepToVec3fArray(spD0, D_i6_801A7F80, 1, limbCount, boss->fwork[9], 100.0f, 0.0f); if (boss->unk_04C == 10) { - Audio_PlaySfx(0x3140208A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3140208A, boss->sfxSource, 4); } if ((boss->unk_04C == 13) && (player->state_1C8 == PLAYERSTATE_1C8_11)) { player->unk_234 = 1; @@ -2434,12 +2432,12 @@ void func_i6_8018DBF0(Boss* boss) { (playerShot->unk_5C == 0) && (fabsf(playerShot->obj.pos.x - boss->obj.pos.x) < 200.0f) && (fabsf(playerShot->obj.pos.y - (boss->obj.pos.y - 100.0f)) < 200.0f) && (fabsf(playerShot->obj.pos.z - (boss->obj.pos.z - 200.0f)) < 100.0f)) { - Object_Kill(&playerShot->obj, playerShot->sfxPos); + Object_Kill(&playerShot->obj, playerShot->sfxSource); boss->state = 15; boss->fwork[9] = 0.2f; boss->unk_04C = 0; boss->swork[8] = 2; - Audio_PlaySfx(0x1940306D, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940306D, boss->sfxSource, 4); break; } } @@ -2454,7 +2452,7 @@ void func_i6_8018DBF0(Boss* boss) { if ((fabsf(effect->obj.pos.x - boss->obj.pos.x) < 200.0f) && (fabsf(effect->obj.pos.y - (boss->obj.pos.y - 100.0f)) < 200.0f) && (fabsf(effect->obj.pos.z - (boss->obj.pos.z - 200.0f)) < 100.0f)) { - Object_Kill(&effect->obj, effect->sfxPos); + Object_Kill(&effect->obj, effect->sfxSource); } } } @@ -2484,7 +2482,7 @@ void func_i6_8018DBF0(Boss* boss) { Math_SmoothStepToF(&boss->fwork[7], 20.0f, 0.1f, 0.1f, 0); Math_SmoothStepToF(&boss->fwork[9], 1.0f, 1.0f, 0.01f, 0); if (boss->unk_04C == 10) { - Audio_PlaySfx(0x31022087, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31022087, boss->sfxSource, 4); } boss->unk_04C++; if (boss->unk_04C >= Animation_GetFrameCount(&D_C0240D0)) { @@ -2520,7 +2518,7 @@ void func_i6_8018DBF0(Boss* boss) { boss->timer_050 = 30; boss->swork[9] = 20; boss->fwork[9] = 0.0f; - func_8001CE28(0, boss->sfxPos); + func_8001CE28(0, boss->sfxSource); boss->timer_05C = 50; } break; @@ -2532,7 +2530,7 @@ void func_i6_8018DBF0(Boss* boss) { boss->unk_044 = 2; boss->timer_050 = 70; boss->fwork[9] = 0.0f; - Audio_PlaySfx(0x1940307C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1940307C, boss->sfxSource, 4); } if (boss->timer_050 == 15) { boss->swork[10] = 80; @@ -2628,8 +2626,8 @@ void func_i6_8018DBF0(Boss* boss) { boss->health = 100; boss->timer_050 = 50; boss->fwork[9] = 0.0f; - Audio_PlaySfx(0x11030073, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_8001D444(0, 0x8021, 0, 0xFF); + AUDIO_PLAY_SFX(0x11030073, boss->sfxSource, 4); + AUDIO_PLAY_BGM(SEQ_ID_33 | 0x8000); break; } break; @@ -2788,7 +2786,7 @@ void func_i6_8018DBF0(Boss* boss) { boss1->timer_050 = 180; boss1->unk_3F8 = 5.0f; Object_SetInfo(&boss1->info, boss1->obj.id); - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); D_80177AB0 = 3; func_i6_80189098(boss); Radio_PlayMessage(gMsg_ID_19330, RCID_ANDROSS_RED); @@ -2836,10 +2834,10 @@ void func_i6_8018DBF0(Boss* boss) { boss->info.hitbox[9] = boss->vwork[3].y - boss->obj.pos.y; boss->info.hitbox[11] = boss->vwork[3].x - boss->obj.pos.x; if ((initialstate == 17) && (boss->state != 17)) { - func_8001A55C(boss->sfxPos, 0x31022087); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x31022087); } if ((initialstate == 7) && (boss->state != 7)) { - func_8001A55C(boss->sfxPos, 0x3103108B); + Audio_KillSfxBySourceAndId(boss->sfxSource, 0x3103108B); } } @@ -3259,7 +3257,7 @@ void func_i6_80192E94(Actor* actor) { actor->vwork[0].z = actor->obj.pos.z; actor->health = 30; actor->unk_0F4.z = actor->obj.rot.z; - Audio_PlaySfx(0x11000028, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11000028, actor->sfxSource, 0); break; case 1: otherActor = gActors; @@ -3300,7 +3298,7 @@ void func_i6_80192E94(Actor* actor) { RAND_FLOAT_CENTERED(10.0f) + actor->obj.pos.y, actor->obj.pos.z, RAND_FLOAT(0.5f) + 0.5f); } func_8007A6F0(&actor->obj.pos, 0x2903A008); - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } } } @@ -3372,7 +3370,7 @@ void func_i6_8019356C(Object_80* obj80) { obj80->obj.rot.z = D_i6_801A7F68; obj80->obj.pos.z += obj80->unk_60; if (obj80->timer_4C == 1) { - Object_Kill(&obj80->obj, obj80->sfxPos); + Object_Kill(&obj80->obj, obj80->sfxSource); } } @@ -3423,9 +3421,9 @@ void func_i6_80193710(void) { Object_58_Initialize(obj58); obj58->obj.status = OBJ_ACTIVE; obj58->obj.id = D_80178310[i].id; - obj58->sfxPos[0] = obj58->obj.pos.x = D_80178310[i].xPos; - obj58->sfxPos[1] = obj58->obj.pos.y = D_80178310[i].yPos; - obj58->sfxPos[2] = obj58->obj.pos.z = -D_80178310[i].zPos1; + obj58->sfxSource[0] = obj58->obj.pos.x = D_80178310[i].xPos; + obj58->sfxSource[1] = obj58->obj.pos.y = D_80178310[i].yPos; + obj58->sfxSource[2] = obj58->obj.pos.z = -D_80178310[i].zPos1; obj58->unk_54 = obj58->obj.rot.y = D_80178310[i].rot.y; Object_SetInfo(&obj58->info, obj58->obj.id); obj58++; @@ -3479,8 +3477,8 @@ void func_i6_801939A0(s32 actorIndex) { actor->unk_0B6 = 1000; } Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); } static Vec3f D_i6_801A6878[4] = { @@ -3503,14 +3501,14 @@ void func_i6_80193AE4(s32 actorIndex) { if (actorIndex == 0) { actor->state = 200; actor->unk_0B6 = 1; - Audio_PlaySfx(0x11030010, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, actor->sfxSource, 0); return; } actor->iwork[11] = 1; actor->fwork[7] = RAND_FLOAT(360.0f); actor->fwork[8] = RAND_FLOAT(360.0f); actor->state = 100; - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } //! @bug This references a variable in another overlay, causing undefined behavior. @@ -3570,12 +3568,12 @@ void func_i6_80193C4C(Player* player) { func_8007B344(boss->obj.pos.x, boss->obj.pos.y, boss->obj.pos.z, 250.0f, 6); break; case 86: - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); D_80177AB0 = 0; break; case 111: player->unk_1D0 = 2; - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); player->unk_190 = player->unk_194 = 7.0f; D_80177A48[0] = 0.0f; D_80177A48[1] = 0.0f; @@ -3598,8 +3596,8 @@ void func_i6_80193C4C(Player* player) { sp68.y = RAND_FLOAT_CENTERED(150.0f); sp68.z = 0.0f; if (gCsFrameCount == 50) { - Audio_PlaySfx(0x11403071, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_8001D400(0); + AUDIO_PLAY_SFX(0x11403071, player->sfxSource, 0); + Audio_SetBaseSfxReverb(0); } if (gCsFrameCount > 40) { sp90 = 1; @@ -3661,7 +3659,7 @@ void func_i6_80193C4C(Player* player) { case 60: for (i = 0; i < ARRAY_COUNT(gEffects); i++) { if ((gEffects[i].obj.id == OBJ_EFFECT_383) && (gEffects[i].obj.status == OBJ_ACTIVE)) { - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); break; } } @@ -3673,11 +3671,11 @@ void func_i6_80193C4C(Player* player) { } break; case 150: - Audio_PlaySfx(0x1900602A, gDefaultSfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900602A, gDefaultSfxSource, 0); break; case 340: - func_8001A55C(player->sfxPos, 0x11403071); - func_8001D400(0); + Audio_KillSfxBySourceAndId(player->sfxSource, 0x11403071); + Audio_SetBaseSfxReverb(0); D_800D2F68 = 0; gBlurAlpha = 0xFF; gCurrentLevel = LEVEL_VENOM_2; @@ -3725,7 +3723,7 @@ void func_i6_80193C4C(Player* player) { } if (gCsFrameCount == 40) { func_i6_801939A0(10); - Audio_PlaySfx(0x2940F026, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940F026, boss->sfxSource, 4); D_80178480 = 30; gOverlayStage = 1; D_Timer_80177BD0[0] = 30; @@ -3746,7 +3744,7 @@ void func_i6_80193C4C(Player* player) { } if (gCsFrameCount == 70) { - func_8001D444(0, 0x8040, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_64 | 0x8000); } if (gCsFrameCount == 150) { player->unk_1D0++; @@ -3980,7 +3978,7 @@ void func_i6_80193C4C(Player* player) { } } if (gCsFrameCount == 1400) { - func_8001DBD0(40); + Audio_FadeOutAll(40); } if (gCsFrameCount > 1400) { D_8017835C = 4; @@ -3990,7 +3988,7 @@ void func_i6_80193C4C(Player* player) { gNextGameState = GSTATE_CREDITS; D_ending_80196D00 = 0; D_800D3180[LEVEL_VENOM_ANDROSS] = Play_CheckMedalStatus(200) + 1; - func_8001DC6C(0, 0x1B); + Audio_SetAudioSpec(0, 0x1B); } } break; @@ -4076,7 +4074,7 @@ void func_i6_80195E44(Actor* actor) { actor->unk_046 -= 5; if (actor->unk_046 < 0) { actor->unk_046 = 0; - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); } break; case 101: diff --git a/src/overlays/ovl_i6/fox_i6_4.c b/src/overlays/ovl_i6/fox_i6_4.c index 8b155724..7d2ed2b0 100644 --- a/src/overlays/ovl_i6/fox_i6_4.c +++ b/src/overlays/ovl_i6/fox_i6_4.c @@ -61,7 +61,7 @@ void func_i6_801A581C(Player* player, f32 xOffset) { for (i = 0; i < ARRAY_COUNT(gPlayerShots); i++) { if (gPlayerShots[i].obj.status == 0) { func_i6_801A5560(player, &gPlayerShots[i], xOffset, -100.0f, 200.0f, PLAYERSHOT_9, 100.0f); - func_800A6028(gPlayerShots[i].sfxPos, 0x09000000); + func_800A6028(gPlayerShots[i].sfxSource, 0x09000000); break; } } diff --git a/src/overlays/ovl_i6/fox_sy.c b/src/overlays/ovl_i6/fox_sy.c index fd075540..6b0d615a 100644 --- a/src/overlays/ovl_i6/fox_sy.c +++ b/src/overlays/ovl_i6/fox_sy.c @@ -61,7 +61,7 @@ void func_i6_80197B30(Actor* actor, s32 timer) { actor->timer_04C = timer; actor->iwork[11] = 1; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } void func_i6_80197C64(Effect* effect) { @@ -114,10 +114,10 @@ void func_i6_80197CC4(Boss* boss) { if (gPlayer[0].state_1C8 == PLAYERSTATE_1C8_3) { gPlayer[0].state_1C8 = PLAYERSTATE_1C8_9; gPlayer[0].unk_1D0 = 0; - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); } - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); } } @@ -196,7 +196,7 @@ void func_i6_80198244(Boss* boss) { } boss->fwork[10] = 181.0f; boss->fwork[34] = 2.8f; - Audio_PlaySfx(0x2902306C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, boss->sfxSource, 4); } void func_i6_801983E4(Boss* boss) { @@ -321,7 +321,7 @@ void func_i6_80198ABC(Boss* boss) { boss->fwork[41] = 1.8f; } } - Audio_PlaySfx(0x2902306C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, boss->sfxSource, 4); switch (D_80177A10[8]) { case 0: @@ -419,14 +419,14 @@ void func_i6_80198F5C(Boss* boss) { } gPlayer[0].unk_114 = 0.0f; } - Audio_PlaySfx(0x2940D09A, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_800182F4(0x101E00FF); - func_800182F4(0x111E00FF); + AUDIO_PLAY_SFX(0x2940D09A, boss->sfxSource, 4); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 30); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 30); return; } if ((gBosses[1].obj.status == OBJ_FREE) || (gBosses[2].obj.status == OBJ_FREE)) { - func_800182F4(0x101400FF); - func_800182F4(0x111400FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 20); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 20); } for (i = 4; i < 60; i++) { @@ -468,11 +468,11 @@ void func_i6_80198F5C(Boss* boss) { } } else { if (boss->index != 0) { - Audio_PlaySfx(0x2903300E, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, boss->sfxSource, 4); } else if (boss->health > 70) { - Audio_PlaySfx(0x29034003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29034003, boss->sfxSource, 4); } else { - Audio_PlaySfx(0x2943500F, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2943500F, boss->sfxSource, 4); } if ((gBosses[1].obj.status == OBJ_FREE) && (gBosses[2].obj.status == OBJ_FREE)) { func_8002E4F8(gMsg_ID_14350, RCID_BOSS_SECTORY); @@ -522,7 +522,7 @@ void func_i6_80199438(Boss* boss) { gHitCount += 4; } if (boss->timer_058 == 50) { - Audio_PlaySfx(0x2903A060, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903A060, boss->sfxSource, 4); D_80137E84[gMainController] = 1; D_Timer_80177BD0[gMainController] = 20; D_80177850 = 15; @@ -555,10 +555,10 @@ void func_i6_80199438(Boss* boss) { for (i = 0; i < 2; i++) { if (gEffects[i].obj.status != OBJ_FREE) { - Object_Kill(&gEffects[i].obj, gEffects[i].sfxPos); + Object_Kill(&gEffects[i].obj, gEffects[i].sfxSource); } } - Audio_KillSfx(boss->sfxPos); + Audio_KillSfxBySource(boss->sfxSource); gShowBossHealth = 0; func_8007A568(boss->obj.pos.x, boss->obj.pos.y, boss->obj.pos.z, 40.0f); func_8007D0E0(boss->obj.pos.x, boss->obj.pos.y, boss->obj.pos.z, 30.0f); @@ -577,7 +577,7 @@ void func_i6_80199438(Boss* boss) { } if (boss->timer_058 == 1) { if (boss->index != 0) { - Object_Kill(&gActors[D_80177A10[9]].obj, gActors[D_80177A10[9]].sfxPos); + Object_Kill(&gActors[D_80177A10[9]].obj, gActors[D_80177A10[9]].sfxSource); if ((gBosses[1].obj.status == OBJ_FREE) || (gBosses[2].obj.status == OBJ_FREE)) { gBosses[0].unk_04A = 1; gObjects58[0].info.dList = D_601F3D0; @@ -591,7 +591,7 @@ void func_i6_80199438(Boss* boss) { } } } - Object_Kill(&boss->obj, boss->sfxPos); + Object_Kill(&boss->obj, boss->sfxSource); } } else { if (boss->health < 80) { @@ -608,7 +608,7 @@ void func_i6_80199438(Boss* boss) { } func_8007D2C8(boss->obj.pos.x, boss->obj.pos.y, boss->obj.pos.z + 30.0f, 4.0f); boss->info.hitbox = SEGMENTED_TO_VIRTUAL(D_6034304); - Audio_PlaySfx(0x2903A06F, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903A06F, boss->sfxSource, 4); } } if (boss->health <= 80) { @@ -681,7 +681,7 @@ void func_i6_80199DAC(Boss* boss) { boss->fwork[12] = 320.0f; if (boss->timer_056 == 0) { boss->timer_056 = 51; - Audio_PlaySfx(0x2902306C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, boss->sfxSource, 4); } } @@ -737,7 +737,7 @@ void func_i6_8019A434(Boss* boss) { boss->fwork[13] = COS_DEG(boss->unk_078.y) * boss->fwork[45]; boss->fwork[12] = 30.0f; boss->fwork[10] = 181.0f; - Audio_PlaySfx(0x19031003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19031003, boss->sfxSource, 4); } void func_i6_8019A520(Boss* boss) { @@ -757,7 +757,7 @@ void func_i6_8019A520(Boss* boss) { } if ((boss->unk_04C == 0) || (boss->unk_04C == 27)) { - Audio_PlaySfx(0x29022019, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29022019, boss->sfxSource, 4); } } @@ -777,7 +777,7 @@ void func_i6_8019A66C(Boss* boss) { func_i6_8019BC14(boss); } if (boss->timer_056 == 60) { - Audio_PlaySfx(0x2902306C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, boss->sfxSource, 4); boss->fwork[34] = 4.5f; if (Rand_ZeroOne() > 0.5f) { func_8002E4F8(gMsg_ID_14330, 160); @@ -829,7 +829,7 @@ void func_i6_8019A898(Boss* boss) { Math_SmoothStepToAngle(&boss->unk_078.y, yAngle1, 0.1f, 2.0f, 0.1f); boss->fwork[0] = 1.0f; if ((boss->unk_04C == 0) || (boss->unk_04C == 27)) { - Audio_PlaySfx(0x29022019, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29022019, boss->sfxSource, 4); } } else { boss->timer_056 = 0; @@ -888,9 +888,9 @@ void func_i6_8019AAF0(Boss* boss) { if (boss->unk_04C >= boss->swork[32] - 29) { if (boss->unk_04C == boss->swork[32] - 29) { if (boss->swork[31] == 11) { - Audio_PlaySfx(0x2903401C, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903401C, boss->sfxSource, 4); } else { - Audio_PlaySfx(0x2902306D, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306D, boss->sfxSource, 4); } } if (boss->unk_04C >= (boss->swork[32] - 5)) { @@ -948,7 +948,7 @@ void func_i6_8019AEEC(Boss* boss) { if ((boss->obj.pos.y != 365.0f) && (boss->swork[21] != 1)) { if (boss->unk_04A != 0) { if (boss->unk_04A == 1) { - func_8001D444(0, 0x8041, 0, 0); + Audio_PlaySequence(SEQ_PLAYER_BGM, SEQ_ID_65 | 0x8000, 0, 0); boss->unk_04A++; gPlayer[0].camEye.x = 0.0f; gPlayer[0].camEye.y = 200.0f; @@ -965,7 +965,7 @@ void func_i6_8019AEEC(Boss* boss) { gActors[59].state = 6; } if (boss->obj.pos.y == 0.0f) { - Audio_PlaySfx(0x0100001D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x0100001D, gDefaultSfxSource, 4); } Math_SmoothStepToF(&boss->obj.pos.y, 365.0f, 0.1f, 5.0f, 0.1f); Math_SmoothStepToF(&gActors[59].obj.pos.y, 153.0f, 0.1f, 5.0f, 0.1f); @@ -975,7 +975,7 @@ void func_i6_8019AEEC(Boss* boss) { gBossHealthBar = boss->health * 1.7f; } if (boss->obj.pos.y == 365.0f) { - Audio_PlaySfx(0x09002013, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09002013, gDefaultSfxSource, 4); boss->timer_050 = 20; boss->timer_056 = 135; } @@ -989,7 +989,7 @@ void func_i6_8019AEEC(Boss* boss) { boss->swork[21] = 0; } if (boss->timer_056 == 95) { - Audio_PlaySfx(0x3102505A, gActors[59].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3102505A, gActors[59].sfxSource, 4); } if (boss->timer_056 < 96) { Math_SmoothStepToF(&gActors[59].fwork[0], 0.0f, 0.1f, 0.2f, 0.05f); @@ -1003,11 +1003,11 @@ void func_i6_8019AEEC(Boss* boss) { } } if (boss->timer_056 == 55) { - D_i6_801A8440[0] = boss->sfxPos[0]; - D_i6_801A8440[1] = boss->sfxPos[1]; + D_i6_801A8440[0] = boss->sfxSource[0]; + D_i6_801A8440[1] = boss->sfxSource[1]; D_i6_801A8440[2] = -500.0f; - Audio_PlaySfx(0x2902306C, D_i6_801A8440, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_KillSfx(gActors[59].sfxPos); + AUDIO_PLAY_SFX(0x2902306C, D_i6_801A8440, 4); + Audio_KillSfxBySource(gActors[59].sfxSource); boss->fwork[34] = 4.5f; gActors[59].vel.z = -40.0f; boss->vel.z = 120.0f; @@ -1196,9 +1196,9 @@ void func_i6_8019BC14(Boss* boss) { gPlayer[0].pos.y = sp48; gPlayer[0].unk_138 = gPlayer[0].pos.z = sp44; if (boss->index == 0) { - Audio_PlaySfx(0x2901306EU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2901306EU, boss->sfxSource, 4U); } else { - Audio_PlaySfx(0x2900306BU, boss->sfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900306BU, boss->sfxSource, 4U); } } } @@ -1296,11 +1296,11 @@ void func_i6_8019C194(Boss* boss, f32 zSpeed, f32 xSpeed) { if (sp2C > 0.0f) { if (boss->fwork[41] == 0.0f) { boss->fwork[41] = ABS(sp2C * 0.01f) + 0.8f; - Audio_PlaySfx(0x09000003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000003, boss->sfxSource, 4); } } else if (boss->fwork[42] == 0.0f) { boss->fwork[42] = ABS(sp2C * 0.01f) + 0.8f; - Audio_PlaySfx(0x09000003, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000003, boss->sfxSource, 4); } } } @@ -1346,7 +1346,7 @@ void func_i6_8019C888(Boss* boss) { } if ((boss->fwork[34] <= 1.0f) && (boss->fwork[34] > 0.5f)) { - Audio_KillSfx(boss->sfxPos); + Audio_KillSfxBySource(boss->sfxSource); } gBossFrameCount++; @@ -1540,7 +1540,7 @@ void func_i6_8019C888(Boss* boss) { if (boss->dmgPart == 0) { if (boss->swork[25] == 0) { boss->swork[24] = 15; - Audio_PlaySfx(0x29121007, boss->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, boss->sfxSource, 4); } else { func_i6_80198F5C(boss); } @@ -1920,7 +1920,7 @@ void func_i6_8019EB80(void) { actor->scale = 0.125f; } actor->iwork[11] = 1; - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); } } @@ -1960,12 +1960,12 @@ void func_i6_8019EE60(Player* player) { for (i = 10; i < ARRAY_COUNT(gActors); i++) { if (gActors[i].unk_0B6 == 0) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } - Object_Kill(&gActors[2].obj, gActors[2].sfxPos); - Object_Kill(&gActors[3].obj, gActors[3].sfxPos); - Object_Kill(&gActors[4].obj, gActors[4].sfxPos); + Object_Kill(&gActors[2].obj, gActors[2].sfxSource); + Object_Kill(&gActors[3].obj, gActors[3].sfxSource); + Object_Kill(&gActors[4].obj, gActors[4].sfxSource); player->unk_1D0++; D_80177A48[0] = 0.05f; if (Rand_ZeroOne() > 0.5f) { @@ -2009,7 +2009,7 @@ void func_i6_8019EE60(Player* player) { player->unk_1D0++; func_800A6148(); func_8001CA24(0); - Audio_KillSfx(player->sfxPos); + Audio_KillSfxBySource(player->sfxSource); D_80178340 = 250; player->timer_1F8 = 50; player->unk_0D0 = 0.0f; @@ -2026,7 +2026,7 @@ void func_i6_8019EE60(Player* player) { player->pos.z = 0.0f; player->unk_1D0++; func_8001C8B8(0); - func_8001D444(0, 0x26, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_38); D_80177A98 = 0; for (i = 0; i < 200; i++) { @@ -2055,10 +2055,10 @@ void func_i6_8019EE60(Player* player) { } if (gCsFrameCount == 343) { - Audio_PlaySfx(0x09000007, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000007, player->sfxSource, 0); } if (gCsFrameCount == 395) { - Audio_PlaySfx(0x09000013, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000013, player->sfxSource, 0); } D_80177A48[1] += D_80177A48[2]; Matrix_RotateY(gCalcMatrix, D_80177A48[1] * M_DTOR, 0); @@ -2101,7 +2101,7 @@ void func_i6_8019EE60(Player* player) { D_80178348 = D_80178350 = D_80178354 = 0; D_8017835C = 8; if (D_80178340 == 0xFF) { - func_8001DBD0(10); + Audio_FadeOutAll(10); player->state_1C8 = PLAYERSTATE_1C8_6; player->timer_1F8 = 0; D_8017837C = 4; @@ -2183,11 +2183,11 @@ void func_i6_8019EE60(Player* player) { D_80177830 = 0; break; case 1440: - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); player->unk_194 = 5.0f; player->unk_190 = 5.0f; - func_800182F4(0x103200FF); - func_800182F4(0x113200FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 50); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 50); break; case 1380: if (gTeamShields[3] > 0) { @@ -2249,7 +2249,7 @@ void func_i6_8019FF00(Actor* actor) { break; case 2: actor->state = 3; - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); actor->fwork[29] = 5.0f; /* fallthrough */ case 3: @@ -2276,7 +2276,7 @@ void func_i6_8019FF00(Actor* actor) { } else { if (gCsFrameCount == 540) { actor->fwork[29] = 3.8f; - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); } Math_SmoothStepToF(&actor->obj.pos.x, 230.0f, 1.0f, 13.0f, 0.0f); } @@ -2286,7 +2286,7 @@ void func_i6_8019FF00(Actor* actor) { if (gCsFrameCount >= 535) { if (gCsFrameCount == 535) { actor->fwork[29] = 3.8f; - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); } Math_SmoothStepToF(&actor->obj.pos.x, -1000.0f, 1.0f, 20.0f, 0.0f); Math_SmoothStepToAngle(&actor->unk_0F4.z, 45.0f, 1.0f, 4.0f, 0.0f); @@ -2301,7 +2301,7 @@ void func_i6_8019FF00(Actor* actor) { if (gCsFrameCount >= 525) { if (gCsFrameCount == 525) { actor->fwork[29] = 3.8f; - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); } Math_SmoothStepToF(&actor->obj.pos.x, 1500.0f, 1.0f, 20.0f, 0.0f); Math_SmoothStepToAngle(&actor->unk_0F4.z, 315.0f, 1.0f, 2.0f, 0.0f); @@ -2404,8 +2404,8 @@ void func_i6_801A06A4(Actor* actor, s32 arg1) { actor->state = arg1 + 7; actor->iwork[11] = 1; Object_SetInfo(&actor->info, actor->obj.id); - Audio_PlaySfx(0x3100000C, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x09000002, actor->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x3100000C, actor->sfxSource, 4); + AUDIO_PLAY_SFX(0x09000002, actor->sfxSource, 0); } } @@ -2441,7 +2441,7 @@ void func_i6_801A07FC(Actor* actor0, Actor* actor1) { actor1->obj.rot.x = actor0->obj.rot.x; actor1->obj.rot.y = actor0->obj.rot.y; actor1->unk_0B6 = 42; - Audio_PlaySfx(0x2900306B, actor1->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900306B, actor1->sfxSource, 4); } void func_i6_801A0A08(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { @@ -2456,7 +2456,7 @@ void func_i6_801A0A08(Actor* actor, f32 xPos, f32 yPos, f32 zPos, f32 arg4) { actor->timer_0BC = 35; actor->iwork[0] = 255; actor->unk_0B6 = 43; - Audio_PlaySfx(0x2900306B, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900306B, actor->sfxSource, 4); } void func_i6_801A0AC0(Player* player) { @@ -2666,16 +2666,16 @@ void func_i6_801A0AC0(Player* player) { func_8007BFFC(gActors[11].obj.pos.x, gActors[11].obj.pos.y, gActors[11].obj.pos.z, gActors[11].vel.x, gActors[11].vel.y, gActors[11].vel.z, 8, 10); func_8007B344(gActors[11].obj.pos.x, gActors[11].obj.pos.y, gActors[11].obj.pos.z, 8, 5); - Audio_PlaySfx(0x2903A060, gActors[11].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903A060, gActors[11].sfxSource, 4); break; case 188: gActors[5].fwork[0] = gActors[6].fwork[0] = gActors[7].fwork[0] = 3.8f; - Audio_PlaySfx(0x2902306C, gActors[5].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x2902306C, gActors[6].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x2902306C, gActors[7].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[5].sfxSource, 4); + AUDIO_PLAY_SFX(0x2902306C, gActors[6].sfxSource, 4); + AUDIO_PLAY_SFX(0x2902306C, gActors[7].sfxSource, 4); break; case 150: - Object_Kill(&gActors[11].obj, gActors[11].sfxPos); + Object_Kill(&gActors[11].obj, gActors[11].sfxSource); for (i = 10; i < 24; i++) { func_i6_801A3B50(gActors[11].obj.pos.x, gActors[11].obj.pos.y, gActors[11].obj.pos.z, RAND_FLOAT_CENTERED(50.0f), RAND_FLOAT_CENTERED(50.0f), @@ -2684,11 +2684,11 @@ void func_i6_801A0AC0(Player* player) { break; case 155: gActors[7].fwork[0] = 3.8f; - Audio_PlaySfx(0x2902306C, gActors[7].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[7].sfxSource, 4); break; case 163: gActors[6].fwork[0] = 3.8f; - Audio_PlaySfx(0x2902306C, gActors[6].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[6].sfxSource, 4); break; case 240: gActors[9].iwork[0] = 255; @@ -2699,7 +2699,7 @@ void func_i6_801A0AC0(Player* player) { gActors[9].iwork[5] = 0; gActors[9].iwork[6] = 255; gActors[9].iwork[7] = 100; - Audio_PlaySfx(0x2940F026, gActors[5].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2940F026, gActors[5].sfxSource, 4); D_801779A8[gMainController] = 100.0f; break; case 260: @@ -2710,7 +2710,7 @@ void func_i6_801A0AC0(Player* player) { D_80178354 = 255; D_80178340 = 255; D_80178358 = 0; - Object_Kill(&gActors[8].obj, gActors[8].sfxPos); + Object_Kill(&gActors[8].obj, gActors[8].sfxSource); player->unk_1D0++; player->camEye.x = gCsCamEyeX = 0.0f; player->camEye.y = gCsCamEyeY = 0.0f; @@ -2766,7 +2766,7 @@ void func_i6_801A0AC0(Player* player) { gActors[5].iwork[4] = gActors[6].iwork[4] = gActors[7].iwork[4] = 1; gActors[5].fwork[5] = gActors[6].fwork[5] = gActors[7].fwork[5] = 80.0f; gActors[6].fwork[1] = 60.0f; - Audio_PlaySfx(0x31000011, gActors[5].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x31000011, gActors[5].sfxSource, 4); } if ((gCsFrameCount >= 285) && (gActors[9].iwork[3] != 0)) { gActors[9].iwork[3] -= 5; @@ -2868,18 +2868,18 @@ void func_i6_801A0AC0(Player* player) { switch (gCsFrameCount) { case 340: gActors[5].fwork[0] = 1.8f; - Audio_PlaySfx(0x2902306C, gActors[5].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[5].sfxSource, 4); break; case 350: gActors[6].fwork[0] = 1.8f; - Audio_PlaySfx(0x2902306C, gActors[6].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[6].sfxSource, 4); break; case 370: gActors[6].fwork[5] = 0.0f; gActors[7].fwork[5] = 0.0f; break; case 360: - func_8001D444(0, 0x2C, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_44); break; case 389: gActors[5].iwork[4] = 1; @@ -2913,7 +2913,7 @@ void func_i6_801A0AC0(Player* player) { if (gCsFrameCount >= 390) { if (gActors[6].iwork[4] != 0) { gActors[6].fwork[0] = 1.8f; - Audio_PlaySfx(0x2902306C, gActors[6].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[6].sfxSource, 4); gActors[6].obj.rot.x = (gActors[6].obj.rot.x - 2.0f); if (gActors[6].obj.rot.x <= 320.0f) { gActors[6].iwork[4] = 0; @@ -2932,8 +2932,7 @@ void func_i6_801A0AC0(Player* player) { gActors[6].obj.rot.y = (gActors[6].obj.rot.y + 6.0f); if (gActors[6].obj.rot.y > 230.0f) { gActors[6].fwork[0] = 2.8f; - Audio_PlaySfx(0x2902306C, gActors[6].sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[6].sfxSource, 4); } } } @@ -2972,8 +2971,7 @@ void func_i6_801A0AC0(Player* player) { gActors[7].obj.rot.y = (gActors[7].obj.rot.y + 6.0f); if (gActors[7].obj.rot.y > 230.0f) { gActors[7].fwork[0] = 2.8f; - Audio_PlaySfx(0x2902306C, gActors[7].sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[7].sfxSource, 4); } } } @@ -3005,13 +3003,12 @@ void func_i6_801A0AC0(Player* player) { gActors[5].obj.rot.y += 7.0f; if (gActors[5].obj.rot.y > 174.0f) { gActors[5].fwork[0] = 2.8f; - Audio_PlaySfx(0x2902306C, gActors[5].sfxPos, 4, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[5].sfxSource, 4); } } if ((gActors[5].iwork[4] == 6) && (gCsFrameCount == 550)) { - Object_Kill(&gActors[10].obj, gActors[10].sfxPos); + Object_Kill(&gActors[10].obj, gActors[10].sfxSource); D_80178488 = 1; } if (gCsFrameCount >= 530) { @@ -3047,14 +3044,14 @@ void func_i6_801A0AC0(Player* player) { case 425: gActors[5].vel.x -= 0.5f; gActors[5].vel.z -= 1.5f; - Object_Kill(&gActors[10].obj, gActors[10].sfxPos); + Object_Kill(&gActors[10].obj, gActors[10].sfxSource); func_i6_801A07FC(&gActors[5], &gActors[10]); break; case 435: - Object_Kill(&gActors[10].obj, gActors[10].sfxPos); + Object_Kill(&gActors[10].obj, gActors[10].sfxSource); func_i6_801A07FC(&gActors[5], &gActors[10]); gActors[7].fwork[0] = 1.8f; - Audio_PlaySfx(0x2902306C, gActors[7].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[7].sfxSource, 4); break; case 458: gActors[7].iwork[4] = 0; @@ -3062,7 +3059,7 @@ void func_i6_801A0AC0(Player* player) { case 450: gActors[5].vel.x -= 0.5f; gActors[5].vel.z -= 1.5f; - Object_Kill(&gActors[10].obj, gActors[10].sfxPos); + Object_Kill(&gActors[10].obj, gActors[10].sfxSource); func_i6_801A07FC(&gActors[5], &gActors[10]); gActors[10].timer_0BC = 180; break; @@ -3078,7 +3075,7 @@ void func_i6_801A0AC0(Player* player) { case 545: player->unk_194 = 10.0f; player->unk_190 = 10.0f; - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); D_80137E84[gMainController] = 1; D_Timer_80177BD0[gMainController] = 5; break; @@ -3092,7 +3089,7 @@ void func_i6_801A0AC0(Player* player) { gActors[5].obj.rot.y = gActors[6].obj.rot.y = 180.0f; gActors[7].obj.rot.y = 140.0f; gActors[5].fwork[0] = 2.8f; - Audio_PlaySfx(0x2902306C, gActors[5].sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2902306C, gActors[5].sfxSource, 4); player->unk_1D0++; break; } @@ -3137,7 +3134,7 @@ void func_i6_801A0AC0(Player* player) { case 580: for (i = 6; i < 10; i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } for (i = 5; i < 7; i++) { @@ -3146,11 +3143,11 @@ void func_i6_801A0AC0(Player* player) { func_i6_801A0510(&gActors[9], 9); break; case 590: - Object_Kill(&gActors[0].obj, gActors[0].sfxPos); + Object_Kill(&gActors[0].obj, gActors[0].sfxSource); break; case 600: - Object_Kill(&gActors[2].obj, gActors[9].sfxPos); - Object_Kill(&gActors[1].obj, gActors[8].sfxPos); + Object_Kill(&gActors[2].obj, gActors[9].sfxSource); + Object_Kill(&gActors[1].obj, gActors[8].sfxSource); break; } if (gCsFrameCount >= 609) { @@ -3160,7 +3157,7 @@ void func_i6_801A0AC0(Player* player) { D_80177A48[0] = 1.0f; player->pos.z = player->unk_138 = 0.0f; player->unk_0D0 = D_80161A54; - func_8001D444(0, 0x8009, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_9 | 0x8000); D_80177838 = 100; player->state_1C8 = PLAYERSTATE_1C8_3; player->unk_1D0 = 0; @@ -3181,7 +3178,7 @@ void func_i6_801A0AC0(Player* player) { player->camAt.y += 20.0f; player->camAt.z = player->unk_138 - 41.0f; for (i = 0; i < 11; i++) { - Object_Kill(&gActors[i].obj, gActors[i].sfxPos); + Object_Kill(&gActors[i].obj, gActors[i].sfxSource); } } break; @@ -3356,7 +3353,7 @@ void func_i6_801A3BD4(Actor* actor) { func_8007F11C(0x162, actor->fwork[16], actor->fwork[17], actor->fwork[18], 100.0f); gPlayer[0].pos.x = sp1E4; gPlayer[0].pos.y = sp1E0; - Audio_PlaySfx(0x2900306B, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2900306B, actor->sfxSource, 4); } actor->unk_048 = 0; } @@ -3409,10 +3406,10 @@ void func_i6_801A3BD4(Actor* actor) { func_8007BFFC(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, actor->vel.x, actor->vel.y, actor->vel.z, 8.0f, 0xA); func_8007B344(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, 8.0f, 5); - Audio_PlaySfx(0x2903A060, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903A060, actor->sfxSource, 4); } if (actor->timer_0BE == 0) { - Object_Kill(&actor->obj, actor->sfxPos); + Object_Kill(&actor->obj, actor->sfxSource); func_80066254(actor); for (i = 10; i < 24; i++) { func_i6_801A3B50(actor->obj.pos.x, actor->obj.pos.y, actor->obj.pos.z, RAND_FLOAT_CENTERED(50.0f), @@ -3505,10 +3502,10 @@ void func_i6_801A3BD4(Actor* actor) { actor->unk_0D0 = 0; if (actor->unk_0D2 == 0) { actor->iwork[18] = 15; - Audio_PlaySfx(0x29121007, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x29121007, actor->sfxSource, 4); } else { - Audio_PlaySfx(0x2903300E, actor->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x2903300E, actor->sfxSource, 4); actor->timer_0C6 = 15; func_8007C120(actor->unk_0D8.x, actor->unk_0D8.y, actor->unk_0D8.z, actor->vel.x, actor->vel.y, actor->vel.z, 0.1f, 10); @@ -3609,7 +3606,7 @@ void func_i6_801A4E44(Object_80* obj80) { Vec3f sp30; if (obj80->state == 0) { - Audio_PlaySfx(0x1900404F, obj80->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900404F, obj80->sfxSource, 4); obj80->state++; } if (!(gGameFrameCount & 3)) { @@ -3648,7 +3645,7 @@ void func_i6_801A52B8(Object_80* obj80) { Vec3f sp38; if (obj80->state == 0) { - Audio_PlaySfx(0x1900404F, obj80->sfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900404F, obj80->sfxSource, 4); obj80->state++; } if (!(gGameFrameCount & 3)) { diff --git a/src/overlays/ovl_i6/fox_ve2.c b/src/overlays/ovl_i6/fox_ve2.c index afcc718b..e3be1cb3 100644 --- a/src/overlays/ovl_i6/fox_ve2.c +++ b/src/overlays/ovl_i6/fox_ve2.c @@ -186,9 +186,9 @@ void func_i6_80196968(void) { Object_58_Initialize(obj58); obj58->obj.status = OBJ_ACTIVE; obj58->obj.id = D_80178310[i].id; - obj58->sfxPos[0] = obj58->obj.pos.x = D_80178310[i].xPos; - obj58->sfxPos[1] = obj58->obj.pos.y = D_80178310[i].yPos; - obj58->sfxPos[2] = obj58->obj.pos.z = -D_80178310[i].zPos1; + obj58->sfxSource[0] = obj58->obj.pos.x = D_80178310[i].xPos; + obj58->sfxSource[1] = obj58->obj.pos.y = D_80178310[i].yPos; + obj58->sfxSource[2] = obj58->obj.pos.z = -D_80178310[i].zPos1; obj58->unk_54 = obj58->obj.rot.y = D_80178310[i].rot.y; Object_SetInfo(&obj58->info, obj58->obj.id); @@ -319,8 +319,8 @@ void func_i6_80196D88(Player* player) { } else { player->timer_1FC = 180; } - func_800182F4(0x103C00FF); - func_800182F4(0x113C00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 60); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 60); /* fallthrough */ case 1: if (D_8017827C == 2) { @@ -367,11 +367,11 @@ void func_i6_80196D88(Player* player) { if (player->unk_120 >= 180.0f) { player->unk_120 -= 360.0f; } - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); player->unk_194 = 5.0f; player->unk_190 = 5.0f; gCsFrameCount = 0; - func_8001D410(0); + Audio_SetBgmParam(0); } break; case 2: @@ -396,7 +396,7 @@ void func_i6_80196D88(Player* player) { } if (gCsFrameCount == 105) { - Audio_PlaySfx(0x09000002, player->sfxPos, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000002, player->sfxSource, 0); player->unk_194 = 5.0f; player->unk_190 = 5.0f; } @@ -418,7 +418,7 @@ void func_i6_80196D88(Player* player) { D_80161A2E = 1; } func_8001CA24(0); - Audio_KillSfx(player->sfxPos); + Audio_KillSfxBySource(player->sfxSource); for (i = 0; i < 200; i++) { gObjects58[i].obj.status = OBJ_FREE; @@ -432,7 +432,7 @@ void func_i6_80196D88(Player* player) { } if (player->timer_1FC == 150) { Radio_PlayMessage(gMsg_ID_8215, RCID_FOX); - func_8001D444(0, 0x803E, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_62 | 0x8000); } if (player->timer_1FC == 1) { if ((gTeamShields[2] > 0) || (gTeamShields[1] > 0) || (gTeamShields[3] > 0)) { diff --git a/src/overlays/ovl_menu/fox_map.c b/src/overlays/ovl_menu/fox_map.c index eeb451f5..f3acebd8 100644 --- a/src/overlays/ovl_menu/fox_map.c +++ b/src/overlays/ovl_menu/fox_map.c @@ -1293,7 +1293,7 @@ void func_menu_8019E99C(void) { s32 i; s32 j; - func_8001DC6C(0, 0x118); + Audio_SetAudioSpec(0, 0x118); D_80137E78 = 2; gGameFrameCount = 0; @@ -1390,7 +1390,7 @@ void func_menu_8019E99C(void) { D_menu_801CEA6C = 0.0f; D_menu_801CEA70 = 0.002f; - func_8001D444(0, 0x3C, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_60); D_menu_801CEFC4 = 0; D_menu_801CEFC8 = 0; @@ -1577,7 +1577,7 @@ void func_menu_8019F42C(void) { D_menu_801CD9AC = 0; - func_8001DC6C(0, 0x19); + Audio_SetAudioSpec(0, 0x19); D_menu_801CD948 = 0; D_menu_801CD94C = 0; @@ -2114,7 +2114,7 @@ void func_menu_801A0954(void) { } if ((s32) D_menu_801CD9E0 == 205) { - func_8001AD00(1000); + Audio_PlayVoiceWithoutBGM(1000); } if (D_menu_801CD9E0 > -355.0f) { @@ -2159,9 +2159,9 @@ void func_menu_801A0954(void) { } if (gControllerPress[gMainController].button & START_BUTTON) { - func_8001D444(0, 0x3C, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_60); - Audio_PlaySfx(0x4900001FU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900001FU, gDefaultSfxSource, 4U); for (planetId = 0; planetId < PLANET_MAX; planetId++) { if ((planetId == PLANET_SECTOR_Z) || (planetId == PLANET_SECTOR_X) || (planetId == PLANET_SECTOR_Y)) { @@ -2174,7 +2174,7 @@ void func_menu_801A0954(void) { D_menu_801CD970 = 255; - func_8001AE58(); + Audio_ClearVoice(); D_menu_801CD974 = 1; D_menu_801CD97C = 1; @@ -2373,7 +2373,7 @@ void func_menu_801A1528(void) { } if (temp == 0.0f) { - Audio_PlaySfx(0x4900001FU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900001FU, gDefaultSfxSource, 4U); D_menu_801CD948 = 0; D_menu_801CD97C = 1; D_menu_801CD944 = 3; @@ -2382,7 +2382,7 @@ void func_menu_801A1528(void) { } if (gControllerPress[gMainController].button & START_BUTTON) { - Audio_PlaySfx(0x4900001FU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900001FU, gDefaultSfxSource, 4U); for (planetId = 0; planetId < PLANET_MAX; planetId++) { if ((planetId == PLANET_SECTOR_Z) || (planetId == PLANET_SECTOR_X) || (planetId == PLANET_SECTOR_Y)) { @@ -2490,9 +2490,9 @@ void func_menu_801A1C14(void) { if (sCurrentPlanetId == PLANET_CORNERIA) { D_80178340 = 0; D_menu_801CD948 = 10; - Audio_PlaySfx(0x0940A00BU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x0940A00BU, gDefaultSfxSource, 4U); } else { - Audio_PlaySfx(0x19003012U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19003012U, gDefaultSfxSource, 4U); D_menu_801CD948++; } } else { @@ -2508,7 +2508,7 @@ void func_menu_801A1C14(void) { case 10: if (D_menu_801CEB34 == 4) { - Audio_PlaySfx(0x19003012U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19003012U, gDefaultSfxSource, 4U); D_menu_801CD948 = 2; } break; @@ -2516,7 +2516,7 @@ void func_menu_801A1C14(void) { case 2: func_menu_801A2674(); if ((D_menu_801CD9FC == D_menu_801CDA50.z) && (D_menu_801CD9D8 == 0)) { - Audio_PlaySfx(0x19004013U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19004013U, gDefaultSfxSource, 4U); D_menu_801CD9D8 = 1; if (sCurrentPlanetId == PLANET_CORNERIA) { D_menu_801CEB48[0] = true; @@ -2593,7 +2593,7 @@ bool func_menu_801A2304(void) { switch (D_menu_801CD94C) { case 0: - func_8001ACDC(3); + Audio_PlayVoice(3); D_menu_801CEA78 += 2.9f; D_menu_801CEA80 += 2.9f; if (D_menu_801CEA78 > 5.5f) { @@ -2750,8 +2750,8 @@ void func_menu_801A2674(void) { D_menu_801CD970 = 0; } - func_800182F4(0x102D00FF); - func_800182F4(0x112D00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 45); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 45); } void func_menu_801A281C(void) { @@ -2935,9 +2935,9 @@ void func_menu_801A2EB8(void) { if (D_menu_801CD9C4 == 30) { if (D_menu_801CD93C == 2) { - Audio_PlaySfx(0x0900802AU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x0900802AU, gDefaultSfxSource, 4U); } else { - Audio_PlaySfx(0x09000032U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09000032U, gDefaultSfxSource, 4U); } } @@ -3005,7 +3005,7 @@ void func_menu_801A2EB8(void) { } if ((D_menu_801CEED8 == 4) && (D_menu_801CEEDC == 0.0f)) { - Audio_PlaySfx(0x19000026U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000026U, gDefaultSfxSource, 4U); } if ((D_menu_801CEED8 == 5) && (D_menu_801CEEDC == 0.0f)) { @@ -3107,7 +3107,7 @@ void func_menu_801A36A8(void) { D_menu_801CF080 = 1.0f; D_menu_801CD948 = 10; - func_8001D444(0, 0x28, 0, 0xFF); + AUDIO_PLAY_BGM(SEQ_ID_40); break; case 10: @@ -3163,7 +3163,7 @@ void func_menu_801A36A8(void) { } if (gControllerPress[gMainController].button & (A_BUTTON | START_BUTTON)) { - Audio_PlaySfx(0x49000003U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003U, gDefaultSfxSource, 4U); D_menu_801CD948 = 3; } } @@ -3617,7 +3617,7 @@ void func_menu_801A4D7C(void) { if (gControllerPress[gMainController].button & A_BUTTON) { func_8001D6DC(0); - Audio_PlaySfx(0x49000003U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003U, gDefaultSfxSource, 4U); D_menu_801CF000[D_menu_801CEFDC] = 10; if (((D_menu_801CD93C != 0) && (D_menu_801CEFDC == 2)) || ((D_menu_801CD93C == 0) && (D_menu_801CEFDC == 1))) { @@ -3808,7 +3808,7 @@ bool func_menu_801A5770(void) { } if (ret) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); } return ret; @@ -3969,15 +3969,15 @@ void func_menu_801A5E80(void) { case 1: if ((gControllerPress[gMainController].button & START_BUTTON) && !(D_menu_801CD9A8)) { - func_8001A838(0x4100001EU); - func_8001AE58(); + Audio_KillSfxById(0x4100001EU); + Audio_ClearVoice(); D_menu_801CF018 = 0; D_menu_801B8280 = 2; D_menu_801CD9B8 = 0; } if ((gControllerPress[gMainController].button & A_BUTTON) && (D_menu_801CD9A0 == 0) && !(D_menu_801CD9A8)) { - func_8001AE58(); + Audio_ClearVoice(); D_Timer_801782AC = 0; } @@ -4018,7 +4018,7 @@ void func_menu_801A5E80(void) { case 4: if (D_menu_801CD9B8 == 0) { - Audio_PlaySfx(0x49002016U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49002016U, gDefaultSfxSource, 4U); D_menu_801CD9B8 = 75; D_menu_801B8280++; } @@ -4038,59 +4038,59 @@ void func_menu_801A5E80(void) { void func_menu_801A61B4(LevelId level) { switch (level) { case LEVEL_CORNERIA: - func_8001DC6C(0, 0); + Audio_SetAudioSpec(0, 0); break; case LEVEL_METEO: - func_8001DC6C(0, 1); + Audio_SetAudioSpec(0, 1); break; case LEVEL_TITANIA: - func_8001DC6C(0, 2); + Audio_SetAudioSpec(0, 2); break; case LEVEL_AQUAS: - func_8001DC6C(0, 12); + Audio_SetAudioSpec(0, 12); break; case LEVEL_BOLSE: - func_8001DC6C(0, 10); + Audio_SetAudioSpec(0, 10); break; case LEVEL_KATINA: - func_8001DC6C(0, 11); + Audio_SetAudioSpec(0, 11); break; case LEVEL_AREA_6: - func_8001DC6C(0, 5); + Audio_SetAudioSpec(0, 5); break; case LEVEL_SECTOR_Z: - func_8001DC6C(0, 13); + Audio_SetAudioSpec(0, 13); break; case LEVEL_FORTUNA: - func_8001DC6C(0, 8); + Audio_SetAudioSpec(0, 8); break; case LEVEL_SECTOR_X: - func_8001DC6C(0, 3); + Audio_SetAudioSpec(0, 3); break; case LEVEL_MACBETH: - func_8001DC6C(0, 14); + Audio_SetAudioSpec(0, 14); break; case LEVEL_ZONESS: - func_8001DC6C(0, 4); + Audio_SetAudioSpec(0, 4); break; case LEVEL_SECTOR_Y: - func_8001DC6C(0, 7); + Audio_SetAudioSpec(0, 7); break; case LEVEL_SOLAR: - func_8001DC6C(0, 521); + Audio_SetAudioSpec(0, 0x209); default: break; @@ -4278,11 +4278,11 @@ s32 func_menu_801A655C(PlanetId start, PlanetId end) { } void func_menu_801A659C(void) { - func_8001A838(0x1100004C); - func_8001A838(0x1100204C); + Audio_KillSfxById(0x1100004C); + Audio_KillSfxById(0x1100204C); if (sCurrentPlanetId != 9) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); } D_menu_801CEFC8 = 0; @@ -4943,7 +4943,7 @@ void func_menu_801A809C(PlanetId planetId) { D_menu_801CD998 += 8; if (D_menu_801CD998 == 8) { - Audio_PlaySfx(0x49008030U, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49008030U, gDefaultSfxSource, 4U); } if (D_menu_801CD998 >= 255) { @@ -5833,7 +5833,7 @@ void func_menu_801AB300(void) { D_menu_801CD940 = 1; D_80178308 = D_menu_801AF428[sCurrentPlanetId][D_menu_801CD940]; - func_8001ACDC(Message_IdFromPtr(D_80178308)); + Audio_PlayVoice(Message_IdFromPtr(D_80178308)); D_80177D68 = D_menu_801AF420[D_menu_801CD940]; D_Timer_801782AC = Message_GetCharCount(D_80178308) * 2; @@ -5848,8 +5848,8 @@ void func_menu_801AB300(void) { D_menu_801CEA74 = 255; D_80177D50 = 1.3f; - Audio_PlaySfx(0x4100001EU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_8001ACDC(Message_IdFromPtr(D_80178308)); + AUDIO_PLAY_SFX(0x4100001EU, gDefaultSfxSource, 4U); + Audio_PlayVoice(Message_IdFromPtr(D_80178308)); D_Timer_801782AC = Message_GetCharCount(D_80178308) * 2; D_menu_801CD9A4 = 0; @@ -5858,9 +5858,9 @@ void func_menu_801AB300(void) { break; case 4: - if (!D_Timer_801782AC && !func_8001AE78()) { + if (!D_Timer_801782AC && !Audio_GetCurrentVoice()) { D_801782A4 = D_80177D68; - func_8001AE58(); + Audio_ClearVoice(); if (D_menu_801CD940 == 0) { D_801782D8 = 0; D_Timer_801782AC = 30; @@ -5889,7 +5889,7 @@ void func_menu_801AB300(void) { } if (D_menu_801CEAB4) { - if (func_8001AED4() == 1) { + if (Audio_GetCurrentVoiceStatus() == 1) { D_Timer_801782B4 = 2; } else { D_Timer_801782B4 = 0; @@ -5910,7 +5910,7 @@ void func_menu_801AB300(void) { } else { D_menu_801CD940 = 1; D_80178308 = D_menu_801AF428[sCurrentPlanetId][D_menu_801CD940]; - func_8001ACDC(Message_IdFromPtr(D_80178308)); + Audio_PlayVoice(Message_IdFromPtr(D_80178308)); D_80177D68 = D_menu_801AF420[D_menu_801CD940]; D_801782A4 = D_80177D68; D_801782D8 = 0; @@ -5930,8 +5930,8 @@ void func_menu_801AB300(void) { case 6: if (D_Timer_801782AC == 0) { - func_8001A838(0x4100001EU); - func_8001ACDC(0); + Audio_KillSfxById(0x4100001EU); + Audio_PlayVoice(0); D_80177D50 = 0.0f; D_menu_801CF018++; D_menu_801CF018 = 7; @@ -6371,7 +6371,7 @@ void func_menu_801AC9A0(s32 index) { switch (D_80177BD8[index]) { case 1: - Audio_PlaySfx(0x1900404DU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1900404DU, gDefaultSfxSource, 4U); D_80177BD8[index] = 11; break; @@ -6379,7 +6379,7 @@ void func_menu_801AC9A0(s32 index) { Math_SmoothStepToF(&gUnkEntities30[index].unk_24, target, 0.1f, 100.0f, 4.0f); gUnkEntities30[index].unk_2F = 255; if (gUnkEntities30[index].unk_24 == target) { - func_8001A838(0x1900404DU); + Audio_KillSfxById(0x1900404DU); D_80177BD8[index] = 4; } break; @@ -6595,7 +6595,7 @@ void func_menu_801AD11C(void) { if (gControllerPress[gMainController].button & START_BUTTON) { if (D_menu_801CD944 == 3 && D_80161A34 == 7) { if (D_menu_801CEFD0) { - Audio_PlaySfx(0x4900100AU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900100AU, gDefaultSfxSource, 4U); } else { func_8001D6DC(1); D_menu_801CEFC4 = 1; @@ -6640,14 +6640,14 @@ void func_menu_801AD11C(void) { } if (D_menu_801CF014 == 0 && var_a3 == 1) { - func_8001D10C(gDefaultSfxPos, 0x1100204C); + func_8001D10C(gDefaultSfxSource, 0x1100204C); D_menu_801CF014 = 1; } if ((D_menu_801CF014 == 1) && (var_a3 == 0) && (y == 0.0f) && (x == 0.0f)) { var_a1 = 0; var_a2 = 0; - func_8001A838(0x1100204CU); + Audio_KillSfxById(0x1100204CU); D_menu_801CF014 = 0; } @@ -6694,12 +6694,12 @@ void func_menu_801AD11C(void) { } if (D_menu_801CF010 == 0 && var_t0 == 1) { - Audio_PlaySfx(0x1100004CU, gDefaultSfxPos, 4U, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x1100004CU, gDefaultSfxSource, 4U); D_menu_801CF010 = 1; } if (D_menu_801CF010 == 1 && var_t0 == 0) { - func_8001A838(0x1100004CU); + Audio_KillSfxById(0x1100004CU); D_menu_801CF010 = 0; } } diff --git a/src/overlays/ovl_menu/fox_option.c b/src/overlays/ovl_menu/fox_option.c index 4622cc97..248a42d6 100644 --- a/src/overlays/ovl_menu/fox_option.c +++ b/src/overlays/ovl_menu/fox_option.c @@ -535,7 +535,7 @@ void Option_Setup(void) { D_menu_801B91EC = 0; D_menu_801B9244 = 0; D_menu_801B9248 = 0; - func_8001D444(0, 36, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_36); } void Option_Init(void) { @@ -550,7 +550,7 @@ void Option_Init(void) { case OPTION_WAIT: if (D_Timer_8017783C == 0) { gOptionMenuStatus = OPTION_SETUP; - func_8001DC6C(0, 23); + Audio_SetAudioSpec(0, 23); } break; @@ -798,7 +798,7 @@ void Option_TrainingUpdate(void) { D_80177CB0 = 0.0f; D_8017782C = 1; gControllerLock = 3; - func_8001DC6C(0, 28); + Audio_SetAudioSpec(0, 28); } else { D_80178340 += 0x20; if (D_80178340 > 0xFF) { @@ -913,13 +913,13 @@ void Option_MainMenuUpdate(void) { temp1 = func_menu_8019C418(&D_menu_801B91A4, OPTION_COUNT - 1, 1, 0, 20, 5, 4, gMainController, &D_menu_801B9180); // clang-format off - if (temp1 != 0) { Audio_PlaySfx(0x49000022, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); } + if (temp1 != 0) { AUDIO_PLAY_SFX(0x49000022, gDefaultSfxSource, 4); } // clang-format on if ((D_menu_801B91A4 == 0) && (D_menu_801B91C8 != 0)) { temp2 = func_menu_8019C418(&D_menu_801B91B0, 1, 0, 0, 20, 5, 4, gMainController, &D_menu_801B9190); if (temp2 != 0) { - Audio_PlaySfx(0x49000022, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000022, gDefaultSfxSource, 4); if (D_menu_801B91B0) { sOptionCardList[0].unk_00.unk_08 = D_8004C50; sOptionCardList[0].unk_00.unk_10 = 80; @@ -939,7 +939,7 @@ void Option_MainMenuUpdate(void) { if ((D_menu_801B91A4 == 4) && (D_menu_801B91C8 != 0)) { temp2 = func_menu_8019C418(&D_menu_801B91AC, 1, 0, 0, 20, 5, 4, gMainController, &D_menu_801B9198); if (temp2 != 0) { - Audio_PlaySfx(0x49000022, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000022, gDefaultSfxSource, 4); if (D_menu_801B91AC) { sOptionCardList[4].unk_00.unk_08 = D_8004C50; sOptionCardList[4].unk_00.unk_10 = 80; @@ -957,13 +957,13 @@ void Option_MainMenuUpdate(void) { } if (gControllerPress[gMainController].button & (A_BUTTON | START_BUTTON)) { - Audio_PlaySfx(0x49000020, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000020, gDefaultSfxSource, 4); D_menu_801B9208 = sOptionCardPosY[D_menu_801B91A4]; D_menu_801B91BC = 0; D_menu_801B912C = 11; } if (gControllerPress[gMainController].button & B_BUTTON) { - Audio_PlaySfx(0x49000021, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000021, gDefaultSfxSource, 4); D_menu_801B8284 = 0; D_menu_801B8280 = 1; D_menu_801B912C = 100; @@ -1182,18 +1182,18 @@ void Option_VersusUpdate(void) { case 1: // clang-format off - if (func_menu_8019C418(&D_menu_801B91A8, 2, 1, 0, 20, 5, 4, gMainController, &D_menu_801B9188)) { Audio_PlaySfx(0x49000022, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); } + if (func_menu_8019C418(&D_menu_801B91A8, 2, 1, 0, 20, 5, 4, gMainController, &D_menu_801B9188)) { AUDIO_PLAY_SFX(0x49000022, gDefaultSfxSource, 4); } // clang-format on if (gControllerPress[gMainController].button & (A_BUTTON | START_BUTTON)) { - Audio_PlaySfx(0x49000020, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000020, gDefaultSfxSource, 4); D_menu_801B9208 = D_menu_801AEF84[D_menu_801B91A8]; D_menu_801B91BC = 0; D_menu_801B912C = 11; } if (gControllerPress[gMainController].button & B_BUTTON) { - Audio_PlaySfx(0x49000021, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000021, gDefaultSfxSource, 4); D_menu_801B912C = 0; D_menu_801B9124 = 1000; gDrawMode = DRAWMODE_0; @@ -1300,7 +1300,7 @@ void Option_SoundInit(void) { D_menu_801B91A0 = 0; gSoundMode = gSaveFile.save.data.soundMode; - func_800182F4(D_menu_801AE998[gSoundMode] | 0xE0000000); + Audio_QueueSeqCmd(D_menu_801AE998[gSoundMode] | 0xE0000000); gVolumeSettings[0] = gSaveFile.save.data.musicVolume; gVolumeSettings[1] = gSaveFile.save.data.voiceVolume; @@ -1361,7 +1361,7 @@ void Option_SoundUpdate(void) { temp = func_menu_8019C418(&D_menu_801B9288, 3, 1, 0, 20, 5, 4, gMainController, &D_menu_801B9250); if (temp != 0) { D_menu_801B9270[sp34] = 255.0f; - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); } if (D_menu_801B9288 == 0) { @@ -1373,19 +1373,19 @@ void Option_SoundUpdate(void) { // Test sound if (gControllerPress[gMainController].button & R_TRIG) { D_menu_801B9284 ^= 1; - func_8001D8F4(D_menu_801B9284); + Audio_PlaySoundTest(D_menu_801B9284); } if (gControllerPress[gMainController].button & A_BUTTON) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); D_menu_801B9288 = (D_menu_801B9288 + 1) & 3; } if (gControllerPress[gMainController].button & B_BUTTON) { - Audio_PlaySfx(0x49000021, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000021, gDefaultSfxSource, 4); if (D_menu_801B9284 == 1) { D_menu_801B9284 = 0; - func_8001D8F4(D_menu_801B9284); + Audio_PlaySoundTest(D_menu_801B9284); } Save_Write(); gDrawMode = DRAWMODE_0; @@ -1400,13 +1400,13 @@ void func_menu_80194AEC(void) { s32 pad; if (func_menu_8019C418(&sp3C, 2, 0, 0, 20, 5, 4, gMainController, &D_menu_801B9260)) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); gSoundMode = sp3C; if (gSoundMode >= 3) { gSoundMode = 0; } gSaveFile.save.data.soundMode = gSoundMode; - func_800182F4(D_menu_801AE998[gSoundMode] | 0xE0000000); + Audio_QueueSeqCmd(D_menu_801AE998[gSoundMode] | 0xE0000000); } } @@ -1652,27 +1652,27 @@ void Option_ExpertSoundUpdate(void) { f32 sp28 = D_menu_801B931C; if (func_menu_8019C66C(&sp28, 0.0f, 49.0f, &D_menu_801B9290) != 0) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); D_menu_801B931C = sp28; } if (gControllerPress[gMainController].button & A_BUTTON) { - func_8001DA90(D_menu_801B931C); + Audio_PlaySoundTestTrack(D_menu_801B931C); D_menu_801B9320 = true; } if (gControllerPress[gMainController].button & B_BUTTON) { if (!D_menu_801B9320) { - Audio_PlaySfx(0x49000021, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_8001D444(0, 36, 0, 255); + AUDIO_PLAY_SFX(0x49000021, gDefaultSfxSource, 4); + AUDIO_PLAY_BGM(SEQ_ID_36); gDrawMode = DRAWMODE_0; D_menu_801B9124 = 1000; D_menu_801B912C = 0; D_menu_801B9244 = 1; } else { - Audio_PlaySfx(0x4900101D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + AUDIO_PLAY_SFX(0x4900101D, gDefaultSfxSource, 4); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); D_menu_801B9320 = false; } } @@ -1741,7 +1741,7 @@ void Option_ExpertSoundDraw(void) { } if (D_menu_801B9320 != 0) { - temp_v0_4 = func_8001C3EC(); + temp_v0_4 = Audio_UpdateFrequencyAnalysis(); var_fv1 = 60.0f; if (spectrumAnalizerMode == 2) { @@ -1841,7 +1841,7 @@ void Option_DataUpdate(void) { case 1: D_menu_801B91CC = 2; - Audio_PlaySfx(0x0940A00B, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x0940A00B, gDefaultSfxSource, 4); D_801779A8[gMainController] = 50.0f; D_80177990[gMainController] = 0; break; @@ -1894,36 +1894,36 @@ void Option_DataUpdate(void) { void func_menu_8019669C(void) { if ((D_menu_801B91CC == 0) || (D_menu_801B91CC == 1)) { if (func_menu_8019C5A0(&D_menu_801B91C0) != 0) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); } if (1) {} } if (gControllerPress[gMainController].button & A_BUTTON) { if (D_menu_801B91CC == 3) { - Audio_PlaySfx(0x49000021, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000021, gDefaultSfxSource, 4); D_menu_801B912C = 3; } else { D_menu_801B9330[D_menu_801B91C0] = 10; if (D_menu_801B91C0 == 0) { if (D_menu_801B91CC == 1) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); D_menu_801B912C = 2; } else { - Audio_PlaySfx(0x49000021, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000021, gDefaultSfxSource, 4); D_menu_801B912C = 3; } } else { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); D_menu_801B912C = 4; } } } else if (gControllerPress[gMainController].button & B_BUTTON) { if (D_menu_801B91CC == 1) { - Audio_PlaySfx(0x4900101D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900101D, gDefaultSfxSource, 4); D_menu_801B912C = 2; } else { - Audio_PlaySfx(0x49000021, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000021, gDefaultSfxSource, 4); D_menu_801B912C = 3; } } @@ -2051,7 +2051,7 @@ void Option_RankingUpdate(void) { func_menu_80196FC4(); if (gControllerPress[gMainController].button & B_BUTTON) { - Audio_PlaySfx(0x49000021, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000021, gDefaultSfxSource, 4); gDrawMode = DRAWMODE_0; D_menu_801B9124 = 1000; D_menu_801B912C = 0; @@ -2066,7 +2066,7 @@ void Option_RankingDraw(void) { void func_menu_80196FC4(void) { if (gControllerPress[gMainController].button & A_BUTTON) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); D_menu_801B93E0 ^= 1; } @@ -2080,7 +2080,7 @@ void func_menu_80196FC4(void) { void func_menu_80197074(void) { if (func_menu_8019C418(&D_menu_801B93E4, 9, 1, 0, 20, 5, 4, gMainController, &D_menu_801B9400)) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); D_menu_801B91D4 = 114.0f - D_menu_801B93E4 * 130.0f; D_menu_801B91DC = 114.0f - D_menu_801B93E4 * 130.0f; D_menu_801B91D8 = -6.0f + D_menu_801B93E4 * 130.0f; @@ -2097,7 +2097,7 @@ void func_menu_8019715C(void) { if (D_menu_801B91D0 != 0) { if (func_menu_8019C418(&D_menu_801B93E4, 9, 1, 1, 20, 2, 9, gMainController, &D_menu_801B9408) != 0.00f) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); D_menu_801B91DC = 114.0f - D_menu_801B93E4 * 130.0f; D_menu_801B91E0 = -6.0f + D_menu_801B93E4 * 130.0f; D_menu_801B91D0 = 0; @@ -2610,7 +2610,7 @@ void Option_VersusMenuInit(void) { s32 i; if (D_menu_801B91C4) { - func_8001D444(0, 56, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_56); } D_menu_801B93D0 = D_menu_801B9124; @@ -2665,19 +2665,19 @@ void func_menu_8019949C(void) { if (!(D_menu_801B93C4 & (1 << i))) { func_menu_8019C824(&D_menu_801B9358[i]); if (func_menu_8019C418(&D_menu_801AED3C[i], 2, 0, 0, 20, 2, 4, i, &D_menu_801B93A0[i])) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); } } if (gControllerPress[i].button & A_BUTTON) { if (D_menu_801B93C4 == 15) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); D_menu_801B91EC = 10; D_menu_801B912C++; break; } else { if (!(D_menu_801B93C4 & (1 << i))) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); gHandicap[i] = D_menu_801AED3C[i]; D_menu_801B9358[i] = 255.0f; D_menu_801B9348[i] = 10; @@ -2688,11 +2688,11 @@ void func_menu_8019949C(void) { if (gControllerPress[i].button & B_BUTTON) { if (D_menu_801B93C4 & (1 << i)) { - Audio_PlaySfx(0x4900101D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900101D, gDefaultSfxSource, 4); D_menu_801B93C4 &= (1 << i) ^ 15; } else { - func_8001D444(0, 36, 0, 255); - Audio_PlaySfx(0x49000021, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_BGM(SEQ_ID_36); + AUDIO_PLAY_SFX(0x49000021, gDefaultSfxSource, 4); func_menu_8019B8A0(2); D_menu_801B9248 = 1; break; @@ -2995,19 +2995,19 @@ void func_menu_8019A2E0(void) { } if (func_menu_8019C418(&D_menu_801B93D4, 4, 0, 0, 20, 2, 4, i, &D_menu_801B9380[i])) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); D_801778A4 = D_menu_801B93D4 + 1; } if (gControllerPress[i].button & A_BUTTON) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); func_menu_8019A080(); D_menu_801B936C = 10; break; } if (gControllerPress[i].button & B_BUTTON) { - Audio_PlaySfx(0x4900101D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900101D, gDefaultSfxSource, 4); D_menu_801B9124 = D_menu_801B93D0; D_menu_801B91C4 = 0; Option_InitEntry(); @@ -3035,20 +3035,20 @@ void func_menu_8019A4DC(void) { } if (func_menu_8019C418(&D_menu_801B93DC, 4, 0, 0, 20, 2, 4, i, &D_menu_801B9380[i])) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); D_menu_801B9340 = D_menu_801B93DC; D_801778C8 = D_menu_801B93DC; } if (gControllerPress[i].button & A_BUTTON) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); func_menu_8019A080(); D_menu_801B937C = 10; break; } if (gControllerPress[i].button & B_BUTTON) { - Audio_PlaySfx(0x4900101D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900101D, gDefaultSfxSource, 4); D_menu_801B9124 = D_menu_801B93D0; D_menu_801B91C4 = 0; Option_InitEntry(); @@ -3076,12 +3076,12 @@ void func_menu_8019A6DC(void) { continue; } if (func_menu_8019C418(&D_menu_801B93D8, 1, 0, 1, 20, 2, 4, i, &D_menu_801B9380[i])) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); D_80161A28 = D_menu_801B93D8; } if (gControllerPress[i].button & A_BUTTON) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); if (D_80161A28 == 0) { gVersusStage = VS_STAGE_CORNERIA; if (D_menu_801B93D0 == 30) { @@ -3097,7 +3097,7 @@ void func_menu_8019A6DC(void) { } if (gControllerPress[i].button & B_BUTTON) { - Audio_PlaySfx(0x4900101D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900101D, gDefaultSfxSource, 4); if (D_menu_801B93D0 == 20) { D_menu_801B9124 = D_menu_801B93D0; D_menu_801B91C4 = 0; @@ -3132,13 +3132,13 @@ void func_menu_8019A954(void) { } if (gControllerPress[i].button & A_BUTTON) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); D_menu_801B91EC = 10; break; } if (gControllerPress[i].button & B_BUTTON) { - Audio_PlaySfx(0x4900101D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900101D, gDefaultSfxSource, 4); func_menu_8019A080(); D_menu_801B933C = 0; D_menu_801B91F0 = 0; @@ -3793,7 +3793,7 @@ bool func_menu_8019C66C(f32* arg0, f32 arg1, f32 arg2, UnkStruct_D_menu_801B9250 temp2 = *arg0; if ((s32) temp2 != (s32) temp) { - Audio_PlaySfx(0x49004007, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49004007, gDefaultSfxSource, 4); var_a2 = true; } @@ -3907,7 +3907,7 @@ void func_menu_8019CBC0(void) { s32 temp; s32 i; - func_8001D444(0, 36, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_36); gBlurAlpha = 0xD0; D_80178410 = 800; @@ -3952,7 +3952,7 @@ void func_menu_8019CD54(void) { if (D_menu_801B9138 == 0) { if (func_menu_8019C418(&D_menu_801B90A0[D_menu_801B9098], 36, 0, 0, 50, 5, 10, gMainController, &D_menu_801B9160[D_menu_801B9098])) { - Audio_PlaySfx(0x49000002, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000002, gDefaultSfxSource, 4); D_menu_801B9150[D_menu_801B9098][0] = D_menu_801AEF5C[D_menu_801B90A0[D_menu_801B9098]]; D_menu_801B90D0[D_menu_801B9098] = 0.0f; D_menu_801B9100[D_menu_801B9098] = 0.0f; @@ -3962,7 +3962,7 @@ void func_menu_8019CD54(void) { if (gControllerPress[gMainController].button & A_BUTTON) { D_menu_801B90D0[D_menu_801B9098] = 0.0f; if (D_menu_801B9138 != 0) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); D_menu_801B9140[0] = 10; D_menu_801B9140[1] = 10; D_menu_801B9140[2] = 10; @@ -3972,7 +3972,7 @@ void func_menu_8019CD54(void) { } else { if (D_menu_801B9098 < 3) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); D_menu_801B90D0[D_menu_801B9098] = 0.0f; D_menu_801B9140[D_menu_801B9098] = 15; D_menu_801B9128 = 1; @@ -3982,7 +3982,7 @@ void func_menu_8019CD54(void) { } if ((gControllerPress[gMainController].button & B_BUTTON) && (D_menu_801B9098 != 0)) { - Audio_PlaySfx(0x4900101D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x4900101D, gDefaultSfxSource, 4); if (D_menu_801B9138 != 0) { D_menu_801B9138 = 0; } @@ -4320,7 +4320,7 @@ void func_menu_8019DE74(void) { func_menu_8019715C(); if (gControllerPress[gMainController].button & 0xD00E) { // START, A, B, C-UP, C-LEFT, C-DOWN - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); gDrawMode = DRAWMODE_0; D_menu_801B912C = 0; @@ -4331,8 +4331,8 @@ void func_menu_8019DE74(void) { gLifeCount[0] = 2; gTotalHits = 0; } else if (D_80161A34 == 8) { - func_800182F4(0x100100FF); - func_800182F4(0x110100FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 1); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 1); D_menu_801B9124 = 400; } } @@ -4363,10 +4363,10 @@ void Option_InvoiceUpdate(void) { case 1: if (D_menu_801B9178 == 0) { if (((gTotalHits * 64) >= 50000) && ((gTotalHits * 64) < 70000)) { - Audio_PlaySfx(0x49000032, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000032, gDefaultSfxSource, 4); } if ((gTotalHits * 64) >= 70000) { - Audio_PlaySfx(0x49000033, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000033, gDefaultSfxSource, 4); } D_menu_801B9178 = 20; D_menu_801B912C++; @@ -4375,7 +4375,7 @@ void Option_InvoiceUpdate(void) { case 2: if ((D_menu_801B9178 == 0) && (gControllerPress[gMainController].button & 0xD00E)) { - Audio_PlaySfx(0x19031083, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x19031083, gDefaultSfxSource, 4); D_menu_801B9090 = 1; D_menu_801B9178 = 60; D_menu_801B912C++; diff --git a/src/overlays/ovl_menu/fox_title.c b/src/overlays/ovl_menu/fox_title.c index 8bef3f9d..38683660 100644 --- a/src/overlays/ovl_menu/fox_title.c +++ b/src/overlays/ovl_menu/fox_title.c @@ -225,11 +225,11 @@ void func_menu_801875E0(void) { func_menu_80188010(); if ((gMainController == -1) || (D_menu_801B827C != 0)) { - func_8001DC6C(0, 0x17); + Audio_SetAudioSpec(0, 0x17); D_menu_801B82C4 = 0; D_menu_801B827C = 0; } else { - func_8001DC6C(0, 0x16); + Audio_SetAudioSpec(0, 0x16); D_menu_801B82C4 = 1; } gControllerLock = 0x1E; @@ -391,15 +391,15 @@ void func_menu_80187B00(void) { func_800B6F50(gCsCamEyeX, gCsCamEyeY, gCsCamEyeZ, gCsCamAtX, gCsCamAtY, gCsCamAtZ); D_8017842C -= 1.0f; if (D_menu_801B82BC == 60) { - func_800182F4(0x103C00FF); - func_800182F4(0x113C00FF); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 60); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 60); } } else { D_80178410 = 0; gRadioState = 0; D_menu_801B82C0 = 0; gDrawMode = DRAWMODE_0; - func_8001DC6C(0, 0x16); + Audio_SetAudioSpec(0, 0x16); D_menu_801B82C4 = 1; } @@ -728,7 +728,7 @@ void func_menu_801881FC(void) { D_menu_801B86A4 = 0; D_menu_801B82B0 = 100; - func_8001D444(0, 34, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_34); } void func_menu_801888E8(void) { @@ -1009,7 +1009,7 @@ void func_menu_801894E8(void) { D_menu_801B7BF0 = 0; - func_8001D444(0, 35, 0, 255); + AUDIO_PLAY_BGM(SEQ_ID_35); } void func_menu_8018994C(void) { @@ -1123,8 +1123,8 @@ void func_menu_8018994C(void) { } if (D_menu_801B82B8 == 638) { - Audio_PlaySfx(0x11030010, D_menu_801B8658.unk_24, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31024059, D_menu_801B8658.unk_24, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, D_menu_801B8658.unk_24, 0); + AUDIO_PLAY_SFX(0x31024059, D_menu_801B8658.unk_24, 0); Radio_PlayMessage(gMsg_ID_60, RCID_ROB64_TITLE); } @@ -1195,8 +1195,8 @@ void func_menu_8018994C(void) { } if (D_80178340 == 255) { - func_8001A55C(D_menu_801B8658.unk_24, 0x11030010); - func_8001A55C(D_menu_801B8658.unk_24, 0x31024059); + Audio_KillSfxBySourceAndId(D_menu_801B8658.unk_24, 0x11030010); + Audio_KillSfxBySourceAndId(D_menu_801B8658.unk_24, 0x31024059); D_menu_801B82C0 = 0; @@ -1348,8 +1348,8 @@ void func_menu_8018A644(void) { switch (D_menu_801B82C0) { case 0: func_menu_8018A338(); - Audio_PlaySfx(0x49000014, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x0140001C, D_menu_801B84D8, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000014, gDefaultSfxSource, 4); + AUDIO_PLAY_SFX(0x0140001C, D_menu_801B84D8, 0); D_menu_801B82B4 = 0; D_menu_801B82C8 = 0.0f; @@ -1394,8 +1394,8 @@ void func_menu_8018A644(void) { } if (D_menu_801B7BEC == 795) { - func_8001A838(0x49000014); - func_8001A55C(D_menu_801B84D8, 0x0140001C); + Audio_KillSfxById(0x49000014); + Audio_KillSfxBySourceAndId(D_menu_801B84D8, 0x0140001C); D_menu_801B82C0 = 0; @@ -1512,8 +1512,8 @@ void func_menu_8018ACEC(void) { switch (D_menu_801B82C0) { case 0: func_menu_8018ABC0(); - Audio_PlaySfx(0x11030010, D_menu_801B8658.unk_24, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31024059, D_menu_801B8658.unk_24, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, D_menu_801B8658.unk_24, 0); + AUDIO_PLAY_SFX(0x31024059, D_menu_801B8658.unk_24, 0); D_menu_801B82CC = 0.01f; D_menu_801B82B4 = 0; @@ -1533,8 +1533,8 @@ void func_menu_8018ACEC(void) { } if (D_80178340 == 255) { - func_8001A55C(D_menu_801B8658.unk_24, 0x11030010); - func_8001A55C(D_menu_801B8658.unk_24, 0x31024059); + Audio_KillSfxBySourceAndId(D_menu_801B8658.unk_24, 0x11030010); + Audio_KillSfxBySourceAndId(D_menu_801B8658.unk_24, 0x31024059); gDrawMode = DRAWMODE_0; @@ -1671,7 +1671,7 @@ void func_menu_8018B5C4(void) { D_menu_801B7BEC = 0; func_menu_8018B058(); - func_8001D400(0x68); + Audio_SetBaseSfxReverb(0x68); D_menu_801B82A8 = 30; @@ -1689,7 +1689,7 @@ void func_menu_8018B5C4(void) { case 10: if (D_menu_801B82A8 == 0) { - Audio_PlaySfx(0x0100001D, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x0100001D, gDefaultSfxSource, 4); D_menu_801B82B4 = 0; D_menu_801B82C0 = 1; } @@ -1704,7 +1704,7 @@ void func_menu_8018B5C4(void) { D_menu_801B9048 -= 0.41f; if (D_menu_801B9048 < 0.0f) { D_menu_801B9048 = 0.0f; - Audio_PlaySfx(0x09002013, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x09002013, gDefaultSfxSource, 4); } } @@ -1718,8 +1718,7 @@ void func_menu_8018B5C4(void) { } if (D_menu_801B84E8[i].unk_38 == 1) { - Audio_PlaySfx(0x1950107A, D_menu_801B84E8[i].unk_50, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x1950107A, D_menu_801B84E8[i].unk_50, 0); }; if (D_menu_801B84E8[i].unk_38 == 0) { @@ -1728,7 +1727,7 @@ void func_menu_8018B5C4(void) { 0.01f); D_menu_801B84E8[i].unk_10 *= 1.04f; if (temp[i] == 0.0f) { - func_8001A55C(D_menu_801B84E8[i].unk_50, 0x1950107A); + Audio_KillSfxBySourceAndId(D_menu_801B84E8[i].unk_50, 0x1950107A); } } } @@ -1754,8 +1753,7 @@ void func_menu_8018B5C4(void) { if (D_menu_801B82B4 == 226) { D_menu_801B7BF0 = 0; - Audio_PlaySfx(0x0100001E, D_menu_801B84E8[3].unk_50, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x0100001E, D_menu_801B84E8[3].unk_50, 0); D_menu_801B86BC = 105.0f; D_menu_801B86C0 = 0.0f; @@ -1848,9 +1846,8 @@ void func_menu_8018B5C4(void) { case 3: if (D_menu_801B82A8 == 0) { - func_8001A55C(D_menu_801B84E8[3].unk_50, 0x0100001E); - Audio_PlaySfx(0x09000002, D_menu_801B84E8[3].unk_50, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + Audio_KillSfxBySourceAndId(D_menu_801B84E8[3].unk_50, 0x0100001E); + AUDIO_PLAY_SFX(0x09000002, D_menu_801B84E8[3].unk_50, 0); D_menu_801B82A8 = 4; @@ -1884,7 +1881,7 @@ void func_menu_8018B5C4(void) { D_menu_801B86A8, D_menu_801B86AC); if (D_menu_801B82B4 > 8) { - func_8001D400(0); + Audio_SetBaseSfxReverb(0); D_menu_801B82C0 = 0; D_menu_801B82C4 = 5; } @@ -2038,8 +2035,8 @@ void func_menu_8018C644(void) { switch (D_menu_801B82C0) { case 0: - Audio_PlaySfx(0x11030010, D_menu_801B8658.unk_24, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - Audio_PlaySfx(0x31024059, D_menu_801B8658.unk_24, 0, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x11030010, D_menu_801B8658.unk_24, 0); + AUDIO_PLAY_SFX(0x31024059, D_menu_801B8658.unk_24, 0); func_menu_8018C1C0(); @@ -2066,8 +2063,7 @@ void func_menu_8018C644(void) { D_menu_801B84E8[i].unk_38--; } else { if (D_menu_801B84E8[i].unk_38 == 0) { - Audio_PlaySfx(0x19000001, D_menu_801B84E8[i].unk_50, 0, &gDefaultScale, &gDefaultScale, - &gDefaultReverb); + AUDIO_PLAY_SFX(0x19000001, D_menu_801B84E8[i].unk_50, 0); D_menu_801B84E8[i].unk_38 = -1; D_menu_801B84E8[i].unk_4C = 1; } @@ -2103,8 +2099,8 @@ void func_menu_8018C644(void) { } if (D_80178340 == 0xFF) { - func_8001A55C(D_menu_801B8658.unk_24, 0x11030010); - func_8001A55C(D_menu_801B8658.unk_24, 0x31024059); + Audio_KillSfxBySourceAndId(D_menu_801B8658.unk_24, 0x11030010); + Audio_KillSfxBySourceAndId(D_menu_801B8658.unk_24, 0x31024059); D_menu_801B82C0++; } func_menu_801912A0(); @@ -2126,7 +2122,7 @@ void func_menu_8018C644(void) { D_menu_801B82C0 = 0; gDrawMode = DRAWMODE_0; D_menu_801B82C4 = 0; - func_8001DC6C(0, 23); + Audio_SetAudioSpec(0, 23); break; } @@ -3221,7 +3217,7 @@ void func_menu_80190EA4(void) { switch (D_menu_801B8280) { case 0: if (gControllerPress[gMainController].button & 0xD00F) { // START, A, B, C-left, C-Down, C-Up, C-Right - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); D_menu_801B8284 = 0; D_menu_801B8280 = 1; gControllerLock = 0x1E; @@ -3232,7 +3228,7 @@ void func_menu_80190EA4(void) { if (D_menu_801B8284 < 120) { D_menu_801B8284 += 18; } else { - func_8001DC6C(0, 0x17); + Audio_SetAudioSpec(0, 0x17); D_80178410 = 0; gRadioState = 0; D_menu_801B82C0 = 0; @@ -3253,9 +3249,9 @@ void func_menu_80190FD0(void) { if (((gControllerPress[gMainController].button & START_BUTTON) || (gControllerPress[gMainController].button & A_BUTTON)) && (D_menu_801B8280 == 0)) { - Audio_PlaySfx(0x49000003, gDefaultSfxPos, 4, &gDefaultScale, &gDefaultScale, &gDefaultReverb); - func_800182F4(0x101E00FF); - func_800182F4(0x111E00FF); + AUDIO_PLAY_SFX(0x49000003, gDefaultSfxSource, 4); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 30); + SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 30); D_menu_801B8284 = 0; D_menu_801B8280 = 1; } @@ -3516,5 +3512,5 @@ void func_menu_801919C4(u16** arg0, s32 arg1) { D_80178740 = 178.0f; } - func_8001ACDC(Message_IdFromPtr(D_80178308)); + Audio_PlayVoice(Message_IdFromPtr(D_80178308)); } diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml index 1b064718..4d8ef261 100644 --- a/tools/permuter_settings.toml +++ b/tools/permuter_settings.toml @@ -25,6 +25,7 @@ compiler_type = "ido" "true" = "int" "false" = "int" "DMG_.*" = "int" +"AUDIOCMD_.*" = "void" [decompme.compilers] "tools/ido-recomp/linux/cc" = "ido5.3" \ No newline at end of file diff --git a/yamls/us/main.yaml b/yamls/us/main.yaml index 0e3242dd..1a1bc861 100644 --- a/yamls/us/main.yaml +++ b/yamls/us/main.yaml @@ -211,15 +211,15 @@ - [0xC51E0, .data, sys_math] - [0xC5220, .data, sys_matrix] - [0xC52F0, .data, sys_fault] - - [0xC54D0, data, audio_synthesis] - - [0xC55B0, data, audio_heap] - - [0xC5B50, data, audio_load] - - [0xC6120, data, audio_playback] # could be C6110? - - [0xC6500, data, audio_effects] - - [0xC6520, data, audio_seqplayer] - - [0xC68E0, data, audio_general] - - [0xC80D0, data, audio_context] - - [0xC8850, data, audio_thread] + - [0xC54D0, .data, audio_synthesis] + - [0xC55B0, .data, audio_heap] + - [0xC5B50, .data, audio_load] + - [0xC6120, .data, audio_playback] # could be C6110? + - [0xC6500, .data, audio_effects] + - [0xC6520, .data, audio_seqplayer] + - [0xC68E0, .data, audio_general] + - [0xC80D0, .data, audio_context] + - [0xC8850, .data, audio_thread] - [0xC8880, .data, sys_sprintf] # DATA - Libultra @@ -343,13 +343,12 @@ - { type: .bss, vram: 0x80144BE0, name: sys_timer } - { type: .bss, vram: 0x80144F60, name: sys_save } - { type: .bss, vram: 0x80145360, name: sys_fault } - - { type: bss, vram: 0x80145D40, name: audio_synthesis } - - { type: bss, vram: 0x80146D80, name: audio_heap } - - { type: bss, vram: 0x80146D90, name: audio_load } - # padding suggests unused bss for playback, effects, or seqplayer - - { type: bss, vram: 0x80146E60, name: audio_general } - - { type: bss, vram: 0x8014BA40, name: audio_context } - - { type: bss, vram: 0x80155DA0, name: audio_thread } + - { type: .bss, vram: 0x80145D40, name: audio_synthesis } + - { type: .bss, vram: 0x80146D80, name: audio_heap } + - { type: .bss, vram: 0x80146D90, name: audio_load } + - { type: .bss, vram: 0x80146E60, name: audio_general } + - { type: .bss, vram: 0x8014BA40, name: audio_context } + - { type: .bss, vram: 0x80155DA0, name: audio_thread } # Libultra bss - { type: .bss, vram: 0x80156620, name: ../libultra/io/controller }