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

OMGPizzaGuy noreply at scummvm.org
Fri Oct 13 00:28:25 UTC 2023


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:
be99ecf84c ULTIMA8: Adjust camera roof detection to match original game.


Commit: be99ecf84c56843c1e7fb27f3b0874183d22a487
    https://github.com/scummvm/scummvm/commit/be99ecf84c56843c1e7fb27f3b0874183d22a487
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2023-10-12T19:28:00-05:00

Commit Message:
ULTIMA8: Adjust camera roof detection to match original game.
This might need adjustment for when camera not focused on main actor.

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


diff --git a/engines/ultima/ultima8/gumps/game_map_gump.cpp b/engines/ultima/ultima8/gumps/game_map_gump.cpp
index 53a0a297c89..94e1ac52317 100644
--- a/engines/ultima/ultima8/gumps/game_map_gump.cpp
+++ b/engines/ultima/ultima8/gumps/game_map_gump.cpp
@@ -88,20 +88,17 @@ void GameMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
 
 	CameraProcess *camera = CameraProcess::GetCameraProcess();
 
-	uint16 roofid = 0;
 	int zlimit = 1 << 16; // should be high enough
 
 	const Item *roof = nullptr;
-	if (!camera) {
-		// Check roof
-		//!! This is _not_ the right place for this...
+	if (camera) {
+		uint16 roofid = camera->findRoof(lerp_factor);
+		roof = getItem(roofid);
+	} else {
 		const Actor *av = getMainActor();
 		Box b = av->getWorldBox();
 		PositionInfo info = map->getPositionInfo(b, b, 0, 1);
 		roof = info.roof;
-	} else {
-		roofid = camera->findRoof(lerp_factor);
-		roof = getItem(roofid);
 	}
 
 	if (roof) {
diff --git a/engines/ultima/ultima8/world/camera_process.cpp b/engines/ultima/ultima8/world/camera_process.cpp
index 38f45ae51a7..57a978430d7 100644
--- a/engines/ultima/ultima8/world/camera_process.cpp
+++ b/engines/ultima/ultima8/world/camera_process.cpp
@@ -283,14 +283,18 @@ uint16 CameraProcess::findRoof(int32 factor) {
 	_earthquake = 0;
 	GetLerped(x, y, z, factor);
 	_earthquake = earthquake_old;
-	Item *avatar = getItem(1);
-	if (!avatar) // avatar gone?
-		return 0;
-
-	int32 dx, dy, dz;
-	avatar->getFootpadWorld(dx, dy, dz);
+ 
+	Box target(x, y, z, 32, 32, 0);
+
+	// Should _itemNum be used when not focused on main actor?
+	Item *item = getItem(1);
+	if (item) {
+		int32 dx, dy, dz;
+		item->getFootpadWorld(dx, dy, dz);
+		target._xd = dx;
+		target._yd = dy;
+	}
 
-	Box target(x, y, z - 10, dx / 2, dy / 2, dz / 2);
 	PositionInfo info = World::get_instance()->getCurrentMap()->getPositionInfo(target, target, 0, 1);
 	return info.roof ? info.roof->getObjId() : 0;
 }




More information about the Scummvm-git-logs mailing list