Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Wad Map Converter: Enabled full libdeng2 C++ API
  • Loading branch information
skyjake committed Jul 24, 2012
1 parent c7142ca commit c471dd7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
9 changes: 6 additions & 3 deletions doomsday/plugins/config_plugin.pri
Expand Up @@ -14,8 +14,11 @@ win32 {

INCLUDEPATH += $$DENG_API_DIR

# The libdeng2 C wrapper can be used from all plugins.
DEFINES += DENG_NO_QT DENG2_C_API_ONLY
include(../dep_deng2_cwrapper.pri)
!dengplugin_libdeng2_full {
# The libdeng2 C wrapper can be used from all plugins.
DEFINES += DENG_NO_QT DENG2_C_API_ONLY
include(../dep_deng2_cwrapper.pri)
}
else: include(../dep_deng2.pri)

include(../dep_deng.pri)
13 changes: 5 additions & 8 deletions doomsday/plugins/wadmapconverter/src/id1map_analyze.cpp
Expand Up @@ -22,7 +22,7 @@
*/

#include "wadmapconverter.h"
#include <de/c_wrapper.h> // libdeng2
#include <de/Log>

#define mapFormat DENG_PLUGIN_GLOBAL(mapFormat)
#define map DENG_PLUGIN_GLOBAL(map)
Expand Down Expand Up @@ -210,7 +210,7 @@ static bool findAndCreatePolyobj(int16_t tag, int16_t anchorX, int16_t anchorY)
uint lineCount = 0;
uint psIndex = 0;

LegacyCore_LogAs("WadMapConverter");
LOG_AS("WadMapConverter");

for(uint j = 1; j < MAXPOLYLINES; ++j)
{
Expand All @@ -227,8 +227,7 @@ static bool findAndCreatePolyobj(int16_t tag, int16_t anchorX, int16_t anchorY)
{
if(!line->xArgs[1])
{
LegacyCore_PrintfLogFragmentAtLevel(DE2_LOG_WARNING,
"Linedef missing (probably #%d) in explicit polyobj (tag:%d).\n", j + 1, tag);
LOG_WARNING("Linedef missing (probably #%d) in explicit polyobj (tag:%d).") << j + 1 << tag;
for(uint k = 0; k < psIndex; ++k)
{
mline_t* line = polyLineList[k];
Expand All @@ -245,8 +244,7 @@ static bool findAndCreatePolyobj(int16_t tag, int16_t anchorX, int16_t anchorY)
psIndex++;
if(psIndex > MAXPOLYLINES)
{
LegacyCore_PrintfLogFragmentAtLevel(DE2_LOG_WARNING,
"Too many linedefs (%d > %d) in explicit polyobj (tag:%d).\n", psIndex, MAXPOLYLINES, tag);
LOG_WARNING("Too many linedefs (%d > %d) in explicit polyobj (tag:%d).") << psIndex << MAXPOLYLINES << tag;
for(uint k = 0; k < psIndex; ++k)
{
mline_t* line = polyLineList[k];
Expand Down Expand Up @@ -274,8 +272,7 @@ static bool findAndCreatePolyobj(int16_t tag, int16_t anchorX, int16_t anchorY)

if(line->xType == PO_LINE_EXPLICIT && line->xArgs[0] == tag)
{
LegacyCore_PrintfLogFragmentAtLevel(DE2_LOG_WARNING,
"Linedef missing (#%d) in explicit polyobj (tag:%d).\n", j, tag);
LOG_WARNING("Linedef missing (#%d) in explicit polyobj (tag:%d).") << j << tag;
for(uint k = 0; k < psIndex; ++k)
{
mline_t* line = polyLineList[k];
Expand Down
19 changes: 10 additions & 9 deletions doomsday/plugins/wadmapconverter/src/id1map_load.cpp
Expand Up @@ -22,6 +22,7 @@
*/

#include "wadmapconverter.h"
#include <de/libdeng2.h>

#define mapFormat DENG_PLUGIN_GLOBAL(mapFormat)
#define map DENG_PLUGIN_GLOBAL(map)
Expand All @@ -33,7 +34,7 @@ static const ddstring_t* findMaterialInDictionary(MaterialDictId id)

static MaterialDictId addMaterialToDictionary(const char* name, MaterialDictGroup group)
{
DENG_ASSERT(name);
DENG2_ASSERT(name);

// Are we yet to instantiate the dictionary itself?
if(!map->materials)
Expand Down Expand Up @@ -150,7 +151,7 @@ static void freeMapData(void)

static bool loadVertexes(Reader* reader, size_t lumpLength)
{
DENG_ASSERT(reader);
DENG2_ASSERT(reader);

ID1MAP_TRACE("Processing vertexes...");
switch(mapFormat)
Expand Down Expand Up @@ -244,7 +245,7 @@ static void interpretLineDefFlags(mline_t* l)

static bool loadLineDefs(Reader* reader, size_t lumpLength)
{
DENG_ASSERT(reader);
DENG2_ASSERT(reader);

ID1MAP_TRACE("Processing line definitions...");
switch(mapFormat)
Expand Down Expand Up @@ -368,7 +369,7 @@ static bool loadLineDefs(Reader* reader, size_t lumpLength)

static bool loadSideDefs(Reader* reader, size_t lumpLength)
{
DENG_ASSERT(reader);
DENG2_ASSERT(reader);

ID1MAP_TRACE("Processing side definitions...");
switch(mapFormat)
Expand Down Expand Up @@ -431,7 +432,7 @@ static bool loadSideDefs(Reader* reader, size_t lumpLength)

static bool loadSectors(Reader* reader, size_t lumpLength)
{
DENG_ASSERT(reader);
DENG2_ASSERT(reader);

ID1MAP_TRACE("Processing sectors...");
switch(mapFormat)
Expand Down Expand Up @@ -501,7 +502,7 @@ static bool loadThings(Reader* reader, size_t lumpLength)

#define ANG45 0x20000000

DENG_ASSERT(reader);
DENG2_ASSERT(reader);

ID1MAP_TRACE("Processing things...");
switch(mapFormat)
Expand Down Expand Up @@ -726,7 +727,7 @@ static bool loadThings(Reader* reader, size_t lumpLength)

static bool loadLights(Reader* reader, size_t lumpLength)
{
DENG_ASSERT(reader);
DENG2_ASSERT(reader);

ID1MAP_TRACE("Processing lights...");

Expand Down Expand Up @@ -776,7 +777,7 @@ static int readInt32(Reader* r)

static float readFloat(Reader* r)
{
DENG_ASSERT(sizeof(float) == 4);
DENG2_ASSERT(sizeof(float) == 4);
if(!r) return 0;
int32_t val = *((const int32_t*) (readPtr));
float returnValue = 0;
Expand Down Expand Up @@ -824,7 +825,7 @@ int LoadMap(MapLumpInfo* lumpInfos[NUM_MAPLUMP_TYPES])
{
size_t elmSize;

DENG_ASSERT(lumpInfos);
DENG2_ASSERT(lumpInfos);

memset(map, 0, sizeof(*map));

Expand Down
3 changes: 3 additions & 0 deletions doomsday/plugins/wadmapconverter/wadmapconverter.pro
Expand Up @@ -2,6 +2,9 @@
# Copyright (c) 2011-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
# Copyright (c) 2011-2012 Daniel Swanson <danij@dengine.net>

# This plugin uses the full libdeng2 C++ API.
CONFIG += dengplugin_libdeng2_full

include(../config_plugin.pri)

TEMPLATE = lib
Expand Down

0 comments on commit c471dd7

Please sign in to comment.