From d097c8e635565a7f0dbcbfd17a1221df763bedfa Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 12 May 2021 01:58:42 +0200 Subject: [PATCH] - removed the non-functional and long abandoned level music alias feature. With RMAPINFO such a hack is no longer needed for anything. --- source/core/music/s_advsound.cpp | 19 +------------------ source/core/raze_music.cpp | 18 ++---------------- source/core/raze_music.h | 2 +- source/core/rendering/scene/hw_flats.cpp | 2 +- source/core/sectorgeometry.cpp | 16 ++++++++-------- source/games/blood/src/blood.cpp | 4 ++-- source/games/blood/src/levels.cpp | 6 +++--- source/games/duke/src/sounds.cpp | 16 ++++++++-------- source/games/exhumed/src/cd.cpp | 4 ++-- source/games/exhumed/src/init.cpp | 2 +- source/games/sw/src/game.cpp | 4 ++-- source/games/sw/src/serp.cpp | 2 +- source/games/sw/src/sounds.cpp | 14 +++++++------- source/games/sw/src/sounds.h | 2 +- source/games/sw/src/sumo.cpp | 8 ++++---- source/games/sw/src/zilla.cpp | 2 +- 16 files changed, 45 insertions(+), 76 deletions(-) diff --git a/source/core/music/s_advsound.cpp b/source/core/music/s_advsound.cpp index 8270d5386..e6adecb1c 100644 --- a/source/core/music/s_advsound.cpp +++ b/source/core/music/s_advsound.cpp @@ -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; diff --git a/source/core/raze_music.cpp b/source/core/raze_music.cpp index c23f0b0ff..2453e8e40 100644 --- a/source/core/raze_music.cpp +++ b/source/core/raze_music.cpp @@ -49,7 +49,6 @@ static FString lastStartedMusic; TArray 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); } diff --git a/source/core/raze_music.h b/source/core/raze_music.h index a87644406..be614353f 100644 --- a/source/core/raze_music.h +++ b/source/core/raze_music.h @@ -11,7 +11,7 @@ extern TArray 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); diff --git a/source/core/rendering/scene/hw_flats.cpp b/source/core/rendering/scene/hw_flats.cpp index cd8cdeeb7..a4489caf8 100644 --- a/source/core/rendering/scene/hw_flats.cpp +++ b/source/core/rendering/scene/hw_flats.cpp @@ -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); diff --git a/source/core/sectorgeometry.cpp b/source/core/sectorgeometry.cpp index 4db5b3617..29e622f10 100644 --- a/source/core/sectorgeometry.cpp +++ b/source/core/sectorgeometry.cpp @@ -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); diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index f37c40693..9584e46ba 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -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; } diff --git a/source/games/blood/src/levels.cpp b/source/games/blood/src/levels.cpp index 449f617ce..4d25e7394 100644 --- a/source/games/blood/src/levels.cpp +++ b/source/games/blood/src/levels.cpp @@ -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); } } diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 9617b033e..9f890b316 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -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; diff --git a/source/games/exhumed/src/cd.cpp b/source/games/exhumed/src/cd.cpp index 9eb9c685a..d2fcab59d 100644 --- a/source/games/exhumed/src/cd.cpp +++ b/source/games/exhumed/src/cd.cpp @@ -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; } diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 031a057aa..d6852fc3c 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -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); } diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index c49766fc9..c10f7b06d 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -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(); diff --git a/source/games/sw/src/serp.cpp b/source/games/sw/src/serp.cpp index 911a29605..e905cc8ea 100644 --- a/source/games/sw/src/serp.cpp +++ b/source/games/sw/src/serp.cpp @@ -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; diff --git a/source/games/sw/src/sounds.cpp b/source/games/sw/src/sounds.cpp index 16ce58cf3..93d36d6e3 100644 --- a/source/games/sw/src/sounds.cpp +++ b/source/games/sw/src/sounds.cpp @@ -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; } diff --git a/source/games/sw/src/sounds.h b/source/games/sw/src/sounds.h index 5adda2407..5a2c13042 100644 --- a/source/games/sw/src/sounds.h +++ b/source/games/sw/src/sounds.h @@ -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); // diff --git a/source/games/sw/src/sumo.cpp b/source/games/sw/src/sumo.cpp index 628770099..f6c8d9c27 100644 --- a/source/games/sw/src/sumo.cpp +++ b/source/games/sw/src/sumo.cpp @@ -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); } } } diff --git a/source/games/sw/src/zilla.cpp b/source/games/sw/src/zilla.cpp index 37e234bb0..c513c4701 100644 --- a/source/games/sw/src/zilla.cpp +++ b/source/games/sw/src/zilla.cpp @@ -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);