From da314955643bdb8f1bc05d7f68cb1f67e031761a Mon Sep 17 00:00:00 2001 From: MysterD Date: Wed, 11 Aug 2021 23:24:53 -0700 Subject: [PATCH] Refactor player sounds, added pitch scale for player sounds --- src/audio/external.c | 23 +++++++- src/audio/external.h | 1 + src/game/characters.c | 81 +++++++++++++++++++++++++- src/game/characters.h | 53 ++++++++++++++++- src/game/interaction.c | 26 ++++----- src/game/mario.c | 19 +++--- src/game/mario_actions_airborne.c | 79 +++++++++++++------------ src/game/mario_actions_automatic.c | 12 ++-- src/game/mario_actions_cutscene.c | 49 ++++++++-------- src/game/mario_actions_moving.c | 18 +++--- src/game/mario_actions_object.c | 24 ++++---- src/game/mario_actions_stationary.c | 33 +++++------ src/game/mario_actions_submerged.c | 6 +- src/pc/network/packets/packet_player.c | 2 +- 14 files changed, 285 insertions(+), 141 deletions(-) diff --git a/src/audio/external.c b/src/audio/external.c index b696072e..c4b39cd1 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -173,6 +173,7 @@ u8 audioString118__[] = ""; struct Sound { s32 soundBits; f32 *position; + f32 customFreqScale; }; // size = 0x8 struct ChannelVolumeScaleFade { @@ -193,6 +194,7 @@ struct SoundCharacteristics { u8 unk19; // ttl? sometimes set to 10 u8 prev; u8 next; + f32 customFreqScale; }; // size = 0x1C struct SequenceQueueItem { @@ -496,7 +498,7 @@ struct ChannelVolumeScaleFade D_80360928[3][CHANNELS_MAX]; u8 sUsedChannelsForSoundBank[SOUND_BANK_COUNT]; u8 sCurrentSound[SOUND_BANK_COUNT][MAX_CHANNELS_PER_SOUND]; // index into gSoundBanks // list item memory for D_803320A4 and D_803320B0 -struct SoundCharacteristics gSoundBanks[SOUND_BANK_COUNT][40]; +struct SoundCharacteristics gSoundBanks[SOUND_BANK_COUNT][40] = { 0 }; u8 D_80363808[SOUND_BANK_COUNT]; u8 D_80363812; static u8 sCapVolumeTo40; @@ -784,10 +786,18 @@ void create_next_audio_buffer(s16 *samples, u32 num_samples) { void play_sound(s32 soundBits, f32 *pos) { sSoundRequests[sSoundRequestCount].soundBits = soundBits; sSoundRequests[sSoundRequestCount].position = pos; + sSoundRequests[sSoundRequestCount].customFreqScale = 0; sSoundRequestCount++; } -void process_sound_request(u32 bits, f32 *pos) { +void play_sound_with_freq_scale(s32 soundBits, f32* pos, f32 freqScale) { + sSoundRequests[sSoundRequestCount].soundBits = soundBits; + sSoundRequests[sSoundRequestCount].position = pos; + sSoundRequests[sSoundRequestCount].customFreqScale = freqScale; + sSoundRequestCount++; +} + +void process_sound_request(u32 bits, f32 *pos, f32 freqScale) { u8 bankIndex; u8 index; u8 counter = 0; @@ -814,6 +824,7 @@ void process_sound_request(u32 bits, f32 *pos) { gSoundBanks[bankIndex][index].soundStatus = bits & SOUNDARGS_MASK_STATUS; } gSoundBanks[bankIndex][index].unk19 = 10; + gSoundBanks[bankIndex][index].customFreqScale = freqScale; } index = 0; } else { @@ -836,6 +847,7 @@ void process_sound_request(u32 bits, f32 *pos) { gSoundBanks[bankIndex][index].soundBits = bits; gSoundBanks[bankIndex][index].soundStatus = bits & SOUNDARGS_MASK_STATUS; gSoundBanks[bankIndex][index].unk19 = 10; + gSoundBanks[bankIndex][index].customFreqScale = freqScale; gSoundBanks[bankIndex][index].prev = D_803320A4[bankIndex]; gSoundBanks[bankIndex][D_803320A4[bankIndex]].next = D_803320B0[bankIndex]; D_803320A4[bankIndex] = D_803320B0[bankIndex]; @@ -853,7 +865,7 @@ void process_all_sound_requests(void) { while (sSoundRequestCount != sNumProcessedSoundRequests) { sound = &sSoundRequests[sNumProcessedSoundRequests]; - process_sound_request(sound->soundBits, sound->position); + process_sound_request(sound->soundBits, sound->position, sound->customFreqScale); sNumProcessedSoundRequests++; } } @@ -1505,6 +1517,11 @@ void update_game_sound(void) { } } } + + // add custom pitch bend + if (gSoundBanks[bankIndex][index].customFreqScale != 0) { + gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale *= gSoundBanks[bankIndex][index].customFreqScale; + } channelIndex++; } diff --git a/src/audio/external.h b/src/audio/external.h index cdbd28b6..32ea3400 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -25,6 +25,7 @@ extern u8 gAudioSPTaskYieldBuffer[]; // ucode yield data ptr; only used in JP struct SPTask *create_next_audio_frame_task(void); void play_sound(s32 soundBits, f32 *pos); +void play_sound_with_freq_scale(s32 soundBits, f32* pos, f32 freqScale); void audio_signal_game_loop_tick(void); void sequence_player_fade_out(u8 player, u16 fadeTimer); void fade_volume_scale(u8 player, u8 targetScale, u16 fadeTimer); diff --git a/src/game/characters.c b/src/game/characters.c index 420e0065..9ab61e96 100644 --- a/src/game/characters.c +++ b/src/game/characters.c @@ -6,6 +6,7 @@ #include "audio_defines.h" #include "luigi_audio_defines.h" #include "pc/configfile.h" +#include "audio/external.h" struct Character gCharacters[CT_MAX] = { [CT_MARIO] = { @@ -15,6 +16,7 @@ struct Character gCharacters[CT_MAX] = { .capModelId = MODEL_MARIOS_CAP, .capKleptoAnimState = KLEPTO_ANIM_STATE_HOLDING_CAP, .capUkikiAnimState = UKIKI_ANIM_STATE_HAT_ON, + .soundFreqScale = 1.0f, // sounds .soundYahWahHoo = SOUND_MARIO_YAH_WAH_HOO, .soundHoohoo = SOUND_MARIO_HOOHOO, @@ -67,6 +69,7 @@ struct Character gCharacters[CT_MAX] = { .capModelId = MODEL_LUIGIS_CAP, .capKleptoAnimState = KLEPTO_ANIM_STATE_HOLDING_CAP_LUIGI, .capUkikiAnimState = UKIKI_ANIM_STATE_HAT_ON_LUIGI, + .soundFreqScale = 1.0f, // sounds .soundYahWahHoo = SOUND_LUIGI_YAH_WAH_HOO, .soundHoohoo = SOUND_LUIGI_HOOHOO, @@ -113,7 +116,79 @@ struct Character gCharacters[CT_MAX] = { }, }; -struct Character* get_character_sound(struct MarioState* m) { - if (m == NULL || m->character == NULL) { return &gCharacters[CT_MARIO]; } - return m->character; +struct Character* get_character(struct MarioState* m) { + return (m == NULL || m->character == NULL) + ? &gCharacters[CT_MARIO] + : m->character; +} + +static s32 get_character_sound(struct MarioState* m, enum CharacterSound characterSound) { + if (m == NULL || m->marioObj == NULL) { return 0; } + struct Character* character = ((m == NULL || m->character == NULL) ? &gCharacters[CT_MARIO] : m->character); + switch (characterSound) { + case CHAR_SOUND_YAH_WAH_HOO: return character->soundYahWahHoo; + case CHAR_SOUND_HOOHOO: return character->soundHoohoo; + case CHAR_SOUND_YAHOO: return character->soundYahoo; + case CHAR_SOUND_UH: return character->soundUh; + case CHAR_SOUND_HRMM: return character->soundHrmm; + case CHAR_SOUND_WAH2: return character->soundWah2; + case CHAR_SOUND_WHOA: return character->soundWhoa; + case CHAR_SOUND_EEUH: return character->soundEeuh; + case CHAR_SOUND_ATTACKED: return character->soundAttacked; + case CHAR_SOUND_OOOF: return character->soundOoof; + case CHAR_SOUND_OOOF2: return character->soundOoof2; + case CHAR_SOUND_HERE_WE_GO: return character->soundHereWeGo; + case CHAR_SOUND_YAWNING: return character->soundYawning; + case CHAR_SOUND_SNORING1: return character->soundSnoring1; + case CHAR_SOUND_SNORING2: return character->soundSnoring2; + case CHAR_SOUND_WAAAOOOW: return character->soundWaaaooow; + case CHAR_SOUND_HAHA: return character->soundHaha; + case CHAR_SOUND_HAHA_2: return character->soundHaha_2; + case CHAR_SOUND_UH2: return character->soundUh2; + case CHAR_SOUND_UH2_2: return character->soundUh2_2; + case CHAR_SOUND_ON_FIRE: return character->soundOnFire; + case CHAR_SOUND_DYING: return character->soundDying; + case CHAR_SOUND_PANTING_COLD: return character->soundPantingCold; + case CHAR_SOUND_PANTING: return character->soundPanting; + case CHAR_SOUND_COUGHING1: return character->soundCoughing1; + case CHAR_SOUND_COUGHING2: return character->soundCoughing2; + case CHAR_SOUND_COUGHING3: return character->soundCoughing3; + case CHAR_SOUND_PUNCH_YAH: return character->soundPunchYah; + case CHAR_SOUND_PUNCH_HOO: return character->soundPunchHoo; + case CHAR_SOUND_MAMA_MIA: return character->soundMamaMia; + case CHAR_SOUND_GROUND_POUND_WAH: return character->soundGroundPoundWah; + case CHAR_SOUND_DROWNING: return character->soundDrowning; + case CHAR_SOUND_PUNCH_WAH: return character->soundPunchWah; + case CHAR_SOUND_YAHOO_WAHA_YIPPEE: return character->soundYahooWahaYippee; + case CHAR_SOUND_DOH: return character->soundDoh; + case CHAR_SOUND_GAME_OVER: return character->soundGameOver; + case CHAR_SOUND_HELLO: return character->soundHello; + case CHAR_SOUND_PRESS_START_TO_PLAY: return character->soundPressStartToPlay; + case CHAR_SOUND_TWIRL_BOUNCE: return character->soundTwirlBounce; + case CHAR_SOUND_SNORING3: return character->soundSnoring3; + case CHAR_SOUND_SO_LONGA_BOWSER: return character->soundSoLongaBowser; + case CHAR_SOUND_IMA_TIRED: return character->soundImaTired; + default: return 0; + } +} + +void play_character_sound(struct MarioState* m, enum CharacterSound characterSound) { + s32 sound = get_character_sound(m, characterSound); + if (sound == 0) { return; } + struct Character* character = get_character(m); + play_sound_with_freq_scale(sound, m->marioObj->header.gfx.cameraToObject, character->soundFreqScale); +} + +void play_character_sound_offset(struct MarioState* m, enum CharacterSound characterSound, u8 offset) { + s32 sound = get_character_sound(m, characterSound); + if (sound == 0) { return; } + struct Character* character = get_character(m); + play_sound_with_freq_scale(sound, m->marioObj->header.gfx.cameraToObject, character->soundFreqScale); +} + +void play_character_sound_if_no_flag(struct MarioState* m, enum CharacterSound characterSound, u32 flags) { + if ((m->flags & flags) == 0) { + play_character_sound(m, characterSound); + m->flags |= flags; + } } \ No newline at end of file diff --git a/src/game/characters.h b/src/game/characters.h index a40ce2fd..f0b44151 100644 --- a/src/game/characters.h +++ b/src/game/characters.h @@ -18,6 +18,7 @@ struct Character { u32 capModelId; s32 capKleptoAnimState; s32 capUkikiAnimState; + f32 soundFreqScale; // sounds s32 soundYahWahHoo; s32 soundHoohoo; @@ -62,8 +63,58 @@ struct Character { s32 soundSoLongaBowser; s32 soundImaTired; }; + +enum CharacterSound { + CHAR_SOUND_YAH_WAH_HOO, + CHAR_SOUND_HOOHOO, + CHAR_SOUND_YAHOO, + CHAR_SOUND_UH, + CHAR_SOUND_HRMM, + CHAR_SOUND_WAH2, + CHAR_SOUND_WHOA, + CHAR_SOUND_EEUH, + CHAR_SOUND_ATTACKED, + CHAR_SOUND_OOOF, + CHAR_SOUND_OOOF2, + CHAR_SOUND_HERE_WE_GO, + CHAR_SOUND_YAWNING, + CHAR_SOUND_SNORING1, + CHAR_SOUND_SNORING2, + CHAR_SOUND_WAAAOOOW, + CHAR_SOUND_HAHA, + CHAR_SOUND_HAHA_2, + CHAR_SOUND_UH2, + CHAR_SOUND_UH2_2, + CHAR_SOUND_ON_FIRE, + CHAR_SOUND_DYING, + CHAR_SOUND_PANTING_COLD, + CHAR_SOUND_PANTING, + CHAR_SOUND_COUGHING1, + CHAR_SOUND_COUGHING2, + CHAR_SOUND_COUGHING3, + CHAR_SOUND_PUNCH_YAH, + CHAR_SOUND_PUNCH_HOO, + CHAR_SOUND_MAMA_MIA, + CHAR_SOUND_GROUND_POUND_WAH, + CHAR_SOUND_DROWNING, + CHAR_SOUND_PUNCH_WAH, + CHAR_SOUND_YAHOO_WAHA_YIPPEE, + CHAR_SOUND_DOH, + CHAR_SOUND_GAME_OVER, + CHAR_SOUND_HELLO, + CHAR_SOUND_PRESS_START_TO_PLAY, + CHAR_SOUND_TWIRL_BOUNCE, + CHAR_SOUND_SNORING3, + CHAR_SOUND_SO_LONGA_BOWSER, + CHAR_SOUND_IMA_TIRED, + CHAR_SOUND_MAX // MUST BE LAST +}; + struct MarioState; extern struct Character gCharacters[]; -struct Character* get_character_sound(struct MarioState* m); +struct Character* get_character(struct MarioState* m); +void play_character_sound(struct MarioState* m, enum CharacterSound characterSound); +void play_character_sound_offset(struct MarioState* m, enum CharacterSound characterSound, u8 offset); +void play_character_sound_if_no_flag(struct MarioState* m, enum CharacterSound characterSound, u32 flags); #endif // CHARACTERS_H diff --git a/src/game/interaction.c b/src/game/interaction.c index a01974fb..ab292764 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -799,7 +799,7 @@ u32 take_damage_and_knock_back(struct MarioState *m, struct Object *o) { } if (o->oDamageOrCoinValue > 0) { - play_sound(get_character_sound(m)->soundAttacked, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_ATTACKED); } update_mario_sound_and_camera(m); @@ -1388,7 +1388,7 @@ u32 interact_tornado(struct MarioState *m, UNUSED u32 interactType, struct Objec marioObj->oMarioTornadoYawVel = 0x400; marioObj->oMarioTornadoPosY = m->pos[1] - o->oPosY; - play_sound(get_character_sound(m)->soundWaaaooow, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_WAAAOOOW); queue_rumble_data_mario(m, 30, 60); return set_mario_action(m, ACT_TORNADO_TWIRLING, m->action == ACT_TWIRLING); @@ -1410,7 +1410,7 @@ u32 interact_whirlpool(struct MarioState *m, UNUSED u32 interactType, struct Obj marioObj->oMarioWhirlpoolPosY = m->pos[1] - o->oPosY; - play_sound(get_character_sound(m)->soundWaaaooow, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_WAAAOOOW); queue_rumble_data_mario(m, 30, 60); return set_mario_action(m, ACT_CAUGHT_IN_WHIRLPOOL, 0); @@ -1433,7 +1433,7 @@ u32 interact_strong_wind(struct MarioState *m, UNUSED u32 interactType, struct O m->forwardVel = -24.0f; m->vel[1] = 12.0f; - play_sound(get_character_sound(m)->soundWaaaooow, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_WAAAOOOW); update_mario_sound_and_camera(m); return set_mario_action(m, ACT_GETTING_BLOWN, 0); } @@ -1457,7 +1457,7 @@ u32 interact_flame(struct MarioState *m, UNUSED u32 interactType, struct Object } else { m->marioObj->oMarioBurnTimer = 0; update_mario_sound_and_camera(m); - play_sound(get_character_sound(m)->soundOnFire, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_ON_FIRE); if ((m->action & ACT_FLAG_AIR) && m->vel[1] <= 0.0f) { burningAction = ACT_BURNING_FALL; @@ -1480,7 +1480,7 @@ u32 interact_snufit_bullet(struct MarioState *m, UNUSED u32 interactType, struct m->interactObj = o; take_damage_from_interact_object(m); - play_sound(get_character_sound(m)->soundAttacked, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_ATTACKED); update_mario_sound_and_camera(m); return drop_and_set_mario_action(m, determine_knockback_action(m, o->oDamageOrCoinValue), @@ -1541,7 +1541,7 @@ u32 interact_bully(struct MarioState *m, UNUSED u32 interactType, struct Object m->invincTimer = 2; update_mario_sound_and_camera(m); - play_sound(get_character_sound(m)->soundEeuh, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_EEUH); play_sound(SOUND_OBJ_BULLY_METAL, m->marioObj->header.gfx.cameraToObject); push_mario_out_of_object(m, o, 5.0f); @@ -1563,7 +1563,7 @@ u32 interact_shock(struct MarioState *m, UNUSED u32 interactType, struct Object m->interactObj = o; take_damage_from_interact_object(m); - play_sound(get_character_sound(m)->soundAttacked, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_ATTACKED); queue_rumble_data_mario(m, 70, 60); if (m->action & (ACT_FLAG_SWIMMING | ACT_FLAG_METAL_WATER)) { @@ -1623,7 +1623,7 @@ u32 interact_hit_from_below(struct MarioState *m, UNUSED u32 interactType, struc bounce_off_object(m, o, 80.0f); reset_mario_pitch(m); #ifndef VERSION_JP - play_sound(get_character_sound(m)->soundTwirlBounce, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_TWIRL_BOUNCE); #endif return drop_and_set_mario_action(m, ACT_TWIRLING, 0); } else { @@ -1658,7 +1658,7 @@ u32 interact_bounce_top(struct MarioState *m, UNUSED u32 interactType, struct Ob bounce_off_object(m, o, 80.0f); reset_mario_pitch(m); #ifndef VERSION_JP - play_sound(get_character_sound(m)->soundTwirlBounce, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_TWIRL_BOUNCE); #endif return drop_and_set_mario_action(m, ACT_TWIRLING, 0); } else { @@ -1776,7 +1776,7 @@ u32 check_object_grab_mario(struct MarioState *m, UNUSED u32 interactType, struc m->usedObj = o; update_mario_sound_and_camera(m); - play_sound(get_character_sound(m)->soundOoof, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF); queue_rumble_data_mario(m, 5, 80); return set_mario_action(m, ACT_GRABBED, 0); } @@ -1906,7 +1906,7 @@ u32 interact_cap(struct MarioState *m, UNUSED u32 interactType, struct Object *o } play_sound(SOUND_MENU_STAR_SOUND, m->marioObj->header.gfx.cameraToObject); - play_sound(get_character_sound(m)->soundHereWeGo, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HERE_WE_GO); if (capMusic != 0) { play_cap_music(capMusic); @@ -2122,7 +2122,7 @@ void check_death_barrier(struct MarioState *m) { return; } if (level_trigger_warp(m, WARP_OP_WARP_FLOOR) == 20 && !(m->flags & MARIO_UNKNOWN_18)) { - play_sound(get_character_sound(m)->soundWaaaooow, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_WAAAOOOW); } } } diff --git a/src/game/mario.c b/src/game/mario.c index ecb6ed3c..f6ed97e5 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -266,12 +266,10 @@ void play_mario_jump_sound(struct MarioState *m) { if (!(m->flags & MARIO_MARIO_SOUND_PLAYED)) { #ifndef VERSION_JP if (m->action == ACT_TRIPLE_JUMP) { - play_sound((get_character_sound(m)->soundYahooWahaYippee) + ((gAudioRandom % 5) << 16), - m->marioObj->header.gfx.cameraToObject); + play_character_sound_offset(m, CHAR_SOUND_YAHOO_WAHA_YIPPEE, ((gAudioRandom % 5) << 16)); } else { #endif - play_sound((get_character_sound(m)->soundYahWahHoo) + ((gAudioRandom % 3) << 16), - m->marioObj->header.gfx.cameraToObject); + play_character_sound_offset(m, CHAR_SOUND_YAH_WAH_HOO, ((gAudioRandom % 3) << 16)); #ifndef VERSION_JP } #endif @@ -306,6 +304,11 @@ void play_sound_and_spawn_particles(struct MarioState *m, u32 soundBits, u32 wav } } + if (soundBits == CHAR_SOUND_PUNCH_HOO) { + play_character_sound(m, CHAR_SOUND_PUNCH_HOO); + return; + } + if ((m->flags & MARIO_METAL_CAP) || soundBits == SOUND_ACTION_UNSTUCK_FROM_GROUND || soundBits == SOUND_MARIO_PUNCH_HOO || soundBits == SOUND_LUIGI_PUNCH_HOO) { play_sound(soundBits, m->marioObj->header.gfx.cameraToObject); @@ -377,7 +380,7 @@ void play_mario_sound(struct MarioState *m, s32 actionSound, s32 marioSound) { } if (marioSound != -1) { - play_sound_if_no_flag(m, marioSound, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, marioSound, MARIO_MARIO_SOUND_PLAYED); } } @@ -1924,10 +1927,10 @@ s32 execute_mario_action(UNUSED struct Object *o) { // HACK: mute snoring even when we skip the waking up action if (gMarioState->isSnoring && gMarioState->action != ACT_SLEEPING) { - func_803205E8(get_character_sound(gMarioState)->soundSnoring1, gMarioState->marioObj->header.gfx.cameraToObject); - func_803205E8(get_character_sound(gMarioState)->soundSnoring2, gMarioState->marioObj->header.gfx.cameraToObject); + func_803205E8(get_character(gMarioState)->soundSnoring1, gMarioState->marioObj->header.gfx.cameraToObject); + func_803205E8(get_character(gMarioState)->soundSnoring2, gMarioState->marioObj->header.gfx.cameraToObject); #ifndef VERSION_JP - func_803205E8(get_character_sound(gMarioState)->soundSnoring3, gMarioState->marioObj->header.gfx.cameraToObject); + func_803205E8(get_character(gMarioState)->soundSnoring3, gMarioState->marioObj->header.gfx.cameraToObject); #endif gMarioState->isSnoring = FALSE; } diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c index 1af70f6a..0ff26fa8 100644 --- a/src/game/mario_actions_airborne.c +++ b/src/game/mario_actions_airborne.c @@ -34,7 +34,7 @@ void play_far_fall_sound(struct MarioState *m) { if (!(action & ACT_FLAG_INVULNERABLE) && action != ACT_TWIRLING && action != ACT_FLYING && !(m->flags & MARIO_UNKNOWN_18)) { if (m->peakHeight - m->pos[1] > 1150.0f) { - play_sound(get_character_sound(m)->soundWaaaooow, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_WAAAOOOW); m->flags |= MARIO_UNKNOWN_18; } } @@ -43,9 +43,9 @@ void play_far_fall_sound(struct MarioState *m) { #ifndef VERSION_JP void play_knockback_sound(struct MarioState *m) { if (m->actionArg == 0 && (m->forwardVel <= -28.0f || m->forwardVel >= 28.0f)) { - play_sound_if_no_flag(m, get_character_sound(m)->soundDoh, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_DOH, MARIO_MARIO_SOUND_PLAYED); } else { - play_sound_if_no_flag(m, get_character_sound(m)->soundUh, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_UH, MARIO_MARIO_SOUND_PLAYED); } } #endif @@ -61,7 +61,7 @@ s32 lava_boost_on_wall(struct MarioState *m) { m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 12 : 18; } - play_sound(get_character_sound(m)->soundOnFire, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_ON_FIRE); update_mario_sound_and_camera(m); return drop_and_set_mario_action(m, ACT_LAVA_BOOST, 1); } @@ -90,7 +90,7 @@ s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) { m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 16 : 24; queue_rumble_data_mario(m, 5, 80); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_FALL_DAMAGE); } - play_sound(get_character_sound(m)->soundAttacked, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_ATTACKED); return drop_and_set_mario_action(m, hardFallAction, 4); } else if (fallHeight > damageHeight && !mario_floor_is_slippery(m)) { m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 8 : 12; @@ -98,7 +98,7 @@ s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) { queue_rumble_data_mario(m, 5, 80); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_FALL_DAMAGE); } - play_sound(get_character_sound(m)->soundAttacked, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_ATTACKED); } } } @@ -132,9 +132,9 @@ s32 should_get_stuck_in_ground(struct MarioState *m) { s32 check_fall_damage_or_get_stuck(struct MarioState *m, u32 hardFallAction) { if (should_get_stuck_in_ground(m)) { #ifdef VERSION_JP - play_sound(get_character_sound(m)->soundOoof, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF); #else - play_sound(get_character_sound(m)->soundOoof2, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF2); #endif m->particleFlags |= PARTICLE_MIST_CIRCLE; drop_and_set_mario_action(m, ACT_FEET_STUCK_IN_GROUND, 0); @@ -473,7 +473,7 @@ s32 act_double_jump(struct MarioState *m) { return set_mario_action(m, ACT_GROUND_POUND, 0); } - play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, get_character_sound(m)->soundHoohoo); + play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, CHAR_SOUND_HOOHOO); common_air_action_step(m, ACT_DOUBLE_JUMP_LAND, animation, AIR_STEP_CHECK_LEDGE_GRAB | AIR_STEP_CHECK_HANG); return FALSE; @@ -495,7 +495,7 @@ s32 act_triple_jump(struct MarioState *m) { #ifndef VERSION_JP play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, 0); #else - play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, get_character_sound(m)->soundYahoo); + play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, CHAR_SOUND_YAHOO); #endif common_air_action_step(m, ACT_TRIPLE_JUMP_LAND, MARIO_ANIM_TRIPLE_JUMP, 0); @@ -511,7 +511,7 @@ s32 act_backflip(struct MarioState *m) { return set_mario_action(m, ACT_GROUND_POUND, 0); } - play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, get_character_sound(m)->soundYahWahHoo); + play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, CHAR_SOUND_YAH_WAH_HOO); common_air_action_step(m, ACT_BACKFLIP_LAND, MARIO_ANIM_BACKFLIP, 0); if (m->action == ACT_BACKFLIP_LAND) { @@ -636,10 +636,10 @@ s32 act_long_jump(struct MarioState *m) { animation = MARIO_ANIM_SLOW_LONGJUMP; } - play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, get_character_sound(m)->soundYahoo); + play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, CHAR_SOUND_YAHOO); if (m->floor->type == SURFACE_VERTICAL_WIND && m->actionState == 0) { - play_sound(get_character_sound(m)->soundHereWeGo, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HERE_WE_GO); m->actionState = 1; } @@ -719,7 +719,7 @@ s32 act_twirling(struct MarioState *m) { s32 act_dive(struct MarioState *m) { if (m->actionArg == 0) { - play_mario_sound(m, SOUND_ACTION_THROW, get_character_sound(m)->soundHoohoo); + play_mario_sound(m, SOUND_ACTION_THROW, CHAR_SOUND_HOOHOO); } else { play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, 0); } @@ -752,9 +752,9 @@ s32 act_dive(struct MarioState *m) { if (should_get_stuck_in_ground(m) && m->faceAngle[0] == -0x2AAA) { queue_rumble_data_mario(m, 5, 80); #ifdef VERSION_JP - play_sound(get_character_sound(m)->soundOoof, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF); #else - play_sound(get_character_sound(m)->soundOoof2, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF2); #endif m->particleFlags |= PARTICLE_MIST_CIRCLE; drop_and_set_mario_action(m, ACT_HEAD_STUCK_IN_GROUND, 0); @@ -793,7 +793,7 @@ s32 act_air_throw(struct MarioState *m) { mario_throw_held_object(m); } - play_sound_if_no_flag(m, get_character_sound(m)->soundWah2, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WAH2, MARIO_MARIO_SOUND_PLAYED); set_mario_animation(m, MARIO_ANIM_THROW_LIGHT_OBJECT); update_air_without_turn(m); @@ -937,7 +937,7 @@ s32 act_ground_pound(struct MarioState *m) { m->actionTimer++; if (m->actionTimer >= m->marioObj->header.gfx.unk38.curAnim->unk08 + 4) { - play_sound(get_character_sound(m)->soundGroundPoundWah, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_GROUND_POUND_WAH); m->actionState = 1; } } else { @@ -948,9 +948,9 @@ s32 act_ground_pound(struct MarioState *m) { if (should_get_stuck_in_ground(m)) { queue_rumble_data_mario(m, 5, 80); #ifdef VERSION_JP - play_sound(get_character_sound(m)->soundOoof, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF); #else - play_sound(get_character_sound(m)->soundOoof2, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF2); #endif m->particleFlags |= PARTICLE_MIST_CIRCLE; set_mario_action(m, ACT_BUTT_STUCK_IN_GROUND, 0); @@ -1162,7 +1162,7 @@ s32 act_backward_air_kb(struct MarioState *m) { #ifndef VERSION_JP play_knockback_sound(m); #else - play_sound_if_no_flag(m, get_character_sound(m)->soundUh, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_UH, MARIO_MARIO_SOUND_PLAYED); #endif common_air_knockback_step(m, ACT_BACKWARD_GROUND_KB, ACT_HARD_BACKWARD_GROUND_KB, 0x0002, -16.0f); return FALSE; @@ -1176,7 +1176,7 @@ s32 act_forward_air_kb(struct MarioState *m) { #ifndef VERSION_JP play_knockback_sound(m); #else - play_sound_if_no_flag(m, get_character_sound(m)->soundUh, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_UH, MARIO_MARIO_SOUND_PLAYED); #endif common_air_knockback_step(m, ACT_FORWARD_GROUND_KB, ACT_HARD_FORWARD_GROUND_KB, 0x002D, 16.0f); return FALSE; @@ -1186,7 +1186,7 @@ s32 act_hard_backward_air_kb(struct MarioState *m) { #ifndef VERSION_JP play_knockback_sound(m); #else - play_sound_if_no_flag(m, get_character_sound(m)->soundUh, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_UH, MARIO_MARIO_SOUND_PLAYED); #endif common_air_knockback_step(m, ACT_HARD_BACKWARD_GROUND_KB, ACT_HARD_BACKWARD_GROUND_KB, 0x0002, -16.0f); @@ -1197,7 +1197,7 @@ s32 act_hard_forward_air_kb(struct MarioState *m) { #ifndef VERSION_JP play_knockback_sound(m); #else - play_sound_if_no_flag(m, get_character_sound(m)->soundUh, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_UH, MARIO_MARIO_SOUND_PLAYED); #endif common_air_knockback_step(m, ACT_HARD_FORWARD_GROUND_KB, ACT_HARD_FORWARD_GROUND_KB, 0x002D, 16.0f); return FALSE; @@ -1211,7 +1211,7 @@ s32 act_thrown_backward(struct MarioState *m) { landAction = ACT_BACKWARD_GROUND_KB; } - play_sound_if_no_flag(m, get_character_sound(m)->soundWaaaooow, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WAAAOOOW, MARIO_MARIO_SOUND_PLAYED); common_air_knockback_step(m, landAction, ACT_HARD_BACKWARD_GROUND_KB, 0x0002, m->forwardVel); @@ -1229,7 +1229,7 @@ s32 act_thrown_forward(struct MarioState *m) { landAction = ACT_FORWARD_GROUND_KB; } - play_sound_if_no_flag(m, get_character_sound(m)->soundWaaaooow, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WAAAOOOW, MARIO_MARIO_SOUND_PLAYED); if (common_air_knockback_step(m, landAction, ACT_HARD_FORWARD_GROUND_KB, 0x002D, m->forwardVel) == AIR_STEP_NONE) { @@ -1253,7 +1253,7 @@ s32 act_soft_bonk(struct MarioState *m) { #ifndef VERSION_JP play_knockback_sound(m); #else - play_sound_if_no_flag(m, get_character_sound(m)->soundUh, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_UH, MARIO_MARIO_SOUND_PLAYED); #endif common_air_knockback_step(m, ACT_FREEFALL_LAND, ACT_HARD_BACKWARD_GROUND_KB, 0x0056, m->forwardVel); @@ -1283,7 +1283,7 @@ s32 act_getting_blown(struct MarioState *m) { mario_set_forward_vel(m, m->forwardVel); #ifdef VERSION_JP - play_sound_if_no_flag(m, get_character_sound(m)->soundUh, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_UH, MARIO_MARIO_SOUND_PLAYED); #endif set_mario_animation(m, MARIO_ANIM_BACKWARD_AIR_KB); @@ -1512,10 +1512,10 @@ s32 act_hold_butt_slide_air(struct MarioState *m) { s32 act_lava_boost(struct MarioState *m) { if (!(m->flags & MARIO_MARIO_SOUND_PLAYED)) { - play_sound_if_no_flag(m, get_character_sound(m)->soundOnFire, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_ON_FIRE, MARIO_MARIO_SOUND_PLAYED); queue_rumble_data_mario(m, 5, 80); } - play_sound_if_no_flag(m, get_character_sound(m)->soundOnFire, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_ON_FIRE, MARIO_MARIO_SOUND_PLAYED); if (!(m->input & INPUT_NONZERO_ANALOG)) { m->forwardVel = approach_f32(m->forwardVel, 0.0f, 0.35f, 0.35f); @@ -1531,7 +1531,7 @@ s32 act_lava_boost(struct MarioState *m) { m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 12 : 18; } m->vel[1] = 84.0f; - play_sound(get_character_sound(m)->soundOnFire, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_ON_FIRE); queue_rumble_data_mario(m, 5, 80); } else { play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_BODY_HIT_GROUND); @@ -1581,7 +1581,7 @@ s32 act_lava_boost(struct MarioState *m) { s32 act_slide_kick(struct MarioState *m) { if (m->actionTimer == 0) { - play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, get_character_sound(m)->soundHoohoo); + play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, CHAR_SOUND_HOOHOO); set_mario_animation(m, MARIO_ANIM_SLIDE_KICK); } @@ -1634,7 +1634,7 @@ s32 act_jump_kick(struct MarioState *m) { s32 animFrame; if (m->actionState == 0) { - play_sound_if_no_flag(m, get_character_sound(m)->soundPunchHoo, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_PUNCH_HOO, MARIO_ACTION_SOUND_PLAYED); m->marioObj->header.gfx.unk38.animID = -1; set_mario_animation(m, MARIO_ANIM_AIR_KICK); m->actionState = 1; @@ -1675,7 +1675,7 @@ s32 act_shot_from_cannon(struct MarioState *m) { mario_set_forward_vel(m, m->forwardVel); - play_sound_if_no_flag(m, get_character_sound(m)->soundYahoo, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_YAHOO, MARIO_MARIO_SOUND_PLAYED); switch (perform_air_step(m, 0)) { case AIR_STEP_NONE: @@ -1924,8 +1924,7 @@ s32 act_flying(struct MarioState *m) { if (startPitch <= 0 && m->faceAngle[0] > 0 && m->forwardVel >= 48.0f) { play_sound(SOUND_ACTION_FLYING_FAST, m->marioObj->header.gfx.cameraToObject); #ifndef VERSION_JP - play_sound((get_character_sound(m)->soundYahooWahaYippee) + ((gAudioRandom % 5) << 16), - m->marioObj->header.gfx.cameraToObject); + play_character_sound_offset(m, CHAR_SOUND_YAHOO_WAHA_YIPPEE, ((gAudioRandom % 5) << 16)); #endif queue_rumble_data_mario(m, 50, 40); } @@ -1948,7 +1947,7 @@ s32 act_riding_hoot(struct MarioState *m) { m->usedObj->oInteractStatus = 0; m->usedObj->oHootMarioReleaseTime = gGlobalTimer; - play_sound_if_no_flag(m, get_character_sound(m)->soundUh, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_UH, MARIO_MARIO_SOUND_PLAYED); queue_rumble_data_mario(m, 4, 40); return set_mario_action(m, ACT_FREEFALL, 0); } @@ -2005,7 +2004,7 @@ s32 act_flying_triple_jump(struct MarioState *m) { } #endif - play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, get_character_sound(m)->soundYahoo); + play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, CHAR_SOUND_YAHOO); if (m->actionState == 0) { set_mario_animation(m, MARIO_ANIM_TRIPLE_JUMP_FLY); @@ -2083,7 +2082,7 @@ s32 act_vertical_wind(struct MarioState *m) { s16 intendedDYaw = m->intendedYaw - m->faceAngle[1]; f32 intendedMag = m->intendedMag / 32.0f; - play_sound_if_no_flag(m, get_character_sound(m)->soundHereWeGo, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_HERE_WE_GO, MARIO_MARIO_SOUND_PLAYED); if (m->actionState == 0) { set_mario_animation(m, MARIO_ANIM_FORWARD_SPINNING_FLIP); if (m->marioObj->header.gfx.unk38.animFrame == 1) { @@ -2124,7 +2123,7 @@ s32 act_special_triple_jump(struct MarioState *m) { return set_mario_action(m, ACT_GROUND_POUND, 0); } - play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, get_character_sound(m)->soundYahoo); + play_mario_sound(m, SOUND_ACTION_TERRAIN_JUMP, CHAR_SOUND_YAHOO); update_air_without_turn(m); diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index 934c394a..0aee87bf 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -236,7 +236,7 @@ s32 act_climbing_pole(struct MarioState *m) { s32 act_grab_pole_slow(struct MarioState *m) { if (m->usedObj == NULL) { m->usedObj = cur_obj_find_nearest_pole(); } - play_sound_if_no_flag(m, get_character_sound(m)->soundWhoa, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WHOA, MARIO_MARIO_SOUND_PLAYED); if (set_pole_position(m, 0.0f) == POLE_NONE) { set_mario_animation(m, MARIO_ANIM_GRAB_POLE_SHORT); @@ -253,7 +253,7 @@ s32 act_grab_pole_fast(struct MarioState *m) { struct Object *marioObj = m->marioObj; if (m->usedObj == NULL) { m->usedObj = cur_obj_find_nearest_pole(); } - play_sound_if_no_flag(m, get_character_sound(m)->soundWhoa, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WHOA, MARIO_MARIO_SOUND_PLAYED); m->faceAngle[1] += marioObj->oMarioPoleYawVel; marioObj->oMarioPoleYawVel = marioObj->oMarioPoleYawVel * 8 / 10; @@ -598,7 +598,7 @@ s32 act_ledge_grab(struct MarioState *m) { } if (m->actionArg == 0) { - play_sound_if_no_flag(m, get_character_sound(m)->soundWhoa, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WHOA, MARIO_MARIO_SOUND_PLAYED); } stop_and_set_height_to_floor(m); @@ -620,7 +620,7 @@ s32 act_ledge_climb_slow(struct MarioState *m) { } if (m->actionTimer == 10) { - play_sound_if_no_flag(m, get_character_sound(m)->soundEeuh, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_EEUH, MARIO_MARIO_SOUND_PLAYED); } update_ledge_climb(m, MARIO_ANIM_SLOW_LEDGE_GRAB, ACT_IDLE); @@ -638,7 +638,7 @@ s32 act_ledge_climb_down(struct MarioState *m) { return let_go_of_ledge(m); } - play_sound_if_no_flag(m, get_character_sound(m)->soundWhoa, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WHOA, MARIO_MARIO_SOUND_PLAYED); update_ledge_climb(m, MARIO_ANIM_CLIMB_DOWN_LEDGE, ACT_LEDGE_GRAB); m->actionArg = 1; @@ -651,7 +651,7 @@ s32 act_ledge_climb_fast(struct MarioState *m) { return let_go_of_ledge(m); } - play_sound_if_no_flag(m, get_character_sound(m)->soundUh2, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_UH2, MARIO_MARIO_SOUND_PLAYED); update_ledge_climb(m, MARIO_ANIM_FAST_LEDGE_GRAB, ACT_IDLE); diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 43867cad..56749321 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -675,7 +675,7 @@ void general_star_dance_handler(struct MarioState *m, s32 isInWater) { break; case 42: - play_sound(get_character_sound(m)->soundHereWeGo, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HERE_WE_GO); break; case 80: @@ -770,7 +770,7 @@ s32 act_standing_death(struct MarioState *m) { return set_mario_action(m, ACT_SUFFOCATION, 0); } - play_sound_if_no_flag(m, get_character_sound(m)->soundDying, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_DYING, MARIO_ACTION_SOUND_PLAYED); common_death_handler(m, MARIO_ANIM_DYING_FALL_OVER, 80); if (m->marioObj->header.gfx.unk38.animFrame == 77) { play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_BODY_HIT_GROUND); @@ -779,19 +779,19 @@ s32 act_standing_death(struct MarioState *m) { } s32 act_electrocution(struct MarioState *m) { - play_sound_if_no_flag(m, get_character_sound(m)->soundDying, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_DYING, MARIO_ACTION_SOUND_PLAYED); common_death_handler(m, MARIO_ANIM_ELECTROCUTION, 43); return FALSE; } s32 act_suffocation(struct MarioState *m) { - play_sound_if_no_flag(m, get_character_sound(m)->soundDying, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_DYING, MARIO_ACTION_SOUND_PLAYED); common_death_handler(m, MARIO_ANIM_SUFFOCATING, 86); return FALSE; } s32 act_death_on_back(struct MarioState *m) { - play_sound_if_no_flag(m, get_character_sound(m)->soundDying, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_DYING, MARIO_ACTION_SOUND_PLAYED); if (common_death_handler(m, MARIO_ANIM_DYING_ON_BACK, 54) == 40) { play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_BODY_HIT_GROUND); } @@ -799,7 +799,7 @@ s32 act_death_on_back(struct MarioState *m) { } s32 act_death_on_stomach(struct MarioState *m) { - play_sound_if_no_flag(m, get_character_sound(m)->soundDying, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_DYING, MARIO_ACTION_SOUND_PLAYED); if (common_death_handler(m, MARIO_ANIM_DYING_ON_STOMACH, 37) == 37) { play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_BODY_HIT_GROUND); } @@ -814,7 +814,7 @@ s32 act_quicksand_death(struct MarioState *m) { } if (m->actionState == 1) { if (m->quicksandDepth >= 100.0f) { - play_sound_if_no_flag(m, get_character_sound(m)->soundWaaaooow, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WAAAOOOW, MARIO_MARIO_SOUND_PLAYED); } if ((m->quicksandDepth += 5.0f) >= 180.0f) { //level_trigger_warp(m, WARP_OP_DEATH); @@ -828,7 +828,7 @@ s32 act_quicksand_death(struct MarioState *m) { } s32 act_eaten_by_bubba(struct MarioState *m) { - play_sound_if_no_flag(m, get_character_sound(m)->soundDying, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_DYING, MARIO_ACTION_SOUND_PLAYED); set_mario_animation(m, MARIO_ANIM_A_POSE); //m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; if (m != &gMarioStates[0]) { @@ -1093,7 +1093,7 @@ s32 act_emerge_from_pipe(struct MarioState *m) { marioObj->header.gfx.node.flags |= GRAPH_RENDER_ACTIVE; - play_sound_if_no_flag(m, get_character_sound(m)->soundYahoo, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_YAHOO, MARIO_MARIO_SOUND_PLAYED); if (gCurrLevelNum == LEVEL_THI) { if (gCurrAreaIndex == 2) { @@ -1280,9 +1280,9 @@ s32 act_death_exit(struct MarioState *m) { if (15 < m->actionTimer++ && launch_mario_until_land(m, ACT_DEATH_EXIT_LAND, MARIO_ANIM_GENERAL_FALL, -32.0f)) { #ifdef VERSION_JP - play_sound(get_character_sound(m)->soundOoof, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF); #else - play_sound(get_character_sound(m)->soundOoof2, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF2); #endif queue_rumble_data_mario(m, 5, 80); //m->numLives--; @@ -1297,9 +1297,9 @@ s32 act_death_exit(struct MarioState *m) { s32 act_unused_death_exit(struct MarioState *m) { if (launch_mario_until_land(m, ACT_FREEFALL_LAND_STOP, MARIO_ANIM_GENERAL_FALL, 0.0f)) { #ifdef VERSION_JP - play_sound(get_character_sound(m)->soundOoof, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF); #else - play_sound(get_character_sound(m)->soundOoof2, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF2); #endif //m->numLives--; // restore 7.75 units of health @@ -1313,9 +1313,9 @@ s32 act_unused_death_exit(struct MarioState *m) { s32 act_falling_death_exit(struct MarioState *m) { if (launch_mario_until_land(m, ACT_DEATH_EXIT_LAND, MARIO_ANIM_GENERAL_FALL, 0.0f)) { #ifdef VERSION_JP - play_sound(get_character_sound(m)->soundOoof, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF); #else - play_sound(get_character_sound(m)->soundOoof2, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_OOOF2); #endif queue_rumble_data_mario(m, 5, 80); //m->numLives--; @@ -1331,7 +1331,7 @@ s32 act_falling_death_exit(struct MarioState *m) { s32 act_special_exit_airborne(struct MarioState *m) { struct Object *marioObj = m->marioObj; - play_sound_if_no_flag(m, get_character_sound(m)->soundYahoo, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_YAHOO, MARIO_MARIO_SOUND_PLAYED); if (m->actionTimer++ < 11) { marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; @@ -1581,7 +1581,7 @@ s32 act_teleport_fade_in(struct MarioState *m) { } s32 act_shocked(struct MarioState *m) { - play_sound_if_no_flag(m, get_character_sound(m)->soundWaaaooow, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WAAAOOOW, MARIO_MARIO_SOUND_PLAYED); play_sound(SOUND_MOVING_SHOCKED, m->marioObj->header.gfx.cameraToObject); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_SHOCK); } @@ -1643,7 +1643,7 @@ s32 act_squished(struct MarioState *m) { if (!(m->flags & MARIO_METAL_CAP) && m->invincTimer == 0) { // cap on: 3 units; cap off: 4.5 units m->hurtCounter += m->flags & MARIO_CAP_ON_HEAD ? 12 : 18; - play_sound_if_no_flag(m, get_character_sound(m)->soundAttacked, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_ATTACKED, MARIO_MARIO_SOUND_PLAYED); } // Both of the 1.8's are really floats, but one of them has to @@ -1888,9 +1888,9 @@ static void intro_cutscene_jump_out_of_pipe(struct MarioState *m) { #ifdef VERSION_EU // For some reason these calls were swapped. play_sound_if_no_flag(m, SOUND_ACTION_HIT_3, MARIO_ACTION_SOUND_PLAYED); - play_sound_if_no_flag(m, get_character_sound(m)->soundYahoo, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_YAHOO, MARIO_MARIO_SOUND_PLAYED); #else - play_sound_if_no_flag(m, get_character_sound(m)->soundYahoo, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_YAHOO, MARIO_MARIO_SOUND_PLAYED); #ifndef VERSION_JP play_sound_if_no_flag(m, SOUND_ACTION_HIT_3, MARIO_ACTION_SOUND_PLAYED); #endif @@ -1902,7 +1902,7 @@ static void intro_cutscene_jump_out_of_pipe(struct MarioState *m) { sound_banks_enable(2, 0x0330); play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING); #ifndef VERSION_JP - play_sound(get_character_sound(m)->soundHaha, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HAHA); #endif advance_cutscene_step(m); } @@ -2050,16 +2050,15 @@ static s32 jumbo_star_cutscene_taking_off(struct MarioState *m) { switch (animFrame) { case 3: - play_sound((get_character_sound(m)->soundYahWahHoo) + (gAudioRandom % 3 << 16), - m->marioObj->header.gfx.cameraToObject); + play_character_sound_offset(m, CHAR_SOUND_YAH_WAH_HOO, (gAudioRandom % 3 << 16)); break; case 28: - play_sound(get_character_sound(m)->soundHoohoo, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HOOHOO); break; case 60: - play_sound(get_character_sound(m)->soundYahoo, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_YAHOO); break; } m->particleFlags |= PARTICLE_SPARKLES; diff --git a/src/game/mario_actions_moving.c b/src/game/mario_actions_moving.c index cd34fe0c..975247b3 100644 --- a/src/game/mario_actions_moving.c +++ b/src/game/mario_actions_moving.c @@ -1387,7 +1387,7 @@ void common_slide_action(struct MarioState *m, u32 endAction, u32 airAction, s32 case GROUND_STEP_LEFT_GROUND: set_mario_action(m, airAction, 0); if (m->forwardVel < -50.0f || 50.0f < m->forwardVel) { - play_sound(get_character_sound(m)->soundHoohoo, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HOOHOO); } break; @@ -1607,12 +1607,12 @@ s32 common_ground_knockback_action(struct MarioState *m, s32 animation, s32 arg2 } if (arg4 > 0) { - play_sound_if_no_flag(m, get_character_sound(m)->soundAttacked, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_ATTACKED, MARIO_MARIO_SOUND_PLAYED); } else { #ifdef VERSION_JP - play_sound_if_no_flag(m, get_character_sound(m)->soundOoof, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_OOOF, MARIO_MARIO_SOUND_PLAYED); #else - play_sound_if_no_flag(m, get_character_sound(m)->soundOoof2, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_OOOF2, MARIO_MARIO_SOUND_PLAYED); #endif } @@ -1663,7 +1663,7 @@ s32 act_hard_backward_ground_kb(struct MarioState *m) { #ifndef VERSION_JP if (val04 == 0x36 && m->prevAction == ACT_SPECIAL_DEATH_EXIT) { - play_sound(get_character_sound(m)->soundMamaMia, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_MAMA_MIA); } #endif @@ -1720,7 +1720,7 @@ s32 act_death_exit_land(struct MarioState *m) { val04 = set_mario_animation(m, MARIO_ANIM_FALL_OVER_BACKWARDS); if (val04 == 0x36) { - play_sound(get_character_sound(m)->soundMamaMia, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_MAMA_MIA); } if (val04 == 0x44) { play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING); @@ -1875,7 +1875,7 @@ s32 act_long_jump_land(struct MarioState *m) { } if (!(m->input & INPUT_NONZERO_ANALOG)) { - play_sound_if_no_flag(m, get_character_sound(m)->soundUh2_2, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_UH2_2, MARIO_MARIO_SOUND_PLAYED); } common_landing_action(m, @@ -1901,7 +1901,7 @@ s32 act_triple_jump_land(struct MarioState *m) { } if (!(m->input & INPUT_NONZERO_ANALOG)) { - play_sound_if_no_flag(m, get_character_sound(m)->soundHaha, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_HAHA, MARIO_MARIO_SOUND_PLAYED); } common_landing_action(m, MARIO_ANIM_TRIPLE_JUMP_LAND, ACT_FREEFALL); @@ -1918,7 +1918,7 @@ s32 act_backflip_land(struct MarioState *m) { } if (!(m->input & INPUT_NONZERO_ANALOG)) { - play_sound_if_no_flag(m, get_character_sound(m)->soundHaha, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_HAHA, MARIO_MARIO_SOUND_PLAYED); } common_landing_action(m, MARIO_ANIM_TRIPLE_JUMP_LAND, ACT_FREEFALL); diff --git a/src/game/mario_actions_object.c b/src/game/mario_actions_object.c index bdae3ce0..04a1e54b 100644 --- a/src/game/mario_actions_object.c +++ b/src/game/mario_actions_object.c @@ -41,7 +41,7 @@ s32 mario_update_punch_sequence(struct MarioState *m) { switch (m->actionArg) { case 0: - play_sound(get_character_sound(m)->soundPunchYah, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_PUNCH_YAH); // Fall-through: case 1: set_mario_animation(m, MARIO_ANIM_FIRST_PUNCH); @@ -81,7 +81,7 @@ s32 mario_update_punch_sequence(struct MarioState *m) { break; case 3: - play_sound(get_character_sound(m)->soundPunchYah, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_PUNCH_YAH); // Fall-through: case 4: set_mario_animation(m, MARIO_ANIM_SECOND_PUNCH); @@ -116,7 +116,7 @@ s32 mario_update_punch_sequence(struct MarioState *m) { break; case 6: - play_mario_action_sound(m, get_character_sound(m)->soundPunchHoo, 1); + play_mario_action_sound(m, CHAR_SOUND_PUNCH_HOO, 1); animFrame = set_mario_animation(m, MARIO_ANIM_GROUND_KICK); if (animFrame == 0) { m->marioBodyState->punchState = (2 << 6) | 6; @@ -132,7 +132,7 @@ s32 mario_update_punch_sequence(struct MarioState *m) { break; case 9: - play_mario_action_sound(m, get_character_sound(m)->soundPunchHoo, 1); + play_mario_action_sound(m, CHAR_SOUND_PUNCH_HOO, 1); set_mario_animation(m, MARIO_ANIM_BREAKDANCE); animFrame = m->marioObj->header.gfx.unk38.animFrame; @@ -192,7 +192,7 @@ s32 act_picking_up(struct MarioState *m) { // slot (cloning via fake object). mario_grab_used_object(m); if (m->heldObj != NULL) { - play_sound_if_no_flag(m, get_character_sound(m)->soundHrmm, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_HRMM, MARIO_MARIO_SOUND_PLAYED); m->actionState = 1; } else { set_mario_action(m, ACT_IDLE, 0); @@ -272,7 +272,7 @@ s32 act_throwing(struct MarioState *m) { if (++m->actionTimer == 7) { mario_throw_held_object(m); - play_sound_if_no_flag(m, get_character_sound(m)->soundWah2, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WAH2, MARIO_MARIO_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED); queue_rumble_data_mario(m, 3, 50); } @@ -292,7 +292,7 @@ s32 act_heavy_throw(struct MarioState *m) { if (++m->actionTimer == 13) { mario_drop_held_object(m); - play_sound_if_no_flag(m, get_character_sound(m)->soundWah2, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WAH2, MARIO_MARIO_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_ACTION_THROW, MARIO_ACTION_SOUND_PLAYED); queue_rumble_data_mario(m, 3, 50); } @@ -329,7 +329,7 @@ s32 act_picking_up_bowser(struct MarioState *m) { mario_grab_used_object(m); if (m->heldObj != NULL) { queue_rumble_data_mario(m, 5, 80); - play_sound(get_character_sound(m)->soundHrmm, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HRMM); if (m->playerIndex == 0) { network_send_object(m->heldObj); } else { @@ -358,7 +358,7 @@ s32 act_holding_bowser(struct MarioState *m) { mario_grab_used_object(m); if (m->heldObj != NULL) { queue_rumble_data_mario(m, 5, 80); - play_sound(get_character_sound(m)->soundHrmm, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HRMM); } else { set_mario_action(m, ACT_IDLE, 0); return FALSE; @@ -371,12 +371,12 @@ s32 act_holding_bowser(struct MarioState *m) { if (m->playerIndex == 0 && m->input & INPUT_B_PRESSED) { #ifndef VERSION_JP if (m->angleVel[1] <= -0xE00 || m->angleVel[1] >= 0xE00) { - play_sound(get_character_sound(m)->soundSoLongaBowser, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_SO_LONGA_BOWSER); } else { - play_sound(get_character_sound(m)->soundHereWeGo, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HERE_WE_GO); } #else - play_sound(get_character_sound(m)->soundHereWeGo, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HERE_WE_GO); #endif return set_mario_action(m, ACT_RELEASING_BOWSER, 0); } diff --git a/src/game/mario_actions_stationary.c b/src/game/mario_actions_stationary.c index 2e0c3fca..3388c65c 100644 --- a/src/game/mario_actions_stationary.c +++ b/src/game/mario_actions_stationary.c @@ -245,18 +245,18 @@ s32 act_start_sleeping(struct MarioState *m) { #ifndef VERSION_JP if (m->actionState == 2) { if (sp24 == -1) { - play_sound(get_character_sound(m)->soundYawning, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_YAWNING); } } if (m->actionState == 1) { if (sp24 == -1) { - play_sound(get_character_sound(m)->soundImaTired, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_IMA_TIRED); } } #else if (m->actionState == 2) { - play_sound_if_no_flag(m, get_character_sound(m)->soundYawning, MARIO_MARIO_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_YAWNING, MARIO_MARIO_SOUND_PLAYED); } #endif @@ -291,12 +291,12 @@ s32 act_sleeping(struct MarioState *m) { } if (sp24 == 2) { - play_sound(get_character_sound(m)->soundSnoring1, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_SNORING1); m->isSnoring = TRUE; } if (sp24 == 20) { - play_sound(get_character_sound(m)->soundSnoring2, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_SNORING2); m->isSnoring = TRUE; } @@ -321,16 +321,16 @@ s32 act_sleeping(struct MarioState *m) { case 2: { sp24 = set_mario_animation(m, MARIO_ANIM_SLEEP_LYING); #ifndef VERSION_JP - play_sound_if_no_flag(m, get_character_sound(m)->soundSnoring3, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_SNORING3, MARIO_MARIO_SOUND_PLAYED); m->isSnoring = TRUE; #else if (sp24 == 2) { - play_sound(get_character_sound(m)->soundSnoring2, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_SNORING2); m->isSnoring = TRUE; } if (sp24 == 25) { - play_sound(get_character_sound(m)->soundSnoring1, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_SNORING1); m->isSnoring = TRUE; } #endif @@ -342,10 +342,10 @@ s32 act_sleeping(struct MarioState *m) { s32 act_waking_up(struct MarioState *m) { if (!m->actionTimer) { - func_803205E8(get_character_sound(m)->soundSnoring1, m->marioObj->header.gfx.cameraToObject); - func_803205E8(get_character_sound(m)->soundSnoring2, m->marioObj->header.gfx.cameraToObject); + func_803205E8(get_character(m)->soundSnoring1, m->marioObj->header.gfx.cameraToObject); + func_803205E8(get_character(m)->soundSnoring2, m->marioObj->header.gfx.cameraToObject); #ifndef VERSION_JP - func_803205E8(get_character_sound(m)->soundSnoring3, m->marioObj->header.gfx.cameraToObject); + func_803205E8(get_character(m)->soundSnoring3, m->marioObj->header.gfx.cameraToObject); #endif if (m->playerIndex == 0) { raise_background_noise(2); @@ -402,7 +402,7 @@ s32 act_shivering(struct MarioState *m) { sp24 = set_mario_animation(m, MARIO_ANIM_SHIVERING_WARMING_HAND); if (sp24 == 0x31) { m->particleFlags |= PARTICLE_BREATH; - play_sound(get_character_sound(m)->soundPantingCold, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_PANTING_COLD); } if (sp24 == 7 || sp24 == 0x51) { play_sound(SOUND_ACTION_CLAP_HANDS_COLD, m->marioObj->header.gfx.cameraToObject); @@ -440,15 +440,15 @@ s32 act_coughing(struct MarioState *m) { stationary_ground_step(m); sp1C = set_mario_animation(m, MARIO_ANIM_COUGHING); if (sp1C == 0x19 || sp1C == 0x23) { - play_sound(get_character_sound(m)->soundCoughing3, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_COUGHING3); } if (sp1C == 0x32 || sp1C == 0x3A) { - play_sound(get_character_sound(m)->soundCoughing2, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_COUGHING2); } if (sp1C == 0x47 || sp1C == 0x50) { - play_sound(get_character_sound(m)->soundCoughing1, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_COUGHING1); } return 0; @@ -595,8 +595,7 @@ s32 act_panting(struct MarioState *m) { } if (set_mario_animation(m, MARIO_ANIM_WALK_PANTING) == 1) { - play_sound(get_character_sound(m)->soundPanting + ((gAudioRandom % 3U) << 0x10), - m->marioObj->header.gfx.cameraToObject); + play_character_sound_offset(m, CHAR_SOUND_PANTING, ((gAudioRandom % 3U) << 0x10)); } stationary_ground_step(m); diff --git a/src/game/mario_actions_submerged.c b/src/game/mario_actions_submerged.c index 6909c69e..0c0c33f2 100644 --- a/src/game/mario_actions_submerged.c +++ b/src/game/mario_actions_submerged.c @@ -890,7 +890,7 @@ static s32 act_forward_water_kb(struct MarioState *m) { } static s32 act_water_shocked(struct MarioState *m) { - play_sound_if_no_flag(m, get_character_sound(m)->soundWaaaooow, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_WAAAOOOW, MARIO_MARIO_SOUND_PLAYED); play_sound(SOUND_MOVING_SHOCKED, m->marioObj->header.gfx.cameraToObject); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_SHOCK); } @@ -930,7 +930,7 @@ static s32 act_drowning(struct MarioState *m) { break; } - play_sound_if_no_flag(m, get_character_sound(m)->soundDrowning, MARIO_ACTION_SOUND_PLAYED); + play_character_sound_if_no_flag(m, CHAR_SOUND_DROWNING, MARIO_ACTION_SOUND_PLAYED); stationary_slow_down(m); perform_water_step(m); @@ -978,7 +978,7 @@ static s32 act_water_plunge(struct MarioState *m) { if (m->actionState == 0) { play_sound(SOUND_ACTION_UNKNOWN430, m->marioObj->header.gfx.cameraToObject); if (m->peakHeight - m->pos[1] > 1150.0f) { - play_sound(get_character_sound(m)->soundHaha_2, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_HAHA_2); } m->particleFlags |= PARTICLE_WATER_SPLASH; diff --git a/src/pc/network/packets/packet_player.c b/src/pc/network/packets/packet_player.c index 1f0f90a8..ef602449 100644 --- a/src/pc/network/packets/packet_player.c +++ b/src/pc/network/packets/packet_player.c @@ -327,7 +327,7 @@ void network_receive_player(struct Packet* p) { if ((m->action == ACT_PUNCHING || m->action == ACT_MOVE_PUNCHING)) { // play first punching sound, otherwise it will be missed if (m->action != oldData.action) { - play_sound(get_character_sound(m)->soundPunchYah, m->marioObj->header.gfx.cameraToObject); + play_character_sound(m, CHAR_SOUND_PUNCH_YAH); } // make the first punch large, otherwise it will be missed if (m->actionArg == 2 && oldData.actionArg == 1) {