[Scummvm-git-logs] scummvm master -> aeffe191663f2af49c51e8e194441111152af0ad

mgerhardy noreply at scummvm.org
Tue Oct 8 11:38:42 UTC 2024


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d13fd5d3cd TWINE: reduced scene debug rendering info
85403c1bf6 TWINE: fixed invalid ImGuiID handling for InputBoundingBox calls
aeffe19166 TWINE: started scene details debug window


Commit: d13fd5d3cd99dfb74d0c2a61231fa090c91ac9c9
    https://github.com/scummvm/scummvm/commit/d13fd5d3cd99dfb74d0c2a61231fa090c91ac9c9
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-08T13:20:28+02:00

Commit Message:
TWINE: reduced scene debug rendering info

this is going to be added to the zone details of the imgui windows

Changed paths:
    engines/twine/debugger/debug_state.cpp


diff --git a/engines/twine/debugger/debug_state.cpp b/engines/twine/debugger/debug_state.cpp
index b339bd13efa..bcac163322e 100644
--- a/engines/twine/debugger/debug_state.cpp
+++ b/engines/twine/debugger/debug_state.cpp
@@ -159,13 +159,12 @@ bool DebugState::displayActors() {
 		if (!drawBox(positions, COLOR_WHITE)) {
 			continue;
 		}
-		const int boxwidth = 150;
+		const int boxwidth = 75;
 		const int lineHeight = 14;
-		const int boxheight = 2 * lineHeight;
-		const Common::Rect filledRect(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, positions.frontTopRightPoint2D.x + boxwidth, positions.frontTopRightPoint2D.y + boxheight);
+		const Common::Rect filledRect(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, positions.frontTopRightPoint2D.x + boxwidth, positions.frontTopRightPoint2D.y + lineHeight);
 		_engine->_interface->box(filledRect, COLOR_WHITE);
 		_engine->_menu->drawRectBorders(filledRect);
-		_engine->drawText(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, Common::String::format("Actor: %i", a), true, true, boxwidth);
+		_engine->drawText(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, Common::String::format("Actor: %i", a), true, false, boxwidth);
 		const int16 rleft = positions.frontTopLeftPoint2D.x;
 		const int16 rtop = positions.backTopLeftPoint2D.y;
 		const int16 rright = positions.backTopRightPoint2D.x;
@@ -204,14 +203,12 @@ bool DebugState::displayZones() {
 			continue;
 		}
 
-		const int boxwidth = 150;
+		const int boxwidth = 50;
 		const int lineHeight = 14;
-		const int boxheight = 2 * lineHeight;
-		const Common::Rect filledRect(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, positions.frontTopRightPoint2D.x + boxwidth, positions.frontTopRightPoint2D.y + boxheight);
+		const Common::Rect filledRect(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, positions.frontTopRightPoint2D.x + boxwidth, positions.frontTopRightPoint2D.y + lineHeight);
 		_engine->_interface->box(filledRect, COLOR_WHITE);
 		_engine->_menu->drawRectBorders(filledRect);
-		_engine->drawText(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, Common::String::format("Type: %i (%i)", (int)zonePtr->type, i), true, false, boxwidth);
-		_engine->drawText(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y + lineHeight, Common::String::format("pos: %i:%i:%i", positions.frontTopRightPoint.x, positions.frontTopRightPoint.y, positions.frontTopRightPoint.z), true, false, boxwidth);
+		_engine->drawText(positions.frontTopRightPoint2D.x, positions.frontTopRightPoint2D.y, Common::String::format("ID: %i", i), true, false, boxwidth);
 		state = true;
 	}
 	return state;


Commit: 85403c1bf686e03bf6c6c12955b5f0a7495d0d69
    https://github.com/scummvm/scummvm/commit/85403c1bf686e03bf6c6c12955b5f0a7495d0d69
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-08T13:27:46+02:00

Commit Message:
TWINE: fixed invalid ImGuiID handling for InputBoundingBox calls

Changed paths:
    engines/twine/debugger/debugtools.cpp


diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index ea90458d612..287198d7e18 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -324,20 +324,20 @@ static void actorDetailsWindow(int &actorIdx, TwinEEngine *engine) {
 		if (actor->_body != -1) {
 			ImGui::SeparatorText("Body");
 			BodyData &bodyData = actor->_entityDataPtr->getBody(actor->_body);
-			ImGuiEx::InputBoundingBox(actor->_body, "Bounding box", bodyData.bbox);
+			ImGuiEx::InputBoundingBox((int)(uintptr)&bodyData, "Bounding box", bodyData.bbox);
 		}
 
 		ImGui::SeparatorText("Entity");
 		EntityData &entityData = actor->_entityData;
-		Common::Array<EntityBody> &bodies = entityData.getBodies();
-		ImGui::Text("Bodies: %i", (int)bodies.size());
-		for (EntityBody &body : bodies) {
-			ImGui::Text("%s index: %i", Resources::HQR_FILE3D_FILE, body.index);
+		Common::Array<EntityBody> &entityBodies = entityData.getBodies();
+		ImGui::Text("Bodies: %i", (int)entityBodies.size());
+		for (EntityBody &entityBody : entityBodies) {
+			ImGui::Text("%s index: %i", Resources::HQR_FILE3D_FILE, entityBody.index);
 			ImGui::Indent();
-			ImGui::Text("%s index: %i", Resources::HQR_BODY_FILE, body.hqrBodyIndex);
-			Common::String id = Common::String::format("Has bounding box##%i", body.index);
-			ImGui::Checkbox(id.c_str(), &body.actorBoundingBox.hasBoundingBox);
-			ImGuiEx::InputBoundingBox(body.index, "Bounding box", body.actorBoundingBox.bbox);
+			ImGui::Text("%s index: %i", Resources::HQR_BODY_FILE, entityBody.hqrBodyIndex);
+			Common::String id = Common::String::format("Has bounding box##%i", entityBody.index);
+			ImGui::Checkbox(id.c_str(), &entityBody.actorBoundingBox.hasBoundingBox);
+			ImGuiEx::InputBoundingBox((int)(uintptr)&entityBody, "Bounding box", entityBody.actorBoundingBox.bbox);
 			ImGui::Unindent();
 		}
 		Common::Array<EntityAnim> &animations = entityData.getAnimations();


Commit: aeffe191663f2af49c51e8e194441111152af0ad
    https://github.com/scummvm/scummvm/commit/aeffe191663f2af49c51e8e194441111152af0ad
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-08T13:38:24+02:00

Commit Message:
TWINE: started scene details debug window

Changed paths:
    engines/twine/debugger/debug_state.h
    engines/twine/debugger/debugtools.cpp


diff --git a/engines/twine/debugger/debug_state.h b/engines/twine/debugger/debug_state.h
index 9c87e9f5d2e..8fbec73a40f 100644
--- a/engines/twine/debugger/debug_state.h
+++ b/engines/twine/debugger/debug_state.h
@@ -86,6 +86,8 @@ public:
 	bool _holomapFlagsWindow = false;
 	bool _gameFlagsWindow = false;
 	bool _menuTextWindow = false;
+	bool _sceneDetailsWindow = false;
+	bool _actorDetailsWindow = true;
 
 	bool _useFreeCamera = false;
 	bool _disableGridRendering = false;
diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index 287198d7e18..35d0047c4b4 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -206,13 +206,85 @@ static void menuTextsWindow(TwinEEngine *engine) {
 	ImGui::End();
 }
 
+static void sceneSelectionCombo(TwinEEngine *engine) {
+	Scene *scene = engine->_scene;
+	GameState *gameState = engine->_gameState;
+	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();
+	}
+}
+
+static const struct ZonesDesc {
+	const char *name;
+	ZoneType type;
+	const char *desc;
+} ZoneDescriptions[] = {
+	{"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}};
+
+static void sceneDetailsWindows(TwinEEngine *engine) {
+	if (!engine->_debugState->_sceneDetailsWindow) {
+		return;
+	}
+	if (ImGui::Begin("Scene", &engine->_debugState->_sceneDetailsWindow)) {
+		Scene *scene = engine->_scene;
+		GameState *gameState = engine->_gameState;
+		ImGui::Text("Scene: %i", scene->_currentSceneIdx);
+		ImGui::Text("Scene name: %s", gameState->_sceneName);
+		sceneSelectionCombo(engine);
+
+		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 (ImGui::Checkbox("Tracks", &engine->_debugState->_showingTracks)) {
+		// 	engine->_redraw->_firstTime = true;
+		// }
+		if (engine->_debugState->_showingZones) {
+			if (ImGui::CollapsingHeader("Zones")) {
+				for (int i = 0; i < ARRAYSIZE(ZoneDescriptions); ++i) {
+					ImGui::CheckboxFlags(ZoneDescriptions[i].name, &engine->_debugState->_typeZones, (1u << (uint32)ZoneDescriptions[i].type));
+					if (ZoneDescriptions[i].desc) {
+						ImGui::SetTooltip(ZoneDescriptions[i].desc);
+					}
+				}
+			}
+		}
+	}
+	ImGui::End();
+}
+
 static void actorDetailsWindow(int &actorIdx, TwinEEngine *engine) {
+	if (!engine->_debugState->_actorDetailsWindow) {
+		return;
+	}
 	ActorStruct *actor = engine->_scene->getActor(actorIdx);
 	if (actor == nullptr) {
 		return;
 	}
 
-	if (ImGui::Begin(ACTOR_DETAILS_TITLE)) {
+	if (ImGui::Begin(ACTOR_DETAILS_TITLE, &engine->_debugState->_actorDetailsWindow)) {
 		if (actorIdx < 0 || actorIdx > engine->_scene->_nbObjets) {
 			actorIdx = 0;
 		}
@@ -444,6 +516,12 @@ static void debuggerMenu(TwinEEngine *engine) {
 		if (ImGui::MenuItem("Game flags")) {
 			engine->_debugState->_gameFlagsWindow = true;
 		}
+		if (ImGui::MenuItem("Scene details")) {
+			engine->_debugState->_sceneDetailsWindow = true;
+		}
+		if (ImGui::MenuItem("Actor details")) {
+			engine->_debugState->_actorDetailsWindow = true;
+		}
 
 		ImGui::SeparatorText("Actions");
 
@@ -453,66 +531,12 @@ static void debuggerMenu(TwinEEngine *engine) {
 			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);
-					}
-				}
-			}
-		}
-
-		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();
-		}
+		sceneSelectionCombo(engine);
 
 		ImGui::EndMenu();
 	}
@@ -539,7 +563,7 @@ void onImGuiRender() {
 	}
 
 	actorDetailsWindow(currentActor, engine);
-
+	sceneDetailsWindows(engine);
 	menuTextsWindow(engine);
 	holomapFlagsWindow(engine);
 	gameFlagsWindow(engine);




More information about the Scummvm-git-logs mailing list