[Scummvm-git-logs] scummvm master -> 418161cb1862707c0225a04ae38ac61bf5f754a5
mgerhardy
noreply at scummvm.org
Mon Oct 7 18:02:06 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c50a0d7694 BACKENDS: added imgui header with helper functions
418161cb18 TWINE: restructed debug windows and allow to edit some character values
Commit: c50a0d769456f0b3083097b25530014e2706f4e6
https://github.com/scummvm/scummvm/commit/c50a0d769456f0b3083097b25530014e2706f4e6
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-07T20:01:37+02:00
Commit Message:
BACKENDS: added imgui header with helper functions
Changed paths:
A backends/imgui/imgui_utils.h
diff --git a/backends/imgui/imgui_utils.h b/backends/imgui/imgui_utils.h
new file mode 100644
index 00000000000..af605841b24
--- /dev/null
+++ b/backends/imgui/imgui_utils.h
@@ -0,0 +1,46 @@
+/* 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 "backends/imgui/IconsMaterialSymbols.h"
+
+#include "backends/imgui/imgui.h"
+
+namespace ImGuiEx {
+
+template<typename INT>
+bool InputInt(const char *label, INT *v, int step = 1, int step_fast = 100, ImGuiInputTextFlags flags = 0) {
+ int tmp = (int)*v;
+ if (ImGui::InputInt(label, &tmp, step, step_fast, flags)) {
+ *v = (INT)tmp;
+ return true;
+ }
+ return false;
+}
+
+void Boolean(bool val) {
+ if (val) {
+ ImGui::Text(ICON_MS_CHECK_BOX);
+ } else {
+ ImGui::Text(ICON_MS_CHECK_BOX_OUTLINE_BLANK);
+ }
+}
+
+} // namespace ImGuiEx
Commit: 418161cb1862707c0225a04ae38ac61bf5f754a5
https://github.com/scummvm/scummvm/commit/418161cb1862707c0225a04ae38ac61bf5f754a5
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-07T20:01:41+02:00
Commit Message:
TWINE: restructed debug windows and allow to edit some character values
Changed paths:
engines/twine/debugger/debug_state.h
engines/twine/debugger/debugtools.cpp
engines/twine/shared.h
diff --git a/engines/twine/debugger/debug_state.h b/engines/twine/debugger/debug_state.h
index d7abf952792..cb17f7b25e0 100644
--- a/engines/twine/debugger/debug_state.h
+++ b/engines/twine/debugger/debug_state.h
@@ -82,6 +82,7 @@ public:
bool _godMode = false;
unsigned int _typeZones = 127; // all zones on as default
int16 _onlyLoadActor = -1;
+ const char *_openPopup = nullptr;
bool _useFreeCamera = false;
bool _disableGridRendering = false;
diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index 2188bb3d32b..fb1466828d0 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -19,9 +19,7 @@
*
*/
-#include "backends/imgui/IconsMaterialSymbols.h"
-
-#include "backends/imgui/imgui.h"
+#include "backends/imgui/imgui_utils.h"
#include "common/util.h"
#include "twine/debugger/debug_state.h"
#include "twine/debugger/debugtools.h"
@@ -36,16 +34,78 @@
#include "twine/shared.h"
#include "twine/twine.h"
+namespace ImGuiEx {
+
+bool InputIVec3(const char *label, TwinE::IVec3 &v, ImGuiInputTextFlags flags = 0) {
+ int tmp[3] = {v.x, v.y, v.z};
+ if (ImGui::InputInt3(label, tmp, flags)) {
+ v.x = tmp[0];
+ v.y = tmp[1];
+ v.z = tmp[2];
+ return true;
+ }
+ return false;
+}
+
+bool InputAngle(const char *label, int32 *v, int step = 1, int step_fast = 100, const char *format = "%.2f", ImGuiInputTextFlags flags = 0) {
+ double tmp = TwinE::AngleToDegree(*v);
+ if (ImGui::InputDouble(label, &tmp, step, step_fast, format, flags)) {
+ *v = TwinE::DegreeToAngle(tmp);
+ return true;
+ }
+ ImGui::SetItemTooltip("Angle: %i", (int)*v);
+ return false;
+}
+
+} // namespace ImGuiEx
+
namespace TwinE {
-#define GAME_STATE_TITLE "Game State"
#define MAIN_WINDOW_TITLE "Debug window"
#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"
+static const char *toString(ShapeType type) {
+ switch (type) {
+ case ShapeType::kNone:
+ return "None";
+ case ShapeType::kSolid:
+ return "Solid";
+ case ShapeType::kStairsTopLeft:
+ return "StairsTopLeft";
+ case ShapeType::kStairsTopRight:
+ return "StairsTopRight";
+ case ShapeType::kStairsBottomLeft:
+ return "StairsBottomLeft";
+ case ShapeType::kStairsBottomRight:
+ return "StairsBottomRight";
+ case ShapeType::kDoubleSideStairsTop1:
+ return "DoubleSideStairsTop1";
+ case ShapeType::kDoubleSideStairsBottom1:
+ return "DoubleSideStairsBottom1";
+ case ShapeType::kDoubleSideStairsLeft1:
+ return "DoubleSideStairsLeft1";
+ case ShapeType::kDoubleSideStairsRight1:
+ return "DoubleSideStairsRight1";
+ case ShapeType::kDoubleSideStairsTop2:
+ return "DoubleSideStairsTop2";
+ case ShapeType::kDoubleSideStairsBottom2:
+ return "DoubleSideStairsBottom2";
+ case ShapeType::kDoubleSideStairsLeft2:
+ return "DoubleSideStairsLeft2";
+ case ShapeType::kDoubleSideStairsRight2:
+ return "DoubleSideStairsRight2";
+ case ShapeType::kFlatBottom1:
+ return "FlatBottom1";
+ case ShapeType::kFlatBottom2:
+ return "FlatBottom2";
+ default:
+ return "Unknown";
+ }
+}
+
void onImGuiInit() {
ImGuiIO &io = ImGui::GetIO();
io.Fonts->AddFontDefault();
@@ -63,82 +123,170 @@ void onImGuiInit() {
_tinyFont = ImGui::addTTFFontFromArchive("FreeSans.ttf", 10.0f, nullptr, nullptr);
}
-static void mainWindow(int ¤tActor, TwinEEngine *engine) {
- if (ImGui::Begin(MAIN_WINDOW_TITLE)) {
- Scene *scene = engine->_scene;
- GameState *gameState = engine->_gameState;
- ImGui::Text("Scene: %i", scene->_currentSceneIdx);
- ImGui::Text("Scene name: %s", gameState->_sceneName);
-
- if (ImGui::Checkbox("Bounding boxes", &engine->_debugState->_showingActors)) {
- engine->_redraw->_firstTime = true;
- }
- if (ImGui::Checkbox("Clipping", &engine->_debugState->_showingClips)) {
- engine->_redraw->_firstTime = true;
- }
- if (ImGui::Checkbox("Zones", &engine->_debugState->_showingZones)) {
- engine->_redraw->_firstTime = true;
+static void holomapFlagsPopup(TwinEEngine *engine) {
+ if (ImGui::BeginPopup(HOLOMAP_FLAGS_TITLE)) {
+ if (ImGui::BeginTable("###holomapflags", 8)) {
+ for (int i = 0; i < engine->numHoloPos(); ++i) {
+ ImGui::TableNextColumn();
+ Common::String id = Common::String::format("[%03d]", i);
+ ImGuiEx::InputInt(id.c_str(), &engine->_gameState->_holomapFlags[i]);
+ }
+ ImGui::EndTable();
}
+ ImGui::EndPopup();
+ }
+}
- if (engine->_debugState->_showingZones) {
- if (ImGui::CollapsingHeader("Zones")) {
- static const struct ZonesDesc {
- const char *name;
- ZoneType type;
- const char *desc;
- } d[] = {
- {"Cube", ZoneType::kCube, "Change to another scene"},
- {"Camera", ZoneType::kCamera, "Binds camera view"},
- {"Sceneric", ZoneType::kSceneric, "For use in Life Script"},
- {"Grid", ZoneType::kGrid, "Set disappearing Grid fragment"},
- {"Object", ZoneType::kObject, "Give bonus"},
- {"Text", ZoneType::kText, "Displays text message"},
- {"Ladder", ZoneType::kLadder, "Hero can climb on it"},
- {"Escalator", ZoneType::kEscalator, nullptr},
- {"Hit", ZoneType::kHit, nullptr},
- {"Rail", ZoneType::kRail, nullptr}};
-
- for (int i = 0; i < ARRAYSIZE(d); ++i) {
- ImGui::CheckboxFlags(d[i].name, &engine->_debugState->_typeZones, (1u << (uint32)d[i].type));
- if (d[i].desc) {
- ImGui::SetTooltip(d[i].desc);
- }
+static void gameFlagsPopup(TwinEEngine *engine) {
+ if (ImGui::BeginPopup(GAME_FLAGS_TITLE)) {
+ ImGui::Text("Chapter %i", engine->_gameState->getChapter());
+ if (ImGui::BeginTable("###gameflags", 8)) {
+ for (int i = 0; i < NUM_GAME_FLAGS; ++i) {
+ ImGui::TableNextColumn();
+ Common::String id = Common::String::format("[%03d]", i);
+ int16 val = engine->_gameState->hasGameFlag(i);
+ if (ImGuiEx::InputInt(id.c_str(), &val)) {
+ engine->_gameState->setGameFlag(i, val);
}
}
+ ImGui::EndTable();
}
+ ImGui::EndPopup();
+ }
+}
- if (ImGui::BeginCombo("Scene", gameState->_sceneName)) {
- for (int i = 0; i < engine->numHoloPos(); ++i) {
- Common::String name = Common::String::format("[%03d] %s", i, engine->_holomap->getLocationName(i));
- if (ImGui::Selectable(name.c_str(), i == engine->_scene->_currentSceneIdx)) {
- scene->_currentSceneIdx = i;
- scene->_needChangeScene = scene->_currentSceneIdx;
- engine->_redraw->_firstTime = true;
- }
+static void menuTextsPopup(TwinEEngine *engine) {
+ if (ImGui::BeginPopup(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);
}
- ImGui::EndCombo();
}
+ engine->_text->initDial(oldTextBankId);
+ ImGui::EndPopup();
+ }
+}
- if (currentActor < 0 || currentActor > engine->_scene->_nbObjets) {
- currentActor = 0;
+static void actorDetailsWindow(int &actorIdx, TwinEEngine *engine) {
+ ActorStruct *actor = engine->_scene->getActor(actorIdx);
+ if (actor == nullptr) {
+ return;
+ }
+ if (ImGui::Begin(ACTOR_DETAILS_TITLE)) {
+ if (actorIdx < 0 || actorIdx > engine->_scene->_nbObjets) {
+ actorIdx = 0;
}
- Common::String currentActorLabel = Common::String::format("Actor %i", currentActor);
+ Common::String currentActorLabel = Common::String::format("Actor %i", actorIdx);
if (ImGui::BeginCombo("Actor", currentActorLabel.c_str())) {
for (int i = 0; i < engine->_scene->_nbObjets; ++i) {
Common::String label = Common::String::format("Actor %i", i);
- const bool selected = i == currentActor;
+ const bool selected = i == actorIdx;
if (ImGui::Selectable(label.c_str(), selected)) {
- currentActor = i;
+ actorIdx = i;
}
}
ImGui::EndCombo();
}
+
+ ImGui::Separator();
+
+ ImGuiEx::InputIVec3("Pos", actor->_posObj);
+ ImGuiEx::InputAngle("Rotation", &actor->_beta);
+ ImGuiEx::InputInt("Speed", &actor->_speed);
+ ImGuiEx::InputInt("Life", &actor->_lifePoint);
+ ImGuiEx::InputInt("Armor", &actor->_armor);
+ ImGuiEx::InputIVec3("Bounding box mins", actor->_boundingBox.mins);
+ ImGuiEx::InputIVec3("Bounding box maxs", actor->_boundingBox.maxs);
+
+ if (ImGui::BeginTable("Properties", 2)) {
+ ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed);
+ ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthFixed);
+ ImGui::TableHeadersRow();
+
+ ImGui::TableNextColumn();
+ ImGui::Text("Followed");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_followedActor);
+ ImGui::TableNextColumn();
+ ImGui::Text("Control mode");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_controlMode);
+ ImGui::TableNextColumn();
+ ImGui::Text("Delay");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_delayInMillis);
+ ImGui::TableNextColumn();
+ ImGui::Text("Strength");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_strengthOfHit);
+ ImGui::TableNextColumn();
+ ImGui::Text("Hit by");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_hitBy);
+ ImGui::TableNextColumn();
+ ImGui::Text("Bonus");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_bonusParameter);
+ ImGui::TableNextColumn();
+ ImGui::Text("Brick shape");
+ ImGui::TableNextColumn();
+ ImGui::Text("%s", toString(actor->brickShape()));
+ ImGui::TableNextColumn();
+ ImGui::Text("Brick causes damage");
+ ImGui::TableNextColumn();
+ ImGuiEx::Boolean(actor->brickCausesDamage());
+ ImGui::TableNextColumn();
+ ImGui::Text("Collision");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_objCol);
+ ImGui::TableNextColumn();
+ ImGui::Text("Body");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_body); // TODO: link to resources
+ ImGui::TableNextColumn();
+ ImGui::Text("Gen body");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_genBody);
+ ImGui::TableNextColumn();
+ ImGui::Text("Save gen body");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_saveGenBody);
+ ImGui::TableNextColumn();
+ ImGui::Text("Gen anim");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_genAnim);
+ ImGui::TableNextColumn();
+ ImGui::Text("Next gen anim");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_nextGenAnim);
+ ImGui::TableNextColumn();
+ ImGui::Text("Ptr anim action");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_ptrAnimAction);
+ ImGui::TableNextColumn();
+ ImGui::Text("Sprite");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i", actor->_sprite);
+ ImGui::TableNextColumn();
+ ImGui::Text("A3DS");
+ ImGui::TableNextColumn();
+ ImGui::Text("%i %i %i", actor->A3DS.Num, actor->A3DS.Deb, actor->A3DS.Fin);
+
+ ImGui::EndTable();
+ }
}
ImGui::End();
}
-static void gameState(TwinEEngine *engine) {
- if (ImGui::Begin(GAME_STATE_TITLE)) {
+static void gameStateMenu(TwinEEngine *engine) {
+ if (ImGui::BeginMenu("Game State")) {
int keys = engine->_gameState->_inventoryNumKeys;
if (ImGui::InputInt("Keys", &keys)) {
engine->_gameState->setKeys(keys);
@@ -171,52 +319,23 @@ static void gameState(TwinEEngine *engine) {
if (ImGui::InputInt("Gas", &gas)) {
engine->_gameState->setGas(gas);
}
+ ImGui::EndMenu();
}
- ImGui::End();
}
-static void holomapFlags(TwinEEngine *engine) {
- if (ImGui::Begin(HOLOMAP_FLAGS_TITLE)) {
- if (ImGui::BeginTable("###holomapflags", 8)) {
- for (int i = 0; i < engine->numHoloPos(); ++i) {
- ImGui::TableNextColumn();
- ImGui::Text("[%03d] = %d", i, engine->_gameState->_holomapFlags[i]);
- }
- ImGui::EndTable();
- }
- }
- ImGui::End();
-}
-
-static void gameFlags(TwinEEngine *engine) {
- if (ImGui::Begin(GAME_FLAGS_TITLE)) {
- ImGui::Text("Chapter %i", engine->_gameState->getChapter());
- if (ImGui::BeginTable("###gameflags", 8)) {
- for (int i = 0; i < NUM_GAME_FLAGS; ++i) {
- ImGui::TableNextColumn();
- ImGui::Text("[%03d] = %d", i, engine->_gameState->hasGameFlag(i));
- }
- ImGui::EndTable();
- }
- }
- 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);
+static void gridMenu(TwinEEngine *engine) {
+ if (ImGui::BeginMenu("Grid")) {
ImGui::Text("World cube %i %i %i", engine->_grid->_worldCube.x, engine->_grid->_worldCube.y, engine->_grid->_worldCube.z);
-
+#if 0
Grid *grid = engine->_grid;
- // Increase celling grid index
- if (ImGui::Button(ICON_MS_PLUS_ONE)) {
+
+ if (ImGui::Button(ICON_MS_ADD)) {
grid->_cellingGridIdx++;
if (grid->_cellingGridIdx > 133) {
grid->_cellingGridIdx = 133;
}
}
- // Decrease celling grid index
- if (ImGui::Button(ICON_MS_EV_SHADOW_MINUS)) {
+ if (ImGui::Button(ICON_MS_REMOVE)) {
grid->_cellingGridIdx--;
if (grid->_cellingGridIdx < 0) {
grid->_cellingGridIdx = 0;
@@ -238,58 +357,93 @@ static void grid(TwinEEngine *engine) {
engine->_scene->_needChangeScene = SCENE_CEILING_GRID_FADE_2; // tricky to make the fade
}
}
+#endif
+ ImGui::EndMenu();
}
- 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;
+static void debuggerMenu(TwinEEngine *engine) {
+ if (ImGui::BeginMenu("Debugger")) {
+ if (ImGui::MenuItem("Texts")) {
+ engine->_debugState->_openPopup = MENU_TEXT_TITLE;
}
- 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);
+ if (ImGui::MenuItem("Holomap flags")) {
+ engine->_debugState->_openPopup = HOLOMAP_FLAGS_TITLE;
+ }
+ if (ImGui::MenuItem("Game flags")) {
+ engine->_debugState->_openPopup = GAME_FLAGS_TITLE;
+ }
+
+ ImGui::SeparatorText("Actions");
+
+ if (ImGui::MenuItem("Center actor")) {
+ ActorStruct *actor = engine->_scene->getActor(OWN_ACTOR_SCENE_INDEX);
+ actor->_posObj = engine->_grid->_worldCube;
+ actor->_posObj.y += 1000;
+ }
+
+ ImGui::SeparatorText("Scene");
+
+ Scene *scene = engine->_scene;
+ GameState *gameState = engine->_gameState;
+ ImGui::Text("Scene: %i", scene->_currentSceneIdx);
+ ImGui::Text("Scene name: %s", gameState->_sceneName);
+
+ ImGui::SeparatorText("Options");
+
+ ImGui::Checkbox("Free camera", &engine->_debugState->_useFreeCamera);
+ ImGui::Checkbox("God mode", &engine->_debugState->_godMode);
+
+ if (ImGui::Checkbox("Bounding boxes", &engine->_debugState->_showingActors)) {
+ engine->_redraw->_firstTime = true;
+ }
+ if (ImGui::Checkbox("Clipping", &engine->_debugState->_showingClips)) {
+ engine->_redraw->_firstTime = true;
+ }
+ if (ImGui::Checkbox("Zones", &engine->_debugState->_showingZones)) {
+ engine->_redraw->_firstTime = true;
+ }
+
+ if (engine->_debugState->_showingZones) {
+ if (ImGui::CollapsingHeader("Zones")) {
+ static const struct ZonesDesc {
+ const char *name;
+ ZoneType type;
+ const char *desc;
+ } d[] = {
+ {"Cube", ZoneType::kCube, "Change to another scene"},
+ {"Camera", ZoneType::kCamera, "Binds camera view"},
+ {"Sceneric", ZoneType::kSceneric, "For use in Life Script"},
+ {"Grid", ZoneType::kGrid, "Set disappearing Grid fragment"},
+ {"Object", ZoneType::kObject, "Give bonus"},
+ {"Text", ZoneType::kText, "Displays text message"},
+ {"Ladder", ZoneType::kLadder, "Hero can climb on it"},
+ {"Escalator", ZoneType::kEscalator, nullptr},
+ {"Hit", ZoneType::kHit, nullptr},
+ {"Rail", ZoneType::kRail, nullptr}};
+
+ for (int i = 0; i < ARRAYSIZE(d); ++i) {
+ ImGui::CheckboxFlags(d[i].name, &engine->_debugState->_typeZones, (1u << (uint32)d[i].type));
+ if (d[i].desc) {
+ ImGui::SetTooltip(d[i].desc);
+ }
+ }
}
}
- 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)) {
- ImGui::Text("Idx %i", actor->_actorIdx);
- ImGui::Text("Pos %i %i %i", actor->_posObj.x, actor->_posObj.y, actor->_posObj.z);
- ImGui::Text("Followed %i", actor->_followedActor);
- ImGui::Text("Rotation %i", actor->_beta);
- ImGui::Text("Speed %i", actor->_speed);
- ImGui::Text("Control mode %i", actor->_controlMode);
- ImGui::Text("Delay %i", actor->_delayInMillis);
- ImGui::Text("Crop %i %i %i %i", actor->_cropLeft, actor->_cropTop, actor->_cropRight, actor->_cropBottom);
- ImGui::Text("Strength %i", actor->_strengthOfHit);
- ImGui::Text("Hit by %i", actor->_hitBy);
- ImGui::Text("Bonus %i", actor->_bonusParameter);
- ImGui::Text("Life %i", actor->_lifePoint);
- ImGui::Text("Brick shape %i", actor->brickShape());
- ImGui::Text("Brick causes damage %i", actor->brickCausesDamage());
- ImGui::Text("Collision %i", actor->_objCol);
- ImGui::Text("Body %i", actor->_body);
- ImGui::Text("Gen body %i", actor->_genBody);
- ImGui::Text("Save gen body %i", actor->_saveGenBody);
- ImGui::Text("Gen anim %i", actor->_genAnim);
- ImGui::Text("Next gen anim %i", actor->_nextGenAnim);
- ImGui::Text("Ptr anim action %i", actor->_ptrAnimAction);
- ImGui::Text("Sprite %i", actor->_sprite);
- ImGui::Text("A3DS %i %i %i", actor->A3DS.Num, actor->A3DS.Deb, actor->A3DS.Fin);
- ImGui::Text("Hit by %i", actor->_hitBy);
+ if (ImGui::BeginCombo("Scene", gameState->_sceneName)) {
+ for (int i = 0; i < engine->numHoloPos(); ++i) {
+ Common::String name = Common::String::format("[%03d] %s", i, engine->_holomap->getLocationName(i));
+ if (ImGui::Selectable(name.c_str(), i == engine->_scene->_currentSceneIdx)) {
+ scene->_currentSceneIdx = i;
+ scene->_needChangeScene = scene->_currentSceneIdx;
+ engine->_redraw->_firstTime = true;
+ }
+ }
+ ImGui::EndCombo();
}
- ImGui::End();
+
+ ImGui::EndMenu();
}
}
@@ -307,30 +461,22 @@ void onImGuiRender() {
TwinEEngine *engine = (TwinEEngine *)g_engine;
if (ImGui::BeginMainMenuBar()) {
- if (ImGui::BeginMenu("Debugger")) {
- 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);
- actor->_posObj = engine->_grid->_worldCube;
- actor->_posObj.y += 1000;
- }
- ImGui::EndMenu();
- }
+ debuggerMenu(engine);
+ gameStateMenu(engine);
+ gridMenu(engine);
ImGui::EndMainMenuBar();
}
- mainWindow(currentActor, engine);
- gameState(engine);
- grid(engine);
- menuTexts(engine);
+ actorDetailsWindow(currentActor, engine);
- // TODO: combine them
- holomapFlags(engine);
- gameFlags(engine);
+ menuTextsPopup(engine);
+ holomapFlagsPopup(engine);
+ gameFlagsPopup(engine);
- actorDetails(currentActor, engine);
+ if (engine->_debugState->_openPopup) {
+ ImGui::OpenPopup(engine->_debugState->_openPopup);
+ engine->_debugState->_openPopup = nullptr;
+ }
}
void onImGuiCleanup() {
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index 204c4fd5d91..94f49beead4 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -752,8 +752,12 @@ inline constexpr int32 FromAngle(int32 angle) {
return angle;
}
-inline double AngleToRadians(int32 angle) {
- return 2.0 * M_PI * angle / (double)LBAAngles::ANGLE_360;
+inline double AngleToDegree(int32 angle) {
+ return (double)angle / (double)LBAAngles::ANGLE_360 * 360.0;
+}
+
+inline int DegreeToAngle(double degree) {
+ return (int)(degree * (double)LBAAngles::ANGLE_360) / 360.0;
}
inline int32 ClampAngle(int32 angle) {
More information about the Scummvm-git-logs
mailing list