[Scummvm-git-logs] scummvm master -> 6ae93447561bcf83de4244334e7f4e7ffd65c62b

mgerhardy noreply at scummvm.org
Tue Oct 8 13:05:00 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:
6ae9344756 TWINE: allow to give items via zu debugger interface and fixed encoding issues


Commit: 6ae93447561bcf83de4244334e7f4e7ffd65c62b
    https://github.com/scummvm/scummvm/commit/6ae93447561bcf83de4244334e7f4e7ffd65c62b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2024-10-08T15:04:24+02:00

Commit Message:
TWINE: allow to give items via zu debugger interface and fixed encoding issues

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


diff --git a/engines/twine/debugger/console.cpp b/engines/twine/debugger/console.cpp
index 511af2ee3c9..b191d02534b 100644
--- a/engines/twine/debugger/console.cpp
+++ b/engines/twine/debugger/console.cpp
@@ -65,10 +65,10 @@ TwinEConsole::TwinEConsole(TwinEEngine *engine) : _engine(engine), GUI::Debugger
 	registerCmd("set_game_flag", WRAP_METHOD(TwinEConsole, doSetGameFlag));
 	registerCmd("show_game_flag", WRAP_METHOD(TwinEConsole, doPrintGameFlag));
 	registerCmd("set_inventory_flag", WRAP_METHOD(TwinEConsole, doSetInventoryFlag));
-	registerCmd("show_inventory_flag", WRAP_METHOD(TwinEConsole, doPrintGameFlag));
+	registerCmd("show_inventory_flag", WRAP_METHOD(TwinEConsole, doPrintInventoryFlag));
 	registerCmd("set_holomap_flag", WRAP_METHOD(TwinEConsole, doSetHolomapFlag));
 	registerCmd("set_holomap_trajectory", WRAP_METHOD(TwinEConsole, doSetHolomapTrajectory));
-	registerCmd("show_holomap_flag", WRAP_METHOD(TwinEConsole, doPrintGameFlag));
+	registerCmd("show_holomap_flag", WRAP_METHOD(TwinEConsole, doPrintHolomapFlag));
 	registerCmd("toggle_enhancements", WRAP_METHOD(TwinEConsole, doToggleEnhancements));
 }
 
diff --git a/engines/twine/debugger/debugtools.cpp b/engines/twine/debugger/debugtools.cpp
index d5342238251..a99d885cfad 100644
--- a/engines/twine/debugger/debugtools.cpp
+++ b/engines/twine/debugger/debugtools.cpp
@@ -22,6 +22,8 @@
 #include "twine/debugger/debugtools.h"
 #include "backends/imgui/imgui.h"
 #include "backends/imgui/imgui_utils.h"
+#include "common/scummsys.h"
+#include "common/str-enc.h"
 #include "common/str.h"
 #include "common/util.h"
 #include "twine/debugger/debug_state.h"
@@ -227,9 +229,13 @@ static void menuTextsWindow(TwinEEngine *engine) {
 static void sceneSelectionCombo(TwinEEngine *engine) {
 	Scene *scene = engine->_scene;
 	GameState *gameState = engine->_gameState;
-	if (ImGui::BeginCombo("Scene", gameState->_sceneName)) {
+	Common::U32String originalSceneName(gameState->_sceneName, Common::kDos850);
+	const Common::String sceneName = originalSceneName.encode(Common::kUtf8);
+	if (ImGui::BeginCombo("Scene", sceneName.c_str())) {
 		for (int i = 0; i < engine->numHoloPos(); ++i) {
-			Common::String name = Common::String::format("[%03d] %s", i, engine->_holomap->getLocationName(i));
+			Common::U32String originalLocationName(engine->_holomap->getLocationName(i), Common::kDos850);
+			const Common::String locationName = originalLocationName.encode(Common::kUtf8);
+			Common::String name = Common::String::format("[%03d] %s", i, locationName.c_str());
 			if (ImGui::Selectable(name.c_str(), i == engine->_scene->_currentSceneIdx)) {
 				scene->_currentSceneIdx = i;
 				scene->_needChangeScene = scene->_currentSceneIdx;
@@ -557,6 +563,24 @@ static void gameStateMenu(TwinEEngine *engine) {
 		if (ImGui::InputInt("Gas", &gas)) {
 			engine->_gameState->setGas(gas);
 		}
+		const TextBankId oldTextBankId = engine->_text->textBank();
+		engine->_text->initDial(TextBankId::Inventory_Intro_and_Holomap);
+
+		for (int i = 0; i < NUM_INVENTORY_ITEMS; ++i) {
+			Common::String label;
+			if (engine->_text->getText((TextId)(100 + i))) {
+				Common::U32String original(engine->_text->_currDialTextEntry->string, Common::kDos850);
+				label = original.encode(Common::kUtf8).substr(0, 30);
+			} else {
+				label = Common::String::format("Item %i", i);
+			}
+			uint8 &value = engine->_gameState->_inventoryFlags[i];
+			bool hasItem = value != 0;
+			if (ImGui::Checkbox(label.c_str(), &hasItem)) {
+				value = hasItem == 0 ? 0 : 1;
+			}
+		}
+		engine->_text->initDial(oldTextBankId);
 		ImGui::EndMenu();
 	}
 }




More information about the Scummvm-git-logs mailing list