Fixed looping jukebox music when it shouldn't (at end of level)

This commit is contained in:
md2211 2008-01-10 20:35:59 +00:00
parent a18d40f312
commit 2d3fe6b2e8
4 changed files with 29 additions and 10 deletions

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20080110
--------
arch/sdl/jukebox.c, arch/sdl/include/jukebox.h, arch/sdl/digi_mixer_music.c; fixed looping jukebox music when it shouldn't (at end of level)
20080108
--------
SConstruct, 2d/font.c, include/args.h, include/byteswap.h, include/netdrv.h, main/args.c, main/gameseq.c, main/gameseg.c, main/menu.c, main/multi.c, main/multi.h, main/multibot.c, main/netdrv.c, main/netlist.c, main/netpkt.c, main/netpkt.h, main/network.c, main/network.h, main/newdemo.c, main/object.h, main/udp.c: Added BigEndian-related multiplayer/network code (unfinished); Re-Added IPX Socket option to Host menu for IPX games; Removed ForceVersionCheck global - conditions with driver->type; Merged netmisc.* and netpkt.*; Handling host disconnect for UDP games in network.c

View file

@ -36,12 +36,8 @@
Mix_Music *current_music = NULL;
void music_done() {
Mix_HaltMusic();
Mix_FreeMusic(current_music);
current_music = NULL;
jukebox_stop_hook();
}
void music_hook_stop();
void music_hook_next();
void convert_hmp(char *filename, char *mid_filename) {
@ -131,7 +127,7 @@ void mix_play_file(char *basedir, char *filename, int loop) {
else {
Mix_PlayMusic(current_music, loop);
}
Mix_HookMusicFinished(music_done);
Mix_HookMusicFinished(loop == -1 ? music_hook_next : music_hook_stop);
}
else {
fprintf(stderr, "File %s%s could not be loaded\n", basedir, filename);
@ -139,6 +135,20 @@ void mix_play_file(char *basedir, char *filename, int loop) {
}
}
// What to do when stopping song playback
void music_hook_stop() {
Mix_HaltMusic();
Mix_FreeMusic(current_music);
current_music = NULL;
jukebox_hook_stop();
}
// What to do when going to next song / looping
void music_hook_next() {
music_hook_stop();
jukebox_hook_next();
}
void mix_set_music_volume(int vol) {
Mix_VolumeMusic(vol);
}

View file

@ -4,7 +4,8 @@
void jukebox_load();
void jukebox_play();
void jukebox_stop();
void jukebox_stop_hook();
void jukebox_hook_stop();
void jukebox_hook_next();
void jukebox_next();
void jukebox_prev();
char *jukebox_current();

View file

@ -126,10 +126,14 @@ void jukebox_stop() {
jukebox_playing = 0;
}
void jukebox_stop_hook() {
void jukebox_hook_stop() {
if (!jukebox_loaded) return;
}
void jukebox_hook_next() {
if (!jukebox_loaded) return;
if (jukebox_playing) jukebox_next();
}
}
void jukebox_next() {
if (!jukebox_loaded) return;