mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- simplified the music playing interface a bit.
#
This commit is contained in:
parent
a05dab66f7
commit
ff50a1681f
21 changed files with 55 additions and 155 deletions
|
@ -947,7 +947,7 @@ void ProcessFrame(void)
|
|||
}
|
||||
if (gDemo.at0)
|
||||
gDemo.Close();
|
||||
sndFadeSong(4000);
|
||||
Mus_Fade(4000);
|
||||
seqKillAll();
|
||||
if (gGameOptions.uGameFlags&2)
|
||||
{
|
||||
|
@ -1367,7 +1367,7 @@ RESTART:
|
|||
if (gRestartGame)
|
||||
{
|
||||
UpdateDacs(0, true);
|
||||
sndStopSong();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds();
|
||||
gQuitGame = 0;
|
||||
gQuitRequest = 0;
|
||||
|
@ -1991,27 +1991,18 @@ int sndTryPlaySpecialMusic(int nMusic)
|
|||
{
|
||||
int nEpisode = nMusic/kMaxLevels;
|
||||
int nLevel = nMusic%kMaxLevels;
|
||||
if (sndPlaySong(gEpisodeInfo[nEpisode].at28[nLevel].at0, gEpisodeInfo[nEpisode].at28[nLevel].atd0, true))
|
||||
if (Mus_Play(gEpisodeInfo[nEpisode].at28[nLevel].at0, gEpisodeInfo[nEpisode].at28[nLevel].atd0, true))
|
||||
{
|
||||
strncpy(gGameOptions.zLevelSong, gEpisodeInfo[nEpisode].at28[nLevel].atd0, BMAX_PATH);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unable to stat the music.
|
||||
*gGameOptions.zLevelSong = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void sndPlaySpecialMusicOrNothing(int nMusic)
|
||||
{
|
||||
int nEpisode = nMusic/kMaxLevels;
|
||||
int nLevel = nMusic%kMaxLevels;
|
||||
if (sndTryPlaySpecialMusic(nMusic))
|
||||
{
|
||||
sndStopSong();
|
||||
strncpy(gGameOptions.zLevelSong, gEpisodeInfo[nEpisode].at28[nLevel].atd0, BMAX_PATH);
|
||||
Mus_Stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ void credLogosDos(void)
|
|||
rotatesprite(160<<16, 100<<16, 65536, 0, 2518, 0, 0, 0x4a, 0, 0, xdim-1, ydim-1);
|
||||
scrNextPage();
|
||||
Wait(360);
|
||||
sndFadeSong(4000);
|
||||
Mus_Fade(4000);
|
||||
}
|
||||
|
||||
void credReset(void)
|
||||
|
|
|
@ -61,7 +61,6 @@ void ReadGameOptionsLegacy(GAMEOPTIONS &gameOptions, GAMEOPTIONSLEGACY &gameOpti
|
|||
gameOptions.nEpisode = gameOptionsLegacy.nEpisode;
|
||||
gameOptions.nLevel = gameOptionsLegacy.nLevel;
|
||||
strcpy(gameOptions.zLevelName, gameOptionsLegacy.zLevelName);
|
||||
strcpy(gameOptions.zLevelSong, gameOptionsLegacy.zLevelSong);
|
||||
gameOptions.nTrackNumber = gameOptionsLegacy.nTrackNumber;
|
||||
gameOptions.nSaveGameSlot = gameOptionsLegacy.nSaveGameSlot;
|
||||
gameOptions.picEntry = gameOptionsLegacy.picEntry;
|
||||
|
|
|
@ -50,7 +50,7 @@ BEGIN_BLD_NS
|
|||
GAMEOPTIONS gGameOptions;
|
||||
|
||||
GAMEOPTIONS gSingleGameOptions = {
|
||||
0, 2, 0, 0, "", "", 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 3600, 1800, 1800, 7200
|
||||
0, 2, 0, 0, "", 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 3600, 1800, 1800, 7200
|
||||
};
|
||||
|
||||
EPISODEINFO gEpisodeInfo[kMaxEpisodes+1];
|
||||
|
@ -88,7 +88,7 @@ void levelOverrideINI(const char *pzIni)
|
|||
void levelPlayIntroScene(int nEpisode)
|
||||
{
|
||||
gGameOptions.uGameFlags &= ~4;
|
||||
sndStopSong();
|
||||
Mus_Stop();
|
||||
sndKillAllSounds();
|
||||
sfxKillAllSounds();
|
||||
ambKillAll();
|
||||
|
@ -104,7 +104,7 @@ void levelPlayIntroScene(int nEpisode)
|
|||
void levelPlayEndScene(int nEpisode)
|
||||
{
|
||||
gGameOptions.uGameFlags &= ~8;
|
||||
sndStopSong();
|
||||
Mus_Stop();
|
||||
sndKillAllSounds();
|
||||
sfxKillAllSounds();
|
||||
ambKillAll();
|
||||
|
@ -199,7 +199,6 @@ void levelSetupOptions(int nEpisode, int nLevel)
|
|||
gGameOptions.nLevel = nLevel;
|
||||
strcpy(gGameOptions.zLevelName, gEpisodeInfo[nEpisode].at28[nLevel].at0);
|
||||
gGameOptions.uMapCRC = dbReadMapCRC(gGameOptions.zLevelName);
|
||||
// strcpy(gGameOptions.zLevelSong, gEpisodeInfo[nEpisode].at28[nLevel].atd0);
|
||||
gGameOptions.nTrackNumber = gEpisodeInfo[nEpisode].at28[nLevel].ate0;
|
||||
}
|
||||
|
||||
|
@ -401,19 +400,17 @@ bool levelTryPlayMusic(int nEpisode, int nLevel, bool bSetLevelSong)
|
|||
if (mus_redbook && gEpisodeInfo[nEpisode].at28[nLevel].ate0 > 0)
|
||||
snprintf(buffer, BMAX_PATH, "blood%02i.ogg", gEpisodeInfo[nEpisode].at28[nLevel].ate0);
|
||||
else
|
||||
{
|
||||
strncpy(buffer, gEpisodeInfo[nEpisode].at28[nLevel].atd0, BMAX_PATH);
|
||||
}
|
||||
if (!strchr(buffer, '.')) strcat(buffer, ".mid");
|
||||
bool bReturn = !!sndPlaySong(gEpisodeInfo[nEpisode].at28[nLevel].at0, buffer, true);
|
||||
if (bReturn || bSetLevelSong)
|
||||
strncpy(gGameOptions.zLevelSong, buffer, BMAX_PATH);
|
||||
else *gGameOptions.zLevelSong = 0;
|
||||
return bReturn;
|
||||
return !!Mus_Play(gEpisodeInfo[nEpisode].at28[nLevel].at0, buffer, true);
|
||||
}
|
||||
|
||||
void levelTryPlayMusicOrNothing(int nEpisode, int nLevel)
|
||||
{
|
||||
if (levelTryPlayMusic(nEpisode, nLevel, true))
|
||||
sndStopSong();
|
||||
Mus_Stop();
|
||||
}
|
||||
|
||||
class LevelsLoadSave : public LoadSave
|
||||
|
|
|
@ -39,7 +39,6 @@ struct GAMEOPTIONS {
|
|||
int nEpisode;
|
||||
int nLevel;
|
||||
char zLevelName[BMAX_PATH];
|
||||
char zLevelSong[BMAX_PATH];
|
||||
int nTrackNumber; //at12a;
|
||||
short nSaveGameSlot;
|
||||
int picEntry;
|
||||
|
|
|
@ -180,7 +180,6 @@ bool GameInterface::LoadGame(FSaveGameNode* node)
|
|||
MUS_ResumeSaved();
|
||||
|
||||
netBroadcastPlayerInfo(myconnectindex);
|
||||
//sndPlaySong(gGameOptions.zLevelSong, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ void SetupNetworkJoinMenu(CGameMenuItemChain *pItem)
|
|||
void NetworkHostGame(CGameMenuItemChain *pItem)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pItem);
|
||||
sndStopSong();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds();
|
||||
UpdateDacs(0, true);
|
||||
gNetPlayers = itemNetworkHostPlayerNum.nValue;
|
||||
|
@ -168,7 +168,7 @@ void NetworkHostGame(CGameMenuItemChain *pItem)
|
|||
void NetworkJoinGame(CGameMenuItemChain *pItem)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pItem);
|
||||
sndStopSong();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds();
|
||||
UpdateDacs(0, true);
|
||||
strcpy(gNetAddress, zNetAddressBuffer);
|
||||
|
|
|
@ -75,27 +75,6 @@ SAMPLE2D * FindChannel(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int sndPlaySong(const char *mapname, const char* songName, bool bLoop)
|
||||
{
|
||||
return Mus_Play(mapname, songName, bLoop);
|
||||
}
|
||||
|
||||
bool sndIsSongPlaying(void)
|
||||
{
|
||||
// Not used
|
||||
return false;
|
||||
}
|
||||
|
||||
void sndFadeSong(int nTime)
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
|
||||
void sndStopSong(void)
|
||||
{
|
||||
Mus_Stop();
|
||||
}
|
||||
|
||||
void sndSetFXVolume(int nVolume)
|
||||
{
|
||||
snd_fxvolume = nVolume;
|
||||
|
@ -307,7 +286,7 @@ void sndTerm(void)
|
|||
if (!sndActive)
|
||||
return;
|
||||
sndActive = false;
|
||||
sndStopSong();
|
||||
Mus_Stop();
|
||||
DeinitSoundDevice();
|
||||
//DeinitMusicDevice();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#pragma once
|
||||
|
||||
#include "resource.h"
|
||||
#include "z_music.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
@ -44,12 +45,7 @@ struct SFX
|
|||
};
|
||||
|
||||
int sndGetRate(int format);
|
||||
int sndPlaySong(const char *mapname, const char *songName, bool bLoop);
|
||||
bool sndIsSongPlaying(void);
|
||||
void sndFadeSong(int nTime);
|
||||
void sndSetMusicVolume(int nVolume);
|
||||
void sndSetFXVolume(int nVolume);
|
||||
void sndStopSong(void);
|
||||
void sndStartSample(const char *pzSound, int nVolume, int nChannel = -1);
|
||||
void sndStartSample(unsigned int nSound, int nVolume, int nChannel = -1, bool bLoop = false);
|
||||
void sndStartWavID(unsigned int nSound, int nVolume, int nChannel = -1);
|
||||
|
|
|
@ -609,6 +609,12 @@ void Mus_Stop()
|
|||
S_StopMusic(true);
|
||||
}
|
||||
|
||||
void Mus_Fade(double seconds)
|
||||
{
|
||||
// Todo: Blood uses this, but the streamer cannot currently fade the volume.
|
||||
Mus_Stop();
|
||||
}
|
||||
|
||||
void Mus_SetPaused(bool on)
|
||||
{
|
||||
if (on) S_PauseMusic();
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
void Mus_Init();
|
||||
int Mus_Play(const char *mapname, const char *fn, bool loop);
|
||||
void Mus_Stop();
|
||||
void Mus_Fade(double seconds);
|
||||
void Mus_SetPaused(bool on);
|
||||
void MUS_ResumeSaved();
|
||||
|
|
|
@ -5008,7 +5008,7 @@ badindex:
|
|||
|
||||
vInstruction(CON_STOPALLMUSIC):
|
||||
insptr++;
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
dispatch();
|
||||
|
||||
vInstruction(CON_OPERATE):
|
||||
|
|
|
@ -1287,7 +1287,7 @@ void gameDisplaySharewareScreens()
|
|||
|
||||
void G_DisplayExtraScreens(void)
|
||||
{
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds();
|
||||
|
||||
if (!DUKEBETA && (!VOLUMEALL || G_GetLogoFlags() & LOGO_SHAREWARESCREENS))
|
||||
|
@ -1467,7 +1467,7 @@ void G_DisplayLogo(void)
|
|||
renderFlushPerms();
|
||||
videoNextPage();
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds(); // JBF 20031228
|
||||
S_ClearSoundLocks(); // JBF 20031228
|
||||
|
||||
|
@ -1669,7 +1669,7 @@ static void G_BonusCutscenes(void)
|
|||
fadepal(0, 0, 0, 0, 252, 4);
|
||||
|
||||
VOL1_END:
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
break;
|
||||
|
@ -1680,7 +1680,7 @@ static void G_BonusCutscenes(void)
|
|||
|
||||
videoSetViewableArea(0, 0, xdim-1, ydim-1);
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
videoClearScreen(0L);
|
||||
videoNextPage();
|
||||
|
||||
|
@ -1714,7 +1714,7 @@ static void G_BonusCutscenes(void)
|
|||
|
||||
videoSetViewableArea(0, 0, xdim-1, ydim-1);
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
videoClearScreen(0L);
|
||||
videoNextPage();
|
||||
|
||||
|
@ -1796,7 +1796,7 @@ static void G_BonusCutscenes(void)
|
|||
if ((G_GetLogoFlags() & LOGO_NOE3BONUSSCENE) && (G_GetLogoFlags() & LOGO_NOE3RADLOGO) && (PLUTOPAK || (G_GetLogoFlags() & LOGO_NODUKETEAMPIC)))
|
||||
return;
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
videoClearScreen(0L);
|
||||
videoNextPage();
|
||||
if (adult_lockout == 0 && !(G_GetLogoFlags() & LOGO_NOE3BONUSSCENE))
|
||||
|
@ -2043,7 +2043,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
totalclock = 0;
|
||||
bonuscnt = 0;
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
|
||||
|
|
|
@ -2602,12 +2602,12 @@ void P_HandleSharedKeys(int playerNum)
|
|||
else ud.pause_on = 1+SHIFTS_IS_PRESSED;
|
||||
if (ud.pause_on)
|
||||
{
|
||||
S_PauseMusic(true);
|
||||
Mus_SetPaused(true);
|
||||
S_PauseSounds(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MusicEnabled()) S_PauseMusic(false);
|
||||
if (MusicEnabled()) Mus_SetPaused(false);
|
||||
|
||||
S_PauseSounds(false);
|
||||
|
||||
|
|
|
@ -133,22 +133,6 @@ void S_MenuSound(void)
|
|||
}
|
||||
|
||||
|
||||
static int S_PlayMusic(const char *mapname, const char* fn, bool looping = true)
|
||||
{
|
||||
return Mus_Play(mapname, fn, looping);
|
||||
}
|
||||
|
||||
void S_StopMusic(void)
|
||||
{
|
||||
Mus_Stop();
|
||||
}
|
||||
|
||||
void S_PauseMusic(bool paused)
|
||||
{
|
||||
Mus_SetPaused(paused);
|
||||
}
|
||||
|
||||
|
||||
static void S_SetMusicIndex(unsigned int m)
|
||||
{
|
||||
g_musicIndex = m;
|
||||
|
@ -156,30 +140,16 @@ static void S_SetMusicIndex(unsigned int m)
|
|||
ud.music_level = m % MAXLEVELS;
|
||||
}
|
||||
|
||||
bool S_TryPlayLevelMusic(unsigned int m)
|
||||
void S_PlayLevelMusicOrNothing(unsigned int m)
|
||||
{
|
||||
ud.returnvar[0] = m / MAXLEVELS;
|
||||
ud.returnvar[1] = m % MAXLEVELS;
|
||||
|
||||
int retval = VM_OnEvent(EVENT_PLAYLEVELMUSICSLOT, g_player[myconnectindex].ps->i, myconnectindex);
|
||||
|
||||
if (retval < 0)
|
||||
return false;
|
||||
|
||||
if (!S_PlayMusic(g_mapInfo[m].filename, g_mapInfo[m].musicfn))
|
||||
{
|
||||
S_SetMusicIndex(m);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void S_PlayLevelMusicOrNothing(unsigned int m)
|
||||
{
|
||||
if (S_TryPlayLevelMusic(m))
|
||||
if (retval >= 0)
|
||||
{
|
||||
//S_StopMusic();
|
||||
Mus_Play(g_mapInfo[m].filename, g_mapInfo[m].musicfn, true);
|
||||
S_SetMusicIndex(m);
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +159,7 @@ int S_TryPlaySpecialMusic(unsigned int m)
|
|||
char const * musicfn = g_mapInfo[m].musicfn;
|
||||
if (musicfn != NULL)
|
||||
{
|
||||
if (!S_PlayMusic(nullptr, musicfn))
|
||||
if (!Mus_Play(nullptr, musicfn, true))
|
||||
{
|
||||
S_SetMusicIndex(m);
|
||||
return 0;
|
||||
|
@ -203,7 +173,6 @@ void S_PlaySpecialMusicOrNothing(unsigned int m)
|
|||
{
|
||||
if (S_TryPlaySpecialMusic(m))
|
||||
{
|
||||
//S_StopMusic();
|
||||
S_SetMusicIndex(m);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#define sounds_public_h_
|
||||
|
||||
#include "sounds_common.h"
|
||||
#include "z_music.h"
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -72,7 +73,6 @@ void cacheAllSounds(void);
|
|||
void S_MenuSound(void);
|
||||
void S_PauseMusic(bool paused);
|
||||
void S_PauseSounds(bool paused);
|
||||
bool S_TryPlayLevelMusic(unsigned int m);
|
||||
void S_PlayLevelMusicOrNothing(unsigned int);
|
||||
int S_TryPlaySpecialMusic(unsigned int);
|
||||
void S_PlaySpecialMusicOrNothing(unsigned int);
|
||||
|
@ -83,7 +83,6 @@ void S_SoundShutdown(void);
|
|||
void S_SoundStartup(void);
|
||||
void S_StopEnvSound(int sndNum,int sprNum);
|
||||
void S_StopAllSounds(void);
|
||||
void S_StopMusic(void);
|
||||
void S_Update(void);
|
||||
void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset);
|
||||
|
||||
|
|
|
@ -1615,7 +1615,7 @@ static void postloadplayer(int32_t savegamep)
|
|||
MUS_ResumeSaved();
|
||||
|
||||
if (MusicEnabled())
|
||||
S_PauseMusic(false);
|
||||
Mus_SetPaused(false);
|
||||
|
||||
g_player[myconnectindex].ps->gm = MODE_GAME;
|
||||
ud.recstat = 0;
|
||||
|
|
|
@ -1236,7 +1236,7 @@ int inExtraScreens = 0;
|
|||
|
||||
void G_DisplayExtraScreens(void)
|
||||
{
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds();
|
||||
if (RR)
|
||||
return;
|
||||
|
@ -1310,7 +1310,7 @@ void G_DisplayLogo(void)
|
|||
renderFlushPerms();
|
||||
videoNextPage();
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds(); // JBF 20031228
|
||||
S_ClearSoundLocks(); // JBF 20031228
|
||||
if (RRRA)
|
||||
|
@ -1724,7 +1724,7 @@ static void G_BonusCutscenes(void)
|
|||
G_HandleEventsWhileNoInput();
|
||||
fadepal(0, 0, 0, 0, 252, 4);
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
break;
|
||||
|
@ -1732,7 +1732,7 @@ static void G_BonusCutscenes(void)
|
|||
case 1:
|
||||
videoSetViewableArea(0, 0, xdim-1, ydim-1);
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
videoClearScreen(0L);
|
||||
videoNextPage();
|
||||
|
||||
|
@ -1760,7 +1760,7 @@ static void G_BonusCutscenes(void)
|
|||
case 3:
|
||||
videoSetViewableArea(0, 0, xdim-1, ydim-1);
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
videoClearScreen(0L);
|
||||
videoNextPage();
|
||||
|
||||
|
@ -1828,7 +1828,7 @@ static void G_BonusCutscenes(void)
|
|||
break;
|
||||
|
||||
case 2:
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
videoClearScreen(0L);
|
||||
videoNextPage();
|
||||
if (adult_lockout == 0)
|
||||
|
@ -2077,7 +2077,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
totalclock = 0;
|
||||
bonuscnt = 0;
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
|
||||
|
@ -2669,7 +2669,7 @@ void G_BonusScreenRRRA(int32_t bonusonly)
|
|||
totalclock = 0;
|
||||
bonuscnt = 0;
|
||||
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
FX_StopAllSounds();
|
||||
S_ClearSoundLocks();
|
||||
|
||||
|
|
|
@ -3649,12 +3649,12 @@ void P_HandleSharedKeys(int playerNum)
|
|||
else ud.pause_on = 1+SHIFTS_IS_PRESSED;
|
||||
if (ud.pause_on)
|
||||
{
|
||||
S_PauseMusic(true);
|
||||
Mus_SetPaused(true);
|
||||
S_PauseSounds(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MusicEnabled()) S_PauseMusic(false);
|
||||
if (MusicEnabled()) Mus_SetPaused(false);
|
||||
|
||||
S_PauseSounds(false);
|
||||
|
||||
|
|
|
@ -122,23 +122,6 @@ void S_MenuSound(void)
|
|||
}
|
||||
|
||||
|
||||
static int S_PlayMusic(const char *mapname, const char* fn, bool looping = true)
|
||||
{
|
||||
return Mus_Play(mapname, fn, looping);
|
||||
}
|
||||
|
||||
void S_StopMusic(void)
|
||||
{
|
||||
Mus_Stop();
|
||||
}
|
||||
|
||||
|
||||
void S_PauseMusic(bool paused)
|
||||
{
|
||||
Mus_SetPaused(paused);
|
||||
}
|
||||
|
||||
|
||||
static void S_SetMusicIndex(unsigned int m)
|
||||
{
|
||||
g_musicIndex = m;
|
||||
|
@ -146,25 +129,10 @@ static void S_SetMusicIndex(unsigned int m)
|
|||
ud.music_level = m % MAXLEVELS;
|
||||
}
|
||||
|
||||
bool S_TryPlayLevelMusic(unsigned int m)
|
||||
{
|
||||
// For RR only explicitly invalidate the music name, but still allow the music code to run its own music substitution logic based on map names.
|
||||
if (!S_PlayMusic(g_mapInfo[m].filename,RR? nullptr : g_mapInfo[m].musicfn))
|
||||
{
|
||||
S_SetMusicIndex(m);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void S_PlayLevelMusicOrNothing(unsigned int m)
|
||||
{
|
||||
if (S_TryPlayLevelMusic(m))
|
||||
{
|
||||
//S_StopMusic();
|
||||
S_SetMusicIndex(m);
|
||||
}
|
||||
Mus_Play(g_mapInfo[m].filename, RR ? nullptr : g_mapInfo[m].musicfn, true);
|
||||
S_SetMusicIndex(m);
|
||||
}
|
||||
|
||||
int S_TryPlaySpecialMusic(unsigned int m)
|
||||
|
@ -174,7 +142,7 @@ int S_TryPlaySpecialMusic(unsigned int m)
|
|||
char const * musicfn = g_mapInfo[m].musicfn;
|
||||
if (musicfn != NULL)
|
||||
{
|
||||
if (!S_PlayMusic(nullptr, musicfn, 1))
|
||||
if (!Mus_Play(nullptr, musicfn, 1))
|
||||
{
|
||||
S_SetMusicIndex(m);
|
||||
return 0;
|
||||
|
@ -189,20 +157,19 @@ void S_PlayRRMusic(int newTrack)
|
|||
char fileName[16];
|
||||
if (!RR)
|
||||
return;
|
||||
S_StopMusic();
|
||||
Mus_Stop();
|
||||
g_cdTrack = newTrack != -1 ? newTrack : g_cdTrack+1;
|
||||
if (newTrack != 10 && (g_cdTrack > 9 || g_cdTrack < 2))
|
||||
g_cdTrack = 2;
|
||||
|
||||
Bsprintf(fileName, "track%.2d.ogg", g_cdTrack);
|
||||
S_PlayMusic(fileName, 0);
|
||||
Mus_Play(fileName, 0, true);
|
||||
}
|
||||
|
||||
void S_PlaySpecialMusicOrNothing(unsigned int m)
|
||||
{
|
||||
if (S_TryPlaySpecialMusic(m))
|
||||
{
|
||||
//S_StopMusic();
|
||||
S_SetMusicIndex(m);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#define sounds_public_h_
|
||||
|
||||
#include "sounds_common.h"
|
||||
#include "z_music.h"
|
||||
|
||||
BEGIN_RR_NS
|
||||
|
||||
|
@ -71,10 +72,8 @@ inline void S_ClearSoundLocks(void) {}
|
|||
int32_t S_LoadSound(uint32_t num);
|
||||
void S_PrecacheSounds(void);
|
||||
void S_MenuSound(void);
|
||||
void S_PauseMusic(bool paused);
|
||||
void S_PauseSounds(bool paused);
|
||||
void S_PlayRRMusic(int newTrack = -1);
|
||||
bool S_TryPlayLevelMusic(unsigned int m);
|
||||
void S_PlayLevelMusicOrNothing(unsigned int);
|
||||
int S_TryPlaySpecialMusic(unsigned int);
|
||||
void S_PlaySpecialMusicOrNothing(unsigned int);
|
||||
|
@ -84,7 +83,6 @@ void S_SoundShutdown(void);
|
|||
void S_SoundStartup(void);
|
||||
void S_StopEnvSound(int32_t num,int32_t i);
|
||||
void S_StopAllSounds(void);
|
||||
void S_StopMusic(void);
|
||||
void S_Update(void);
|
||||
void S_ChangeSoundPitch(int soundNum, int spriteNum, int pitchoffset);
|
||||
|
||||
|
|
Loading…
Reference in a new issue