[Scummvm-git-logs] scummvm master -> 1dbc1e896118b149584ec5c872e01ed6417e0c0f

OMGPizzaGuy noreply at scummvm.org
Sun Sep 14 21:22:19 UTC 2025


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

Summary:
1dbc1e8961 ULTIMA8: Replace custom Rect with Common::Rect32


Commit: 1dbc1e896118b149584ec5c872e01ed6417e0c0f
    https://github.com/scummvm/scummvm/commit/1dbc1e896118b149584ec5c872e01ed6417e0c0f
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2025-09-14T16:13:12-05:00

Commit Message:
ULTIMA8: Replace custom Rect with Common::Rect32

Changed paths:
  R engines/ultima/ultima8/misc/rect.h
    engines/ultima/ultima8/filesys/archive.h
    engines/ultima/ultima8/gfx/fonts/font.h
    engines/ultima/ultima8/gfx/fonts/tt_font.cpp
    engines/ultima/ultima8/gfx/fonts/tt_font.h
    engines/ultima/ultima8/gfx/gump_shape_archive.cpp
    engines/ultima/ultima8/gfx/gump_shape_archive.h
    engines/ultima/ultima8/gfx/render_surface.cpp
    engines/ultima/ultima8/gfx/render_surface.h
    engines/ultima/ultima8/gfx/shape.h
    engines/ultima/ultima8/gumps/ask_gump.cpp
    engines/ultima/ultima8/gumps/bark_gump.cpp
    engines/ultima/ultima8/gumps/container_gump.h
    engines/ultima/ultima8/gumps/credits_gump.cpp
    engines/ultima/ultima8/gumps/cru_energy_gump.cpp
    engines/ultima/ultima8/gumps/cru_health_gump.cpp
    engines/ultima/ultima8/gumps/desktop_gump.cpp
    engines/ultima/ultima8/gumps/game_map_gump.cpp
    engines/ultima/ultima8/gumps/gump.cpp
    engines/ultima/ultima8/gumps/gump.h
    engines/ultima/ultima8/gumps/item_relative_gump.cpp
    engines/ultima/ultima8/gumps/menu_gump.cpp
    engines/ultima/ultima8/gumps/mini_stats_gump.cpp
    engines/ultima/ultima8/gumps/minimap_gump.cpp
    engines/ultima/ultima8/gumps/movie_gump.cpp
    engines/ultima/ultima8/gumps/paperdoll_gump.cpp
    engines/ultima/ultima8/gumps/paperdoll_gump.h
    engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
    engines/ultima/ultima8/gumps/slider_gump.cpp
    engines/ultima/ultima8/gumps/u8_save_gump.cpp
    engines/ultima/ultima8/gumps/weasel_gump.cpp
    engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
    engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
    engines/ultima/ultima8/gumps/widgets/sliding_widget.h
    engines/ultima/ultima8/gumps/widgets/text_widget.cpp
    engines/ultima/ultima8/kernel/mouse.cpp
    engines/ultima/ultima8/ultima8.cpp
    engines/ultima/ultima8/world/current_map.cpp
    engines/ultima/ultima8/world/item.cpp
    engines/ultima/ultima8/world/item_sorter.cpp
    engines/ultima/ultima8/world/item_sorter.h
    engines/ultima/ultima8/world/snap_process.cpp
    engines/ultima/ultima8/world/snap_process.h
    engines/ultima/ultima8/world/sort_item.h


diff --git a/engines/ultima/ultima8/filesys/archive.h b/engines/ultima/ultima8/filesys/archive.h
index 8e061fb338e..e286bb7f057 100644
--- a/engines/ultima/ultima8/filesys/archive.h
+++ b/engines/ultima/ultima8/filesys/archive.h
@@ -22,6 +22,13 @@
 #ifndef ULTIMA8_FILESYS_ARCHIVE_H
 #define ULTIMA8_FILESYS_ARCHIVE_H
 
