Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-Mania-Decompilation
Path: blob/master/SonicMania/Objects/Global/Music.h
338 views
1
#ifndef OBJ_MUSIC_H
2
#define OBJ_MUSIC_H
3
4
#include "Game.h"
5
6
typedef enum {
7
TRACK_NONE = -1,
8
TRACK_STAGE = 0,
9
TRACK_INVINCIBLE = 1,
10
TRACK_SNEAKERS = 2,
11
TRACK_MINIBOSS = 3,
12
TRACK_HBHBOSS = 4,
13
TRACK_EGGMAN1 = 5,
14
TRACK_EGGMAN2 = 6,
15
TRACK_ACTCLEAR = 7,
16
TRACK_DROWNING = 8,
17
TRACK_GAMEOVER = 9,
18
TRACK_SUPER = 10,
19
#if MANIA_USE_PLUS
20
TRACK_HBHMISCHIEF = 11,
21
TRACK_SOUNDTEST = 12,
22
#else
23
TRACK_SOUNDTEST = 11,
24
TRACK_HBHMISCHIEF = 12,
25
#endif
26
TRACK_1UP = 13,
27
28
// Aliases/Reused slots
29
TRACK_METALSONIC = TRACK_EGGMAN1,
30
TRACK_RUBYPRESENCE = TRACK_EGGMAN1,
31
TRACK_BUDDYBEAT = TRACK_EGGMAN2,
32
TRACK_ERZBOSS = TRACK_SUPER,
33
} MusicTracks;
34
35
typedef enum {
36
TRACK_PRIORITY_NONE = 0,
37
TRACK_PRIORITY_ANY = 10,
38
TRACK_PRIORITY_POWERUP = 100,
39
TRACK_PRIORITY_SUPER = 1000,
40
TRACK_PRIORITY_DROWN = 10000,
41
TRACK_PRIORITY_1UP = 100000,
42
} TrackPriorityValues;
43
44
// Object Class
45
struct ObjectMusic {
46
RSDK_OBJECT
47
char trackNames[16][32];
48
uint32 trackLoops[16];
49
int32 trackStartPos;
50
int32 channelID;
51
int32 activeTrack;
52
#if MANIA_USE_PLUS
53
int32 nextTrack;
54
int32 restartTrackID;
55
#else
56
int32 prevTrack;
57
int32 queuedTrack;
58
int32 nextTrack;
59
bool32 playingRegularTrack;
60
bool32 playingDrownTrack;
61
bool32 playing1UPTrack;
62
#endif
63
uint16 aniFrames;
64
};
65
66
// Entity Class
67
struct EntityMusic {
68
RSDK_ENTITY
69
StateMachine(state);
70
String trackFile;
71
String soundTestTitle;
72
int32 trackID;
73
uint32 trackLoop;
74
bool32 playOnLoad;
75
bool32 restartTrack;
76
int32 timer;
77
int32 trackPriority;
78
int32 trackStartPos;
79
float volume;
80
float fadeSpeed;
81
Animator animator;
82
};
83
84
// Object Struct
85
extern ObjectMusic *Music;
86
87
// Standard Entity Events
88
void Music_Update(void);
89
void Music_LateUpdate(void);
90
void Music_StaticUpdate(void);
91
void Music_Draw(void);
92
void Music_Create(void *data);
93
void Music_StageLoad(void);
94
#if GAME_INCLUDE_EDITOR
95
void Music_EditorDraw(void);
96
void Music_EditorLoad(void);
97
#endif
98
void Music_Serialize(void);
99
100
// Extra Entity Functions
101
102
// Adds a new music track
103
void Music_SetMusicTrack(const char *path, uint8 track, uint32 loopPoint);
104
// stops the currently playing music stream
105
void Music_Stop(void);
106
// pauses the currently playing music stream
107
void Music_Pause(void);
108
// resumes the currently playing music stream
109
void Music_Resume(void);
110
// checks if there is music currently playing
111
bool32 Music_IsPlaying(void);
112
113
// Plays a jingle
114
void Music_PlayJingle(uint8 trackID);
115
// Plays a track, doesn't use the music stack at all
116
void Music_PlayTrack(uint8 trackID);
117
// Play a track using the info from a music entity
118
void Music_PlayTrackPtr(EntityMusic *entity);
119
120
#if MANIA_USE_PLUS
121
void Music_PlayAutoMusicQueuedTrack(uint8 trackID);
122
void Music_HandleMusicStack_Powerups(EntityMusic *entity);
123
bool32 Music_CheckMusicStack_Active(void);
124
void Music_GetNextTrackStartPos(EntityMusic *entity);
125
#endif
126
void Music_JingleFadeOut(uint8 trackID, bool32 transitionFade);
127
#if MANIA_USE_PLUS
128
void Music_FinishJingle(EntityMusic *entity);
129
void Music_ClearMusicStack(void);
130
#endif
131
void Music_TransitionTrack(uint8 trackID, float fadeSpeed);
132
void Music_FadeOut(float fadeSpeed);
133
134
void Music_State_PlayOnLoad(void);
135
#if MANIA_USE_PLUS
136
void Music_State_Jingle(void);
137
void Music_State_JingleFade(void);
138
#endif
139
void Music_State_FadeTrackIn(void);
140
void Music_State_StopOnFade(void);
141
void Music_State_PlayOnFade(void);
142
#if !MANIA_USE_PLUS
143
void Music_State_1UPJingle(void);
144
#endif
145
146
#endif //! OBJ_MUSIC_H
147
148