TETRAEDGE: Fix Undefined Symbol GCC Compiler Warnings

These are emitted if -Wundef is passed to GCC.

This commit also modifies the generic naming of these symbols to add
the engine name as a prefix i.e. DEBUG_PATH could be set in the build
environment for other reasons, TETRAEDGE_DEBUG_PATH is clearer and
avoids odd side effects.
This commit is contained in:
D G Turner 2023-01-18 02:05:15 +00:00
parent 933e62f03c
commit 98b06f1ed6
7 changed files with 33 additions and 33 deletions

View File

@ -40,7 +40,7 @@
#include "tetraedge/te/te_input_mgr.h"
#include "tetraedge/te/te_sound_manager.h"
//#define DUMP_LAYOUTS 1
//#define TETRAEDGE_DUMP_LAYOUTS
namespace Tetraedge {
@ -403,7 +403,7 @@ void Application::drawFront() {
g_engine->getRenderer()->loadIdentityMatrix();
}
#if DUMP_LAYOUTS
#ifdef TETRAEDGE_DUMP_LAYOUTS
static int renderCount = 0;
static void dumpLayout(TeLayout *layout, Common::String indent = "++") {
assert(layout);
@ -459,7 +459,7 @@ void Application::performRender() {
game->scene().drawPath();
g_system->updateScreen();
#if DUMP_LAYOUTS
#ifdef TETRAEDGE_DUMP_LAYOUTS
renderCount++;
if (renderCount % 100 == 0) {
debug("\n--------------------\nFrame %d back layout: ", renderCount);

View File

@ -1123,7 +1123,7 @@ bool Game::onMouseClick(const Common::Point &pt) {
return false;
}
#if ENABLE_CUSTOM_CURSOR_CHECKS
#ifdef TETRAEDGE_ENABLE_CUSTOM_CURSOR_CHECKS
// Note: None of these cursor files seem to be actually shipped with the game
// but the logic is reproduced here just in case there's some different
// version that uses them.
@ -1169,7 +1169,7 @@ bool Game::onMouseMove() {
//
// So maybe all this is useless?
#if ENABLE_CUSTOM_CURSOR_CHECKS
#ifdef TETRAEDGE_ENABLE_CUSTOM_CURSOR_CHECKS
TeVector2s32 mouseLoc = g_engine->getInputMgr()->lastMousePos();
bool skipFullSearch = false;
@ -1212,7 +1212,7 @@ bool Game::onMouseMove() {
if (!checkedCursor)
app->mouseCursorLayout().load(DEFAULT_CURSOR);
#endif // ENABLE_CUSTOM_CURSOR_CHECKS
#endif
return false;
}

View File

@ -42,8 +42,8 @@
#include "tetraedge/te/te_lua_script.h"
#include "tetraedge/te/te_lua_thread.h"
//#define DEBUG_PATHFINDING 1
//#define DEBUG_LIGHTS 1
//#define TETRAEDGE_DEBUG_PATHFINDING
//#define TETRAEDGE_DEBUG_LIGHTS
namespace Tetraedge {
@ -350,7 +350,7 @@ void InGameScene::draw() {
currentCamera()->apply();
#if DEBUG_PATHFINDING
#ifdef TETRAEDGE_DEBUG_PATHFINDING
if (_character && _character->curve()) {
_character->curve()->setVisible(true);
_character->curve()->draw();
@ -707,7 +707,7 @@ bool InGameScene::loadLights(const Common::Path &path) {
_lights[i]->enable(i);
}
#if DEBUG_LIGHTS
#ifdef TETRAEDGE_DEBUG_LIGHTS
debug("--- Scene lights ---");
debug("Shadow: %s no:%d far:%.02f near:%.02f fov:%.02f", _shadowColor.dump().c_str(), _shadowLightNo, _shadowFarPlane, _shadowNearPlane, _shadowFov);
debug("Global: %s", TeLight::globalAmbient().dump().c_str());

View File

@ -495,25 +495,25 @@ bool Inventory::updateLayout() {
return false;
}
//#define DEBUG_SAVELOAD 1
//#define TETRAEDGE_DEBUG_SAVELOAD
Common::Error Inventory::syncState(Common::Serializer &s) {
uint nitems = _invObjects.size();
s.syncAsUint32LE(nitems);
if (s.isLoading()) {
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_DEBUG_SAVELOAD
debug("Inventory::syncState: --- Loading %d inventory items: ---", nitems);
#endif
for (uint i = 0; i < nitems; i++) {
Common::String objname;
s.syncString(objname);
addObject(objname);
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_DEBUG_SAVELOAD
debug("Inventory::syncState: %s", objname.c_str());
#endif
}
} else if (nitems) {
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_DEBUG_SAVELOAD
debug("Inventory::syncState: --- Saving %d inventory items: --- ", _invObjects.size());
#endif
// Add items in reverse order as the "addObject" on load will
@ -523,13 +523,13 @@ Common::Error Inventory::syncState(Common::Serializer &s) {
iter--;
Common::String objname = (*iter)->name();
s.syncString(objname);
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_DEBUG_SAVELOAD
debug("Inventory::syncState: %s", objname.c_str());
#endif
}
}
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_DEBUG_SAVELOAD
debug("Inventory::syncState: -------- end --------");
#endif
return Common::kNoError;

View File

@ -128,7 +128,7 @@ enum TeLuaSaveVarType {
String = 4
};
#define DEBUG_SAVELOAD 1
#define TETRAEDGE_LUA_DEBUG_SAVELOAD
Common::Error TeLuaContext::syncState(Common::Serializer &s) {
// Save/Load globals. The format of saving is:
@ -136,7 +136,7 @@ Common::Error TeLuaContext::syncState(Common::Serializer &s) {
// Vals can be string, number (uint32), or boolean (byte)
// The type of "None" (0) is the end of the list (and has no name/val).
if (s.isSaving()) {
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_LUA_DEBUG_SAVELOAD
debug("TeLuaContext::syncState: --- Saving globals: ---");
#endif
lua_pushvalue(_luaState, LUA_GLOBALSINDEX);
@ -157,7 +157,7 @@ Common::Error TeLuaContext::syncState(Common::Serializer &s) {
s.syncString(name);
bool val = lua_toboolean(_luaState, -1);
s.syncAsByte(val);
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_LUA_DEBUG_SAVELOAD
debug("TeLuaContext::syncState: bool %s = %s", name.c_str(), val ? "true" : "false");
#endif
} else if (vtype == LUA_TNUMBER) {
@ -166,7 +166,7 @@ Common::Error TeLuaContext::syncState(Common::Serializer &s) {
s.syncString(name);
double val = lua_tonumber(_luaState, -1);
s.syncAsDoubleLE(val);
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_LUA_DEBUG_SAVELOAD
debug("TeLuaContext::syncState: num %s = %f", name.c_str(), val);
#endif
} else if (vtype == LUA_TSTRING) {
@ -175,7 +175,7 @@ Common::Error TeLuaContext::syncState(Common::Serializer &s) {
s.syncString(name);
Common::String val = lua_tostring(_luaState, -1);
s.syncString(val);
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_LUA_DEBUG_SAVELOAD
debug("TeLuaContext::syncState: str %s = '%s'", name.c_str(), val.c_str());
#endif
}
@ -183,7 +183,7 @@ Common::Error TeLuaContext::syncState(Common::Serializer &s) {
nextresult = lua_next(_luaState, -2);
}
} else {
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_LUA_DEBUG_SAVELOAD
debug("TeLuaContext::syncState: --- Loading globals: --- ");
#endif
// loading
@ -197,7 +197,7 @@ Common::Error TeLuaContext::syncState(Common::Serializer &s) {
byte b = 0;
s.syncAsByte(b);
lua_pushboolean(_luaState, b);
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_LUA_DEBUG_SAVELOAD
debug("TeLuaContext::syncState: bool %s = %s", name.c_str(), b ? "true" : "false");
#endif
break;
@ -206,7 +206,7 @@ Common::Error TeLuaContext::syncState(Common::Serializer &s) {
float d = 0;
s.syncAsDoubleLE(d);
lua_pushnumber(_luaState, d);
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_LUA_DEBUG_SAVELOAD
debug("TeLuaContext::syncState: num %s = %f", name.c_str(), d);
#endif
break;
@ -215,7 +215,7 @@ Common::Error TeLuaContext::syncState(Common::Serializer &s) {
Common::String str;
s.syncString(str);
lua_pushstring(_luaState, str.c_str());
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_LUA_DEBUG_SAVELOAD
debug("TeLuaContext::syncState: str %s = '%s'", name.c_str(), str.c_str());
#endif
break;
@ -228,7 +228,7 @@ Common::Error TeLuaContext::syncState(Common::Serializer &s) {
}
}
#if DEBUG_SAVELOAD
#ifdef TETRAEDGE_LUA_DEBUG_SAVELOAD
debug("TeLuaContext::syncState: -------- end --------");
#endif

View File

@ -19,9 +19,9 @@
*
*/
//#define DUMP_RENDERED_FONTS 1
//#define TETRAEDGE_DUMP_RENDERED_FONTS
#ifdef DUMP_RENDERED_FONTS
#ifdef TETRAEDGE_DUMP_RENDERED_FONTS
#include "image/png.h"
#endif
@ -41,7 +41,7 @@ TeTextBase2::~TeTextBase2() {
delete _mesh;
}
#ifdef DUMP_RENDERED_FONTS
#ifdef TETRAEDGE_DUMP_RENDERED_FONTS
static int dumpCount = 0;
#endif
@ -107,7 +107,7 @@ void TeTextBase2::build() {
TeIntrusivePtr<Te3DTexture> texture = Te3DTexture::makeInstance();
texture->load(img);
#if DUMP_RENDERED_FONTS
#ifdef TETRAEDGE_DUMP_RENDERED_FONTS
Common::DumpFile dumpFile;
dumpFile.open(Common::String::format("/tmp/rendered-font-dump-%04d.png", dumpCount));
dumpCount++;

View File

@ -25,9 +25,9 @@
#include "tetraedge/te/te_frame_anim.h"
#include "tetraedge/te/te_resource_manager.h"
//#define DUMP_LOADED_IMAGES 1
//#define TETRAEDGE_DUMP_LOADED_IMAGES
#ifdef DUMP_LOADED_IMAGES
#ifdef TETRAEDGE_DUMP_LOADED_IMAGES
#include "image/png.h"
#endif
@ -106,7 +106,7 @@ bool TeTiledSurface::load(const Common::Path &path) {
img.createImg(_codec->width(), _codec->height(), nullpal, _imgFormat, bufx, bufy);
if (_codec->update(0, img)) {
#if DUMP_LOADED_IMAGES
#ifdef TETRAEDGE_DUMP_LOADED_IMAGES
static int dumpCount = 0;
Common::DumpFile dumpFile;
dumpFile.open(Common::String::format("/tmp/dump-tiledsurf-%s-%04d.png", name().c_str(), dumpCount));