[Scummvm-git-logs] scummvm master -> 9c52f89077a0690be3b92de8e56f85d9f1f8fdde

OMGPizzaGuy noreply at scummvm.org
Thu Apr 25 02:38: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:
9c52f89077 ULTIMA8: Fix Ultima8Engine::setVideoMode command.


Commit: 9c52f89077a0690be3b92de8e56f85d9f1f8fdde
    https://github.com/scummvm/scummvm/commit/9c52f89077a0690be3b92de8e56f85d9f1f8fdde
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-04-24T21:37:40-05:00

Commit Message:
ULTIMA8: Fix Ultima8Engine::setVideoMode command.
New width and height are not persisted, but this can be used for testing.

Changed paths:
    engines/ultima/ultima8/gumps/desktop_gump.cpp
    engines/ultima/ultima8/gumps/desktop_gump.h
    engines/ultima/ultima8/ultima8.cpp
    engines/ultima/ultima8/ultima8.h


diff --git a/engines/ultima/ultima8/gumps/desktop_gump.cpp b/engines/ultima/ultima8/gumps/desktop_gump.cpp
index 3267572958c..8de705a5951 100644
--- a/engines/ultima/ultima8/gumps/desktop_gump.cpp
+++ b/engines/ultima/ultima8/gumps/desktop_gump.cpp
@@ -70,6 +70,18 @@ void DesktopGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool sca
 	}
 }
 
+void DesktopGump::RenderSurfaceChanged() {
+	// Resize the desktop gump to match the parent
+	if (_parent) {
+		Rect new_dims;
+		_parent->GetDims(new_dims);
+		_dims.setWidth(new_dims.width());
+		_dims.setHeight(new_dims.height());
+	}
+
+	Gump::RenderSurfaceChanged();
+}
+
 void DesktopGump::saveData(Common::WriteStream *ws) {
 	warning("Trying to save DesktopGump");
 }
diff --git a/engines/ultima/ultima8/gumps/desktop_gump.h b/engines/ultima/ultima8/gumps/desktop_gump.h
index f5b727a2341..d3f7994742e 100644
--- a/engines/ultima/ultima8/gumps/desktop_gump.h
+++ b/engines/ultima/ultima8/gumps/desktop_gump.h
@@ -40,6 +40,8 @@ public:
 	DesktopGump(int32 x, int32 y, int32 width, int32 height);
 	~DesktopGump() override;
 
+	void RenderSurfaceChanged() override;
+
 	void PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
 	void PaintChildren(RenderSurface *surf, int32 lerp_factor, bool scaled) override;
 
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 9dfbd2fcc42..504058d6448 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -447,7 +447,21 @@ bool Ultima8Engine::setupGame() {
 Common::Error Ultima8Engine::startupGame() {
 	debug(MM_INFO, "-- Initializing Game: %s --", _gameInfo->_name.c_str());
 
-	GraphicSysInit();
+	if (ConfMan.hasKey("usehighres")) {
+		_highRes = ConfMan.getBool("usehighres");
+	}
+
+	if (GAME_IS_U8) {
+		ConfMan.registerDefault("width", _highRes ? U8_HIRES_SCREEN_WIDTH : U8_DEFAULT_SCREEN_WIDTH);
+		ConfMan.registerDefault("height", _highRes ? U8_HIRES_SCREEN_HEIGHT : U8_DEFAULT_SCREEN_HEIGHT);
+	} else {
+		ConfMan.registerDefault("width", _highRes ? CRUSADER_HIRES_SCREEN_WIDTH : CRUSADER_DEFAULT_SCREEN_WIDTH);
+		ConfMan.registerDefault("height", _highRes ? CRUSADER_HIRES_SCREEN_HEIGHT : CRUSADER_DEFAULT_SCREEN_HEIGHT);
+	}
+
+	int width = ConfMan.getInt("width");
+	int height = ConfMan.getInt("height");
+	changeVideoMode(width, height);
 
 	_gameData = new GameData(_gameInfo);
 
@@ -713,22 +727,7 @@ void Ultima8Engine::paint() {
 		screen->update();
 }
 
-void Ultima8Engine::GraphicSysInit() {
-	if (ConfMan.hasKey("usehighres")) {
-		_highRes = ConfMan.getBool("usehighres");
-	}
-
-	if (GAME_IS_U8) {
-		ConfMan.registerDefault("width", _highRes ? U8_HIRES_SCREEN_WIDTH : U8_DEFAULT_SCREEN_WIDTH);
-		ConfMan.registerDefault("height", _highRes ? U8_HIRES_SCREEN_HEIGHT : U8_DEFAULT_SCREEN_HEIGHT);
-	} else {
-		ConfMan.registerDefault("width", _highRes ? CRUSADER_HIRES_SCREEN_WIDTH : CRUSADER_DEFAULT_SCREEN_WIDTH);
-		ConfMan.registerDefault("height", _highRes ? CRUSADER_HIRES_SCREEN_HEIGHT : CRUSADER_DEFAULT_SCREEN_HEIGHT);
-	}
-
-	int width = ConfMan.getInt("width");
-	int height = ConfMan.getInt("height");
-
+void Ultima8Engine::changeVideoMode(int width, int height) {
 	if (_screen) {
 		Rect old_dims;
 		_screen->GetSurfaceDims(old_dims);
@@ -776,7 +775,6 @@ void Ultima8Engine::GraphicSysInit() {
 		_inverterGump->InitGump(0);
 	}
 
-
 	// Show the splash screen immediately now that the screen has been set up
 	int saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
 	if (saveSlot == -1) {
@@ -793,13 +791,6 @@ void Ultima8Engine::GraphicSysInit() {
 	paint();
 }
 
-void Ultima8Engine::changeVideoMode(int width, int height) {
-	//if (width > 0) width = ConfMan.getInt("width");
-	//if (height > 0) height = ConfMan.getInt("height");
-
-	GraphicSysInit();
-}
-
 void Ultima8Engine::handleEvent(const Common::Event &event) {
 	// Handle the fact that we can get 2 modals stacking.
 	// We want the focussed one preferrably.
diff --git a/engines/ultima/ultima8/ultima8.h b/engines/ultima/ultima8/ultima8.h
index b689add966e..27aea115dd0 100644
--- a/engines/ultima/ultima8/ultima8.h
+++ b/engines/ultima/ultima8/ultima8.h
@@ -158,9 +158,6 @@ private:
 	//! Does a Full reset of the Engine (including shutting down Video)
 //	void fullReset();
 
-	// called depending upon command line arguments
-	void GraphicSysInit(); // starts/restarts the graphics subsystem
-
 	void handleDelayedEvents();
 
 	bool pollEvent(Common::Event &event);




More information about the Scummvm-git-logs mailing list