[Scummvm-git-logs] scummvm master -> 990f48c5f716ba5e84ee32757d4b724149c2ded1
mgerhardy
noreply at scummvm.org
Mon Oct 7 09:46:23 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
990f48c5f7 TWINE: merged debug states into one class
Commit: 990f48c5f716ba5e84ee32757d4b724149c2ded1
https://github.com/scummvm/scummvm/commit/990f48c5f716ba5e84ee32757d4b724149c2ded1
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-07T11:45:39+02:00
Commit Message:
TWINE: merged debug states into one class
Changed paths:
A engines/twine/debugger/debug_state.cpp
A engines/twine/debugger/debug_state.h
R engines/twine/debugger/debug.cpp
R engines/twine/debugger/debug.h
R engines/twine/debugger/debug_grid.cpp
R engines/twine/debugger/debug_grid.h
R engines/twine/debugger/debug_scene.cpp
R engines/twine/debugger/debug_scene.h
engines/twine/debugger/console.cpp
engines/twine/debugger/console.h
engines/twine/debugger/debugtools.cpp
engines/twine/input.cpp
engines/twine/input.h
engines/twine/metaengine.cpp
engines/twine/module.mk
engines/twine/renderer/redraw.cpp
engines/twine/scene/actor.cpp
engines/twine/scene/animations.cpp
engines/twine/scene/collision.cpp
engines/twine/scene/grid.cpp
engines/twine/scene/scene.cpp
engines/twine/script/script_life.cpp
engines/twine/twine.cpp
engines/twine/twine.h
diff --git a/engines/twine/debugger/console.cpp b/engines/twine/debugger/console.cpp
index 5146bbecb6d..511af2ee3c9 100644
--- a/engines/twine/debugger/console.cpp
+++ b/engines/twine/debugger/console.cpp
@@ -22,8 +22,7 @@
#include "twine/debugger/console.h"
#include "common/scummsys.h"
#include "common/util.h"
-#include "twine/debugger/debug_grid.h"
-#include "twine/debugger/debug_scene.h"
+#include "twine/debugger/debug_state.h"
#include "twine/holomap.h"
#include "twine/renderer/redraw.h"
#include "twine/resources/hqr.h"
@@ -50,8 +49,6 @@ TwinEConsole::TwinEConsole(TwinEEngine *engine) : _engine(engine), GUI::Debugger
registerCmd("toggle_scenery_view", WRAP_METHOD(TwinEConsole, doToggleSceneryView));
registerCmd("magic_points", WRAP_METHOD(TwinEConsole, doAddMagicPoints));
registerCmd("dumpfile", WRAP_METHOD(TwinEConsole, doDumpFile));
- registerCmd("list_menutext", WRAP_METHOD(TwinEConsole, doListMenuText));
- registerCmd("toggle_debug", WRAP_METHOD(TwinEConsole, doToggleDebug));
registerCmd("toggle_darkpal", WRAP_METHOD(TwinEConsole, doToggleDarkPal));
registerCmd("toggle_zones", WRAP_METHOD(TwinEConsole, doToggleZoneRendering));
registerCmd("toggle_tracks", WRAP_METHOD(TwinEConsole, doToggleTrackRendering));
@@ -95,28 +92,25 @@ void TwinEConsole::postEnter() {
} else { \
debugPrintf("Enabling " description); \
(var) = true; \
- } \
- if ((var) && !_engine->_cfgfile.Debug) { \
- doToggleDebug(0, nullptr); \
}
bool TwinEConsole::doToggleZoneRendering(int argc, const char **argv) {
- TOGGLE_DEBUG(_engine->_debugScene->_showingZones, "zone rendering\n")
+ TOGGLE_DEBUG(_engine->_debugState->_showingZones, "zone rendering\n")
return true;
}
bool TwinEConsole::doToggleActorRendering(int argc, const char **argv) {
- TOGGLE_DEBUG(_engine->_debugScene->_showingActors, "actor rendering\n")
+ TOGGLE_DEBUG(_engine->_debugState->_showingActors, "actor rendering\n")
return true;
}
bool TwinEConsole::doToggleTrackRendering(int argc, const char **argv) {
- TOGGLE_DEBUG(_engine->_debugScene->_showingTracks, "tracks rendering\n")
+ TOGGLE_DEBUG(_engine->_debugState->_showingTracks, "tracks rendering\n")
return true;
}
bool TwinEConsole::doToggleGodMode(int argc, const char **argv) {
- TOGGLE_DEBUG(_engine->_debugScene->_godMode, "god mode\n")
+ TOGGLE_DEBUG(_engine->_debugState->_godMode, "god mode\n")
return true;
}
@@ -126,7 +120,7 @@ bool TwinEConsole::doToggleEnhancements(int argc, const char **argv) {
}
bool TwinEConsole::doToggleClipRendering(int argc, const char **argv) {
- TOGGLE_DEBUG(_engine->_debugScene->_showingClips, "clip rendering\n")
+ TOGGLE_DEBUG(_engine->_debugState->_showingClips, "clip rendering\n")
return true;
}
@@ -158,12 +152,12 @@ bool TwinEConsole::doSkipSceneActorsBut(int argc, const char **argv) {
}
const int16 actorIdx = atoi(argv[1]);
debugPrintf("Only load actor %d in the next scene\n", actorIdx);
- _engine->_debugScene->_onlyLoadActor = actorIdx;
+ _engine->_debugState->_onlyLoadActor = actorIdx;
return true;
}
bool TwinEConsole::doToggleFreeCamera(int argc, const char **argv) {
- TOGGLE_DEBUG(_engine->_debugGrid->_useFreeCamera, "free camera movement\n")
+ TOGGLE_DEBUG(_engine->_debugState->_useFreeCamera, "free camera movement\n")
return true;
}
@@ -180,7 +174,7 @@ bool TwinEConsole::doSetTrackObject(int argc, const char **argv) {
}
bool TwinEConsole::doToggleSceneRendering(int argc, const char **argv) {
- TOGGLE_DEBUG(_engine->_debugGrid->_disableGridRendering, "scene rendering\n")
+ TOGGLE_DEBUG(_engine->_debugState->_disableGridRendering, "scene rendering\n")
return true;
}
@@ -334,34 +328,6 @@ bool TwinEConsole::doToggleDarkPal(int argc, const char **argv) {
return true;
}
-bool TwinEConsole::doToggleDebug(int argc, const char **argv) {
- if (_engine->_cfgfile.Debug) {
- debugPrintf("Disabling debug mode\n");
- _engine->_cfgfile.Debug = false;
- } else {
- debugPrintf("Enabling debug mode\n");
- _engine->_cfgfile.Debug = true;
- }
- return true;
-}
-
-bool TwinEConsole::doListMenuText(int argc, const char **argv) {
- TextBankId textBankId = TextBankId::Inventory_Intro_and_Holomap;
- if (argc >= 2) {
- textBankId = (TextBankId)atoi(argv[1]);
- }
- const TextBankId oldTextBankId = _engine->_text->textBank();
- _engine->_text->initDial(textBankId);
- for (int32 i = 0; i < 1000; ++i) {
- char buf[256];
- if (_engine->_text->getMenuText((TextId)i, buf, sizeof(buf))) {
- debugPrintf("%4i: %s\n", i, buf);
- }
- }
- _engine->_text->initDial(oldTextBankId);
- return true;
-}
-
bool TwinEConsole::doSetHeroPosition(int argc, const char **argv) {
IVec3 &pos = _engine->_scene->_sceneHero->_posObj;
if (argc < 4) {
diff --git a/engines/twine/debugger/console.h b/engines/twine/debugger/console.h
index af1ade8d7a8..e54ed4a60e5 100644
--- a/engines/twine/debugger/console.h
+++ b/engines/twine/debugger/console.h
@@ -46,8 +46,6 @@ private:
bool doSetLife(int argc, const char **argv);
bool doGiveAllItems(int argc, const char **argv);
bool doChangeScene(int argc, const char **argv);
- bool doListMenuText(int argc, const char **argv);
- bool doToggleDebug(int argc, const char **argv);
bool doToggleDarkPal(int argc, const char **argv);
bool doToggleAutoAggressive(int argc, const char **argv);
bool doGiveKey(int argc, const char **argv);
diff --git a/engines/twine/debugger/debug.cpp b/engines/twine/debugger/debug.cpp
deleted file mode 100644
index 21f927c2ef1..00000000000
--- a/engines/twine/debugger/debug.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "twine/debugger/debug.h"
-#include "twine/debugger/debug_grid.h"
-#include "twine/twine.h"
-
-namespace TwinE {
-
-void Debug::processDebug() {
- _engine->_debugGrid->changeGridCamera();
- _engine->_debugGrid->applyCellingGrid();
-}
-
-} // namespace TwinE
diff --git a/engines/twine/debugger/debug.h b/engines/twine/debugger/debug.h
deleted file mode 100644
index 82828b51a98..00000000000
--- a/engines/twine/debugger/debug.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef TWINE_DEBUG_H
-#define TWINE_DEBUG_H
-
-#include "common/scummsys.h"
-#include "common/rect.h"
-
-namespace TwinE {
-
-class TwinEEngine;
-
-class Debug {
-private:
- TwinEEngine *_engine;
-
-public:
- Debug(TwinEEngine *engine) : _engine(engine) {}
- void processDebug();
-};
-
-} // namespace TwinE
-
-#endif
diff --git a/engines/twine/debugger/debug_grid.cpp b/engines/twine/debugger/debug_grid.cpp
deleted file mode 100644
index c0a382c2729..00000000000
--- a/engines/twine/debugger/debug_grid.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "twine/debugger/debug_grid.h"
-#include "common/debug.h"
-#include "twine/scene/grid.h"
-#include "twine/input.h"
-#include "twine/renderer/redraw.h"
-#include "twine/scene/scene.h"
-#include "twine/twine.h"
-
-namespace TwinE {
-
-DebugGrid::DebugGrid(TwinEEngine *engine) : _engine(engine) {
-}
-
-void DebugGrid::changeGridCamera() {
- if (!_useFreeCamera) {
- return;
- }
-
- Grid *grid = _engine->_grid;
- Redraw *redraw = _engine->_redraw;
- Input *input = _engine->_input;
- if (input->isActionActive(TwinEActionType::DebugGridCameraPressUp)) {
- grid->_newCamera.z--;
- redraw->_firstTime = true;
- } else if (input->isActionActive(TwinEActionType::DebugGridCameraPressDown)) {
- grid->_newCamera.z++;
- redraw->_firstTime = true;
- }
- if (input->isActionActive(TwinEActionType::DebugGridCameraPressLeft)) {
- grid->_newCamera.x--;
- redraw->_firstTime = true;
- } else if (input->isActionActive(TwinEActionType::DebugGridCameraPressRight)) {
- grid->_newCamera.x++;
- redraw->_firstTime = true;
- }
-}
-
-void DebugGrid::applyCellingGrid() {
- Grid *grid = _engine->_grid;
- Input *input = _engine->_input;
- // Increase celling grid index
- if (input->toggleActionIfActive(TwinEActionType::IncreaseCellingGridIndex)) {
- grid->_cellingGridIdx++;
- if (grid->_cellingGridIdx > 133) {
- grid->_cellingGridIdx = 133;
- }
- }
- // Decrease celling grid index
- else if (input->toggleActionIfActive(TwinEActionType::DecreaseCellingGridIndex)) {
- grid->_cellingGridIdx--;
- if (grid->_cellingGridIdx < 0) {
- grid->_cellingGridIdx = 0;
- }
- }
- // Enable/disable celling grid
- else if (input->toggleActionIfActive(TwinEActionType::ApplyCellingGrid)) {
- if (grid->_useCellingGrid == -1) {
- grid->_useCellingGrid = 1;
- //grid->createGridMap();
- grid->initCellingGrid(grid->_cellingGridIdx);
- debug("Enable Celling Grid index: %d", grid->_cellingGridIdx);
- _engine->_scene->_needChangeScene = SCENE_CEILING_GRID_FADE_2; // tricky to make the fade
- } else if (grid->_useCellingGrid == 1) {
- grid->_useCellingGrid = -1;
- grid->copyMapToCube();
- _engine->_redraw->_firstTime = true;
- debug("Disable Celling Grid index: %d", grid->_cellingGridIdx);
- _engine->_scene->_needChangeScene = SCENE_CEILING_GRID_FADE_2; // tricky to make the fade
- }
- }
-}
-
-} // namespace TwinE
diff --git a/engines/twine/debugger/debug_grid.h b/engines/twine/debugger/debug_grid.h
deleted file mode 100644
index 44bf6e4fe3b..00000000000
--- a/engines/twine/debugger/debug_grid.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef TWINE_GRIDDEBUG_H
-#define TWINE_GRIDDEBUG_H
-
-#include "common/scummsys.h"
-
-namespace TwinE {
-
-class TwinEEngine;
-
-class DebugGrid {
-private:
- TwinEEngine *_engine;
-
-public:
- DebugGrid(TwinEEngine *engine);
-
- bool _useFreeCamera = false;
- bool _disableGridRendering = false;
-
- /** Change scenario camera positions */
- void changeGridCamera();
- /** Apply and change disappear celling grid */
- void applyCellingGrid();
-};
-
-} // namespace TwinE
-
-#endif
diff --git a/engines/twine/debugger/debug_scene.cpp b/engines/twine/debugger/debug_state.cpp
similarity index 88%
rename from engines/twine/debugger/debug_scene.cpp
rename to engines/twine/debugger/debug_state.cpp
index 9ff6d9ed103..b339bd13efa 100644
--- a/engines/twine/debugger/debug_scene.cpp
+++ b/engines/twine/debugger/debug_state.cpp
@@ -19,7 +19,7 @@
*
*/
-#include "twine/debugger/debug_scene.h"
+#include "twine/debugger/debug_state.h"
#include "twine/menu/interface.h"
#include "twine/menu/menu.h"
#include "twine/renderer/redraw.h"
@@ -31,24 +31,28 @@
namespace TwinE {
-DebugScene::DebugScene(TwinEEngine *engine) : _engine(engine) {}
+DebugState::DebugState(TwinEEngine *engine) : _engine(engine) {}
-void DebugScene::drawClip(const Common::Rect &rect) {
+void DebugState::update() {
+ changeGridCamera();
+}
+
+void DebugState::drawClip(const Common::Rect &rect) {
if (!_showingClips) {
return;
}
_engine->_menu->drawRectBorders(rect);
}
-void DebugScene::projectBoundingBoxPoints(IVec3 *pPoint3d, IVec3 *pPoint3dProjected) {
+void DebugState::projectBoundingBoxPoints(IVec3 *pPoint3d, IVec3 *pPoint3dProjected) {
*pPoint3dProjected = _engine->_renderer->projectPoint(*pPoint3d);
}
-bool DebugScene::checkZoneType(ZoneType type) const {
+bool DebugState::checkZoneType(ZoneType type) const {
return (_typeZones & (1u << (uint32)type)) != 0u;
}
-DebugScene::ScenePositionsProjected DebugScene::calculateBoxPositions(const IVec3 &mins, const IVec3 &maxs) {
+DebugState::ScenePositionsProjected DebugState::calculateBoxPositions(const IVec3 &mins, const IVec3 &maxs) {
ScenePositionsProjected positions;
// compute the points in 3D
positions.frontBottomLeftPoint.x = mins.x - _engine->_grid->_worldCube.x;
@@ -92,7 +96,7 @@ DebugScene::ScenePositionsProjected DebugScene::calculateBoxPositions(const IVec
return positions;
}
-bool DebugScene::drawBox(const ScenePositionsProjected &positions, uint8 color) {
+bool DebugState::drawBox(const ScenePositionsProjected &positions, uint8 color) {
bool state = false;
// draw front part
state |= _engine->_interface->drawLine(positions.frontBottomLeftPoint2D.x, positions.frontBottomLeftPoint2D.y, positions.frontTopLeftPoint2D.x, positions.frontTopLeftPoint2D.y, color);
@@ -121,7 +125,31 @@ bool DebugScene::drawBox(const ScenePositionsProjected &positions, uint8 color)
return state;
}
-bool DebugScene::displayActors() {
+void DebugState::changeGridCamera() {
+ if (!_useFreeCamera) {
+ return;
+ }
+
+ Grid *grid = _engine->_grid;
+ Redraw *redraw = _engine->_redraw;
+ Input *input = _engine->_input;
+ if (input->isActionActive(TwinEActionType::DebugGridCameraPressUp)) {
+ grid->_newCamera.z--;
+ redraw->_firstTime = true;
+ } else if (input->isActionActive(TwinEActionType::DebugGridCameraPressDown)) {
+ grid->_newCamera.z++;
+ redraw->_firstTime = true;
+ }
+ if (input->isActionActive(TwinEActionType::DebugGridCameraPressLeft)) {
+ grid->_newCamera.x--;
+ redraw->_firstTime = true;
+ } else if (input->isActionActive(TwinEActionType::DebugGridCameraPressRight)) {
+ grid->_newCamera.x++;
+ redraw->_firstTime = true;
+ }
+}
+
+bool DebugState::displayActors() {
bool state = false;
for (int32 a = 0; a < _engine->_scene->_nbObjets; a++) {
const ActorStruct *actorPtr = _engine->_scene->getActor(a);
@@ -151,7 +179,7 @@ bool DebugScene::displayActors() {
}
// TODO: implement the rendering points of all tracks as a dot with the id
-bool DebugScene::displayTracks() {
+bool DebugState::displayTracks() {
#if 0
for (int i = 0; i < _engine->_scene->sceneNumTracks; i++) {
const Vec3 *trackPoint = &_engine->_scene->sceneTracks[i];
@@ -161,7 +189,7 @@ bool DebugScene::displayTracks() {
return false;
}
-bool DebugScene::displayZones() {
+bool DebugState::displayZones() {
bool state = false;
for (int i = 0; i < _engine->_scene->_sceneNumZones; i++) {
const ZoneStruct *zonePtr = &_engine->_scene->_sceneZones[i];
@@ -189,7 +217,7 @@ bool DebugScene::displayZones() {
return state;
}
-void DebugScene::renderDebugView() {
+void DebugState::renderDebugView() {
if (_showingZones) {
displayZones();
}
diff --git a/engines/twine/debugger/debug_scene.h b/engines/twine/debugger/debug_state.h
similarity index 88%
rename from engines/twine/debugger/debug_scene.h
rename to engines/twine/debugger/debug_state.h
index d97442e206c..d7abf952792 100644
--- a/engines/twine/debugger/debug_scene.h
+++ b/engines/twine/debugger/debug_state.h
@@ -25,12 +25,13 @@
#include "common/rect.h"
#include "common/scummsys.h"
#include "twine/shared.h"
+#include <cstdarg>
namespace TwinE {
class TwinEEngine;
-class DebugScene {
+class DebugState {
private:
TwinEEngine *_engine;
@@ -68,8 +69,12 @@ private:
ScenePositionsProjected calculateBoxPositions(const IVec3 &mins, const IVec3 &maxs);
bool drawBox(const ScenePositionsProjected &positions, uint8 color);
+
+ /** Change scenario camera positions */
+ void changeGridCamera();
+
public:
- DebugScene(TwinEEngine *engine);
+ DebugState(TwinEEngine *engine);
bool _showingZones = false;
bool _showingActors = false;
bool _showingTracks = false;
@@ -78,9 +83,14 @@ public:
unsigned int _typeZones = 127; // all zones on as default
int16 _onlyLoadActor = -1;
- void renderDebugView();
+ bool _useFreeCamera = false;
+ bool _disableGridRendering = false;
+ TextBankId _textBankId = TextBankId::Inventory_Intro_and_Holomap;
+ void renderDebugView();
void drawClip(const Common::Rect &rect);
+
+ void update();
};
} // namespace TwinE
diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index ec6e7fb11e3..2188bb3d32b 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -22,10 +22,8 @@
#include "backends/imgui/IconsMaterialSymbols.h"
#include "backends/imgui/imgui.h"
-#include "backends/imgui/imgui_internal.h"
#include "common/util.h"
-#include "twine/debugger/debug_grid.h"
-#include "twine/debugger/debug_scene.h"
+#include "twine/debugger/debug_state.h"
#include "twine/debugger/debugtools.h"
#include "twine/debugger/dt-internal.h"
#include "twine/holomap.h"
@@ -45,6 +43,8 @@ namespace TwinE {
#define HOLOMAP_FLAGS_TITLE "Holomap flags"
#define GAME_FLAGS_TITLE "Game flags"
#define ACTOR_DETAILS_TITLE "Actor"
+#define GRID_TITLE "Grid"
+#define MENU_TEXT_TITLE "Menu texts"
void onImGuiInit() {
ImGuiIO &io = ImGui::GetIO();
@@ -70,17 +70,17 @@ static void mainWindow(int ¤tActor, TwinEEngine *engine) {
ImGui::Text("Scene: %i", scene->_currentSceneIdx);
ImGui::Text("Scene name: %s", gameState->_sceneName);
- if (ImGui::Checkbox("Bounding boxes", &engine->_debugScene->_showingActors)) {
+ if (ImGui::Checkbox("Bounding boxes", &engine->_debugState->_showingActors)) {
engine->_redraw->_firstTime = true;
}
- if (ImGui::Checkbox("Clipping", &engine->_debugScene->_showingClips)) {
+ if (ImGui::Checkbox("Clipping", &engine->_debugState->_showingClips)) {
engine->_redraw->_firstTime = true;
}
- if (ImGui::Checkbox("Zones", &engine->_debugScene->_showingZones)) {
+ if (ImGui::Checkbox("Zones", &engine->_debugState->_showingZones)) {
engine->_redraw->_firstTime = true;
}
- if (engine->_debugScene->_showingZones) {
+ if (engine->_debugState->_showingZones) {
if (ImGui::CollapsingHeader("Zones")) {
static const struct ZonesDesc {
const char *name;
@@ -99,7 +99,7 @@ static void mainWindow(int ¤tActor, TwinEEngine *engine) {
{"Rail", ZoneType::kRail, nullptr}};
for (int i = 0; i < ARRAYSIZE(d); ++i) {
- ImGui::CheckboxFlags(d[i].name, &engine->_debugScene->_typeZones, (1u << (uint32)d[i].type));
+ ImGui::CheckboxFlags(d[i].name, &engine->_debugState->_typeZones, (1u << (uint32)d[i].type));
if (d[i].desc) {
ImGui::SetTooltip(d[i].desc);
}
@@ -202,6 +202,65 @@ static void gameFlags(TwinEEngine *engine) {
ImGui::End();
}
+static void grid(TwinEEngine *engine) {
+ if (ImGui::Begin(GRID_TITLE)) {
+ ImGui::Text("World cube %i %i %i", engine->_grid->_worldCube.x, engine->_grid->_worldCube.y, engine->_grid->_worldCube.z);
+ ImGui::Text("World cube %i %i %i", engine->_grid->_worldCube.x, engine->_grid->_worldCube.y, engine->_grid->_worldCube.z);
+
+ Grid *grid = engine->_grid;
+ // Increase celling grid index
+ if (ImGui::Button(ICON_MS_PLUS_ONE)) {
+ grid->_cellingGridIdx++;
+ if (grid->_cellingGridIdx > 133) {
+ grid->_cellingGridIdx = 133;
+ }
+ }
+ // Decrease celling grid index
+ if (ImGui::Button(ICON_MS_EV_SHADOW_MINUS)) {
+ grid->_cellingGridIdx--;
+ if (grid->_cellingGridIdx < 0) {
+ grid->_cellingGridIdx = 0;
+ }
+ }
+ // Enable/disable celling grid
+ if (ImGui::Button("Apply ceiling grid")) {
+ if (grid->_useCellingGrid == -1) {
+ grid->_useCellingGrid = 1;
+ // grid->createGridMap();
+ grid->initCellingGrid(grid->_cellingGridIdx);
+ debug("Enable Celling Grid index: %d", grid->_cellingGridIdx);
+ engine->_scene->_needChangeScene = SCENE_CEILING_GRID_FADE_2; // tricky to make the fade
+ } else if (grid->_useCellingGrid == 1) {
+ grid->_useCellingGrid = -1;
+ grid->copyMapToCube();
+ engine->_redraw->_firstTime = true;
+ debug("Disable Celling Grid index: %d", grid->_cellingGridIdx);
+ engine->_scene->_needChangeScene = SCENE_CEILING_GRID_FADE_2; // tricky to make the fade
+ }
+ }
+ }
+ ImGui::End();
+}
+
+static void menuTexts(TwinEEngine *engine) {
+ if (ImGui::Begin(MENU_TEXT_TITLE)) {
+ int id = (int)engine->_debugState->_textBankId;
+ if (ImGui::InputInt("Text bank", &id)) {
+ engine->_debugState->_textBankId = (TextBankId)id;
+ }
+ const TextBankId oldTextBankId = engine->_text->textBank();
+ engine->_text->initDial(engine->_debugState->_textBankId);
+ for (int32 i = 0; i < 1000; ++i) {
+ char buf[256];
+ if (engine->_text->getMenuText((TextId)i, buf, sizeof(buf))) {
+ ImGui::Text("%4i: %s\n", i, buf);
+ }
+ }
+ engine->_text->initDial(oldTextBankId);
+ }
+ ImGui::End();
+}
+
static void actorDetails(int actorIdx, TwinEEngine *engine) {
if (ActorStruct *actor = engine->_scene->getActor(actorIdx)) {
if (ImGui::Begin(ACTOR_DETAILS_TITLE)) {
@@ -249,8 +308,8 @@ void onImGuiRender() {
if (ImGui::BeginMainMenuBar()) {
if (ImGui::BeginMenu("Debugger")) {
- ImGui::Checkbox("Free camera", &engine->_debugGrid->_useFreeCamera);
- ImGui::Checkbox("God mode", &engine->_debugScene->_godMode);
+ ImGui::Checkbox("Free camera", &engine->_debugState->_useFreeCamera);
+ ImGui::Checkbox("God mode", &engine->_debugState->_godMode);
if (ImGui::MenuItem("Center actor")) {
ActorStruct *actor = engine->_scene->getActor(OWN_ACTOR_SCENE_INDEX);
@@ -264,6 +323,8 @@ void onImGuiRender() {
mainWindow(currentActor, engine);
gameState(engine);
+ grid(engine);
+ menuTexts(engine);
// TODO: combine them
holomapFlags(engine);
diff --git a/engines/twine/input.cpp b/engines/twine/input.cpp
index a5851e18a3a..3839a3d7e2a 100644
--- a/engines/twine/input.cpp
+++ b/engines/twine/input.cpp
@@ -34,7 +34,7 @@ const char *uiKeyMapId = "uiKeyMap";
const char *cutsceneKeyMapId = "cutsceneKeyMap";
const char *holomapKeyMapId = "holomapKeyMap";
-ScopedKeyMap::ScopedKeyMap(TwinEEngine* engine, const char *id) : _engine(engine) {
+ScopedKeyMap::ScopedKeyMap(TwinEEngine *engine, const char *id) : _engine(engine) {
_changed = _engine->_input->enableAdditionalKeyMap(id, true);
_keymap = id;
}
@@ -114,7 +114,7 @@ void Input::enableKeyMap(const char *id) {
Common::Keymapper *keymapper = g_system->getEventManager()->getKeymapper();
const Common::KeymapArray &keymaps = keymapper->getKeymaps();
for (Common::Keymap *keymap : keymaps) {
- const Common::String& keymapId = keymap->getId();
+ const Common::String &keymapId = keymap->getId();
if (keymapId == mainKeyMapId || keymapId == uiKeyMapId || keymapId == cutsceneKeyMapId || keymapId == holomapKeyMapId) {
keymap->setEnabled(keymapId == id);
}
@@ -124,23 +124,7 @@ void Input::enableKeyMap(const char *id) {
}
void Input::processCustomEngineEventStart(const Common::Event &event) {
- if (!_engine->_cfgfile.Debug) {
- switch (event.customType) {
- case TwinEActionType::DebugGridCameraPressUp:
- case TwinEActionType::DebugGridCameraPressDown:
- case TwinEActionType::DebugGridCameraPressLeft:
- case TwinEActionType::DebugGridCameraPressRight:
- case TwinEActionType::ApplyCellingGrid:
- case TwinEActionType::IncreaseCellingGridIndex:
- case TwinEActionType::DecreaseCellingGridIndex:
- break;
- default:
- _actionStates[event.customType] = 1 + event.kbdRepeat;
- break;
- }
- } else {
- _actionStates[event.customType] = 1 + event.kbdRepeat;
- }
+ _actionStates[event.customType] = 1 + event.kbdRepeat;
debug(3, "twine custom event type start: %i", event.customType);
}
diff --git a/engines/twine/input.h b/engines/twine/input.h
index 1059040451b..3d510dfff86 100644
--- a/engines/twine/input.h
+++ b/engines/twine/input.h
@@ -39,9 +39,6 @@ extern const char *holomapKeyMapId;
enum TwinEActionType {
Pause,
- ApplyCellingGrid,
- IncreaseCellingGridIndex,
- DecreaseCellingGridIndex,
DebugGridCameraPressUp,
DebugGridCameraPressDown,
DebugGridCameraPressLeft,
diff --git a/engines/twine/metaengine.cpp b/engines/twine/metaengine.cpp
index d939e9013e3..cde7ec4b0f8 100644
--- a/engines/twine/metaengine.cpp
+++ b/engines/twine/metaengine.cpp
@@ -222,21 +222,6 @@ Common::KeymapArray TwinEMetaEngine::initKeymaps(const char *target) const {
act->addDefaultInputMapping("p");
gameKeyMap->addAction(act);
- act = new Action("APPLYCELLINGGRID", _("Debug Apply Celling Grid"));
- act->setCustomEngineActionEvent(TwinEActionType::ApplyCellingGrid);
- act->addDefaultInputMapping("t");
- gameKeyMap->addAction(act);
-
- act = new Action("INCREASECELLINGGRIDINDEX", _("Debug Increase Celling Grid Index"));
- act->setCustomEngineActionEvent(TwinEActionType::IncreaseCellingGridIndex);
- act->addDefaultInputMapping("g");
- gameKeyMap->addAction(act);
-
- act = new Action("DECREASECELLINGGRIDINDEX", _("Debug Decrease Celling Grid Index"));
- act->setCustomEngineActionEvent(TwinEActionType::DecreaseCellingGridIndex);
- act->addDefaultInputMapping("b");
- gameKeyMap->addAction(act);
-
act = new Action("DEBUGGRIDCAMERAPRESSUP", _("Debug Grid Camera Up"));
act->setCustomEngineActionEvent(TwinEActionType::DebugGridCameraPressUp);
act->addDefaultInputMapping("s");
diff --git a/engines/twine/module.mk b/engines/twine/module.mk
index ed6b84d0ef7..e4da64ac659 100644
--- a/engines/twine/module.mk
+++ b/engines/twine/module.mk
@@ -5,9 +5,7 @@ MODULE_OBJS := \
audio/sound.o \
\
debugger/console.o \
- debugger/debug.o \
- debugger/debug_grid.o \
- debugger/debug_scene.o \
+ debugger/debug_state.o \
\
menu/interface.o \
menu/menu.o \
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index b34a945ad5e..043561c1c17 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -26,7 +26,7 @@
#include "common/util.h"
#include "graphics/surface.h"
#include "twine/audio/sound.h"
-#include "twine/debugger/debug_scene.h"
+#include "twine/debugger/debug_state.h"
#include "twine/input.h"
#include "twine/menu/interface.h"
#include "twine/menu/menu.h"
@@ -394,7 +394,7 @@ void Redraw::processDrawListShadows(const DrawListStruct &drawCmd) {
addRedrawArea(_engine->_interface->_clip);
- _engine->_debugScene->drawClip(renderRect);
+ _engine->_debugState->drawClip(renderRect);
}
_engine->_interface->unsetClip();
}
@@ -438,7 +438,7 @@ void Redraw::processDrawListActors(const DrawListStruct &drawCmd, bool bgRedraw)
_engine->blitFrontToWork(_engine->_interface->_clip);
}
- _engine->_debugScene->drawClip(_engine->_interface->_clip);
+ _engine->_debugState->drawClip(_engine->_interface->_clip);
}
_engine->_interface->unsetClip();
}
@@ -499,7 +499,7 @@ void Redraw::processDrawListActorSprites(const DrawListStruct &drawCmd, bool bgR
_engine->blitFrontToWork(_engine->_interface->_clip);
}
- _engine->_debugScene->drawClip(renderRect);
+ _engine->_debugState->drawClip(renderRect);
_engine->_interface->unsetClip();
}
}
@@ -909,7 +909,7 @@ void Redraw::redrawEngineActions(bool bgRedraw) { // AffScene
correctZLevels(drawList, drawListPos);
processDrawList(drawList, drawListPos, bgRedraw);
- _engine->_debugScene->renderDebugView();
+ _engine->_debugState->renderDebugView();
renderOverlays();
renderText();
diff --git a/engines/twine/scene/actor.cpp b/engines/twine/scene/actor.cpp
index f1fbe5a1497..40070ff5404 100644
--- a/engines/twine/scene/actor.cpp
+++ b/engines/twine/scene/actor.cpp
@@ -24,7 +24,7 @@
#include "common/system.h"
#include "common/textconsole.h"
#include "twine/audio/sound.h"
-#include "twine/debugger/debug_scene.h"
+#include "twine/debugger/debug_state.h"
#include "twine/parser/entity.h"
#include "twine/renderer/renderer.h"
#include "twine/renderer/screens.h"
@@ -373,7 +373,7 @@ void Actor::hitObj(int32 actorIdx, int32 actorIdxAttacked, int32 hitforce, int32
return;
}
- if (IS_HERO(actorIdxAttacked) && _engine->_debugScene->_godMode) {
+ if (IS_HERO(actorIdxAttacked) && _engine->_debugState->_godMode) {
return;
}
diff --git a/engines/twine/scene/animations.cpp b/engines/twine/scene/animations.cpp
index b6efe38c11d..2bc1592de65 100644
--- a/engines/twine/scene/animations.cpp
+++ b/engines/twine/scene/animations.cpp
@@ -25,7 +25,7 @@
#include "common/stream.h"
#include "common/util.h"
#include "twine/audio/sound.h"
-#include "twine/debugger/debug_scene.h"
+#include "twine/debugger/debug_state.h"
#include "twine/parser/anim.h"
#include "twine/parser/entity.h"
#include "twine/renderer/renderer.h"
diff --git a/engines/twine/scene/collision.cpp b/engines/twine/scene/collision.cpp
index 6f75851ac59..2251ae7662d 100644
--- a/engines/twine/scene/collision.cpp
+++ b/engines/twine/scene/collision.cpp
@@ -23,7 +23,7 @@
#include "common/debug.h"
#include "common/memstream.h"
#include "common/util.h"
-#include "twine/debugger/debug_scene.h"
+#include "twine/debugger/debug_state.h"
#include "twine/renderer/renderer.h"
#include "twine/resources/resources.h"
#include "twine/scene/actor.h"
diff --git a/engines/twine/scene/grid.cpp b/engines/twine/scene/grid.cpp
index 1e02a7a75b0..fa7d9c9ce0d 100644
--- a/engines/twine/scene/grid.cpp
+++ b/engines/twine/scene/grid.cpp
@@ -23,7 +23,7 @@
#include "common/endian.h"
#include "common/memstream.h"
#include "common/textconsole.h"
-#include "twine/debugger/debug_grid.h"
+#include "twine/debugger/debug_state.h"
#include "twine/menu/interface.h"
#include "twine/parser/blocklibrary.h"
#include "twine/renderer/redraw.h"
@@ -67,7 +67,7 @@ void Grid::init(int32 w, int32 h) {
}
void Grid::copyMask(int32 index, int32 x, int32 y, const Graphics::ManagedSurface &buffer) {
- if (_engine->_debugGrid->_disableGridRendering) {
+ if (_engine->_debugState->_disableGridRendering) {
return;
}
uint8 *ptr = _brickMaskTable[index];
@@ -498,7 +498,7 @@ bool Grid::drawSprite(int32 posX, int32 posY, const SpriteData &ptr, int spriteI
// WARNING: Rewrite this function to have better performance
bool Grid::drawBrickSprite(int32 posX, int32 posY, const uint8 *ptr, bool isSprite) {
- if (_engine->_debugGrid->_disableGridRendering) {
+ if (_engine->_debugState->_disableGridRendering) {
return false;
}
if (!_engine->_interface->_clip.isValidRect()) {
@@ -841,7 +841,7 @@ void Grid::centerScreenOnActor() {
if (_engine->_disableScreenRecenter) {
return;
}
- if (_engine->_debugGrid->_useFreeCamera) {
+ if (_engine->_debugState->_useFreeCamera) {
return;
}
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index 246d4742719..e21bb976383 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -26,8 +26,7 @@
#include "common/util.h"
#include "twine/audio/music.h"
#include "twine/audio/sound.h"
-#include "twine/debugger/debug_grid.h"
-#include "twine/debugger/debug_scene.h"
+#include "twine/debugger/debug_state.h"
#include "twine/holomap.h"
#include "twine/renderer/redraw.h"
#include "twine/renderer/renderer.h"
@@ -277,7 +276,7 @@ bool Scene::loadSceneLBA2() {
act->_lifeScript = _currentScene + stream.pos();
stream.skip(act->_lifeScriptSize);
- if (_engine->_debugScene->_onlyLoadActor != -1 && _engine->_debugScene->_onlyLoadActor != cnt) {
+ if (_engine->_debugState->_onlyLoadActor != -1 && _engine->_debugState->_onlyLoadActor != cnt) {
_nbObjets--;
a--;
}
@@ -407,7 +406,7 @@ bool Scene::loadSceneLBA1() {
act->_lifeScript = _currentScene + stream.pos();
stream.skip(act->_lifeScriptSize);
- if (_engine->_debugScene->_onlyLoadActor != -1 && _engine->_debugScene->_onlyLoadActor != cnt) {
+ if (_engine->_debugState->_onlyLoadActor != -1 && _engine->_debugState->_onlyLoadActor != cnt) {
_nbObjets--;
a--;
}
@@ -783,7 +782,7 @@ void Scene::checkZoneSce(int32 actorIdx) {
}
break;
case ZoneType::kCamera:
- if (_currentlyFollowedActor == actorIdx && !_engine->_debugGrid->_useFreeCamera) {
+ if (_currentlyFollowedActor == actorIdx && !_engine->_debugState->_useFreeCamera) {
_engine->_disableScreenRecenter = true;
if (_engine->_grid->_newCamera.x != zone->infoData.CameraView.x || _engine->_grid->_newCamera.y != zone->infoData.CameraView.y || _engine->_grid->_newCamera.z != zone->infoData.CameraView.z) {
_engine->_grid->_newCamera.x = zone->infoData.CameraView.x;
diff --git a/engines/twine/script/script_life.cpp b/engines/twine/script/script_life.cpp
index d9016a08f20..208d8f9b846 100644
--- a/engines/twine/script/script_life.cpp
+++ b/engines/twine/script/script_life.cpp
@@ -22,7 +22,7 @@
#include "twine/script/script_life.h"
#include "common/memstream.h"
#include "common/stream.h"
-#include "twine/debugger/debug_scene.h"
+#include "twine/debugger/debug_state.h"
#include "twine/scene/actor.h"
#include "twine/scene/animations.h"
#include "twine/audio/music.h"
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index c1e0112ba99..dab7402bc92 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -41,9 +41,7 @@
#include "twine/audio/music.h"
#include "twine/audio/sound.h"
#include "twine/debugger/console.h"
-#include "twine/debugger/debug.h"
-#include "twine/debugger/debug_grid.h"
-#include "twine/debugger/debug_scene.h"
+#include "twine/debugger/debug_state.h"
#include "twine/detection.h"
#include "twine/holomap_v1.h"
#include "twine/holomap_v2.h"
@@ -225,10 +223,8 @@ TwinEEngine::TwinEEngine(OSystem *system, Common::Language language, uint32 flag
}
_sound = new Sound(this);
_text = new Text(this);
- _debugGrid = new DebugGrid(this);
_input = new Input(this);
- _debug = new Debug(this);
- _debugScene = new DebugScene(this);
+ _debugState = new DebugState(this);
setDebugger(new TwinEConsole(this));
}
@@ -256,10 +252,8 @@ TwinEEngine::~TwinEEngine() {
delete _holomap;
delete _sound;
delete _text;
- delete _debugGrid;
delete _input;
- delete _debug;
- delete _debugScene;
+ delete _debugState;
}
void TwinEEngine::pushMouseCursorVisible() {
@@ -533,7 +527,6 @@ void TwinEEngine::initConfigurations() {
_cfgfile.Sound = ConfGetBoolOrDefault("sound", true);
_cfgfile.Fps = ConfGetIntOrDefault("fps", DEFAULT_FRAMES_PER_SECOND);
- _cfgfile.Debug = ConfGetBoolOrDefault("debug", false);
_cfgfile.Mouse = ConfGetBoolOrDefault("mouse", true);
_cfgfile.UseAutoSaving = ConfGetBoolOrDefault("useautosaving", false);
@@ -551,7 +544,6 @@ void TwinEEngine::initConfigurations() {
debug(1, "Sound: %s", (_cfgfile.Sound ? "true" : "false"));
debug(1, "Movie: %i", _cfgfile.Movie);
debug(1, "Fps: %i", _cfgfile.Fps);
- debug(1, "Debug: %s", (_cfgfile.Debug ? "true" : "false"));
debug(1, "UseAutoSaving: %s", (_cfgfile.UseAutoSaving ? "true" : "false"));
debug(1, "WallCollision: %s", (_cfgfile.WallCollision ? "true" : "false"));
debug(1, "AutoAggressive: %s", (_actor->_combatAuto ? "true" : "false"));
@@ -887,7 +879,7 @@ bool TwinEEngine::runGameEngine() { // mainLoopInteration
_movements->update();
- _debug->processDebug();
+ _debugState->update();
if (_menuOptions->flagCredits) {
if (isLBA1()) {
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index e710010f907..7fdc4a59356 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -92,8 +92,6 @@ struct ConfigFile {
int32 _languageId = 0;
/** Enable/Disable game dialogues */
bool FlagDisplayText = false;
- /** Flag to display game debug */
- bool Debug = false;
/** Type of music file to be used */
MidiFileType MidiType = MIDIFILE_NONE;
/** Game version */
@@ -145,7 +143,7 @@ class Text;
class DebugGrid;
struct Keyboard;
class Debug;
-class DebugScene;
+class DebugState;
// lba2
class Buggy;
@@ -299,14 +297,12 @@ public:
Holomap *_holomap;
Sound *_sound;
Text *_text;
- DebugGrid *_debugGrid;
Input *_input;
- Debug *_debug;
Buggy *_buggy; // lba2
Dart *_dart; // lba2
Rain *_rain; // lba2
Wagon *_wagon; // lba2
- DebugScene *_debugScene;
+ DebugState *_debugState;
/** Configuration file structure
* Contains all the data used in the engine to configurate the game in particularly ways. */
More information about the Scummvm-git-logs
mailing list