mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 11:40:44 +00:00
- removed the non-functional and long abandoned level music alias feature.
With RMAPINFO such a hack is no longer needed for anything.
This commit is contained in:
parent
783b94f922
commit
d097c8e635
16 changed files with 45 additions and 76 deletions
|
@ -52,13 +52,11 @@ enum SICommands
|
|||
SI_MusicVolume,
|
||||
SI_MidiDevice,
|
||||
SI_MusicAlias,
|
||||
SI_LevelMusic,
|
||||
};
|
||||
|
||||
|
||||
// This specifies whether Timidity or Windows playback is preferred for a certain song (only useful for Windows.)
|
||||
extern MusicAliasMap MusicAliases;
|
||||
extern MusicAliasMap LevelMusicAliases;
|
||||
extern MidiDeviceMap MidiDevices;
|
||||
extern MusicVolumeMap MusicVolumes;
|
||||
|
||||
|
@ -80,7 +78,6 @@ static const char *SICommandStrings[] =
|
|||
"$musicvolume",
|
||||
"$mididevice",
|
||||
"$musicalias",
|
||||
"$levelmusic",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -140,7 +137,7 @@ static void S_AddSNDINFO (int lump)
|
|||
sc.MustGetString();
|
||||
FName musname (sc.String);
|
||||
sc.MustGetFloat();
|
||||
MusicVolumes[musname] = sc.Float;
|
||||
MusicVolumes[musname] = (float)sc.Float;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -172,20 +169,6 @@ static void S_AddSNDINFO (int lump)
|
|||
}
|
||||
break;
|
||||
|
||||
case SI_LevelMusic: {
|
||||
sc.MustGetString();
|
||||
FName alias = sc.String;
|
||||
sc.MustGetString();
|
||||
FName mapped = sc.String;
|
||||
|
||||
// only set the alias if the lump it maps to exists.
|
||||
if (mapped == NAME_None || fileSystem.FindFile(sc.String) >= 0)
|
||||
{
|
||||
LevelMusicAliases[alias] = mapped;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SI_MidiDevice: {
|
||||
sc.MustGetString();
|
||||
FName nm = sc.String;
|
||||
|
|
|
@ -49,7 +49,6 @@ static FString lastStartedMusic;
|
|||
TArray<FString> specialmusic;
|
||||
|
||||
MusicAliasMap MusicAliases;
|
||||
MusicAliasMap LevelMusicAliases;
|
||||
|
||||
CVAR(Bool, printmusicinfo, false, 0)
|
||||
CVAR(Bool, mus_extendedlookup, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||
|
@ -191,31 +190,18 @@ static FString LookupMusicCB(const char* musicname, int& order)
|
|||
}
|
||||
|
||||
|
||||
static FString lastMusicLevel, lastMusic;
|
||||
int Mus_Play(const char *mapname, const char *fn, bool loop)
|
||||
static FString lastMusic;
|
||||
int Mus_Play(const char *fn, bool loop)
|
||||
{
|
||||
if (mus_blocked) return 1; // Caller should believe it succeeded.
|
||||
if (*fn == '/') fn++;
|
||||
// Store the requested names for resuming.
|
||||
lastMusicLevel = mapname;
|
||||
lastMusic = fn;
|
||||
|
||||
if (!MusicEnabled())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 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.
|
||||
// This way it can be done with an add-on definition lump even in cases like Redneck Rampage where no music definitions exist
|
||||
// or where music gets reused for multiple levels but replacement is wanted individually.
|
||||
if (mapname && *mapname)
|
||||
{
|
||||
if (*mapname == '/') mapname++;
|
||||
FName *check = LevelMusicAliases.CheckKey(FName(mapname, true));
|
||||
if (check) fn = check->GetChars();
|
||||
}
|
||||
|
||||
return S_ChangeMusic(fn, 0, loop, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ extern TArray<FString> specialmusic;
|
|||
// Totally minimalistic interface - should be all the game modules need.
|
||||
void Mus_InitMusic();
|
||||
void Mus_UpdateMusic();
|
||||
int Mus_Play(const char *mapname, const char *fn, bool loop);
|
||||
int Mus_Play(const char *fn, bool loop);
|
||||
void Mus_Stop();
|
||||
bool Mus_IsPlaying();
|
||||
void Mus_SetPaused(bool on);
|
||||
|
|
|
@ -244,7 +244,7 @@ void HWFlat::ProcessSector(HWDrawInfo *di, sectortype * frontsector, int section
|
|||
const auto &vp = di->Viewpoint;
|
||||
|
||||
float florz, ceilz;
|
||||
PlanesAtPoint(frontsector, vp.Pos.X * 16.f, vp.Pos.Y * -16.f, &ceilz, &florz);
|
||||
PlanesAtPoint(frontsector, float(vp.Pos.X) * 16.f, float(vp.Pos.Y) * -16.f, &ceilz, &florz);
|
||||
|
||||
fade = lookups.getFade(frontsector->floorpal); // fog is per sector.
|
||||
visibility = sectorVisibility(frontsector);
|
||||
|
|
|
@ -139,8 +139,8 @@ public:
|
|||
DVector2 dv = { double(ix2 - ix1), -double(iy2 - iy1) };
|
||||
auto vang = dv.Angle() - 90.;
|
||||
|
||||
cosalign = vang.Cos();
|
||||
sinalign = vang.Sin();
|
||||
cosalign = float(vang.Cos());
|
||||
sinalign = float(vang.Sin());
|
||||
|
||||
int pow2width = 1 << sizeToBits((int)tx->GetDisplayWidth());
|
||||
if (pow2width < (int)tx->GetDisplayWidth()) pow2width *= 2;
|
||||
|
@ -247,9 +247,9 @@ bool SectorGeometry::MakeVertices(unsigned int secnum, int plane, const FVector2
|
|||
{
|
||||
auto sline = §ionLines[sec->lines[start]];
|
||||
auto wallp = &wall[sline->startpoint];
|
||||
float X = WallStartX(wallp);
|
||||
float Y = WallStartY(wallp);
|
||||
if (fabs(X) > 32768. || fabs(Y) > 32768.)
|
||||
float X = float(WallStartX(wallp));
|
||||
float Y = float(WallStartY(wallp));
|
||||
if (fabs(X) > 32768.f || fabs(Y) > 32768.f)
|
||||
{
|
||||
// If we get here there's some fuckery going around with the coordinates. Let's better abort and wait for things to realign.
|
||||
// Do not try alternative methods if this happens.
|
||||
|
@ -277,7 +277,7 @@ bool SectorGeometry::MakeVertices(unsigned int secnum, int plane, const FVector2
|
|||
{
|
||||
minx = pt.first;
|
||||
miny = pt.second;
|
||||
outer = a;
|
||||
outer = int(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -303,8 +303,8 @@ bool SectorGeometry::MakeVertices(unsigned int secnum, int plane, const FVector2
|
|||
}
|
||||
|
||||
auto& entry = data[secnum].planes[plane];
|
||||
entry.vertices.Resize(indices.size());
|
||||
entry.texcoords.Resize(indices.size());
|
||||
entry.vertices.Resize((unsigned)indices.size());
|
||||
entry.texcoords.Resize((unsigned)indices.size());
|
||||
entry.normal = CalcNormal(sectorp, plane);
|
||||
|
||||
auto texture = tileGetTexture(plane ? sectorp->ceilingpicnum : sectorp->floorpicnum);
|
||||
|
|
|
@ -487,7 +487,7 @@ void GameInterface::Render()
|
|||
|
||||
void sndPlaySpecialMusicOrNothing(int nMusic)
|
||||
{
|
||||
if (!Mus_Play(nullptr, quoteMgr.GetQuote(nMusic), true))
|
||||
if (!Mus_Play(quoteMgr.GetQuote(nMusic), true))
|
||||
{
|
||||
Mus_Stop();
|
||||
}
|
||||
|
@ -539,7 +539,7 @@ DEFINE_ACTION_FUNCTION(_Blood, OriginalLoadScreen)
|
|||
|
||||
DEFINE_ACTION_FUNCTION(_Blood, PlayIntroMusic)
|
||||
{
|
||||
Mus_Play(nullptr, "PESTIS.MID", false);
|
||||
Mus_Play("PESTIS.MID", false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -246,12 +246,12 @@ void levelTryPlayMusic()
|
|||
else
|
||||
{
|
||||
buffer = currentLevel->music;
|
||||
if (Mus_Play(currentLevel->labelName, buffer, true)) return;
|
||||
if (Mus_Play(buffer, true)) return;
|
||||
if (buffer.IsNotEmpty()) DefaultExtension(buffer, ".mid");
|
||||
}
|
||||
if (!Mus_Play(currentLevel->labelName, buffer, true))
|
||||
if (!Mus_Play(buffer, true))
|
||||
{
|
||||
Mus_Play("", "", true);
|
||||
Mus_Play("", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -674,7 +674,7 @@ void S_MenuSound(void)
|
|||
|
||||
static bool cd_disabled = false; // This is in case mus_redbook is enabled but no tracks found so that the regular music system can be switched on.
|
||||
|
||||
static void MusPlay(const char* label, const char* music, bool loop)
|
||||
static void MusPlay(const char* music, bool loop)
|
||||
{
|
||||
if (isWorldTour())
|
||||
{
|
||||
|
@ -688,26 +688,26 @@ static void MusPlay(const char* label, const char* music, bool loop)
|
|||
int file = fileSystem.GetFileContainer(num);
|
||||
if (file == 1)
|
||||
{
|
||||
Mus_Play(label, alternative, loop);
|
||||
Mus_Play(alternative, loop);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int result = Mus_Play(label, music, loop);
|
||||
int result = Mus_Play(music, loop);
|
||||
// do not remain silent if playing World Tour when the user has deleted the music.
|
||||
if (!result && isWorldTour())
|
||||
{
|
||||
FString alternative = music;
|
||||
alternative.Substitute(".ogg", ".mid");
|
||||
Mus_Play(label, alternative, loop);
|
||||
Mus_Play(alternative, loop);
|
||||
}
|
||||
}
|
||||
|
||||
void S_PlayLevelMusic(MapRecord *mi)
|
||||
{
|
||||
if (isRR() && mi->music.IsEmpty() && mus_redbook && !cd_disabled) return;
|
||||
MusPlay(mi->labelName, mi->music, true);
|
||||
MusPlay(mi->music, true);
|
||||
}
|
||||
|
||||
void S_PlaySpecialMusic(unsigned int m)
|
||||
|
@ -716,7 +716,7 @@ void S_PlaySpecialMusic(unsigned int m)
|
|||
auto& musicfn = specialmusic[m];
|
||||
if (musicfn.IsNotEmpty())
|
||||
{
|
||||
MusPlay(nullptr, musicfn, true);
|
||||
MusPlay(musicfn, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,10 +741,10 @@ void S_PlayRRMusic(int newTrack)
|
|||
g_cdTrack = 2;
|
||||
|
||||
FStringf filename("redneck%s%02d.ogg", isRRRA()? "rides" : "", g_cdTrack);
|
||||
if (Mus_Play(nullptr, filename, false)) return;
|
||||
if (Mus_Play(filename, false)) return;
|
||||
|
||||
filename.Format("track%02d.ogg", g_cdTrack);
|
||||
if (Mus_Play(nullptr, filename, false)) return;
|
||||
if (Mus_Play(filename, false)) return;
|
||||
}
|
||||
// If none of the tracks managed to start, disable the CD music for this session so that regular music can play if defined.
|
||||
cd_disabled = true;
|
||||
|
|
|
@ -48,11 +48,11 @@ bool playCDtrack(int nTrack, bool bLoop)
|
|||
|
||||
// try ogg vorbis now from root directory.
|
||||
sprintf(filename, "exhumed%02d.ogg", nTrack);
|
||||
if (!Mus_Play(nullptr, filename, true))
|
||||
if (!Mus_Play(filename, true))
|
||||
{
|
||||
// try ogg vorbis now from GOG MUSIC subdirectory.
|
||||
sprintf(filename, "track%02d.ogg", nTrack);
|
||||
Mus_Play(nullptr, filename, true);
|
||||
Mus_Play(filename, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ void InitLevel(MapRecord* map)
|
|||
|
||||
RefreshStatus();
|
||||
|
||||
if (!mus_redbook && map->music.IsNotEmpty()) Mus_Play(map->labelName, map->music, true); // Allow non-CD music if defined for the current level
|
||||
if (!mus_redbook && map->music.IsNotEmpty()) Mus_Play(map->music, true); // Allow non-CD music if defined for the current level
|
||||
playCDtrack(map->cdSongId, true);
|
||||
setLevelStarted(currentLevel);
|
||||
}
|
||||
|
|
|
@ -404,7 +404,7 @@ void InitRunLevel(void)
|
|||
|
||||
if (currentLevel)
|
||||
{
|
||||
PlaySong(currentLevel->labelName, currentLevel->music, currentLevel->cdSongId);
|
||||
PlaySong(currentLevel->music, currentLevel->cdSongId);
|
||||
}
|
||||
|
||||
InitPrediction(&Player[myconnectindex]);
|
||||
|
@ -542,7 +542,7 @@ void GameInterface::LevelCompleted(MapRecord* map, int skill)
|
|||
if (map == nullptr)
|
||||
{
|
||||
FinishAnim = false;
|
||||
PlaySong(nullptr, ThemeSongs[0], ThemeTrack[0]);
|
||||
PlaySong(ThemeSongs[0], ThemeTrack[0]);
|
||||
if (isShareware())
|
||||
{
|
||||
PlayOrderSound();
|
||||
|
|
|
@ -817,7 +817,7 @@ int DoDeathSpecial(short SpriteNum)
|
|||
if (!SW_SHAREWARE)
|
||||
{
|
||||
// Resume the regular music - in a hack-free fashion.
|
||||
PlaySong(currentLevel->labelName, currentLevel->music, currentLevel->cdSongId);
|
||||
PlaySong(currentLevel->music, currentLevel->cdSongId);
|
||||
}
|
||||
|
||||
BossSpriteNum[0] = -2;
|
||||
|
|
|
@ -935,16 +935,16 @@ int PlayerYellVocs[] =
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track, bool isThemeTrack) //(nullptr, nullptr, -1, false) starts the normal level music.
|
||||
bool PlaySong(const char* song_file_name, int cdaudio_track, bool isThemeTrack) //(nullptr, nullptr, -1, false) starts the normal level music.
|
||||
{
|
||||
// Play CD audio if enabled.
|
||||
if (cdaudio_track >= 0 && (mus_redbook || !song_file_name || *song_file_name == 0))
|
||||
{
|
||||
FStringf trackname("shadow%02d.ogg", cdaudio_track);
|
||||
if (!Mus_Play(mapname, trackname, true))
|
||||
if (!Mus_Play(trackname, true))
|
||||
{
|
||||
trackname.Format("track%02d.ogg", cdaudio_track);
|
||||
if (!Mus_Play(mapname, trackname, true))
|
||||
if (!Mus_Play(trackname, true))
|
||||
{
|
||||
Printf("Can't find CD track %i!\n", cdaudio_track);
|
||||
}
|
||||
|
@ -955,14 +955,14 @@ bool PlaySong(const char* mapname, const char* song_file_name, int cdaudio_track
|
|||
{
|
||||
return true;
|
||||
}
|
||||
if (!Mus_Play(mapname, song_file_name, true))
|
||||
if (!Mus_Play(song_file_name, true))
|
||||
{
|
||||
// try the CD track anyway if no MIDI could be found (the original game doesn't have any MIDI, it was CD Audio only, this avoids no music playing if mus_redbook is off.)
|
||||
FStringf trackname("shadow%02d.ogg", cdaudio_track);
|
||||
if (!Mus_Play(mapname, trackname, true))
|
||||
if (!Mus_Play(trackname, true))
|
||||
{
|
||||
trackname.Format("track%02d.ogg", cdaudio_track);
|
||||
if (!Mus_Play(nullptr, trackname, true)) return false;
|
||||
if (!Mus_Play(trackname, true)) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -1011,7 +1011,7 @@ DEFINE_ACTION_FUNCTION(_SW, PlaySong)
|
|||
{
|
||||
PARAM_PROLOGUE;
|
||||
PARAM_INT(song);
|
||||
PlaySong(nullptr, ThemeSongs[song], ThemeTrack[song], true);
|
||||
PlaySong(ThemeSongs[song], ThemeTrack[song], true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ void StopFX(void);
|
|||
void StopSound(void);
|
||||
void StartAmbientSound(void);
|
||||
void StopAmbientSound(void);
|
||||
bool PlaySong(const char *mapname, const char *song_file_name, int cdaudio_track, bool isThemeTrack = false); //(nullptr, nullptr, -1, false) starts the normal level music.
|
||||
bool PlaySong(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);
|
||||
|
||||
//
|
||||
|
|
|
@ -797,7 +797,7 @@ int DoSumoDeathMelt(short SpriteNum)
|
|||
if (!SW_SHAREWARE)
|
||||
{
|
||||
// Resume the regular music - in a hack-free fashion.
|
||||
PlaySong(currentLevel->labelName, currentLevel->music, currentLevel->cdSongId);
|
||||
PlaySong(currentLevel->music, currentLevel->cdSongId);
|
||||
}
|
||||
|
||||
BossSpriteNum[1] = -2; // Sprite is gone, set it back to keep it valid!
|
||||
|
@ -868,7 +868,7 @@ BossHealthMeter(void)
|
|||
bosswasseen[0] = true;
|
||||
if (!SW_SHAREWARE)
|
||||
{
|
||||
PlaySong(nullptr, ThemeSongs[2], ThemeTrack[2], true);
|
||||
PlaySong(ThemeSongs[2], ThemeTrack[2], true);
|
||||
}
|
||||
}
|
||||
else if (i == 1 && !bosswasseen[1])
|
||||
|
@ -876,7 +876,7 @@ BossHealthMeter(void)
|
|||
bosswasseen[1] = true;
|
||||
if (!SW_SHAREWARE)
|
||||
{
|
||||
PlaySong(nullptr, ThemeSongs[3], ThemeTrack[3], true);
|
||||
PlaySong(ThemeSongs[3], ThemeTrack[3], true);
|
||||
}
|
||||
}
|
||||
else if (i == 2 && !bosswasseen[2])
|
||||
|
@ -884,7 +884,7 @@ BossHealthMeter(void)
|
|||
bosswasseen[2] = true;
|
||||
if (!SW_SHAREWARE)
|
||||
{
|
||||
PlaySong(nullptr, ThemeSongs[4], ThemeTrack[4], true);
|
||||
PlaySong(ThemeSongs[4], ThemeTrack[4], true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -775,7 +775,7 @@ int DoZillaDeathMelt(short SpriteNum)
|
|||
if (!SW_SHAREWARE)
|
||||
{
|
||||
// Resume the regular music - in a hack-free fashion.
|
||||
PlaySong(currentLevel->labelName, currentLevel->music, currentLevel->cdSongId);
|
||||
PlaySong(currentLevel->music, currentLevel->cdSongId);
|
||||
}
|
||||
|
||||
//KeepActorOnFloor(SpriteNum);
|
||||
|
|
Loading…
Reference in a new issue