sm64coopdx/src/goddard/sfx.c
Prince Frizzy 75bb9b7912
Update to Refresh 13 (#19)
* Refresh 13

Co-authored-by: n64 <n64>
2022-03-13 00:17:10 -08:00

38 lines
835 B
C

#include <PR/ultratypes.h>
#include "sfx.h"
static u32 sCurrSfx; // bitset of currently playing sound effects
static u32 sPrevSfx; // bitset of sound effects that were playing on the previous frame
/**
* Stops all sound effects
*/
void gd_reset_sfx(void) {
sPrevSfx = GD_SFX_NONE;
sCurrSfx = GD_SFX_NONE;
}
/**
* Returns a bitset of the newly started sound effects.
* This is used by geo_draw_mario_head_goddard to start new sounds.
*/
u32 gd_new_sfx_to_play(void) {
return ~sPrevSfx & sCurrSfx;
}
/**
* Called at the start of a frame.
*/
void gd_sfx_update(void) {
sPrevSfx = sCurrSfx;
sCurrSfx = GD_SFX_NONE;
}
/**
* Marks a sound effect to be played. This must be called repeatedly once per
* frame to keep the sound effect playing.
*/
void gd_play_sfx(enum GdSfx sfx) {
sCurrSfx |= sfx;
}