[Scummvm-git-logs] scummvm branch-2-8 -> c8d0d18ef8801db3aa8e6e7923cc8c0411df3584

OMGPizzaGuy noreply at scummvm.org
Sun Jan 14 20:59:43 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:
df24145433 ULTIMA8: Adjust camera box to avoid floor detected as roof during cutscenes
16587a31b1 ULTIMA8: Ensure item locations within containers are valid.
c8d0d18ef8 NEWS: Mention more Ultima 8 fixes


Commit: df2414543373031ee6e87abba88de849f5942610
    https://github.com/scummvm/scummvm/commit/df2414543373031ee6e87abba88de849f5942610
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-01-14T14:44:14-06:00

Commit Message:
ULTIMA8: Adjust camera box to avoid floor detected as roof during cutscenes
Fixes #14831

Changed paths:
    engines/ultima/ultima8/world/camera_process.cpp


diff --git a/engines/ultima/ultima8/world/camera_process.cpp b/engines/ultima/ultima8/world/camera_process.cpp
index 57a978430d7..c6bf49cb4f6 100644
--- a/engines/ultima/ultima8/world/camera_process.cpp
+++ b/engines/ultima/ultima8/world/camera_process.cpp
@@ -283,8 +283,10 @@ uint16 CameraProcess::findRoof(int32 factor) {
 	_earthquake = 0;
 	GetLerped(x, y, z, factor);
 	_earthquake = earthquake_old;
- 
-	Box target(x, y, z, 32, 32, 0);
+
+	// Default camera box based on 1x1x1 footpad,
+	// which is the minimal size to avoid floor detected as roof
+	Box target(x, y, z, 32, 32, 8);
 
 	// Should _itemNum be used when not focused on main actor?
 	Item *item = getItem(1);


Commit: 16587a31b10d156c6aaf3c2b113ccfe70e5296ba
    https://github.com/scummvm/scummvm/commit/16587a31b10d156c6aaf3c2b113ccfe70e5296ba
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-01-14T14:44:24-06:00

Commit Message:
ULTIMA8: Ensure item locations within containers are valid.
Fixes #14848

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


diff --git a/engines/ultima/ultima8/gumps/container_gump.cpp b/engines/ultima/ultima8/gumps/container_gump.cpp
index 1c04d7f11c6..425b4be8dc6 100644
--- a/engines/ultima/ultima8/gumps/container_gump.cpp
+++ b/engines/ultima/ultima8/gumps/container_gump.cpp
@@ -83,19 +83,71 @@ void ContainerGump::InitGump(Gump *newparent, bool take_focus) {
 	// U8 puts a container gump slightly to the left of an object
 }
 
-void ContainerGump::getItemCoords(Item *item, int32 &itemx, int32 &itemy) {
-	item->getGumpLocation(itemx, itemy);
+void ContainerGump::run() {
+	Gump::run();
+
+	Container *c = getContainer(_owner);
+	if (!c) {
+		// Container gone!?
+		Close();
+		return;
+	}
+
+	Std::list<Item *> &contents = c->_contents;
+	Std::list<Item *>::iterator iter;
+	for (iter = contents.begin(); iter != contents.end(); ++iter) {
+		Item *item = *iter;
+
+		int32 itemx, itemy;
+		item->getGumpLocation(itemx, itemy);
 
-	if (itemx == 0xFF && itemy == 0xFF) {
-		// randomize position
-		// TODO: maybe try to put it somewhere where it doesn't overlap others?
+		const Shape *sh = item->getShapeObject();
+		assert(sh);
+		const ShapeFrame *fr = sh->getFrame(item->getFrame());
+		assert(fr);
 
-		Common::RandomSource &rs = Ultima8Engine::get_instance()->getRandomSource();
-		itemx = rs.getRandomNumber(_itemArea.width() - 1);
-		itemy = rs.getRandomNumber(_itemArea.height() - 1);
+		// Ensure item locations within item area.
+		int32 minx = fr->_xoff;
+		int32 miny = fr->_yoff;
 
-		item->setGumpLocation(itemx, itemy);
+		int32 maxx = _itemArea.width() + fr->_xoff - fr->_width;
+		int32 maxy = _itemArea.height() + fr->_yoff - fr->_height;
+
+		if (itemx == 0xFF && itemy == 0xFF) {
+			// randomize position
+			// TODO: maybe try to put it somewhere where it doesn't overlap others?
+
+			Common::RandomSource &rs = Ultima8Engine::get_instance()->getRandomSource();
+			itemx = rs.getRandomNumberRng(minx, maxx);
+			itemy = rs.getRandomNumberRng(miny, maxy);
+
+			item->setGumpLocation(itemx, itemy);
+		}
+
+		if (itemx < minx) {
+			itemx = minx;
+			item->setGumpLocation(itemx, itemy);
+		}
+
+		if (itemx > maxx) {
+			itemx = maxx;
+			item->setGumpLocation(itemx, itemy);
+		}
+
+		if (itemy < miny) {
+			itemy = miny;
+			item->setGumpLocation(itemx, itemy);
+		}
+
+		if (itemy > maxy) {
+			itemy = maxy;
+			item->setGumpLocation(itemx, itemy);
+		}
 	}
+}
+
+void ContainerGump::getItemCoords(Item *item, int32 &itemx, int32 &itemy) {
+	item->getGumpLocation(itemx, itemy);
 
 	itemx += _itemArea.left;
 	itemy += _itemArea.top;
diff --git a/engines/ultima/ultima8/gumps/container_gump.h b/engines/ultima/ultima8/gumps/container_gump.h
index 04ac3a9fa82..68046713cd1 100644
--- a/engines/ultima/ultima8/gumps/container_gump.h
+++ b/engines/ultima/ultima8/gumps/container_gump.h
@@ -53,6 +53,8 @@ public:
 	// Init the gump, call after construction
 	void InitGump(Gump *newparent, bool take_focus = true) override;
 
+	void run() override;
+
 	// Paint the Gump
 	void PaintThis(RenderSurface *, int32 lerp_factor, bool scaled) override;
 


Commit: c8d0d18ef8801db3aa8e6e7923cc8c0411df3584
    https://github.com/scummvm/scummvm/commit/c8d0d18ef8801db3aa8e6e7923cc8c0411df3584
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2024-01-14T14:59:15-06:00

Commit Message:
NEWS: Mention more Ultima 8 fixes

Changed paths:
    NEWS.md


diff --git a/NEWS.md b/NEWS.md
index 3cba403ec35..a21fc5e3308 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -38,6 +38,8 @@ For a more comprehensive changelog of the latest experimental code, see:
    - Fix Ultima VIII text centering for plaques.
    - Fix Ultima VIII crash on dragging items to screen edge.
    - Fix Ultima VIII unexpected jumping on left click.
+   - Fix Ultima VIII camera during cutscenes for Shrine of the Ancient Ones.
+   - Fix Ultima VIII invalid placement of items within containers.
 
  Android port:
    - Fixed crash in built-in help with German language.




More information about the Scummvm-git-logs mailing list