From c471dd7346406eaa830fe9180d53eb287d408020 Mon Sep 17 00:00:00 2001 From: skyjake Date: Tue, 24 Jul 2012 21:19:33 +0300 Subject: [PATCH] Wad Map Converter: Enabled full libdeng2 C++ API --- doomsday/plugins/config_plugin.pri | 9 ++++++--- .../wadmapconverter/src/id1map_analyze.cpp | 13 +++++-------- .../wadmapconverter/src/id1map_load.cpp | 19 ++++++++++--------- .../wadmapconverter/wadmapconverter.pro | 3 +++ 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/doomsday/plugins/config_plugin.pri b/doomsday/plugins/config_plugin.pri index 7a08debfcb..f3dda512f3 100644 --- a/doomsday/plugins/config_plugin.pri +++ b/doomsday/plugins/config_plugin.pri @@ -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) diff --git a/doomsday/plugins/wadmapconverter/src/id1map_analyze.cpp b/doomsday/plugins/wadmapconverter/src/id1map_analyze.cpp index 109933538e..27c9aaf81a 100644 --- a/doomsday/plugins/wadmapconverter/src/id1map_analyze.cpp +++ b/doomsday/plugins/wadmapconverter/src/id1map_analyze.cpp @@ -22,7 +22,7 @@ */ #include "wadmapconverter.h" -#include // libdeng2 +#include #define mapFormat DENG_PLUGIN_GLOBAL(mapFormat) #define map DENG_PLUGIN_GLOBAL(map) @@ -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) { @@ -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]; @@ -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]; @@ -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]; diff --git a/doomsday/plugins/wadmapconverter/src/id1map_load.cpp b/doomsday/plugins/wadmapconverter/src/id1map_load.cpp index d26bb91d0a..c15a6761f5 100644 --- a/doomsday/plugins/wadmapconverter/src/id1map_load.cpp +++ b/doomsday/plugins/wadmapconverter/src/id1map_load.cpp @@ -22,6 +22,7 @@ */ #include "wadmapconverter.h" +#include #define mapFormat DENG_PLUGIN_GLOBAL(mapFormat) #define map DENG_PLUGIN_GLOBAL(map) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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..."); @@ -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; @@ -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)); diff --git a/doomsday/plugins/wadmapconverter/wadmapconverter.pro b/doomsday/plugins/wadmapconverter/wadmapconverter.pro index 6e237c31a9..560986ccb3 100644 --- a/doomsday/plugins/wadmapconverter/wadmapconverter.pro +++ b/doomsday/plugins/wadmapconverter/wadmapconverter.pro @@ -2,6 +2,9 @@ # Copyright (c) 2011-2012 Jaakko Keränen # Copyright (c) 2011-2012 Daniel Swanson +# This plugin uses the full libdeng2 C++ API. +CONFIG += dengplugin_libdeng2_full + include(../config_plugin.pri) TEMPLATE = lib