Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/src/goddard/sfx.c
7858 views
1
#include <PR/ultratypes.h>
2
3
#include "sfx.h"
4
5
static u32 sCurrSfx; // bitset of currently playing sound effects
6
static u32 sPrevSfx; // bitset of sound effects that were playing on the previous frame
7
8
/**
9
* Stops all sound effects
10
*/
11
void gd_reset_sfx(void) {
12
sPrevSfx = GD_SFX_NONE;
13
sCurrSfx = GD_SFX_NONE;
14
}
15
16
/**
17
* Returns a bitset of the newly started sound effects.
18
* This is used by geo_draw_mario_head_goddard to start new sounds.
19
*/
20
u32 gd_new_sfx_to_play(void) {
21
return ~sPrevSfx & sCurrSfx;
22
}
23
24
/**
25
* Called at the start of a frame.
26
*/
27
void gd_sfx_update(void) {
28
sPrevSfx = sCurrSfx;
29
sCurrSfx = GD_SFX_NONE;
30
}
31
32
/**
33
* Marks a sound effect to be played. This must be called repeatedly once per
34
* frame to keep the sound effect playing.
35
*/
36
void gd_play_sfx(enum GdSfx sfx) {
37
sCurrSfx |= sfx;
38
}
39
40