Skip to content

Commit

Permalink
IdTech1Converter|MapInfoTranslator: Set Map Info.Author to the games'…
Browse files Browse the repository at this point in the history
… author

For consistency with the default Map Info defs for the other games.

Also removed the unnecessary "DEFSONG" music id symbolic.
  • Loading branch information
danij-deng committed Sep 13, 2014
1 parent 528817d commit 36e72a8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 35 deletions.
42 changes: 16 additions & 26 deletions doomsday/plugins/common/src/p_sound.cpp
@@ -1,7 +1,7 @@
/** @file p_sound.cpp id Tech 1 sound playback functionality.
*
* @authors Copyright © 2003-2013 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2005-2013 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 2005-2014 Daniel Swanson <danij@dengine.net>
* @authors Copyright © 1999 Activision
* @authors Copyright © 1993-1996 id Software, Inc.
*
Expand All @@ -23,47 +23,37 @@
#include "common.h"
#include "p_sound.h"

#include <de/Log>
#include "dmu_lib.h"
#include "hexlex.h"
#ifdef __JHEXEN__
# include "g_common.h"
# include "hexlex.h"
#endif

#include <de/Log>

using namespace de;
using namespace common;

void S_MapMusic(de::Uri const &mapUri)
{
if(Record const *mapInfo = Defs().mapInfos.tryFind("id", mapUri.compose()))
{
#ifdef __JHEXEN__
Record const &mapInfo = Defs().mapInfos.find("id", mapUri.compose());
int const cdTrack = mapInfo.geti("cdTrack");
String const lump = mapInfo.gets("songLump").compareWithoutCase("DEFSONG")? mapInfo.gets("songLump") : "";

LOG_RES_VERBOSE("S_MapMusic: %s lump: %s") << mapUri.compose() << lump;

// Update the 'currentmap' music definition.
Record &music = Defs().musics.find("id", "currentmap");
music.set("lumpName", lump);
music.set("cdTrack", cdTrack);
// Update the 'currentmap' music definition.
String const songId = "currentmap";

if(S_StartMusic("currentmap", true))
{
// Set the game status cvar for the map music.
Con_SetInteger2("map-music", Defs().getMusicNum(music.gets("id").toUtf8().constData()), SVF_WRITE_OVERRIDE);
}
Record &music = Defs().musics.find("id", songId);
music.set("lumpName", mapInfo->gets("songLump"));
music.set("cdTrack", mapInfo->geti("cdTrack", 0));
#else
if(Record const *mapInfo = Defs().mapInfos.tryFind("id", mapUri.compose()))
{
int songNumber = Defs().getMusicNum(mapInfo->gets("music").toUtf8().constData());
String const songId = mapInfo->gets("music");
#endif

int const songNumber = Defs().getMusicNum(songId.toUtf8().constData());
if(S_StartMusicNum(songNumber, true))
{
// Set the game status cvar for the map music.
Con_SetInteger2("map-music", songNumber, SVF_WRITE_OVERRIDE);
}
}
#endif
}

void S_SectorSound(Sector *sec, int id)
Expand All @@ -79,8 +69,8 @@ void S_SectorStopSounds(Sector *sec)
if(!sec) return;

// Stop other sounds playing from origins in this sector.
/// @todo Add a compatibility option allowing origins to work independently?
S_StopSound2(0, (mobj_t*) P_GetPtrp(sec, DMU_EMITTER), SSF_ALL_SECTOR);
/// @todo Add a compatibility option allowing emitters to work independently?
S_StopSound2(0, (mobj_t *) P_GetPtrp(sec, DMU_EMITTER), SSF_ALL_SECTOR);
}

void S_PlaneSound(Plane *pln, int id)
Expand Down
25 changes: 16 additions & 9 deletions doomsday/plugins/idtech1converter/src/mapinfotranslator.cpp
Expand Up @@ -77,21 +77,21 @@ namespace internal {

void resetToDefaults() {
// Add all expected fields with their default values.
addText ("map", "Maps:"); // URI. Unknown.
addNumber ("cdTrack", 1);
addBoolean("doubleSky", false);
addText ("fadeTable", "COLORMAP");
addNumber ("hub", 0);
addNumber ("warpTrans", 0);
addBoolean("lightning", false);
addText ("map", "Maps:"); // URI. Unknown.
addText ("nextMap", ""); // URI. None. (If scheme is "@wt" then the path is a warp trans number).
addText ("secretNextMap", ""); // URI. None. (If scheme is "@wt" then the path is a warp trans number).
addNumber ("cdTrack", 1);
addText ("title", "Untitled");
addText ("sky1Material", defaultSkyMaterial());
addText ("sky2Material", defaultSkyMaterial());
addNumber ("sky1ScrollDelta", 0);
addText ("sky2Material", defaultSkyMaterial());
addNumber ("sky2ScrollDelta", 0);
addBoolean("doubleSky", false);
addBoolean("lightning", false);
addText ("fadeTable", "COLORMAP");
addText ("songLump", "DEFSONG");
addText ("songLump", "");
addNumber ("warpTrans", 0);
}
};

Expand Down Expand Up @@ -1399,6 +1399,9 @@ String MapInfoTranslator::translate()
episodeIdx += 1;
}

GameInfo gameInfo;
DD_GameInfo(&gameInfo);

// Output mapinfo defs.
for(HexDefs::MapInfos::const_iterator i = d->defs.mapInfos.begin(); i != d->defs.mapInfos.end(); ++i)
{
Expand All @@ -1410,9 +1413,13 @@ String MapInfoTranslator::translate()
os << "\n\nMap Info {"
<< "\n ID = \"" + mapUri.compose() + "\";"
<< "\n Name = \"" + info.gets("title") + "\";"
<< "\n Music = \"" + info.gets("songLump") + "\";"
<< "\n Author = \"" + String(Str_Text(gameInfo.author)) + "\";"
<< "\n CD Track = " + String::number(info.geti("cdTrack")) + ";"
<< "\n Fade Table = \"" + info.gets("fadeTable") + "\";";
if(!info.gets("songLump").isEmpty())
{
os << "\n Music = \"" + info.gets("songLump") + "\";";
}
if(info.getb("lightning"))
{
os << "\n Flags = lightning;";
Expand Down

0 comments on commit 36e72a8

Please sign in to comment.