From 351f897d2cb00e47970425647005590245791934 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 19 Mar 2022 14:42:10 +0000 Subject: [PATCH] SAGA2: Remove Some Undefined Macro Compiler Warnings Previously some of the Dinotopia specific code for cursor cycling was hidden behind macros, resulting in some bitrot to the code. This has been migrated to being more live by removing the macros. This prevents various GCC warnings when -Wundef is passed. --- engines/saga2/grabinfo.cpp | 31 +++++++++++++------------------ engines/saga2/panel.cpp | 5 ++--- engines/saga2/panel.h | 5 ----- engines/saga2/tile.h | 2 +- 4 files changed, 16 insertions(+), 27 deletions(-) diff --git a/engines/saga2/grabinfo.cpp b/engines/saga2/grabinfo.cpp index 6a579ec56e7..53a71a95d0f 100644 --- a/engines/saga2/grabinfo.cpp +++ b/engines/saga2/grabinfo.cpp @@ -349,42 +349,37 @@ void GrabInfo::clearGauge() { if (grabObj == nullptr) clearMouseGauge(); } -#if CURSOR_CYCLING - -extern bool eyeEnabled; -extern bool walkEnabled; - +// FIXME: This code is specific to Dinotopia. Was disabled for some time and needs updating void cycleCursor() { - - if (! g_vm->_mouseInfo.cursorCyclingEnabled) +#if 0 + if (! g_vm->_mouseInfo->cursorCyclingEnabled) // FIXME: cursorCyclingEnabled not present in GrabInfo return; - uint8 curIntent; - curIntent = g_vm->_mouseInfo.getIntent(); + uint8 curIntent = g_vm->_mouseInfo->getIntent(); if (++curIntent == GrabInfo::IntentCounts) - g_vm->_mouseInfo.setIntent(1); //Set Cursor First State Skip None + g_vm->_mouseInfo->setIntent(1); //Set Cursor First State Skip None else { - if (!walkEnabled && curIntent == GrabInfo::WalkTo) + if (!walkEnabled && curIntent == GrabInfo::WalkTo) // FIXME: walkEnabled not present ++curIntent; - if (curIntent == GrabInfo::PickUp && g_vm->_mouseInfo.getObject() != nullptr) + if (curIntent == GrabInfo::PickUp && g_vm->_mouseInfo->getObject() != nullptr) ++curIntent; - if (curIntent == GrabInfo::Drop && g_vm->_mouseInfo.getObject() == nullptr) + if (curIntent == GrabInfo::Drop && g_vm->_mouseInfo->getObject() == nullptr) ++curIntent; - if (!eyeEnabled && curIntent == GrabInfo::LookAt) + if (!eyeEnabled && curIntent == GrabInfo::LookAt) // FIXME: eyeEnabled not present ++curIntent; if (curIntent == GrabInfo::Navigate) { if (walkEnabled) curIntent = 1; //Set Cursor First State Skip None else { curIntent = 2; - if (curIntent == GrabInfo::PickUp && g_vm->_mouseInfo.getObject() != nullptr) + if (curIntent == GrabInfo::PickUp && g_vm->_mouseInfo->getObject() != nullptr) ++curIntent; } } - g_vm->_mouseInfo.setIntent(curIntent); //Set Cursor To Next State - } -} + g_vm->_mouseInfo->setIntent(curIntent); //Set Cursor To Next State + } #endif +} } // end of namespace Saga2 diff --git a/engines/saga2/panel.cpp b/engines/saga2/panel.cpp index 6b15b1a9ef8..78670245a13 100644 --- a/engines/saga2/panel.cpp +++ b/engines/saga2/panel.cpp @@ -27,6 +27,7 @@ #include "saga2/saga2.h" #include "saga2/panel.h" +#include "saga2/detection.h" #include "saga2/fontlib.h" #include "saga2/floating.h" #include "saga2/display.h" @@ -775,12 +776,10 @@ void gToolBase::handleMouse(Common::Event &event, uint32 time) { if (lockUINest > 0) return; -#if CURSOR_CYCLING - if (_curMouseState.right) { + if (g_vm->getGameId() == GID_DINO && _curMouseState.right) { cycleCursor(); return; } -#endif // Code for "Tool tip delay" if (prevState.pos != _curMouseState.pos diff --git a/engines/saga2/panel.h b/engines/saga2/panel.h index 9bef1dd54a4..0e18f8935c1 100644 --- a/engines/saga2/panel.h +++ b/engines/saga2/panel.h @@ -46,12 +46,7 @@ namespace Saga2 { Cursor Cycling Stuff * ===================================================================== */ -#if DINO -#define CURSOR_CYCLING 1 -#endif -#if CURSOR_CYCLING void cycleCursor(); -#endif /* ===================================================================== * Forward declarations diff --git a/engines/saga2/tile.h b/engines/saga2/tile.h index d6c2a85c23b..5d50213e7e8 100644 --- a/engines/saga2/tile.h +++ b/engines/saga2/tile.h @@ -724,7 +724,7 @@ enum platformFlags { plCutVNeg = (1 << 13) }; -#if OLDPLATFLAAGS +#ifdef OLDPLATFLAAGS enum platformFlags { plCutaway = (1 << 0), // remove when player underneath