2006-03-20 17:12:09 +00:00
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ( " PARALLAX " ) . PARALLAX , IN DISTRIBUTING THE CODE TO
END - USERS , AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN , GRANTS A
ROYALTY - FREE , PERPETUAL LICENSE TO SUCH END - USERS FOR USE BY SUCH END - USERS
IN USING , DISPLAYING , AND CREATING DERIVATIVE WORKS THEREOF , SO LONG AS
SUCH USE , DISPLAY OR CREATION IS FOR NON - COMMERCIAL , ROYALTY OR REVENUE
FREE PURPOSES . IN NO EVENT SHALL THE END - USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE - BEARING PURPOSES . THE END - USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE .
COPYRIGHT 1993 - 1999 PARALLAX SOFTWARE CORPORATION . ALL RIGHTS RESERVED .
*/
/*
*
* Routines to manage the songs in Descent .
*
*/
# include <stdio.h>
2009-03-03 12:55:27 +00:00
# include <stdlib.h>
2006-03-20 17:12:09 +00:00
# include <string.h>
# include "error.h"
# include "pstypes.h"
# include "songs.h"
# include "cfile.h"
# include "digi.h"
# include "rbaudio.h"
2010-06-14 08:13:16 +00:00
# ifdef USE_SDLMIXER
# include "digi_mixer_music.h"
# include "jukebox.h"
# endif
2009-03-03 12:55:27 +00:00
# include "config.h"
2006-03-20 17:12:09 +00:00
# include "timer.h"
int Songs_initialized = 0 ;
2010-06-14 08:13:16 +00:00
static int Song_playing = 0 ; // 0 if no song playing, else the Descent song number
2010-08-01 17:42:38 +00:00
static int Redbook_playing = 0 ; // Redbook track num differs from Song_playing. We need this for Redbook repeat hooks.
2010-04-05 11:54:23 +00:00
2010-08-01 17:42:38 +00:00
bim_song_info * BIMSongs = NULL ;
int Num_bim_songs ;
2006-03-20 17:12:09 +00:00
2009-03-03 12:55:27 +00:00
# define EXTMUSIC_VOLUME_SCALE (255)
2006-03-20 17:12:09 +00:00
//takes volume in range 0..8
2010-06-14 08:13:16 +00:00
void songs_set_volume ( int volume )
2006-03-20 17:12:09 +00:00
{
2010-06-14 08:13:16 +00:00
# ifdef _WIN32
2010-11-28 15:49:40 +00:00
digi_win32_set_midi_volume ( volume ) ;
2010-06-14 08:13:16 +00:00
# endif
if ( GameCfg . MusicType = = MUSIC_TYPE_REDBOOK )
{
RBASetVolume ( 0 ) ;
2010-08-19 15:54:19 +00:00
RBASetVolume ( volume ) ;
2010-06-14 08:13:16 +00:00
}
# ifdef USE_SDLMIXER
2010-08-19 15:54:19 +00:00
mix_set_music_volume ( volume ) ;
2010-06-14 08:13:16 +00:00
# endif
2006-03-20 17:12:09 +00:00
}
void songs_init ( )
{
2010-04-05 11:54:23 +00:00
int i = 0 ;
2006-03-20 17:12:09 +00:00
char inputline [ 80 + 1 ] ;
2010-06-14 08:13:16 +00:00
CFILE * fp = NULL ;
char sng_file [ PATH_MAX ] ;
2006-03-20 17:12:09 +00:00
2010-08-01 17:42:38 +00:00
Songs_initialized = 0 ;
if ( BIMSongs ! = NULL )
d_free ( BIMSongs ) ;
2010-02-19 15:30:57 +00:00
2010-06-14 08:13:16 +00:00
memset ( sng_file , ' \0 ' , sizeof ( sng_file ) ) ;
if ( Current_mission ! = NULL )
{
snprintf ( sng_file , strlen ( Current_mission_filename ) + 5 , " %s.sng " , Current_mission_filename ) ;
fp = cfopen ( sng_file , " rb " ) ;
}
if ( fp = = NULL )
fp = cfopen ( " descent.sng " , " rb " ) ;
2010-04-05 11:54:23 +00:00
if ( fp = = NULL ) // No descent.sng available. Define a default song-set
{
2010-08-01 17:42:38 +00:00
int predef = 30 ; // define 30 songs - period
MALLOC ( BIMSongs , bim_song_info , predef ) ;
if ( ! BIMSongs )
return ;
strncpy ( BIMSongs [ SONG_TITLE ] . filename , " descent.hmp " , sizeof ( BIMSongs [ SONG_TITLE ] . filename ) ) ;
strncpy ( BIMSongs [ SONG_BRIEFING ] . filename , " briefing.hmp " , sizeof ( BIMSongs [ SONG_BRIEFING ] . filename ) ) ;
strncpy ( BIMSongs [ SONG_CREDITS ] . filename , " credits.hmp " , sizeof ( BIMSongs [ SONG_CREDITS ] . filename ) ) ;
strncpy ( BIMSongs [ SONG_ENDLEVEL ] . filename , " endlevel.hmp " , sizeof ( BIMSongs [ SONG_ENDLEVEL ] . filename ) ) ; // can't find it? give a warning
strncpy ( BIMSongs [ SONG_ENDGAME ] . filename , " endgame.hmp " , sizeof ( BIMSongs [ SONG_ENDGAME ] . filename ) ) ; // ditto
for ( i = SONG_FIRST_LEVEL_SONG ; i < predef ; i + + ) {
snprintf ( BIMSongs [ i ] . filename , sizeof ( BIMSongs [ i ] . filename ) , " game%02d.hmp " , i - SONG_FIRST_LEVEL_SONG + 1 ) ;
if ( ! cfexist ( BIMSongs [ i ] . filename ) )
snprintf ( BIMSongs [ i ] . filename , sizeof ( BIMSongs [ i ] . filename ) , " game%d.hmp " , i - SONG_FIRST_LEVEL_SONG ) ;
if ( ! cfexist ( BIMSongs [ i ] . filename ) )
2010-04-05 11:54:23 +00:00
{
2010-08-01 17:42:38 +00:00
memset ( BIMSongs [ i ] . filename , ' \0 ' , sizeof ( BIMSongs [ i ] . filename ) ) ; // music not available
break ;
2010-04-05 11:54:23 +00:00
}
2006-03-20 17:12:09 +00:00
}
2010-04-05 11:54:23 +00:00
}
else
{
2010-02-19 15:30:57 +00:00
while ( ! PHYSFS_eof ( fp ) )
2006-03-20 17:12:09 +00:00
{
2010-02-19 15:30:57 +00:00
cfgets ( inputline , 80 , fp ) ;
2006-03-20 17:12:09 +00:00
if ( strlen ( inputline ) )
{
2010-08-01 17:42:38 +00:00
BIMSongs = d_realloc ( BIMSongs , sizeof ( bim_song_info ) * ( i + 1 ) ) ;
memset ( BIMSongs [ i ] . filename , ' \0 ' , sizeof ( BIMSongs [ i ] . filename ) ) ;
sscanf ( inputline , " %15s " , BIMSongs [ i ] . filename ) ;
if ( strrchr ( BIMSongs [ i ] . filename , ' . ' ) )
if ( ! stricmp ( strrchr ( BIMSongs [ i ] . filename , ' . ' ) , " .hmp " ) | |
! stricmp ( strrchr ( BIMSongs [ i ] . filename , ' . ' ) , " .mp3 " ) | |
! stricmp ( strrchr ( BIMSongs [ i ] . filename , ' . ' ) , " .ogg " ) | |
! stricmp ( strrchr ( BIMSongs [ i ] . filename , ' . ' ) , " .aif " ) | |
! stricmp ( strrchr ( BIMSongs [ i ] . filename , ' . ' ) , " .mid " )
2010-06-14 08:13:16 +00:00
)
2010-02-19 15:30:57 +00:00
i + + ;
2006-03-20 17:12:09 +00:00
}
}
}
2010-08-01 17:42:38 +00:00
Num_bim_songs = i ;
2006-03-20 17:12:09 +00:00
Songs_initialized = 1 ;
2010-08-01 17:42:38 +00:00
if ( fp ! = NULL )
cfclose ( fp ) ;
2006-03-20 17:12:09 +00:00
2010-06-14 17:55:25 +00:00
if ( GameArg . SndNoMusic )
GameCfg . MusicType = MUSIC_TYPE_NONE ;
2010-06-14 08:13:16 +00:00
// If SDL_Mixer is not supported (or deactivated), switch to no-music type if SDL_mixer-related music type was selected
# ifdef USE_SDLMIXER
if ( GameArg . SndDisableSdlMixer )
# else
if ( 1 )
# endif
{
# ifndef _WIN32
if ( GameCfg . MusicType = = MUSIC_TYPE_BUILTIN )
GameCfg . MusicType = MUSIC_TYPE_NONE ;
# endif
if ( GameCfg . MusicType = = MUSIC_TYPE_CUSTOM )
GameCfg . MusicType = MUSIC_TYPE_NONE ;
}
if ( GameCfg . MusicType = = MUSIC_TYPE_REDBOOK )
RBAInit ( ) ;
# ifdef USE_SDLMIXER
else if ( GameCfg . MusicType = = MUSIC_TYPE_CUSTOM )
jukebox_load ( ) ;
# endif
songs_set_volume ( GameCfg . MusicVolume ) ;
}
2006-03-20 17:12:09 +00:00
2010-06-14 08:13:16 +00:00
void songs_uninit ( )
2006-03-20 17:12:09 +00:00
{
2010-06-14 08:13:16 +00:00
# ifdef _WIN32
2010-11-28 15:49:40 +00:00
digi_win32_stop_current_song ( ) ; // Stop midi song, if playing
2010-06-14 08:13:16 +00:00
# endif
RBAStop ( ) ;
// RBAExit();
# ifdef USE_SDLMIXER
mix_stop_music ( ) ;
jukebox_unload ( ) ;
# endif
2010-08-01 17:42:38 +00:00
if ( BIMSongs ! = NULL )
d_free ( BIMSongs ) ;
2010-06-14 08:13:16 +00:00
Song_playing = 0 ;
Songs_initialized = 0 ;
2006-03-20 17:12:09 +00:00
}
2010-06-14 08:13:16 +00:00
//stop any songs - builtin, redbook or jukebox - that are currently playing
2006-03-20 17:12:09 +00:00
void songs_stop_all ( void )
{
2010-06-14 08:13:16 +00:00
# ifdef _WIN32
2010-11-28 15:49:40 +00:00
digi_win32_stop_current_song ( ) ; // Stop midi song, if playing
2010-06-14 08:13:16 +00:00
# endif
RBAStop ( ) ;
# ifdef USE_SDLMIXER
mix_stop_music ( ) ;
# endif
2010-04-05 11:54:23 +00:00
Song_playing = 0 ;
2006-03-20 17:12:09 +00:00
}
2010-06-14 08:13:16 +00:00
void songs_pause ( void )
2006-03-20 17:12:09 +00:00
{
2010-11-28 15:49:40 +00:00
# ifdef _WIN32
digi_win32_pause_midi_song ( ) ;
# endif
2010-06-14 08:13:16 +00:00
if ( GameCfg . MusicType = = MUSIC_TYPE_REDBOOK )
RBAPause ( ) ;
# ifdef USE_SDLMIXER
mix_pause_music ( ) ;
# endif
2006-03-20 17:12:09 +00:00
}
2010-06-14 08:13:16 +00:00
void songs_resume ( void )
{
2010-11-28 15:49:40 +00:00
# ifdef _WIN32
digi_win32_resume_midi_song ( ) ;
# endif
2010-06-14 08:13:16 +00:00
if ( GameCfg . MusicType = = MUSIC_TYPE_REDBOOK )
RBAResume ( ) ;
# ifdef USE_SDLMIXER
mix_resume_music ( ) ;
# endif
}
2006-03-20 17:12:09 +00:00
2010-06-14 08:13:16 +00:00
void songs_pause_resume ( void )
2006-03-20 17:12:09 +00:00
{
2010-06-14 08:13:16 +00:00
if ( GameCfg . MusicType = = MUSIC_TYPE_REDBOOK )
RBAPauseResume ( ) ;
# ifdef USE_SDLMIXER
mix_pause_resume_music ( ) ;
# endif
2006-03-20 17:12:09 +00:00
}
/*
* Some of these have different Track listings !
* Which one is the " correct " order ?
*/
# define D2_1_DISCID 0x7d0ff809 // Descent II
# define D2_2_DISCID 0xe010a30e // Descent II
# define D2_3_DISCID 0xd410070d // Descent II
# define D2_4_DISCID 0xc610080d // Descent II
# define D2_DEF_DISCID 0x87102209 // Definitive collection Disc 2
# define D2_OEM_DISCID 0xac0bc30d // Destination: Quartzon
# define D2_OEM2_DISCID 0xc40c0a0d // Destination: Quartzon
# define D2_VERTIGO_DISCID 0x53078208 // Vertigo
# define D2_VERTIGO2_DISCID 0x64071408 // Vertigo + DMB
# define D2_MAC_DISCID 0xb70ee40e // Macintosh
# define D2_IPLAY_DISCID 0x22115710 // iPlay for Macintosh
2010-06-14 08:13:16 +00:00
# define REDBOOK_TITLE_TRACK 2
# define REDBOOK_CREDITS_TRACK 3
# define REDBOOK_FIRST_LEVEL_TRACK (songs_haved2_cd() ? 4 : 1)
2006-03-20 17:12:09 +00:00
// songs_haved2_cd returns 1 if the descent 2 CD is in the drive and
// 0 otherwise
int songs_haved2_cd ( )
{
int discid ;
2010-04-05 11:54:23 +00:00
2009-05-06 12:19:28 +00:00
if ( GameCfg . OrigTrackOrder )
return 1 ;
2010-06-14 08:13:16 +00:00
if ( ! ( GameCfg . MusicType = = MUSIC_TYPE_REDBOOK ) )
2006-03-20 17:12:09 +00:00
return 0 ;
discid = RBAGetDiscID ( ) ;
switch ( discid ) {
case D2_1_DISCID :
case D2_2_DISCID :
case D2_3_DISCID :
case D2_4_DISCID :
case D2_DEF_DISCID :
case D2_OEM_DISCID :
case D2_OEM2_DISCID :
case D2_VERTIGO_DISCID :
case D2_VERTIGO2_DISCID :
case D2_MAC_DISCID :
case D2_IPLAY_DISCID :
return 1 ;
default :
return 0 ;
}
}
2010-08-23 11:29:45 +00:00
void play_credits_track ( )
2009-03-03 12:55:27 +00:00
{
stop_time ( ) ;
2010-08-23 11:29:45 +00:00
songs_play_song ( SONG_CREDITS , 1 ) ;
2009-03-03 12:55:27 +00:00
start_time ( ) ;
}
2010-04-05 11:54:23 +00:00
int songs_play_song ( int songnum , int repeat )
2006-03-20 17:12:09 +00:00
{
2008-11-19 15:52:07 +00:00
songs_init ( ) ;
2010-08-01 17:42:38 +00:00
if ( ! Songs_initialized )
return 0 ;
2006-03-20 17:12:09 +00:00
2010-06-14 08:13:16 +00:00
switch ( GameCfg . MusicType )
2010-04-05 11:54:23 +00:00
{
2010-06-14 08:13:16 +00:00
case MUSIC_TYPE_BUILTIN :
{
2010-08-01 17:42:38 +00:00
Song_playing = 0 ;
2010-06-14 08:13:16 +00:00
# ifdef _WIN32
2010-06-15 18:27:10 +00:00
if ( GameArg . SndDisableSdlMixer )
2010-06-14 08:13:16 +00:00
{
2010-11-28 15:49:40 +00:00
if ( digi_win32_play_midi_song ( BIMSongs [ songnum ] . filename , repeat ) ) // NOTE: If SDL_mixer active, this will still be called in mix_play_file in case file is hmp
2010-06-14 08:13:16 +00:00
{
Song_playing = songnum ;
}
}
else
# endif
# ifdef USE_SDLMIXER
{
2010-08-01 17:42:38 +00:00
if ( mix_play_file ( BIMSongs [ songnum ] . filename , repeat , NULL ) )
2010-06-14 08:13:16 +00:00
{
Song_playing = songnum ;
}
}
# endif
break ;
}
case MUSIC_TYPE_REDBOOK :
{
int num_tracks = RBAGetNumberOfTracks ( ) ;
2010-09-26 14:22:55 +00:00
//Song_playing = 0; // keep playing current music if chosen song is unavailable (e.g. SONG_ENDLEVEL)
2010-06-14 08:13:16 +00:00
if ( ( songnum = = SONG_TITLE ) & & ( REDBOOK_TITLE_TRACK < = num_tracks ) )
{
2011-01-10 19:40:55 +00:00
if ( RBAPlayTracks ( REDBOOK_TITLE_TRACK , REDBOOK_TITLE_TRACK , repeat ? play_credits_track : NULL ) )
2010-06-14 08:13:16 +00:00
{
Redbook_playing = REDBOOK_TITLE_TRACK ;
Song_playing = songnum ;
}
}
else if ( ( songnum = = SONG_CREDITS ) & & ( REDBOOK_CREDITS_TRACK < = num_tracks ) )
{
2011-01-10 19:40:55 +00:00
if ( RBAPlayTracks ( REDBOOK_CREDITS_TRACK , REDBOOK_CREDITS_TRACK , repeat ? play_credits_track : NULL ) )
2010-06-14 08:13:16 +00:00
{
Redbook_playing = REDBOOK_CREDITS_TRACK ;
Song_playing = songnum ;
}
}
break ;
}
# ifdef USE_SDLMIXER
case MUSIC_TYPE_CUSTOM :
{
2010-08-01 17:42:38 +00:00
// EXCEPTION: If SONG_ENDLEVEL is undefined, continue playing level song.
if ( Song_playing > = SONG_FIRST_LEVEL_SONG & & songnum = = SONG_ENDLEVEL & & ! strlen ( GameCfg . CMMiscMusic [ songnum ] ) )
return Song_playing ;
Song_playing = 0 ;
2010-08-25 00:40:55 +00:00
if ( mix_play_file ( GameCfg . CMMiscMusic [ songnum ] ,
// Play the credits track after the title track and loop the credits track if original CD track order was chosen
( songnum = = SONG_TITLE & & GameCfg . OrigTrackOrder ) ? 0 : repeat ,
( songnum = = SONG_TITLE & & GameCfg . OrigTrackOrder ) ? play_credits_track : NULL ) )
2010-06-14 08:13:16 +00:00
Song_playing = songnum ;
break ;
}
# endif
default :
Song_playing = 0 ;
break ;
2010-04-05 11:54:23 +00:00
}
2010-06-14 08:13:16 +00:00
2010-04-05 11:54:23 +00:00
return Song_playing ;
2006-03-20 17:12:09 +00:00
}
2010-06-14 08:13:16 +00:00
void redbook_first_song_func ( )
2009-03-03 12:55:27 +00:00
{
stop_time ( ) ;
2010-06-14 08:13:16 +00:00
songs_play_level_song ( 1 , 0 ) ;
2009-03-03 12:55:27 +00:00
start_time ( ) ;
}
2010-06-14 08:13:16 +00:00
// play track given by levelnum (depending on the music type and it's playing behaviour) or increment/decrement current track number via offset value
int songs_play_level_song ( int levelnum , int offset )
2006-03-20 17:12:09 +00:00
{
int songnum ;
Assert ( levelnum ! = 0 ) ;
2008-11-19 15:52:07 +00:00
songs_init ( ) ;
2010-08-01 17:42:38 +00:00
if ( ! Songs_initialized )
return 0 ;
2006-03-20 17:12:09 +00:00
songnum = ( levelnum > 0 ) ? ( levelnum - 1 ) : ( - levelnum ) ;
2010-06-14 08:13:16 +00:00
switch ( GameCfg . MusicType )
{
case MUSIC_TYPE_BUILTIN :
{
2010-08-01 17:42:38 +00:00
if ( offset )
return Song_playing ;
Song_playing = 0 ;
if ( ( Num_bim_songs - SONG_FIRST_LEVEL_SONG ) > 0 )
2010-06-14 08:13:16 +00:00
{
2010-08-01 17:42:38 +00:00
songnum = SONG_FIRST_LEVEL_SONG + ( songnum % ( Num_bim_songs - SONG_FIRST_LEVEL_SONG ) ) ;
2010-06-14 08:13:16 +00:00
# ifdef _WIN32
2010-06-15 18:27:10 +00:00
if ( GameArg . SndDisableSdlMixer )
2010-06-14 08:13:16 +00:00
{
2010-11-28 15:49:40 +00:00
if ( digi_win32_play_midi_song ( BIMSongs [ songnum ] . filename , 1 ) ) // NOTE: If SDL_mixer active, this will still be called in mix_play_file in case file is hmp
2010-06-14 08:13:16 +00:00
{
Song_playing = songnum ;
}
}
2010-07-05 12:14:49 +00:00
# ifdef USE_SDLMIXER
2010-06-14 08:13:16 +00:00
else
# endif
2010-07-05 12:14:49 +00:00
# endif
2010-06-14 08:13:16 +00:00
# ifdef USE_SDLMIXER
{
2010-08-01 17:42:38 +00:00
if ( mix_play_file ( BIMSongs [ songnum ] . filename , 1 , NULL ) )
2010-06-14 08:13:16 +00:00
{
Song_playing = songnum ;
}
}
# endif
}
break ;
}
case MUSIC_TYPE_REDBOOK :
{
int n_tracks = RBAGetNumberOfTracks ( ) ;
int tracknum ;
2009-03-03 12:55:27 +00:00
2010-06-14 08:13:16 +00:00
if ( ! offset )
2010-08-01 17:42:38 +00:00
{
if ( Song_playing > = SONG_FIRST_LEVEL_SONG )
return Song_playing ;
2010-06-14 08:13:16 +00:00
tracknum = REDBOOK_FIRST_LEVEL_TRACK + ( ( n_tracks + 1 < = REDBOOK_FIRST_LEVEL_TRACK ) ? 0 : ( songnum % ( n_tracks - REDBOOK_FIRST_LEVEL_TRACK + 1 ) ) ) ;
2010-08-01 17:42:38 +00:00
}
2010-06-14 08:13:16 +00:00
else
{
tracknum = Redbook_playing + offset ;
if ( tracknum < REDBOOK_FIRST_LEVEL_TRACK )
tracknum = n_tracks - ( REDBOOK_FIRST_LEVEL_TRACK - tracknum ) + 1 ;
else if ( tracknum > n_tracks )
tracknum = REDBOOK_FIRST_LEVEL_TRACK + ( tracknum - n_tracks ) - 1 ;
}
2006-03-20 17:12:09 +00:00
2010-08-01 17:42:38 +00:00
Song_playing = 0 ;
2010-06-14 08:13:16 +00:00
if ( RBAEnabled ( ) & & ( tracknum < = n_tracks ) )
{
if ( RBAPlayTracks ( tracknum , n_tracks , redbook_first_song_func ) )
{
2010-08-01 17:42:38 +00:00
Song_playing = songnum + SONG_FIRST_LEVEL_SONG ;
2010-06-14 08:13:16 +00:00
Redbook_playing = tracknum ;
}
}
break ;
}
# ifdef USE_SDLMIXER
case MUSIC_TYPE_CUSTOM :
{
if ( ! offset )
{
if ( GameCfg . CMLevelMusicPlayOrder = = MUSIC_CM_PLAYORDER_CONT )
{
static int last_songnum = - 1 ;
2010-08-01 17:42:38 +00:00
if ( Song_playing > = SONG_FIRST_LEVEL_SONG )
return Song_playing ;
2006-03-20 17:12:09 +00:00
2010-06-14 08:13:16 +00:00
// As soon as we start a new level, go to next track
if ( last_songnum ! = - 1 & & songnum ! = last_songnum )
( ( GameCfg . CMLevelMusicTrack [ 0 ] + 1 > = GameCfg . CMLevelMusicTrack [ 1 ] ) ? GameCfg . CMLevelMusicTrack [ 0 ] = 0 : GameCfg . CMLevelMusicTrack [ 0 ] + + ) ;
last_songnum = songnum ;
}
2010-08-17 14:59:57 +00:00
else if ( GameCfg . CMLevelMusicPlayOrder = = MUSIC_CM_PLAYORDER_LEVEL )
2010-06-14 08:13:16 +00:00
GameCfg . CMLevelMusicTrack [ 0 ] = ( songnum % GameCfg . CMLevelMusicTrack [ 1 ] ) ;
}
else
{
GameCfg . CMLevelMusicTrack [ 0 ] + = offset ;
if ( GameCfg . CMLevelMusicTrack [ 0 ] < 0 )
GameCfg . CMLevelMusicTrack [ 0 ] = GameCfg . CMLevelMusicTrack [ 1 ] + GameCfg . CMLevelMusicTrack [ 0 ] ;
if ( GameCfg . CMLevelMusicTrack [ 0 ] + 1 > GameCfg . CMLevelMusicTrack [ 1 ] )
GameCfg . CMLevelMusicTrack [ 0 ] = GameCfg . CMLevelMusicTrack [ 0 ] - GameCfg . CMLevelMusicTrack [ 1 ] ;
}
2006-03-20 17:12:09 +00:00
2010-08-01 17:42:38 +00:00
Song_playing = 0 ;
2010-06-14 08:13:16 +00:00
if ( jukebox_play ( ) )
2010-08-01 17:42:38 +00:00
Song_playing = songnum + SONG_FIRST_LEVEL_SONG ;
2006-03-20 17:12:09 +00:00
2010-06-14 08:13:16 +00:00
break ;
}
# endif
default :
Song_playing = 0 ;
break ;
}
return Song_playing ;
2006-03-20 17:12:09 +00:00
}
2010-04-05 11:54:23 +00:00
// check which song is playing
int songs_is_playing ( )
{
return Song_playing ;
}