- thorough cleanup of the Shadow Warrior music code.

This was one huge mess where nothing fit together.
Also added an enhancement that the CD Audio boss theme tracks are also played when CD music is generally off, because these have no equivalent in MIDI. This needs to be checked if it's stylistically ok, though.
This commit is contained in:
Christoph Oelckers 2019-12-07 19:57:19 +01:00
parent ff50a1681f
commit 0157446ad1
18 changed files with 54 additions and 483 deletions

View file

@ -563,12 +563,6 @@ int Mus_Play(const char *mapname, const char *fn, bool loop)
{
return 0;
}
// A restart was requested. Ignore the music name being passed and just try tp restart what got here last.
if (mapname && *mapname == '*')
{
mapname = lastMusicLevel.GetChars();
fn = lastMusic.GetChars();
}
// Allow per level music substitution.
// For most cases using $musicalias would be sufficient, but that method only works if a level actually has some music defined at all.

View file

@ -259,7 +259,8 @@ static void SaveStatistics(const char *fn, TArray<FStatistics> &statlist)
{
fw->Printf("\t{\n");
qsort(&ls[0], ls.Size(), sizeof(ls[0]), compare_level_names);
// Only makes sense if level names follow a strict format. This is noz the case here.
//qsort(&ls[0], ls.Size(), sizeof(ls[0]), compare_level_names);
for(unsigned k=0;k<ls.Size ();k++)
{

View file

@ -2607,8 +2607,7 @@ void P_HandleSharedKeys(int playerNum)
}
else
{
if (MusicEnabled()) Mus_SetPaused(false);
Mus_SetPaused(false);
S_PauseSounds(false);
pub = NUMPAGES;

View file

@ -344,35 +344,6 @@ static int S_CalcDistAndAng(int spriteNum, int soundNum, int sectNum, int angle,
sndang = S_GetAngle(angle, cam, pos);
sndist = FindDistance3D(cam->x-pos->x, cam->y-pos->y, (cam->z-pos->z));
#ifdef SPLITSCREEN_MOD_HACKS
if (g_fakeMultiMode==2)
{
// HACK for splitscreen mod: take the min of sound distances
// to 1st and 2nd player.
if (PN(spriteNum) == APLAYER && P_Get(spriteNum) == 1)
{
sndist = sndang = 0;
goto sound_further_processing;
}
{
const vec3_t *cam2 = &g_player[1].ps->pos;
int32_t sndist2 = FindDistance3D(cam2->x-pos->x, cam2->y-pos->y, (cam2->z-pos->z));
if (sndist2 < sndist)
{
cam = cam2;
sectNum = g_player[1].ps->cursectnum;
angle = g_player[1].ps->ang;
sndist = sndist2;
sndang = S_GetAngle(angle, cam, pos);
}
}
}
#endif
if ((g_sounds[soundNum].m & (SF_GLOBAL|SF_DTAG)) != SF_GLOBAL && S_IsAmbientSFX(spriteNum) && (sector[SECT(spriteNum)].lotag&0xff) < 9) // ST_9_SLIDING_ST_DOOR
sndist = divscale14(sndist, SHT(spriteNum)+1);
@ -464,13 +435,6 @@ int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos)
while (j < MAXSOUNDINSTANCES && snd.voices[j].id != voice)
j++;
#ifdef DEBUGGINGAIDS
if (EDUKE32_PREDICT_FALSE(j >= MAXSOUNDINSTANCES))
{
OSD_Printf(OSD_ERROR "%s %d: WTF?\n", __FILE__, __LINE__);
return -1;
}
#endif
snd.voices[j].owner = spriteNum;
@ -482,14 +446,6 @@ int S_PlaySound3D(int num, int spriteNum, const vec3_t *pos)
int pitch = S_GetPitch(sndNum);
auto const pOther = g_player[screenpeek].ps;
#ifdef SPLITSCREEN_MOD_HACKS
if (g_fakeMultiMode==2)
{
// splitscreen HACK
if (g_player[1].ps->i == spriteNum)
pOther = g_player[1].ps;
}
#endif
if (pOther->sound_pitch)
pitch += pOther->sound_pitch;

View file

@ -1613,9 +1613,7 @@ static void postloadplayer(int32_t savegamep)
S_ClearSoundLocks();
G_CacheMapData();
MUS_ResumeSaved();
if (MusicEnabled())
Mus_SetPaused(false);
Mus_SetPaused(false);
g_player[myconnectindex].ps->gm = MODE_GAME;
ud.recstat = 0;

View file

@ -3654,7 +3654,7 @@ void P_HandleSharedKeys(int playerNum)
}
else
{
if (MusicEnabled()) Mus_SetPaused(false);
Mus_SetPaused(false);
S_PauseSounds(false);

View file

@ -155,7 +155,7 @@ int S_TryPlaySpecialMusic(unsigned int m)
void S_PlayRRMusic(int newTrack)
{
char fileName[16];
if (!RR)
if (!RR || !mus_redbook)
return;
Mus_Stop();
g_cdTrack = newTrack != -1 ? newTrack : g_cdTrack+1;

View file

@ -24,6 +24,7 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../common/textures
${CMAKE_CURRENT_SOURCE_DIR}/../common/fonts
${CMAKE_CURRENT_SOURCE_DIR}/../common/2d
${CMAKE_CURRENT_SOURCE_DIR}/../common/music
${CMAKE_CURRENT_SOURCE_DIR}/../platform
)

View file

@ -84,7 +84,6 @@ SWBOOL DemoInitOnce = FALSE;
short DemoDebugBufferMax = 1;
extern char LevelName[];
extern char LevelSong[16];
extern uint8_t FakeMultiNumPlayers;
extern SWBOOL QuitFlag;
@ -179,7 +178,7 @@ DemoWriteHeader(void)
return;
strcpy(dh.map_name, LevelName);
strcpy(dh.LevelSong, LevelSong);
strcpy(dh.LevelSong, "");
dh.Level = Level;
if (FakeMultiNumPlayers)
@ -238,7 +237,6 @@ DemoReadHeader(void)
DREAD(&dh, sizeof(dh), 1, DemoFileIn);
strcpy(DemoLevelName, dh.map_name);
strcpy(LevelSong, dh.LevelSong);
Level = dh.Level;
if (dh.numplayers > 1)
{
@ -389,13 +387,6 @@ DemoPlayBack(void)
ControlInfo info;
int Xdim, Ydim, ScreenSize;
if (SW_SHAREWARE)
{
// code here needs to be similar to RunLevel startup code
PlaySong(LevelSong, -1, TRUE, TRUE);
}
// Initialize Game part of network code (When ready2send != 0)
InitNetVars();
@ -570,8 +561,7 @@ ScenePlayBack(void)
if (SW_SHAREWARE)
{
// code here needs to be similar to RunLevel startup code
strcpy(LevelSong,"yokoha03.mid");
PlaySong(LevelSong, -1, TRUE, TRUE);
PlaySong(nullptr, "yokoha03.mid", -1);
}
// IMPORTANT - MUST be right before game loop

View file

@ -96,6 +96,7 @@ Things required to make savegames work:
#include "m_argv.h"
#include "debugbreak.h"
#include "menu/menu.h"
#include "z_music.h"
//#include "crc32.h"
@ -964,8 +965,6 @@ void InitGame()
COVERsetbrightness(0, &palette_data[0][0]);
InitFX(); // JBF: do it down here so we get a hold of the window handle
InitMusic();
}
@ -986,7 +985,6 @@ TYTAIK16 MID
YOKOHA03 MID
*/
char LevelSong[16];
short SongLevelNum;
//#ifndef SW_SHAREWARE
LEVEL_INFO LevelInfo[MAX_LEVELS_REG+2] =
@ -1170,7 +1168,7 @@ InitLevel(void)
// A few IMPORTANT GLOBAL RESETS
InitLevelGlobals();
if (!DemoMode)
StopSong();
Mus_Stop();
if (LoadGameOutsideMoveLoop)
{
@ -1196,7 +1194,6 @@ InitLevel(void)
FindLevelInfo(LevelName, &Level);
if (Level > 0)
{
strcpy(LevelSong, LevelInfo[Level].SongName);
strcpy(LevelName, LevelInfo[Level].LevelName);
UserMapName[0] = '\0';
}
@ -1235,7 +1232,6 @@ InitLevel(void)
if (Level > 0)
{
// user map is part of game - treat it as such
strcpy(LevelSong, LevelInfo[Level].SongName);
strcpy(LevelName, LevelInfo[Level].LevelName);
UserMapName[0] = '\0';
}
@ -1243,7 +1239,6 @@ InitLevel(void)
else
{
strcpy(LevelName, LevelInfo[Level].LevelName);
strcpy(LevelSong, LevelInfo[Level].SongName);
}
}
@ -1599,8 +1594,7 @@ void ResetKeyRange(uint8_t* kb, uint8_t* ke)
void PlayTheme()
{
// start music at logo
strcpy(LevelSong,"theme.mid");
PlaySong(LevelSong, RedBookSong[0], TRUE, TRUE);
PlaySong(nullptr, "theme.mid", RedBookSong[0]);
DSPRINTF(ds,"After music stuff...");
MONO_PRINT(ds);
@ -1704,9 +1698,9 @@ void CreditsLevel(void)
while (FX_SoundActive(handle)) ;
// try 14 then 2 then quit
if (!PlaySong(NULL, 14, FALSE, TRUE))
if (!PlaySong(nullptr, nullptr, 14, true))
{
if (!PlaySong(NULL, 2, FALSE, TRUE))
if (!PlaySong(nullptr, nullptr, 2, true))
{
handle = PlaySound(DIGI_NOLIKEMUSIC,&zero,&zero,&zero,v3df_none);
if (handle > 0)
@ -1747,10 +1741,6 @@ void CreditsLevel(void)
curpic = CREDITS1_PIC;
}
if (!SongIsPlaying())
break;
if (inputState.GetKeyStatus(KEYSC_ESC))
break;
}
@ -1759,7 +1749,7 @@ void CreditsLevel(void)
videoClearViewableArea(0L);
videoNextPage();
ResetKeys();
StopSong();
Mus_Stop();
}
@ -2247,10 +2237,7 @@ void BonusScreen(PLAYERp pp)
totalclock = ototalclock = 0;
limit = synctics;
if (MusicEnabled())
{
PlaySong(voc[DIGI_ENDLEV].name, 3, TRUE, TRUE);
}
PlaySong(nullptr, voc[DIGI_ENDLEV].name, 3);
// special case code because I don't care any more!
if (FinishAnim)
@ -2565,10 +2552,7 @@ void StatScreen(PLAYERp mpp)
inputState.ClearKeyStatus(KEYSC_SPACE);
inputState.ClearKeyStatus(KEYSC_ENTER);
if (MusicEnabled())
{
PlaySong(voc[DIGI_ENDLEV].name, 3, TRUE, TRUE);
}
PlaySong(nullptr, voc[DIGI_ENDLEV].name, 3);
while (!inputState.GetKeyStatus(KEYSC_SPACE) && !inputState.GetKeyStatus(KEYSC_ENTER))
{
@ -2781,7 +2765,6 @@ void InitRunLevel(void)
if (snd_ambience)
StartAmbientSound();
SetCrosshair();
PlaySong(LevelSong, -1, TRUE, TRUE);
SetRedrawScreen(Player + myconnectindex);
// crappy little hack to prevent play clock from being overwritten
// for load games
@ -2803,7 +2786,7 @@ void InitRunLevel(void)
waitforeverybody();
StopSong();
Mus_Stop();
if (Bstrcasecmp(CacheLastLevel, LevelName) != 0)
DoTheCache();
@ -2827,7 +2810,7 @@ void InitRunLevel(void)
{
track = RedBookSong[Level];
}
PlaySong(LevelSong, track, TRUE, TRUE);
PlaySong(LevelInfo[Level].LevelName, LevelInfo[Level].SongName, track);
}
InitPrediction(&Player[myconnectindex]);
@ -3270,12 +3253,12 @@ void PauseKey(PLAYERp pp)
#define MSG_GAME_PAUSED "Game Paused"
MNU_MeasureString(MSG_GAME_PAUSED, &w, &h);
PutStringTimer(pp, TEXT_TEST_COL(w), 100, MSG_GAME_PAUSED, 999);
PauseSong(TRUE);
Mus_SetPaused(true);
}
else
{
pClearTextLine(pp, 100);
PauseSong(FALSE);
Mus_SetPaused(false);
}
}

