Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
ambience.c File Reference

Go to the source code of this file.

Data Structures

struct  AmbientSoundSettings
 

Enumerations

enum  AmbientSoundState { AMBIENCE_STATE_IDLE = 0 , AMBIENCE_STATE_FADE_OUT = 1 , AMBIENCE_STATE_FADE_IN = 2 }
 
enum  AmbientSoundFlag { AMBIENCE_FLAG_PLAYING = 1 }
 

Functions

void reset_ambient_sounds (void)
 
void update_ambient_sounds (void)
 
s32 play_ambient_sounds (s32 soundID, s32 fadeTime)
 

Variables

AmbientSoundSettings DefaultAmbientSoundData
 
AmbientSoundSettings AmbientSoundData
 

Data Structure Documentation

◆ AmbientSoundSettings

struct AmbientSoundSettings
Data Fields
s16 flags
s16 fadeState
s32 fadeTime
s32 soundID
s32 unkC

Enumeration Type Documentation

◆ AmbientSoundState

Enumerator
AMBIENCE_STATE_IDLE 
AMBIENCE_STATE_FADE_OUT 
AMBIENCE_STATE_FADE_IN 

Definition at line 12 of file ambience.c.

12 {
14 AMBIENCE_STATE_FADE_OUT = 1, // fade out old sounds
15 AMBIENCE_STATE_FADE_IN = 2 // fade in new sounds
AmbientSoundState
Definition ambience.c:12
@ AMBIENCE_STATE_IDLE
Definition ambience.c:13
@ AMBIENCE_STATE_FADE_IN
Definition ambience.c:15
@ AMBIENCE_STATE_FADE_OUT
Definition ambience.c:14

◆ AmbientSoundFlag

Enumerator
AMBIENCE_FLAG_PLAYING 

Definition at line 18 of file ambience.c.

18 {
AmbientSoundFlag
Definition ambience.c:18
@ AMBIENCE_FLAG_PLAYING
Definition ambience.c:19

Function Documentation

◆ reset_ambient_sounds()

void reset_ambient_sounds ( void )

Definition at line 32 of file ambience.c.

32 {
34}
AmbientSoundSettings AmbientSoundData
Definition ambience.c:30
AmbientSoundSettings DefaultAmbientSoundData
Definition ambience.c:22

Referenced by load_engine_data().

◆ update_ambient_sounds()

void update_ambient_sounds ( void )

Definition at line 36 of file ambience.c.

36 {
38 s32 error;
39
40 switch (ambientSoundState->fadeState) {
42 break;
44 if (ambientSoundState->flags & 1) {
45 if (ambientSoundState->fadeTime < 250) {
47 } else {
49 }
50
51 if (error != AU_RESULT_OK) {
52 return;
53 }
54 }
56 break;
60 return;
61 }
63 }
64 if (ambientSoundState->soundID < 0) {
66 } else if (snd_load_ambient(ambientSoundState->soundID) == AU_RESULT_OK) {
67 if (snd_ambient_play(0, 0) == AU_RESULT_OK) {
70 }
71 }
72 break;
73 }
74}
BSS s32 PopupMenu_SelectedIndex
@ AU_RESULT_OK
Definition enums.h:1759
AuResult snd_ambient_play(s32 arg0, s32 arg1)
AuResult snd_load_ambient(s32 arg0)
AuResult snd_ambient_stop_slow(s32 arg0, s32 arg1)
AuResult snd_ambient_stop_quick(s32 arg0)
AuResult snd_ambient_is_stopped(s32 arg0)

Referenced by step_game_loop().

◆ play_ambient_sounds()

s32 play_ambient_sounds ( s32 soundID,
s32 fadeTime )

Definition at line 76 of file ambience.c.

76 {
78
82 return 1;
83 }
84
85 if (state->soundID == soundID) {
86 return 2;
87 }
88
89 state->soundID = soundID;
90 state->fadeTime = fadeTime;
92 return 1;
93}
GameStatus * gGameStatusPtr
Definition main_loop.c:31

Variable Documentation

◆ DefaultAmbientSoundData

AmbientSoundSettings DefaultAmbientSoundData
Initial value:
= {
.flags = 0,
.fadeState = 0,
.fadeTime = 0,
.soundID = -1,
.unkC = -1
}

Definition at line 22 of file ambience.c.

22 {
23 .flags = 0,
24 .fadeState = 0,
25 .fadeTime = 0,
26 .soundID = -1,
27 .unkC = -1
28};

Referenced by reset_ambient_sounds().

◆ AmbientSoundData

AmbientSoundSettings AmbientSoundData

Definition at line 30 of file ambience.c.

Referenced by play_ambient_sounds(), reset_ambient_sounds(), and update_ambient_sounds().