Skip to content

Commit 02ef034

Browse files
escape209SquareMan
authored andcommitted
Match zMusicUnpause
1 parent 90fd857 commit 02ef034

File tree

2 files changed

+24
-29
lines changed

2 files changed

+24
-29
lines changed

src/SB/Game/zMusic.cpp

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ void zMusicInit()
114114
volume_reset();
115115
}
116116

117-
// Correct, but won't work due to the switch case jump table (messes with offsets)
118-
S32 getCurrLevelMusicEnum()
117+
static S32 getCurrLevelMusicEnum()
119118
{
120119
S32 snd_enum;
121120

@@ -247,39 +246,36 @@ void zMusicPause()
247246
}
248247
}
249248

250-
// WIP.
251-
#if 0
252-
// Only thing that doesn't compile correctly is the function call to xSndPlay, in which a bunch of stuff is in the wrong order it looks like.
253249
void zMusicUnpause(S32 kill)
254250
{
255-
if (sMusicPaused != 0)
251+
if (sMusicPaused == 0)
256252
{
257-
for (S32 i = 0; i < 2; i++)
253+
return;
254+
}
255+
256+
for (S32 i = 0; i < 2; i++)
257+
{
258+
zMusicTrackInfo* track = &sMusicTrack[i];
259+
if (track->snd_id == 0)
258260
{
259-
zMusicTrackInfo* track = &sMusicTrack[i];
260-
U32 prioBase = 0x800 * i;
261-
if (track->snd_id != 0)
262-
{
263-
if (kill != 0)
264-
{
265-
track->snd_id = 0;
266-
}
267-
else
268-
{
269-
U32 res =
270-
xSndPlay(track->assetID, track->lastVol, lbl_803CDD48, 0xff,
271-
prioBase | (int)(-track->loop | track->loop) >> 0x1f & 0x8000U |
272-
0x10000 | 0x20000,
273-
0, SND_CAT_MUSIC, lbl_803CDD48);
274-
track->snd_id = res;
275-
}
276-
}
261+
continue;
262+
}
263+
264+
if (kill != 0)
265+
{
266+
track->snd_id = 0;
267+
}
268+
else
269+
{
270+
S32 flags = i * 0x800;
271+
flags |= ((track->loop != 0) ? 0x8000 : 0) | 0x10000;
272+
flags |= 0x20000;
273+
track->snd_id = xSndPlay(track->assetID, track->lastVol, 0.0f, 0xff, flags, 0, SND_CAT_MUSIC, 0.0f);
277274
}
278-
sMusicPaused = 0;
279275
}
280-
}
281276

282-
#endif
277+
sMusicPaused = 0;
278+
}
283279

284280
// WIP.
285281
#if 0

src/SB/Game/zMusic.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ struct zMusicTrackInfo
3838

3939
void volume_reset();
4040
void zMusicRefreshVolume();
41-
S32 getCurrLevelMusicEnum();
4241
void zMusicNotify(S32 situation);
4342
void zMusicSetVolume(F32 vol, F32 delay);
4443
void zMusicKill();

0 commit comments

Comments
 (0)