Skip to content

Commit

Permalink
Fixed|Doom: IDMUS cheat not working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Dec 4, 2018
1 parent 30dc42f commit a977ef3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion doomsday/apps/plugins/common/include/p_sound.h
Expand Up @@ -30,8 +30,10 @@

/**
* Start the song for the specified map.
*
* @c return Music was successfully started.
*/
void S_MapMusic(de::Uri const &mapUri);
bool S_MapMusic(de::Uri const &mapUri);

extern "C" {
#endif
Expand Down
4 changes: 3 additions & 1 deletion doomsday/apps/plugins/common/src/world/p_sound.cpp
Expand Up @@ -33,7 +33,7 @@

using namespace de;

void S_MapMusic(de::Uri const &mapUri)
bool S_MapMusic(de::Uri const &mapUri)
{
String musicId = G_MapInfoForMapUri(mapUri).gets("music");
if (musicId.isEmpty())
Expand All @@ -44,13 +44,15 @@ void S_MapMusic(de::Uri const &mapUri)
{
// Set the game status cvar for the map music.
Con_SetInteger2("map-music", Defs().getMusicNum(musicId.toUtf8()), SVF_WRITE_OVERRIDE);
return true;
}
else
{
// We don't have anything to play.
S_StopMusic();
Con_SetInteger2("map-music", -1, SVF_WRITE_OVERRIDE);
}
return false;
}

void S_SectorSound(Sector *sec, int id)
Expand Down
5 changes: 3 additions & 2 deletions doomsday/apps/plugins/doom/src/m_cheat.cpp
Expand Up @@ -36,6 +36,7 @@
#include "gamesession.h"
#include "hu_msg.h"
#include "p_user.h"
#include "p_sound.h"
#include "player.h"

using namespace de;
Expand Down Expand Up @@ -78,8 +79,8 @@ CHEAT_FUNC(Music)
}

// Lookup and try to enqueue the Music for the referenced episode and map.
Record const &mapInfo = G_MapInfoForMapUri(TranslateMapWarpNumber(episodeId, warpNumber));
if(S_StartMusic(mapInfo.gets("music").toUtf8().constData(), true /*loop it*/))
const auto mapUri = TranslateMapWarpNumber(episodeId, warpNumber);
if (S_MapMusic(mapUri))
{
P_SetMessageWithFlags(plr, STSTR_MUS, LMF_NO_HIDE);
return true;
Expand Down

0 comments on commit a977ef3

Please sign in to comment.