+#include "common/scummsys.h"
+#include "ultima/shared/std/containers.h"
+
+namespace Common {
+	class SeekableReadStream;
+}
+
 namespace Ultima {
 namespace Ultima8 {
 
diff --git a/engines/ultima/ultima8/gfx/fonts/font.h b/engines/ultima/ultima8/gfx/fonts/font.h
index aa2358d0845..bd39901a42f 100644
--- a/engines/ultima/ultima8/gfx/fonts/font.h
+++ b/engines/ultima/ultima8/gfx/fonts/font.h
@@ -22,9 +22,10 @@
 #ifndef ULTIMA8_GFX_FONTS_FONT_H
 #define ULTIMA8_GFX_FONTS_FONT_H
 
+#include "common/rect.h"
+
 #include "ultima/shared/std/containers.h"
 #include "ultima/shared/std/string.h"
-#include "ultima/ultima8/misc/rect.h"
 #include "ultima/ultima8/misc/encoding.h"
 
 namespace Ultima {
@@ -34,7 +35,7 @@ class RenderedText;
 
 struct PositionedText {
 	Std::string _text;
-	Rect _dims;
+	Common::Rect32 _dims;
 	Std::string::size_type _cursor;
 };
 
diff --git a/engines/ultima/ultima8/gfx/fonts/tt_font.cpp b/engines/ultima/ultima8/gfx/fonts/tt_font.cpp
index 711bc2b0c66..68db1883cde 100644
--- a/engines/ultima/ultima8/gfx/fonts/tt_font.cpp
+++ b/engines/ultima/ultima8/gfx/fonts/tt_font.cpp
@@ -123,7 +123,7 @@ void TTFont::getTextSize(const Std::string &text,
 }
 
 
-void TTFont::addTextBorder(Graphics::ManagedSurface &textSurf, uint32 *texBuf, const Ultima::Ultima8::Rect &dims, int32 resultWidth, int32 resultHeight, uint32 borderColor) {
+void TTFont::addTextBorder(Graphics::ManagedSurface &textSurf, uint32 *texBuf, const Common::Rect32 &dims, int32 resultWidth, int32 resultHeight, uint32 borderColor) {
 	uint8 bA, bR, bG, bB;
 	_PF_RGBA.colorToARGB(borderColor, bA, bR, bG, bB);
 
diff --git a/engines/ultima/ultima8/gfx/fonts/tt_font.h b/engines/ultima/ultima8/gfx/fonts/tt_font.h
index 4114c0d721d..c8681182923 100644
--- a/engines/ultima/ultima8/gfx/fonts/tt_font.h
+++ b/engines/ultima/ultima8/gfx/fonts/tt_font.h
@@ -67,7 +67,7 @@ protected:
 
 	uint16 _bullet;
 
-	void addTextBorder(Graphics::ManagedSurface &textSurf, uint32 *texBuf, const Ultima::Ultima8::Rect &dims, int32 resultWidth, int32 resultHeight, uint32 borderColor);
+	void addTextBorder(Graphics::ManagedSurface &textSurf, uint32 *texBuf, const Common::Rect32 &dims, int32 resultWidth, int32 resultHeight, uint32 borderColor);
 };
 
 } // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gfx/gump_shape_archive.cpp b/engines/ultima/ultima8/gfx/gump_shape_archive.cpp
index ffb70d6a7b6..9ab914fffe7 100644
--- a/engines/ultima/ultima8/gfx/gump_shape_archive.cpp
+++ b/engines/ultima/ultima8/gfx/gump_shape_archive.cpp
@@ -19,10 +19,8 @@
  *
  */
 
-#include "ultima/ultima8/misc/debugger.h"
-
 #include "ultima/ultima8/gfx/gump_shape_archive.h"
-#include "ultima/ultima8/misc/rect.h"
+#include "common/stream.h"
 
 namespace Ultima {
 namespace Ultima8 {
@@ -41,11 +39,11 @@ void GumpShapeArchive::loadGumpage(Common::SeekableReadStream *rs) {
 		y1 = static_cast<int16>(rs->readUint16LE());
 		x2 = static_cast<int16>(rs->readUint16LE());
 		y2 = static_cast<int16>(rs->readUint16LE());
-		_gumpItemArea[i] = new Rect(x1, y1, x2, y2);
+		_gumpItemArea[i] = new Common::Rect32(x1, y1, x2, y2);
 	}
 }
 
-Rect *GumpShapeArchive::getGumpItemArea(uint32 shapenum) {
+Common::Rect32 *GumpShapeArchive::getGumpItemArea(uint32 shapenum) {
 	if (shapenum >= _gumpItemArea.size())
 		return nullptr;
 	return _gumpItemArea[shapenum];
diff --git a/engines/ultima/ultima8/gfx/gump_shape_archive.h b/engines/ultima/ultima8/gfx/gump_shape_archive.h
index 3912c65d84e..bf784d14cc1 100644
--- a/engines/ultima/ultima8/gfx/gump_shape_archive.h
+++ b/engines/ultima/ultima8/gfx/gump_shape_archive.h
@@ -23,13 +23,11 @@
 #define ULTIMA8_GFX_GUMPSHAPEARCHIVE_H
 
 #include "ultima/ultima8/gfx/shape_archive.h"
-
+#include "common/rect.h"
 
 namespace Ultima {
 namespace Ultima8 {
 
-struct Rect;
-
 class GumpShapeArchive : public ShapeArchive {
 public:
 	GumpShapeArchive(uint16 id, Palette *pal = 0,
@@ -42,10 +40,10 @@ public:
 	~GumpShapeArchive() override;
 
 	void loadGumpage(Common::SeekableReadStream *rs);
-	Rect *getGumpItemArea(uint32 shapenum);
+	Common::Rect32 *getGumpItemArea(uint32 shapenum);
 
 protected:
-	Std::vector<Rect *> _gumpItemArea;
+	Std::vector<Common::Rect32 *> _gumpItemArea;
 };
 
 } // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gfx/render_surface.cpp b/engines/ultima/ultima8/gfx/render_surface.cpp
index 9b1bdb8b08e..e311166e260 100644
--- a/engines/ultima/ultima8/gfx/render_surface.cpp
+++ b/engines/ultima/ultima8/gfx/render_surface.cpp
@@ -125,7 +125,7 @@ bool RenderSurface::EndPainting() {
 // Desc: Get the Surface Dimensions (and logical origin)
 // r: Rect object to fill
 //
-void RenderSurface::GetSurfaceDims(Rect &r) const {
+void RenderSurface::GetSurfaceDims(Common::Rect32 &r) const {
 	r.moveTo(_ox, _oy);
 	r.setWidth(_surface->w);
 	r.setHeight(_surface->h);
@@ -165,8 +165,8 @@ void RenderSurface::GetOrigin(int32 &x, int32 &y) const {
 // Desc: Get the Clipping Rectangle
 // r: Rect object to fill
 //
-void RenderSurface::GetClippingRect(Rect &r) const {
-	r = Rect(_clipWindow.left, _clipWindow.top, _clipWindow.right, _clipWindow.bottom);
+void RenderSurface::GetClippingRect(Common::Rect32 &r) const {
+	r = Common::Rect32(_clipWindow.left, _clipWindow.top, _clipWindow.right, _clipWindow.bottom);
 }
 
 //
@@ -175,7 +175,7 @@ void RenderSurface::GetClippingRect(Rect &r) const {
 // Desc: Set the Clipping Rectangle
 // r: Rect object that contains new Clipping Rectangle
 //
-void RenderSurface::SetClippingRect(const Rect &r) {
+void RenderSurface::SetClippingRect(const Common::Rect32 &r) {
 	// What we need to do is to clip the clipping rect to the phyiscal screen
 	_clipWindow = Common::Rect(r.left, r.top, r.right, r.bottom);
 	_clipWindow.clip(Common::Rect(-_ox, -_oy, -_ox + _surface->w, -_oy + _surface->h));
@@ -201,14 +201,14 @@ bool RenderSurface::IsFlipped() const {
 	return _flipped;
 }
 
-void RenderSurface::fillRect(const Rect &r, uint32 color) {
+void RenderSurface::fillRect(const Common::Rect32 &r, uint32 color) {
 	Common::Rect rect(r.left, r.top, r.right, r.bottom);
 	rect.clip(_clipWindow);
 	rect.translate(_ox, _oy);
 	_surface->fillRect(rect, color);
 }
 
-void RenderSurface::frameRect(const Rect& r, uint32 color) {
+void RenderSurface::frameRect(const Common::Rect32& r, uint32 color) {
 	Common::Rect rect(r.left, r.top, r.right, r.bottom);
 	rect.clip(_clipWindow);
 	rect.translate(_ox, _oy);
@@ -219,7 +219,7 @@ void RenderSurface::drawLine(int32 sx, int32 sy, int32 ex, int32 ey, uint32 colo
 	_surface->drawLine(sx + _ox, sy + _oy, ex + _ox, ey + _oy, color);
 }
 
-void RenderSurface::fill32(uint32 rgb, const Rect &r) {
+void RenderSurface::fill32(uint32 rgb, const Common::Rect32 &r) {
 	Common::Rect rect(r.left, r.top, r.right, r.bottom);
 	rect.clip(_clipWindow);
 	rect.translate(_ox, _oy);
@@ -268,7 +268,7 @@ void inline fillBlendedLogic(uint8 *pixels, int32 pitch, uint32 rgba, const Comm
 
 } // End of anonymous namespace
 
-void RenderSurface::fillBlended(uint32 rgba, const Rect &r) {
+void RenderSurface::fillBlended(uint32 rgba, const Common::Rect32 &r) {
 	int alpha = TEX32_A(rgba);
 	if (alpha == 0xFF) {
 		fill32(rgba, r);
@@ -286,7 +286,7 @@ void RenderSurface::fillBlended(uint32 rgba, const Rect &r) {
 		fillBlendedLogic<uint16>(_pixels, _pitch, rgba, rect, _surface->format);
 }
 
-void RenderSurface::frameRect32(uint32 rgb, const Rect &r) {
+void RenderSurface::frameRect32(uint32 rgb, const Common::Rect32 &r) {
 	Common::Rect rect(r.left, r.top, r.right, r.bottom);
 	rect.clip(_clipWindow);
 	rect.translate(_ox, _oy);
diff --git a/engines/ultima/ultima8/gfx/render_surface.h b/engines/ultima/ultima8/gfx/render_surface.h
index 3844bdfcd03..8624c0e816c 100644
--- a/engines/ultima/ultima8/gfx/render_surface.h
+++ b/engines/ultima/ultima8/gfx/render_surface.h
@@ -23,15 +23,12 @@
 #define ULTIMA8_GFX_RENDERSURFACE_H
 
 #include "graphics/managed_surface.h"
-#include "ultima/ultima8/misc/rect.h"
 
 namespace Ultima {
 namespace Ultima8 {
 
 class Shape;
 
-struct Rect;
-
 //
 // RenderSurface
 //
@@ -93,13 +90,13 @@ public:
 	void GetOrigin(int32 &x, int32 &y) const;
 
 	//! Get the Surface Dimensions
-	void GetSurfaceDims(Rect &) const;
+	void GetSurfaceDims(Common::Rect32 &) const;
 
 	//! Get Clipping Rectangle
-	void GetClippingRect(Rect &) const;
+	void GetClippingRect(Common::Rect32 &) const;
 
 	//! Set Clipping Rectangle
-	void SetClippingRect(const Rect &);
+	void SetClippingRect(const Common::Rect32 &);
 
 	//! Flip the surface
 	void SetFlipped(bool flipped);
@@ -113,27 +110,27 @@ public:
 	};
 
 	//! Fill the region with a color in the pixel format
-	void fillRect(const Rect &r, uint32 color);
+	void fillRect(const Common::Rect32 &r, uint32 color);
 
 	//! Fill the region with a color in the pixel format
-	void frameRect(const Rect &r, uint32 color);
+	void frameRect(const Common::Rect32 &r, uint32 color);
 
 	// Draw a line with a color in the pixel format
 	void drawLine(int32 sx, int32 sy, int32 ex, int32 ey, uint32 color);
 
 	//! Fill the region with a color in the TEX32_PACK_RGB format
 	void fill32(uint32 rgb, int32 sx, int32 sy, int32 w, int32 h) {
-		fill32(rgb, Rect(sx, sy, sx + w, sy + h));
+		fill32(rgb, Common::Rect32(sx, sy, sx + w, sy + h));
 	}
 
 	//! Fill the region with a color in the TEX32_PACK_RGB format
-	void fill32(uint32 rgb, const Rect &r);
+	void fill32(uint32 rgb, const Common::Rect32 &r);
 
 	//! Fill the region doing alpha blending with a color in the TEX32_PACK_RGBA format
-	void fillBlended(uint32 rgba, const Rect &r);
+	void fillBlended(uint32 rgba, const Common::Rect32 &r);
 
 	//! Fill the region with a color in the TEX32_PACK_RGB format
-	void frameRect32(uint32 rgb, const Rect &r);
+	void frameRect32(uint32 rgb, const Common::Rect32 &r);
 
 	// Draw a line with a color in the TEX32_PACK_RGB format
 	void drawLine32(uint32 rgb, int32 sx, int32 sy, int32 ex, int32 ey);
diff --git a/engines/ultima/ultima8/gfx/shape.h b/engines/ultima/ultima8/gfx/shape.h
index 5b57df58951..122085cfafd 100644
--- a/engines/ultima/ultima8/gfx/shape.h
+++ b/engines/ultima/ultima8/gfx/shape.h
@@ -32,7 +32,6 @@ namespace Ultima8 {
 class ShapeFrame;
 class RawShapeFrame;
 class Palette;
-struct Rect;
 struct ConvertShapeFormat;
 
 class Shape {
diff --git a/engines/ultima/ultima8/gumps/ask_gump.cpp b/engines/ultima/ultima8/gumps/ask_gump.cpp
index e90fe1b958f..78518afee5f 100644
--- a/engines/ultima/ultima8/gumps/ask_gump.cpp
+++ b/engines/ultima/ultima8/gumps/ask_gump.cpp
@@ -65,7 +65,7 @@ void AskGump::InitGump(Gump *newparent, bool take_focus) {
 		child->InitGump(this);
 		child->SetIndex(i);
 
-		Rect cd;
+		Common::Rect32 cd;
 		child->GetDims(cd);
 		if (i + 1 < _answers->getSize())
 			cd.setHeight(cd.height() + child->getVlead());
@@ -134,7 +134,7 @@ bool AskGump::loadData(Common::ReadStream *rs, uint32 version) {
 
 		if (!child) return false;
 
-		Rect cd;
+		Common::Rect32 cd;
 		child->GetDims(cd);
 
 		if (px + cd.width() > 160 && px != 0) {
diff --git a/engines/ultima/ultima8/gumps/bark_gump.cpp b/engines/ultima/ultima8/gumps/bark_gump.cpp
index 7288c4c0fe4..2e6b3b009fa 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.cpp
+++ b/engines/ultima/ultima8/gumps/bark_gump.cpp
@@ -107,7 +107,7 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
 		}
 	}
 
-	Rect d;
+	Common::Rect32 d;
 	widget->GetDims(d);
 	_dims.setHeight(d.height());
 	_dims.setWidth(d.width());
@@ -130,7 +130,7 @@ bool BarkGump::NextText() {
 	TextWidget *widget = dynamic_cast<TextWidget *>(getGump(_textWidget));
 	assert(widget);
 	if (widget->setupNextText()) {
-		Rect d;
+		Common::Rect32 d;
 		widget->GetDims(d);
 		_dims.setHeight(d.height());
 		_dims.setWidth(d.width());
@@ -239,7 +239,7 @@ bool BarkGump::loadData(Common::ReadStream *rs, uint32 version) {
 	if (!widget)
 		return false;
 
-	Rect d;
+	Common::Rect32 d;
 	widget->GetDims(d);
 	_dims.setHeight(d.height());
 	_dims.setWidth(d.width());
diff --git a/engines/ultima/ultima8/gumps/container_gump.h b/engines/ultima/ultima8/gumps/container_gump.h
index 68046713cd1..45e0b410d3d 100644
--- a/engines/ultima/ultima8/gumps/container_gump.h
+++ b/engines/ultima/ultima8/gumps/container_gump.h
@@ -43,7 +43,7 @@ public:
 	              uint32 flags = FLAG_DRAGGABLE, int32 layer = LAYER_NORMAL);
 	~ContainerGump() override;
 
-	void setItemArea(Rect *itemArea) {
+	void setItemArea(Common::Rect32 *itemArea) {
 		_itemArea = *itemArea;
 	}
 
@@ -87,7 +87,7 @@ protected:
 
 	void getItemCoords(Item *item, int32 &itemx, int32 &itemy);
 
-	Rect _itemArea;
+	Common::Rect32 _itemArea;
 
 	bool _displayDragging;
 	uint32 _draggingShape;
diff --git a/engines/ultima/ultima8/gumps/credits_gump.cpp b/engines/ultima/ultima8/gumps/credits_gump.cpp
index 5f233224a02..b1df55d40bf 100644
--- a/engines/ultima/ultima8/gumps/credits_gump.cpp
+++ b/engines/ultima/ultima8/gumps/credits_gump.cpp
@@ -180,7 +180,7 @@ void CreditsGump::run() {
 		if (nextblock == -1)
 			nextblock = 0;
 		// time to render next block
-		Rect bounds;
+		Common::Rect32 bounds;
 		_scroll[nextblock]->GetSurfaceDims(bounds);
 
 		uint32 color = TEX32_PACK_RGB(0, 0, 0);
diff --git a/engines/ultima/ultima8/gumps/cru_energy_gump.cpp b/engines/ultima/ultima8/gumps/cru_energy_gump.cpp
index c8d08b1eb78..c1572bf4848 100644
--- a/engines/ultima/ultima8/gumps/cru_energy_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_energy_gump.cpp
@@ -72,7 +72,7 @@ void CruEnergyGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scale
 	if (!gamepal)
 		return;
 
-	Rect rect(34, 7, 34 + width, 21);
+	Common::Rect32 rect(34, 7, 34 + width, 21);
 	surf->fillRect(rect, gamepal->_native[ENERGY_BAR_COLOR]);
 }
 
diff --git a/engines/ultima/ultima8/gumps/cru_health_gump.cpp b/engines/ultima/ultima8/gumps/cru_health_gump.cpp
index d8f51634b6d..e5bcfa5bafb 100644
--- a/engines/ultima/ultima8/gumps/cru_health_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_health_gump.cpp
@@ -64,7 +64,7 @@ void CruHealthGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scale
 	if (!gamepal)
 		return;
 
-	Rect rect(34, 7, 34 + width, 21);
+	Common::Rect32 rect(34, 7, 34 + width, 21);
 	surf->fillRect(rect, gamepal->_native[HEALTH_BAR_COLOR]);
 }
 
diff --git a/engines/ultima/ultima8/gumps/desktop_gump.cpp b/engines/ultima/ultima8/gumps/desktop_gump.cpp
index b96b076df7a..b60a13e02ca 100644
--- a/engines/ultima/ultima8/gumps/desktop_gump.cpp
+++ b/engines/ultima/ultima8/gumps/desktop_gump.cpp
@@ -65,7 +65,7 @@ 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;
+		Common::Rect32 new_dims;
 		_parent->GetDims(new_dims);
 		_dims.setWidth(new_dims.width());
 		_dims.setHeight(new_dims.height());
diff --git a/engines/ultima/ultima8/gumps/game_map_gump.cpp b/engines/ultima/ultima8/gumps/game_map_gump.cpp
index 9478a5b6f58..c89af23b448 100644
--- a/engines/ultima/ultima8/gumps/game_map_gump.cpp
+++ b/engines/ultima/ultima8/gumps/game_map_gump.cpp
@@ -105,7 +105,7 @@ void GameMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
 		zlimit = roof->getZ();
 	}
 
-	Rect clipWindow;
+	Common::Rect32 clipWindow;
 	surf->GetClippingRect(clipWindow);
 	_displayList->BeginDisplayList(clipWindow, loc);
 
@@ -601,7 +601,7 @@ void GameMapGump::DropItem(Item *item, int mx, int my) {
 
 void GameMapGump::RenderSurfaceChanged() {
 	// Resize the desktop gump to match the parent
-	Rect new_dims;
+	Common::Rect32 new_dims;
 	_parent->GetDims(new_dims);
 	_dims.setWidth(new_dims.width());
 	_dims.setHeight(new_dims.height());
diff --git a/engines/ultima/ultima8/gumps/gump.cpp b/engines/ultima/ultima8/gumps/gump.cpp
index c4391b9bc76..fc84be368f1 100644
--- a/engines/ultima/ultima8/gumps/gump.cpp
+++ b/engines/ultima/ultima8/gumps/gump.cpp
@@ -228,11 +228,11 @@ void Gump::Paint(RenderSurface *surf, int32 lerp_factor, bool scaled) {
 	surf->SetOrigin(ox + nx, oy + ny);
 
 	// Get Old Clipping Rect
-	Rect old_rect;
+	Common::Rect32 old_rect;
 	surf->GetClippingRect(old_rect);
 
 	// Set new clipping rect
-	Rect new_rect = _dims;
+	Common::Rect32 new_rect = _dims;
 	new_rect.clip(old_rect);
 	surf->SetClippingRect(new_rect);
 
@@ -277,11 +277,11 @@ void Gump::PaintCompositing(RenderSurface *surf, int32 lerp_factor,
 	surf->SetOrigin(0, 0);
 
 	// Get Old Clipping Rect
-	Rect old_rect;
+	Common::Rect32 old_rect;
 	surf->GetClippingRect(old_rect);
 
 	// Set new clipping rect
-	Rect new_rect(_dims);
+	Common::Rect32 new_rect(_dims);
 	GumpRectToScreenSpace(new_rect, ROUND_OUTSIDE);
 	new_rect.clip(old_rect);
 	surf->SetClippingRect(new_rect);
@@ -340,7 +340,7 @@ Gump *Gump::FindGump(int mx, int my) {
 
 void Gump::setRelativePosition(Gump::Position pos, int xoffset, int yoffset) {
 	if (_parent) {
-		Rect rect;
+		Common::Rect32 rect;
 		_parent->GetDims(rect);
 
 		switch (pos) {
@@ -447,7 +447,7 @@ void Gump::GumpToParent(int32 &gx, int32 &gy, PointRoundDir) {
 }
 
 // Transform a rectangle to screenspace from gumpspace
-void Gump::GumpRectToScreenSpace(Rect &gr, RectRoundDir r) {
+void Gump::GumpRectToScreenSpace(Common::Rect32 &gr, RectRoundDir r) {
 	PointRoundDir tl = (r == ROUND_INSIDE ? ROUND_BOTTOMRIGHT : ROUND_TOPLEFT);
 	PointRoundDir br = (r == ROUND_OUTSIDE ? ROUND_BOTTOMRIGHT : ROUND_TOPLEFT);
 
@@ -463,7 +463,7 @@ void Gump::GumpRectToScreenSpace(Rect &gr, RectRoundDir r) {
 }
 
 // Transform a rectangle to gumpspace from screenspace
-void Gump::ScreenSpaceToGumpRect(Rect &sr, RectRoundDir r) {
+void Gump::ScreenSpaceToGumpRect(Common::Rect32 &sr, RectRoundDir r) {
 	PointRoundDir tl = (r == ROUND_INSIDE ? ROUND_BOTTOMRIGHT : ROUND_TOPLEFT);
 	PointRoundDir br = (r == ROUND_OUTSIDE ? ROUND_BOTTOMRIGHT : ROUND_TOPLEFT);
 
diff --git a/engines/ultima/ultima8/gumps/gump.h b/engines/ultima/ultima8/gumps/gump.h
index e3e53461419..3fa05e91693 100644
--- a/engines/ultima/ultima8/gumps/gump.h
+++ b/engines/ultima/ultima8/gumps/gump.h
@@ -22,8 +22,8 @@
 #ifndef ULTIMA8_GUMPS_GUMP_H
 #define ULTIMA8_GUMPS_GUMP_H
 
+#include "common/rect.h"
 #include "ultima/ultima8/kernel/object.h"
-#include "ultima/ultima8/misc/rect.h"
 #include "ultima/ultima8/gfx/frame_id.h"
 #include "ultima/shared/std/containers.h"
 #include "ultima/ultima8/misc/classtype.h"
@@ -51,7 +51,7 @@ protected:
 	int32 _x, _y;         // Gump's position in parent.
 	// Always the upper left corner!
 
-	Rect _dims;           // The dimensions/coord space of the gump
+	Common::Rect32 _dims; // The dimensions/coord space of the gump
 	uint32 _flags;        // Gump flags
 	int32 _layer;         // gump ordering layer
 
@@ -241,12 +241,12 @@ public:
 	//
 
 	//! Get the _dims
-	virtual void GetDims(Rect &d) const {
+	virtual void GetDims(Common::Rect32 &d) const {
 		d = _dims;
 	}
 
 	//! Set the _dims
-	virtual void SetDims(const Rect &d) {
+	virtual void SetDims(const Common::Rect32 &d) {
 		_dims = d;
 	}
 
@@ -279,10 +279,10 @@ public:
 		PointRoundDir r = ROUND_TOPLEFT);
 
 	//! Transform a rectangle to screenspace from gumpspace
-	virtual void GumpRectToScreenSpace(Rect &gr, RectRoundDir r = ROUND_OUTSIDE);
+	virtual void GumpRectToScreenSpace(Common::Rect32 &gr, RectRoundDir r = ROUND_OUTSIDE);
 
 	//! Transform a rectangle to gumpspace from screenspace
-	virtual void ScreenSpaceToGumpRect(Rect &sr, RectRoundDir r = ROUND_OUTSIDE);
+	virtual void ScreenSpaceToGumpRect(Common::Rect32 &sr, RectRoundDir r = ROUND_OUTSIDE);
 
 	//! Trace a click, and return ObjId
 	virtual uint16 TraceObjId(int32 mx, int32 my);
diff --git a/engines/ultima/ultima8/gumps/item_relative_gump.cpp b/engines/ultima/ultima8/gumps/item_relative_gump.cpp
index 5f255c17ce9..f1fb66a36a5 100644
--- a/engines/ultima/ultima8/gumps/item_relative_gump.cpp
+++ b/engines/ultima/ultima8/gumps/item_relative_gump.cpp
@@ -51,7 +51,7 @@ void ItemRelativeGump::InitGump(Gump *newparent, bool take_focus) {
 
 void ItemRelativeGump::MoveOnScreen() {
 	assert(_parent);
-	Rect sd, gd;
+	Common::Rect32 sd;
 	_parent->GetDims(sd);
 
 	// first move back to our desired location
@@ -148,7 +148,7 @@ void ItemRelativeGump::GetItemLocation(int32 lerp_factor) {
 		gy = gy - it->getShapeInfo()->_z * 8 - 16;
 	} else {
 		// If location not found show near bottom center
-		Rect r;
+		Common::Rect32 r;
 		gump->GetDims(r);
 		gx = (r.left + r.right) / 2;
 		gy = r.bottom - 8;
diff --git a/engines/ultima/ultima8/gumps/menu_gump.cpp b/engines/ultima/ultima8/gumps/menu_gump.cpp
index 14abb601617..9788325a404 100644
--- a/engines/ultima/ultima8/gumps/menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/menu_gump.cpp
@@ -151,7 +151,7 @@ void MenuGump::InitGump(Gump *newparent, bool take_focus) {
 			name = av->getName();
 
 		if (!name.empty()) {
-			Rect rect;
+			Common::Rect32 rect;
 			Gump *widget = new TextWidget(0, 0, name, true, 6);
 			widget->InitGump(this, false);
 			widget->GetDims(rect);
@@ -163,7 +163,7 @@ void MenuGump::InitGump(Gump *newparent, bool take_focus) {
 		widget->InitGump(this, false);
 		widget->Move(_dims.width() / 2 + 6, 10);
 
-		Rect textdims;
+		Common::Rect32 textdims;
 		widget->GetDims(textdims);
 
 		widget = new EditWidget(0, 0, "", true, 6, 110, 40, 15); // CONSTANTS!
diff --git a/engines/ultima/ultima8/gumps/mini_stats_gump.cpp b/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
index 9fa907d06ae..d03177ab1ad 100644
--- a/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
+++ b/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
@@ -92,8 +92,8 @@ void MiniStatsGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scale
 
 	Palette *pal = PaletteManager::get_instance()->getPalette(PaletteManager::Pal_Game);
 	for (int i = 0; i < 3; ++i) {
-		Rect hprect(hpx + i, bary - hpheight + 1, hpx + i + 1, bary + 1);
-		Rect manarect(manax + i, bary - manaheight + 1, manax + i + 1, bary + 1);
+		Common::Rect32 hprect(hpx + i, bary - hpheight + 1, hpx + i + 1, bary + 1);
+		Common::Rect32 manarect(manax + i, bary - manaheight + 1, manax + i + 1, bary + 1);
 		surf->fillRect(hprect, pal->_native[hpcolour[i]]);
 		surf->fillRect(manarect, pal->_native[manacolour[i]]);
 	}
diff --git a/engines/ultima/ultima8/gumps/minimap_gump.cpp b/engines/ultima/ultima8/gumps/minimap_gump.cpp
index 2f94134a841..0e114b149c1 100644
--- a/engines/ultima/ultima8/gumps/minimap_gump.cpp
+++ b/engines/ultima/ultima8/gumps/minimap_gump.cpp
@@ -129,7 +129,7 @@ void MiniMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
 	surf->frameRect(_dims, color);
 
 	// Dimensions minus border
-	Rect dims = _dims;
+	Common::Rect32 dims = _dims;
 	dims.grow(-1);
 
 	// Fill the background
diff --git a/engines/ultima/ultima8/gumps/movie_gump.cpp b/engines/ultima/ultima8/gumps/movie_gump.cpp
index 6d3d68786c1..d2c960dbfa6 100644
--- a/engines/ultima/ultima8/gumps/movie_gump.cpp
+++ b/engines/ultima/ultima8/gumps/movie_gump.cpp
@@ -200,8 +200,8 @@ void MovieGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
 		TextWidget *subtitle = dynamic_cast<TextWidget *>(getGump(_subtitleWidget));
 		if (subtitle) {
 			int32 x, y;
-			Rect textdims;
-			Rect screendims;
+			Common::Rect32 textdims;
+			Common::Rect32 screendims;
 			subtitle->getLocation(x, y);
 			subtitle->GetDims(textdims);
 			surf->GetSurfaceDims(screendims);
diff --git a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
index a003b82337b..8807a40a1e1 100644
--- a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
+++ b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
@@ -421,9 +421,9 @@ void PaperdollGump::ChildNotify(Gump *child, uint32 message) {
 			gump->setRelativePosition(BOTTOM_RIGHT, -5, -5);
 		} else {
 			// check if it is off-screen. If so, move it back
-			Rect rect;
+			Common::Rect32 rect;
 			desktop->GetDims(rect);
-			Rect sr;
+			Common::Rect32 sr;
 			statsgump->GetDims(sr);
 			sr.grow(-2);
 			statsgump->GumpRectToScreenSpace(sr);
diff --git a/engines/ultima/ultima8/gumps/paperdoll_gump.h b/engines/ultima/ultima8/gumps/paperdoll_gump.h
index cfdb265e063..08a789ccf17 100644
--- a/engines/ultima/ultima8/gumps/paperdoll_gump.h
+++ b/engines/ultima/ultima8/gumps/paperdoll_gump.h
@@ -86,7 +86,7 @@ protected:
 	uint32 _draggingWeight;
 
 private:
-	const Rect _backpackRect;
+	const Common::Rect32 _backpackRect;
 };
 
 } // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp b/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
index 0401a3e9091..e52e5147bc2 100644
--- a/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
+++ b/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
@@ -378,7 +378,7 @@ void ShapeViewerGump::U8ShapeViewer() {
 	}
 
 	Gump *desktopGump = Ultima8Engine::get_instance()->getDesktopGump();
-	Rect res;
+	Common::Rect32 res;
 	desktopGump->GetDims(res);
 
 	int xoff, yoff, width, height;
diff --git a/engines/ultima/ultima8/gumps/slider_gump.cpp b/engines/ultima/ultima8/gumps/slider_gump.cpp
index f62c143b3a8..af3a4a52d50 100644
--- a/engines/ultima/ultima8/gumps/slider_gump.cpp
+++ b/engines/ultima/ultima8/gumps/slider_gump.cpp
@@ -114,7 +114,7 @@ void SliderGump::InitGump(Gump *newparent, bool take_focus) {
 
 	// Create the SlidingWidget
 	FrameID frame(GameData::GUMPS, slidershape, sliderframe);
-	SlidingWidget *slider = new SlidingWidget(sliderminx, slidery, frame, Rect(sliderminx, slidery, slidermaxx, slidery));
+	SlidingWidget *slider = new SlidingWidget(sliderminx, slidery, frame, Common::Rect32(sliderminx, slidery, slidermaxx, slidery));
 	slider->SetIndex(SLIDER_INDEX);
 	slider->InitGump(this);
 	slider->setValueForRange(_value, _min, _max);
diff --git a/engines/ultima/ultima8/gumps/u8_save_gump.cpp b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
index 28d1211c2c8..5a07328b307 100644
--- a/engines/ultima/ultima8/gumps/u8_save_gump.cpp
+++ b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
@@ -111,7 +111,7 @@ void U8SaveGump::InitGump(Gump *newparent, bool take_focus) {
 		if (index % 10 == 9) {
 			// HACK: There is no frame for '0', so we re-use part of the
 			// frame for '10', cutting off the first 6 pixels.
-			Rect rect;
+			Common::Rect32 rect;
 			gump->GetDims(rect);
 			rect.translate(6, 0);
 			gump->SetDims(rect);
diff --git a/engines/ultima/ultima8/gumps/weasel_gump.cpp b/engines/ultima/ultima8/gumps/weasel_gump.cpp
index 036f6265403..6268e396a0f 100644
--- a/engines/ultima/ultima8/gumps/weasel_gump.cpp
+++ b/engines/ultima/ultima8/gumps/weasel_gump.cpp
@@ -142,7 +142,7 @@ void WeaselGump::InitGump(Gump *newparent, bool take_focus) {
 	}
 
 	_ui = new WeaselUIContainerGump();
-	_ui->SetDims(Rect(0, 0, mhFrame->_width,
+	_ui->SetDims(Common::Rect32(0, 0, mhFrame->_width,
 					  tFrame->_height + mhFrame->_height + mlFrame->_height + bFrame->_height));
 	_ui->InitGump(this, false);
 	_ui->setRelativePosition(CENTER);
diff --git a/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp b/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
index ee9e78e6f5b..6226635f11e 100644
--- a/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
@@ -53,7 +53,7 @@ void EditWidget::InitGump(Gump *newparent, bool take_focus) {
 	_dims.moveTo(0, -font->getBaseline());
 
 	if (_gameFont && getFont()->isHighRes()) {
-		Rect rect(_dims);
+		Common::Rect32 rect(_dims);
 		ScreenSpaceToGumpRect(rect, ROUND_OUTSIDE);
 		_dims.moveTo(0, rect.top);
 	}
@@ -87,7 +87,7 @@ bool EditWidget::textFits(Std::string &t) {
 	int32 max_width = _multiLine ? _dims.width() : 0;
 	int32 max_height = _dims.height();
 	if (_gameFont && font->isHighRes()) {
-		Rect rect(0, 0, max_width, max_height);
+		Common::Rect32 rect(0, 0, max_width, max_height);
 		GumpRectToScreenSpace(rect, ROUND_INSIDE);
 
 		max_width = rect.width();
@@ -99,7 +99,7 @@ bool EditWidget::textFits(Std::string &t) {
 	                  Font::TEXT_LEFT, false);
 
 	if (_gameFont && font->isHighRes()) {
-		Rect rect(0, 0, width, height);
+		Common::Rect32 rect(0, 0, width, height);
 		ScreenSpaceToGumpRect(rect, ROUND_OUTSIDE);
 
 		width = rect.width();
@@ -136,7 +136,7 @@ void EditWidget::renderText() {
 		int32 max_width = _multiLine ? _dims.width() : 0;
 		int32 max_height = _dims.height();
 		if (_gameFont && font->isHighRes()) {
-			Rect rect(0, 0, max_width, max_height);
+			Common::Rect32 rect(0, 0, max_width, max_height);
 			GumpRectToScreenSpace(rect, ROUND_INSIDE);
 
 			max_width = rect.width();
@@ -182,7 +182,7 @@ void EditWidget::PaintComposited(RenderSurface *surf, int32 lerp_factor, int32 s
 
 	_cachedText->draw(surf, x, y, true);
 
-	Rect rect(_dims);
+	Common::Rect32 rect(_dims);
 	GumpRectToScreenSpace(rect, ROUND_OUTSIDE);
 }
 
diff --git a/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp b/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
index 5fdc1245a30..aa58d3ecd43 100644
--- a/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/sliding_widget.cpp
@@ -30,7 +30,7 @@ SlidingWidget::SlidingWidget()
 	: Gump(), _dragBounds() {
 }
 
-SlidingWidget::SlidingWidget(int x, int y, FrameID frame, const Rect &dragBounds)
+SlidingWidget::SlidingWidget(int x, int y, FrameID frame, const Common::Rect32 &dragBounds)
 	: Gump(x, y, 5, 5, 0, FLAG_DRAGGABLE), _dragBounds(dragBounds) {
 	SetShape(frame, true);
 	if (_dragBounds.width() < _dims.width())
diff --git a/engines/ultima/ultima8/gumps/widgets/sliding_widget.h b/engines/ultima/ultima8/gumps/widgets/sliding_widget.h
index 42005f88dae..15669678fc0 100644
--- a/engines/ultima/ultima8/gumps/widgets/sliding_widget.h
+++ b/engines/ultima/ultima8/gumps/widgets/sliding_widget.h
@@ -30,13 +30,13 @@ namespace Ultima8 {
 
 class SlidingWidget : public Gump {
 protected:
-	Rect _dragBounds;
+	Common::Rect32 _dragBounds;
 
 public:
 	ENABLE_RUNTIME_CLASSTYPE()
 
 	SlidingWidget();
-	SlidingWidget(int x, int y, FrameID frame, const Rect &dragBounds);
+	SlidingWidget(int x, int y, FrameID frame, const Common::Rect32 &dragBounds);
 	~SlidingWidget() override;
 
 	int getValueForRange(int min, int max);
diff --git a/engines/ultima/ultima8/gumps/widgets/text_widget.cpp b/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
index 91bbada1bbc..98952182463 100644
--- a/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
@@ -59,19 +59,19 @@ void TextWidget::InitGump(Gump *newparent, bool take_focus) {
 	_dims.moveTo(0, -font->getBaseline());
 
 	if (_gameFont && getFont()->isHighRes()) {
-		Rect rect(_dims);
+		Common::Rect32 rect(_dims);
 		ScreenSpaceToGumpRect(rect, ROUND_OUTSIDE);
 		_dims.moveTo(0, rect.top);
 
 		// Note that GumpRectToScreenSpace is guaranteed to keep
 		// _targetWidth/_targetHeight zero if they already were.
-		Rect target(_dims);
+		Common::Rect32 target(_dims);
 		GumpRectToScreenSpace(target, ROUND_OUTSIDE);
 
 		_targetWidth = target.width();
 		_targetHeight = target.height();
 
-		Rect sr(0, 0, _targetWidth, _targetHeight);
+		Common::Rect32 sr(0, 0, _targetWidth, _targetHeight);
 		ScreenSpaceToGumpRect(sr, ROUND_OUTSIDE);
 		_dims.setWidth(sr.width());
 		_dims.setHeight(sr.height());
@@ -87,7 +87,7 @@ int TextWidget::getVlead() {
 	int32 vlead = _cachedText->getVlead();
 
 	if (_gameFont && getFont()->isHighRes()) {
-		Rect rect(0, 0, 0, vlead);
+		Common::Rect32 rect(0, 0, 0, vlead);
 		ScreenSpaceToGumpRect(rect, ROUND_OUTSIDE);
 		vlead = rect.height();
 	}
@@ -126,14 +126,10 @@ bool TextWidget::setupNextText() {
 	if (_gameFont) {
 		Font *fontP = getFont();
 		if (fontP->isHighRes()) {
-			Rect sr(0, 0, _dims.width(), _dims.height());
+			Common::Rect32 sr(0, 0, _dims.width(), _dims.height());
 			ScreenSpaceToGumpRect(sr, ROUND_OUTSIDE);
 			_dims.setWidth(sr.width());
 			_dims.setHeight(sr.height());
-
-			sr = Rect(0, 0, 0, _dims.top);
-			ScreenSpaceToGumpRect(sr, ROUND_OUTSIDE);
-			_dims.moveTo(_dims.left, sr.height());
 		}
 	}
 
@@ -194,7 +190,7 @@ void TextWidget::PaintComposited(RenderSurface *surf, int32 lerp_factor, int32 s
 	if (dynamic_cast<ButtonWidget *>(_parent) && dynamic_cast<AskGump *>(_parent->GetParent()))
 		return;
 
-	Rect rect(_dims);
+	Common::Rect32 rect(_dims);
 	GumpRectToScreenSpace(rect, ROUND_OUTSIDE);
 }
 
diff --git a/engines/ultima/ultima8/kernel/mouse.cpp b/engines/ultima/ultima8/kernel/mouse.cpp
index 96720a5e5b3..987fea9f9a6 100644
--- a/engines/ultima/ultima8/kernel/mouse.cpp
+++ b/engines/ultima/ultima8/kernel/mouse.cpp
@@ -157,7 +157,7 @@ int Mouse::getMouseLength(int mx, int my) const {
 			return 2;
 	}
 
-	Rect dims;
+	Common::Rect32 dims;
 	RenderSurface *screen = engine->getRenderScreen();
 	screen->GetSurfaceDims(dims);
 
@@ -182,7 +182,7 @@ int Mouse::getMouseLength(int mx, int my) const {
 }
 
 Direction Mouse::getMouseDirectionWorld(int mx, int my) const {
-	Rect dims;
+	Common::Rect32 dims;
 	RenderSurface *screen = Ultima8Engine::get_instance()->getRenderScreen();
 	screen->GetSurfaceDims(dims);
 
@@ -289,7 +289,7 @@ int Mouse::mouseFrameForDir(Direction mousedir) const {
 }
 
 void Mouse::setMouseCoords(int mx, int my) {
-	Rect dims;
+	Common::Rect32 dims;
 	RenderSurface *screen = Ultima8Engine::get_instance()->getRenderScreen();
 	screen->GetSurfaceDims(dims);
 
diff --git a/engines/ultima/ultima8/misc/rect.h b/engines/ultima/ultima8/misc/rect.h
deleted file mode 100644
index 998ccd7cb91..00000000000
--- a/engines/ultima/ultima8/misc/rect.h
+++ /dev/null
@@ -1,123 +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 ULTIMA8_MISC_RECT_H
-#define ULTIMA8_MISC_RECT_H
-
-namespace Ultima {
-namespace Ultima8 {
-
-// TODO: Replace Ultima8::Rect with Common::Rect
-// The key difference between Ultima8::Rect and Common::Rect is the use of int32 for variables.
-// Attempts to change this may cause the game to be unstable.
-
-struct Rect {
-	int32 left, top;
-	int32 right, bottom;
-
-	Rect() : top(0), left(0), bottom(0), right(0) {}
-	Rect(int x1, int y1, int x2, int y2) : top(y1), left(x1), bottom(y2), right(x2) {}
-
-	bool operator==(const Rect &rhs) const { return equals(rhs); }
-	bool operator!=(const Rect &rhs) const { return !equals(rhs); }
-
-	int16 width() const { return right - left; }
-	int16 height() const { return bottom - top; }
-
-	void setWidth(int16 aWidth) {
-		right = left + aWidth;
-	}
-
-	void setHeight(int16 aHeight) {
-		bottom = top + aHeight;
-	}
-
-	void grow(int16 offset) {
-		left -= offset;
-		top -= offset;
-		right += offset;
-		bottom += offset;
-	}
-
-	// Check if the rectangle is empty (its width or length is 0) or invalid (its width or length are negative).
-	bool isEmpty() const {
-		return (left >= right || top >= bottom);
-	}
-
-	// Check to see if a Rectangle is 'valid'
-	bool isValidRect() const {
-		return (left <= right && top <= bottom);
-	}
-
-	// Check to see if a point is within the Rectangle
-	bool contains(int16 x, int16 y) const {
-		return (left <= x) && (x < right) && (top <= y) && (y < bottom);
-	}
-
-	// Check if the given Rect is contained inside this rectangle.
-	bool contains(const Rect &r) const {
-		return (left <= r.left) && (r.right <= right) && (top <= r.top) && (r.bottom <= bottom);
-	}
-
-	// Move the Rect (Relative)
-	void translate(int32 dx, int32 dy) {
-		left += dx;
-		right += dx;
-		top += dy;
-		bottom += dy;
-	}
-
-	// Move the Rect (Absolute)
-	void moveTo(int32 x, int32 y) {
-		bottom += y - top;
-		right += x - left;
-		top = y;
-		left = x;
-	}
-
-	void clip(const Rect &r) {
-		if (top < r.top) top = r.top;
-		else if (top > r.bottom) top = r.bottom;
-
-		if (left < r.left) left = r.left;
-		else if (left > r.right) left = r.right;
-
-		if (bottom < r.top) bottom = r.top;
-		else if (bottom > r.bottom) bottom = r.bottom;
-
-		if (right < r.left) right = r.left;
-		else if (right > r.right) right = r.right;
-	}
-
-	bool intersects(const Rect &r) const {
-		return (left < r.right) && (r.left < right) && (top < r.bottom) && (r.top < bottom);
-	}
-
-	bool equals(const Rect &o) const {
-		return left == o.left && top == o.top && right == o.right && bottom == o.bottom;
-	}
-
-};
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index d91d3bddf98..dfd34408290 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -720,7 +720,7 @@ void Ultima8Engine::paint() {
 	tpaint -= g_system->getMillis();
 #endif
 
-	Rect r;
+	Common::Rect32 r;
 	_screen->GetSurfaceDims(r);
 	if (_highRes)
 		_screen->fill32(TEX32_PACK_RGB(0, 0, 0), r);
@@ -749,7 +749,7 @@ void Ultima8Engine::paint() {
 
 void Ultima8Engine::changeVideoMode(int width, int height) {
 	if (_screen) {
-		Rect old_dims;
+		Common::Rect32 old_dims;
 		_screen->GetSurfaceDims(old_dims);
 		if (width == old_dims.width() && height == old_dims.height())
 			return;
@@ -789,7 +789,7 @@ void Ultima8Engine::changeVideoMode(int width, int height) {
 		_desktopGump->InitGump(0);
 		_desktopGump->MakeFocus();
 	} else {
-		_desktopGump->SetDims(Rect(0, 0, width, height));
+		_desktopGump->SetDims(Common::Rect32(0, 0, width, height));
 		_desktopGump->RenderSurfaceChanged();
 	}
 
@@ -1347,7 +1347,7 @@ void Ultima8Engine::resetEngine() {
 void Ultima8Engine::setupCoreGumps() {
 	debug(1, "Setting up core game gumps...");
 
-	Rect dims;
+	Common::Rect32 dims;
 	_screen->GetSurfaceDims(dims);
 
 	debug(1, "Creating Desktop...");
diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index e1516155d30..b0113887314 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -425,7 +425,7 @@ static inline bool ChunkOnScreen(int32 cx, int32 cy, int32 sleft, int32 stop, in
 static inline void CalcFastAreaLimits(int32 &sx_limit,
 									  int32 &sy_limit,
 									  int32 &xy_limit,
-									  const Rect &dims,
+									  const Common::Rect32 &dims,
 									  int mapChunkSize) {
 	// By default the fastArea is the screensize rounded down to the nearest
 	// map chunk, plus 3 wide and 7 high.
@@ -449,7 +449,7 @@ void CurrentMap::updateFastArea(const Point3 &from, const Point3 &to) {
 	int z_max = MAX(from.z, to.z);
 
 	// Work out Fine (screenspace) Limits of chunks with half chunk border
-	Rect dims;
+	Common::Rect32 dims;
 	Ultima8Engine::get_instance()->getGameMapGump()->GetDims(dims);
 
 	int32 sleft  = ((x_min - y_min) / 4)         - (dims.width() / 2 + _mapChunkSize / 4);
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index ce67f344ba1..610b76c2d2e 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -628,7 +628,7 @@ bool Item::isOnScreen() const {
 	if (!game_map)
 		return false;
 
-	Rect game_map_dims;
+	Common::Rect32 game_map_dims;
 	int32 screenx = -1;
 	int32 screeny = -1;
 	game_map->GetLocationOfItem(_objId, screenx, screeny);
@@ -654,7 +654,7 @@ bool Item::isPartlyOnScreen() const {
 	if (!game_map)
 		return false;
 
-	Rect game_map_dims;
+	Common::Rect32 game_map_dims;
 	int32 screenx = -1;
 	int32 screeny = -1;
 	game_map->GetLocationOfItem(_objId, screenx, screeny);
diff --git a/engines/ultima/ultima8/world/item_sorter.cpp b/engines/ultima/ultima8/world/item_sorter.cpp
index d417ed96279..81332055913 100644
--- a/engines/ultima/ultima8/world/item_sorter.cpp
+++ b/engines/ultima/ultima8/world/item_sorter.cpp
@@ -72,7 +72,7 @@ ItemSorter::~ItemSorter() {
 	}
 }
 
-void ItemSorter::BeginDisplayList(const Rect &clipWindow, const Point3 &cam) {
+void ItemSorter::BeginDisplayList(const Common::Rect32 &clipWindow, const Point3 &cam) {
 	// Get the _shapes, if required
 	if (!_shapes) _shapes = GameData::get_instance()->getMainShapes();
 
diff --git a/engines/ultima/ultima8/world/item_sorter.h b/engines/ultima/ultima8/world/item_sorter.h
index 5a710b8a62f..28fe1d6626e 100644
--- a/engines/ultima/ultima8/world/item_sorter.h
+++ b/engines/ultima/ultima8/world/item_sorter.h
@@ -22,7 +22,7 @@
 #ifndef ULTIMA8_WORLD_ITEMSORTER_H
 #define ULTIMA8_WORLD_ITEMSORTER_H
 
-#include "ultima/ultima8/misc/rect.h"
+#include "common/rect.h"
 
 namespace Ultima {
 namespace Ultima8 {
@@ -35,7 +35,7 @@ struct Point3;
 
 class ItemSorter {
 	MainShapeArchive    *_shapes;
-	Rect        _clipWindow;
+	Common::Rect32      _clipWindow;
 
 	SortItem    *_items;
 	SortItem    *_itemsTail;
@@ -55,7 +55,7 @@ public:
 	};
 
 	// Begin creating the display list
-	void BeginDisplayList(const Rect &clipWindow, const Point3 &cam);
+	void BeginDisplayList(const Common::Rect32 &clipWindow, const Point3 &cam);
 
 	void AddItem(const Point3 &pt, uint32 shape_num, uint32 frame_num, uint32 item_flags, uint32 ext_flags, uint16 item_num = 0);
 	void AddItem(const Item *);                   // Add an Item. SetupLerp() MUST have been called
diff --git a/engines/ultima/ultima8/world/snap_process.cpp b/engines/ultima/ultima8/world/snap_process.cpp
index b18fe94919c..37dcc9b0cc6 100644
--- a/engines/ultima/ultima8/world/snap_process.cpp
+++ b/engines/ultima/ultima8/world/snap_process.cpp
@@ -93,13 +93,13 @@ void SnapProcess::updateCurrentEgg() {
 	int32 axd, ayd, azd;
 	Point3 pta = a->getLocation();
 	a->getFootpadWorld(axd, ayd, azd);
-	Rect arect(pta.x, pta.y, pta.x + axd, pta.y + ayd);
+	Common::Rect32 arect(pta.x, pta.y, pta.x + axd, pta.y + ayd);
 
 	for (const auto &eggId : _snapEggs) {
 		const Item *egg = getItem(eggId);
 		if (!egg)
 			continue;
-		Rect r;
+		Common::Rect32 r;
 		Point3 pte = egg->getLocation();
 		getSnapEggRange(egg, r);
 		if (r.intersects(arect) && (pta.z <= pte.z + 0x30 && pta.z >= pte.z - 0x30)) {
@@ -121,14 +121,14 @@ void SnapProcess::removeEgg(Item *item) {
 	}
 	if (id == _currentSnapEgg) {
 		_currentSnapEgg = 0;
-		_currentSnapEggRange = Rect();
+		_currentSnapEggRange = Common::Rect32();
 	}
 }
 
 void SnapProcess::clearEggs() {
 	_snapEggs.clear();
 	_currentSnapEgg = 0;
-	_currentSnapEggRange = Rect();
+	_currentSnapEggRange = Common::Rect32();
 }
 
 
@@ -147,7 +147,7 @@ bool SnapProcess::isNpcInRangeOfCurrentEgg() const {
 	a->getFootpadWorld(axd, ayd, azd);
 	Point3 pte = currentegg->getLocation();
 
-	Rect arect(pta.x, pta.y, pta.x + axd, pta.y + ayd);
+	Common::Rect32 arect(pta.x, pta.y, pta.x + axd, pta.y + ayd);
 
 	if (!_currentSnapEggRange.intersects(arect))
 		return false;
@@ -157,7 +157,7 @@ bool SnapProcess::isNpcInRangeOfCurrentEgg() const {
 	return true;
 }
 
-void SnapProcess::getSnapEggRange(const Item *item, Rect &rect) const {
+void SnapProcess::getSnapEggRange(const Item *item, Common::Rect32 &rect) const {
 	assert(item);
 	uint16 qhi = ((item->getQuality() >> 8) & 0xff);
 	// Interpreting the values as *signed* char here is deliberate.
diff --git a/engines/ultima/ultima8/world/snap_process.h b/engines/ultima/ultima8/world/snap_process.h
index 6b44fc4116b..70682ff6e6f 100644
--- a/engines/ultima/ultima8/world/snap_process.h
+++ b/engines/ultima/ultima8/world/snap_process.h
@@ -23,7 +23,7 @@
 #define ULTIMA8_WORLD_SNAPPROCESS_H
 
 #include "ultima/ultima8/kernel/process.h"
-#include "ultima/ultima8/misc/rect.h"
+#include "common/rect.h"
 
 namespace Ultima {
 namespace Ultima8 {
@@ -51,12 +51,12 @@ public:
 protected:
 	static SnapProcess *_instance;
 
-	void getSnapEggRange(const Item *egg, Rect &rect) const;
+	void getSnapEggRange(const Item *egg, Common::Rect32 &rect) const;
 	void updateCurrentEgg();
 	bool isNpcInRangeOfCurrentEgg() const;
 
 	ObjId   _currentSnapEgg;
-	Rect	_currentSnapEggRange;
+	Common::Rect32 _currentSnapEggRange;
 	Std::list<ObjId> _snapEggs;
 };
 
diff --git a/engines/ultima/ultima8/world/sort_item.h b/engines/ultima/ultima8/world/sort_item.h
index 5edcec344bb..97754cee45d 100644
--- a/engines/ultima/ultima8/world/sort_item.h
+++ b/engines/ultima/ultima8/world/sort_item.h
@@ -23,8 +23,8 @@
 #define ULTIMA8_WORLD_SORTITEM_H
 
 #include "common/str.h"
+#include "common/rect.h"
 #include "ultima/ultima8/misc/common_types.h"
-#include "ultima/ultima8/misc/rect.h"
 #include "ultima/ultima8/misc/box.h"
 
 //#define SORTITEM_OCCLUSION_EXPERIMENTAL 1
@@ -63,7 +63,7 @@ struct SortItem {
 	uint32                  _flags;     // Item flags
 	uint32                  _extFlags;  // Item extended flags
 
-	Rect                    _sr; // Screenspace rect for shape frame
+	Common::Rect32          _sr; // Screenspace rect for shape frame
 	/*
 	            Bounding Box layout
 




More information about the Scummvm-git-logs mailing list