View file

@ -2942,7 +2942,6 @@ void MNU_DoButton(MenuItem_p item, SWBOOL draw)
SWBOOL state;
int last_value;
short shade = MENU_SHADE_DEFAULT;
extern char LevelSong[];
const char *extra_text = NULL;
PLAYERp pp = &Player[myconnectindex];
int button_x,zero=0;
@ -3025,35 +3024,6 @@ void MNU_DoButton(MenuItem_p item, SWBOOL draw)
}
break;
case btn_music:
last_value = mus_enabled;
mus_enabled = state = buttonsettings[item->button];
if (mus_enabled != last_value)
{
SWBOOL bak;
if (MusicEnabled())
{
bak = DemoMode;
PlaySong(LevelSong, RedBookSong[Level], TRUE, TRUE);
DemoMode = bak;
}
else
{
bak = DemoMode;
StopSong();
DemoMode = bak;
if (SW_SHAREWARE)
{
handle = PlaySound(DIGI_NOLIKEMUSIC,&zero,&zero,&zero,v3df_none);
if (handle > FX_Ok)
while (FX_SoundActive(handle))
handleevents();
}
}
}
break;
case btn_talking:
snd_speech = state = buttonsettings[item->button];
break;

View file

@ -57,6 +57,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "player.h"
#include "i_specialpaths.h"
#include "savegamehelp.h"
#include "z_music.h"
//void TimerFunc(task * Task);
BEGIN_SW_NS
@ -75,7 +76,6 @@ TO DO
extern int lastUpdate;
extern uint8_t RedBookSong[40];
extern char UserMapName[80];
extern char LevelSong[16];
extern char SaveGameDescr[10][80];
extern int PlayClock;
extern short TotalKillable;
@ -663,8 +663,6 @@ bool GameInterface::SaveGame(FSaveGameNode *sv)
// game settings
MWRITE(&gNet,sizeof(gNet),1,fil);
MWRITE(LevelSong,sizeof(LevelSong),1,fil);
MWRITE(palette,sizeof(palette),1,fil);
MWRITE(palette_data,sizeof(palette_data),1,fil);
MWRITE(&gs,sizeof(gs),1,fil);
@ -744,7 +742,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
// Don't terminate until you've made sure conditions are valid for loading.
if (InMenuLevel)
StopSong();
Mus_Stop();
else
TerminateLevel();
Terminate3DSounds();
@ -1112,8 +1110,6 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
// game settings
MREAD(&gNet,sizeof(gNet),1,fil);
MREAD(LevelSong,sizeof(LevelSong),1,fil);
MREAD(palette,sizeof(palette),1,fil);
MREAD(palette_data,sizeof(palette_data),1,fil);
@ -1225,7 +1221,7 @@ bool GameInterface::LoadGame(FSaveGameNode* sv)
screenpeek = myconnectindex;
PlayingLevel = Level;
PlaySong(LevelSong, RedBookSong[Level], TRUE, TRUE);
MUS_ResumeSaved();
if (snd_ambience)
StartAmbientSound();
FX_SetVolume(snd_fxvolume);

View file

@ -815,14 +815,13 @@ int DoDeathSpecial(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
static SWBOOL alreadydid = FALSE;
DoMatchEverything(NULL, sp->lotag, ON);
if (!SW_SHAREWARE && MusicEnabled() && !alreadydid)
if (!SW_SHAREWARE)
{
PlaySong(0, RedBookSong[Level], TRUE, TRUE);
alreadydid = TRUE;
// Resume the regular music - in a hack-free fashion.
PlaySong(LevelInfo[Level].LevelName, LevelInfo[Level].SongName, RedBookSong[Level]);
}
BossSpriteNum[0] = -2;

View file

@ -51,6 +51,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "menus.h"
#include "config.h"
#include "menu/menu.h"
#include "z_music.h"
#ifdef _WIN32
#include "sdlayer.h"
@ -84,11 +85,9 @@ uint8_t RedBookSong[40] =
SWBOOL Use_SoundSpriteNum = FALSE;
int16_t SoundSpriteNum = -1; // Always set this back to -1 for proper validity checking!
SWBOOL MusicInitialized = FALSE;
SWBOOL FxInitialized = FALSE;
void SoundCallBack(unsigned int num);
SWBOOL LoadSong(const char *track);
#define MUSIC_ID -65536
@ -121,19 +120,6 @@ int voice;
int loopflag;
typedef enum
{
SongTypeNone,
SongTypeMIDI,
SongTypeWave,
} SongType_t;
char *SongPtr = NULL;
int SongLength = 0;
char *SongName = NULL;
int SongTrack = 0;
SongType_t SongType = SongTypeNone;
int SongVoice = -1;
extern SWBOOL DemoMode;
//
@ -254,27 +240,6 @@ int PlayerYellVocs[] =
DIGI_PLAYERYELL3
};
#if 0
// DEBUG
void CheckSndData(char *file, int line)
{
short i;
//return;
for (i = 0; i<DIGI_MAX; i++)
{
if (!globsndata[i] && !globvpdata[i]) continue;
if (memcmp(globsndata[i], globvpdata[i], glength[i]) != 0)
{
printf("%s %d\n",file,line);
printf("CheckSndData: Data is not the same! num = %d",i);
exit(0);
}
}
}
#endif
//
// Routine called when a sound is finished playing
@ -321,7 +286,7 @@ void
UnInitSound(void)
{
SoundShutdown();
MusicShutdown();
Mus_Stop();
}
void
@ -330,17 +295,6 @@ InitFX(void)
VOC_INFOp vp;
short i;
#if 0
// DEBUG
for (i=0; i<DIGI_MAX; i++)
{
globsndata[i] = globvpdata[i] = NULL;
glength[i] = 0;
}
#endif
//ExternalSoundMod();
// Select which cards to use
SoundStartup();
@ -353,167 +307,25 @@ InitFX(void)
FX_SetCallBack(SoundCallBack);
}
void
InitMusic(void)
{
// Select which cards to use
MusicStartup();
//SendGeneralMidiSysX();
}
void
ExternalSoundMod(void)
{
FILE *fin;
VOC_INFOp vp;
char name[40];
char new_name[40];
int pri;
int pitch_lo, pitch_hi;
int ret;
fin = fopen("swextern.snd", "r");
if (!fin)
return;
while (TRUE)
{
ret = fscanf(fin, "%s %s %d %d", name, new_name, &pitch_lo, &pitch_hi);
if (ret == EOF)
break;
for (vp = voc; vp < &voc[SIZ(voc)]; vp++)
{
#if 0
if (!vp->name)
continue;
#endif
if (!Bstrcasecmp(name, vp->name))
{
// vp->priority = pri;
strcpy(vp->name, new_name);
vp->pitch_lo = pitch_lo;
vp->pitch_hi = pitch_hi;
}
}
}
fclose(fin);
}
extern short Level;
SWBOOL
PlaySong(char *song_file_name, int cdaudio_track, SWBOOL loop, SWBOOL restart)
SWBOOL PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track, bool isThemeTrack) //(nullptr, nullptr, -1, false) starts the normal level music.
{
if (!MusicEnabled())
if (mapname == nullptr && song_file_name == nullptr && cdaudio_track == -1)
{
return FALSE;
// Get the music defined for the current level.
}
if (DemoMode)
return FALSE;
if (!restart)
// Play CD audio if enabled or if this is a theme track.
if (cdaudio_track >= 0 && (mus_redbook || isThemeTrack))
{
if (SongType == SongTypeWave)
FStringf trackname("track%02d.ogg", cdaudio_track);
if (!Mus_Play(nullptr, trackname, true))
{
if (SongTrack > 0 && SongTrack == cdaudio_track)
{
// ogg replacement for a CD track
return TRUE;
}
else if (SongName && song_file_name && !strcmp(SongName, song_file_name))
{
return TRUE;
}
}
else if (SongType == SongTypeMIDI)
{
if (SongName && song_file_name && !strcmp(SongName, song_file_name))
{
return TRUE;
}
buildprintf("Can't find CD track %i!\n", cdaudio_track);
}
}
StopSong();
if (!SW_SHAREWARE)
{
if (cdaudio_track >= 0 && mus_redbook)
{
char waveformtrack[MAXWAVEFORMTRACKLENGTH];
Bstrncpy(waveformtrack, gs.WaveformTrackName, MAXWAVEFORMTRACKLENGTH - 1);
char *numPos = Bstrstr(waveformtrack, "??");
if (numPos && (numPos-waveformtrack) < MAXWAVEFORMTRACKLENGTH - 2)
{
static const char *tracktypes[] = { ".flac", ".ogg" };
const size_t tracknamebaselen = Bstrlen(waveformtrack);
size_t i;
numPos[0] = '0' + (cdaudio_track / 10) % 10;
numPos[1] = '0' + cdaudio_track % 10;
for (i = 0; i < ARRAY_SIZE(tracktypes); ++i)
{
waveformtrack[tracknamebaselen] = '\0';
Bstrncat(waveformtrack, tracktypes[i], MAXWAVEFORMTRACKLENGTH - 1);
if (LoadSong(waveformtrack))
{
SongVoice = FX_Play(SongPtr, SongLength, 0, 0, 0,
255, 255, 255, FX_MUSIC_PRIORITY, 1.f, MUSIC_ID);
if (SongVoice > FX_Ok)
{
SongType = SongTypeWave;
SongTrack = cdaudio_track;
SongName = Bstrdup(waveformtrack);
return TRUE;
}
}
}
buildprintf("Can't find CD track %i!\n", cdaudio_track);
}
else
{
buildprintf("Make sure to have \"??\" as a placeholder for the track number in your WaveformTrackName!\n");
buildprintf(" e.g. WaveformTrackName = \"MUSIC/Track??\"\n");
}
}
}
if (!song_file_name || !LoadSong(song_file_name))
{
return FALSE;
}
if (!memcmp(SongPtr, "MThd", 4))
{
MUSIC_PlaySong(SongPtr, SongLength, MUSIC_LoopSong);
SongType = SongTypeMIDI;
SongName = strdup(song_file_name);
return TRUE;
}
else
{
SongVoice = FX_Play(SongPtr, SongLength, 0, 0, 0,
255, 255, 255, FX_MUSIC_PRIORITY, 1.f, MUSIC_ID);
if (SongVoice > FX_Ok)
{
SongType = SongTypeWave;
SongName = strdup(song_file_name);
return TRUE;
}
}
return FALSE;
return Mus_Play(nullptr, song_file_name, true);
}
void
@ -522,57 +334,11 @@ StopFX(void)
FX_StopAllSounds();
}
void
StopSong(void)
{
if (DemoMode)
return;
if (SongType == SongTypeWave && SongVoice > 0)
{
FX_StopSound(SongVoice);
SongVoice = 0;
}
else if (SongType == SongTypeMIDI)
{
MUSIC_StopSong();
}
SongType = SongTypeNone;
DO_FREE_AND_NULL(SongName);
SongTrack = 0;
if (SongPtr)
{
FreeMem(SongPtr);
SongPtr = 0;
SongLength = 0;
}
}
void
PauseSong(SWBOOL pauseon)
{
if (!MusicEnabled()) return;
if (SongType == SongTypeWave && SongVoice > 0)
{
FX_PauseVoice(SongVoice, pauseon);
}
}
SWBOOL
SongIsPlaying(void)
{
return FALSE;
}
void
StopSound(void)
{
StopFX();
StopSong();
Mus_Stop();
}
//
@ -1082,34 +848,6 @@ ReadSound(FileReader &handle, VOC_INFOp vp, int length)
return 0;
}
SWBOOL
LoadSong(const char *filename)
{
auto fr = fileSystem.OpenFileReader(filename, 0);
if (!fr.isOpen())
{
return FALSE;
}
auto size = fr.GetLength();
auto ptr = (char *) AllocMem(size);
if (ptr == NULL)
{
return FALSE;
}
if (fr.Read(ptr, size) != size)
{
FreeMem(ptr);
return FALSE;
}
SongPtr = ptr;
SongLength = size;
return TRUE;
}
void
SoundStartup(void)
{
@ -1159,52 +897,11 @@ SoundShutdown(void)
}
/*
===================
=
= MusicStartup
=
===================
*/
void MusicStartup(void)
{
#if 0
auto fil = fileSystem.OpenFileReader("swtimbr.tmb", 0);
if (fil.isOpen())
{
auto tmb = fil.Read();
if (tmb.Size())
AL_RegisterTimbreBank(tmb.Data());
}
#endif
}
void COVER_SetReverb(int amt)
{
FX_SetReverb(amt);
}
/*
===================
=
= MusicShutdown
=
===================
*/
void MusicShutdown(void)
{
StopSong();
int status = MUSIC_Shutdown();
if (status != MUSIC_Ok)
{
buildprintf("Music error: %s\n", MUSIC_ErrorString(status));
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////

View file

@ -84,15 +84,11 @@ SWBOOL CacheSound(int num, int type);
void COVER_SetReverb(int amt);
void UnInitSound(void);
void InitFX(void);
void InitMusic(void);
void StopFX(void);
void StopSong(void);
void PauseSong(SWBOOL pauseon);
void StopSound(void);
void StartAmbientSound(void);
void StopAmbientSound(void);
SWBOOL PlaySong(char *song_file_name, int cdaudio_track, SWBOOL loop, SWBOOL restart);
SWBOOL SongIsPlaying(void);
SWBOOL PlaySong(const char *mapname, const char *song_file_name, int cdaudio_track, bool isThemeTrack = false); //(nullptr, nullptr, -1, false) starts the normal level music.
void PlaySoundRTS(int rts_num);
//

View file

@ -794,7 +794,6 @@ int DoSumoDeathMelt(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
static SWBOOL alreadydid = FALSE;
PlaySound(DIGI_SUMOFART, &sp->x, &sp->y, &sp->z, v3df_follow);
@ -803,10 +802,10 @@ int DoSumoDeathMelt(short SpriteNum)
u->ID = 0;
DoMatchEverything(NULL, sp->lotag, ON);
if (!SW_SHAREWARE && MusicEnabled() && !alreadydid)
if (!SW_SHAREWARE)
{
PlaySong(0, RedBookSong[Level], TRUE, TRUE);
alreadydid = TRUE;
// Resume the regular music - in a hack-free fashion.
PlaySong(LevelInfo[Level].LevelName, LevelInfo[Level].SongName, RedBookSong[Level]);
}
BossSpriteNum[1] = -2; // Sprite is gone, set it back to keep it valid!
@ -882,25 +881,25 @@ BossHealthMeter(void)
if (i == 0 && !serpwasseen)
{
serpwasseen = TRUE;
if (!SW_SHAREWARE && MusicEnabled())
if (!SW_SHAREWARE)
{
PlaySong(0, ThemeTrack[2], TRUE, TRUE);
PlaySong(nullptr, nullptr, ThemeTrack[2], true);
}
}
else if (i == 1 && !sumowasseen)
{
sumowasseen = TRUE;
if (!SW_SHAREWARE && MusicEnabled())
if (!SW_SHAREWARE)
{
PlaySong(0, ThemeTrack[3], TRUE, TRUE);
PlaySong(nullptr, nullptr, ThemeTrack[3], true);
}
}
else if (i == 2 && !zillawasseen)
{
zillawasseen = TRUE;
if (!SW_SHAREWARE && MusicEnabled())
if (!SW_SHAREWARE)
{
PlaySong(0, ThemeTrack[4], TRUE, TRUE);
PlaySong(nullptr, nullptr, ThemeTrack[4], true);
}
}
}
@ -919,13 +918,6 @@ BossHealthMeter(void)
if (i == 2 && (!zillawasseen || BossSpriteNum[2] < 0))
continue;
// This is needed because of possible saved game situation
if (!SW_SHAREWARE && !triedplay)
{
PlaySong(0, ThemeTrack[i+2], TRUE, FALSE);
triedplay = TRUE; // Only try once, then give up
}
sp = &sprite[BossSpriteNum[i]];
u = User[BossSpriteNum[i]];

View file

@ -769,7 +769,6 @@ int DoZillaDeathMelt(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
static SWBOOL alreadydid = FALSE;
if (RANDOM_RANGE(1000) > 800)
SpawnGrenadeExp(SpriteNum);
@ -778,10 +777,10 @@ int DoZillaDeathMelt(short SpriteNum)
RESET(u->Flags, SPR_JUMPING|SPR_FALLING|SPR_MOVED);
//DoMatchEverything(NULL, sp->lotag, ON);
if (!SW_SHAREWARE && MusicEnabled() && !alreadydid)
if (!SW_SHAREWARE)
{
PlaySong(0, RedBookSong[Level], TRUE, TRUE);
alreadydid = TRUE;
// Resume the regular music - in a hack-free fashion.
PlaySong(LevelInfo[Level].LevelName, LevelInfo[Level].SongName, RedBookSong[Level]);
}
//KeepActorOnFloor(SpriteNum);

View file

@ -1286,7 +1286,7 @@ OptionMenu SoundOptions //protected
//Option "$SNDMNU_RANDOMIZEPITCHES", "snd_pitched", "OnOff"
Slider "$SNDMNU_CHANNELS", "snd_numchannels", 64, 128, 8, 0
staticText ""
ifgame (Blood, ShadowWarrior)
ifgame (Blood, ShadowWarrior, Redneck, RedneckRides)
{
Option "$SNDMNU_CDEMU", "mus_redbook", "OnOff"
}